~ubuntu-branches/ubuntu/wily/gargoyle-free/wily-proposed

« back to all changes in this revision

Viewing changes to tads/tads3/test/data/varmacpp.c

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Beucler
  • Date: 2009-09-11 20:09:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090911200943-idgzoyupq6650zpn
Tags: upstream-2009-08-25
ImportĀ upstreamĀ versionĀ 2009-08-25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define printf(prefix, arg...) \
 
2
   tadsSay(prefix); "\n"; \
 
3
   arg#foreach*"\t"; tadsSay(#@arg + ' = ' + arg); "\n"; **
 
4
 
 
5
#define makelist(ele...) [ele#foreach#ele#,#]
 
6
 
 
7
#define makelist2(nm, eles...) (nm = [eles#argcount, ## eles])
 
8
 
 
9
#define inheritNext(prop, args...) \
 
10
    doInheritNext(getMethodDefiner(), &prop, args#foreach#args#,#)
 
11
 
 
12
#define printConcat(prefix, args...) \
 
13
    tadsSay(prefix args#ifnempty#,# args#foreach#args#+#)
 
14
 
 
15
main(args)
 
16
{
 
17
    local a = 1;
 
18
    local b = 2;
 
19
    local xyz = 3;
 
20
    local lst;
 
21
    
 
22
    printf('hello', a, b, xyz);
 
23
    printf('goodbye');
 
24
 
 
25
    "\blist 1 a:\n";
 
26
    lst = makelist(1, 2, 3);
 
27
    foreach(local cur in lst)
 
28
        "cur = <<cur>>\n";
 
29
 
 
30
    "\blist 1 b:\n";
 
31
    lst = makelist();
 
32
    foreach(local cur in lst)
 
33
        "cur = <<cur>>\n";
 
34
 
 
35
    "\blist 1 c:\n";
 
36
    lst = makelist(8);
 
37
    foreach(local cur in lst)
 
38
        "cur = <<cur>>\n";
 
39
 
 
40
    "\blist2 a:\n";
 
41
    makelist2(lst, 7, 8, 9, 10);
 
42
    foreach(local cur in lst)
 
43
        "cur = <<cur>>\n";
 
44
 
 
45
    "\blist2 b:\n";
 
46
    makelist2(lst);
 
47
    foreach(local cur in lst)
 
48
        "cur = <<cur>>\n";
 
49
 
 
50
    inheritNext(sdesc, 1, 2, 3);
 
51
    inheritNext(sdesc, 'hello');
 
52
    inheritNext(ldesc);
 
53
 
 
54
    "\b";
 
55
    printConcat('no-arguments'); "\n";
 
56
    printConcat('args', 'a', 'b', 'c'); "\n";
 
57
}
 
58
 
 
59
property sdesc, ldesc;
 
60
 
 
61
doInheritNext(obj, prop, [args])
 
62
{
 
63
    "doInheritNext: ";
 
64
    switch(prop)
 
65
    {
 
66
    case &sdesc: "sdesc"; break;
 
67
    case &ldesc: "ldesc"; break;
 
68
    default: "unknown prop"; break;
 
69
    }
 
70
 
 
71
    "\n";
 
72
    foreach(local cur in args)
 
73
        "\t<<cur>>\n";
 
74
}