Posted to tcl by gps at Mon Mar 02 01:32:51 GMT 2009view raw
- struct box {int x; int y; int width; int height};
- procedure new_box {declare int x; declare int y; declare int width; declare int height} {
- declare struct box b;
- declare int s;
- typesize s box;
- rcall b allocate s;
- call print_pointer b;
- -> b.x x;
- -> b.y y;
- -> b.width width;
- -> b.height height;
- result b;
- } {declare struct box};
- procedure move_box {declare struct box b; declare int x; declare int y} {
- declare int var;
- -> b.x x;
- -> b.y y;
- result b;
- } {declare struct box};
- #I don't have strings yet, so this is what is what the runtime calls so far:
- procedure startup {declare int argc;} {
- declare struct box b;
- rcall b new_box 0 0 400 400;
- call print_pointer b;
- call move_box b 20 20;
- call say_hello;
- call print_pointer b;
- call print_integer b.x;
- result 0;
- } {declare int};