version 1.5, 2001/11/24 19:17:47 |
version 1.6, 2001/11/24 19:19:59 |
|
|
static char tbl_end[] = "};\n"; |
static char tbl_end[] = "};\n"; |
|
|
static char null_entry[] = "\n\t(char *(*)())0,\n\ |
static char null_entry[] = "\n\t(char *(*)())0,\n\ |
\t(xdrproc_t) xdr_void,\t\t\t0,\n\ |
\t(xdrproc_t) xdr_void,\t\t\t0,\n\ |
\t(xdrproc_t) xdr_void,\t\t\t0,\n"; |
\t(xdrproc_t) xdr_void,\t\t\t0,\n"; |
|
|
static char tbl_nproc[] = "int %s_nproc =\n\tsizeof(%s_table)/sizeof(%s_table[0]);\n\n"; |
static char tbl_nproc[] = "int %s_nproc =\n\tsizeof(%s_table)/sizeof(%s_table[0]);\n\n"; |
|
|
static void write_table __P((definition *)); |
static write_table __P((definition *)); |
static void printit __P((char *, char *)); |
static printit __P((char *, char *)); |
|
|
void |
void |
write_tables() |
write_tables() |
{ |
{ |
definition *def; |
|
list *l; |
list *l; |
|
definition *def; |
|
|
f_print(fout, "\n"); |
f_print(fout, "\n"); |
for (l = defined; l != NULL; l = l->next) { |
for (l = defined; l != NULL; l = l->next) { |
def = (definition *) l->val; |
def = (definition *) l->val; |
if (def->def_kind == DEF_PROGRAM) |
if (def->def_kind == DEF_PROGRAM) { |
write_table(def); |
write_table(def); |
|
} |
} |
} |
} |
} |
|
|
static void |
static |
write_table(def) |
write_table(def) |
definition *def; |
definition *def; |
{ |
{ |
|
|
current = atoi(proc->proc_num); |
current = atoi(proc->proc_num); |
if (current != expected++) { |
if (current != expected++) { |
f_print(fout, |
f_print(fout, |
"\n/*\n * WARNING: table out of order\n */\n"); |
"\n/*\n * WARNING: table out of order\n */\n"); |
if (warning == 0) { |
if (warning == 0) { |
f_print(stderr, |
f_print(stderr, |
"WARNING %s table is out of order\n", |
"WARNING %s table is out of order\n", |
progvers); |
progvers); |
warning = 1; |
warning = 1; |
nonfatalerrors = 1; |
nonfatalerrors = 1; |
|
|
f_print(fout, "\n\t(char *(*)())RPCGEN_ACTION("); |
f_print(fout, "\n\t(char *(*)())RPCGEN_ACTION("); |
|
|
/* routine to invoke */ |
/* routine to invoke */ |
if (!newstyle) |
if ( !newstyle) |
pvname_svc(proc->proc_name, vp->vers_num); |
pvname_svc(proc->proc_name, vp->vers_num); |
else { |
else { |
if (newstyle) |
if( newstyle ) |
f_print(fout, "_"); /* calls internal func */ |
f_print( fout, "_"); /* calls internal func */ |
pvname(proc->proc_name, vp->vers_num); |
pvname(proc->proc_name, vp->vers_num); |
} |
} |
f_print(fout, "),\n"); |
f_print(fout, "),\n"); |
|
|
/* argument info */ |
/* argument info */ |
if (proc->arg_num > 1) |
if( proc->arg_num > 1 ) |
printit((char*) NULL, proc->args.argname); |
printit((char*) NULL, proc->args.argname ); |
else |
else |
/* do we have to do something special for newstyle */ |
/* do we have to do something special for newstyle */ |
printit(proc->args.decls->decl.prefix, |
printit( proc->args.decls->decl.prefix, |
proc->args.decls->decl.type); |
proc->args.decls->decl.type ); |
/* result info */ |
/* result info */ |
printit(proc->res_prefix, proc->res_type); |
printit(proc->res_prefix, proc->res_type); |
} |
} |
|
|
} |
} |
} |
} |
|
|
static void |
static |
printit(prefix, type) |
printit(prefix, type) |
char *prefix; |
char *prefix; |
char *type; |
char *type; |
{ |
{ |
int len, tabs; |
int len; |
|
int tabs; |
|
|
|
|
len = fprintf(fout, "\txdr_%s,", stringfix(type)); |
len = fprintf(fout, "\txdr_%s,", stringfix(type)); |
/* account for leading tab expansion */ |
/* account for leading tab expansion */ |
len += TABSIZE - 1; |
len += TABSIZE - 1; |
|
|
if (streq(type, "void")) { |
if (streq(type, "void")) { |
f_print(fout, "0"); |
f_print(fout, "0"); |
} else { |
} else { |
f_print(fout, "sizeof ("); |
f_print(fout, "sizeof ( "); |
/* XXX: should "follow" be 1 ??? */ |
/* XXX: should "follow" be 1 ??? */ |
ptype(prefix, type, 0); |
ptype(prefix, type, 0); |
f_print(fout, ")"); |
f_print(fout, ")"); |