changeset 150:26042f4007d5 current

fix examples
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 23 May 2020 07:51:47 +0900
parents ff10c3399912
children 2eca1fb48fa2
files CbC-examples/arg.c CbC-examples/stack1.c CbC-examples/test05.c CbC-examples/test_cs.c CbC-examples/test_para3.c CbC-examples/test_para4.c CbC-examples/test_tree.c
diffstat 7 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/CbC-examples/arg.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/arg.c	Sat May 23 07:51:47 2020 +0900
@@ -13,13 +13,13 @@
 void *exit_env;
 __code (*exit___code)();
 
-#ifndef __llvm__ 
+// #ifndef __llvm__ 
 __code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env);
 __code cargs(struct arg args0,__code exit1(int, void*),void *env);
 __code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l);
 __code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l);
 __code carg6(int i, int j,int k,int l,struct arg args0);
-#endif
+// #endif
 
 __code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env)
 {
--- a/CbC-examples/stack1.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/stack1.c	Sat May 23 07:51:47 2020 +0900
@@ -3,7 +3,9 @@
  */
 
 #include <stdio.h>
-#define NULL 0
+#include <stdlib.h>
+
+// #define NULL 0
 extern int printf(const char*, ...);
 
 extern void *malloc(size_t);
@@ -30,7 +32,7 @@
     goto (* ((struct cont_save *)sp)->ret)(i+4,sp);
 }
 
-__code __attribute__ ((fastcall)) f_g1(int j,void *sp) {  /* Continuation  */
+__code f_g1(int j,void *sp) {  /* Continuation  */
     int k;
     struct f_g0_save *c;
 
@@ -98,6 +100,8 @@
 	goto print(i,j,exit2,exit2env);
 }
 
+int main0( int ac, char *av[]);
+
 int main(int ac, char*av[]){
 	main0(ac,av);
 }
--- a/CbC-examples/test05.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/test05.c	Sat May 23 07:51:47 2020 +0900
@@ -1,4 +1,6 @@
 //#include<stdio.h>
+#include <stdlib.h>
+
 extern int printf(const char*, ...);
 #define dprint(f, args...) \
     printf("in %s: "f, __FUNCTION__, ## args)
--- a/CbC-examples/test_cs.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/test_cs.c	Sat May 23 07:51:47 2020 +0900
@@ -2,6 +2,7 @@
 //#include<stdlib.h>
 
 extern int printf(const char*, ...);
+extern     void exit(int status);
 
 __code cs_exit(int , double , char );
 __code cs1(int, int, int, int);
--- a/CbC-examples/test_para3.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/test_para3.c	Sat May 23 07:51:47 2020 +0900
@@ -49,9 +49,9 @@
 int function(){
 	struct abc A;
 	struct def B;
-	A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad;
-	B.d = 30, B.f = 0xbf;
-	B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed;
+	A.a = 10, A.b = 20.02, A.c = '\0', A.d = (void*)0xad;
+	B.d = 30, B.f = (void*)0xbf;
+	B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = (void*)0xed;
 
 	printf("function  :\n");
 	print_abc(A);
@@ -65,9 +65,9 @@
 	struct abc A;
 	struct def B;
 	//int a=10, b=20, c=30, d=40, e=50, f=60, g=70;
-	A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad;
-	B.d = 30, B.f = 0xbf;
-	B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed;
+	A.a = 10, A.b = 20.02, A.c = '\0', A.d = (void*)0xad;
+	B.d = 30, B.f = (void*)0xbf;
+	B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = (void*)0xed;
 
 	/*
 	printf("main    :\n");
--- a/CbC-examples/test_para4.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/test_para4.c	Sat May 23 07:51:47 2020 +0900
@@ -2,6 +2,7 @@
 //#include<stdlib.h>
 
 extern int printf(const char*, ...);
+extern     void exit(int status);
 
 #define DPRINT 1
 #define NOINLINE __attribute__((noinline))
--- a/CbC-examples/test_tree.c	Sat Mar 21 09:14:44 2020 +0900
+++ b/CbC-examples/test_tree.c	Sat May 23 07:51:47 2020 +0900
@@ -5,6 +5,8 @@
 __code cs(int , double , char );
 void testvoid(double a);
 int testint(double a);
+void test_goto(int a, int b, double c);
+__code test_goto1(int a, int b, double c);
 
 __code cs(int a, double b, char c){
 	printf("__code cs was called.\n");