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"
200 " CORBA_unsigned_long i;\n"
201 " CORBA_boolean ok;\n"
202 " ok = CORBA_unsigned_long_deserialize(codec, &i);\n"
204 " ok = forb_sequence_alloc_buf(seq, i);\n"
205 " seq->_length = i;\n"
206 " CORBA_sequence_set_release(seq, CORBA_TRUE);\n"
208 " for (i = 0; i<seq->_length && ok; i++)\n");
209 fprintf(ci->fh, " ok = %s_deserialize(codec, &(seq->_buffer[i]));\n", type);
211 fprintf(ci->fh, " return ok;\n"
219 cc_output_ser_typedef_array(OIDL_C_Info *ci,
225 for(cur = IDL_TYPE_DCL(tree).dcls; cur; cur = IDL_LIST(cur).next) {
226 if (IDL_NODE_TYPE(IDL_LIST(cur).data) == IDLN_TYPE_ARRAY) {
227 id = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_TYPE_ARRAY(IDL_LIST(cur).data).ident), "_", 0);
228 fprintf(ci->fh, "CORBA_boolean %s_serialize(FORB_CDR_Codec *codec, const %s array)\n", id, id);
229 fprintf(ci->fh, "{\n");
230 forb_cbe_write_ser_var(
232 IDL_TYPE_DCL(tree).type_spec,
237 fprintf(ci->fh, " return CORBA_TRUE;\n"
239 " return CORBA_FALSE;\n"
242 fprintf(ci->fh, "CORBA_boolean %s_deserialize(FORB_CDR_Codec *codec, %s array)\n", id, id);
243 fprintf(ci->fh, "{\n");
244 forb_cbe_write_ser_var(
246 IDL_TYPE_DCL(tree).type_spec,
251 fprintf(ci->fh, " return CORBA_TRUE;\n"
253 " return CORBA_FALSE;\n"
261 forb_output_serialization (OIDL_C_Info *ci,
264 switch (IDL_NODE_TYPE (node)) {
266 cc_output_ser_typedef_array(ci, node);
268 case IDLN_TYPE_STRUCT:
269 cc_output_ser_struct(ci, node);
271 case IDLN_TYPE_UNION:
273 case IDLN_EXCEPT_DCL:
276 case IDLN_TYPE_SEQUENCE:
277 cc_output_ser_seqence(ci, node);
280 g_error ("You can't produce a serialization for a %s",
281 IDL_tree_type_names[IDL_NODE_TYPE (node)]);
285 /* tci.structname = forb_generate_tcstruct_name (node); */
286 /* tci.substructname = NULL; */
287 /* tci.array_gen_ctr = 0; */
289 /* cbe_tc_generate (ci, &tci); */
291 /* g_free (tci.structname); */
295 cc_output_serialization_walker (IDL_tree_func_data *tfd,
298 IDL_tree tree = tfd->tree;
300 switch(IDL_NODE_TYPE (tree)) {
304 return FALSE; /* dont recurse into these */
306 case IDLN_TYPE_SEQUENCE:
307 /* if (!tfd->step) { */
308 /* cc_typecode_prep_sequence (tree, ci); */
314 case IDLN_EXCEPT_DCL:
315 case IDLN_TYPE_STRUCT:
316 case IDLN_TYPE_UNION:
319 case IDLN_TYPE_FIXED:
321 forb_output_serialization (ci, tree);
324 if (!IDL_SRCFILE(tree).isTop) {
332 return TRUE; /* continue walking */
336 cc_output_serialization (IDL_tree tree,
339 IDL_tree_walk2 (tree, NULL, IDL_WalkF_TypespecOnly,
340 (IDL_tree_func) cc_output_serialization_walker,
341 (IDL_tree_func) cc_output_serialization_walker,
350 /* cc_output_class_id (IDL_tree tree, */
351 /* OIDL_Run_Info *rinfo, */
352 /* OIDL_C_Info *ci) */
354 /* char *iface_id; */
356 /* iface_id = IDL_ns_ident_to_qstring ( */
357 /* IDL_IDENT_TO_NS (IDL_INTERFACE (tree).ident), "_", 0); */
359 /* fprintf (ci->fh, "\n#ifndef FORB_IDL_C_IMODULE_%s\n",ci->c_base_name); */
360 /* fprintf (ci->fh, "CORBA_unsigned_long %s__classid = 0;\n", iface_id); */
361 /* fprintf (ci->fh, "#endif\n"); */
363 /* g_free (iface_id); */
367 /* cc_output_class_ids (IDL_tree tree, */
368 /* OIDL_Run_Info *rinfo, */
369 /* OIDL_C_Info *ci) */
371 /* if (!tree || (tree->declspec & IDLF_DECLSPEC_PIDL)) */
374 /* switch (IDL_NODE_TYPE (tree)) { */
375 /* case IDLN_MODULE: */
376 /* cc_output_class_ids (IDL_MODULE (tree).definition_list, rinfo, ci); */
378 /* case IDLN_LIST: { */
381 /* for (node = tree; node; node = IDL_LIST (node).next) */
382 /* cc_output_class_ids (IDL_LIST (node).data, rinfo, ci); */
385 /* case IDLN_INTERFACE: */
386 /* cc_output_class_id (tree, rinfo, ci); */
396 /* cc_output_iargs (FILE *of, const char *method, IDL_tree tree) */
399 /* int arg_count = 0; */
401 /* /\* Build a list of IArgs *\/ */
402 /* for (sub = IDL_OP_DCL (tree).parameter_dcls; sub; */
403 /* sub = IDL_LIST (sub).next) { */
407 /* if (!arg_count) */
408 /* fprintf (of, "static Forb_IArg %s__arginfo [] = {\n", method); */
410 /* parm = IDL_LIST(sub).data; */
412 /* fprintf (of, "\t{ "); */
414 /* /\* TypeCode tc *\/ */
415 /* tc = forb_cbe_get_typecode_name ( */
416 /* IDL_PARAM_DCL (parm).param_type_spec); */
418 /* g_warning ("Can't get typecode"); */
419 /* tc = g_strdup ("NULL /\* no typecode *\/"); */
421 /* fprintf (of, "%s, ", tc); */
423 /* /\* IArgFlag flags *\/ */
424 /* switch (IDL_PARAM_DCL (parm).attr) { */
425 /* case IDL_PARAM_IN: */
426 /* fprintf (of, " Forb_I_ARG_IN "); */
428 /* case IDL_PARAM_OUT: */
429 /* fprintf (of, " Forb_I_ARG_OUT "); */
431 /* case IDL_PARAM_INOUT: */
432 /* fprintf (of, " Forb_I_ARG_INOUT "); */
436 /* if (forb_cbe_type_is_fixed_length ( */
437 /* IDL_PARAM_DCL (parm).param_type_spec)) */
438 /* fprintf (of, "| Forb_I_COMMON_FIXED_SIZE"); */
440 /* else if (IDL_PARAM_DCL(parm).attr == IDL_PARAM_OUT) { */
442 /* IDL_tree ts = forb_cbe_get_typespec ( */
443 /* IDL_PARAM_DCL (parm).param_type_spec); */
445 /* switch(IDL_NODE_TYPE (ts)) { */
446 /* case IDLN_TYPE_STRUCT: */
447 /* case IDLN_TYPE_UNION: */
448 /* case IDLN_TYPE_ARRAY: */
449 /* /\* fprintf (of, "| FORB_I_ARG_FIXED");*\/ */
456 /* fprintf (of, ", "); */
458 /* /\* string name *\/ */
459 /* fprintf (of, "(char *)\"%s\"", IDL_IDENT (IDL_PARAM_DCL ( */
460 /* IDL_LIST (sub).data).simple_declarator).str); */
462 /* fprintf (of, " }%s\n", IDL_LIST (sub).next ? "," : ""); */
469 /* fprintf (of, "};\n"); */
473 /* cc_output_contexts (FILE *of, const char *method, IDL_tree tree) */
475 /* /\* Build a list of contest names *\/ */
476 /* if (IDL_OP_DCL (tree).context_expr) { */
477 /* IDL_tree curitem; */
479 /* fprintf (of, "/\* Exceptions *\/\n"); */
480 /* fprintf (of, "static CORBA_string %s__contextinfo [] = {\n", */
483 /* for (curitem = IDL_OP_DCL (tree).context_expr; curitem; */
484 /* curitem = IDL_LIST (curitem).next) { */
485 /* fprintf (of, "\"%s\"%c", */
486 /* IDL_STRING (IDL_LIST (curitem).data).value, */
487 /* IDL_LIST (curitem).next ? ',' : ' '); */
490 /* fprintf (of, "};\n"); */
495 /* cc_output_exceptinfo (FILE *of, const char *method, IDL_tree tree) */
497 /* /\* Build a list of exception typecodes *\/ */
498 /* if (IDL_OP_DCL (tree).raises_expr) { */
499 /* IDL_tree curitem; */
501 /* fprintf (of, "/\* Exceptions *\/\n"); */
502 /* fprintf (of, "static CORBA_TypeCode %s__exceptinfo [] = {\n", */
505 /* for (curitem = IDL_OP_DCL (tree).raises_expr; curitem; */
506 /* curitem = IDL_LIST(curitem).next) { */
508 /* IDL_tree curnode = IDL_LIST(curitem).data; */
510 /* type_id = forb_cbe_get_typecode_name (curnode); */
511 /* fprintf (of, "\t%s,\n", type_id); */
512 /* g_free (type_id); */
514 /* fprintf (of, "\tNULL\n};\n"); */
519 /* cc_output_method_bits (IDL_tree tree, const char *id, OIDL_C_Info *ci) */
521 /* FILE *of = ci->fh; */
522 /* char *fullname; */
524 /* fullname = g_strconcat (id, "_", IDL_IDENT ( */
525 /* IDL_OP_DCL (tree).ident).str, NULL); */
527 /* cc_output_iargs (of, fullname, tree); */
529 /* cc_output_contexts (of, fullname, tree); */
531 /* cc_output_exceptinfo (of, fullname, tree); */
533 /* g_free (fullname); */
537 /* cc_output_method (FILE *of, IDL_tree tree, const char *id) */
540 /* int except_count; */
541 /* int context_count; */
542 /* const char *method; */
543 /* char *fullname; */
545 /* fullname = g_strconcat (id, "_", IDL_IDENT ( */
546 /* IDL_OP_DCL (tree).ident).str, NULL); */
548 /* arg_count = IDL_list_length (IDL_OP_DCL (tree).parameter_dcls); */
549 /* except_count = IDL_list_length (IDL_OP_DCL (tree).raises_expr); */
550 /* context_count = IDL_list_length (IDL_OP_DCL (tree).context_expr); */
552 /* fprintf (of, "\t{\n"); */
554 /* /\* IArgs arguments *\/ */
556 /* fprintf (of, "\t\t{ %d, %d, %s__arginfo, FALSE },\n", */
557 /* arg_count, arg_count, fullname); */
559 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
561 /* /\* IContexts contexts *\/ */
562 /* if (context_count) */
563 /* fprintf (of, "\t\t{ %d, %d, %s__contextinfo, FALSE },\n", */
564 /* context_count, context_count, fullname); */
566 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
568 /* /\* ITypes exceptions *\/ */
569 /* if (IDL_OP_DCL (tree).raises_expr) */
570 /* fprintf (of, "\t\t{ %d, %d, %s__exceptinfo, FALSE },\n", */
571 /* except_count, except_count, fullname); */
573 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
575 /* /\* TypeCode ret *\/ */
576 /* if (IDL_OP_DCL (tree).op_type_spec) { */
579 /* type_id = forb_cbe_get_typespec_str ( */
580 /* IDL_OP_DCL (tree).op_type_spec); */
581 /* fprintf (of, "\t\tTC_%s, ", type_id); */
582 /* g_free (type_id); */
584 /* fprintf (of, "TC_void, "); */
586 /* /\* string name, long name_len *\/ */
587 /* method = IDL_IDENT (IDL_OP_DCL (tree).ident).str; */
588 /* fprintf (of, "(char *)\"%s\", %d,\n", method, strlen (method)); */
590 /* /\* IMethodFlags flags *\/ */
591 /* fprintf (of, "\t\t0"); */
593 /* if (IDL_OP_DCL(tree).f_oneway) */
594 /* fprintf (of, " | Forb_I_METHOD_1_WAY"); */
596 /* /\* FIXME: re-scan for no_out *\/ */
597 /* /\* if (no_out) */
598 /* fprintf (of, " | Forb_I_METHOD_NO_OUT");*\/ */
600 /* if (IDL_OP_DCL (tree).op_type_spec && */
601 /* forb_cbe_type_is_fixed_length ( */
602 /* IDL_OP_DCL (tree).op_type_spec)) */
603 /* fprintf (of, "| Forb_I_COMMON_FIXED_SIZE"); */
605 /* if (IDL_OP_DCL(tree).context_expr) */
606 /* fprintf (of, "| Forb_I_METHOD_HAS_CONTEXT"); */
608 /* fprintf (of, "\n}\n"); */
610 /* g_free (fullname); */
614 /* cc_output_base_itypes(IDL_tree node, CCSmallInterfaceTraverseInfo *iti) */
616 /* if (iti->cur_node == node) */
619 /* fprintf (iti->of, "(char *)\"%s\",\n", */
620 /* IDL_IDENT(IDL_INTERFACE(node).ident).repo_id); */
622 /* iti->parents++; */
626 /* cc_output_itypes (GSList *list, OIDL_C_Info *ci) */
629 /* FILE *of = ci->fh; */
631 /* for (l = list; l; l = l->next) { */
632 /* CCSmallInterfaceTraverseInfo iti; */
633 /* Interface *i = l->data; */
637 /* id = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS ( */
638 /* IDL_INTERFACE (i->tree).ident), "_", 0); */
640 /* for (m = i->methods; m; m = m->next) */
641 /* cc_output_method_bits (m->data, id, ci); */
643 /* if (i->methods) { */
644 /* fprintf (of, "\n#ifdef FORB_IDL_C_IMODULE_%s\n", */
645 /* ci->c_base_name); */
646 /* fprintf (of, "static\n"); */
647 /* fprintf (of, "#endif\n"); */
649 /* fprintf (of, "Forb_IMethod %s__imethods [] = {\n", id); */
651 /* if (!(m = i->methods)) */
652 /* fprintf (of, "{{0}}"); */
654 /* else for (; m; m = m->next) { */
655 /* cc_output_method (of, m->data, id); */
657 /* fprintf(of, ", "); */
660 /* fprintf (of, "};\n\n"); */
663 /* fprintf (of, "static CORBA_string %s__base_itypes[] = {\n", id); */
666 /* iti.cur_node = i->tree; */
667 /* iti.cur_id = id; */
668 /* iti.parents = 0; */
669 /* IDL_tree_traverse_parents(i->tree, (GFunc)cc_output_base_itypes, &iti); */
671 /* fprintf (of, "(char *)\"IDL:omg.org/CORBA/Object:1.0\"\n};"); */
673 /* fprintf (of, "\n#ifdef FORB_IDL_C_IMODULE_%s\n", */
674 /* ci->c_base_name); */
675 /* fprintf (of, "static\n"); */
676 /* fprintf (of, "#endif\n"); */
677 /* fprintf (of, "Forb_IInterface %s__iinterface = {\n", id); */
678 /* fprintf (of, "TC_%s,", id); */
679 /* fprintf (of, "{%d, %d, %s__imethods, FALSE},\n", */
680 /* g_slist_length (i->methods), */
681 /* g_slist_length (i->methods), id); */
683 /* fprintf (of, "{%d, %d, %s__base_itypes, FALSE}\n", */
684 /* iti.parents + 1, iti.parents + 1, id); */
686 /* fprintf (of, "};\n\n"); */
691 /* for (l = list; l; l = l->next) { */
692 /* g_slist_free (((Interface *)l->data)->methods); */
693 /* g_free (l->data); */
696 /* g_slist_free (list); */
699 /* static GSList * */
700 /* cc_build_interfaces (GSList *list, IDL_tree tree) */
705 /* switch (IDL_NODE_TYPE (tree)) { */
706 /* case IDLN_MODULE: */
707 /* list = cc_build_interfaces ( */
708 /* list, IDL_MODULE (tree).definition_list); */
710 /* case IDLN_LIST: { */
712 /* for (sub = tree; sub; sub = IDL_LIST (sub).next) */
713 /* list = cc_build_interfaces ( */
714 /* list, IDL_LIST (sub).data); */
717 /* case IDLN_ATTR_DCL: { */
718 /* IDL_tree curitem; */
720 /* for (curitem = IDL_ATTR_DCL (tree).simple_declarations; */
721 /* curitem; curitem = IDL_LIST (curitem).next) { */
722 /* OIDL_Attr_Info *ai = IDL_LIST (curitem).data->data; */
724 /* list = cc_build_interfaces (list, ai->op1); */
726 /* list = cc_build_interfaces (list, ai->op2); */
730 /* case IDLN_INTERFACE: { */
731 /* Interface *i = g_new0 (Interface, 1); */
733 /* i->tree = tree; */
735 /* list = g_slist_append (list, i); */
737 /* list = cc_build_interfaces (list, IDL_INTERFACE(tree).body); */
741 /* case IDLN_OP_DCL: { */
744 /* g_return_val_if_fail (list != NULL, NULL); */
746 /* i = ( g_slist_last(list) )->data; */
747 /* i->methods = g_slist_append (i->methods, tree); */
750 /* case IDLN_EXCEPT_DCL: */
760 /* cc_output_skel (IDL_tree tree, */
761 /* OIDL_C_Info *ci, */
765 /* gboolean has_retval; */
769 /* g_return_if_fail (idx != NULL); */
771 /* intf = IDL_get_parent_node (tree, IDLN_INTERFACE, NULL); */
773 /* has_retval = IDL_OP_DCL (tree).op_type_spec != NULL; */
775 /* opname = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_OP_DCL (tree).ident), "_", 0); */
776 /* ifname = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_INTERFACE (intf).ident), "_", 0); */
778 /* fprintf (ci->fh, "void _FORB_skel_small_%s(" */
779 /* "POA_%s *_o_servant, " */
780 /* "gpointer _o_retval," */
781 /* "gpointer *_o_args," */
782 /* "CORBA_Context _o_ctx," */
783 /* "CORBA_Environment *_o_ev,\n", opname, ifname); */
785 /* forb_cbe_op_write_proto (ci->fh, tree, "_impl_", TRUE); */
787 /* fprintf (ci->fh, ") {\n"); */
789 /* if (has_retval) { */
790 /* fprintf (ci->fh, "*("); */
791 /* forb_cbe_write_param_typespec (ci->fh, tree); */
792 /* fprintf (ci->fh, " *)_o_retval = "); */
795 /* fprintf (ci->fh, "_impl_%s (_o_servant, ", IDL_IDENT (IDL_OP_DCL (tree).ident).str); */
797 /* forb_cbe_unflatten_args (tree, ci->fh, "_o_args"); */
799 /* if (IDL_OP_DCL (tree).context_expr) */
800 /* fprintf (ci->fh, "_o_ctx, "); */
802 /* fprintf (ci->fh, "_o_ev);\n"); */
804 /* fprintf (ci->fh, "}\n"); */
806 /* g_free (opname); */
807 /* g_free (ifname); */
813 /* cc_output_skels (IDL_tree tree, */
814 /* OIDL_Run_Info *rinfo, */
815 /* OIDL_C_Info *ci, */
818 /* if (!tree || (tree->declspec & IDLF_DECLSPEC_PIDL)) */
821 /* switch (IDL_NODE_TYPE (tree)) { */
822 /* case IDLN_MODULE: */
823 /* cc_output_skels (IDL_MODULE (tree).definition_list, rinfo, ci, idx); */
825 /* case IDLN_LIST: { */
828 /* for (node = tree; node; node = IDL_LIST (node).next) */
829 /* cc_output_skels (IDL_LIST (node).data, rinfo, ci, idx); */
832 /* case IDLN_ATTR_DCL: { */
833 /* OIDL_Attr_Info *ai = tree->data; */
836 /* for (node = IDL_ATTR_DCL (tree).simple_declarations; node; node = IDL_LIST (node).next) { */
837 /* ai = IDL_LIST (node).data->data; */
839 /* cc_output_skels (ai->op1, rinfo, ci, idx); */
841 /* cc_output_skels (ai->op2, rinfo, ci, idx); */
845 /* case IDLN_INTERFACE: { */
846 /* int real_idx = 0; */
848 /* cc_output_skels (IDL_INTERFACE (tree).body, rinfo, ci, &real_idx); */
851 /* case IDLN_OP_DCL: */
852 /* cc_output_skel (tree, ci, idx); */
860 forb_idl_output_c_common (IDL_tree tree,
861 OIDL_Run_Info *rinfo,
864 fprintf (ci->fh, OIDL_C_WARNING);
865 /* fprintf (ci->fh, "#include <string.h>\n"); */
866 /* fprintf (ci->fh, "#define FORB2_STUBS_API\n"); */
867 /* fprintf (ci->fh, "#define FORB_IDL_C_COMMON\n"); */
868 /* fprintf (ci->fh, "#define %s_COMMON\n", ci->c_base_name); */
869 fprintf (ci->fh, "#include \"%s.h\"\n", ci->base_name);
870 fprintf (ci->fh, "#include <forb/cdr.h>\n");
871 fprintf (ci->fh, "#include <forb/object.h>\n\n");
872 /* fprintf (ci->fh, "static const CORBA_unsigned_long Forb_zero_int = 0;\n"); */
874 /* FIXME: this is slightly nasty, but we need these in common,
875 and this fixes an internal build issue */
876 /* if (rinfo->enabled_passes & OUTPUT_SKELS || */
877 /* rinfo->enabled_passes & OUTPUT_STUBS) { */
878 /* fprintf (ci->fh, "\n#ifndef FORB_IDL_C_IMODULE_%s\n",ci->c_base_name); */
879 /* cc_output_skels (tree, rinfo, ci, NULL); */
880 /* fprintf (ci->fh, "\n#endif\n"); */
883 cc_output_serialization (tree, ci);
884 /* cc_output_typecodes (tree, ci); */
886 /* cc_output_class_ids (tree, rinfo, ci); */
888 /* if (rinfo->idata) { */
889 /* GSList *list = NULL; */
891 /* fprintf (ci->fh, "\n/\* Interface type data *\/\n\n"); */
893 /* list = cc_build_interfaces (list, tree); */
894 /* cc_output_itypes (list, ci); */