3 #include "forb-idl-c-backend.h"
9 GSList *methods; /* IDLN_OP_DCLs */
14 IDL_tree cur_node; /* Current Interface */
17 } CCSmallInterfaceTraverseInfo;
21 /* static void cc_output_typecodes (IDL_tree tree, */
22 /* OIDL_C_Info *ci); */
25 /* cc_typecode_prep_sequence (IDL_tree tree, */
26 /* OIDL_C_Info *ci) */
28 /* IDL_tree seq_type; */
29 /* IDL_tree fake_seq_type = NULL; */
31 /* char *seq_type_str; */
33 /* seq_type = forb_cbe_get_typespec (IDL_TYPE_SEQUENCE (tree).simple_type_spec); */
35 /* if (IDL_NODE_TYPE (seq_type) != IDLN_INTERFACE) */
36 /* seq_type_str = forb_cbe_get_typespec_str (seq_type); */
38 /* seq_type_str = g_strdup ("CORBA_Object"); */
39 /* fake_seq_type = IDL_type_object_new (); */
42 /* type_str = forb_cbe_get_typespec_str (IDL_TYPE_SEQUENCE (tree).simple_type_spec); */
44 /* if (strcmp (type_str, seq_type_str)) { */
45 /* IDL_tree fake_seq; */
47 /* fake_seq = IDL_type_sequence_new ( */
48 /* fake_seq_type ? fake_seq_type : seq_type, */
50 /* IDL_NODE_UP (fake_seq) = IDL_NODE_UP (tree); */
52 /* cc_output_typecodes (fake_seq, ci); */
54 /* IDL_TYPE_SEQUENCE (fake_seq).simple_type_spec = NULL; */
55 /* IDL_tree_free (fake_seq); */
58 /* if (fake_seq_type) */
59 /* IDL_tree_free (fake_seq_type); */
61 /* g_free (type_str); */
62 /* g_free (seq_type_str); */
66 /* cc_output_tc_walker (IDL_tree_func_data *tfd, */
67 /* OIDL_C_Info *ci) */
69 /* IDL_tree tree = tfd->tree; */
71 /* switch(IDL_NODE_TYPE (tree)) { */
72 /* case IDLN_CONST_DCL: */
73 /* case IDLN_ATTR_DCL: */
74 /* case IDLN_OP_DCL: */
75 /* return FALSE; /\* dont recurse into these *\/ */
77 /* case IDLN_TYPE_SEQUENCE: */
78 /* if (!tfd->step) { */
79 /* cc_typecode_prep_sequence (tree, ci); */
82 /* /\* drop through *\/ */
84 /* case IDLN_INTERFACE: */
85 /* case IDLN_EXCEPT_DCL: */
86 /* case IDLN_TYPE_STRUCT: */
87 /* case IDLN_TYPE_UNION: */
88 /* case IDLN_TYPE_DCL: */
89 /* case IDLN_TYPE_ENUM: */
90 /* case IDLN_TYPE_FIXED: */
92 /* forb_output_typecode (ci, tree); */
98 /* return TRUE; /\* continue walking *\/ */
102 /* cc_output_typecodes (IDL_tree tree, */
103 /* OIDL_C_Info *ci) */
105 /* IDL_tree_walk2 (tree, NULL, IDL_WalkF_TypespecOnly, */
106 /* (IDL_tree_func) cc_output_tc_walker, */
107 /* (IDL_tree_func) cc_output_tc_walker, */
114 cc_output_ser_struct(OIDL_C_Info *ci,
117 IDL_tree cur, curmem;
119 id = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_TYPE_STRUCT(s).ident), "_", 0);
121 fprintf(ci->fh, "CORBA_boolean %s_serialize(FORB_CDR_Codec *codec, const %s *ptr)\n", id, id);
122 fprintf(ci->fh, "{\n");
123 for(cur = IDL_TYPE_STRUCT(s).member_list; cur; cur = IDL_LIST(cur).next) {
124 for(curmem = IDL_MEMBER(IDL_LIST(cur).data).dcls; curmem; curmem = IDL_LIST(curmem).next) {
125 forb_cbe_write_ser_var(
127 IDL_MEMBER(IDL_LIST(cur).data).type_spec,
128 IDL_LIST(curmem).data,
135 fprintf(ci->fh, " return CORBA_TRUE;\n"
137 " return CORBA_FALSE;\n"
140 fprintf(ci->fh, "CORBA_boolean %s_deserialize(FORB_CDR_Codec *codec, %s *ptr)\n", id, id);
141 fprintf(ci->fh, "{\n");
142 for(cur = IDL_TYPE_STRUCT(s).member_list; cur; cur = IDL_LIST(cur).next) {
143 for(curmem = IDL_MEMBER(IDL_LIST(cur).data).dcls; curmem; curmem = IDL_LIST(curmem).next) {
144 forb_cbe_write_ser_var(
146 IDL_MEMBER(IDL_LIST(cur).data).type_spec,
147 IDL_LIST(curmem).data,
154 fprintf(ci->fh, " return CORBA_TRUE;\n"
156 " return CORBA_FALSE;\n"
164 cc_output_ser_seqence(OIDL_C_Info *ci,
167 //IDL_tree cur, curmem;
171 id = forb_cbe_get_typespec_str(s);
172 type = forb_cbe_get_typespec_str(IDL_TYPE_SEQUENCE(s).simple_type_spec);
176 r = CORBA_unsigned_long_serialize(codec, (val)->_length);
177 for (i=0; i<(val)->_length && r; i++)
178 r = type ## _serialize(codec, &((val)->_buffer[i]));
180 tts = forb_cbe_get_typespec(IDL_TYPE_SEQUENCE(s).simple_type_spec);
181 fake_if = (IDL_NODE_TYPE(tts) == IDLN_INTERFACE);
183 /* Header file already contains defines for CORBA_sequence_Object_[de]serialize */
187 fprintf(ci->fh, "CORBA_boolean %s_serialize(FORB_CDR_Codec *codec, const %s *seq)\n", id, id);
188 fprintf(ci->fh, "{\n"
190 " CORBA_boolean ok;\n"
191 " ok = CORBA_unsigned_long_serialize(codec, &seq->_length);\n"
192 " for (i = 0; i<seq->_length && ok; i++)\n");
193 fprintf(ci->fh, " ok = %s_serialize(codec, &(seq->_buffer[i]));\n", type);
195 fprintf(ci->fh, " return ok;\n"
198 fprintf(ci->fh, "CORBA_boolean %s_deserialize(FORB_CDR_Codec *codec, %s *seq)\n", id, id);
199 fprintf(ci->fh, "{\n"
201 " CORBA_boolean ok;\n"
202 " ok = CORBA_unsigned_long_deserialize(codec, &seq->_length);\n"
204 " seq->_buffer = %s_allocbuf(seq->_length);\n"
205 " CORBA_sequence_set_release(seq, CORBA_TRUE);\n"
207 " for (i = 0; i<seq->_length && ok; i++)\n", id);
208 fprintf(ci->fh, " ok = %s_deserialize(codec, &(seq->_buffer[i]));\n", type);
210 fprintf(ci->fh, " return ok;\n"
218 cc_output_ser_typedef_array(OIDL_C_Info *ci,
224 for(cur = IDL_TYPE_DCL(tree).dcls; cur; cur = IDL_LIST(cur).next) {
225 if (IDL_NODE_TYPE(IDL_LIST(cur).data) == IDLN_TYPE_ARRAY) {
226 id = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_TYPE_ARRAY(IDL_LIST(cur).data).ident), "_", 0);
227 fprintf(ci->fh, "CORBA_boolean %s_serialize(FORB_CDR_Codec *codec, const %s array)\n", id, id);
228 fprintf(ci->fh, "{\n");
229 forb_cbe_write_ser_var(
231 IDL_TYPE_DCL(tree).type_spec,
236 fprintf(ci->fh, " return CORBA_TRUE;\n"
238 " return CORBA_FALSE;\n"
241 fprintf(ci->fh, "CORBA_boolean %s_deserialize(FORB_CDR_Codec *codec, %s array)\n", id, id);
242 fprintf(ci->fh, "{\n");
243 forb_cbe_write_ser_var(
245 IDL_TYPE_DCL(tree).type_spec,
250 fprintf(ci->fh, " return CORBA_TRUE;\n"
252 " return CORBA_FALSE;\n"
260 forb_output_serialization (OIDL_C_Info *ci,
263 switch (IDL_NODE_TYPE (node)) {
265 cc_output_ser_typedef_array(ci, node);
267 case IDLN_TYPE_STRUCT:
268 cc_output_ser_struct(ci, node);
270 case IDLN_TYPE_UNION:
272 case IDLN_EXCEPT_DCL:
275 case IDLN_TYPE_SEQUENCE:
276 cc_output_ser_seqence(ci, node);
279 g_error ("You can't produce a serialization for a %s",
280 IDL_tree_type_names[IDL_NODE_TYPE (node)]);
284 /* tci.structname = forb_generate_tcstruct_name (node); */
285 /* tci.substructname = NULL; */
286 /* tci.array_gen_ctr = 0; */
288 /* cbe_tc_generate (ci, &tci); */
290 /* g_free (tci.structname); */
294 cc_output_serialization_walker (IDL_tree_func_data *tfd,
297 IDL_tree tree = tfd->tree;
299 switch(IDL_NODE_TYPE (tree)) {
303 return FALSE; /* dont recurse into these */
305 case IDLN_TYPE_SEQUENCE:
306 /* if (!tfd->step) { */
307 /* cc_typecode_prep_sequence (tree, ci); */
313 case IDLN_EXCEPT_DCL:
314 case IDLN_TYPE_STRUCT:
315 case IDLN_TYPE_UNION:
318 case IDLN_TYPE_FIXED:
320 forb_output_serialization (ci, tree);
323 if (!IDL_SRCFILE(tree).isTop) {
331 return TRUE; /* continue walking */
335 cc_output_serialization (IDL_tree tree,
338 IDL_tree_walk2 (tree, NULL, IDL_WalkF_TypespecOnly,
339 (IDL_tree_func) cc_output_serialization_walker,
340 (IDL_tree_func) cc_output_serialization_walker,
349 /* cc_output_class_id (IDL_tree tree, */
350 /* OIDL_Run_Info *rinfo, */
351 /* OIDL_C_Info *ci) */
353 /* char *iface_id; */
355 /* iface_id = IDL_ns_ident_to_qstring ( */
356 /* IDL_IDENT_TO_NS (IDL_INTERFACE (tree).ident), "_", 0); */
358 /* fprintf (ci->fh, "\n#ifndef FORB_IDL_C_IMODULE_%s\n",ci->c_base_name); */
359 /* fprintf (ci->fh, "CORBA_unsigned_long %s__classid = 0;\n", iface_id); */
360 /* fprintf (ci->fh, "#endif\n"); */
362 /* g_free (iface_id); */
366 /* cc_output_class_ids (IDL_tree tree, */
367 /* OIDL_Run_Info *rinfo, */
368 /* OIDL_C_Info *ci) */
370 /* if (!tree || (tree->declspec & IDLF_DECLSPEC_PIDL)) */
373 /* switch (IDL_NODE_TYPE (tree)) { */
374 /* case IDLN_MODULE: */
375 /* cc_output_class_ids (IDL_MODULE (tree).definition_list, rinfo, ci); */
377 /* case IDLN_LIST: { */
380 /* for (node = tree; node; node = IDL_LIST (node).next) */
381 /* cc_output_class_ids (IDL_LIST (node).data, rinfo, ci); */
384 /* case IDLN_INTERFACE: */
385 /* cc_output_class_id (tree, rinfo, ci); */
395 /* cc_output_iargs (FILE *of, const char *method, IDL_tree tree) */
398 /* int arg_count = 0; */
400 /* /\* Build a list of IArgs *\/ */
401 /* for (sub = IDL_OP_DCL (tree).parameter_dcls; sub; */
402 /* sub = IDL_LIST (sub).next) { */
406 /* if (!arg_count) */
407 /* fprintf (of, "static Forb_IArg %s__arginfo [] = {\n", method); */
409 /* parm = IDL_LIST(sub).data; */
411 /* fprintf (of, "\t{ "); */
413 /* /\* TypeCode tc *\/ */
414 /* tc = forb_cbe_get_typecode_name ( */
415 /* IDL_PARAM_DCL (parm).param_type_spec); */
417 /* g_warning ("Can't get typecode"); */
418 /* tc = g_strdup ("NULL /\* no typecode *\/"); */
420 /* fprintf (of, "%s, ", tc); */
422 /* /\* IArgFlag flags *\/ */
423 /* switch (IDL_PARAM_DCL (parm).attr) { */
424 /* case IDL_PARAM_IN: */
425 /* fprintf (of, " Forb_I_ARG_IN "); */
427 /* case IDL_PARAM_OUT: */
428 /* fprintf (of, " Forb_I_ARG_OUT "); */
430 /* case IDL_PARAM_INOUT: */
431 /* fprintf (of, " Forb_I_ARG_INOUT "); */
435 /* if (forb_cbe_type_is_fixed_length ( */
436 /* IDL_PARAM_DCL (parm).param_type_spec)) */
437 /* fprintf (of, "| Forb_I_COMMON_FIXED_SIZE"); */
439 /* else if (IDL_PARAM_DCL(parm).attr == IDL_PARAM_OUT) { */
441 /* IDL_tree ts = forb_cbe_get_typespec ( */
442 /* IDL_PARAM_DCL (parm).param_type_spec); */
444 /* switch(IDL_NODE_TYPE (ts)) { */
445 /* case IDLN_TYPE_STRUCT: */
446 /* case IDLN_TYPE_UNION: */
447 /* case IDLN_TYPE_ARRAY: */
448 /* /\* fprintf (of, "| FORB_I_ARG_FIXED");*\/ */
455 /* fprintf (of, ", "); */
457 /* /\* string name *\/ */
458 /* fprintf (of, "(char *)\"%s\"", IDL_IDENT (IDL_PARAM_DCL ( */
459 /* IDL_LIST (sub).data).simple_declarator).str); */
461 /* fprintf (of, " }%s\n", IDL_LIST (sub).next ? "," : ""); */
468 /* fprintf (of, "};\n"); */
472 /* cc_output_contexts (FILE *of, const char *method, IDL_tree tree) */
474 /* /\* Build a list of contest names *\/ */
475 /* if (IDL_OP_DCL (tree).context_expr) { */
476 /* IDL_tree curitem; */
478 /* fprintf (of, "/\* Exceptions *\/\n"); */
479 /* fprintf (of, "static CORBA_string %s__contextinfo [] = {\n", */
482 /* for (curitem = IDL_OP_DCL (tree).context_expr; curitem; */
483 /* curitem = IDL_LIST (curitem).next) { */
484 /* fprintf (of, "\"%s\"%c", */
485 /* IDL_STRING (IDL_LIST (curitem).data).value, */
486 /* IDL_LIST (curitem).next ? ',' : ' '); */
489 /* fprintf (of, "};\n"); */
494 /* cc_output_exceptinfo (FILE *of, const char *method, IDL_tree tree) */
496 /* /\* Build a list of exception typecodes *\/ */
497 /* if (IDL_OP_DCL (tree).raises_expr) { */
498 /* IDL_tree curitem; */
500 /* fprintf (of, "/\* Exceptions *\/\n"); */
501 /* fprintf (of, "static CORBA_TypeCode %s__exceptinfo [] = {\n", */
504 /* for (curitem = IDL_OP_DCL (tree).raises_expr; curitem; */
505 /* curitem = IDL_LIST(curitem).next) { */
507 /* IDL_tree curnode = IDL_LIST(curitem).data; */
509 /* type_id = forb_cbe_get_typecode_name (curnode); */
510 /* fprintf (of, "\t%s,\n", type_id); */
511 /* g_free (type_id); */
513 /* fprintf (of, "\tNULL\n};\n"); */
518 /* cc_output_method_bits (IDL_tree tree, const char *id, OIDL_C_Info *ci) */
520 /* FILE *of = ci->fh; */
521 /* char *fullname; */
523 /* fullname = g_strconcat (id, "_", IDL_IDENT ( */
524 /* IDL_OP_DCL (tree).ident).str, NULL); */
526 /* cc_output_iargs (of, fullname, tree); */
528 /* cc_output_contexts (of, fullname, tree); */
530 /* cc_output_exceptinfo (of, fullname, tree); */
532 /* g_free (fullname); */
536 /* cc_output_method (FILE *of, IDL_tree tree, const char *id) */
539 /* int except_count; */
540 /* int context_count; */
541 /* const char *method; */
542 /* char *fullname; */
544 /* fullname = g_strconcat (id, "_", IDL_IDENT ( */
545 /* IDL_OP_DCL (tree).ident).str, NULL); */
547 /* arg_count = IDL_list_length (IDL_OP_DCL (tree).parameter_dcls); */
548 /* except_count = IDL_list_length (IDL_OP_DCL (tree).raises_expr); */
549 /* context_count = IDL_list_length (IDL_OP_DCL (tree).context_expr); */
551 /* fprintf (of, "\t{\n"); */
553 /* /\* IArgs arguments *\/ */
555 /* fprintf (of, "\t\t{ %d, %d, %s__arginfo, FALSE },\n", */
556 /* arg_count, arg_count, fullname); */
558 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
560 /* /\* IContexts contexts *\/ */
561 /* if (context_count) */
562 /* fprintf (of, "\t\t{ %d, %d, %s__contextinfo, FALSE },\n", */
563 /* context_count, context_count, fullname); */
565 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
567 /* /\* ITypes exceptions *\/ */
568 /* if (IDL_OP_DCL (tree).raises_expr) */
569 /* fprintf (of, "\t\t{ %d, %d, %s__exceptinfo, FALSE },\n", */
570 /* except_count, except_count, fullname); */
572 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
574 /* /\* TypeCode ret *\/ */
575 /* if (IDL_OP_DCL (tree).op_type_spec) { */
578 /* type_id = forb_cbe_get_typespec_str ( */
579 /* IDL_OP_DCL (tree).op_type_spec); */
580 /* fprintf (of, "\t\tTC_%s, ", type_id); */
581 /* g_free (type_id); */
583 /* fprintf (of, "TC_void, "); */
585 /* /\* string name, long name_len *\/ */
586 /* method = IDL_IDENT (IDL_OP_DCL (tree).ident).str; */
587 /* fprintf (of, "(char *)\"%s\", %d,\n", method, strlen (method)); */
589 /* /\* IMethodFlags flags *\/ */
590 /* fprintf (of, "\t\t0"); */
592 /* if (IDL_OP_DCL(tree).f_oneway) */
593 /* fprintf (of, " | Forb_I_METHOD_1_WAY"); */
595 /* /\* FIXME: re-scan for no_out *\/ */
596 /* /\* if (no_out) */
597 /* fprintf (of, " | Forb_I_METHOD_NO_OUT");*\/ */
599 /* if (IDL_OP_DCL (tree).op_type_spec && */
600 /* forb_cbe_type_is_fixed_length ( */
601 /* IDL_OP_DCL (tree).op_type_spec)) */
602 /* fprintf (of, "| Forb_I_COMMON_FIXED_SIZE"); */
604 /* if (IDL_OP_DCL(tree).context_expr) */
605 /* fprintf (of, "| Forb_I_METHOD_HAS_CONTEXT"); */
607 /* fprintf (of, "\n}\n"); */
609 /* g_free (fullname); */
613 /* cc_output_base_itypes(IDL_tree node, CCSmallInterfaceTraverseInfo *iti) */
615 /* if (iti->cur_node == node) */
618 /* fprintf (iti->of, "(char *)\"%s\",\n", */
619 /* IDL_IDENT(IDL_INTERFACE(node).ident).repo_id); */
621 /* iti->parents++; */
625 /* cc_output_itypes (GSList *list, OIDL_C_Info *ci) */
628 /* FILE *of = ci->fh; */
630 /* for (l = list; l; l = l->next) { */
631 /* CCSmallInterfaceTraverseInfo iti; */
632 /* Interface *i = l->data; */
636 /* id = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS ( */
637 /* IDL_INTERFACE (i->tree).ident), "_", 0); */
639 /* for (m = i->methods; m; m = m->next) */
640 /* cc_output_method_bits (m->data, id, ci); */
642 /* if (i->methods) { */
643 /* fprintf (of, "\n#ifdef FORB_IDL_C_IMODULE_%s\n", */
644 /* ci->c_base_name); */
645 /* fprintf (of, "static\n"); */
646 /* fprintf (of, "#endif\n"); */
648 /* fprintf (of, "Forb_IMethod %s__imethods [] = {\n", id); */
650 /* if (!(m = i->methods)) */
651 /* fprintf (of, "{{0}}"); */
653 /* else for (; m; m = m->next) { */
654 /* cc_output_method (of, m->data, id); */
656 /* fprintf(of, ", "); */
659 /* fprintf (of, "};\n\n"); */
662 /* fprintf (of, "static CORBA_string %s__base_itypes[] = {\n", id); */
665 /* iti.cur_node = i->tree; */
666 /* iti.cur_id = id; */
667 /* iti.parents = 0; */
668 /* IDL_tree_traverse_parents(i->tree, (GFunc)cc_output_base_itypes, &iti); */
670 /* fprintf (of, "(char *)\"IDL:omg.org/CORBA/Object:1.0\"\n};"); */
672 /* fprintf (of, "\n#ifdef FORB_IDL_C_IMODULE_%s\n", */
673 /* ci->c_base_name); */
674 /* fprintf (of, "static\n"); */
675 /* fprintf (of, "#endif\n"); */
676 /* fprintf (of, "Forb_IInterface %s__iinterface = {\n", id); */
677 /* fprintf (of, "TC_%s,", id); */
678 /* fprintf (of, "{%d, %d, %s__imethods, FALSE},\n", */
679 /* g_slist_length (i->methods), */
680 /* g_slist_length (i->methods), id); */
682 /* fprintf (of, "{%d, %d, %s__base_itypes, FALSE}\n", */
683 /* iti.parents + 1, iti.parents + 1, id); */
685 /* fprintf (of, "};\n\n"); */
690 /* for (l = list; l; l = l->next) { */
691 /* g_slist_free (((Interface *)l->data)->methods); */
692 /* g_free (l->data); */
695 /* g_slist_free (list); */
698 /* static GSList * */
699 /* cc_build_interfaces (GSList *list, IDL_tree tree) */
704 /* switch (IDL_NODE_TYPE (tree)) { */
705 /* case IDLN_MODULE: */
706 /* list = cc_build_interfaces ( */
707 /* list, IDL_MODULE (tree).definition_list); */
709 /* case IDLN_LIST: { */
711 /* for (sub = tree; sub; sub = IDL_LIST (sub).next) */
712 /* list = cc_build_interfaces ( */
713 /* list, IDL_LIST (sub).data); */
716 /* case IDLN_ATTR_DCL: { */
717 /* IDL_tree curitem; */
719 /* for (curitem = IDL_ATTR_DCL (tree).simple_declarations; */
720 /* curitem; curitem = IDL_LIST (curitem).next) { */
721 /* OIDL_Attr_Info *ai = IDL_LIST (curitem).data->data; */
723 /* list = cc_build_interfaces (list, ai->op1); */
725 /* list = cc_build_interfaces (list, ai->op2); */
729 /* case IDLN_INTERFACE: { */
730 /* Interface *i = g_new0 (Interface, 1); */
732 /* i->tree = tree; */
734 /* list = g_slist_append (list, i); */
736 /* list = cc_build_interfaces (list, IDL_INTERFACE(tree).body); */
740 /* case IDLN_OP_DCL: { */
743 /* g_return_val_if_fail (list != NULL, NULL); */
745 /* i = ( g_slist_last(list) )->data; */
746 /* i->methods = g_slist_append (i->methods, tree); */
749 /* case IDLN_EXCEPT_DCL: */
759 /* cc_output_skel (IDL_tree tree, */
760 /* OIDL_C_Info *ci, */
764 /* gboolean has_retval; */
768 /* g_return_if_fail (idx != NULL); */
770 /* intf = IDL_get_parent_node (tree, IDLN_INTERFACE, NULL); */
772 /* has_retval = IDL_OP_DCL (tree).op_type_spec != NULL; */
774 /* opname = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_OP_DCL (tree).ident), "_", 0); */
775 /* ifname = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_INTERFACE (intf).ident), "_", 0); */
777 /* fprintf (ci->fh, "void _FORB_skel_small_%s(" */
778 /* "POA_%s *_o_servant, " */
779 /* "gpointer _o_retval," */
780 /* "gpointer *_o_args," */
781 /* "CORBA_Context _o_ctx," */
782 /* "CORBA_Environment *_o_ev,\n", opname, ifname); */
784 /* forb_cbe_op_write_proto (ci->fh, tree, "_impl_", TRUE); */
786 /* fprintf (ci->fh, ") {\n"); */
788 /* if (has_retval) { */
789 /* fprintf (ci->fh, "*("); */
790 /* forb_cbe_write_param_typespec (ci->fh, tree); */
791 /* fprintf (ci->fh, " *)_o_retval = "); */
794 /* fprintf (ci->fh, "_impl_%s (_o_servant, ", IDL_IDENT (IDL_OP_DCL (tree).ident).str); */
796 /* forb_cbe_unflatten_args (tree, ci->fh, "_o_args"); */
798 /* if (IDL_OP_DCL (tree).context_expr) */
799 /* fprintf (ci->fh, "_o_ctx, "); */
801 /* fprintf (ci->fh, "_o_ev);\n"); */
803 /* fprintf (ci->fh, "}\n"); */
805 /* g_free (opname); */
806 /* g_free (ifname); */
812 /* cc_output_skels (IDL_tree tree, */
813 /* OIDL_Run_Info *rinfo, */
814 /* OIDL_C_Info *ci, */
817 /* if (!tree || (tree->declspec & IDLF_DECLSPEC_PIDL)) */
820 /* switch (IDL_NODE_TYPE (tree)) { */
821 /* case IDLN_MODULE: */
822 /* cc_output_skels (IDL_MODULE (tree).definition_list, rinfo, ci, idx); */
824 /* case IDLN_LIST: { */
827 /* for (node = tree; node; node = IDL_LIST (node).next) */
828 /* cc_output_skels (IDL_LIST (node).data, rinfo, ci, idx); */
831 /* case IDLN_ATTR_DCL: { */
832 /* OIDL_Attr_Info *ai = tree->data; */
835 /* for (node = IDL_ATTR_DCL (tree).simple_declarations; node; node = IDL_LIST (node).next) { */
836 /* ai = IDL_LIST (node).data->data; */
838 /* cc_output_skels (ai->op1, rinfo, ci, idx); */
840 /* cc_output_skels (ai->op2, rinfo, ci, idx); */
844 /* case IDLN_INTERFACE: { */
845 /* int real_idx = 0; */
847 /* cc_output_skels (IDL_INTERFACE (tree).body, rinfo, ci, &real_idx); */
850 /* case IDLN_OP_DCL: */
851 /* cc_output_skel (tree, ci, idx); */
859 forb_idl_output_c_common (IDL_tree tree,
860 OIDL_Run_Info *rinfo,
863 fprintf (ci->fh, OIDL_C_WARNING);
864 /* fprintf (ci->fh, "#include <string.h>\n"); */
865 /* fprintf (ci->fh, "#define FORB2_STUBS_API\n"); */
866 /* fprintf (ci->fh, "#define FORB_IDL_C_COMMON\n"); */
867 /* fprintf (ci->fh, "#define %s_COMMON\n", ci->c_base_name); */
868 fprintf (ci->fh, "#include \"%s.h\"\n", ci->base_name);
869 fprintf (ci->fh, "#include <forb/cdr.h>\n");
870 fprintf (ci->fh, "#include <forb/object.h>\n\n");
871 /* fprintf (ci->fh, "static const CORBA_unsigned_long Forb_zero_int = 0;\n"); */
873 /* FIXME: this is slightly nasty, but we need these in common,
874 and this fixes an internal build issue */
875 /* if (rinfo->enabled_passes & OUTPUT_SKELS || */
876 /* rinfo->enabled_passes & OUTPUT_STUBS) { */
877 /* fprintf (ci->fh, "\n#ifndef FORB_IDL_C_IMODULE_%s\n",ci->c_base_name); */
878 /* cc_output_skels (tree, rinfo, ci, NULL); */
879 /* fprintf (ci->fh, "\n#endif\n"); */
882 cc_output_serialization (tree, ci);
883 /* cc_output_typecodes (tree, ci); */
885 /* cc_output_class_ids (tree, rinfo, ci); */
887 /* if (rinfo->idata) { */
888 /* GSList *list = NULL; */
890 /* fprintf (ci->fh, "\n/\* Interface type data *\/\n\n"); */
892 /* list = cc_build_interfaces (list, tree); */
893 /* cc_output_itypes (list, ci); */