comparison CbC-examples/test_func2code.c @ 21:959d4c8c8abc

add conv.c conv1.c
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Tue, 29 Sep 2009 20:15:16 +0900
parents
children
comparison
equal deleted inserted replaced
20:9de9dad105d4 21:959d4c8c8abc
1 #include<stdio.h>
2 #include<stdlib.h>
3
4 #define DEBUG 1
5 #ifdef DEBUG
6 #define log(f, args...) \
7 fprintf(stderr, "in %s: "f, __FUNCTION__, ## args)
8 #else
9 #define log(f, args...) ;
10 #endif
11
12 __code
13 exitter(int a)
14 {
15 exit(0);
16 }
17
18 __code
19 cs0(int x, int y)
20 {
21 log("x = %d, y = %d.\n", x, y);
22 log("will exit with code %d.\n", x*y);
23 goto exitter(x*y);
24 }
25
26 void
27 continuation(int a)
28 {
29 log("go code segment cs0\n");
30 goto cs0(a, a*20);
31 log("Error: continuation reachs bad region.\n");
32 }
33
34 int
35 main(int argc, char **argv)
36 {
37 int a;
38 if (argc>2) {
39 a = atoi(argv[1]);
40 }
41
42 continuation(20);
43 }