Mercurial > hg > CbC > CbC_gcc
comparison CbC-examples/stack1.c @ 150:26042f4007d5 current
fix examples
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 May 2020 07:51:47 +0900 |
parents | 420680fc7707 |
children |
comparison
equal
deleted
inserted
replaced
149:ff10c3399912 | 150:26042f4007d5 |
---|---|
1 /* | 1 /* |
2 test for CbC converted __code from C | 2 test for CbC converted __code from C |
3 */ | 3 */ |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #define NULL 0 | 6 #include <stdlib.h> |
7 | |
8 // #define NULL 0 | |
7 extern int printf(const char*, ...); | 9 extern int printf(const char*, ...); |
8 | 10 |
9 extern void *malloc(size_t); | 11 extern void *malloc(size_t); |
10 | 12 |
11 typedef void *stack; | 13 typedef void *stack; |
28 | 30 |
29 __code g(int i,void *sp) { | 31 __code g(int i,void *sp) { |
30 goto (* ((struct cont_save *)sp)->ret)(i+4,sp); | 32 goto (* ((struct cont_save *)sp)->ret)(i+4,sp); |
31 } | 33 } |
32 | 34 |
33 __code __attribute__ ((fastcall)) f_g1(int j,void *sp) { /* Continuation */ | 35 __code f_g1(int j,void *sp) { /* Continuation */ |
34 int k; | 36 int k; |
35 struct f_g0_save *c; | 37 struct f_g0_save *c; |
36 | 38 |
37 c = sp; | 39 c = sp; |
38 k = c->kk; | 40 k = c->kk; |
96 | 98 |
97 sp += sizeof(struct f0_save); | 99 sp += sizeof(struct f0_save); |
98 goto print(i,j,exit2,exit2env); | 100 goto print(i,j,exit2,exit2env); |
99 } | 101 } |
100 | 102 |
103 int main0( int ac, char *av[]); | |
104 | |
101 int main(int ac, char*av[]){ | 105 int main(int ac, char*av[]){ |
102 main0(ac,av); | 106 main0(ac,av); |
103 } | 107 } |
104 | 108 |
105 int main0( int ac, char *av[]) | 109 int main0( int ac, char *av[]) |