#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
void
emit(definition * def)
{
- if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
+ if (def->def_kind == DEF_CONST) {
return;
}
print_header(def);
static int
findtype(definition * def, char *type)
{
- if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
+ if (def->def_kind == DEF_CONST) {
return (0);
} else {
return (streq(def->def_name, type));
static void
print_ifarg_with_cast(int ptr_to, char *type, char *arg)
{
- f_print(fout, ptr_to ? ", (%s *) %s" : ", (%s) %s", type, arg);
+ if (streq(type, "bool")) {
+ f_print(fout, ptr_to ? ", (bool_t *) %s" : ", (bool_t) %s", arg);
+ } else {
+ f_print(fout, ptr_to ? ", (%s *) %s" : ", (%s) %s", type, arg);
+ }
}
static void
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:
} else if (streq(type, "opaque")) {
alt = "opaque";
}
- if (alt) {
+ if (alt)
print_rxifopen(alt);
- print_rxifarg(amp, objname, 0);
- } else {
+ else
print_rxifopen("vector");
- print_rxifarg(amp, "(char *)", 0);
- sprintf(temp, "%s", objname);
- strcat(Proc_list->code, temp);
- strcat(Proc_list->scode, temp);
- }
+
+ print_rxifarg(amp, "(char *)", 0);
+ sprintf(temp, "%s", objname);
+ strcat(Proc_list->code, temp);
+ strcat(Proc_list->scode, temp);
print_rxifarg("", amax, 1);
if (!alt) {
print_rxifsizeof(prefix, type);
Proc_list->pl.param_flag |= OUT_STRING;
print_rxifarg("", objname, 0);
} else
- print_rxifarg("&", objname, 0);
+ print_rxifarg("(char **) &", objname, 0);
/* print_rxifarg(amp, objname, 0); */
print_rxifarg("", amax, 1);
if (!alt) {