From 3cced4ee453f635703513013e7ae1ee76351f9ac Mon Sep 17 00:00:00 2001 From: David Howells Date: Wed, 13 Feb 2002 04:09:14 +0000 Subject: [PATCH] rxgen-generate-function-prototypes-20020212 actually from David Howells of Red Hat. generates function prototypes in rxgen-emitted headers --- src/rxgen/rpc_hout.c | 55 +++++++++++++++++++++++++++++++++++++++++++ src/rxgen/rpc_parse.c | 4 ++++ src/rxgen/rpc_parse.h | 1 + 3 files changed, 60 insertions(+) diff --git a/src/rxgen/rpc_hout.c b/src/rxgen/rpc_hout.c index ea9f23ddd..bb763cb42 100644 --- a/src/rxgen/rpc_hout.c +++ b/src/rxgen/rpc_hout.c @@ -38,6 +38,7 @@ RCSID("$Header$"); #include +#include #include #include "rpc_util.h" #include "rpc_parse.h" @@ -46,6 +47,7 @@ static pconstdef(); static pstructdef(); static puniondef(); static pprogramdef(); +static psprocdef(); static penumdef(); static ptypedef(); static pdeclaration(); @@ -82,6 +84,9 @@ print_datadef(def) case DEF_PROGRAM: pprogramdef(def); break; + case DEF_PROC: + psprocdef(def); + break; case DEF_CONST: pconstdef(def); break; @@ -203,6 +208,56 @@ pprogramdef(def) } } +static +psproc1(defp,callTconnF,type,prefix,iomask) +definition *defp; +int callTconnF; +char *type, *prefix; +int iomask; +{ + proc1_list *plist, *plist1; + + f_print(fout,"\nextern %s %s%s%s(\n",type,prefix,defp->pc.proc_prefix,defp->pc.proc_name); + + if (callTconnF) { + f_print(fout,"\t/*IN */ struct rx_call *z_call"); + } else { + f_print(fout,"\t/*IN */ struct rx_connection *z_conn"); + } + + for (plist = defp->pc.plists; plist; plist = plist->next) { + if (plist->component_kind == DEF_PARAM && (iomask & (1<pl.param_kind))) { + switch (plist->pl.param_kind) { + case DEF_INPARAM: f_print(fout,",\n\t/*IN */ "); break; + case DEF_OUTPARAM: f_print(fout,",\n\t/*OUT*/ "); break; + case DEF_INOUTPARAM: f_print(fout,",\n\t/*I/O*/ "); break; + } + if (plist->pl.param_flag & OUT_STRING) { + f_print(fout,"%s *%s",plist->pl.param_type,plist->pl.param_name); + } else { + f_print(fout,"%s %s",plist->pl.param_type,plist->pl.param_name); + } + } + } + f_print(fout, ");\n"); +} + +static +psprocdef(defp) +definition *defp; +{ + int split_flag = defp->pc.split_flag; + + if (split_flag) { + psproc1(defp,1,"int","Start",(1<pc.split_flag = 1; scan2(TOK_EQUAL, TOK_SEMICOLON, &tok); } + else { + defp->pc.split_flag = 0; + } if (tok.kind == TOK_EQUAL) { if (opcodesnotallowed[PackageIndex]) error("Opcode assignment isn't allowed here!"); diff --git a/src/rxgen/rpc_parse.h b/src/rxgen/rpc_parse.h index 1d91d41e8..010306cbd 100644 --- a/src/rxgen/rpc_parse.h +++ b/src/rxgen/rpc_parse.h @@ -187,6 +187,7 @@ struct procedure_def { #undef INOUT #define INOUT 2 short paramtypes[3]; + char split_flag; relation rel; proc1_list *plists; }; -- 2.39.5