]> rtime.felk.cvut.cz Git - frescor/forb.git/blobdiff - forb-idl/forb-idl-c-stubs.c
IDL compiler: Invoke methods directly only within the same executor
[frescor/forb.git] / forb-idl / forb-idl-c-stubs.c
index d9542e5980b51314fd5f7122a756866552f09756..6405e32aa4b544b0bc0606b12c4361ca0c25b1d2 100644 (file)
@@ -44,9 +44,10 @@ cs_output_stub (IDL_tree     tree,
 /*             fprintf(of, "    return "FORB_RETVAL_VAR_NAME";\n"); */
 /*     } */
         fprintf(of, "  if (ev) ev->major = FORB_EX_NONE;\n");
-        fprintf(of, "  if (forb_object_is_local(_obj)) {\n");
+        fprintf(of, "  if (forb_object_is_local(_obj) &&\n"
+                          "forb_get_current_executor() == forb_object_get_executor(_obj)) {\n");
         fprintf(of, "    if (!_obj->interface ||\n"
-                    "        strncmp(_obj->interface->name, \"%s\", %d) != 0) {\n"
+                    "        strncmp(_obj->interface->name, \"%s\", %zd) != 0) {\n"
                     "      ev->major = FORB_EX_BAD_OPERATION;\n"
                     "      return %s;\n"
                     "    }\n", iface_id, strlen(iface_id), has_retval ? FORB_RETVAL_VAR_NAME : "");
@@ -68,7 +69,7 @@ cs_output_stub (IDL_tree     tree,
        fprintf(of, "    ex_on_fail(forb_request_init(&req, _obj) == 0, FORB_EX_INTERNAL);\n");
        fprintf(of, "    forb_iop_prepare_request(&req, \"%s\", FORB_METHOD_INDEX(%s), ev);\n",
                iface_id, opname);
-       fprintf(of, "    if (forb_exception_occured(ev)) goto exception;\n");
+       fprintf(of, "    if (forb_exception_occurred(ev)) goto exception;\n");
        for (sub = IDL_OP_DCL (tree).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
                IDL_tree        parm = IDL_LIST (sub).data;
                IDL_ParamRole   role;
@@ -85,9 +86,9 @@ cs_output_stub (IDL_tree     tree,
                }
        }
        fprintf(of, "    forb_request_send(&req, ev);\n");
-       fprintf(of, "    if (forb_exception_occured(ev)) goto exception;\n");
+       fprintf(of, "    if (forb_exception_occurred(ev)) goto exception;\n");
        fprintf(of, "    forb_request_wait_for_reply(&req);\n");
-       fprintf(of, "    if (forb_exception_occured(ev)) goto exception;\n");
+       fprintf(of, "    if (forb_exception_occurred(ev)) goto exception;\n");
        if (has_retval) {
          fprintf(of, "    ");
          forb_cbe_write_typespec(of, IDL_OP_DCL(tree).op_type_spec);
@@ -107,6 +108,7 @@ cs_output_stub (IDL_tree     tree,
                          fprintf(ci->fh, "    *%s = forb_malloc(sizeof(**%s));\n", name, name);
                          fprintf(ci->fh, "    if (!*%s) { ev->major = FORB_EX_NO_MEMORY; goto exception; }\n", name);
                          fprintf(ci->fh, "    memset(*%s, 0, sizeof(**%s));\n", name, name);
+                         fprintf(ci->fh, "    CORBA_sequence_set_release(*%s, CORBA_TRUE);\n", name);
                          /* TODO: Free previously allocated parameters on no memory error. */
                  }
                  fprintf(of, "    ");