00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "prim2.hh"
00025 #include "stdlib.h"
00026
00027 Sym FFUN = symbol ("ForeignFunction");
00028
00029 Tree ffunction (Tree signature, Tree incfile, Tree libfile)
00030 {
00031 return tree(FFUN, signature, incfile, libfile);
00032 }
00033
00034 bool isffunction(Tree t)
00035 {
00036 return t->node() == Node(FFUN);
00037 }
00038
00039 Tree ffsignature(Tree ff)
00040 {
00041 return ff->branch(0);
00042 }
00043
00044 const char* ffincfile(Tree ff)
00045 {
00046 return tree2str(ff->branch(1));
00047 }
00048
00049 const char* fflibfile(Tree ff)
00050 {
00051 return tree2str(ff->branch(2));
00052 }
00053
00054 int ffrestype(Tree t)
00055 {
00056 return tree2int(hd(ffsignature(t)));
00057 }
00058
00059 const char* ffname(Tree t)
00060 {
00061 return tree2str(nth(ffsignature(t),1));
00062 }
00063
00064 int ffarity(Tree t)
00065 {
00066 return len(ffsignature(t))-2;
00067 }
00068
00069 int ffargtype(Tree t, int i)
00070 {
00071 return tree2int(nth(ffsignature(t), i+2));
00072 }