Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /MLRISC/trunk/vararg-ccall/vararg.c
ViewVC logotype

Annotation of /MLRISC/trunk/vararg-ccall/vararg.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3063 - (view) (download) (as text)

1 : mrainey 3062 #include <stdio.h>
2 :    
3 :     struct vararg_s {
4 :     union arg_u {
5 :     int i;
6 :     double d;
7 :     char* s;
8 :     } arg;
9 :     long long kind;
10 :     long long loc;
11 :     long long ty;
12 :     };
13 :    
14 :     struct varargs_s {
15 :     struct vararg_s* hd;
16 :     void* p;
17 :     struct varargs_s* tl;
18 :     };
19 :    
20 : mrainey 3063 extern int varargs (void* cFun, struct varargs_s* args, int stkSz);
21 :    
22 :     int vararg_wrapper (void* cFun, struct varargs_s* args, int stkSz)
23 : mrainey 3062 {
24 : mrainey 3063 printf ("vararg cFun=%p args=%p, stkSz=%d\n", cFun, varargs, stkSz);
25 :     struct varargs_s* tmp_args = args;
26 :     while (tmp_args) {
27 :     struct vararg_s* hd = tmp_args->hd;
28 : mrainey 3062 printf ("arg=%s kind=%d loc=%d ty=%d\n", hd->arg.s, (int)hd->kind, (int)hd->loc, (int)hd->ty);
29 : mrainey 3063 tmp_args = tmp_args->tl;
30 : mrainey 3062 }
31 : mrainey 3063 int x = varargs(cFun, args, stkSz);
32 : mrainey 3062 return 0;
33 :     }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0