Commit a9dff877 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Some more work on the manual + some more non-reg tests.

also, add a -jpg option to gnuplot-rif (I need that for the manual).
parent fd4cbc59
include ./Makefile.version
include ./Makefile.common.source
-include mymakefile
# migth be necessary if camlidl is not installed for the current version of ocaml
# nb: to be done only once since for camlidl, the install is made in the ocaml install
......
......@@ -95,7 +95,7 @@ ifeq ($(HOSTTYPE),mac)
else
ifeq ($(HOSTTYPE),cross-win32)
DEBUG=
# DEBUG= -Wl,--subsystem,windows -mwindows
# generate native win32 code using a cross compiler (source set_cross)
CC=/usr/bin/i586-mingw32msvc-gcc $(DEBUG)
GCC=/usr/bin/i586-mingw32msvc-gcc $(DEBUG)
......
......@@ -6,7 +6,7 @@ let between(x, min, max : real) : bool = ((min < x) and (x < max))
let up_and_down(x, px : real ref; min, max, delta : real) =
if
(pre x < min) or ( (pre x < max) and (pre px <= pre x))
(pre x < min) or ( (pre x < max) and (pre px <= pre x))
then
between(x, pre x, pre x + delta)
else
......@@ -17,26 +17,26 @@ let up_and_down(x, px : real ref; min, max, delta : real) =
system rabbit_speed () returns (Speed: real) =
exist Delta : real in
exist SpeedLow: real in
exist SpeedHigh: real in
exist pSpeed: real in
exist Delta : real in
exist SpeedLow: real in
exist SpeedHigh: real in
exist pSpeed: real in
exist draw_params : bool in
exist compute_speed : bool in
exist draw_params : bool in
exist compute_speed : bool in
let DeltaMin = 0.5 in
let DeltaMax = 1.0 in
let SpeedLowMin = 0.0 in
let SpeedLowMax = 5.0 in
let SpeedHighMin = 1.0 in
let SpeedHighMax = 20.0 in
let DeltaMin = 0.5 in
let DeltaMax = 1.0 in
let SpeedLowMin = 0.0 in
let SpeedLowMax = 5.0 in
let SpeedHighMin = 1.0 in
let SpeedHighMax = 20.0 in
pSpeed = 0.0 and Speed = 0.0
fby
assert pSpeed = pre Speed in
assert draw_params =
pSpeed = 0.0 and Speed = 0.0
fby
assert pSpeed = pre Speed in
assert draw_params =
-- Choosing New values for parameters
(
DeltaMin < Delta and Delta < DeltaMax and
......@@ -46,12 +46,12 @@ fby
)
in
assert compute_speed =
(
SpeedLow = pre SpeedLow and
SpeedHigh = pre SpeedHigh and
Delta = pre Delta and
up_and_down(Speed, pSpeed, pre SpeedLow, pre SpeedHigh, pre Delta)
)
(
SpeedLow = pre SpeedLow and
SpeedHigh = pre SpeedHigh and
Delta = pre Delta and
up_and_down(Speed, pSpeed, pre SpeedLow, pre SpeedHigh, pre Delta)
)
in
loop {
......@@ -211,4 +211,4 @@ exist cx : real in
z = 3.0
}
}
}
\ No newline at end of file
}
......@@ -147,7 +147,7 @@ ln: $(OBJDIR) $(SOURCES)
RESULT = luc4c_lib.o
all: nc
all: $(COMPIL_MODE)
install: libinstall
......
......@@ -19,6 +19,12 @@
open Value
let debug = false
let debug_oc = ref stderr
let _ =
if debug then
debug_oc := open_out "debug_luc.log"
(*********************************************************************)
(* Handling Lucky processes *)
......@@ -42,9 +48,10 @@ let lucky_process_cpt = ref 0
let get_new_lucky_process_number () =
incr lucky_process_cpt;
if debug then (
print_string (
output_string !debug_oc (
"# CAML: get_new_lucky_process_number: create a new lucky process (" ^
(string_of_int !lucky_process_cpt) ^ ")\n");
flush !debug_oc
);
!lucky_process_cpt
......@@ -98,6 +105,10 @@ let (make : string -> string -> lucky_process) =
fun pp file ->
try
let _ =
if debug then (
output_string !debug_oc "XXXXXXX\n";
flush !debug_oc;
);
assert (file <> "");
Formula_to_bdd.clear_all ()
in
......@@ -175,9 +186,9 @@ let (list_to_tbl : Var.subst list -> subst_tbl) =
let (step: lucky_process -> step_mode -> unit) =
fun lp step_mode ->
if debug then (
print_string (
output_string !debug_oc (
"# CAML: step lp= " ^ (string_of_int lp) ^ " \n" );
flush stdout;
flush !debug_oc;
);
match state_of_lp lp with
| Some (st0,inp,_outp) ->
......@@ -325,17 +336,17 @@ let (get_output_int : lucky_process -> string -> int) =
let (get_output_float : lucky_process -> string -> float) =
fun lp name ->
if debug then (
print_string (
output_string !debug_oc (
"# CAML: get_output_float \"" ^ name ^ "\" (" ^ (string_of_int lp) ^ ") : " );
flush stdout;
flush !debug_oc;
);
match get_outval_val lp name with
| B(b) -> failwith ("luc4c: "^name^" is not a bool")
| N(F(f)) ->
if debug then (
print_float f;
print_string "\n";
flush stdout
output_string !debug_oc (string_of_float f);
output_string !debug_oc "\n";
flush !debug_oc
);
f
| N(I(i)) -> failwith ("luc4c: "^name^" is not an int")
......
......@@ -8,7 +8,7 @@
#include "fenv.h"
#ifdef MINGW32
#ifdef __MINGW32__
#include "mingw_fenv.h"
#endif
#include "luc4c_stubs.h"
......@@ -18,10 +18,13 @@
/* Initialisation of Caml runtime */
/* ********************************************************************** */
static FILE* ooc;
#ifdef DEBUG_LUC4C
static FILE *fp;
#endif
#define NOM_BIDON "bidon"
static char *argv_bidon[] = {
static char *argv_[] = {
NOM_BIDON,
NULL
};
......@@ -37,6 +40,7 @@ static fexcept_t flagp;
void lucky_caml_init()
{
fexcept_t fet;
......@@ -46,17 +50,24 @@ void lucky_caml_init()
if (!caml_started) {
/* // Some fenv flags make caml_startup raise some floatting points exceptions. */
fegetenv(&envp);
#ifdef MINGW32
#ifdef __MINGW32__
mingw_feinitialise();
#endif
//feclearexcept(FE_ALL_EXCEPT);
//fe = fedisableexcept(FE_ALL_EXCEPT);
caml_startup(&argv_bidon[0]);
#ifdef DEBUG_LUC4C
fprintf(fp,"\n# luc4c_stubc.c: calling caml_startup\n");
#endif
caml_startup(&argv_[0]);
#ifdef DEBUG_LUC4C
fprintf(fp,"\n# luc4c_stubc.c: exiting caml_startup!!!\n");
#endif
fesetenv(&envp);
// feenableexcept(fe);
......@@ -94,19 +105,23 @@ value value_of_step_mode(step_mode sm)
lucky_process make(const char * pp, const char * filename)
{
int lp;
static value* closure=NULL;
#ifdef DEBUG_LUC4C
fp=fopen("debug.txt", "w");
fprintf(fp,"\n# luc4c_stubc.c: make\n");
#endif
if (closure == NULL)
closure = caml_named_value("luc4c_make");
// XXX bug: does not work if called from caml... why?
// why is it not impossible to call caml via c via caml?
lp = caml_callback2(
*closure,
caml_copy_string(pp),
caml_copy_string(filename));
return(Int_val(lp));
#ifdef DEBUG_LUC4C
fprintf(fp,"\n# luc4c_stubc.c: make exit;%d \n",lp);
#endif
return(Int_val(lp));
}
void kill_lucky_process(lucky_process lp)
......@@ -156,7 +171,9 @@ void lucky_set_input_float(lucky_process lp, char* vn, double v)
char* vn_copy;
static value* closure=NULL;
// fprintf(stdout,"\n# luc4c_stubc.c: lucky_set_output_float lp=%d, nv=%s(%f)\n",lp,vn,v);
#ifdef DEBUG_LUC4C
fprintf(fp,"\n# luc4c_stubc.c: lucky_set_output_float lp=%d, nv=%s(%f)\n",lp,vn,v);
#endif
if (closure == NULL)
closure = caml_named_value("luc4c_set_input_float");
......@@ -205,7 +222,9 @@ double lucky_get_output_float(lucky_process lp, char* vn)
if (closure == NULL)
closure = caml_named_value("luc4c_get_output_float");
// fprintf(stdout,"# luc4c_stubc.c: lucky_get_output_float lp=%d, nv=%s(%f)\n",lp,vn,res_val);
#ifdef DEBUG_LUC4C
fprintf(fp,"# luc4c_stubc.c: lucky_get_output_float lp=%d, nv=%s(%f)\n",lp,vn, res);
#endif
return (Double_val(caml_callback2(*closure, Val_int(lp), caml_copy_string(vn))));
}
......@@ -218,8 +237,9 @@ void lucky_step(lucky_process lp, step_mode sm)
value sm_value, lp_value;
static value* closure=NULL;
//fprintf(stdout,"# luc4c_stubc.c: lucky_step, lp=%d, sm=%d\n",lp,sm);
#ifdef DEBUG_LUC4C
fprintf(fp,"# luc4c_stubc.c: lucky_step, lp=%d, sm=%d\n",lp,sm);
#endif
if (closure == NULL)
closure = caml_named_value("luc4c_step");
......
......@@ -159,7 +159,7 @@ RESULT=lutin
ln: $(OBJDIR) $(SOURCES)
all: ln
make nc
make $(COMPIL_MODE)
......
......@@ -94,6 +94,11 @@ mingw_fenv.o:luc4c_lib.o
endif
.PHONY:dll
dll:lucky.dll
cp $(OBJDIR)/lucky.dll ~/PROJECTS/COMON/COMON_Alices/
cp $(OBJDIR)/lucky.dll ~/public_html/lurette
lucky.dll: $(OBJDIR) liblucky_nc.a libluc4c_nc.a
cd $(OBJDIR) && \
$(GCC) -shared \
......@@ -155,7 +160,7 @@ ocaml2c_stubs.o: lurette_lib.o
lurette_exe.o:lurette_lib.o
call_lurette_main.o:lurette_lib.o
lib$(COMPIL_MODE): liblurette_nc.a
libnc: liblurette_nc.a
# On rajoute asmrun + les fichiers spcifiques lurette.
liblurette_nc.a: lurette_exe.o call_lurette_main.o lurette_lib.o liblucky_nc.a $(OBJDIR)
......@@ -217,7 +222,7 @@ common/lurette_lib.o: libncnc
luc4c_lib.o:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) ln -f ../Lucky/Makefile.luc4c && \
$(MAKE) $(COMPIL_MODE) -f ../Lucky/Makefile.luc4c
$(MAKE) nc -f ../Lucky/Makefile.luc4c
lurette_lib.o: $(OBJDIR)
......@@ -236,7 +241,7 @@ lurette_ml_exec: $(OBJDIR)
cd $(OBJDIR) && \
rm -f oracle.* sut.* && \
$(MAKE) ln -f ../common/Makefile.lurette4ocaml && \
$(MAKE) $(COMPIL_MODE)l -f ../common/Makefile.lurette4ocaml
$(MAKE) ncl -f ../common/Makefile.lurette4ocaml
include $(LURETTE_PATH)/source/Makefile.release
......@@ -246,7 +251,7 @@ include $(LURETTE_PATH)/source/Makefile.release
.PHONY: gnuplot-rif
gnuplot-rif:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -f ../Gnuplot-rif/Makefile ln && \
$(MAKE) -f ../Gnuplot-rif/Makefile $(COMPIL_MODE)
$(MAKE) -f ../Gnuplot-rif/Makefile nc
gnuplot-rif_clean:$(OBJDIR)
......@@ -257,7 +262,7 @@ gnuplot-rif_clean:$(OBJDIR)
gnuplot-socket:$(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../misc/Makefile.gnuplot-socket && \
$(MAKE) -k $(COMPIL_MODE) -f ../misc/Makefile.gnuplot-socket
$(MAKE) -k nc -f ../misc/Makefile.gnuplot-socket
gnuplot-socket_clean:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k clean -f ../misc/Makefile.gnuplot-socket
......@@ -267,7 +272,7 @@ gnuplot-socket_clean:$(OBJDIR)
lucky:$(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../*/Makefile.lucky && \
$(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.lucky
$(MAKE) -k nc -f ../*/Makefile.lucky
lucky_clean: $(OBJDIR)
......@@ -287,7 +292,7 @@ lucky_debug_no_assert:
##############################################################################"
.PHONY:lutin
lutin:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k ln -f ../*/Makefile.lutin && $(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.lutin
cd $(OBJDIR) && $(MAKE) -k ln -f ../*/Makefile.lutin && $(MAKE) -k nc -f ../*/Makefile.lutin
lutin_clean:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -f ../*/Makefile.lutin clean
......@@ -394,7 +399,7 @@ lurette_debug:
ltop: $(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../Lurettetop/Makefile.lurettetop && \
$(MAKE) -k $(COMPIL_MODE) -f ../Lurettetop/Makefile.lurettetop
$(MAKE) -k nc -f ../Lurettetop/Makefile.lurettetop
ltop_clean: $(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k clean -f ../*/Makefile.lurettetop
......@@ -402,13 +407,13 @@ ltop_clean: $(OBJDIR)
ltopc: $(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../*/Makefile.lurettetop && \
$(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.lurettetop OCAMLFLAGS="-noassert -unsafe -mno-cygwin"
$(MAKE) -k nc -f ../*/Makefile.lurettetop OCAMLFLAGS="-noassert -unsafe -mno-cygwin"
##############################################################################"
show:$(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../Lucky/Makefile.show_luc && \
$(MAKE) -k -f ../Lucky/Makefile.show_luc $(COMPIL_MODE)
$(MAKE) -k -f ../Lucky/Makefile.show_luc nc
show_clean:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k clean -f ../*/Makefile.show_luc && cd ..
......@@ -416,7 +421,7 @@ show_clean:$(OBJDIR)
##############################################################################"
.PHONY:luc2c
luc2c:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k ln -f ../*/Makefile.luc2c && $(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.luc2c
cd $(OBJDIR) && $(MAKE) -k ln -f ../*/Makefile.luc2c && $(MAKE) -k nc -f ../*/Makefile.luc2c
luc2c_clean:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k clean -f ../*/Makefile.luc2c
......@@ -427,7 +432,7 @@ luc2c_clean:$(OBJDIR)
luc2luciole:$(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../*/Makefile.luc2luciole && \
$(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.luc2luciole
$(MAKE) -k nc -f ../*/Makefile.luc2luciole
luc2luciole_clean:$(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k clean -f ../*/Makefile.luc2luciole
......@@ -437,7 +442,7 @@ luc2luciole_clean:$(OBJDIR)
.PHONY:luc4c
luc4c: $(OBJDIR)
cd $(OBJDIR) && $(MAKE) -k ln -f ../*/Makefile.luc4c && \
$(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.luc4c
$(MAKE) -k nc -f ../*/Makefile.luc4c
# Pour Corys
luc4c_so:
......@@ -464,7 +469,7 @@ dot:$(OBJDIR)
stubs:$(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../*/Makefile.gen_stubs && \
$(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.gen_stubs
$(MAKE) -k nc -f ../*/Makefile.gen_stubs
stubs_clean:$(OBJDIR)
......@@ -478,7 +483,7 @@ gen_luc_clean:$(OBJDIR)
gen_luc:$(OBJDIR)
cd $(OBJDIR) && \
$(MAKE) -k ln -f ../*/Makefile.gen_fake_lucky &&\
$(MAKE) -k $(COMPIL_MODE) -f ../*/Makefile.gen_fake_lucky
$(MAKE) -k nc -f ../*/Makefile.gen_fake_lucky
......
......@@ -57,6 +57,7 @@ lurette-scade-rel: strip
cp $(LURETTE_PATH)/utils/lucky_cpp lurette-scade-$(VERSION)/utils/ &&\
cp $(LURETTE_PATH)/install/*.in lurette-scade-$(VERSION)/install/ &&\
cp $(LURETTE_PATH)/utils/lucky.el lurette-scade-$(VERSION)/utils/ &&\
cp $(LURETTE_PATH)/utils/lutin.el lurette-scade-$(VERSION)/utils/ &&\
cp $(LURETTE_PATH)/utils/lucky.vim lurette-scade-$(VERSION)/utils/ &&\
cp $(LURETTE_PATH)/utils/rif.el lurette-scade-$(VERSION)/utils/ &&\
\
......@@ -88,15 +89,14 @@ lurette-rel: strip
mkdir /tmp/$(LURETTE_RELEASE_NAME)/doc
\
cp -f $(LURETTE_PATH)/$(HOSTTYPE)/bin/lucky$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/getsaonodes \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/lusinfo$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/lus2ec* \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/lutin$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/luc2lic$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/luc2luciole$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/ec2c$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/lus2lic$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/pollux$(EXE) \
`which lus2lic` \
`which pollux` \
`which lusinfo` \
`which getsaonodes` \
`which lus2ec` \
`which ec2c` \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/lurettetop_exe$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/show_luc$(EXE) \
$(LURETTE_PATH)/$(HOSTTYPE)/bin/gen_fake_lucky$(EXE) \
......@@ -398,7 +398,10 @@ test-rel:
cd /tmp/$(ALL_RELEASE_NAME)/examples/ && \
cp /tmp/$(ALL_RELEASE_NAME).tgz $(SYNCHRONE_DIR)/lurette/ && \
cp $(LURETTE_PATH)/RELEASE-NOTES $(SYNCHRONE_DIR)/lurette && \
make test && echo "test ok; consider issuing a 'make www' and a 'make verimag'"
make test && \
echo && \
echo && \
echo "test ok; consider issuing a 'make www' and a 'make verimag'"
# Update the web site with the new tgz
www:
......@@ -427,6 +430,6 @@ verimag:
./RUN_ME
cd /usr/local/tools/lustre-misc/lurette/examples/ && \
make test && \
mkdir $(shell ocamlc -where)/../lucky && \
mkdir -p $(shell ocamlc -where)/../lucky && \
cp -rf /usr/local/tools/lustre-misc/lurette/lib $(shell ocamlc -where)/../lucky
......@@ -132,7 +132,7 @@ ln: $(OBJDIR) $(SOURCES)
RESULT = lurette_ml_exec
all: ncl
all: $(COMPIL_MODE)l
install: libinstall
......
......@@ -132,7 +132,7 @@ ln: $(OBJDIR) $(SOURCES)
RESULT = lurette_lib.o
all: dnc
all: $(COMPIL_MODE)
install: libinstall
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment