]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
rxgen-generate-function-prototypes-20020212
authorDavid Howells <bartbanter@hotmail.com>
Wed, 13 Feb 2002 04:09:14 +0000 (04:09 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 13 Feb 2002 04:09:14 +0000 (04:09 +0000)
actually from David Howells of Red Hat.
generates function prototypes in rxgen-emitted headers

src/rxgen/rpc_hout.c
src/rxgen/rpc_parse.c
src/rxgen/rpc_parse.h

index ea9f23ddde0f8f3ba96e462360834206bfe4c00f..bb763cb42f60dd56bb1e4a2ce05510636e5bbbc2 100644 (file)
@@ -38,6 +38,7 @@
 RCSID("$Header$");
 
 #include <stdio.h>
+#include <string.h>
 #include <ctype.h>
 #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<<plist->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<<DEF_INPARAM )|(1<<DEF_INOUTPARAM));
+               psproc1(defp,1,"int","End",  (1<<DEF_OUTPARAM)|(1<<DEF_INOUTPARAM));
+       } else {
+               psproc1(defp,0,"int","",0xFFFFFFFF);
+       }
+
+       psproc1(defp,1,"afs_int32","S",0xFFFFFFFF);
+}
+
 
 pprocdef(proc, vp)
        proc_list *proc;
index 7b1d8e450fe6f799a77bc25a8431bdb9ff410c0a..825ddf851045549b0dd26bc4d275cad19ae6bc24 100644 (file)
@@ -780,8 +780,12 @@ int noname;
     }
     if (tok.kind  == TOK_SPLIT) {
        proc_split = 1;
+       defp->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!");
index 1d91d41e843e9c541a948308d806f822749f765a..010306cbd5dc2016e1b9defd154ed6b8ed1686ea 100644 (file)
@@ -187,6 +187,7 @@ struct procedure_def {
 #undef INOUT
 #define        INOUT   2
     short paramtypes[3];
+    char split_flag;
     relation rel;
     proc1_list *plists;
  };