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(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(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(CDR_Codec *codec, const %s *ptr)\n", id, id);
188 fprintf(ci->fh, "{\n"
190 " CORBA_boolean ok;\n"
191 " ok = CORBA_unsigned_long_serialize(codec, &ptr->_length);\n"
192 " for (i = 0; i<ptr->_length && ok; i++)\n");
193 fprintf(ci->fh, " ok = %s_serialize(codec, &(ptr->_buffer[i]));\n", type);
195 fprintf(ci->fh, " return ok;\n"
198 fprintf(ci->fh, "CORBA_boolean %s_deserialize(CDR_Codec *codec, %s *ptr)\n", id, id);
199 fprintf(ci->fh, "{\n"
201 " CORBA_boolean ok;\n"
202 " ok = CORBA_unsigned_long_deserialize(codec, &ptr->_length);\n"
203 " ok = ok && (ptr->_length <= ptr->_maximum);\n"
205 " if (CORBA_sequence_get_release(ptr)) CORBA_free(ptr->_buffer);\n"
206 " ptr->_buffer = %s_allocbuf(ptr->_length);\n"
207 " CORBA_sequence_set_release(ptr, CORBA_TRUE);\n"
209 " for (i = 0; i<ptr->_length && ok; i++)\n", id);
210 fprintf(ci->fh, " ok = %s_deserialize(codec, &(ptr->_buffer[i]));\n", type);
212 fprintf(ci->fh, " return ok;\n"
220 cc_output_ser_typedef_array(OIDL_C_Info *ci,
226 for(cur = IDL_TYPE_DCL(tree).dcls; cur; cur = IDL_LIST(cur).next) {
227 if (IDL_NODE_TYPE(IDL_LIST(cur).data) == IDLN_TYPE_ARRAY) {
228 id = IDL_ns_ident_to_qstring(IDL_IDENT_TO_NS(IDL_TYPE_ARRAY(IDL_LIST(cur).data).ident), "_", 0);
229 fprintf(ci->fh, "CORBA_boolean %s_serialize(CDR_Codec *codec, const %s array)\n", id, id);
230 fprintf(ci->fh, "{\n");
231 forb_cbe_write_ser_var(
233 IDL_TYPE_DCL(tree).type_spec,
238 fprintf(ci->fh, " return CORBA_TRUE;\n"
240 " return CORBA_FALSE;\n"
243 fprintf(ci->fh, "CORBA_boolean %s_deserialize(CDR_Codec *codec, %s array)\n", id, id);
244 fprintf(ci->fh, "{\n");
245 forb_cbe_write_ser_var(
247 IDL_TYPE_DCL(tree).type_spec,
252 fprintf(ci->fh, " return CORBA_TRUE;\n"
254 " return CORBA_FALSE;\n"
262 forb_output_serialization (OIDL_C_Info *ci,
265 switch (IDL_NODE_TYPE (node)) {
267 cc_output_ser_typedef_array(ci, node);
269 case IDLN_TYPE_STRUCT:
270 cc_output_ser_struct(ci, node);
272 case IDLN_TYPE_UNION:
274 case IDLN_EXCEPT_DCL:
277 case IDLN_TYPE_SEQUENCE:
278 cc_output_ser_seqence(ci, node);
281 g_error ("You can't produce a serialization for a %s",
282 IDL_tree_type_names[IDL_NODE_TYPE (node)]);
286 /* tci.structname = forb_generate_tcstruct_name (node); */
287 /* tci.substructname = NULL; */
288 /* tci.array_gen_ctr = 0; */
290 /* cbe_tc_generate (ci, &tci); */
292 /* g_free (tci.structname); */
296 cc_output_serialization_walker (IDL_tree_func_data *tfd,
299 IDL_tree tree = tfd->tree;
301 switch(IDL_NODE_TYPE (tree)) {
305 return FALSE; /* dont recurse into these */
307 case IDLN_TYPE_SEQUENCE:
308 /* if (!tfd->step) { */
309 /* cc_typecode_prep_sequence (tree, ci); */
315 case IDLN_EXCEPT_DCL:
316 case IDLN_TYPE_STRUCT:
317 case IDLN_TYPE_UNION:
320 case IDLN_TYPE_FIXED:
322 forb_output_serialization (ci, tree);
325 if (!IDL_SRCFILE(tree).isTop) {
333 return TRUE; /* continue walking */
337 cc_output_serialization (IDL_tree tree,
340 IDL_tree_walk2 (tree, NULL, IDL_WalkF_TypespecOnly,
341 (IDL_tree_func) cc_output_serialization_walker,
342 (IDL_tree_func) cc_output_serialization_walker,
351 /* cc_output_class_id (IDL_tree tree, */
352 /* OIDL_Run_Info *rinfo, */
353 /* OIDL_C_Info *ci) */
355 /* char *iface_id; */
357 /* iface_id = IDL_ns_ident_to_qstring ( */
358 /* IDL_IDENT_TO_NS (IDL_INTERFACE (tree).ident), "_", 0); */
360 /* fprintf (ci->fh, "\n#ifndef FORB_IDL_C_IMODULE_%s\n",ci->c_base_name); */
361 /* fprintf (ci->fh, "CORBA_unsigned_long %s__classid = 0;\n", iface_id); */
362 /* fprintf (ci->fh, "#endif\n"); */
364 /* g_free (iface_id); */
368 /* cc_output_class_ids (IDL_tree tree, */
369 /* OIDL_Run_Info *rinfo, */
370 /* OIDL_C_Info *ci) */
372 /* if (!tree || (tree->declspec & IDLF_DECLSPEC_PIDL)) */
375 /* switch (IDL_NODE_TYPE (tree)) { */
376 /* case IDLN_MODULE: */
377 /* cc_output_class_ids (IDL_MODULE (tree).definition_list, rinfo, ci); */
379 /* case IDLN_LIST: { */
382 /* for (node = tree; node; node = IDL_LIST (node).next) */
383 /* cc_output_class_ids (IDL_LIST (node).data, rinfo, ci); */
386 /* case IDLN_INTERFACE: */
387 /* cc_output_class_id (tree, rinfo, ci); */
397 /* cc_output_iargs (FILE *of, const char *method, IDL_tree tree) */
400 /* int arg_count = 0; */
402 /* /\* Build a list of IArgs *\/ */
403 /* for (sub = IDL_OP_DCL (tree).parameter_dcls; sub; */
404 /* sub = IDL_LIST (sub).next) { */
408 /* if (!arg_count) */
409 /* fprintf (of, "static Forb_IArg %s__arginfo [] = {\n", method); */
411 /* parm = IDL_LIST(sub).data; */
413 /* fprintf (of, "\t{ "); */
415 /* /\* TypeCode tc *\/ */
416 /* tc = forb_cbe_get_typecode_name ( */
417 /* IDL_PARAM_DCL (parm).param_type_spec); */
419 /* g_warning ("Can't get typecode"); */
420 /* tc = g_strdup ("NULL /\* no typecode *\/"); */
422 /* fprintf (of, "%s, ", tc); */
424 /* /\* IArgFlag flags *\/ */
425 /* switch (IDL_PARAM_DCL (parm).attr) { */
426 /* case IDL_PARAM_IN: */
427 /* fprintf (of, " Forb_I_ARG_IN "); */
429 /* case IDL_PARAM_OUT: */
430 /* fprintf (of, " Forb_I_ARG_OUT "); */
432 /* case IDL_PARAM_INOUT: */
433 /* fprintf (of, " Forb_I_ARG_INOUT "); */
437 /* if (forb_cbe_type_is_fixed_length ( */
438 /* IDL_PARAM_DCL (parm).param_type_spec)) */
439 /* fprintf (of, "| Forb_I_COMMON_FIXED_SIZE"); */
441 /* else if (IDL_PARAM_DCL(parm).attr == IDL_PARAM_OUT) { */
443 /* IDL_tree ts = forb_cbe_get_typespec ( */
444 /* IDL_PARAM_DCL (parm).param_type_spec); */
446 /* switch(IDL_NODE_TYPE (ts)) { */
447 /* case IDLN_TYPE_STRUCT: */
448 /* case IDLN_TYPE_UNION: */
449 /* case IDLN_TYPE_ARRAY: */
450 /* /\* fprintf (of, "| FORB_I_ARG_FIXED");*\/ */
457 /* fprintf (of, ", "); */
459 /* /\* string name *\/ */
460 /* fprintf (of, "(char *)\"%s\"", IDL_IDENT (IDL_PARAM_DCL ( */
461 /* IDL_LIST (sub).data).simple_declarator).str); */
463 /* fprintf (of, " }%s\n", IDL_LIST (sub).next ? "," : ""); */
470 /* fprintf (of, "};\n"); */
474 /* cc_output_contexts (FILE *of, const char *method, IDL_tree tree) */
476 /* /\* Build a list of contest names *\/ */
477 /* if (IDL_OP_DCL (tree).context_expr) { */
478 /* IDL_tree curitem; */
480 /* fprintf (of, "/\* Exceptions *\/\n"); */
481 /* fprintf (of, "static CORBA_string %s__contextinfo [] = {\n", */
484 /* for (curitem = IDL_OP_DCL (tree).context_expr; curitem; */
485 /* curitem = IDL_LIST (curitem).next) { */
486 /* fprintf (of, "\"%s\"%c", */
487 /* IDL_STRING (IDL_LIST (curitem).data).value, */
488 /* IDL_LIST (curitem).next ? ',' : ' '); */
491 /* fprintf (of, "};\n"); */
496 /* cc_output_exceptinfo (FILE *of, const char *method, IDL_tree tree) */
498 /* /\* Build a list of exception typecodes *\/ */
499 /* if (IDL_OP_DCL (tree).raises_expr) { */
500 /* IDL_tree curitem; */
502 /* fprintf (of, "/\* Exceptions *\/\n"); */
503 /* fprintf (of, "static CORBA_TypeCode %s__exceptinfo [] = {\n", */
506 /* for (curitem = IDL_OP_DCL (tree).raises_expr; curitem; */
507 /* curitem = IDL_LIST(curitem).next) { */
509 /* IDL_tree curnode = IDL_LIST(curitem).data; */
511 /* type_id = forb_cbe_get_typecode_name (curnode); */
512 /* fprintf (of, "\t%s,\n", type_id); */
513 /* g_free (type_id); */
515 /* fprintf (of, "\tNULL\n};\n"); */
520 /* cc_output_method_bits (IDL_tree tree, const char *id, OIDL_C_Info *ci) */
522 /* FILE *of = ci->fh; */
523 /* char *fullname; */
525 /* fullname = g_strconcat (id, "_", IDL_IDENT ( */
526 /* IDL_OP_DCL (tree).ident).str, NULL); */
528 /* cc_output_iargs (of, fullname, tree); */
530 /* cc_output_contexts (of, fullname, tree); */
532 /* cc_output_exceptinfo (of, fullname, tree); */
534 /* g_free (fullname); */
538 /* cc_output_method (FILE *of, IDL_tree tree, const char *id) */
541 /* int except_count; */
542 /* int context_count; */
543 /* const char *method; */
544 /* char *fullname; */
546 /* fullname = g_strconcat (id, "_", IDL_IDENT ( */
547 /* IDL_OP_DCL (tree).ident).str, NULL); */
549 /* arg_count = IDL_list_length (IDL_OP_DCL (tree).parameter_dcls); */
550 /* except_count = IDL_list_length (IDL_OP_DCL (tree).raises_expr); */
551 /* context_count = IDL_list_length (IDL_OP_DCL (tree).context_expr); */
553 /* fprintf (of, "\t{\n"); */
555 /* /\* IArgs arguments *\/ */
557 /* fprintf (of, "\t\t{ %d, %d, %s__arginfo, FALSE },\n", */
558 /* arg_count, arg_count, fullname); */
560 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
562 /* /\* IContexts contexts *\/ */
563 /* if (context_count) */
564 /* fprintf (of, "\t\t{ %d, %d, %s__contextinfo, FALSE },\n", */
565 /* context_count, context_count, fullname); */
567 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
569 /* /\* ITypes exceptions *\/ */
570 /* if (IDL_OP_DCL (tree).raises_expr) */
571 /* fprintf (of, "\t\t{ %d, %d, %s__exceptinfo, FALSE },\n", */
572 /* except_count, except_count, fullname); */
574 /* fprintf (of, "\t\t{ 0, 0, NULL, FALSE },\n"); */
576 /* /\* TypeCode ret *\/ */
577 /* if (IDL_OP_DCL (tree).op_type_spec) { */
580 /* type_id = forb_cbe_get_typespec_str ( */
581 /* IDL_OP_DCL (tree).op_type_spec); */
582 /* fprintf (of, "\t\tTC_%s, ", type_id); */
583 /* g_free (type_id); */
585 /* fprintf (of, "TC_void, "); */
587 /* /\* string name, long name_len *\/ */
588 /* method = IDL_IDENT (IDL_OP_DCL (tree).ident).str; */
589 /* fprintf (of, "(char *)\"%s\", %d,\n", method, strlen (method)); */
591 /* /\* IMethodFlags flags *\/ */
592 /* fprintf (of, "\t\t0"); */
594 /* if (IDL_OP_DCL(tree).f_oneway) */
595 /* fprintf (of, " | Forb_I_METHOD_1_WAY"); */
597 /* /\* FIXME: re-scan for no_out *\/ */
598 /* /\* if (no_out) */
599 /* fprintf (of, " | Forb_I_METHOD_NO_OUT");*\/ */
601 /* if (IDL_OP_DCL (tree).op_type_spec && */
602 /* forb_cbe_type_is_fixed_length ( */
603 /* IDL_OP_DCL (tree).op_type_spec)) */
604 /* fprintf (of, "| Forb_I_COMMON_FIXED_SIZE"); */
606 /* if (IDL_OP_DCL(tree).context_expr) */
607 /* fprintf (of, "| Forb_I_METHOD_HAS_CONTEXT"); */
609 /* fprintf (of, "\n}\n"); */
611 /* g_free (fullname); */
615 /* cc_output_base_itypes(IDL_tree node, CCSmallInterfaceTraverseInfo *iti) */
617 /* if (iti->cur_node == node) */
620 /* fprintf (iti->of, "(char *)\"%s\",\n", */
621 /* IDL_IDENT(IDL_INTERFACE(node).ident).repo_id); */
623 /* iti->parents++; */
627 /* cc_output_itypes (GSList *list, OIDL_C_Info *ci) */
630 /* FILE *of = ci->fh; */
632 /* for (l = list; l; l = l->next) { */
633 /* CCSmallInterfaceTraverseInfo iti; */
634 /* Interface *i = l->data; */
638 /* id = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS ( */
639 /* IDL_INTERFACE (i->tree).ident), "_", 0); */
641 /* for (m = i->methods; m; m = m->next) */
642 /* cc_output_method_bits (m->data, id, ci); */
644 /* if (i->methods) { */
645 /* fprintf (of, "\n#ifdef FORB_IDL_C_IMODULE_%s\n", */
646 /* ci->c_base_name); */
647 /* fprintf (of, "static\n"); */
648 /* fprintf (of, "#endif\n"); */
650 /* fprintf (of, "Forb_IMethod %s__imethods [] = {\n", id); */
652 /* if (!(m = i->methods)) */
653 /* fprintf (of, "{{0}}"); */
655 /* else for (; m; m = m->next) { */
656 /* cc_output_method (of, m->data, id); */
658 /* fprintf(of, ", "); */
661 /* fprintf (of, "};\n\n"); */
664 /* fprintf (of, "static CORBA_string %s__base_itypes[] = {\n", id); */
667 /* iti.cur_node = i->tree; */
668 /* iti.cur_id = id; */
669 /* iti.parents = 0; */
670 /* IDL_tree_traverse_parents(i->tree, (GFunc)cc_output_base_itypes, &iti); */
672 /* fprintf (of, "(char *)\"IDL:omg.org/CORBA/Object:1.0\"\n};"); */
674 /* fprintf (of, "\n#ifdef FORB_IDL_C_IMODULE_%s\n", */
675 /* ci->c_base_name); */
676 /* fprintf (of, "static\n"); */
677 /* fprintf (of, "#endif\n"); */
678 /* fprintf (of, "Forb_IInterface %s__iinterface = {\n", id); */
679 /* fprintf (of, "TC_%s,", id); */
680 /* fprintf (of, "{%d, %d, %s__imethods, FALSE},\n", */
681 /* g_slist_length (i->methods), */
682 /* g_slist_length (i->methods), id); */
684 /* fprintf (of, "{%d, %d, %s__base_itypes, FALSE}\n", */
685 /* iti.parents + 1, iti.parents + 1, id); */
687 /* fprintf (of, "};\n\n"); */
692 /* for (l = list; l; l = l->next) { */
693 /* g_slist_free (((Interface *)l->data)->methods); */
694 /* g_free (l->data); */
697 /* g_slist_free (list); */
700 /* static GSList * */
701 /* cc_build_interfaces (GSList *list, IDL_tree tree) */
706 /* switch (IDL_NODE_TYPE (tree)) { */
707 /* case IDLN_MODULE: */
708 /* list = cc_build_interfaces ( */
709 /* list, IDL_MODULE (tree).definition_list); */
711 /* case IDLN_LIST: { */
713 /* for (sub = tree; sub; sub = IDL_LIST (sub).next) */
714 /* list = cc_build_interfaces ( */
715 /* list, IDL_LIST (sub).data); */
718 /* case IDLN_ATTR_DCL: { */
719 /* IDL_tree curitem; */
721 /* for (curitem = IDL_ATTR_DCL (tree).simple_declarations; */
722 /* curitem; curitem = IDL_LIST (curitem).next) { */
723 /* OIDL_Attr_Info *ai = IDL_LIST (curitem).data->data; */
725 /* list = cc_build_interfaces (list, ai->op1); */
727 /* list = cc_build_interfaces (list, ai->op2); */
731 /* case IDLN_INTERFACE: { */
732 /* Interface *i = g_new0 (Interface, 1); */
734 /* i->tree = tree; */
736 /* list = g_slist_append (list, i); */
738 /* list = cc_build_interfaces (list, IDL_INTERFACE(tree).body); */
742 /* case IDLN_OP_DCL: { */
745 /* g_return_val_if_fail (list != NULL, NULL); */
747 /* i = ( g_slist_last(list) )->data; */
748 /* i->methods = g_slist_append (i->methods, tree); */
751 /* case IDLN_EXCEPT_DCL: */
761 /* cc_output_skel (IDL_tree tree, */
762 /* OIDL_C_Info *ci, */
766 /* gboolean has_retval; */
770 /* g_return_if_fail (idx != NULL); */
772 /* intf = IDL_get_parent_node (tree, IDLN_INTERFACE, NULL); */
774 /* has_retval = IDL_OP_DCL (tree).op_type_spec != NULL; */
776 /* opname = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_OP_DCL (tree).ident), "_", 0); */
777 /* ifname = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_INTERFACE (intf).ident), "_", 0); */
779 /* fprintf (ci->fh, "void _FORB_skel_small_%s(" */
780 /* "POA_%s *_o_servant, " */
781 /* "gpointer _o_retval," */
782 /* "gpointer *_o_args," */
783 /* "CORBA_Context _o_ctx," */
784 /* "CORBA_Environment *_o_ev,\n", opname, ifname); */
786 /* forb_cbe_op_write_proto (ci->fh, tree, "_impl_", TRUE); */
788 /* fprintf (ci->fh, ") {\n"); */
790 /* if (has_retval) { */
791 /* fprintf (ci->fh, "*("); */
792 /* forb_cbe_write_param_typespec (ci->fh, tree); */
793 /* fprintf (ci->fh, " *)_o_retval = "); */
796 /* fprintf (ci->fh, "_impl_%s (_o_servant, ", IDL_IDENT (IDL_OP_DCL (tree).ident).str); */
798 /* forb_cbe_unflatten_args (tree, ci->fh, "_o_args"); */
800 /* if (IDL_OP_DCL (tree).context_expr) */
801 /* fprintf (ci->fh, "_o_ctx, "); */
803 /* fprintf (ci->fh, "_o_ev);\n"); */
805 /* fprintf (ci->fh, "}\n"); */
807 /* g_free (opname); */
808 /* g_free (ifname); */
814 /* cc_output_skels (IDL_tree tree, */
815 /* OIDL_Run_Info *rinfo, */
816 /* OIDL_C_Info *ci, */
819 /* if (!tree || (tree->declspec & IDLF_DECLSPEC_PIDL)) */
822 /* switch (IDL_NODE_TYPE (tree)) { */
823 /* case IDLN_MODULE: */
824 /* cc_output_skels (IDL_MODULE (tree).definition_list, rinfo, ci, idx); */
826 /* case IDLN_LIST: { */
829 /* for (node = tree; node; node = IDL_LIST (node).next) */
830 /* cc_output_skels (IDL_LIST (node).data, rinfo, ci, idx); */
833 /* case IDLN_ATTR_DCL: { */
834 /* OIDL_Attr_Info *ai = tree->data; */
837 /* for (node = IDL_ATTR_DCL (tree).simple_declarations; node; node = IDL_LIST (node).next) { */
838 /* ai = IDL_LIST (node).data->data; */
840 /* cc_output_skels (ai->op1, rinfo, ci, idx); */
842 /* cc_output_skels (ai->op2, rinfo, ci, idx); */
846 /* case IDLN_INTERFACE: { */
847 /* int real_idx = 0; */
849 /* cc_output_skels (IDL_INTERFACE (tree).body, rinfo, ci, &real_idx); */
852 /* case IDLN_OP_DCL: */
853 /* cc_output_skel (tree, ci, idx); */
861 forb_idl_output_c_common (IDL_tree tree,
862 OIDL_Run_Info *rinfo,
865 fprintf (ci->fh, OIDL_C_WARNING);
866 /* fprintf (ci->fh, "#include <string.h>\n"); */
867 /* fprintf (ci->fh, "#define FORB2_STUBS_API\n"); */
868 /* fprintf (ci->fh, "#define FORB_IDL_C_COMMON\n"); */
869 /* fprintf (ci->fh, "#define %s_COMMON\n", ci->c_base_name); */
870 fprintf (ci->fh, "#include \"%s.h\"\n", ci->base_name);
871 fprintf (ci->fh, "#include <forb/cdr.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); */