Commit 2d0aacef authored by Erwan Jahier's avatar Erwan Jahier
Browse files

lurette unstable_1_43.7 Tue, 07 Feb 2006 17:49:05 +0100 by jahier

Parent-Version:      unstable_1_43.6
Version-Log:

source/util.ml
source/parse_luc.ml
source/lurettetop.ml
   fix gnuplot calling under win32.

source/parse_c_scade.ml
   give better error msg during a parse error

source/lustreExp.ml

source/Makefile.luc2c
source/luc2c.ml
   A little bit more work on that.

Project-Description: Lurette
parent 7b737c8c
......@@ -75,12 +75,12 @@
(source/liblutin.idl 181 1127735479 j/21_liblutin.i 1.1)
(doc/lurette-man/sensors.tex 846 1138032075 q/5_sensors.te 1.1)
(test/time-CHAILLOL.res 8235 1063029729 g/11_time-CHAIL 1.1)
(source/parse_luc.ml 50860 1137765987 41_parse_env. 1.67)
(source/parse_luc.ml 50914 1139330945 41_parse_env. 1.68)
(source/lurette_exe.c 178 1122044801 e/27_lurette_ex 1.3)
(source/show_luc.ml 4332 1137765987 e/25_show_luc.m 1.13)
(examples/xlurette/Scade-sparc/Direction_D1.saofd 1335 1137765987 l/21_Direction_ 1.1)
(install/xlurette.sh.in 95 1137765987 g/21_xlurette.s 1.3)
(source/lurettetop.ml 85071 1137765987 c/1_lurettetop 1.63)
(source/lurettetop.ml 84862 1139330945 c/1_lurettetop 1.64)
(doc/lurette-man/clean-button.jpg 879 1138032075 q/0_clean-butt 1.1)
(examples/xlurette/Sildex/sut_sildex.c 10531 1138025047 o/23_sut_sildex 1.1)
(polka/Changes 1952 1071844798 e/22_Changes 1.2)
......@@ -103,8 +103,8 @@
(install/pixmaps/config-params.xpm 2753 1137765987 n/12_config-par 1.1)
(source/exp.mli 3611 1127735479 g/48_exp.mli 1.8)
(examples/xlurette/Gyro/giro2.luc 2836 1137765987 m/41_giro2.luc 1.1)
(source/lustreExp.ml 41139 1137765987 g/45_lustreExp. 1.14)
(source/Makefile.luc2c 1319 1138025047 n/45_Makefile.l 1.1)
(source/lustreExp.ml 41154 1139330945 g/45_lustreExp. 1.15)
(source/Makefile.luc2c 1295 1139330945 n/45_Makefile.l 1.2)
(GBDDML/gbdd.cc 49536 1138025047 p/3_gbdd.cc 1.1)
(FAQ 2004 1137765987 i/15_FAQ 1.2)
(polka/documentation/Makefile 476 1047029868 e/18_Makefile 1.1)
......@@ -114,7 +114,7 @@
(install/xlurette.bat.in 60 1137765987 g/22_xlurette.b 1.3)
(test/time-ecrins.res 10644 1137765987 d/20_time-ecrin 1.51)
(examples/lucky/tut-examples/Makefile 611 1137765987 k/25_Makefile 1.1)
(user-rules 25948 1138025047 c/14_myrules 1.75)
(user-rules 25351 1139330945 c/14_myrules 1.76)
(examples/xlurette/Scade-win32/counter.saofd 587 1137765987 l/40_counter.sa 1.1)
(polka/caml/polka_caml.h 1648 1071844798 d/36_polka_caml 1.2)
(utils/lucky_cpp 230 1137765987 n/29_lucky_cpp 1.1)
......@@ -242,7 +242,7 @@
(doc/figs/para.fig 4244 1138034376 q/38_para.fig 1.1)
(install/pixmaps/clean-up.xpm 1565 1137765987 n/26_clean-up.x 1.1)
(polka/C/bit.h 1424 1071844798 e/2_bit.h 1.2)
(source/parse_c_scade.ml 9072 1137765987 e/41_parse_c_sc 1.8)
(source/parse_c_scade.ml 10030 1139330945 e/41_parse_c_sc 1.9)
(source/bddd.mli 1232 1137765987 g/37_bddd.mli 1.12)
(test/time-rey.exp 10176 1090504025 h/13_time-rey.e 1.10)
(source/gne.mli 1887 1127735479 b/36_gne.mli 1.9)
......@@ -288,7 +288,7 @@
(i386-linux-gcc3/include/communic.h 444 1138025047 o/35_communic.h 1.1)
(source/graph.ml 3777 1137765987 14_graph.ml 1.14)
(examples/xlurette/Scade-sparc/libdigital.saofdm 1256 1137765987 l/20_libdigital 1.1)
(source/util.ml 20376 1137765987 35_util.ml 1.78)
(source/util.ml 20508 1139330945 35_util.ml 1.79)
(doc/lurette-man/stop-button.jpg 804 1138032075 p/35_stop-butto 1.1)
(xlurette/Scade/luctcl.tcl 586 1122044801 j/12_luctcl.tcl 1.1)
(source/luc4ocaml.ml 4469 1137765987 i/30_lucaml.ml 1.2)
......@@ -339,7 +339,7 @@
(examples/xlurette/heater/test1.res 0 1137765987 m/22_test1.res 1.1)
(doc/lucky-man/Makefile 1433 1138032075 p/30_Makefile 1.1)
(i386-linux-gcc3/include/caml/intext.h 4313 1138025047 o/44_intext.h 1.1)
(source/version.ml 15 1138025047 n/43_version.ml 1.1)
(source/version.ml 26 1139330945 n/43_version.ml 1.2)
(examples/xlurette/Scade-win32/Pilot.ewo 785 1137765987 l/28_Pilot.ewo 1.1)
(examples/xlurette/heater/test3.rif0 4697 1138025047 m/23_test3.rif0 1.2)
(RELEASE-NOTES 3282 1137765987 h/45_RELEASE-NO 1.7)
......@@ -354,7 +354,7 @@
(i386-linux-gcc3/include/caml/custom.h 2175 1138025047 o/46_custom.h 1.1)
(doc/lurette-man/lurette3.jpg 70191 1138032075 p/43_lurette3.j 1.1)
(examples/xlurette/Scade-win32/Pilot.vsp 2075 1137765987 l/45_Pilot.vsp 1.1)
(source/luc2c.ml 5554 1138025047 n/46_luc2c.ml 1.1)
(source/luc2c.ml 7729 1139330945 n/46_luc2c.ml 1.2)
(install/pixmaps/config-params.bmp 6966 1137765987 m/47_config-par 1.1)
(source/gen_stubs.ml 14674 1137765987 24_generate_l 1.63)
(test/test_losange-10d.lus 108 1065787303 g/41_test_losan 1.1)
......@@ -399,7 +399,7 @@
(doc/tutorial/simple.tex 267 1138032075 q/26_simple.tex 1.1)
(examples/xlurette/tram/Makefile 1271 1138025047 o/19_Makefile 1.1)
(examples/xlurette/fault-tolerant-heater/Makefile 815 1138025047 n/47_Makefile 1.1)
(source/Makefile.release 14027 1138032075 n/41_Makefile.r 1.3)
(source/Makefile.release 14452 1139330945 n/41_Makefile.r 1.4)
(source/socket_client_serveur.ml 1844 1122044801 i/42_socket_cli 1.1)
(xlurette/Scade/LuretteTcl.c 752 1122044801 j/15_LuretteTcl 1.1)
(source/Makefile.lutinlib 1691 1138025047 n/44_Makefile.l 1.1)
......
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Lurette")
(Project-Version lurette unstable_1_43 6)
(Parent-Version lurette unstable_1_43 5)
(Version-Log "")
(Project-Version lurette unstable_1_43 7)
(Parent-Version lurette unstable_1_43 6)
(Version-Log "
source/util.ml
source/parse_luc.ml
source/lurettetop.ml
fix gnuplot calling under win32.
source/parse_c_scade.ml
give better error msg during a parse error
source/lustreExp.ml
source/Makefile.luc2c
source/luc2c.ml
A little bit more work on that.
")
(New-Version-Log ""
)
(Checkin-Time "Tue, 24 Jan 2006 10:07:43 +0100")
(Checkin-Time "Tue, 07 Feb 2006 17:49:05 +0100")
(Checkin-Login jahier)
(Populate-Ignore ())
(Project-Keywords)
......@@ -37,7 +56,7 @@
(source/lucky.mli (lurette/15_env.mli 1.26 644))
(source/lucky.ml (lurette/16_env.ml 1.47 644))
(source/util.ml (lurette/35_util.ml 1.78 644))
(source/util.ml (lurette/35_util.ml 1.79 644))
(source/formula_to_bdd.ml (lurette/g/34_formula_to 1.13 644))
(source/formula_to_bdd.mli (lurette/g/35_formula_to 1.9 644))
......@@ -57,7 +76,7 @@
(source/store.ml (lurette/b/27_rnumsolver 1.46 644))
(source/parse_luc.mli (lurette/40_parse_env. 1.28 644))
(source/parse_luc.ml (lurette/41_parse_env. 1.67 644))
(source/parse_luc.ml (lurette/41_parse_env. 1.68 644))
(source/show_env.mli (lurette/42_show_env.m 1.14 644))
(source/show_env.ml (lurette/43_show_env.m 1.24 644))
......@@ -77,7 +96,7 @@
(source/gne.mli (lurette/b/36_gne.mli 1.9 644))
(source/gne.ml (lurette/b/37_gne.ml 1.10 644))
(source/lurettetop.ml (lurette/c/1_lurettetop 1.63 644))
(source/lurettetop.ml (lurette/c/1_lurettetop 1.64 644))
(source/draw.mli (lurette/f/1_draw.mli 1.5 644))
(source/draw.ml (lurette/f/2_draw.ml 1.7 644))
......@@ -89,7 +108,7 @@
(source/gen_stubs.ml (lurette/24_generate_l 1.63 644))
(source/gen_stubs_common.ml (lurette/e/39_gen_stubs_ 1.7 644))
(source/gen_stubs_common.mli (lurette/e/40_gen_stubs_ 1.5 644))
(source/parse_c_scade.ml (lurette/e/41_parse_c_sc 1.8 644))
(source/parse_c_scade.ml (lurette/e/41_parse_c_sc 1.9 644))
(source/parse_c_scade.mli (lurette/e/42_parse_c_sc 1.5 644))
(source/control.mli (lurette/c/3_control.ml 1.4 644))
......@@ -125,7 +144,7 @@
(Makefile.common.source (lurette/e/33_Makefile.c 1.16 644))
(OcamlMakefile (lurette/17_OcamlMakef 1.54 644))
(install/Makefile.lurette.in (lurette/b/38_Makefile.l 1.38 644))
(user-rules (lurette/c/14_myrules 1.75 644))
(user-rules (lurette/c/14_myrules 1.76 644))
(Makefile (lurette/d/13_Makefile 1.7 644))
(source/Makefile.lurettetop (lurette/d/14_Makefile.l 1.9 644))
......@@ -259,7 +278,7 @@
;; Files added by populate at Thu, 13 Nov 2003 16:59:39 +0100,
;; to version 1.8(w), by jahier:
(source/lustreExp.ml (lurette/g/45_lustreExp. 1.14 644))
(source/lustreExp.ml (lurette/g/45_lustreExp. 1.15 644))
;; Files added by populate at Thu, 13 Nov 2003 16:59:41 +0100,
;; to version 1.8(w), by jahier:
......@@ -748,16 +767,16 @@
(source/luckyCapi_stubs.c (lurette/n/38_luckyCapi_ 1.1 644))
(source/luckyCapi.idl (lurette/n/39_luckyCapi. 1.1 644))
(source/luckyCapi.ml (lurette/n/40_luckyCapi. 1.1 644))
(source/Makefile.release (lurette/n/41_Makefile.r 1.3 644))
(source/Makefile.release (lurette/n/41_Makefile.r 1.4 644))
;; Files added by populate at Fri, 20 Jan 2006 15:37:37 +0100,
;; to version 1.42(w), by jahier:
(source/graphUtil.mli (lurette/n/42_graphUtil. 1.1 644))
(source/version.ml (lurette/n/43_version.ml 1.1 644))
(source/version.ml (lurette/n/43_version.ml 1.2 644))
(source/Makefile.lutinlib (lurette/n/44_Makefile.l 1.1 644))
(source/Makefile.luc2c (lurette/n/45_Makefile.l 1.1 644))
(source/luc2c.ml (lurette/n/46_luc2c.ml 1.1 644))
(source/Makefile.luc2c (lurette/n/45_Makefile.l 1.2 644))
(source/luc2c.ml (lurette/n/46_luc2c.ml 1.2 644))
(examples/xlurette/fault-tolerant-heater/Makefile (lurette/n/47_Makefile 1.1 644))
(examples/xlurette/fault-tolerant-heater/test.rif.exp (lurette/n/48_test.rif.e 1.1 644))
(examples/xlurette/Gyro/.lurette_rc (lurette/n/49_.lurette_r 1.1 644))
......
......@@ -14,7 +14,7 @@ ifdef STATIC
endif
LIBS = str unix
CLIBS =
#CLIBS =
USE_CAMLP4 = yes
......@@ -25,8 +25,8 @@ SOURCES_OCAML = \
$(HERE)/Ezdl_c.c \
$(HERE)/Ezdl.ml \
$(HERE)/Ezdl.mli \
$(HERE)/version.ml \
$(HERE)/util.ml \
$(HERE)/util2.ml \
$(HERE)/graphUtil.ml \
$(HERE)/graphUtil.mli \
$(HERE)/type.mli \
......@@ -47,12 +47,9 @@ SOURCES_OCAML = \
$(HERE)/luc2c.ml
cat:
ls -l $(SOURCES_OCAML)
SOURCES = $(SOURCES_OCAML)
RESULT = luc2c_exe
RESULT = luc2c
-include $(OCAMLMAKEFILE)
......
......@@ -7,15 +7,15 @@ ver:
echo version=$(VERSION)
strip:
strip $(HOME)/lurette/$(HOST_TYPE)/bin/lucky$(EXE)
strip $(HOME)/lurette/$(HOST_TYPE)/bin/lurettetop_exe$(EXE)
strip $(HOME)/lurette/$(HOST_TYPE)/bin/xlurette_exe$(EXE)
strip $(HOME)/lurette/$(HOST_TYPE)/bin/show_luc$(EXE)
strip $(HOME)/lurette/$(HOST_TYPE)/bin/gen_fake_lucky$(EXE)
strip $(HOME)/lurette/$(HOST_TYPE)/bin/gen_stubs_exe$(EXE)
strip ../$(HOST_TYPE)/bin/lucky$(EXE)
strip ../$(HOST_TYPE)/bin/lurettetop_exe$(EXE)
strip ../$(HOST_TYPE)/bin/xlurette_exe$(EXE)
strip ../$(HOST_TYPE)/bin/show_luc$(EXE)
strip ../$(HOST_TYPE)/bin/gen_fake_lucky$(EXE)
strip ../$(HOST_TYPE)/bin/gen_stubs_exe$(EXE)
# strip $(HOME)/lurette/$(HOST_TYPE)/bin/lutin$(EXE)
# strip $(HOME)/lurette/$(HOST_TYPE)/bin/gen_fake_lutin$(EXE)
# strip ../$(HOST_TYPE)/bin/lutin$(EXE)
# strip ../$(HOST_TYPE)/bin/gen_fake_lutin$(EXE)
ifeq ($(HOST_TYPE),cygwin)
......@@ -234,12 +234,12 @@ draw-rel:
mkdir /tmp/$(DRAW_RELEASE_NAME)/examples/luckyDraw
mkdir /tmp/$(DRAW_RELEASE_NAME)/doc
\
cp -rf $(HOME)/lurette/examples/luckyDraw /tmp/$(DRAW_RELEASE_NAME)/examples/
cp -rf ../examples/luckyDraw /tmp/$(DRAW_RELEASE_NAME)/examples/
cp -rf $(SYNCHRONE_LURETTE_DIR)/doc/luckydraw /tmp/$(DRAW_RELEASE_NAME)/doc/
mkdir /tmp/$(DRAW_RELEASE_NAME)/lib
mkdir /tmp/$(DRAW_RELEASE_NAME)/bin
\
cp $(HOME)/lurette/README-luckyDraw /tmp/$(DRAW_RELEASE_NAME)/
cp ../README-luckyDraw /tmp/$(DRAW_RELEASE_NAME)/
cp -rf $(HOME)/$(HOSTTYPE)/lib/*polka*a /tmp/$(DRAW_RELEASE_NAME)/lib
cp -rf $(HOME)/$(HOSTTYPE)/lib/*bdd*a /tmp/$(DRAW_RELEASE_NAME)/lib
cp $(CAML_INSTALL_DIR)/lib/ocaml/libcamlidl.a /tmp/$(DRAW_RELEASE_NAME)/lib
......@@ -277,9 +277,9 @@ luc4ocaml-rel:
mkdir /tmp/$(LUC4OCAML_RELEASE_NAME)/examples
mkdir /tmp/$(LUC4OCAML_RELEASE_NAME)/doc
\
cp $(HOME)/lurette/README-luc4ocaml /tmp/$(LUC4OCAML_RELEASE_NAME)/
cp $(HOME)/lurette/$(HOSTTYPE)/lib/liblucky_nc.a /tmp/$(LUC4OCAML_RELEASE_NAME)/lib
cp $(HOME)/lurette/$(HOSTTYPE)/lib/*luc4ocaml*.* /tmp/$(LUC4OCAML_RELEASE_NAME)/lib
cp ../README-luc4ocaml /tmp/$(LUC4OCAML_RELEASE_NAME)/
cp ../$(HOSTTYPE)/lib/liblucky_nc.a /tmp/$(LUC4OCAML_RELEASE_NAME)/lib
cp ../$(HOSTTYPE)/lib/*luc4ocaml*.* /tmp/$(LUC4OCAML_RELEASE_NAME)/lib
\
cp -rf $(HOME)/$(HOSTTYPE)/lib/*polka*a /tmp/$(LUC4OCAML_RELEASE_NAME)/lib
cp -rf $(HOME)/$(HOSTTYPE)/lib/*bdd*a /tmp/$(LUC4OCAML_RELEASE_NAME)/lib
......@@ -289,9 +289,9 @@ luc4ocaml-rel:
\
cp -rf $(HOME)/SYNCHRONE/lurette/doc/luc4ocaml \
/tmp/$(LUC4OCAML_RELEASE_NAME)/doc
cp -rf $(HOME)/lurette/examples/lucky /tmp/$(LUC4OCAML_RELEASE_NAME)/examples/
cp -rf $(HOME)/lurette/examples/ocaml /tmp/$(LUC4OCAML_RELEASE_NAME)/examples/
cp -rf $(HOME)/lurette/examples/rml /tmp/$(LUC4OCAML_RELEASE_NAME)/examples/
cp -rf ../examples/lucky /tmp/$(LUC4OCAML_RELEASE_NAME)/examples/
cp -rf ../examples/ocaml /tmp/$(LUC4OCAML_RELEASE_NAME)/examples/
cp -rf ../examples/rml /tmp/$(LUC4OCAML_RELEASE_NAME)/examples/
\
rm -f /tmp/$(LUC4OCAML_RELEASE_NAME)/lib/*~
cd /tmp && tar cvfz $(LUC4OCAML_RELEASE_NAME).tgz $(LUC4OCAML_RELEASE_NAME)
......@@ -329,3 +329,18 @@ test-all-rel:
./RUN_ME
cd /tmp/$(ALL_RELEASE_NAME)/examples/ && \
make test
#################################################################################################"
# install the new version at verimag, and test it
verimag:
cp $(SYNCHRONE_DIR)/lurette/$(ALL_RELEASE_NAME).tgz /usr/local/tools/lustre-misc && \
cd /usr/local/tools/lustre-misc && \
tar xvfz $(ALL_RELEASE_NAME).tgz && \
mv -f /usr/local/tools/lustre-misc/lurette /usr/local/tools/lustre-misc/lurette_old && \
mv /usr/local/tools/lustre-misc/$(ALL_RELEASE_NAME) /usr/local/tools/lustre-misc/lurette && \
cd /usr/local/tools/lustre-misc/lurette &&\
./RUN_ME
cd /usr/local/tools/lustre-misc/lurette/examples/ && \
make test
......@@ -4,14 +4,11 @@
** Public License
**-----------------------------------------------------------------------
**
** File: show_luc.ml
** File: luc2c.ml
** Author: jahier@imag.fr
**
** Generates C files to call Lucky from C.
**
*)
open Parse_luc
......@@ -33,26 +30,36 @@ let (flag : flagT) = {
}
(****************************************************************************)
(*
invent a file name from the list of file names, unless one was provided
Invent a file name from the list of file names, unless one was provided
at the command line.
*)
let (build_file_name : string list -> string) =
fun el ->
match flag.output with
None ->
let fn =
List.fold_left
(fun f acc -> acc^"_"^(Filename.basename f))
""
el
in
flag.output <- Some fn;
fn
| Some fn -> fn
let change_file_name f =
(* make sure that there is no strange char in the name of the
file as it will be used as a C ident.
Therefore, we replace " " and "-" by "_".
Is there any other problematic chars?
*)
let f0 = (Filename.basename (Filename.chop_extension f)) in
let f1 = Str.global_replace (Str.regexp " ") "_" f0 in
let f2 = Str.global_replace (Str.regexp "-") "_" f1 in
f2
in
match flag.output with
None ->
let fn =
List.fold_left
(fun f acc -> (acc^"_"^(change_file_name f)))
(change_file_name (List.hd el))
(List.tl el)
in
flag.output <- Some fn;
fn
| Some fn -> fn
(****************************************************************************)
let (gen_h_file : string -> Exp.var list -> Exp.var list -> Exp.var list -> unit) =
......@@ -67,17 +74,58 @@ let (gen_h_file : string -> Exp.var list -> Exp.var list -> Exp.var list -> unit
put (Var.name var);
putln ";";
in
put ("// Automatically generated by luc2c.\n \n") ;
put ("// Automatically generated by luc2c version "^Version.str^".\n \n") ;
putln "//-------- Predefined types ---------";
putln ("#ifndef _"^ fn ^ "_LUC2C_PREDEF_TYPES");
putln ("#define _"^ fn ^ "_LUC2C_PREDEF_TYPES");
putln "typedef int bool;";
putln "#endif";
putln "//--------- Pragmas ----------------";
putln ("//MODULE: " ^ fn ^ " " ^ (string_of_int (List.length in_vars))
^ " " ^ (string_of_int (List.length out_vars)));
List.iter
(fun var ->
put ("extern void " ^ fn ^ "_O_" ^ (Var.name var) ^ "(void*, ");
putln ("//IN: " ^ (Type.to_cstring (Var.typ var)) ^ " " ^(Var.name var))
)
in_vars;
List.iter
(fun var ->
putln ("//OUT: " ^ (Type.to_cstring (Var.typ var)) ^ " " ^(Var.name var))
)
out_vars;
putln ("#ifndef _"^ fn ^"_LUC2C_SRC_FILE");
putln ("\n//--------Context type ------------");
putln ("struct "^fn^"_ctx;");
(* putln "\n//--------Context allocation --------"; *)
(* putln ("extern struct "^fn^"_ctx* "^fn^"_new_ctx(void* client_data);"); *)
putln ("\n//-------Context copy --------------");
putln ("extern void "^fn^"_copy_ctx(struct "^fn^"_ctx* dest, struct "^ fn ^
"_ctx* src);");
(* putln "\n//--------Reset procedure -----------"; *)
(* putln ("extern void "^fn^"_reset(struct "^fn^"_ctx* ctx);"); *)
putln ("\n//-------Step procedure -----------");
putln ("extern void "^fn^"_step(struct "^fn^"_ctx* ctx);");
putln ("\n//-------Input procedures ---------");
List.iter
(fun var ->
put ("extern void " ^ fn ^ "_I_" ^ (Var.name var) ^
"(struct "^fn^"_ctx*, ");
put ((Type.to_cstring (Var.typ var)) ^ ");\n");
)
loc_vars;
putln "";
put ("void " ^ fn ^ "_step(" ^ fn ^ "_ctx* ctx);\n");
in_vars;
putln ("#endif");
flush oc;
close_out oc
......@@ -99,9 +147,10 @@ let (gen_c_file : string -> Exp.var list -> Exp.var list -> Exp.var list -> unit
in
put ("// Automatically generated by luc2c.\n" ^
put ("// Automatically generated by luc2c version "^Version.str^".\n\n" ^
"#include <stdlib.h>\n" ^
"#include <stdio.h> \n" ^
"#define _"^fn^"_LUC2C_SRC_FILE\n" ^
"#include \"" ^ fn ^ ".h\" \n" ^
" \n") ;
......@@ -114,8 +163,10 @@ let (gen_c_file : string -> Exp.var list -> Exp.var list -> Exp.var list -> unit
List.iter put_var_decl_in_struct in_vars;
putln " //OUTPUTS";
List.iter put_var_decl_in_struct out_vars;
putln " //LOCALS";
List.iter put_var_decl_in_struct loc_vars;
(* putln " //LOCALS"; *)
(* List.iter put_var_decl_in_struct loc_vars; *)
put "} ";
putln (fn ^ "_ctx;\n");
......@@ -126,7 +177,8 @@ Input procedures must be used:
List.iter
(fun var ->
put ("void " ^ fn ^ "_I_" ^ (Var.name var) ^ "(" ^ fn ^ "_ctx, ");
put ("void " ^ fn ^ "_I_" ^ (Var.name var) ^
"(" ^ fn ^ "_ctx* ctx, ");
put ((Type.to_cstring (Var.typ var)) ^ " V){\n");
put (" ctx->_" ^ (Var.name var) ^ " = V;");
putln "}";
......@@ -140,16 +192,22 @@ Input procedures must be used:
put ("extern void " ^ fn ^ "_O_" ^ (Var.name var) ^ "(void*, ");
put ((Type.to_cstring (Var.typ var)) ^ ");\n");
)
loc_vars;
out_vars;
putln "
putln ("/*--------
Copy the value of an internal structure
--------*/
void "^ fn ^"_copy_ctx("^ fn ^"_ctx* dest, "^ fn ^"_ctx* src){
memcpy((void*)dest, (void*)src, sizeof("^ fn ^"_ctx));
}");
putln "
/*--------
Step procedure
--------*/";
put ("void " ^ fn ^ "_step(" ^ fn ^ "_ctx* ctx){\n");
put "}";
putln " ///XXXX A FAIRE XXXX \n}";
flush oc;
close_out oc
......
......@@ -2526,7 +2526,7 @@ let (read_commands : string -> (unit -> string) -> bool) =
)
else
(
output_string !ocr "\n. lurette has terminated normally.\n";
output_string !ocr "\nLurette has terminated normally.\n";
flush !ocr
)
)
......@@ -2543,26 +2543,23 @@ let (read_commands : string -> (unit -> string) -> bool) =
Unix.chdir sdir;
true
| CallSim2chro ->
(try
if Filename.is_relative flag.output then
ignore (Util2.sim2chro (Filename.concat flag.sut_dir flag.output))
else
ignore (Util2.sim2chro flag.output)
with _ -> ()
);
true
let sdir = Unix.getcwd () in
Unix.chdir flag.sut_dir;
ignore (Util2.sim2chro flag.output);
Unix.chdir sdir;
true
| CallGnuplot ->
if Filename.is_relative flag.output then
ignore (gnuplot (Filename.concat flag.sut_dir flag.output))
else
let sdir = Unix.getcwd () in
Unix.chdir flag.sut_dir;
ignore (gnuplot flag.output);
true
Unix.chdir sdir;
true
| CallGnuplotPs ->
if Filename.is_relative flag.output then
ignore (gnuplot_ps (Filename.concat flag.sut_dir flag.output))
else
let sdir = Unix.getcwd () in
Unix.chdir flag.sut_dir;
ignore (gnuplot_ps flag.output);
true
Unix.chdir sdir;
true
| Quit -> false
| HelpSimple -> output_string !ocr cmd_usage; flush !ocr; true
| Help -> display_cmd (); true
......
......@@ -110,7 +110,7 @@ type my_in_channel = { lv_prefix : string ; string : string }
let (type_error : my_in_channel -> Lexeme.t -> string -> unit) =
fun ic lexeme msg ->
let (line, col) = Util.from_char_pos_to_line_and_col ic.string lexeme.cstart in
let (line, col) = Util.from_char_pos_to_line_and_col ic.string lexeme.cstart true in
print_string (
"\n*** Type error at token '" ^ lexeme.str ^ "' line " ^
line ^ " col " ^ col ^ ": " ^ msg ^ ".\n");
......@@ -118,7 +118,7 @@ let (type_error : my_in_channel -> Lexeme.t -> string -> unit) =
let (syntax_error : my_in_channel -> Lexeme.t -> string -> unit) =
fun ic lexeme msg ->
let (line, col) = Util.from_char_pos_to_line_and_col ic.string lexeme.cstart in
let (line, col) = Util.from_char_pos_to_line_and_col ic.string lexeme.cstart true in
print_string (
"\n*** Syntax error at token '" ^ lexeme.str ^ "' line " ^
line ^ " col " ^ col ^ ": " ^ msg ^ ".\n");
......@@ -134,7 +134,7 @@ let (uncompatible_type : my_in_channel -> Lexeme.t -> Type.t -> Type.t
let (not_yet_supported : my_in_channel -> Lexeme.t -> string -> unit) =
fun ic lexeme str ->
let (line, col) = Util.from_char_pos_to_line_and_col ic.string lexeme.cstart in
let (line, col) = Util.from_char_pos_to_line_and_col ic.string lexeme.cstart true in
print_string (
"\n*** At token '" ^ lexeme.str ^ "' line " ^
line ^ " col " ^ col ^ ": " ^ str ^ " is not supported, sorry.\n");
......
......@@ -32,21 +32,22 @@ let (debug_print_vn_ct_list : string -> file -> string -> vn_ct list -> unit) =
flush stdout
)
let (print_debug_func_do : Lexing.lexbuf -> string -> token Stream.t -> unit) =
fun ic msg tok ->
(match Stream.peek tok with
None -> print_string "End of file "
| Some token -> print_genlex_token token
);
print_string ( " *** At character " ^
string_of_int (ic.lex_curr_pos) ^ ", token " ^
(string_of_int (Stream.count tok)) ^ "\t: " ^ msg);
flush stdout
let (print_debug_func : Lexing.lexbuf -> string -> token Stream.t -> unit) =
fun ic msg tok ->
if debug then
(
(match Stream.peek tok with
None -> print_string "End of file "
| Some token -> print_genlex_token token
);
print_string (
string_of_int (ic.lex_curr_pos) ^ " \t " ^
(string_of_int (Stream.count tok)) ^ "\t: " ^ msg);
flush stdout
)
else
()
if debug then print_debug_func_do ic msg tok else ()
(****************************************************************************)
(****************************************************************************)
......@@ -55,6 +56,9 @@ let lexer = make_lexer ["typedef"; "struct";
"."; ","; "{"; "}"; ";"; ":"; "("; ")"; "["; "]";
"/*"; "*/"; "#"]
let set_pos buf i =
buf.lex_curr_pos <- i
(* returns all the struct definitions of the file *)
let rec (get_all_typedef_struct : Lexing.lexbuf -> (string * vn_ct list) list
......@@ -62,47 +66,54 @@ let rec (get_all_typedef_struct : Lexing.lexbuf -> (string * vn_ct list) list
fun ic acc tok ->
let _ = print_debug_func ic ("get_all_typedef_struct \n") tok in
(match tok with parser
[< 'Kwd (_, "typedef") >] -> get_all_typedef_struct2 ic acc tok
| [< 'Ident (_, _) >] -> get_all_typedef_struct ic acc tok
| [< 'Kwd (_, _) >] -> get_all_typedef_struct ic acc tok
| [< 'Int (_, _) >] -> get_all_typedef_struct ic acc tok
| [< 'Float (_, _) >] -> get_all_typedef_struct ic acc tok
| [< 'Char (_, _) >] -> get_all_typedef_struct ic acc tok
| [< 'String (_, _) >] -> get_all_typedef_struct ic acc tok
[< 'Kwd ((_,nic), "typedef") >] -> get_all_typedef_struct2 (set_pos ic nic; ic) acc tok
| [< 'Ident ((_,nic), _) >] -> get_all_typedef_struct (set_pos ic nic; ic) acc tok
| [< 'Kwd ((_,nic), _) >] -> get_all_typedef_struct (set_pos ic nic; ic) acc tok
| [< 'Int ((_,nic), _) >] -> get_all_typedef_struct (set_pos ic nic; ic) acc tok
| [< 'Float ((_,nic), _) >] -> get_all_typedef_struct (set_pos ic nic; ic) acc tok
| [< 'Char ((_,nic), _) >] -> get_all_typedef_struct (set_pos ic nic; ic) acc tok