Ignore:
Timestamp:
Nov 26, 2006, 6:26:53 PM (19 years ago)
Author:
cinc
Message:

Missing parameters in declarations of overriden methods in *.ih files fixed.

Location:
trunk/ORBit2-2.14.0/src/idl-compiler
Files:
2 edited

Legend:

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

    r114 r117  
    241241}
    242242#endif
     243
     244
     245/*
     246  This function is called for each parent to check if the current parent introduced the
     247  overriden method. If yes, the parameter info is taken from this parent and put into the
     248  file.
     249 */
     250static
     251void VoyagerDoWriteParamsForOverridenMethod(IDL_tree curif, InheritedOutputInfo *ioi)
     252{
     253  IDL_tree curitem;
     254  char* overridenMethodName;
     255
     256  if(curif == ioi->realif)
     257    return;
     258
     259  overridenMethodName=ioi->chrOverridenMethodName;
     260
     261  for(curitem = IDL_INTERFACE(curif).body; curitem; curitem = IDL_LIST(curitem).next) {
     262    IDL_tree curop = IDL_LIST(curitem).data;
     263
     264    switch(IDL_NODE_TYPE(curop)) {
     265    case IDLN_OP_DCL:
     266      {
     267        /* Check if the current method (introduced by some parent) is the one to be
     268           overriden. */
     269        if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){
     270          IDL_tree  sub;
     271         
     272          g_assert (IDL_NODE_TYPE(curop) == IDLN_OP_DCL);
     273         
     274          /* Write the params including the typespec */         
     275          for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
     276            IDL_tree parm = IDL_LIST (sub).data;
     277           
     278            orbit_cbe_write_param_typespec (ioi->of, parm);
     279           
     280            fprintf (ioi->of, " %s,\n", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
     281          }
     282        }
     283        break;
     284      }
     285        default:
     286          break;
     287    }
     288  }
     289}
     290
     291/*
     292  Overriden methods are introduced by some parent class. This function gets the parent node and
     293  climbs down the list of classes to find the one introducing the method. A support function called
     294  for every node while traversing actually writes the info.
     295*/
     296static void
     297VoyagerWriteParamsForOverridenMethod(FILE       *of,
     298                                          IDL_tree    op,
     299                                          const char *nom_prefix,
     300                                          gboolean    for_epv)
     301{
     302  char * id2;
     303  char * ptr;
     304  IDL_tree tmptree;
     305
     306  g_assert (IDL_NODE_TYPE(op) == IDLN_OP_DCL);
     307
     308  id2=g_strdup(IDL_IDENT (IDL_OP_DCL (op).ident).str);
     309  if((ptr=strstr(id2, NOM_OVERRIDE_STRING))!=NULL)
     310    *ptr='\0';
     311 
     312  tmptree = IDL_get_parent_node(op, IDLN_INTERFACE, NULL);
     313 
     314  if(IDL_INTERFACE(tmptree).inheritance_spec) {
     315    InheritedOutputInfo ioi;
     316   
     317    ioi.of = of;
     318    ioi.realif = tmptree;
     319    ioi.chrOverridenMethodName=id2;
     320    IDL_tree_traverse_parents(IDL_INTERFACE(tmptree).inheritance_spec, (GFunc)VoyagerDoWriteParamsForOverridenMethod, &ioi);
     321  }
     322  g_free(id2);
     323}
    243324
    244325static void
     
    740821                fprintf(ski->of, "/* Params should end here ... */\n");
    741822                op = ski->tree;
     823                VoyagerWriteParamsForOverridenMethod(ski->of,
     824                                                     op,
     825                                                     "",
     826                                                     FALSE);
     827
    742828                for(curitem = IDL_OP_DCL(ski->tree).parameter_dcls;
    743829                    curitem; curitem = IDL_LIST(curitem).next) {
     
    838924                fprintf(ski->of, "ev)");
    839925                fprintf(ski->of, ")\n");
    840 #if 0
    841                 fprintf(ski->of, "static char* nomFullIdString_%s_%s = nomMNFullDef_%s_%s;\n",
    842                         id2, gstr->str,
    843                         id2, gstr->str);
    844 #endif
    845926              }
    846927            else{
  • trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-stubs.c

    r116 r117  
    9595}
    9696
    97 void
     97static void
    9898VoyagerWriteProtoForParentCall (FILE       *of,
    9999                                IDL_tree    op,
     
    141141}
    142142
     143/*
     144  This function is called for each parent to check if the current parent introduced the
     145  overriden method. If yes, the parameter info is taken from this parent and put into the
     146  file.
     147 */
    143148static
    144149void VoyagerDoWriteParamsForOverridenMethod(IDL_tree curif, InheritedOutputInfo2 *ioi)
     
    196201}
    197202
    198 void VoyagerWriteParamsForOverridenMethod(FILE       *of,
     203/*
     204  Overriden methods are introduced by some parent class. This function gets the parent node and
     205  climbs down the list of classes to find the one introducing the method. A support function called
     206  for every node while traversing actually writes the info.
     207*/
     208static void
     209VoyagerWriteParamsForOverridenMethod(FILE       *of,
    199210                                IDL_tree    op,
    200211                                const char *nom_prefix,
Note: See TracChangeset for help on using the changeset viewer.