[Prev][Next][Index][Thread]

More macro questions



I've begun hacking at the GD c-ffi library again. Now that I have a
passing knowledge of macros, maybe I can at least get a skeleton
version to compile, and slowly implement each macro.

I've fixed quite a few of the broken macros ('fixed' isn't a great
word for that; they at least compile now.) I'm trying to get a basic
C-function-definer macro built so that the definitions for malloc and
free will parse. Here is what I'm trying to match:

define C-function malloc
  /* XXX - Need <C-size-t> and <C-raw-pointer> */
  parameter size :: <C-size-t>;
  result memory :: <C-raw-pointer>;
  c-name: "malloc";
end;

And here is my broken definition of that macro:

define macro C-function-definer
  { define C-function ?dname:name
      { (parameter ?pname:name :: ?type:name) ... }
      { (result ?rname:name :: ?type:name) ... }
      { c-name ?cname:name }
    end }
    => { /* XXX - need expansion */ }
end macro;

But, this doesn't work. Can anyone suggest how I can fix the above
macro to match the above case? I realize that this probably isn't an
all-inclusive case, but I think that if I can get it working,
additions shouldn't be a problem.



Follow-Ups: