diff CbC-examples/too-long-argument.c @ 78:365b84b6fe04

more examples
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 20 Sep 2011 17:32:20 +0900
parents
children b0f061ae1da0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CbC-examples/too-long-argument.c	Tue Sep 20 17:32:20 2011 +0900
@@ -0,0 +1,104 @@
+#define __environment _CbC_environment
+#define __return _CbC_return
+
+#include <stdio.h>
+
+#undef WRONGNUMBER
+
+typedef __code
+(*CCC)( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff,
+	__code(*ret)(int,void *),
+	void *env);
+
+__code
+tcode2( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff,
+	__code(*ret)(int,void *),
+	void *env)
+{
+fprintf(stdout,"#0017:tcode2: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n",
+f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff);
+     goto ret(0,env);
+}
+
+__code
+tcode1(f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff,ret,env)
+	int f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff;
+	__code(*ret)(int,void *);
+	void *env;
+{
+fprintf(stdout,"#0028:tcode1: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n",
+f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff);
+     goto ret(0,env);
+}
+
+__code
+tcode4(int x,int y,CCC junction,__code(*ret)(int),void *env)
+{
+#ifdef WRONGNUMBER
+     goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,ret,env);
+#else
+     goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env);
+#endif
+}
+
+__code
+tcode0(int x,int y,__code(*junction)(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,__code(*)(int),void *),__code(*ret)(int),void *env)
+{
+#ifdef WRONGNUMBER
+     goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,ret,env);
+#else
+     goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env);
+#endif
+}
+
+int
+main0()
+{
+#ifdef WRONGNUMBER
+     goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+	__return,__environment);
+#else
+     goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
+	__return,__environment);
+#endif
+}
+
+int
+main1()
+{
+#ifdef WRONGNUMBER
+     goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13,
+	__return,__environment);
+#else
+     goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
+	__return,__environment);
+#endif
+}
+
+int
+main2()
+{
+     goto tcode0(0,1,tcode1,__return,__environment);
+}
+
+int
+main4()
+{
+     goto tcode4(0,1,tcode2,__return,__environment);
+}
+
+int
+main()
+{
+    printf("#0092:main4\n");
+    main4();
+    printf("#0094:main2\n");
+    main2();
+    printf("#0096:main0\n");
+    main0();
+    printf("#0098:main1\n");
+    main1();
+return 0;
+}
+
+//