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 3063 - (download) (as text) (annotate)
Thu Jun 5 00:42:15 2008 UTC (10 years, 11 months ago) by mrainey
File size: 728 byte(s)
  Bugfixes for ia32 vararg calls.
#include <stdio.h>

struct vararg_s {
  union arg_u {
    int i;
    double d;
    char* s;
  } arg;
  long long kind;
  long long loc;
  long long ty;
};

struct varargs_s {
  struct vararg_s* hd;
  void* p;
  struct varargs_s* tl;
};

extern int varargs (void* cFun, struct varargs_s* args, int stkSz);

int vararg_wrapper (void* cFun, struct varargs_s* args, int stkSz)
{
  printf ("vararg cFun=%p args=%p, stkSz=%d\n", cFun, varargs, stkSz);
  struct varargs_s* tmp_args = args;
  while (tmp_args) {
    struct vararg_s* hd = tmp_args->hd;
    printf ("arg=%s kind=%d loc=%d ty=%d\n", hd->arg.s, (int)hd->kind, (int)hd->loc, (int)hd->ty);
    tmp_args = tmp_args->tl;
  }
  int x = varargs(cFun, args, stkSz);
  return 0;
}

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