Debian Codegraph @

terps/tads/tads3/test/data/bifptr.t

raw
1 #include <tads.h>
2 #include <dynfunc.h>
3
4 showIfc(p)
5 {
6 if (p != nil)
7 "{ argc=<<p[1]>>, optArgc=<<p[2]>>, varargs=<<p[3] ? 'yes' : 'no'>> }";
8 else
9 "(not found)";
10 }
11
12 obj: object
13 ;
14
15 main(args)
16 {
17 local f = &tadsSay;
18 "f=tadsSay: ifc=<<showIfc(getFuncParams(f))>>\n";
19 f('this is a pointer call to tadsSay!!!\n');
20 "\b";
21
22 obj.setMethod(&m1, &tadsSay);
23 "obj.m1=tadsSay: ifc=<<showIfc(obj.getPropParams(&m1))>>\n";
24 obj.m1('this is a setMethod call to tadsSay!!!\n');
25 "\b";
26
27 f = Compiler.compile(
28 'function(x) {'
29 + 'local f = &tadsSay;'
30 + '"in DynamicFunc: f=tadsSay: ifc=<\<showIfc(getFuncParams(f))>>\\n";'
31 + 'f(\'DynamicFunc pointer call to tadsSay! x=<\<x>>\\n\');'
32 + '}');
33 f(1234);
34 }