Ignore:
Timestamp:
Dec 3, 2006, 9:15:50 PM (19 years ago)
Author:
cinc
Message:

Put class declaration at the top of header files so it's known to included files. This is necessary for classes in IDL files referencing classes in other IDL files which reference the class in the first IDL file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-headers.c

    r138 r145  
    1414static void ch_output_skel_protos(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci);
    1515static void ch_output_voyager(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci);
     16static void ch_VoyagerOutputClassDeclaration(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci);
    1617
    1718void
     
    3637  fprintf(ci->fh, "#endif /* __cplusplus */\n\n");
    3738
     39  /* Forward declare our class */
     40  ch_VoyagerOutputClassDeclaration(tree, rinfo, ci);
    3841  /* Do all the typedefs, etc. */
    3942  fprintf(ci->fh, "\n/** typedefs **/\n");
     
    218221        case IDLN_FORWARD_DCL:
    219222        case IDLN_INTERFACE:
    220                 ch_output_interface (tree, rinfo, ci);
     223      /* ch_output_interface (tree, rinfo, ci); */
    221224                break;
    222225        case IDLN_TYPE_STRUCT:
     
    295298        }
    296299}
     300
     301/*
     302  This function declares the class struct and the pointer on the class.
     303 */
     304static void
     305ch_VoyagerOutputClassDeclaration(IDL_tree tree,
     306                                 OIDL_Run_Info *rinfo,
     307                                 OIDL_C_Info   *ci)
     308{
     309        if (!tree)
     310                return;
     311
     312        switch (IDL_NODE_TYPE (tree)) {
     313        case IDLN_EXCEPT_DCL:
     314                break;
     315        case IDLN_FORWARD_DCL:
     316        case IDLN_INTERFACE:
     317                ch_output_interface (tree, rinfo, ci);
     318                break;
     319        case IDLN_TYPE_STRUCT:
     320                break;
     321        case IDLN_TYPE_ENUM:
     322                break;
     323        case IDLN_TYPE_DCL:
     324                break;
     325        case IDLN_TYPE_UNION:
     326                break;
     327        case IDLN_CODEFRAG:
     328                break;
     329        case IDLN_SRCFILE:
     330                break;
     331        case IDLN_CONST_DCL:
     332                break;
     333        case IDLN_NATIVE:
     334                break;
     335        default:
     336                break;
     337        }
     338
     339        switch (IDL_NODE_TYPE (tree)) {
     340        case IDLN_MODULE:
     341                break;
     342        case IDLN_LIST: {
     343                IDL_tree sub;
     344
     345                for (sub = tree; sub; sub = IDL_LIST (sub).next) {
     346                        ch_VoyagerOutputClassDeclaration (IDL_LIST (sub).data, rinfo, ci);
     347                }
     348                }
     349                break;
     350        case IDLN_INTERFACE:
     351                break;
     352        default:
     353                break;
     354        }
     355}
     356
    297357
    298358static void
Note: See TracChangeset for help on using the changeset viewer.