for (count = 0; IDL_LIST(params).data; params = IDL_LIST(params).next, count++) {
for (count = 0; params != NULL && IDL_LIST(params).data != NULL; params = IDL_LIST(params).next, count++) {
fill_td_from_type(TreeState *state, XPTTypeDescriptor *td, IDL_tree type){    IDL_tree up;    if (type) {        switch (IDL_NODE_TYPE(type)) {          case IDLN_TYPE_INTEGER: {              gboolean sign = IDL_TYPE_INTEGER(type).f_signed;              switch(IDL_TYPE_INTEGER(type).f_type) {                case IDL_INTEGER_TYPE_SHORT:                  td->prefix.flags = sign ? TD_INT16 : TD_UINT16;                  break;                case IDL_INTEGER_TYPE_LONG:                  td->prefix.flags = sign ? TD_INT32 : TD_UINT32;                  break;                case IDL_INTEGER_TYPE_LONGLONG:                  td->prefix.flags = sign ? TD_INT64 : TD_UINT64;                  break;              }              break;          }          case IDLN_TYPE_CHAR:            td->prefix.flags = TD_CHAR;            break;          case IDLN_TYPE_WIDE_CHAR:            td->prefix.flags = TD_WCHAR;            break;          case IDLN_TYPE_STRING:            /* XXXshaver string-type? */            td->prefix.flags = TD_PSTRING | XPT_TDP_POINTER;            break;          case IDLN_TYPE_WIDE_STRING:            td->prefix.flags = TD_PWSTRING | XPT_TDP_POINTER;            break;          case IDLN_TYPE_BOOLEAN:            td->prefix.flags = TD_BOOL;            break;          case IDLN_TYPE_OCTET:            td->prefix.flags = TD_UINT8;            break;          case IDLN_TYPE_FLOAT:            switch (IDL_TYPE_FLOAT (type).f_type) {              case IDL_FLOAT_TYPE_FLOAT:                td->prefix.flags = TD_FLOAT;                break;              case IDL_FLOAT_TYPE_DOUBLE:                td->prefix.flags = TD_DOUBLE;                break;              /* XXX 'long double' just ignored, or what? */              default: break;            }            break;          case IDLN_IDENT:            if (!(up = IDL_NODE_UP(type))) {                IDL_tree_error(type,                               "ERROR: orphan ident %s in param list\n",                               IDL_IDENT(type).str);                return FALSE;            }            switch (IDL_NODE_TYPE(up)) {                /* This whole section is abominably ugly */              case IDLN_FORWARD_DCL:              case IDLN_INTERFACE: {                XPTInterfaceDirectoryEntry *ide, *ides;                uint16 num_ifaces;                char *className;                const char *iid_is;handle_iid_is:                ides = HEADER(state)->interface_directory;                num_ifaces = HEADER(state)->num_interfaces;                /* might get here via the goto, so re-check type */                if (IDL_NODE_TYPE(up) == IDLN_INTERFACE)                    className = IDL_IDENT(IDL_INTERFACE(up).ident).str;                else if (IDL_NODE_TYPE(up) == IDLN_FORWARD_DCL)                    className = IDL_IDENT(IDL_FORWARD_DCL(up).ident).str;                else                    className = IDL_IDENT(IDL_NATIVE(up).ident).str;                iid_is = NULL;                if (IDL_NODE_TYPE(state->tree) == IDLN_PARAM_DCL) {                    iid_is =                        IDL_tree_property_get(IDL_PARAM_DCL(state->tree).simple_declarator,                                              "iid_is");                }                if (iid_is) {                    int16 argnum = -1, count;                    IDL_tree params = IDL_OP_DCL(IDL_NODE_UP(IDL_NODE_UP(state->tree))).parameter_dcls;                    for (count = 0; IDL_LIST(params).data;                         params = IDL_LIST(params).next, count++) {                        char *name;                        name = IDL_IDENT(IDL_PARAM_DCL(IDL_LIST(params).data).simple_declarator).str;                        if (!strcmp(name, iid_is)) {                            /* XXX verify that this is an nsid here */                            argnum = count;                            break;                        }                    }                    if (argnum < 0) {                        IDL_tree_error(type, "can't find matching arg for "                                       "[iid_is(%s)]\n", iid_is);                        return FALSE;                      }                    td->prefix.flags = TD_INTERFACE_IS_TYPE | XPT_TDP_POINTER;                    td->type.argnum = argnum;                } else {                    td->prefix.flags = TD_INTERFACE_TYPE | XPT_TDP_POINTER;                    ide = FindInterfaceByName(ides, num_ifaces, className);                    if (!ide || ide < ides || ide > ides + num_ifaces) {                        IDL_tree_error(type, "unknown iface %s in param\n",                                       className);                        return FALSE;                    }                    td->type.interface = ide - ides + 1;#ifdef DEBUG_shaver_index                    fprintf(stderr, "DBG: index %d for %s\n",                            td->type.interface, className);#endif                }                break;              }              case IDLN_NATIVE: {                  char *ident;                  gboolean isID;                  /* jband - adding goto for iid_is when type is native */                  if (IDL_NODE_TYPE(state->tree) == IDLN_PARAM_DCL &&                      IDL_tree_property_get(IDL_PARAM_DCL(state->tree).simple_declarator,                                              "iid_is"))                      goto handle_iid_is;                  ident = IDL_IDENT(type).str;                  isID = FALSE;                  if(IDL_tree_property_get(type, "nsid"))                      isID = TRUE;                  /* XXX obsolete the below! */                  /* check for nsID, nsCID, nsIID, nsIIDRef */                  if (!isID && ident[0] == 'n' && ident[1] == 's') {                      ident += 2;                      if (ident[0] == 'C')                          ident ++;                      else if (ident[0] == 'I' && ident[1] == 'I')                          ident ++;                      if (ident[0] == 'I' && ident[1] == 'D') {                          ident += 2;                          if ((ident[0] == '\0') ||                              (ident[0] == 'R' && ident[1] == 'e' &&                               ident[2] == 'f' && ident[3] == '\0')) {                              isID = TRUE;                          }                      }                  }                  if (isID) {#ifdef DEBUG_shaver                      fprintf(stderr, "doing nsID for %s\n",                              IDL_IDENT(type).str);#endif                      td->prefix.flags = TD_PNSIID | XPT_TDP_POINTER;                      if(IDL_tree_property_get(type, "ref"))                          td->prefix.flags |= XPT_TDP_REFERENCE;                  } else {#ifdef DEBUG_shaver                      fprintf(stderr, "not doing nsID for %s\n",                              IDL_IDENT(type).str);#endif                      td->prefix.flags = TD_VOID | XPT_TDP_POINTER;                  }                  break;                }              default:                if (IDL_NODE_TYPE(IDL_NODE_UP(up)) == IDLN_TYPE_DCL) {                    /* restart with the underlying type */                    IDL_tree new_type;                    new_type = IDL_TYPE_DCL(IDL_NODE_UP(up)).type_spec;#ifdef DEBUG_shaver_misc                    fprintf(stderr, "following %s typedef to %s\n",                            IDL_IDENT(type).str, IDL_NODE_TYPE_NAME(new_type));#endif                    return fill_td_from_type(state, td, new_type);                }                IDL_tree_error(type, "can't handle %s ident in param list\n",#ifdef DEBUG_shaver                        IDL_NODE_TYPE_NAME(IDL_NODE_UP(type))#else                        "that type of"#endif                        );#ifdef DEBUG_shaver                XPT_ASSERT(0);#endif                return FALSE;            }            break;          default:            IDL_tree_error(type, "can't handle %s in param list\n",#ifdef DEBUG_shaver                        IDL_NODE_TYPE_NAME(IDL_NODE_UP(type))#else                        "that type"#endif            );            return FALSE;        }    } else {        td->prefix.flags = TD_VOID;    }    return TRUE;}