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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3068 - (download) (as text) (annotate)
Fri Jun 6 00:25:53 2008 UTC (10 years, 9 months ago) by mrainey
File size: 837 byte(s)
  Got the prototype up and running.
#include <stdio.h>

struct zipped_arg_s {
  union val_u {
    int i;
    double d;
    char* s;
  } val;
  long long kind;
  long long loc;
  long long ty;
};

extern void varargs (void* cFun, struct zipped_arg_s* args, struct zipped_arg_s* argsEnd);

void vararg_wrapper (void* cFun, struct zipped_arg_s* args, struct zipped_arg_s* argsEnd)
{
  printf ("vararg cFun=%p args=%p, end=%p\n", cFun, args, argsEnd);
  struct zipped_arg_s* tmp_args = args;

  for(tmp_args = args; tmp_args < argsEnd; tmp_args++)
    if ((int)tmp_args->ty == 32)
      printf ("arg=%d kind=%d loc=%d ty=%d\n", tmp_args->val.i, (int)tmp_args->kind, (int)tmp_args->loc, (int)tmp_args->ty);
    else 
      printf ("arg=%f kind=%d loc=%d ty=%d\n", tmp_args->val.d, (int)tmp_args->kind, (int)tmp_args->loc, (int)tmp_args->ty);

  varargs(cFun, args, argsEnd);
}


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