Ignore:
Timestamp:
Dec 1, 2006, 10:21:43 PM (19 years ago)
Author:
cinc
Message:

Remove warnings when calling inherited methods. Fixed a parameter bug for inherited methods.

File:
1 edited

Legend:

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

    r124 r131  
    972972}
    973973
     974
    974975/*
    975976  This function puts out something like the following in the *.h file:
    976977
    977   #define WPFolder_wpEchoString() \
    978           WPObject_wpEchoString()
     978  #define WPFolder_wpEchoString(nomSelf, a, b, ...) \
     979          WPObject_wpEchoString((WPObject*) nomSelf, a, b, ...)
    979980*/
    980981static void
     
    10021003           overriden. */
    10031004        if(!strcmp(overridenMethodName, IDL_IDENT(IDL_OP_DCL(curop).ident).str)){
    1004           fprintf(ioi->of, "#define %s_%s() \\\n        %s_%s()\n",
    1005                   realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str,
    1006                   id, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
     1005          IDL_tree  sub;
     1006
     1007          //fprintf(ioi->of, "#define %s_%s() \\\n        %s_%s()\n",
     1008          //      realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str,
     1009          //      id, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
     1010          fprintf(ioi->of, "#define %s_%s(nomSelf, ",
     1011                  realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
     1012          for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
     1013            IDL_tree parm = IDL_LIST (sub).data;
     1014            fprintf (ioi->of, "%s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
     1015          }
     1016          fprintf(ioi->of, "ev) \\\n");
     1017          fprintf(ioi->of, "        %s_%s((%s*) nomSelf, ",
     1018                  id, IDL_IDENT(IDL_OP_DCL(curop).ident).str, id);
     1019          for (sub = IDL_OP_DCL (curop).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
     1020            IDL_tree parm = IDL_LIST (sub).data;
     1021            fprintf (ioi->of, "%s, ", IDL_IDENT (IDL_PARAM_DCL (parm).simple_declarator).str);
     1022          }
     1023          fprintf(ioi->of, "ev)\n");
    10071024        }
    10081025        break;
     
    11351152}
    11361153
    1137 
    11381154static void
    11391155ch_output_stub_protos(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
     
    11981214              VoyagerOutputClassDataStructMember(ci->fh, cur, "");
    11991215              fprintf(ci->fh, ";\n");
    1200             }
    1201           else
    1202             {
    1203 #if 0
    1204               /* FIXME:
    1205                  This is only a debug method to be thrown out... */
    1206               fprintf(ci->fh, "/* DEBUG: Overriden method ");
    1207               fprintf(ci->fh, "%s, %s, %s: %d */\n", IDL_IDENT (IDL_OP_DCL (cur).ident).str,
    1208                       __FILE__, __FUNCTION__, __LINE__);
    1209 #endif
    12101216            }
    12111217          break;
     
    12471253      fprintf(ci->fh, "} %sClassData;\n\n", id);
    12481254     
    1249       /***** Print introduced method for possible postprocessing ***/
     1255
     1256      /******* Print introduced method for possible postprocessing *******/
    12501257      for(sub = IDL_INTERFACE(tree).body; sub; sub = IDL_LIST(sub).next) {
    12511258        IDL_tree cur;
     
    12721279      }/* for */
    12731280      fprintf(ci->fh, "\n");
    1274       /***** Print introduced method for possible postprocessing ***/
    1275 
    1276       /***** Output overriden methods ***/
     1281      /******* Print introduced method for possible postprocessing *******/
     1282
     1283      /******* Output overriden methods *******/
    12771284      for(sub = IDL_INTERFACE(tree).body; sub; sub = IDL_LIST(sub).next) {
    12781285        IDL_tree cur;
     
    12901297                /* There's an overriden method here */
    12911298                *ptr='\0';
     1299                fprintf(ci->fh, "/* %s, %s line %d */\n", __FILE__, __FUNCTION__, __LINE__);
    12921300                fprintf(ci->fh, "/* OVERRIDE_METHOD: ");
    12931301                fprintf(ci->fh, "%s %s */\n", IDL_IDENT (IDL_OP_DCL (cur).ident).str, id );
     
    12951303                fprintf(ci->fh, "#undef %s_%s\n", id, IDL_IDENT (IDL_OP_DCL (cur).ident).str);
    12961304                fprintf(ci->fh, "#endif\n");
     1305
    12971306                /* Try to find the interface introducing this method */
    12981307
     
    13031312                  ioi.realif = tree;
    13041313                  ioi.chrOverridenMethodName=IDL_IDENT (IDL_OP_DCL (cur).ident).str;
    1305                   IDL_tree_traverse_parents(IDL_INTERFACE(tree).inheritance_spec, (GFunc)VoyagerOutputOverridenMethod, &ioi);
     1314                  IDL_tree_traverse_parents(IDL_INTERFACE(tree).inheritance_spec,
     1315                                            (GFunc)VoyagerOutputOverridenMethod, &ioi);
    13061316                }
    13071317                *ptr='_';
     
    13141324      }/* for */
    13151325      fprintf(ci->fh, "\n");
    1316       /***** Output overriden methods ***/
     1326      /******* Output overriden methods *******/
    13171327
    13181328      /* */
     
    13251335}
    13261336
     1337/*
     1338  This function writes the params of methods. The typespec is not written.
     1339  This function is useful for putting parameters into macros.
     1340 */
     1341static void
     1342VoyagerOutputMethodParamsNoTypeSpec(FILE  *of, IDL_tree tree, const char *nom_prefix)
     1343{
     1344        IDL_tree curitem;
     1345
     1346    g_assert (IDL_NODE_TYPE(tree) == IDLN_OP_DCL);
     1347
     1348    /* add the parms */
     1349    for(curitem = IDL_OP_DCL(tree).parameter_dcls;
     1350        curitem; curitem = IDL_LIST(curitem).next) {
     1351      IDL_tree tr;
     1352
     1353      tr = IDL_LIST(curitem).data;     
     1354      /*  Write list of params */
     1355      if(IDL_NODE_TYPE(tr) == IDLN_PARAM_DCL)
     1356        {
     1357          fprintf(of, " %s,", IDL_IDENT(IDL_PARAM_DCL(tr).simple_declarator).str);
     1358        }
     1359    }
     1360    return ;
     1361}
     1362
    13271363static void
    13281364ch_output_inherited_protos(IDL_tree curif, InheritedOutputInfo *ioi)
     
    13421378    switch(IDL_NODE_TYPE(curop)) {
    13431379    case IDLN_OP_DCL:
    1344       /* Only output methods which are not overriden */
     1380      /* Only output methods which are not overriden. Overriden methods are also
     1381         put into the data but they're marked with __OVERRIDE__. */
    13451382      if(!strstr(IDL_IDENT (IDL_OP_DCL (curop).ident).str, "__OVERRIDE__"))
    13461383        {
    13471384          fprintf(ioi->of, "/* %s, %s line %d */\n", __FILE__, __FUNCTION__, __LINE__);
    1348           fprintf(ioi->of, "#define %s_%s %s_%s\n",
    1349                   realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str,
    1350                   id, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
     1385          //          fprintf(ioi->of, "#define %s_%s %s_%s\n",
     1386          //      realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str,
     1387          //      id, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
     1388          fprintf(ioi->of, "#define %s_%s(nomSelf,",realid, IDL_IDENT(IDL_OP_DCL(curop).ident).str);
     1389          VoyagerOutputMethodParamsNoTypeSpec(ioi->of, curop, "");
     1390          fprintf(ioi->of, " ev) \\\n        %s_%s((%s*) nomSelf,",
     1391                  id, IDL_IDENT(IDL_OP_DCL(curop).ident).str, id);
     1392          VoyagerOutputMethodParamsNoTypeSpec(ioi->of, curop, "");
     1393          fprintf(ioi->of, " ev)\n");
    13511394        }
    13521395      break;
Note: See TracChangeset for help on using the changeset viewer.