]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
forb-idl: Better handling of PIDL (Pseudo-IDL)
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 26 Aug 2008 15:58:48 +0000 (17:58 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 26 Aug 2008 16:03:27 +0000 (18:03 +0200)
forb-idl/forb-idl-c-headers.c
forb-idl/forb-idl-c-stubs.c

index 7414fa4312eeead6e3e9f0c1ea509e4c470191bd..0cde62ce6b5d41f5b2d9e4b5f12744a3c68882c5 100644 (file)
@@ -428,13 +428,14 @@ ch_output_interface(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
     fullname = forb_cbe_get_typespec_str(tree);
     fprintf(ci->fh, "#if !defined(FORB_DECL_%s) && !defined(_%s_defined)\n#define FORB_DECL_%s 1\n#define _%s_defined 1\n", fullname, fullname, fullname, fullname);
 
-/*     if ( tree->declspec & IDLF_DECLSPEC_PIDL ) { */
-/*         /\* PIDL interfaces are not normal CORBA Objects *\/ */
+    if ( tree->declspec & IDLF_DECLSPEC_PIDL ) {
+        /* PIDL interfaces are not normal CORBA Objects */
+      fprintf(ci->fh, "// PIDL: %s\n", fullname);
 /*             fprintf(ci->fh, "typedef struct %s_type *%s;\n", fullname, fullname); */
 /*     fprintf(ci->fh, "#ifndef TC_%s\n", fullname); */
 /*     fprintf(ci->fh, "#  define TC_%s TC_CORBA_Object\n", fullname); */
 /*     fprintf(ci->fh, "#endif\n"); */
-/*     } else { */
+    } else {
 
 /*         fprintf(ci->fh, "#define %s__freekids CORBA_Object__freekids\n", fullname); */
        fprintf(ci->fh, "typedef forb_object %s;\n", fullname);
@@ -448,9 +449,9 @@ ch_output_interface(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
                fullname, fullname, fullname);
        
        /* ch_type_alloc_and_tc(tree, rinfo, ci, FALSE); */
-/*     } */
+    }
 
-    fprintf(ci->fh, "#endif\n");
+    fprintf(ci->fh, "#endif\n\n");
     g_free(fullname);
 }
 
index 75c66a62ac7ae469b4e75654f37ae640cdd45004..6c376d73242216f81fb899a6f0b7aaa891804533 100644 (file)
@@ -68,7 +68,7 @@ cs_output_stub (IDL_tree     tree,
                    "    CDR_Codec codec;\n"
                    "    forb_request_handle_t req;\n"
                    "    CDR_codec_init_static(&codec);\n"
-                   "    ex_on_fail(CDR_buffer_init(&codec, 256), FORB_EX_NO_MEMORY);\n");
+                   "    ex_on_fail(CDR_buffer_init(&codec, 256, FORB_REQEST_HDR_SIZE), FORB_EX_NO_MEMORY);\n");
 /*     fprintf(of, "    forb_prepare_request(&codec, _obj, FORB_METHOD_INDEX(%s));\n", */
 /*             opname); */
        for (sub = IDL_OP_DCL (tree).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
@@ -157,11 +157,14 @@ cs_output_stubs (IDL_tree     tree,
        case IDLN_INTERFACE: {
                int real_idx = 0;
                char *id;
-               id = IDL_ns_ident_to_qstring (IDL_INTERFACE (tree).ident, "_", 0);
-               fprintf(ci->fh, "#define _%s_impl(obj) ((struct forb_%s_impl*)(obj)->implementation)\n\n",
-                       id, id);
-               g_free(id);
-               cs_output_stubs (IDL_INTERFACE (tree).body, ci, &real_idx);
+               /* Do not output skeletons for PIDL interfaces */
+               if ((tree->declspec & IDLF_DECLSPEC_PIDL) == 0) {
+                 id = IDL_ns_ident_to_qstring (IDL_INTERFACE (tree).ident, "_", 0);
+                 fprintf(ci->fh, "#define _%s_impl(obj) ((struct forb_%s_impl*)(obj)->implementation)\n\n",
+                         id, id);
+                 g_free(id);
+                 cs_output_stubs (IDL_INTERFACE (tree).body, ci, &real_idx);
+               }
                break;
                }
        case IDLN_OP_DCL:
@@ -180,9 +183,11 @@ forb_idl_output_c_stubs (IDL_tree       tree,
        fprintf (ci->fh, OIDL_C_WARNING);
        fprintf (ci->fh, "#include <string.h>\n");
 /*     fprintf (ci->fh, "#define FORB2_STUBS_API\n"); */
+       fprintf (ci->fh, "#include <forb/forb-idl.h>\n");
        fprintf (ci->fh, "#include \"%s.h\"\n\n", ci->base_name);
 
-       fprintf (ci->fh, "#define ex_on_fail(command, ex) if (!(command)) do { ev->major = (ex); goto exception; } while(0)\n\n");
+       fprintf (ci->fh, "#define ex_on_fail(command, ex) if (!(command)) do { ev->major = (ex); goto exception; } while(0)\n");
+       fprintf (ci->fh, "#define FORB_REQEST_HDR_SIZE (forb_iop_MESSAGE_HEADER_SIZE + forb_iop_REQUEST_HEADER_SIZE)\n\n");
 
        cs_output_stubs (tree, ci, NULL);
 }