changeset 11:bdf156058529 draft

merge
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sun, 03 Jun 2012 22:09:34 +0900
parents 972515f10c1d (current diff) d6ac7ec2c6a7 (diff)
children 774d70d1ea62
files
diffstat 5 files changed, 75 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/DPP/Makefile	Sun Jun 03 22:09:13 2012 +0900
+++ b/DPP/Makefile	Sun Jun 03 22:09:34 2012 +0900
@@ -1,9 +1,10 @@
 CC=cbc-gcc-4.6.0
+#CC=~/hg/CbC/build-CbC-4.5/INSTALL_DIR/bin/cbc-gcc-4.5.0 
 #MCC=mcc
 TARGET=dpp dpp2 tableau tableau2 tableau3
 #MCCFLAGS=-s
-#CFLAGS=-I. -g -O0 -Wall
-CFLAGS= -O2 -Wall
+#CFLAGS=-I. -g -Wall
+CFLAGS=-O3 -Wall
 
 .SUFFIXES:	.cbc .c .o
 
--- a/DPP/dpp.cbc	Sun Jun 03 22:09:13 2012 +0900
+++ b/DPP/dpp.cbc	Sun Jun 03 22:09:34 2012 +0900
@@ -3,7 +3,7 @@
 ** Author : Atsuki Shimoji
 ** Note   : This is a single running program.
 */
-
+#include <stdio.h>
 #include "dpp.h"
 
 code putdown_lfork(PhilsPtr self)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loop/print.c	Sun Jun 03 22:09:34 2012 +0900
@@ -0,0 +1,4 @@
+void func(void (*p)() ) { p(); }
+#include <stdio.h>
+void print() { printf("Hello\n");}
+int main() { func(print); return 0;}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loop/print.cbc	Sun Jun 03 22:09:34 2012 +0900
@@ -0,0 +1,15 @@
+__code print(__rectype *p);
+
+__code func(__rectype *p) { 
+  p(print);
+}
+
+#include <stdio.h>
+__code print(__rectype *p) { 
+  printf("Hello\n");
+}
+
+int main() { 
+  goto func(print); 
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loop/while.cbc	Sun Jun 03 22:09:34 2012 +0900
@@ -0,0 +1,52 @@
+#define __environment _CbC_environment
+#define __return _CbC_return
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+__code csa(__rectype *p, int total, int count);
+
+
+__code print(__rectype *p, int total, int count) {
+  printf("function print()\n");
+  printf("total = %d\ncount = %d\n",total,count);
+  exit(0);
+}
+
+__code cs_end(__rectype *p, int total, int count){
+  printf("cs_end: loop end\n");
+  goto p(csa, total, count);
+}
+
+
+__code while_cond(__rectype *p, int total, int count) {
+  printf("while_cond\n");
+  if ( count <= 100) {
+    goto cs_while(p, total, count);
+  } else {
+    goto cs_end(p, total, count);
+  }
+
+}
+
+__code cs_while(__rectype *p, int total, int count) {
+  printf("cswhile: \n");
+  total += count;
+  count ++;
+  goto while_cond(p, total, count);
+}
+
+__code csa(__rectype *p, int total, int count) {
+  goto cs_while(print, 0, 0);
+}
+
+void func() {
+  goto csa(print, 0, 0);
+}
+
+int main()
+{
+  func();
+  return 0;
+}