print_ifarg("(caddr_t *)");
}
if (*objname == '&') {
- f_print(fout, "%s.%s_val, (u_int *)%s.%s_len", objname, name,
- objname, name);
+ if (brief_flag) {
+ f_print(fout, "%s.val, (u_int *)%s.len", objname, objname);
+ } else {
+ f_print(fout, "%s.%s_val, (u_int *)%s.%s_len",
+ objname, name, objname, name);
+ }
} else {
- f_print(fout, "&%s->%s_val, (u_int *)&%s->%s_len", objname,
- name, objname, name);
+ if (brief_flag) {
+ f_print(fout, "&%s->val, (u_int *)&%s->len",
+ objname, objname);
+ } else {
+ f_print(fout, "&%s->%s_val, (u_int *)&%s->%s_len",
+ objname, name, objname, name);
+ }
}
}
print_ifarg(amax);
declaration *cs;
char *object;
char *format = "&objp->%s_u.%s";
+ char *briefformat = "&objp->u.%s";
print_stat(&def->def.un.enum_decl);
f_print(fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);
object =
alloc(strlen(def->def_name) + strlen(format) +
strlen(cs->name) + 1);
- s_print(object, format, def->def_name, cs->name);
+
+ if (brief_flag)
+ s_print(object, briefformat, cs->name);
+ else
+ s_print(object, format, def->def_name, cs->name);
+
print_ifstat(2, cs->prefix, cs->type, cs->rel, cs->array_max,
object, cs->name);
free(object);
switch (dec->rel) {
case REL_ARRAY:
f_print(fout, "struct %s {\n", dec->name);
- f_print(fout, "\tu_int %s_len;\n", dec->name);
- f_print(fout, "\t%s%s *%s_val;\n", prefix, dec->type, dec->name);
+ if (brief_flag) {
+ f_print(fout, "\tu_int %s_len;\n", dec->name);
+ f_print(fout, "\t%s%s *%s_val;\n", prefix,
+ dec->type, dec->name);
+ } else {
+ f_print(fout, "\tu_int %s_len;\n", dec->name);
+ f_print(fout, "\t%s%s *%s_val;\n", prefix,
+ dec->type, dec->name);
+ }
f_print(fout, "} %s", dec->name);
break;
default:
if (decl && !streq(decl->type, "void")) {
pdeclaration(name, decl, 2);
}
- f_print(fout, "\t} %s_u;\n", name);
+ if (brief_flag) {
+ f_print(fout, "\t} u;\n");
+ } else {
+ f_print(fout, "\t} %s_u;\n", name);
+ }
f_print(fout, "};\n");
f_print(fout, "typedef struct %s %s;\n", name, name);
STOREVAL(&uniondef_defined, def);
if (streq(old, "string")) {
old = "char";
rel = REL_POINTER;
- } else if (streq(old, "opaque")) {
+ } else if (!brief_flag && streq(old, "opaque")) {
old = "char";
} else if (streq(old, "bool")) {
old = "bool_t";
f_print(fout, "typedef ");
switch (rel) {
case REL_ARRAY:
- f_print(fout, "struct %s {\n", name);
- f_print(fout, "\tu_int %s_len;\n", name);
- f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
- f_print(fout, "} %s", name);
+ if (brief_flag) {
+ if (streq(old, "opaque")) {
+ f_print(fout, "struct rx_opaque %s", name);
+ } else {
+ f_print(fout, "struct {\n");
+ f_print(fout, "\tu_int len;\n");
+ f_print(fout, "\t%s%s *val;\n", prefix, old);
+ f_print(fout, "} %s", name);
+ }
+ } else {
+ f_print(fout, "struct %s {\n", name);
+ f_print(fout, "\tu_int %s_len;\n", name);
+ f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
+ f_print(fout, "} %s", name);
+ }
break;
case REL_POINTER:
f_print(fout, "%s%s *%s", prefix, old, name);
f_print(fout, "%s%s *%s", prefix, type, dec->name);
break;
case REL_ARRAY:
- f_print(fout, "struct %s {\n", dec->name);
- tabify(fout, tab);
- f_print(fout, "\tu_int %s_len;\n", dec->name);
- tabify(fout, tab);
- f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
- tabify(fout, tab);
- f_print(fout, "} %s", dec->name);
+ if (brief_flag) {
+ if (streq(dec->type, "opaque")) {
+ f_print(fout, "struct rx_opaque %s",dec->name);
+ } else {
+ f_print(fout, "struct {\n");
+ tabify(fout, tab);
+ f_print(fout, "\tu_int len;\n");
+ tabify(fout, tab);
+ f_print(fout, "\t%s%s *val;\n", prefix, type);
+ tabify(fout, tab);
+ f_print(fout, "} %s", dec->name);
+ }
+ } else {
+ f_print(fout, "struct %s {\n", dec->name);
+ tabify(fout, tab);
+ f_print(fout, "\tu_int %s_len;\n", dec->name);
+ tabify(fout, tab);
+ f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
+ tabify(fout, tab);
+ f_print(fout, "} %s", dec->name);
+ }
break;
}
}
struct commandline {
int ansic_flag;
+ int brief_flag;
int cflag;
int hflag;
int lflag;
char OutFile[256];
char Sflag = 0, Cflag = 0, hflag = 0, cflag = 0, kflag = 0, uflag = 0;
char ansic_flag = 0; /* If set, build ANSI C style prototypes */
+char brief_flag = 0; /* If set, shorten names */
char zflag = 0; /* If set, abort server stub if rpc call returns non-zero */
char xflag = 0; /* if set, add stats code to stubs */
char yflag = 0; /* if set, only emit function name arrays to xdr file */
if (!parseargs(argc, argv, &cmd)) {
f_print(stderr, "usage: %s infile\n", cmdname);
f_print(stderr,
- " %s [-c | -h | -l | -m | -C | -S | -r | -k | -R | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n",
+ " %s [-c | -h | -l | -m | -C | -S | -r | -b | -k | -R | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n",
cmdname);
f_print(stderr, " %s [-s udp|tcp]* [-o outfile] [infile]\n",
cmdname);
if (xflag) {
f_print(fout, "#include \"rx/rx_globals.h\"\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include \"rx/rx_opaque.h\"\n");
+ }
if (uflag)
f_print(fout, "#include <ubik.h>\n");
f_print(fout, "#else /* UKERNEL */\n");
if (xflag) {
f_print(fout, "#include \"rx/rx_globals.h\"\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include \"rx/rx_opaque.h\"\n");
+ }
f_print(fout, "#else /* KERNEL */\n");
f_print(fout, "#include <afs/param.h>\n");
f_print(fout, "#include <afs/stds.h>\n");
if (xflag) {
f_print(fout, "#include <rx/rx_globals.h>\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include <rx/rx_opaque.h>\n");
+ }
f_print(fout, "#include <afs/rxgen_consts.h>\n");
if (uflag)
f_print(fout, "#include <ubik.h>\n");
if (xflag) {
f_print(fout, "#include \"rx/rx_globals.h\"\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include \"rx/rx_opaque.h\"\n");
+ }
} else {
f_print(fout, "#include <sys/types.h>\n");
f_print(fout, "#include <rx/xdr.h>\n");
if (xflag) {
f_print(fout, "#include <rx/rx_globals.h>\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include <rx/rx_opaque.h\"\n");
+ }
f_print(fout, "#include <afs/rxgen_consts.h>\n");
}
}
if (xflag) {
f_print(fout, "#include \"rx/rx_globals.h\"\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include \"rx/rx_opaque.h\"\n");
+ }
} else {
f_print(fout, "#include <sys/types.h>\n");
f_print(fout, "#include <rx/xdr.h>\n");
if (xflag) {
f_print(fout, "#include <rx/rx_globals.h>\n");
}
+ if (brief_flag) {
+ f_print(fout, "#include <rx/rx_opaque.h>\n");
+ }
f_print(fout, "#include <afs/rxgen_consts.h>\n");
}
}
case 'm':
case 'C':
case 'S':
+ case 'b':
case 'r':
case 'R':
case 'k':
}
}
cmd->ansic_flag = ansic_flag = flag['A'];
+ cmd->brief_flag = brief_flag = flag['b'];
cmd->cflag = cflag = flag['c'];
cmd->hflag = hflag = flag['h'];
cmd->sflag = flag['s'];
*somefrees = 1;
switch (defp1->pc.rel) {
case REL_ARRAY:
- f_print(fout, "\n\t%s.%s_val = 0;",
- plist->pl.param_name, defp1->def_name);
- f_print(fout, "\n\t%s.%s_len = 0;",
- plist->pl.param_name, defp1->def_name);
plist->pl.string_name = alloc(40);
- s_print(plist->pl.string_name, "%s_val",
- defp1->def_name);
+ if (brief_flag) {
+ f_print(fout, "\n\t%s.val = 0;",
+ plist->pl.param_name);
+ f_print(fout, "\n\t%s.len = 0;",
+ plist->pl.param_name);
+ s_print(plist->pl.string_name, "val");
+ } else {
+ f_print(fout, "\n\t%s.%s_val = 0;",
+ plist->pl.param_name, defp1->def_name);
+ f_print(fout, "\n\t%s.%s_len = 0;",
+ plist->pl.param_name, defp1->def_name);
+ s_print(plist->pl.string_name, "%s_val",
+ defp1->def_name);
+ }
break;
case REL_POINTER:
f_print(fout, "\n\t%s = 0;", plist->pl.param_name);
extern char OutFile[];
extern char Sflag, Cflag, hflag, cflag, kflag, uflag;
extern char ansic_flag;
+extern char brief_flag;
extern char zflag;
extern char xflag;
extern char yflag;