/* print out the definitions for the arguments of functions in the
   header file
 */
static void
pargdef (definition * def)
{
  decl_list *l;
  version_list *vers;
  const char *name;
  proc_list *plist;

  for (vers = def->def.pr.versions; vers != NULL; vers = vers->next)
    {
      for (plist = vers->procs; plist != NULL;
	   plist = plist->next)
	{

	  if (!newstyle || plist->arg_num < 2)
	    {
	      continue;		/* old style or single args */
	    }
	  name = plist->args.argname;
	  f_print (fout, "struct %s {\n", name);
	  for (l = plist->args.decls;
	       l != NULL; l = l->next)
	    {
	      pdeclaration (name, &l->decl, 1, ";\n");
	    }
	  f_print (fout, "};\n");
	  f_print (fout, "typedef struct %s %s;\n", name, name);
	  storexdrfuncdecl (name, 1);
	  f_print (fout, "\n");
	}
    }

}
Exemple #2
0
/*
 * Print the C-version of an xdr definition
 */
void
print_datadef(definition *def)
{
	if (def->def_kind == DEF_PROGRAM)  /* handle data only */
		return;

	if (def->def_kind != DEF_CONST)
		f_print(fout, "\n");
	switch (def->def_kind) {
	case DEF_STRUCT:
		pstructdef(def);
		break;
	case DEF_UNION:
		puniondef(def);
		break;
	case DEF_ENUM:
		penumdef(def);
		break;
	case DEF_TYPEDEF:
		ptypedef(def);
		break;
	case DEF_PROGRAM:
		pprogramdef(def);
		break;
	case DEF_CONST:
		pconstdef(def);
		break;
	}
	if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST)
		storexdrfuncdecl(def->def_name, def->def_kind != DEF_TYPEDEF ||
		    !isvectordef(def->def.ty.old_type, def->def.ty.rel));
}