• R/O
  • SSH

CbC: Commit

micro-C base Continuation based C


Commit MetaInfo

Revision07fdf66a7547d6dd8ccc6c16ed5a384c54e11a4c (tree)
Zeit2012-11-17 13:54:46
AutorShinji KONO <kono@ie.u...>
CommiterShinji KONO

Log Message

merge

Ändern Zusammenfassung

Diff

diff -r 2a5be2433ef2 -r 07fdf66a7547 test/cbc_return.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/cbc_return.c Sat Nov 17 13:54:46 2012 +0900
@@ -0,0 +1,35 @@
1+#include<stdio.h>
2+typedef void (*RET_FUNC)(int, void *);
3+
4+void g(RET_FUNC func)
5+{
6+ func(33, NULL);
7+}
8+
9+int f_cbc()
10+{
11+ //__label__ _cbc_exit0;
12+ //int retval;
13+ void *ret;
14+
15+ ret = _CbC_return;
16+
17+ printf("#0016:f0: fp = 0x%x\n", __builtin_frame_address(0));
18+ printf("#0017:__return_func = %x\n", ret);
19+ g(ret);
20+
21+ printf("#0020:not good\n");
22+ return 0;
23+//_cbc_exit0:
24+ //printf("#0023:f1: fp = 0x%x\n", __builtin_frame_address(0));
25+ //return retval;
26+}
27+
28+int main(int argc, char **argv)
29+{
30+ int t;
31+ printf("#0030:main before: fp = 0x%x\n", __builtin_frame_address(0));
32+ t = f_cbc();
33+ printf("#0032:f_cbc = %d\n", t);
34+ printf("#0033:main after: fp = 0x%x\n", __builtin_frame_address(0));
35+}
diff -r 2a5be2433ef2 -r 07fdf66a7547 test/cloop.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/cloop.c Sat Nov 17 13:54:46 2012 +0900
@@ -0,0 +1,57 @@
1+int printf(const char *,...);
2+
3+char c[] = {0,1,2,3,4,5,6,7,8,9};
4+short s[] = {0,1,2,3,4,5,6,7,8,9};
5+int j[] = {0,1,2,3,4,5,6,7,8,9};
6+long long l[] = {0,1,2,3,4,5,6,7,8,9};
7+
8+void
9+f(char *c,short *s, int *j, long long *l)
10+{
11+ int i;
12+ for( i = 0;i<10;i++) {
13+ printf("%d ",c[i]);
14+ }
15+ for( i = 0;i<10;i++) {
16+ printf("%d ",s[i]);
17+ }
18+ for( i = 0;i<10;i++) {
19+ printf("%d ",j[i]);
20+ }
21+ for( i = 0;i<10;i++) {
22+ printf("%lld ",l[i]);
23+ }
24+ printf("\n");
25+}
26+
27+void
28+st(char *c,short *s, int *j, long long *l)
29+{
30+ int i;
31+ for( i = 0;i<10;i++) {
32+ c[i] = i;
33+ printf("\n");
34+ }
35+ for( i = 0;i<10;i++) {
36+ s[i] = i;
37+ printf("\n");
38+ }
39+ for( i = 0;i<10;i++) {
40+ j[i] = i;
41+ printf("\n");
42+ }
43+ for( i = 0;i<10;i++) {
44+ l[i] = i;
45+ printf("\n");
46+ }
47+}
48+
49+int
50+main()
51+{
52+ f(c,s,j,l);
53+ st(c,s,j,l);
54+ f(c,s,j,l);
55+}
56+
57+/* end */
Show on old repository browser