diff --git a/.gitignore b/.gitignore index 6230de4ff3791354645bcbe4faf3c31eca38f3de..c553cd1ec9aa0f9908a2b5fbb0a093305fdfd151 100644 --- a/.gitignore +++ b/.gitignore @@ -9,14 +9,15 @@ src/TAGS *.h *.diff *.swp -src/._bcdi/* -src/._d/* -src/._ncdi/* +._bcdi/* +._d/* +._ncdi/* src/lus2lic src/parser.ml src/parser.mli src/lexer.ml src/lexer.mli +obj* *.lic release* *.lus.tex diff --git a/AFAIRE b/AFAIRE new file mode 100644 index 0000000000000000000000000000000000000000..af7e376936510aedd623984038b560e73cf01bf5 --- /dev/null +++ b/AFAIRE @@ -0,0 +1,45 @@ + +12/08/06 +bug +./objlinux64/lus2lic test_static/cond01.lus -dbg lazyc + + +12/08/03 + +./objlinux/lus2lic test_static/predef01.lus +Fatal error: exception Match_failure("objlinux/doNoPoly.ml", 55, 17) + + +12/08/01 -> + ./objlinux/lus2lic test_static/predef01.lus -dbg lazyc +*** Error in file "/home/raymond/git/lus2lic/test_static/predef01.lus", line 6, col 6 to 8, token 'map': +*** Lustre::map<<Lustre::or, 42>>: unknown Lustre operator. +*** Available operators in the current scope are: + +---------------------- + + +12/07/30 -> remplacement de GetEff.check_static_arg + par une version epurée qui ne fait de cohérence de type + (cf vielle version check_static_arg_old.ml) + -> A FAIRE !! + +================================================================ +- UnifyType.f (BIEN AVANCE) +---------------------------------------------------------------- +unifyType : remplacer + Unif of Eff.type_ +par + Unif of Eff.poly_match +---------------------------------------------------------------- +07/12 fait partiellement, au niveau des expressions +---------------------------------------------------------------- + +================================================================ +- Eff : node_exp dans by_pos_op dans val_exp_core +---------------------------------------------------------------- +Ca revient à copier la définition d'un noeud partout où +il est utilisé => FAIRE AUTREMENT +---------------------------------------------------------------- +---------------------------------------------------------------- + diff --git a/ALIRE b/ALIRE new file mode 100644 index 0000000000000000000000000000000000000000..ffa6aa70014baaeebf5b7372d5a04fd5d4329a07 --- /dev/null +++ b/ALIRE @@ -0,0 +1,57 @@ + +Reprise des travaux, juillet 2012 ... + +Besoins : +- intégrer les constructions d'horloge avancées (condact et merge) + +En cours : +- sans tout casser, remettre un peu d'ordre dans la bande + Compile/Eff/LasyCompiler, surtout LasyCompiler qui fait + un peu trop de choses... +- Idée, on passe par une forme intermédaire LicPrg : + * composée des type "compilés" Eff.xxx + * point de sortie de LasyCompiler : son rôle doit + être revu à la baisse, il s'occupe de "tirer" les fils + (aspect lazy), c'est-à -dire résoudre tout ce qui est + packaging et parametres statiques, MAIS PAS PLUS + * toutes les autre modifs de type source_2-source sont fait + dans des modules dédiés par des fonctions LicPrg -> LicPrg + * L'impression proprement dite des progs est un (simple) + dump du LicPrg : elle n'est plus faite au fur et à mesure + dans LasyCompiler + + +ETAT COURANT + +----------------------------------------------------------- +12/07/09 + +--> Les expressions de noeud qui s'avèrent polymorphes et/ou + surchargés, sont : + - acceptées dans les val_exp, à condition que l'utilisation + lève l'ambiguité + - refusées dans les "node alias" + + = PLUS TARD : il faudrait que les noeuds qui s'avèrent polymorphes + et/ou surchargés soient traités comme de MACROS avec un STATIG ARG + de nature TYPE implicite + +----------------------------------------------------------- +12/07/05 + +- completement séparé la compil de l'affichage, du coup + on a débranché l'ancien source_to_source + +- l'ajout d'alias sur type array est fait par une passe source 2 source : + ca fait un exemple de traitement s2s simple, + c'est plus propre qu'avant ou c'etait fait par effet de bord + a l'affichage +--> consequence co-latterale : les clashs sur nom de type introduit + sont gérés de manière plus "smart" + +==> reste a faire : + refaire les traitements source_to_source !! + + + + diff --git a/ALIRE.compil-des-nodes b/ALIRE.compil-des-nodes new file mode 100644 index 0000000000000000000000000000000000000000..cb7aedf9e5390337bdbb05ee680c3f82ef2e7b63 --- /dev/null +++ b/ALIRE.compil-des-nodes @@ -0,0 +1,12 @@ + +compile_all -> + +compile_all_nodes -> + +compile_all_item node_check_interface -> + node_check_interface:cache on -> + +node_check_interface_do + + node_check: cache on node_check_do + + node_check_do en plus pour l'interface (prov) diff --git a/Makefile b/Makefile index 6f6b6f7fc8610d6722a4cbdf8f6fc02edffdd49f..33ccfb4d77386e30aea6903308a17d2ca280e845 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,143 @@ - - +all: doit + +OBJDIR=./obj$(HOSTTYPE) +SRCDIR=./src + +LN=ln -s +$(OBJDIR)/% : $(SRCDIR)/% + rm -f $@; cd $(OBJDIR) && $(LN) ../$(SRCDIR)/$* . + +$(OBJDIR): + mkdir $(OBJDIR) + +OCAMLMAKEFILE = ./OCamlMakefile +RESULT=$(OBJDIR)/lus2lic$(EXE) + +LIBS = str unix + +OCAMLC=ocamlc +OCAMLOPT=ocamlopt + +ifeq ($(HOSTTYPE),cross-win32) + OCAMLC=/usr/i586-mingw32msvc/bin/ocamlc + OCAMLOPT=/usr/i586-mingw32msvc/bin/ocamlopt + OCAMLDEP=/usr/i586-mingw32msvc/bin/ocamldep + OCAMLRUN=/usr/i586-mingw32msvc/bin/ocamlrun + OCAMLLIB = `/usr/i586-mingw32msvc/bin/ocamlc -where` +endif + +ifeq ($(HOSTTYPE),cygwin) +CFLAGS=-mno-cygwin +endif + +SOURCES = \ + $(OBJDIR)/version.ml \ + $(OBJDIR)/verbose.mli \ + $(OBJDIR)/verbose.ml \ + $(OBJDIR)/filenameExtras.mli \ + $(OBJDIR)/filenameExtras.ml \ + $(OBJDIR)/global.ml \ + $(OBJDIR)/ident.mli \ + $(OBJDIR)/ident.ml \ + $(OBJDIR)/lxm.mli \ + $(OBJDIR)/lxm.ml \ + $(OBJDIR)/errors.ml \ + $(OBJDIR)/predef.ml \ + $(OBJDIR)/syntaxTreeCore.ml \ + $(OBJDIR)/syntaxTree.ml \ + $(OBJDIR)/syntaxTreeDump.mli \ + $(OBJDIR)/syntaxTreeDump.ml \ + $(OBJDIR)/solveIdent.mli \ + $(OBJDIR)/solveIdent.ml \ + $(OBJDIR)/parserUtils.ml \ + $(OBJDIR)/parser.mly \ + $(OBJDIR)/lexer.mll \ + $(OBJDIR)/syntaxTabUtils.mli \ + $(OBJDIR)/syntaxTabUtils.ml \ + $(OBJDIR)/instanciateModel.mli \ + $(OBJDIR)/instanciateModel.ml \ + $(OBJDIR)/symbolTab.mli \ + $(OBJDIR)/symbolTab.ml \ + $(OBJDIR)/eff.ml \ + $(OBJDIR)/name.mli \ + $(OBJDIR)/name.ml \ + $(OBJDIR)/licDump.ml \ + $(OBJDIR)/licPrg.mli \ + $(OBJDIR)/licPrg.ml \ + $(OBJDIR)/unifyType.mli \ + $(OBJDIR)/unifyType.ml \ + $(OBJDIR)/unifyClock.mli \ + $(OBJDIR)/unifyClock.ml \ + $(OBJDIR)/syntaxTab.mli \ + $(OBJDIR)/syntaxTab.ml \ + $(OBJDIR)/uglyStuff.ml \ + $(OBJDIR)/predefEvalType.mli \ + $(OBJDIR)/predefEvalType.ml \ + $(OBJDIR)/predefEvalConst.mli \ + $(OBJDIR)/predefEvalConst.ml \ + $(OBJDIR)/predefEvalClock.mli \ + $(OBJDIR)/predefEvalClock.ml \ + $(OBJDIR)/builtIn.ml \ + $(OBJDIR)/evalConst.mli \ + $(OBJDIR)/evalConst.ml \ + $(OBJDIR)/evalType.mli \ + $(OBJDIR)/evalType.ml \ + $(OBJDIR)/evalClock.mli \ + $(OBJDIR)/evalClock.ml \ + $(OBJDIR)/structArrayExpand.mli \ + $(OBJDIR)/structArrayExpand.ml \ + $(OBJDIR)/uniqueOutput.mli \ + $(OBJDIR)/uniqueOutput.ml \ + $(OBJDIR)/getEff.mli \ + $(OBJDIR)/getEff.ml \ + $(OBJDIR)/nodesExpand.mli \ + $(OBJDIR)/nodesExpand.ml \ + $(OBJDIR)/doNoPoly.ml \ + $(OBJDIR)/doAliasTypes.ml \ + $(OBJDIR)/doSplit.ml \ + $(OBJDIR)/lazyCompiler.ml \ + $(OBJDIR)/lazyCompiler.mli \ + $(OBJDIR)/compile.ml \ + $(OBJDIR)/mainArgs.ml \ + $(OBJDIR)/mainArgs.mli \ + $(OBJDIR)/main.ml + +# +# Be sure to build those files before doing something else +# since they are needed by $(RESULT) +PRE_TARGETS=$(OBJDIR)/version.ml + +MLONLY_SOURCES=$(filter %.ml %.mll %.mly, $(SOURCES)) + +ln: $(OBJDIR) $(SOURCES) + +doit: ln + make nc + +include $(OCAMLMAKEFILE) + +# Specific rule (version) + +.PRECIOUS: $(OBJDIR)/version.ml + +$(OBJDIR)/version.ml: + echo "(* Automatically generated from src/Makefile *) " > $@ + echo "let tool = \"lus2lic\"" >> $@ + echo "let branch = \"$(shell utils/get_branch_name)\"" >> $@ + echo "let commit = \"$(shell utils/get_commit_number)\"" >> $@ + echo "let sha_1 = \"$(shell utils/get_sha_1)"\">> $@ + echo "let str = (branch ^ \".\" ^ commit)">> $@ all: nc lus2lic: - cd src; make nc ; make test + make all + make test + + +# TEST, NON REGR. ETC... +TESTDIR=./tests .PHONY: diff test log @@ -15,36 +147,34 @@ diff: log: rm -f lv6.log; git log > lv6.log -clean_src: - cd src ; make clean - - test_nc: - cd src/test ; make test -test: clean_src lus2lic test_nc + cd $(TESTDIR) ; make test + +test: clean all test_nc test_ec: - cd src/test ; make test_ec + cd $(TESTDIR) ; make test_ec test_lic: - cd src/test ; make test_lic + cd $(TESTDIR) ; make test_lic test_lv4: - cd src/test ; make test_lv4 + cd $(TESTDIR) ; make test_lv4 utest: - cd src/test ; make utest + cd $(TESTDIR) ; make utest utest_lic: - cd src/test ; make utest_lic + cd $(TESTDIR) ; make utest_lic utest_ec: - cd src/test ; make utest_ec + cd $(TESTDIR) ; make utest_ec utest_lv4: - cd src/test ; make utest_lv4 + cd $(TESTDIR) ; make utest_lv4 + +ci: $(OBJDIR)/version.ml + make test && git commit -F log && rm -f $(OBJDIR)/version.ml -ci:src/version.ml - make test && git commit -F log && rm -f src/version.ml +cia: $(OBJDIR)/version.ml + git commit -a -F log && rm -f $(OBJDIR)/version.ml -cia:src/version.ml - make test && git commit -a -F log && rm -f src/version.ml amend: - git commit -a -F log --amend && rm -f src/version.ml + git commit -a -F log --amend && rm -f $(OBJDIR)/version.ml diff --git a/OCamlMakefile b/OCamlMakefile new file mode 100644 index 0000000000000000000000000000000000000000..e9deb247da8176127583035f864c801fd5a47f4f --- /dev/null +++ b/OCamlMakefile @@ -0,0 +1,1277 @@ +########################################################################### +# OCamlMakefile +# Copyright (C) 1999- Markus Mottl +# +# For updates see: +# http://www.ocaml.info/home/ocaml_sources.html +# +########################################################################### + +# Modified by damien for .glade.ml compilation + +# Set these variables to the names of the sources to be processed and +# the result variable. Order matters during linkage! + +ifndef SOURCES + SOURCES := foo.ml +endif +export SOURCES + +ifndef RES_CLIB_SUF + RES_CLIB_SUF := _stubs +endif +export RES_CLIB_SUF + +ifndef RESULT + RESULT := foo +endif +export RESULT := $(strip $(RESULT)) + +export LIB_PACK_NAME + +ifndef DOC_FILES + DOC_FILES := $(filter %.mli, $(SOURCES)) +endif +export DOC_FILES +FIRST_DOC_FILE := $(firstword $(DOC_FILES)) + +export BCSUFFIX +export NCSUFFIX + +ifndef TOPSUFFIX + TOPSUFFIX := .top +endif +export TOPSUFFIX + +# Eventually set include- and library-paths, libraries to link, +# additional compilation-, link- and ocamlyacc-flags +# Path- and library information needs not be written with "-I" and such... +# Define THREADS if you need it, otherwise leave it unset (same for +# USE_CAMLP4)! + +export THREADS +export VMTHREADS +export ANNOTATE +export USE_CAMLP4 + +export INCDIRS +export LIBDIRS +export EXTLIBDIRS +export RESULTDEPS +export OCAML_DEFAULT_DIRS + +export LIBS +export CLIBS +export CFRAMEWORKS + +export OCAMLFLAGS +export OCAMLNCFLAGS +export OCAMLBCFLAGS + +export OCAMLLDFLAGS +export OCAMLNLDFLAGS +export OCAMLBLDFLAGS + +export OCAMLMKLIB_FLAGS + +ifndef OCAMLCPFLAGS + OCAMLCPFLAGS := a +endif +export OCAMLCPFLAGS + +ifndef DOC_DIR + DOC_DIR := doc +endif +export DOC_DIR + +export PPFLAGS + +export LFLAGS +export YFLAGS +export IDLFLAGS + +export OCAMLDOCFLAGS + +export OCAMLFIND_INSTFLAGS + +export DVIPSFLAGS + +export STATIC + +# Add a list of optional trash files that should be deleted by "make clean" +export TRASH + +ECHO := echo + +ifdef REALLY_QUIET + export REALLY_QUIET + ECHO := true + LFLAGS := $(LFLAGS) -q + YFLAGS := $(YFLAGS) -q +endif + +#################### variables depending on your OCaml-installation + +SYSTEM := $(shell ocamlc -config 2>/dev/null | grep system | sed 's/system: //') + # This may be + # - mingw + # - win32 + # - cygwin + # - some other string means Unix + # - empty means ocamlc does not support -config + +ifeq ($(SYSTEM),mingw) + MINGW=1 +endif +ifeq ($(SYSTEM),win32) + MSVC=1 +endif + +ifdef MINGW + export MINGW + WIN32 := 1 + # We are compiling with cygwin tools: + CFLAGS_WIN32 := -mno-cygwin + # The default value 'cc' makes 'ocamlc -cc "cc"' raises the error 'The + # NTVDM CPU has encountered an illegal instruction'. + CC := gcc + # The OCaml C header files use this flag: + CFLAGS += -D__MINGW32__ +endif +ifdef MSVC + export MSVC + WIN32 := 1 + ifndef STATIC + CPPFLAGS_WIN32 := -DCAML_DLL + endif + CFLAGS_WIN32 += -nologo + EXT_OBJ := obj + EXT_LIB := lib + ifeq ($(CC),gcc) + # work around GNU Make default value + ifdef THREADS + CC := cl -MT + else + CC := cl + endif + endif + ifeq ($(CXX),g++) + # work around GNU Make default value + CXX := $(CC) + endif + CFLAG_O := -Fo +endif +ifdef WIN32 + EXT_CXX := cpp + EXE := .exe +endif + +ifndef EXT_OBJ + EXT_OBJ := o +endif +ifndef EXT_LIB + EXT_LIB := a +endif +ifndef EXT_CXX + EXT_CXX := cc +endif +ifndef EXE + EXE := # empty +endif +ifndef CFLAG_O + CFLAG_O := -o # do not delete this comment (preserves trailing whitespace)! +endif + +export CC +export CXX +export CFLAGS +export CXXFLAGS +export LDFLAGS +export CPPFLAGS + +ifndef RPATH_FLAG + ifdef ELF_RPATH_FLAG + RPATH_FLAG := $(ELF_RPATH_FLAG) + else + RPATH_FLAG := -R + endif +endif +export RPATH_FLAG + +ifndef MSVC +ifndef PIC_CFLAGS + PIC_CFLAGS := -fPIC +endif +ifndef PIC_CPPFLAGS + PIC_CPPFLAGS := -DPIC +endif +endif + +export PIC_CFLAGS +export PIC_CPPFLAGS + +BCRESULT := $(addsuffix $(BCSUFFIX), $(RESULT)) +NCRESULT := $(addsuffix $(NCSUFFIX), $(RESULT)) +TOPRESULT := $(addsuffix $(TOPSUFFIX), $(RESULT)) + +ifndef OCAMLFIND + OCAMLFIND := ocamlfind +endif +export OCAMLFIND + +ifndef OCAMLC + OCAMLC := ocamlc +endif +export OCAMLC + +ifndef OCAMLOPT + OCAMLOPT := ocamlopt +endif +export OCAMLOPT + +ifndef OCAMLMKTOP + OCAMLMKTOP := ocamlmktop +endif +export OCAMLMKTOP + +ifndef OCAMLCP + OCAMLCP := ocamlcp +endif +export OCAMLCP + +ifndef OCAMLDEP + OCAMLDEP := ocamldep +endif +export OCAMLDEP + +ifndef OCAMLLEX + OCAMLLEX := ocamllex +endif +export OCAMLLEX + +ifndef OCAMLYACC + OCAMLYACC := ocamlyacc +endif +export OCAMLYACC + +ifndef OCAMLMKLIB + OCAMLMKLIB := ocamlmklib +endif +export OCAMLMKLIB + +ifndef OCAML_GLADECC + OCAML_GLADECC := lablgladecc2 +endif +export OCAML_GLADECC + +ifndef OCAML_GLADECC_FLAGS + OCAML_GLADECC_FLAGS := +endif +export OCAML_GLADECC_FLAGS + +ifndef CAMELEON_REPORT + CAMELEON_REPORT := report +endif +export CAMELEON_REPORT + +ifndef CAMELEON_REPORT_FLAGS + CAMELEON_REPORT_FLAGS := +endif +export CAMELEON_REPORT_FLAGS + +ifndef CAMELEON_ZOGGY + CAMELEON_ZOGGY := camlp4o pa_zog.cma pr_o.cmo +endif +export CAMELEON_ZOGGY + +ifndef CAMELEON_ZOGGY_FLAGS + CAMELEON_ZOGGY_FLAGS := +endif +export CAMELEON_ZOGGY_FLAGS + +ifndef OXRIDL + OXRIDL := oxridl +endif +export OXRIDL + +ifndef CAMLIDL + CAMLIDL := camlidl +endif +export CAMLIDL + +ifndef CAMLIDLDLL + CAMLIDLDLL := camlidldll +endif +export CAMLIDLDLL + +ifndef NOIDLHEADER + MAYBE_IDL_HEADER := -header +endif +export NOIDLHEADER + +export NO_CUSTOM + +ifndef CAMLP4 + CAMLP4 := camlp4 +endif +export CAMLP4 + +ifndef REAL_OCAMLFIND + ifdef PACKS + ifndef CREATE_LIB + ifdef THREADS + PACKS += threads + endif + endif + empty := + space := $(empty) $(empty) + comma := , + ifdef PREDS + PRE_OCAML_FIND_PREDICATES := $(subst $(space),$(comma),$(PREDS)) + PRE_OCAML_FIND_PACKAGES := $(subst $(space),$(comma),$(PACKS)) + OCAML_FIND_PREDICATES := -predicates $(PRE_OCAML_FIND_PREDICATES) + # OCAML_DEP_PREDICATES := -syntax $(PRE_OCAML_FIND_PREDICATES) + OCAML_FIND_PACKAGES := $(OCAML_FIND_PREDICATES) -package $(PRE_OCAML_FIND_PACKAGES) + OCAML_DEP_PACKAGES := $(OCAML_DEP_PREDICATES) -package $(PRE_OCAML_FIND_PACKAGES) + else + OCAML_FIND_PACKAGES := -package $(subst $(space),$(comma),$(PACKS)) + OCAML_DEP_PACKAGES := + endif + OCAML_FIND_LINKPKG := -linkpkg + REAL_OCAMLFIND := $(OCAMLFIND) + endif +endif + +export OCAML_FIND_PACKAGES +export OCAML_DEP_PACKAGES +export OCAML_FIND_LINKPKG +export REAL_OCAMLFIND + +ifndef OCAMLDOC + OCAMLDOC := ocamldoc +endif +export OCAMLDOC + +ifndef LATEX + LATEX := latex +endif +export LATEX + +ifndef DVIPS + DVIPS := dvips +endif +export DVIPS + +ifndef PS2PDF + PS2PDF := ps2pdf +endif +export PS2PDF + +ifndef OCAMLMAKEFILE + OCAMLMAKEFILE := OCamlMakefile +endif +export OCAMLMAKEFILE + +ifndef OCAMLLIBPATH + OCAMLLIBPATH := \ + $(shell $(OCAMLC) 2>/dev/null -where || echo /usr/local/lib/ocaml) +endif +export OCAMLLIBPATH + +ifndef OCAML_LIB_INSTALL + OCAML_LIB_INSTALL := $(OCAMLLIBPATH)/contrib +endif +export OCAML_LIB_INSTALL + +########################################################################### + +#################### change following sections only if +#################### you know what you are doing! + +# delete target files when a build command fails +.PHONY: .DELETE_ON_ERROR +.DELETE_ON_ERROR: + +# for pedants using "--warn-undefined-variables" +export MAYBE_IDL +export REAL_RESULT +export CAMLIDLFLAGS +export THREAD_FLAG +export RES_CLIB +export MAKEDLL +export ANNOT_FLAG +export C_OXRIDL +export SUBPROJS +export CFLAGS_WIN32 +export CPPFLAGS_WIN32 + +INCFLAGS := + +SHELL := /bin/sh + +MLDEPDIR := ._d +BCDIDIR := ._bcdi +NCDIDIR := ._ncdi + +FILTER_EXTNS := %.mli %.ml %.mll %.mly %.idl %.oxridl %.c %.m %.$(EXT_CXX) %.rep %.zog %.glade + +FILTERED := $(filter $(FILTER_EXTNS), $(SOURCES)) +SOURCE_DIRS := $(filter-out ./, $(sort $(dir $(FILTERED)))) + +FILTERED_REP := $(filter %.rep, $(FILTERED)) +DEP_REP := $(FILTERED_REP:%.rep=$(MLDEPDIR)/%.d) +AUTO_REP := $(FILTERED_REP:.rep=.ml) + +FILTERED_ZOG := $(filter %.zog, $(FILTERED)) +DEP_ZOG := $(FILTERED_ZOG:%.zog=$(MLDEPDIR)/%.d) +AUTO_ZOG := $(FILTERED_ZOG:.zog=.ml) + +FILTERED_GLADE := $(filter %.glade, $(FILTERED)) +DEP_GLADE := $(FILTERED_GLADE:%.glade=$(MLDEPDIR)/%.d) +AUTO_GLADE := $(FILTERED_GLADE:.glade=.ml) + +FILTERED_ML := $(filter %.ml, $(FILTERED)) +DEP_ML := $(FILTERED_ML:%.ml=$(MLDEPDIR)/%.d) + +FILTERED_MLI := $(filter %.mli, $(FILTERED)) +DEP_MLI := $(FILTERED_MLI:.mli=.di) + +FILTERED_MLL := $(filter %.mll, $(FILTERED)) +DEP_MLL := $(FILTERED_MLL:%.mll=$(MLDEPDIR)/%.d) +AUTO_MLL := $(FILTERED_MLL:.mll=.ml) + +FILTERED_MLY := $(filter %.mly, $(FILTERED)) +DEP_MLY := $(FILTERED_MLY:%.mly=$(MLDEPDIR)/%.d) $(FILTERED_MLY:.mly=.di) +AUTO_MLY := $(FILTERED_MLY:.mly=.mli) $(FILTERED_MLY:.mly=.ml) + +FILTERED_IDL := $(filter %.idl, $(FILTERED)) +DEP_IDL := $(FILTERED_IDL:%.idl=$(MLDEPDIR)/%.d) $(FILTERED_IDL:.idl=.di) +C_IDL := $(FILTERED_IDL:%.idl=%_stubs.c) +ifndef NOIDLHEADER + C_IDL += $(FILTERED_IDL:.idl=.h) +endif +OBJ_C_IDL := $(FILTERED_IDL:%.idl=%_stubs.$(EXT_OBJ)) +AUTO_IDL := $(FILTERED_IDL:.idl=.mli) $(FILTERED_IDL:.idl=.ml) $(C_IDL) + +FILTERED_OXRIDL := $(filter %.oxridl, $(FILTERED)) +DEP_OXRIDL := $(FILTERED_OXRIDL:%.oxridl=$(MLDEPDIR)/%.d) $(FILTERED_OXRIDL:.oxridl=.di) +AUTO_OXRIDL := $(FILTERED_OXRIDL:.oxridl=.mli) $(FILTERED_OXRIDL:.oxridl=.ml) $(C_OXRIDL) + +FILTERED_C_CXX := $(filter %.c %.m %.$(EXT_CXX), $(FILTERED)) +OBJ_C_CXX := $(FILTERED_C_CXX:.c=.$(EXT_OBJ)) +OBJ_C_CXX := $(OBJ_C_CXX:.m=.$(EXT_OBJ)) +OBJ_C_CXX := $(OBJ_C_CXX:.$(EXT_CXX)=.$(EXT_OBJ)) + +PRE_TARGETS += $(AUTO_MLL) $(AUTO_MLY) $(AUTO_IDL) $(AUTO_OXRIDL) $(AUTO_ZOG) $(AUTO_REP) $(AUTO_GLADE) + +ALL_DEPS := $(DEP_ML) $(DEP_MLI) $(DEP_MLL) $(DEP_MLY) $(DEP_IDL) $(DEP_OXRIDL) $(DEP_ZOG) $(DEP_REP) $(DEP_GLADE) + +MLDEPS := $(filter %.d, $(ALL_DEPS)) +MLIDEPS := $(filter %.di, $(ALL_DEPS)) +BCDEPIS := $(MLIDEPS:%.di=$(BCDIDIR)/%.di) +NCDEPIS := $(MLIDEPS:%.di=$(NCDIDIR)/%.di) + +ALLML := $(filter %.mli %.ml %.mll %.mly %.idl %.oxridl %.rep %.zog %.glade, $(FILTERED)) + +IMPLO_INTF := $(ALLML:%.mli=%.mli.__) +IMPLO_INTF := $(foreach file, $(IMPLO_INTF), \ + $(basename $(file)).cmi $(basename $(file)).cmo) +IMPLO_INTF := $(filter-out %.mli.cmo, $(IMPLO_INTF)) +IMPLO_INTF := $(IMPLO_INTF:%.mli.cmi=%.cmi) + +IMPLX_INTF := $(IMPLO_INTF:.cmo=.cmx) + +INTF := $(filter %.cmi, $(IMPLO_INTF)) +IMPL_CMO := $(filter %.cmo, $(IMPLO_INTF)) +IMPL_CMX := $(IMPL_CMO:.cmo=.cmx) +IMPL_ASM := $(IMPL_CMO:.cmo=.asm) +IMPL_S := $(IMPL_CMO:.cmo=.s) + +OBJ_LINK := $(OBJ_C_IDL) $(OBJ_C_CXX) +OBJ_FILES := $(IMPL_CMO:.cmo=.$(EXT_OBJ)) $(OBJ_LINK) + +EXECS := $(addsuffix $(EXE), \ + $(sort $(TOPRESULT) $(BCRESULT) $(NCRESULT))) +ifdef WIN32 + EXECS += $(BCRESULT).dll $(NCRESULT).dll +endif + +CLIB_BASE := $(RESULT)$(RES_CLIB_SUF) +ifneq ($(strip $(OBJ_LINK)),) + RES_CLIB := lib$(CLIB_BASE).$(EXT_LIB) +endif + +ifdef WIN32 +DLLSONAME := dll$(CLIB_BASE).dll +else +DLLSONAME := dll$(CLIB_BASE).so +endif + +NONEXECS := $(INTF) $(IMPL_CMO) $(IMPL_CMX) $(IMPL_ASM) $(IMPL_S) \ + $(OBJ_FILES) $(PRE_TARGETS) $(BCRESULT).cma $(NCRESULT).cmxa \ + $(NCRESULT).$(EXT_LIB) $(BCRESULT).cmi $(BCRESULT).cmo \ + $(NCRESULT).cmi $(NCRESULT).cmx $(NCRESULT).$(EXT_OBJ) \ + $(RES_CLIB) $(IMPL_CMO:.cmo=.annot) \ + $(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo $(LIB_PACK_NAME).cmx \ + $(LIB_PACK_NAME).$(EXT_OBJ) + +ifndef STATIC + NONEXECS += $(DLLSONAME) +endif + +ifndef LIBINSTALL_FILES + LIBINSTALL_FILES := $(RESULT).mli $(RESULT).cmi $(RESULT).cma \ + $(RESULT).cmxa $(RESULT).$(EXT_LIB) $(RES_CLIB) + ifndef STATIC + ifneq ($(strip $(OBJ_LINK)),) + LIBINSTALL_FILES += $(DLLSONAME) + endif + endif +endif + +export LIBINSTALL_FILES + +ifdef WIN32 + # some extra stuff is created while linking DLLs + NONEXECS += $(BCRESULT).$(EXT_LIB) $(BCRESULT).exp $(NCRESULT).exp $(CLIB_BASE).exp $(CLIB_BASE).lib +endif + +TARGETS := $(EXECS) $(NONEXECS) + +# If there are IDL-files +ifneq ($(strip $(FILTERED_IDL)),) + MAYBE_IDL := -cclib -lcamlidl +endif + +ifdef USE_CAMLP4 + CAMLP4PATH := \ + $(shell $(CAMLP4) -where 2>/dev/null || echo /usr/local/lib/camlp4) + INCFLAGS := -I $(CAMLP4PATH) + CINCFLAGS := -I$(CAMLP4PATH) +endif + +DINCFLAGS := $(INCFLAGS) $(SOURCE_DIRS:%=-I %) $(OCAML_DEFAULT_DIRS:%=-I %) +INCFLAGS := $(DINCFLAGS) $(INCDIRS:%=-I %) +CINCFLAGS += $(SOURCE_DIRS:%=-I%) $(INCDIRS:%=-I%) $(OCAML_DEFAULT_DIRS:%=-I%) + +ifndef MSVC + CLIBFLAGS += $(SOURCE_DIRS:%=-L%) $(LIBDIRS:%=-L%) \ + $(EXTLIBDIRS:%=-L%) $(OCAML_DEFAULT_DIRS:%=-L%) + + ifeq ($(ELF_RPATH), yes) + CLIBFLAGS += $(EXTLIBDIRS:%=-Wl,$(RPATH_FLAG)%) + endif +endif + +ifndef PROFILING + INTF_OCAMLC := $(OCAMLC) +else + ifndef THREADS + INTF_OCAMLC := $(OCAMLCP) -p $(OCAMLCPFLAGS) + else + # OCaml does not support profiling byte code + # with threads (yet), therefore we force an error. + ifndef REAL_OCAMLC + $(error Profiling of multithreaded byte code not yet supported by OCaml) + endif + INTF_OCAMLC := $(OCAMLC) + endif +endif + +ifndef MSVC + COMMON_LDFLAGS := $(LDFLAGS:%=-ccopt %) $(SOURCE_DIRS:%=-ccopt -L%) \ + $(LIBDIRS:%=-ccopt -L%) $(EXTLIBDIRS:%=-ccopt -L%) \ + $(EXTLIBDIRS:%=-ccopt -Wl $(OCAML_DEFAULT_DIRS:%=-ccopt -L%)) + + ifeq ($(ELF_RPATH),yes) + COMMON_LDFLAGS += $(EXTLIBDIRS:%=-ccopt -Wl,$(RPATH_FLAG)%) + endif +else + COMMON_LDFLAGS := -ccopt "/link -NODEFAULTLIB:LIBC $(LDFLAGS:%=%) $(SOURCE_DIRS:%=-LIBPATH:%) \ + $(LIBDIRS:%=-LIBPATH:%) $(EXTLIBDIRS:%=-LIBPATH:%) \ + $(OCAML_DEFAULT_DIRS:%=-LIBPATH:%) " +endif + +CLIBS_OPTS := $(CLIBS:%=-cclib -l%) $(CFRAMEWORKS:%=-cclib '-framework %') +ifdef MSVC + ifndef STATIC + # MSVC libraries do not have 'lib' prefix + CLIBS_OPTS := $(CLIBS:%=-cclib %.lib) + endif +endif + +ifneq ($(strip $(OBJ_LINK)),) + ifdef CREATE_LIB + OBJS_LIBS := -cclib -l$(CLIB_BASE) $(CLIBS_OPTS) $(MAYBE_IDL) + else + OBJS_LIBS := $(OBJ_LINK) $(CLIBS_OPTS) $(MAYBE_IDL) + endif +else + OBJS_LIBS := $(CLIBS_OPTS) $(MAYBE_IDL) +endif + +ifdef LIB_PACK_NAME + FOR_PACK_NAME := $(shell echo $(LIB_PACK_NAME) | awk '{print toupper(substr($$0,1,1))substr($$0,2)}') +endif + +# If we have to make byte-code +ifndef REAL_OCAMLC + BYTE_OCAML := y + + # EXTRADEPS is added dependencies we have to insert for all + # executable files we generate. Ideally it should be all of the + # libraries we use, but it's hard to find the ones that get searched on + # the path since I don't know the paths built into the compiler, so + # just include the ones with slashes in their names. + EXTRADEPS := $(addsuffix .cma,$(foreach i,$(LIBS),$(if $(findstring /,$(i)),$(i)))) + + + ifndef LIB_PACK_NAME + SPECIAL_OCAMLFLAGS := $(OCAMLBCFLAGS) + else + SPECIAL_OCAMLFLAGS := -for-pack $(FOR_PACK_NAME) $(OCAMLBCFLAGS) + endif + + REAL_OCAMLC := $(INTF_OCAMLC) + + REAL_IMPL := $(IMPL_CMO) + REAL_IMPL_INTF := $(IMPLO_INTF) + IMPL_SUF := .cmo + + DEPFLAGS := + MAKE_DEPS := $(MLDEPS) $(BCDEPIS) + + ifdef CREATE_LIB + override CFLAGS := $(PIC_CFLAGS) $(CFLAGS) + override CPPFLAGS := $(PIC_CPPFLAGS) $(CPPFLAGS) + ifndef STATIC + ifneq ($(strip $(OBJ_LINK)),) + MAKEDLL := $(DLLSONAME) + ALL_LDFLAGS := -dllib $(DLLSONAME) + endif + endif + endif + + ifndef NO_CUSTOM + ifneq "$(strip $(OBJ_LINK) $(THREADS) $(MAYBE_IDL) $(CLIBS) $(CFRAMEWORKS))" "" + ALL_LDFLAGS += -custom + endif + endif + + ALL_LDFLAGS += $(INCFLAGS) $(OCAMLLDFLAGS) $(OCAMLBLDFLAGS) \ + $(COMMON_LDFLAGS) $(LIBS:%=%.cma) + CAMLIDLDLLFLAGS := + + ifdef THREADS + ifdef VMTHREADS + THREAD_FLAG := -vmthread + else + THREAD_FLAG := -thread + endif + ALL_LDFLAGS := $(THREAD_FLAG) $(ALL_LDFLAGS) + ifndef CREATE_LIB + ifndef REAL_OCAMLFIND + ALL_LDFLAGS := unix.cma threads.cma $(ALL_LDFLAGS) + endif + endif + endif + +# we have to make native-code +else + EXTRADEPS := $(addsuffix .cmxa,$(foreach i,$(LIBS),$(if $(findstring /,$(i)),$(i)))) + ifndef PROFILING + SPECIAL_OCAMLFLAGS := $(OCAMLNCFLAGS) + PLDFLAGS := + else + SPECIAL_OCAMLFLAGS := -p $(OCAMLNCFLAGS) + PLDFLAGS := -p + endif + + ifndef LIB_PACK_NAME + SPECIAL_OCAMLFLAGS := $(OCAMLNCFLAGS) + else + SPECIAL_OCAMLFLAGS := -for-pack $(FOR_PACK_NAME) $(OCAMLNCFLAGS) + endif + REAL_IMPL := $(IMPL_CMX) + REAL_IMPL_INTF := $(IMPLX_INTF) + IMPL_SUF := .cmx + + override CPPFLAGS := -DNATIVE_CODE $(CPPFLAGS) + + DEPFLAGS := -native + MAKE_DEPS := $(MLDEPS) $(NCDEPIS) + + ALL_LDFLAGS := $(PLDFLAGS) $(INCFLAGS) $(OCAMLLDFLAGS) \ + $(OCAMLNLDFLAGS) $(COMMON_LDFLAGS) + CAMLIDLDLLFLAGS := -opt + + ifndef CREATE_LIB + ALL_LDFLAGS += $(LIBS:%=%.cmxa) + else + override CFLAGS := $(PIC_CFLAGS) $(CFLAGS) + override CPPFLAGS := $(PIC_CPPFLAGS) $(CPPFLAGS) + endif + + ifdef THREADS + THREAD_FLAG := -thread + ALL_LDFLAGS := $(THREAD_FLAG) $(ALL_LDFLAGS) + ifndef CREATE_LIB + ifndef REAL_OCAMLFIND + ALL_LDFLAGS := unix.cmxa threads.cmxa $(ALL_LDFLAGS) + endif + endif + endif +endif + +export MAKE_DEPS + +ifdef ANNOTATE + ANNOT_FLAG := -dtypes +else +endif + +ALL_OCAMLCFLAGS := $(THREAD_FLAG) $(ANNOT_FLAG) $(OCAMLFLAGS) \ + $(INCFLAGS) $(SPECIAL_OCAMLFLAGS) + +ifdef make_deps + -include $(MAKE_DEPS) + PRE_TARGETS := +endif + +########################################################################### +# USER RULES + +# Call "OCamlMakefile QUIET=" to get rid of all of the @'s. +QUIET=@ + +# generates byte-code (default) +byte-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ + REAL_RESULT="$(BCRESULT)" make_deps=yes +bc: byte-code + +byte-code-nolink: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ + REAL_RESULT="$(BCRESULT)" make_deps=yes +bcnl: byte-code-nolink + +top: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(TOPRESULT) \ + REAL_RESULT="$(BCRESULT)" make_deps=yes + +# generates native-code + +native-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ + REAL_RESULT="$(NCRESULT)" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + make_deps=yes +nc: native-code + +native-code-nolink: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ + REAL_RESULT="$(NCRESULT)" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + make_deps=yes +ncnl: native-code-nolink + +# generates byte-code libraries +byte-code-library: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(BCRESULT).cma \ + REAL_RESULT="$(BCRESULT)" \ + CREATE_LIB=yes \ + make_deps=yes +bcl: byte-code-library + +# generates native-code libraries +native-code-library: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(NCRESULT).cmxa \ + REAL_RESULT="$(NCRESULT)" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + CREATE_LIB=yes \ + make_deps=yes +ncl: native-code-library + +ifdef WIN32 +# generates byte-code dll +byte-code-dll: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(BCRESULT).dll \ + REAL_RESULT="$(BCRESULT)" \ + make_deps=yes +bcd: byte-code-dll + +# generates native-code dll +native-code-dll: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(NCRESULT).dll \ + REAL_RESULT="$(NCRESULT)" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + make_deps=yes +ncd: native-code-dll +endif + +# generates byte-code with debugging information +debug-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ + REAL_RESULT="$(BCRESULT)" make_deps=yes \ + OCAMLFLAGS="-g $(OCAMLFLAGS)" \ + OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" +dc: debug-code + +debug-code-nolink: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ + REAL_RESULT="$(BCRESULT)" make_deps=yes \ + OCAMLFLAGS="-g $(OCAMLFLAGS)" \ + OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" +dcnl: debug-code-nolink + +# generates byte-code with debugging information (native code) +debug-native-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ + REAL_RESULT="$(NCRESULT)" make_deps=yes \ + REAL_OCAMLC="$(OCAMLOPT)" \ + OCAMLFLAGS="-g $(OCAMLFLAGS)" \ + OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" +dnc: debug-native-code + +debug-native-code-nolink: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ + REAL_RESULT="$(NCRESULT)" make_deps=yes \ + REAL_OCAMLC="$(OCAMLOPT)" \ + OCAMLFLAGS="-g $(OCAMLFLAGS)" \ + OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" +dncnl: debug-native-code-nolink + +# generates byte-code libraries with debugging information +debug-code-library: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(BCRESULT).cma \ + REAL_RESULT="$(BCRESULT)" make_deps=yes \ + CREATE_LIB=yes \ + OCAMLFLAGS="-g $(OCAMLFLAGS)" \ + OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" +dcl: debug-code-library + +# generates byte-code libraries with debugging information (native code) +debug-native-code-library: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(NCRESULT).cma \ + REAL_RESULT="$(NCRESULT)" make_deps=yes \ + REAL_OCAMLC="$(OCAMLOPT)" \ + CREATE_LIB=yes \ + OCAMLFLAGS="-g $(OCAMLFLAGS)" \ + OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" +dncl: debug-native-code-library + +# generates byte-code for profiling +profiling-byte-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ + REAL_RESULT="$(BCRESULT)" PROFILING="y" \ + make_deps=yes +pbc: profiling-byte-code + +# generates native-code + +profiling-native-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ + REAL_RESULT="$(NCRESULT)" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + PROFILING="y" \ + make_deps=yes +pnc: profiling-native-code + +# generates byte-code libraries +profiling-byte-code-library: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(BCRESULT).cma \ + REAL_RESULT="$(BCRESULT)" PROFILING="y" \ + CREATE_LIB=yes \ + make_deps=yes +pbcl: profiling-byte-code-library + +# generates native-code libraries +profiling-native-code-library: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(RES_CLIB) $(NCRESULT).cmxa \ + REAL_RESULT="$(NCRESULT)" PROFILING="y" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + CREATE_LIB=yes \ + make_deps=yes +pncl: profiling-native-code-library + +# packs byte-code objects +pack-byte-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT).cmo \ + REAL_RESULT="$(BCRESULT)" \ + PACK_LIB=yes make_deps=yes +pabc: pack-byte-code + +# packs native-code objects +pack-native-code: $(PRE_TARGETS) + $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ + $(NCRESULT).cmx $(NCRESULT).$(EXT_OBJ) \ + REAL_RESULT="$(NCRESULT)" \ + REAL_OCAMLC="$(OCAMLOPT)" \ + PACK_LIB=yes make_deps=yes +panc: pack-native-code + +# generates HTML-documentation +htdoc: $(DOC_DIR)/$(RESULT)/html/index.html + +# generates Latex-documentation +ladoc: $(DOC_DIR)/$(RESULT)/latex/doc.tex + +# generates PostScript-documentation +psdoc: $(DOC_DIR)/$(RESULT)/latex/doc.ps + +# generates PDF-documentation +pdfdoc: $(DOC_DIR)/$(RESULT)/latex/doc.pdf + +# generates all supported forms of documentation +doc: htdoc ladoc psdoc pdfdoc + +########################################################################### +# LOW LEVEL RULES + +$(REAL_RESULT): $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) $(RESULTDEPS) + $(REAL_OCAMLFIND) $(REAL_OCAMLC) \ + $(OCAML_FIND_PACKAGES) $(OCAML_FIND_LINKPKG) \ + $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@$(EXE) \ + $(REAL_IMPL) + +nolink: $(REAL_IMPL_INTF) $(OBJ_LINK) + +ifdef WIN32 +$(REAL_RESULT).dll: $(REAL_IMPL_INTF) $(OBJ_LINK) + $(CAMLIDLDLL) $(CAMLIDLDLLFLAGS) $(OBJ_LINK) $(CLIBS) \ + -o $@ $(REAL_IMPL) +endif + +%$(TOPSUFFIX): $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) + $(REAL_OCAMLFIND) $(OCAMLMKTOP) \ + $(OCAML_FIND_PACKAGES) $(OCAML_FIND_LINKPKG) \ + $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@$(EXE) \ + $(REAL_IMPL) + +.SUFFIXES: .mli .ml .cmi .cmo .cmx .cma .cmxa .$(EXT_OBJ) \ + .mly .di .d .$(EXT_LIB) .idl %.oxridl .c .m .$(EXT_CXX) .h .so \ + .rep .zog .glade + +ifndef STATIC +ifdef MINGW +# From OCaml 3.11.0, ocamlmklib is available on windows +OCAMLMLIB_EXISTS = $(shell which $(OCAMLMKLIB)) +ifeq ($(strip $(OCAMLMLIB_EXISTS)),) +$(DLLSONAME): $(OBJ_LINK) + $(CC) $(CFLAGS) $(CFLAGS_WIN32) $(OBJ_LINK) -shared -o $@ \ + $(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/lib%.a))) \ + '$(OCAMLLIBPATH)/ocamlrun.a' \ + -Wl,--whole-archive \ + -Wl,--export-all-symbols \ + -Wl,--allow-multiple-definition \ + -Wl,--enable-auto-import +else +$(DLLSONAME): $(OBJ_LINK) + $(OCAMLMKLIB) $(INCFLAGS) $(CLIBFLAGS) \ + -o $(CLIB_BASE) $(OBJ_LINK) $(CLIBS:%=-l%) \ + $(CFRAMEWORKS:%=-framework %) \ + $(OCAMLMKLIB_FLAGS) +endif +else +ifdef MSVC +$(DLLSONAME): $(OBJ_LINK) + link /NOLOGO /DLL /OUT:$@ $(OBJ_LINK) \ + $(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/%.lib))) \ + '$(OCAMLLIBPATH)/ocamlrun.lib' + +else +$(DLLSONAME): $(OBJ_LINK) + $(OCAMLMKLIB) $(INCFLAGS) $(CLIBFLAGS) \ + -o $(CLIB_BASE) $(OBJ_LINK) $(CLIBS:%=-l%) $(CFRAMEWORKS:%=-framework %) \ + $(OCAMLMKLIB_FLAGS) +endif +endif +endif + +ifndef LIB_PACK_NAME +$(RESULT).cma: $(REAL_IMPL_INTF) $(MAKEDLL) $(EXTRADEPS) $(RESULTDEPS) + $(REAL_OCAMLFIND) $(REAL_OCAMLC) -a $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@ $(REAL_IMPL) + +$(RESULT).cmxa $(RESULT).$(EXT_LIB): $(REAL_IMPL_INTF) $(EXTRADEPS) $(RESULTDEPS) + $(REAL_OCAMLFIND) $(OCAMLOPT) -a $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@ $(REAL_IMPL) +else +# Packing a bytecode library +ifdef BYTE_OCAML +$(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo: $(REAL_IMPL_INTF) + $(REAL_OCAMLFIND) $(REAL_OCAMLC) -pack -o $(LIB_PACK_NAME).cmo $(OCAMLLDFLAGS) $(REAL_IMPL) +# Packing into a unit which can be transformed into a library +# Remember the .ml's must have been compiled with -for-pack $(LIB_PACK_NAME) +else +$(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmx: $(REAL_IMPL_INTF) + $(REAL_OCAMLFIND) $(OCAMLOPT) -pack -o $(LIB_PACK_NAME).cmx $(OCAMLLDFLAGS) $(REAL_IMPL) +endif + +$(RESULT).cma: $(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo $(MAKEDLL) $(EXTRADEPS) $(RESULTDEPS) + $(REAL_OCAMLFIND) $(REAL_OCAMLC) -a $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@ $(LIB_PACK_NAME).cmo + +$(RESULT).cmxa $(RESULT).$(EXT_LIB): $(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmx $(EXTRADEPS) $(RESULTDEPS) + $(REAL_OCAMLFIND) $(OCAMLOPT) -a $(filter-out -custom, $(ALL_LDFLAGS)) $(OBJS_LIBS) -o $@ $(LIB_PACK_NAME).cmx +endif + +$(RES_CLIB): $(OBJ_LINK) +ifndef MSVC + ifneq ($(strip $(OBJ_LINK)),) + $(AR) rcs $@ $(OBJ_LINK) + endif +else + ifneq ($(strip $(OBJ_LINK)),) + lib -nologo -debugtype:cv -out:$(RES_CLIB) $(OBJ_LINK) + endif +endif + +.mli.cmi: $(EXTRADEPS) + $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ + if [ -z "$$pp" ]; then \ + $(ECHO) $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c $(THREAD_FLAG) $(ANNOT_FLAG) \ + $(OCAMLFLAGS) $(INCFLAGS) $<; \ + $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c $(THREAD_FLAG) $(ANNOT_FLAG) \ + $(OCAMLFLAGS) $(INCFLAGS) $<; \ + else \ + $(ECHO) $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c -pp \"$$pp $(PPFLAGS)\" $(THREAD_FLAG) $(ANNOT_FLAG) \ + $(OCAMLFLAGS) $(INCFLAGS) $<; \ + $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c -pp "$$pp $(PPFLAGS)" $(THREAD_FLAG) $(ANNOT_FLAG) \ + $(OCAMLFLAGS) $(INCFLAGS) $<; \ + fi + +.ml.cmi .ml.$(EXT_OBJ) .ml.cmx .ml.cmo: $(EXTRADEPS) + $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ + if [ -z "$$pp" ]; then \ + $(ECHO) $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c $(ALL_OCAMLCFLAGS) $<; \ + $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c $(ALL_OCAMLCFLAGS) $<; \ + else \ + $(ECHO) $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c -pp \"$$pp $(PPFLAGS)\" $(ALL_OCAMLCFLAGS) $<; \ + $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ + -c -pp "$$pp $(PPFLAGS)" $(ALL_OCAMLCFLAGS) $<; \ + fi + +.PRECIOUS: %.ml +%.ml: %.mll + $(OCAMLLEX) $(LFLAGS) $< + +.PRECIOUS: %.ml %.mli +%.ml %.mli: %.mly + $(OCAMLYACC) $(YFLAGS) $< + $(QUIET)pp=`sed -n -e 's/.*(\*pp \([^*]*\) \*).*/\1/p;q' $<`; \ + if [ ! -z "$$pp" ]; then \ + mv $*.ml $*.ml.temporary; \ + echo "(*pp $$pp $(PPFLAGS)*)" > $*.ml; \ + cat $*.ml.temporary >> $*.ml; \ + rm $*.ml.temporary; \ + mv $*.mli $*.mli.temporary; \ + echo "(*pp $$pp $(PPFLAGS)*)" > $*.mli; \ + cat $*.mli.temporary >> $*.mli; \ + rm $*.mli.temporary; \ + fi + + +.PRECIOUS: %.ml +%.ml: %.rep + $(CAMELEON_REPORT) $(CAMELEON_REPORT_FLAGS) -gen $< + +.PRECIOUS: %.ml +%.ml: %.zog + $(CAMELEON_ZOGGY) $(CAMELEON_ZOGGY_FLAGS) -impl $< > $@ + +.PRECIOUS: %.ml +%.ml: %.glade + $(OCAML_GLADECC) $(OCAML_GLADECC_FLAGS) $< > $@ + +.PRECIOUS: %.ml %.mli +%.ml %.mli: %.oxridl + $(OXRIDL) $< + +.PRECIOUS: %.ml %.mli %_stubs.c %.h +%.ml %.mli %_stubs.c %.h: %.idl + $(CAMLIDL) $(MAYBE_IDL_HEADER) $(IDLFLAGS) \ + $(CAMLIDLFLAGS) $< + $(QUIET)if [ $(NOIDLHEADER) ]; then touch $*.h; fi + +.c.$(EXT_OBJ): + $(OCAMLC) -c -cc "$(CC)" -ccopt "$(CFLAGS) \ + $(CPPFLAGS) $(CPPFLAGS_WIN32) \ + $(CFLAGS_WIN32) $(CINCFLAGS) $(CFLAG_O)$@ " $< + +.m.$(EXT_OBJ): + $(CC) -c $(CFLAGS) $(CINCFLAGS) $(CPPFLAGS) \ + -I'$(OCAMLLIBPATH)' \ + $< $(CFLAG_O)$@ + +.$(EXT_CXX).$(EXT_OBJ): + $(CXX) -c $(CXXFLAGS) $(CINCFLAGS) $(CPPFLAGS) \ + -I'$(OCAMLLIBPATH)' \ + $< $(CFLAG_O)$@ + +$(MLDEPDIR)/%.d: %.ml + $(QUIET)if [ ! -d $(@D) ]; then mkdir -p $(@D); fi + $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ + if [ -z "$$pp" ]; then \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ + $(DINCFLAGS) $< \> $@; \ + $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ + $(DINCFLAGS) $< > $@; \ + else \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ + -pp \"$$pp $(PPFLAGS)\" $(DINCFLAGS) $< \> $@; \ + $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ + -pp "$$pp $(PPFLAGS)" $(DINCFLAGS) $< > $@; \ + fi + +$(BCDIDIR)/%.di $(NCDIDIR)/%.di: %.mli + $(QUIET)if [ ! -d $(@D) ]; then mkdir -p $(@D); fi + $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ + if [ -z "$$pp" ]; then \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) $(DINCFLAGS) $< \> $@; \ + $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) $(DINCFLAGS) $< > $@; \ + else \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) \ + -pp \"$$pp $(PPFLAGS)\" $(DINCFLAGS) $< \> $@; \ + $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) \ + -pp "$$pp $(PPFLAGS)" $(DINCFLAGS) $< > $@; \ + fi + +$(DOC_DIR)/$(RESULT)/html: + mkdir -p $@ + +$(DOC_DIR)/$(RESULT)/html/index.html: $(DOC_DIR)/$(RESULT)/html $(DOC_FILES) + rm -rf $</* + $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $(FIRST_DOC_FILE)`; \ + if [ -z "$$pp" ]; then \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -html -d $< $(OCAMLDOCFLAGS) $(INCFLAGS) $(DOC_FILES); \ + $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -html -d $< $(OCAMLDOCFLAGS) $(INCFLAGS) $(DOC_FILES); \ + else \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -pp \"$$pp $(PPFLAGS)\" -html -d $< $(OCAMLDOCFLAGS) \ + $(INCFLAGS) $(DOC_FILES); \ + $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -pp "$$pp $(PPFLAGS)" -html -d $< $(OCAMLDOCFLAGS) \ + $(INCFLAGS) $(DOC_FILES); \ + fi + +$(DOC_DIR)/$(RESULT)/latex: + mkdir -p $@ + +$(DOC_DIR)/$(RESULT)/latex/doc.tex: $(DOC_DIR)/$(RESULT)/latex $(DOC_FILES) + rm -rf $</* + $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $(FIRST_DOC_FILE)`; \ + if [ -z "$$pp" ]; then \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -latex $(OCAMLDOCFLAGS) $(INCFLAGS) \ + $(DOC_FILES) -o $@; \ + $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -latex $(OCAMLDOCFLAGS) $(INCFLAGS) $(DOC_FILES) \ + -o $@; \ + else \ + $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -pp \"$$pp $(PPFLAGS)\" -latex $(OCAMLDOCFLAGS) \ + $(INCFLAGS) $(DOC_FILES) -o $@; \ + $(REAL_OCAMLFIND) $(OCAMLDOC) $(OCAML_FIND_PACKAGES) -pp "$$pp $(PPFLAGS)" -latex $(OCAMLDOCFLAGS) \ + $(INCFLAGS) $(DOC_FILES) -o $@; \ + fi + +$(DOC_DIR)/$(RESULT)/latex/doc.ps: $(DOC_DIR)/$(RESULT)/latex/doc.tex + cd $(DOC_DIR)/$(RESULT)/latex && \ + $(LATEX) doc.tex && \ + $(LATEX) doc.tex && \ + $(DVIPS) $(DVIPSFLAGS) doc.dvi -o $(@F) + +$(DOC_DIR)/$(RESULT)/latex/doc.pdf: $(DOC_DIR)/$(RESULT)/latex/doc.ps + cd $(DOC_DIR)/$(RESULT)/latex && $(PS2PDF) $(<F) + +define make_subproj +.PHONY: +subproj_$(1): + $$(eval $$(call PROJ_$(1))) + $(QUIET)if [ "$(SUBTARGET)" != "all" ]; then \ + $(MAKE) -f $(OCAMLMAKEFILE) $(SUBTARGET); \ + fi +endef + +$(foreach subproj,$(SUBPROJS),$(eval $(call make_subproj,$(subproj)))) + +.PHONY: +subprojs: $(SUBPROJS:%=subproj_%) + +########################################################################### +# (UN)INSTALL RULES FOR LIBRARIES + +.PHONY: libinstall +libinstall: all + $(QUIET)printf "\nInstalling library with ocamlfind\n" + $(OCAMLFIND) install $(OCAMLFIND_INSTFLAGS) $(RESULT) META $(LIBINSTALL_FILES) + $(QUIET)printf "\nInstallation successful.\n" + +.PHONY: libinstall-byte-code +libinstall-byte-code: all + $(QUIET)printf "\nInstalling byte-code library with ocamlfind\n" + $(OCAMLFIND) install $(OCAMLFIND_INSTFLAGS) $(RESULT) META \ + $(filter-out $(RESULT).$(EXT_LIB) $(RESULT).cmxa, $(LIBINSTALL_FILES)) + $(QUIET)printf "\nInstallation successful.\n" + +.PHONY: libinstall-native-code +libinstall-native-code: all + $(QUIET)printf "\nInstalling native-code library with ocamlfind\n" + $(OCAMLFIND) install $(OCAMLFIND_INSTFLAGS) $(RESULT) META \ + $(filter-out $(DLLSONAME) $(RESULT).cma, $(LIBINSTALL_FILES)) + $(QUIET)printf "\nInstallation successful.\n" + +.PHONY: libuninstall +libuninstall: + $(QUIET)printf "\nUninstalling library with ocamlfind\n" + $(OCAMLFIND) remove $(OCAMLFIND_INSTFLAGS) $(RESULT) + $(QUIET)printf "\nUninstallation successful.\n" + +.PHONY: rawinstall +rawinstall: all + $(QUIET)printf "\nInstalling library to: $(OCAML_LIB_INSTALL)\n" + -install -d $(OCAML_LIB_INSTALL) + for i in $(LIBINSTALL_FILES); do \ + if [ -f $$i ]; then \ + install -c -m 0644 $$i $(OCAML_LIB_INSTALL); \ + fi; \ + done + $(QUIET)printf "\nInstallation successful.\n" + +.PHONY: rawuninstall +rawuninstall: + $(QUIET)printf "\nUninstalling library from: $(OCAML_LIB_INSTALL)\n" + cd $(OCAML_LIB_INSTALL) && rm $(notdir $(LIBINSTALL_FILES)) + $(QUIET)printf "\nUninstallation successful.\n" + +########################################################################### +# MAINTENANCE RULES + +.PHONY: clean +clean:: + rm -f $(TARGETS) $(TRASH) + rm -rf $(BCDIDIR) $(NCDIDIR) $(MLDEPDIR) + +.PHONY: cleanup +cleanup:: + rm -f $(NONEXECS) $(TRASH) + rm -rf $(BCDIDIR) $(NCDIDIR) $(MLDEPDIR) + +.PHONY: clean-doc +clean-doc:: + rm -rf $(DOC_DIR)/$(RESULT) + +.PHONY: clean-all +clean-all:: clean clean-doc + +.PHONY: nobackup +nobackup: + rm -f *.bak *~ *.dup diff --git a/test-old/Condact.lus b/_test-old/Condact.lus similarity index 100% rename from test-old/Condact.lus rename to _test-old/Condact.lus diff --git a/test-old/Makefile b/_test-old/Makefile similarity index 100% rename from test-old/Makefile rename to _test-old/Makefile diff --git a/test-old/contractForElementSelectionInArray/contractForElementSelectionInArray.lus b/_test-old/contractForElementSelectionInArray/contractForElementSelectionInArray.lus similarity index 100% rename from test-old/contractForElementSelectionInArray/contractForElementSelectionInArray.lus rename to _test-old/contractForElementSelectionInArray/contractForElementSelectionInArray.lus diff --git a/test-old/contractForElementSelectionInArray/main.lus b/_test-old/contractForElementSelectionInArray/main.lus similarity index 100% rename from test-old/contractForElementSelectionInArray/main.lus rename to _test-old/contractForElementSelectionInArray/main.lus diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus b/_test-old/contractForElementSelectionInArray/noeudsIndependants.lus similarity index 100% rename from src/test/should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus rename to _test-old/contractForElementSelectionInArray/noeudsIndependants.lus diff --git a/test-old/contractForElementSelectionInArray/packageTableau.lus b/_test-old/contractForElementSelectionInArray/packageTableau.lus similarity index 100% rename from test-old/contractForElementSelectionInArray/packageTableau.lus rename to _test-old/contractForElementSelectionInArray/packageTableau.lus diff --git a/test-old/contractForElementSelectionInArray/readme b/_test-old/contractForElementSelectionInArray/readme similarity index 100% rename from test-old/contractForElementSelectionInArray/readme rename to _test-old/contractForElementSelectionInArray/readme diff --git a/test-old/contractForElementSelectionInArray/tri.lus b/_test-old/contractForElementSelectionInArray/tri.lus similarity index 100% rename from test-old/contractForElementSelectionInArray/tri.lus rename to _test-old/contractForElementSelectionInArray/tri.lus diff --git a/test-old/modelInst.lus b/_test-old/modelInst.lus similarity index 100% rename from test-old/modelInst.lus rename to _test-old/modelInst.lus diff --git a/test-old/packages.lus b/_test-old/packages.lus similarity index 100% rename from test-old/packages.lus rename to _test-old/packages.lus diff --git a/test-old/packages2.lus b/_test-old/packages2.lus similarity index 100% rename from test-old/packages2.lus rename to _test-old/packages2.lus diff --git a/test-old/qs.lv6 b/_test-old/qs.lv6 similarity index 100% rename from test-old/qs.lv6 rename to _test-old/qs.lv6 diff --git a/test-old/readme b/_test-old/readme similarity index 100% rename from test-old/readme rename to _test-old/readme diff --git a/test-old/test.diff b/_test-old/test.diff similarity index 100% rename from test-old/test.diff rename to _test-old/test.diff diff --git a/test-old/test.exp b/_test-old/test.exp similarity index 100% rename from test-old/test.exp rename to _test-old/test.exp diff --git a/test-old/test.res b/_test-old/test.res similarity index 100% rename from test-old/test.res rename to _test-old/test.res diff --git a/test-old/tests/cons.lus b/_test-old/tests/cons.lus similarity index 100% rename from test-old/tests/cons.lus rename to _test-old/tests/cons.lus diff --git a/test-old/tests/const-array.lus b/_test-old/tests/const-array.lus similarity index 100% rename from test-old/tests/const-array.lus rename to _test-old/tests/const-array.lus diff --git a/test-old/tests/const-bool.lus b/_test-old/tests/const-bool.lus similarity index 100% rename from test-old/tests/const-bool.lus rename to _test-old/tests/const-bool.lus diff --git a/test-old/tests/const-simple.lus b/_test-old/tests/const-simple.lus similarity index 100% rename from test-old/tests/const-simple.lus rename to _test-old/tests/const-simple.lus diff --git a/test-old/tests/const-struct.lus b/_test-old/tests/const-struct.lus similarity index 100% rename from test-old/tests/const-struct.lus rename to _test-old/tests/const-struct.lus diff --git a/test-old/tests/left.lus b/_test-old/tests/left.lus similarity index 100% rename from test-old/tests/left.lus rename to _test-old/tests/left.lus diff --git a/test-old/tests/newpacks.lus b/_test-old/tests/newpacks.lus similarity index 100% rename from test-old/tests/newpacks.lus rename to _test-old/tests/newpacks.lus diff --git a/test-old/tests/node-simple.lus b/_test-old/tests/node-simple.lus similarity index 100% rename from test-old/tests/node-simple.lus rename to _test-old/tests/node-simple.lus diff --git a/test-old/tests/p.lus b/_test-old/tests/p.lus similarity index 100% rename from test-old/tests/p.lus rename to _test-old/tests/p.lus diff --git a/test-old/tests/packages.lus b/_test-old/tests/packages.lus similarity index 100% rename from test-old/tests/packages.lus rename to _test-old/tests/packages.lus diff --git a/test-old/tests/packs.lus b/_test-old/tests/packs.lus similarity index 100% rename from test-old/tests/packs.lus rename to _test-old/tests/packs.lus diff --git a/test-old/tests/q.lus b/_test-old/tests/q.lus similarity index 100% rename from test-old/tests/q.lus rename to _test-old/tests/q.lus diff --git a/test-old/tests/struct0.lus b/_test-old/tests/struct0.lus similarity index 100% rename from test-old/tests/struct0.lus rename to _test-old/tests/struct0.lus diff --git a/test-old/tests/t.lus b/_test-old/tests/t.lus similarity index 100% rename from test-old/tests/t.lus rename to _test-old/tests/t.lus diff --git a/test-old/tests/t0.lus b/_test-old/tests/t0.lus similarity index 100% rename from test-old/tests/t0.lus rename to _test-old/tests/t0.lus diff --git a/test-old/tests/t1.lus b/_test-old/tests/t1.lus similarity index 100% rename from test-old/tests/t1.lus rename to _test-old/tests/t1.lus diff --git a/test-old/tests/t2.lus b/_test-old/tests/t2.lus similarity index 100% rename from test-old/tests/t2.lus rename to _test-old/tests/t2.lus diff --git a/src/test/should_work/Pascal/test.lus b/_test-old/tests/test.lus similarity index 100% rename from src/test/should_work/Pascal/test.lus rename to _test-old/tests/test.lus diff --git a/src/test/should_work/Pascal/trivial.lus b/_test-old/tests/trivial.lus similarity index 100% rename from src/test/should_work/Pascal/trivial.lus rename to _test-old/tests/trivial.lus diff --git a/src/test/Makefile b/_tests/Makefile similarity index 93% rename from src/test/Makefile rename to _tests/Makefile index 2002653a72ea3553528867a4419ac12c1bd98097..036b1aac3564afd64cc745d460bf22f03da6d775 100644 --- a/src/test/Makefile +++ b/_tests/Makefile @@ -1,6 +1,9 @@ -LC0=../lus2lic -LC=../lus2lic -vl 2 -LC2=../lus2lic + +OBJDIR=../obj$(HOSTTYPE) + +LC0=$(OBJDIR)/lus2lic +LC=$(OBJDIR)/lus2lic -vl 2 +LC2=$(OBJDIR)/lus2lic NL="----------------------------------------------------------------------\\n" filter_line=grep -v Opening\ file @@ -11,6 +14,9 @@ KO_LUS=$(shell find should_fail -name "*.lus" -print | LC_ALL=C sort -n) ALL_LUS=$(OK_LUS) $(KO_LUS) +all: + echo $(ALL_LUS) + LIC=$(shell find should_work -name "*.lic" -print | LC_ALL=C sort -n) @@ -110,6 +116,7 @@ test_lv4: for d in ${OK_LUS}; do \ /bin/echo -e "\n$(NL)====> $(LC0) --nonreg-test -lv4 $$d -o /tmp/xx.lus" >> test_lv4.res; \ $(LC0) --nonreg-test -lv4 $$d -o /tmp/xx.lus >> test_lv4.res 2>&1 ;\ + if [ ! -f /tmp/xx.lus ]; then echo "Error $$d: no /tmp/xx.lus file" >> test_lv4.res 2>&1; fi ;\ for node in `lusinfo /tmp/xx.lus nodes`; do \ /bin/echo -e "lus2ec /tmp/xx.lus $$node" >> test_lv4.res; \ (lus2ec /tmp/xx.lus $$node >> \ @@ -129,6 +136,7 @@ utest: utest_lic utest_ec utest_lv4 clean: + rm -f *.c *.h *.ec for d in ${ALL_LUS}; do \ rm $$d.lic; \ done diff --git a/src/test/should_fail/bad_file_name b/_tests/should_fail/bad_file_name similarity index 100% rename from src/test/should_fail/bad_file_name rename to _tests/should_fail/bad_file_name diff --git a/src/test/should_fail/clock/bad_call02.lus b/_tests/should_fail/clock/bad_call02.lus similarity index 100% rename from src/test/should_fail/clock/bad_call02.lus rename to _tests/should_fail/clock/bad_call02.lus diff --git a/src/test/should_fail/clock/bad_id.lus b/_tests/should_fail/clock/bad_id.lus similarity index 100% rename from src/test/should_fail/clock/bad_id.lus rename to _tests/should_fail/clock/bad_id.lus diff --git a/src/test/should_fail/clock/clock.lus b/_tests/should_fail/clock/clock.lus similarity index 100% rename from src/test/should_fail/clock/clock.lus rename to _tests/should_fail/clock/clock.lus diff --git a/src/test/should_fail/clock/clock2.lus b/_tests/should_fail/clock/clock2.lus similarity index 100% rename from src/test/should_fail/clock/clock2.lus rename to _tests/should_fail/clock/clock2.lus diff --git a/src/test/should_fail/clock/inonout.lus b/_tests/should_fail/clock/inonout.lus similarity index 100% rename from src/test/should_fail/clock/inonout.lus rename to _tests/should_fail/clock/inonout.lus diff --git a/src/test/should_fail/clock/when_enum.lus b/_tests/should_fail/clock/when_enum.lus similarity index 100% rename from src/test/should_fail/clock/when_enum.lus rename to _tests/should_fail/clock/when_enum.lus diff --git a/src/test/should_fail/semantics/activation1.lus b/_tests/should_fail/semantics/activation1.lus similarity index 100% rename from src/test/should_fail/semantics/activation1.lus rename to _tests/should_fail/semantics/activation1.lus diff --git a/src/test/should_fail/semantics/activation2.lus b/_tests/should_fail/semantics/activation2.lus similarity index 100% rename from src/test/should_fail/semantics/activation2.lus rename to _tests/should_fail/semantics/activation2.lus diff --git a/src/test/should_fail/semantics/bad_call01.lus b/_tests/should_fail/semantics/bad_call01.lus similarity index 100% rename from src/test/should_fail/semantics/bad_call01.lus rename to _tests/should_fail/semantics/bad_call01.lus diff --git a/src/test/should_fail/semantics/bug.lus b/_tests/should_fail/semantics/bug.lus similarity index 100% rename from src/test/should_fail/semantics/bug.lus rename to _tests/should_fail/semantics/bug.lus diff --git a/src/test/should_fail/semantics/const.lus b/_tests/should_fail/semantics/const.lus similarity index 100% rename from src/test/should_fail/semantics/const.lus rename to _tests/should_fail/semantics/const.lus diff --git a/src/test/should_fail/semantics/const2.lus b/_tests/should_fail/semantics/const2.lus similarity index 100% rename from src/test/should_fail/semantics/const2.lus rename to _tests/should_fail/semantics/const2.lus diff --git a/src/test/should_fail/semantics/const3.lus b/_tests/should_fail/semantics/const3.lus similarity index 100% rename from src/test/should_fail/semantics/const3.lus rename to _tests/should_fail/semantics/const3.lus diff --git a/src/test/should_fail/semantics/cpt_dc.lus b/_tests/should_fail/semantics/cpt_dc.lus similarity index 100% rename from src/test/should_fail/semantics/cpt_dc.lus rename to _tests/should_fail/semantics/cpt_dc.lus diff --git a/src/test/should_fail/semantics/def.lus b/_tests/should_fail/semantics/def.lus similarity index 100% rename from src/test/should_fail/semantics/def.lus rename to _tests/should_fail/semantics/def.lus diff --git a/src/test/should_fail/semantics/import2.lus b/_tests/should_fail/semantics/import2.lus similarity index 100% rename from src/test/should_fail/semantics/import2.lus rename to _tests/should_fail/semantics/import2.lus diff --git a/src/test/should_fail/semantics/m.lus b/_tests/should_fail/semantics/m.lus similarity index 100% rename from src/test/should_fail/semantics/m.lus rename to _tests/should_fail/semantics/m.lus diff --git a/src/test/should_fail/semantics/not_a_constant.lus b/_tests/should_fail/semantics/not_a_constant.lus similarity index 100% rename from src/test/should_fail/semantics/not_a_constant.lus rename to _tests/should_fail/semantics/not_a_constant.lus diff --git a/src/test/should_fail/semantics/piege.lus b/_tests/should_fail/semantics/piege.lus similarity index 100% rename from src/test/should_fail/semantics/piege.lus rename to _tests/should_fail/semantics/piege.lus diff --git a/src/test/should_fail/semantics/tranche.lus b/_tests/should_fail/semantics/tranche.lus similarity index 100% rename from src/test/should_fail/semantics/tranche.lus rename to _tests/should_fail/semantics/tranche.lus diff --git a/src/test/should_fail/semantics/x.lus b/_tests/should_fail/semantics/x.lus similarity index 100% rename from src/test/should_fail/semantics/x.lus rename to _tests/should_fail/semantics/x.lus diff --git a/src/test/should_fail/syntax/old_style_and_pack.lus b/_tests/should_fail/syntax/old_style_and_pack.lus similarity index 100% rename from src/test/should_fail/syntax/old_style_and_pack.lus rename to _tests/should_fail/syntax/old_style_and_pack.lus diff --git a/src/test/should_fail/syntax/record.lus b/_tests/should_fail/syntax/record.lus similarity index 100% rename from src/test/should_fail/syntax/record.lus rename to _tests/should_fail/syntax/record.lus diff --git a/src/test/should_fail/type/Gyro.lus b/_tests/should_fail/type/Gyro.lus similarity index 100% rename from src/test/should_fail/type/Gyro.lus rename to _tests/should_fail/type/Gyro.lus diff --git a/src/test/should_fail/type/bad_call03.lus b/_tests/should_fail/type/bad_call03.lus similarity index 100% rename from src/test/should_fail/type/bad_call03.lus rename to _tests/should_fail/type/bad_call03.lus diff --git a/src/test/should_fail/type/const2.lus b/_tests/should_fail/type/const2.lus similarity index 100% rename from src/test/should_fail/type/const2.lus rename to _tests/should_fail/type/const2.lus diff --git a/src/test/should_fail/type/packages.lus b/_tests/should_fail/type/packages.lus similarity index 100% rename from src/test/should_fail/type/packages.lus rename to _tests/should_fail/type/packages.lus diff --git a/src/test/should_fail/type/packages2.lus b/_tests/should_fail/type/packages2.lus similarity index 100% rename from src/test/should_fail/type/packages2.lus rename to _tests/should_fail/type/packages2.lus diff --git a/src/test/should_fail/type/parametric_node.lus b/_tests/should_fail/type/parametric_node.lus similarity index 100% rename from src/test/should_fail/type/parametric_node.lus rename to _tests/should_fail/type/parametric_node.lus diff --git a/src/test/should_fail/type/parametric_node2.lus b/_tests/should_fail/type/parametric_node2.lus similarity index 100% rename from src/test/should_fail/type/parametric_node2.lus rename to _tests/should_fail/type/parametric_node2.lus diff --git a/src/test/should_fail/type/parametric_node3.lus b/_tests/should_fail/type/parametric_node3.lus similarity index 100% rename from src/test/should_fail/type/parametric_node3.lus rename to _tests/should_fail/type/parametric_node3.lus diff --git a/src/test/should_fail/type/parametric_node4.lus b/_tests/should_fail/type/parametric_node4.lus similarity index 100% rename from src/test/should_fail/type/parametric_node4.lus rename to _tests/should_fail/type/parametric_node4.lus diff --git a/src/test/should_work/NONREG/COUNTER.lus b/_tests/should_work/NONREG/COUNTER.lus similarity index 100% rename from src/test/should_work/NONREG/COUNTER.lus rename to _tests/should_work/NONREG/COUNTER.lus diff --git a/src/test/should_work/NONREG/CURRENT.lus b/_tests/should_work/NONREG/CURRENT.lus similarity index 100% rename from src/test/should_work/NONREG/CURRENT.lus rename to _tests/should_work/NONREG/CURRENT.lus diff --git a/src/test/should_work/NONREG/EDGE.lus b/_tests/should_work/NONREG/EDGE.lus similarity index 100% rename from src/test/should_work/NONREG/EDGE.lus rename to _tests/should_work/NONREG/EDGE.lus diff --git a/src/test/should_work/NONREG/FALLING_EDGE.lus b/_tests/should_work/NONREG/FALLING_EDGE.lus similarity index 100% rename from src/test/should_work/NONREG/FALLING_EDGE.lus rename to _tests/should_work/NONREG/FALLING_EDGE.lus diff --git a/src/test/should_work/NONREG/Int.lus b/_tests/should_work/NONREG/Int.lus similarity index 100% rename from src/test/should_work/NONREG/Int.lus rename to _tests/should_work/NONREG/Int.lus diff --git a/src/test/should_work/NONREG/PCOND.lus b/_tests/should_work/NONREG/PCOND.lus similarity index 100% rename from src/test/should_work/NONREG/PCOND.lus rename to _tests/should_work/NONREG/PCOND.lus diff --git a/src/test/should_work/NONREG/PCOND1.lus b/_tests/should_work/NONREG/PCOND1.lus similarity index 100% rename from src/test/should_work/NONREG/PCOND1.lus rename to _tests/should_work/NONREG/PCOND1.lus diff --git a/src/test/should_work/NONREG/SOURIS.lus b/_tests/should_work/NONREG/SOURIS.lus similarity index 100% rename from src/test/should_work/NONREG/SOURIS.lus rename to _tests/should_work/NONREG/SOURIS.lus diff --git a/src/test/should_work/NONREG/STABLE.lus b/_tests/should_work/NONREG/STABLE.lus similarity index 100% rename from src/test/should_work/NONREG/STABLE.lus rename to _tests/should_work/NONREG/STABLE.lus diff --git a/src/test/should_work/NONREG/SWITCH.lus b/_tests/should_work/NONREG/SWITCH.lus similarity index 100% rename from src/test/should_work/NONREG/SWITCH.lus rename to _tests/should_work/NONREG/SWITCH.lus diff --git a/src/test/should_work/NONREG/SWITCH1.lus b/_tests/should_work/NONREG/SWITCH1.lus similarity index 100% rename from src/test/should_work/NONREG/SWITCH1.lus rename to _tests/should_work/NONREG/SWITCH1.lus diff --git a/src/test/should_work/NONREG/TIME_STABLE.lus b/_tests/should_work/NONREG/TIME_STABLE.lus similarity index 100% rename from src/test/should_work/NONREG/TIME_STABLE.lus rename to _tests/should_work/NONREG/TIME_STABLE.lus diff --git a/src/test/should_work/NONREG/TIME_STABLE1.lus b/_tests/should_work/NONREG/TIME_STABLE1.lus similarity index 100% rename from src/test/should_work/NONREG/TIME_STABLE1.lus rename to _tests/should_work/NONREG/TIME_STABLE1.lus diff --git a/src/test/should_work/NONREG/Watch.lus b/_tests/should_work/NONREG/Watch.lus similarity index 100% rename from src/test/should_work/NONREG/Watch.lus rename to _tests/should_work/NONREG/Watch.lus diff --git a/src/test/should_work/NONREG/X.lus b/_tests/should_work/NONREG/X.lus similarity index 100% rename from src/test/should_work/NONREG/X.lus rename to _tests/should_work/NONREG/X.lus diff --git a/src/test/should_work/NONREG/X1.lus b/_tests/should_work/NONREG/X1.lus similarity index 100% rename from src/test/should_work/NONREG/X1.lus rename to _tests/should_work/NONREG/X1.lus diff --git a/src/test/should_work/NONREG/X2.lus b/_tests/should_work/NONREG/X2.lus similarity index 100% rename from src/test/should_work/NONREG/X2.lus rename to _tests/should_work/NONREG/X2.lus diff --git a/src/test/should_work/NONREG/X3.lus b/_tests/should_work/NONREG/X3.lus similarity index 100% rename from src/test/should_work/NONREG/X3.lus rename to _tests/should_work/NONREG/X3.lus diff --git a/src/test/should_work/NONREG/X6.lus b/_tests/should_work/NONREG/X6.lus similarity index 100% rename from src/test/should_work/NONREG/X6.lus rename to _tests/should_work/NONREG/X6.lus diff --git a/src/test/should_work/NONREG/_N_uu.lus b/_tests/should_work/NONREG/_N_uu.lus similarity index 100% rename from src/test/should_work/NONREG/_N_uu.lus rename to _tests/should_work/NONREG/_N_uu.lus diff --git a/src/test/should_work/NONREG/activation_ec.lus b/_tests/should_work/NONREG/activation_ec.lus similarity index 100% rename from src/test/should_work/NONREG/activation_ec.lus rename to _tests/should_work/NONREG/activation_ec.lus diff --git a/src/test/should_work/NONREG/after.lus b/_tests/should_work/NONREG/after.lus similarity index 100% rename from src/test/should_work/NONREG/after.lus rename to _tests/should_work/NONREG/after.lus diff --git a/src/test/should_work/NONREG/alarme.lus b/_tests/should_work/NONREG/alarme.lus similarity index 100% rename from src/test/should_work/NONREG/alarme.lus rename to _tests/should_work/NONREG/alarme.lus diff --git a/src/test/should_work/NONREG/arbitre.lus b/_tests/should_work/NONREG/arbitre.lus similarity index 100% rename from src/test/should_work/NONREG/arbitre.lus rename to _tests/should_work/NONREG/arbitre.lus diff --git a/src/test/should_work/NONREG/argos.lus b/_tests/should_work/NONREG/argos.lus similarity index 100% rename from src/test/should_work/NONREG/argos.lus rename to _tests/should_work/NONREG/argos.lus diff --git a/src/test/should_work/NONREG/assertion.lus b/_tests/should_work/NONREG/assertion.lus similarity index 100% rename from src/test/should_work/NONREG/assertion.lus rename to _tests/should_work/NONREG/assertion.lus diff --git a/src/test/should_work/NONREG/aux.lus b/_tests/should_work/NONREG/aux.lus similarity index 100% rename from src/test/should_work/NONREG/aux.lus rename to _tests/should_work/NONREG/aux.lus diff --git a/src/test/should_work/NONREG/aux1.lus b/_tests/should_work/NONREG/aux1.lus similarity index 100% rename from src/test/should_work/NONREG/aux1.lus rename to _tests/should_work/NONREG/aux1.lus diff --git a/src/test/should_work/NONREG/bascule.lus b/_tests/should_work/NONREG/bascule.lus similarity index 100% rename from src/test/should_work/NONREG/bascule.lus rename to _tests/should_work/NONREG/bascule.lus diff --git a/src/test/should_work/NONREG/call.lus b/_tests/should_work/NONREG/call.lus similarity index 100% rename from src/test/should_work/NONREG/call.lus rename to _tests/should_work/NONREG/call.lus diff --git a/src/test/should_work/NONREG/ck2.lus b/_tests/should_work/NONREG/ck2.lus similarity index 100% rename from src/test/should_work/NONREG/ck2.lus rename to _tests/should_work/NONREG/ck2.lus diff --git a/src/test/should_work/NONREG/ck3.lus b/_tests/should_work/NONREG/ck3.lus similarity index 100% rename from src/test/should_work/NONREG/ck3.lus rename to _tests/should_work/NONREG/ck3.lus diff --git a/src/test/should_work/NONREG/ck4.lus b/_tests/should_work/NONREG/ck4.lus similarity index 100% rename from src/test/should_work/NONREG/ck4.lus rename to _tests/should_work/NONREG/ck4.lus diff --git a/src/test/should_work/NONREG/ck5.lus b/_tests/should_work/NONREG/ck5.lus similarity index 100% rename from src/test/should_work/NONREG/ck5.lus rename to _tests/should_work/NONREG/ck5.lus diff --git a/src/test/should_work/NONREG/ck6.lus b/_tests/should_work/NONREG/ck6.lus similarity index 100% rename from src/test/should_work/NONREG/ck6.lus rename to _tests/should_work/NONREG/ck6.lus diff --git a/src/test/should_work/NONREG/ck7.lus b/_tests/should_work/NONREG/ck7.lus similarity index 100% rename from src/test/should_work/NONREG/ck7.lus rename to _tests/should_work/NONREG/ck7.lus diff --git a/src/test/should_work/NONREG/clock.lus b/_tests/should_work/NONREG/clock.lus similarity index 100% rename from src/test/should_work/NONREG/clock.lus rename to _tests/should_work/NONREG/clock.lus diff --git a/src/test/should_work/NONREG/cminus.lus b/_tests/should_work/NONREG/cminus.lus similarity index 100% rename from src/test/should_work/NONREG/cminus.lus rename to _tests/should_work/NONREG/cminus.lus diff --git a/src/test/should_work/NONREG/compteur.lus b/_tests/should_work/NONREG/compteur.lus similarity index 100% rename from src/test/should_work/NONREG/compteur.lus rename to _tests/should_work/NONREG/compteur.lus diff --git a/src/test/should_work/NONREG/count.lus b/_tests/should_work/NONREG/count.lus similarity index 100% rename from src/test/should_work/NONREG/count.lus rename to _tests/should_work/NONREG/count.lus diff --git a/src/test/should_work/NONREG/cpt.lus b/_tests/should_work/NONREG/cpt.lus similarity index 100% rename from src/test/should_work/NONREG/cpt.lus rename to _tests/should_work/NONREG/cpt.lus diff --git a/src/test/should_work/NONREG/cst.lus b/_tests/should_work/NONREG/cst.lus similarity index 100% rename from src/test/should_work/NONREG/cst.lus rename to _tests/should_work/NONREG/cst.lus diff --git a/src/test/should_work/NONREG/deconne.lus b/_tests/should_work/NONREG/deconne.lus similarity index 100% rename from src/test/should_work/NONREG/deconne.lus rename to _tests/should_work/NONREG/deconne.lus diff --git a/src/test/should_work/NONREG/dep.lus b/_tests/should_work/NONREG/dep.lus similarity index 100% rename from src/test/should_work/NONREG/dep.lus rename to _tests/should_work/NONREG/dep.lus diff --git a/src/test/should_work/NONREG/dependeur.lus b/_tests/should_work/NONREG/dependeur.lus similarity index 100% rename from src/test/should_work/NONREG/dependeur.lus rename to _tests/should_work/NONREG/dependeur.lus diff --git a/src/test/should_work/NONREG/dependeur_struct.lus b/_tests/should_work/NONREG/dependeur_struct.lus similarity index 100% rename from src/test/should_work/NONREG/dependeur_struct.lus rename to _tests/should_work/NONREG/dependeur_struct.lus diff --git a/src/test/should_work/NONREG/drapfab.lus b/_tests/should_work/NONREG/drapfab.lus similarity index 100% rename from src/test/should_work/NONREG/drapfab.lus rename to _tests/should_work/NONREG/drapfab.lus diff --git a/src/test/should_work/NONREG/enum.lus b/_tests/should_work/NONREG/enum.lus similarity index 100% rename from src/test/should_work/NONREG/enum.lus rename to _tests/should_work/NONREG/enum.lus diff --git a/src/test/should_work/NONREG/enum0.lus b/_tests/should_work/NONREG/enum0.lus similarity index 100% rename from src/test/should_work/NONREG/enum0.lus rename to _tests/should_work/NONREG/enum0.lus diff --git a/src/test/should_work/NONREG/eq1.lus b/_tests/should_work/NONREG/eq1.lus similarity index 100% rename from src/test/should_work/NONREG/eq1.lus rename to _tests/should_work/NONREG/eq1.lus diff --git a/src/test/should_work/NONREG/ex.lus b/_tests/should_work/NONREG/ex.lus similarity index 100% rename from src/test/should_work/NONREG/ex.lus rename to _tests/should_work/NONREG/ex.lus diff --git a/src/test/should_work/NONREG/exclusion.lus b/_tests/should_work/NONREG/exclusion.lus similarity index 100% rename from src/test/should_work/NONREG/exclusion.lus rename to _tests/should_work/NONREG/exclusion.lus diff --git a/src/test/should_work/NONREG/fby.lus b/_tests/should_work/NONREG/fby.lus similarity index 100% rename from src/test/should_work/NONREG/fby.lus rename to _tests/should_work/NONREG/fby.lus diff --git a/src/test/should_work/NONREG/flo.lus b/_tests/should_work/NONREG/flo.lus similarity index 100% rename from src/test/should_work/NONREG/flo.lus rename to _tests/should_work/NONREG/flo.lus diff --git a/src/test/should_work/NONREG/fresh_name.lus b/_tests/should_work/NONREG/fresh_name.lus similarity index 100% rename from src/test/should_work/NONREG/fresh_name.lus rename to _tests/should_work/NONREG/fresh_name.lus diff --git a/src/test/should_work/NONREG/hanane.lus b/_tests/should_work/NONREG/hanane.lus similarity index 100% rename from src/test/should_work/NONREG/hanane.lus rename to _tests/should_work/NONREG/hanane.lus diff --git a/src/test/should_work/NONREG/impl_priority.lus b/_tests/should_work/NONREG/impl_priority.lus similarity index 100% rename from src/test/should_work/NONREG/impl_priority.lus rename to _tests/should_work/NONREG/impl_priority.lus diff --git a/src/test/should_work/NONREG/import1.lus b/_tests/should_work/NONREG/import1.lus similarity index 100% rename from src/test/should_work/NONREG/import1.lus rename to _tests/should_work/NONREG/import1.lus diff --git a/src/test/should_work/NONREG/initial.lus b/_tests/should_work/NONREG/initial.lus similarity index 100% rename from src/test/should_work/NONREG/initial.lus rename to _tests/should_work/NONREG/initial.lus diff --git a/src/test/should_work/NONREG/integrator.lus b/_tests/should_work/NONREG/integrator.lus similarity index 100% rename from src/test/should_work/NONREG/integrator.lus rename to _tests/should_work/NONREG/integrator.lus diff --git a/src/test/should_work/NONREG/long_et_stupide_nom_de_noeud.lus b/_tests/should_work/NONREG/long_et_stupide_nom_de_noeud.lus similarity index 100% rename from src/test/should_work/NONREG/long_et_stupide_nom_de_noeud.lus rename to _tests/should_work/NONREG/long_et_stupide_nom_de_noeud.lus diff --git a/src/test/should_work/NONREG/merge.lus b/_tests/should_work/NONREG/merge.lus similarity index 100% rename from src/test/should_work/NONREG/merge.lus rename to _tests/should_work/NONREG/merge.lus diff --git a/src/test/should_work/NONREG/minmax1.lus b/_tests/should_work/NONREG/minmax1.lus similarity index 100% rename from src/test/should_work/NONREG/minmax1.lus rename to _tests/should_work/NONREG/minmax1.lus diff --git a/src/test/should_work/NONREG/minmax2.lus b/_tests/should_work/NONREG/minmax2.lus similarity index 100% rename from src/test/should_work/NONREG/minmax2.lus rename to _tests/should_work/NONREG/minmax2.lus diff --git a/src/test/should_work/NONREG/minmax3.lus b/_tests/should_work/NONREG/minmax3.lus similarity index 100% rename from src/test/should_work/NONREG/minmax3.lus rename to _tests/should_work/NONREG/minmax3.lus diff --git a/src/test/should_work/NONREG/minmax4.lus b/_tests/should_work/NONREG/minmax4.lus similarity index 100% rename from src/test/should_work/NONREG/minmax4.lus rename to _tests/should_work/NONREG/minmax4.lus diff --git a/src/test/should_work/NONREG/minmax4_bis.lus b/_tests/should_work/NONREG/minmax4_bis.lus similarity index 100% rename from src/test/should_work/NONREG/minmax4_bis.lus rename to _tests/should_work/NONREG/minmax4_bis.lus diff --git a/src/test/should_work/NONREG/minmax5.lus b/_tests/should_work/NONREG/minmax5.lus similarity index 100% rename from src/test/should_work/NONREG/minmax5.lus rename to _tests/should_work/NONREG/minmax5.lus diff --git a/src/test/should_work/NONREG/minmax5_random.lus b/_tests/should_work/NONREG/minmax5_random.lus similarity index 100% rename from src/test/should_work/NONREG/minmax5_random.lus rename to _tests/should_work/NONREG/minmax5_random.lus diff --git a/src/test/should_work/NONREG/minmax6.lus b/_tests/should_work/NONREG/minmax6.lus similarity index 100% rename from src/test/should_work/NONREG/minmax6.lus rename to _tests/should_work/NONREG/minmax6.lus diff --git a/src/test/should_work/NONREG/mm.lus b/_tests/should_work/NONREG/mm.lus similarity index 100% rename from src/test/should_work/NONREG/mm.lus rename to _tests/should_work/NONREG/mm.lus diff --git a/src/test/should_work/NONREG/mm1.lus b/_tests/should_work/NONREG/mm1.lus similarity index 100% rename from src/test/should_work/NONREG/mm1.lus rename to _tests/should_work/NONREG/mm1.lus diff --git a/src/test/should_work/NONREG/mm22.lus b/_tests/should_work/NONREG/mm22.lus similarity index 100% rename from src/test/should_work/NONREG/mm22.lus rename to _tests/should_work/NONREG/mm22.lus diff --git a/src/test/should_work/NONREG/mm3.lus b/_tests/should_work/NONREG/mm3.lus similarity index 100% rename from src/test/should_work/NONREG/mm3.lus rename to _tests/should_work/NONREG/mm3.lus diff --git a/src/test/should_work/NONREG/model.lus b/_tests/should_work/NONREG/model.lus similarity index 100% rename from src/test/should_work/NONREG/model.lus rename to _tests/should_work/NONREG/model.lus diff --git a/src/test/should_work/NONREG/model2.lus b/_tests/should_work/NONREG/model2.lus similarity index 100% rename from src/test/should_work/NONREG/model2.lus rename to _tests/should_work/NONREG/model2.lus diff --git a/src/test/should_work/NONREG/mouse.lus b/_tests/should_work/NONREG/mouse.lus similarity index 100% rename from src/test/should_work/NONREG/mouse.lus rename to _tests/should_work/NONREG/mouse.lus diff --git a/src/test/should_work/NONREG/mouse1.lus b/_tests/should_work/NONREG/mouse1.lus similarity index 100% rename from src/test/should_work/NONREG/mouse1.lus rename to _tests/should_work/NONREG/mouse1.lus diff --git a/src/test/should_work/NONREG/mouse2.lus b/_tests/should_work/NONREG/mouse2.lus similarity index 100% rename from src/test/should_work/NONREG/mouse2.lus rename to _tests/should_work/NONREG/mouse2.lus diff --git a/src/test/should_work/NONREG/mouse3.lus b/_tests/should_work/NONREG/mouse3.lus similarity index 100% rename from src/test/should_work/NONREG/mouse3.lus rename to _tests/should_work/NONREG/mouse3.lus diff --git a/src/test/should_work/NONREG/multiclock.lus b/_tests/should_work/NONREG/multiclock.lus similarity index 100% rename from src/test/should_work/NONREG/multiclock.lus rename to _tests/should_work/NONREG/multiclock.lus diff --git a/src/test/should_work/NONREG/nc1.lus b/_tests/should_work/NONREG/nc1.lus similarity index 100% rename from src/test/should_work/NONREG/nc1.lus rename to _tests/should_work/NONREG/nc1.lus diff --git a/src/test/should_work/NONREG/nc10.lus b/_tests/should_work/NONREG/nc10.lus similarity index 100% rename from src/test/should_work/NONREG/nc10.lus rename to _tests/should_work/NONREG/nc10.lus diff --git a/src/test/should_work/NONREG/nc2.lus b/_tests/should_work/NONREG/nc2.lus similarity index 100% rename from src/test/should_work/NONREG/nc2.lus rename to _tests/should_work/NONREG/nc2.lus diff --git a/src/test/should_work/NONREG/nc3.lus b/_tests/should_work/NONREG/nc3.lus similarity index 100% rename from src/test/should_work/NONREG/nc3.lus rename to _tests/should_work/NONREG/nc3.lus diff --git a/src/test/should_work/NONREG/nc4.lus b/_tests/should_work/NONREG/nc4.lus similarity index 100% rename from src/test/should_work/NONREG/nc4.lus rename to _tests/should_work/NONREG/nc4.lus diff --git a/src/test/should_work/NONREG/nc5.lus b/_tests/should_work/NONREG/nc5.lus similarity index 100% rename from src/test/should_work/NONREG/nc5.lus rename to _tests/should_work/NONREG/nc5.lus diff --git a/src/test/should_work/NONREG/nc6.lus b/_tests/should_work/NONREG/nc6.lus similarity index 100% rename from src/test/should_work/NONREG/nc6.lus rename to _tests/should_work/NONREG/nc6.lus diff --git a/src/test/should_work/NONREG/nc7.lus b/_tests/should_work/NONREG/nc7.lus similarity index 100% rename from src/test/should_work/NONREG/nc7.lus rename to _tests/should_work/NONREG/nc7.lus diff --git a/src/test/should_work/NONREG/nc8.lus b/_tests/should_work/NONREG/nc8.lus similarity index 100% rename from src/test/should_work/NONREG/nc8.lus rename to _tests/should_work/NONREG/nc8.lus diff --git a/src/test/should_work/NONREG/nc9.lus b/_tests/should_work/NONREG/nc9.lus similarity index 100% rename from src/test/should_work/NONREG/nc9.lus rename to _tests/should_work/NONREG/nc9.lus diff --git a/src/test/should_work/NONREG/nested.lus b/_tests/should_work/NONREG/nested.lus similarity index 100% rename from src/test/should_work/NONREG/nested.lus rename to _tests/should_work/NONREG/nested.lus diff --git a/src/test/should_work/NONREG/node_caller1.lus b/_tests/should_work/NONREG/node_caller1.lus similarity index 100% rename from src/test/should_work/NONREG/node_caller1.lus rename to _tests/should_work/NONREG/node_caller1.lus diff --git a/src/test/should_work/NONREG/o2l_feux_compl.lus b/_tests/should_work/NONREG/o2l_feux_compl.lus similarity index 100% rename from src/test/should_work/NONREG/o2l_feux_compl.lus rename to _tests/should_work/NONREG/o2l_feux_compl.lus diff --git a/src/test/should_work/NONREG/packed_cst.lus b/_tests/should_work/NONREG/packed_cst.lus similarity index 100% rename from src/test/should_work/NONREG/packed_cst.lus rename to _tests/should_work/NONREG/packed_cst.lus diff --git a/src/test/should_work/NONREG/param_node.lus b/_tests/should_work/NONREG/param_node.lus similarity index 100% rename from src/test/should_work/NONREG/param_node.lus rename to _tests/should_work/NONREG/param_node.lus diff --git a/src/test/should_work/NONREG/param_node2.lus b/_tests/should_work/NONREG/param_node2.lus similarity index 100% rename from src/test/should_work/NONREG/param_node2.lus rename to _tests/should_work/NONREG/param_node2.lus diff --git a/src/test/should_work/NONREG/param_node3.lus b/_tests/should_work/NONREG/param_node3.lus similarity index 100% rename from src/test/should_work/NONREG/param_node3.lus rename to _tests/should_work/NONREG/param_node3.lus diff --git a/src/test/should_work/NONREG/param_node4.lus b/_tests/should_work/NONREG/param_node4.lus similarity index 100% rename from src/test/should_work/NONREG/param_node4.lus rename to _tests/should_work/NONREG/param_node4.lus diff --git a/src/test/should_work/NONREG/param_struct.lus b/_tests/should_work/NONREG/param_struct.lus similarity index 100% rename from src/test/should_work/NONREG/param_struct.lus rename to _tests/should_work/NONREG/param_struct.lus diff --git a/src/test/should_work/NONREG/patrick.lus b/_tests/should_work/NONREG/patrick.lus similarity index 100% rename from src/test/should_work/NONREG/patrick.lus rename to _tests/should_work/NONREG/patrick.lus diff --git a/src/test/should_work/NONREG/poussoir.lus b/_tests/should_work/NONREG/poussoir.lus similarity index 100% rename from src/test/should_work/NONREG/poussoir.lus rename to _tests/should_work/NONREG/poussoir.lus diff --git a/src/test/should_work/NONREG/rs.lus b/_tests/should_work/NONREG/rs.lus similarity index 100% rename from src/test/should_work/NONREG/rs.lus rename to _tests/should_work/NONREG/rs.lus diff --git a/src/test/should_work/NONREG/s.lus b/_tests/should_work/NONREG/s.lus similarity index 100% rename from src/test/should_work/NONREG/s.lus rename to _tests/should_work/NONREG/s.lus diff --git a/src/test/should_work/NONREG/simple.lus b/_tests/should_work/NONREG/simple.lus similarity index 100% rename from src/test/should_work/NONREG/simple.lus rename to _tests/should_work/NONREG/simple.lus diff --git a/src/test/should_work/NONREG/sincos.lus b/_tests/should_work/NONREG/sincos.lus similarity index 100% rename from src/test/should_work/NONREG/sincos.lus rename to _tests/should_work/NONREG/sincos.lus diff --git a/src/test/should_work/NONREG/speedcontrol.lus b/_tests/should_work/NONREG/speedcontrol.lus similarity index 100% rename from src/test/should_work/NONREG/speedcontrol.lus rename to _tests/should_work/NONREG/speedcontrol.lus diff --git a/src/test/should_work/NONREG/stopwatch.lus b/_tests/should_work/NONREG/stopwatch.lus similarity index 100% rename from src/test/should_work/NONREG/stopwatch.lus rename to _tests/should_work/NONREG/stopwatch.lus diff --git a/src/test/should_work/NONREG/test.exp b/_tests/should_work/NONREG/test.exp similarity index 100% rename from src/test/should_work/NONREG/test.exp rename to _tests/should_work/NONREG/test.exp diff --git a/src/test/should_work/NONREG/test.res b/_tests/should_work/NONREG/test.res similarity index 100% rename from src/test/should_work/NONREG/test.res rename to _tests/should_work/NONREG/test.res diff --git a/src/test/should_work/NONREG/testCA.lus b/_tests/should_work/NONREG/testCA.lus similarity index 100% rename from src/test/should_work/NONREG/testCA.lus rename to _tests/should_work/NONREG/testCA.lus diff --git a/src/test/should_work/NONREG/test_clash.lus b/_tests/should_work/NONREG/test_clash.lus similarity index 100% rename from src/test/should_work/NONREG/test_clash.lus rename to _tests/should_work/NONREG/test_clash.lus diff --git a/src/test/should_work/NONREG/test_const.lus b/_tests/should_work/NONREG/test_const.lus similarity index 100% rename from src/test/should_work/NONREG/test_const.lus rename to _tests/should_work/NONREG/test_const.lus diff --git a/src/test/should_work/NONREG/test_node_expand.lus b/_tests/should_work/NONREG/test_node_expand.lus similarity index 100% rename from src/test/should_work/NONREG/test_node_expand.lus rename to _tests/should_work/NONREG/test_node_expand.lus diff --git a/src/test/should_work/NONREG/test_node_expand2.lus b/_tests/should_work/NONREG/test_node_expand2.lus similarity index 100% rename from src/test/should_work/NONREG/test_node_expand2.lus rename to _tests/should_work/NONREG/test_node_expand2.lus diff --git a/src/test/should_work/NONREG/trivial.lus b/_tests/should_work/NONREG/trivial.lus similarity index 100% rename from src/test/should_work/NONREG/trivial.lus rename to _tests/should_work/NONREG/trivial.lus diff --git a/src/test/should_work/NONREG/trivial2.lus b/_tests/should_work/NONREG/trivial2.lus similarity index 100% rename from src/test/should_work/NONREG/trivial2.lus rename to _tests/should_work/NONREG/trivial2.lus diff --git a/src/test/should_work/NONREG/tuple.lus b/_tests/should_work/NONREG/tuple.lus similarity index 100% rename from src/test/should_work/NONREG/tuple.lus rename to _tests/should_work/NONREG/tuple.lus diff --git a/src/test/should_work/NONREG/type_decl.lus b/_tests/should_work/NONREG/type_decl.lus similarity index 100% rename from src/test/should_work/NONREG/type_decl.lus rename to _tests/should_work/NONREG/type_decl.lus diff --git a/src/test/should_work/NONREG/uu.lus b/_tests/should_work/NONREG/uu.lus similarity index 100% rename from src/test/should_work/NONREG/uu.lus rename to _tests/should_work/NONREG/uu.lus diff --git a/src/test/should_work/NONREG/v1.lus b/_tests/should_work/NONREG/v1.lus similarity index 100% rename from src/test/should_work/NONREG/v1.lus rename to _tests/should_work/NONREG/v1.lus diff --git a/src/test/should_work/Pascal/access.lus b/_tests/should_work/Pascal/access.lus similarity index 100% rename from src/test/should_work/Pascal/access.lus rename to _tests/should_work/Pascal/access.lus diff --git a/src/test/should_work/Pascal/consensus.lus b/_tests/should_work/Pascal/consensus.lus similarity index 100% rename from src/test/should_work/Pascal/consensus.lus rename to _tests/should_work/Pascal/consensus.lus diff --git a/src/test/should_work/Pascal/consensus2.lus b/_tests/should_work/Pascal/consensus2.lus similarity index 100% rename from src/test/should_work/Pascal/consensus2.lus rename to _tests/should_work/Pascal/consensus2.lus diff --git a/src/test/should_work/Pascal/fby.lus b/_tests/should_work/Pascal/fby.lus similarity index 100% rename from src/test/should_work/Pascal/fby.lus rename to _tests/should_work/Pascal/fby.lus diff --git a/src/test/should_work/Pascal/func_with_body.lus b/_tests/should_work/Pascal/func_with_body.lus similarity index 100% rename from src/test/should_work/Pascal/func_with_body.lus rename to _tests/should_work/Pascal/func_with_body.lus diff --git a/src/test/should_work/Pascal/heater_control.lus b/_tests/should_work/Pascal/heater_control.lus similarity index 100% rename from src/test/should_work/Pascal/heater_control.lus rename to _tests/should_work/Pascal/heater_control.lus diff --git a/src/test/should_work/Pascal/left.lus b/_tests/should_work/Pascal/left.lus similarity index 100% rename from src/test/should_work/Pascal/left.lus rename to _tests/should_work/Pascal/left.lus diff --git a/src/test/should_work/Pascal/newpacks.lus b/_tests/should_work/Pascal/newpacks.lus similarity index 100% rename from src/test/should_work/Pascal/newpacks.lus rename to _tests/should_work/Pascal/newpacks.lus diff --git a/src/test/should_work/Pascal/onlyroll.lus b/_tests/should_work/Pascal/onlyroll.lus similarity index 100% rename from src/test/should_work/Pascal/onlyroll.lus rename to _tests/should_work/Pascal/onlyroll.lus diff --git a/src/test/should_work/Pascal/p.lus b/_tests/should_work/Pascal/p.lus similarity index 100% rename from src/test/should_work/Pascal/p.lus rename to _tests/should_work/Pascal/p.lus diff --git a/src/test/should_work/Pascal/packs.lus b/_tests/should_work/Pascal/packs.lus similarity index 100% rename from src/test/should_work/Pascal/packs.lus rename to _tests/should_work/Pascal/packs.lus diff --git a/src/test/should_work/Pascal/pfs.lus b/_tests/should_work/Pascal/pfs.lus similarity index 100% rename from src/test/should_work/Pascal/pfs.lus rename to _tests/should_work/Pascal/pfs.lus diff --git a/src/test/should_work/Pascal/struct.lus b/_tests/should_work/Pascal/struct.lus similarity index 100% rename from src/test/should_work/Pascal/struct.lus rename to _tests/should_work/Pascal/struct.lus diff --git a/src/test/should_work/Pascal/struct0.lus b/_tests/should_work/Pascal/struct0.lus similarity index 100% rename from src/test/should_work/Pascal/struct0.lus rename to _tests/should_work/Pascal/struct0.lus diff --git a/src/test/should_work/Pascal/t.lus b/_tests/should_work/Pascal/t.lus similarity index 100% rename from src/test/should_work/Pascal/t.lus rename to _tests/should_work/Pascal/t.lus diff --git a/src/test/should_work/Pascal/t0.lus b/_tests/should_work/Pascal/t0.lus similarity index 100% rename from src/test/should_work/Pascal/t0.lus rename to _tests/should_work/Pascal/t0.lus diff --git a/src/test/should_work/Pascal/t1.lus b/_tests/should_work/Pascal/t1.lus similarity index 100% rename from src/test/should_work/Pascal/t1.lus rename to _tests/should_work/Pascal/t1.lus diff --git a/src/test/should_work/Pascal/t2.lus b/_tests/should_work/Pascal/t2.lus similarity index 100% rename from src/test/should_work/Pascal/t2.lus rename to _tests/should_work/Pascal/t2.lus diff --git a/test-old/tests/test.lus b/_tests/should_work/Pascal/test.lus similarity index 100% rename from test-old/tests/test.lus rename to _tests/should_work/Pascal/test.lus diff --git a/test-old/tests/trivial.lus b/_tests/should_work/Pascal/trivial.lus similarity index 100% rename from test-old/tests/trivial.lus rename to _tests/should_work/Pascal/trivial.lus diff --git a/src/test/should_work/clock/clock.lus b/_tests/should_work/clock/clock.lus similarity index 100% rename from src/test/should_work/clock/clock.lus rename to _tests/should_work/clock/clock.lus diff --git a/src/test/should_work/clock/clock2.lus b/_tests/should_work/clock/clock2.lus similarity index 100% rename from src/test/should_work/clock/clock2.lus rename to _tests/should_work/clock/clock2.lus diff --git a/src/test/should_work/clock/clock_ite.lus b/_tests/should_work/clock/clock_ite.lus similarity index 100% rename from src/test/should_work/clock/clock_ite.lus rename to _tests/should_work/clock/clock_ite.lus diff --git a/src/test/should_work/clock/when_enum.lus b/_tests/should_work/clock/when_enum.lus similarity index 100% rename from src/test/should_work/clock/when_enum.lus rename to _tests/should_work/clock/when_enum.lus diff --git a/src/test/should_work/clock/when_node.lus b/_tests/should_work/clock/when_node.lus similarity index 100% rename from src/test/should_work/clock/when_node.lus rename to _tests/should_work/clock/when_node.lus diff --git a/src/test/should_work/clock/when_not.lus b/_tests/should_work/clock/when_not.lus similarity index 100% rename from src/test/should_work/clock/when_not.lus rename to _tests/should_work/clock/when_not.lus diff --git a/src/test/should_work/clock/when_tuple.lus b/_tests/should_work/clock/when_tuple.lus similarity index 100% rename from src/test/should_work/clock/when_tuple.lus rename to _tests/should_work/clock/when_tuple.lus diff --git a/src/test/should_work/demo/Gyroscope2.lus b/_tests/should_work/demo/Gyroscope2.lus similarity index 100% rename from src/test/should_work/demo/Gyroscope2.lus rename to _tests/should_work/demo/Gyroscope2.lus diff --git a/src/test/should_work/demo/alias.lus b/_tests/should_work/demo/alias.lus similarity index 100% rename from src/test/should_work/demo/alias.lus rename to _tests/should_work/demo/alias.lus diff --git a/src/test/should_work/demo/bred.lus b/_tests/should_work/demo/bred.lus similarity index 100% rename from src/test/should_work/demo/bred.lus rename to _tests/should_work/demo/bred.lus diff --git a/src/test/should_work/demo/bred_lv4.lus b/_tests/should_work/demo/bred_lv4.lus similarity index 100% rename from src/test/should_work/demo/bred_lv4.lus rename to _tests/should_work/demo/bred_lv4.lus diff --git a/src/test/should_work/demo/clock.lus b/_tests/should_work/demo/clock.lus similarity index 100% rename from src/test/should_work/demo/clock.lus rename to _tests/should_work/demo/clock.lus diff --git a/src/test/should_work/demo/clock1_2ms.lus b/_tests/should_work/demo/clock1_2ms.lus similarity index 100% rename from src/test/should_work/demo/clock1_2ms.lus rename to _tests/should_work/demo/clock1_2ms.lus diff --git a/src/test/should_work/demo/decl.lus b/_tests/should_work/demo/decl.lus similarity index 100% rename from src/test/should_work/demo/decl.lus rename to _tests/should_work/demo/decl.lus diff --git a/src/test/should_work/demo/declaration.lus b/_tests/should_work/demo/declaration.lus similarity index 100% rename from src/test/should_work/demo/declaration.lus rename to _tests/should_work/demo/declaration.lus diff --git a/src/test/should_work/demo/def.lus b/_tests/should_work/demo/def.lus similarity index 100% rename from src/test/should_work/demo/def.lus rename to _tests/should_work/demo/def.lus diff --git a/src/test/should_work/demo/filliter.lus b/_tests/should_work/demo/filliter.lus similarity index 100% rename from src/test/should_work/demo/filliter.lus rename to _tests/should_work/demo/filliter.lus diff --git a/src/test/should_work/demo/filter.lus b/_tests/should_work/demo/filter.lus similarity index 100% rename from src/test/should_work/demo/filter.lus rename to _tests/should_work/demo/filter.lus diff --git a/src/test/should_work/demo/lustre_test1_ok.lus b/_tests/should_work/demo/lustre_test1_ok.lus similarity index 100% rename from src/test/should_work/demo/lustre_test1_ok.lus rename to _tests/should_work/demo/lustre_test1_ok.lus diff --git a/src/test/should_work/demo/map_red_iter.lus b/_tests/should_work/demo/map_red_iter.lus similarity index 100% rename from src/test/should_work/demo/map_red_iter.lus rename to _tests/should_work/demo/map_red_iter.lus diff --git a/src/test/should_work/demo/mapdeRed.lus b/_tests/should_work/demo/mapdeRed.lus similarity index 100% rename from src/test/should_work/demo/mapdeRed.lus rename to _tests/should_work/demo/mapdeRed.lus diff --git a/src/test/should_work/demo/mapinf.lus b/_tests/should_work/demo/mapinf.lus similarity index 100% rename from src/test/should_work/demo/mapinf.lus rename to _tests/should_work/demo/mapinf.lus diff --git a/src/test/should_work/demo/mapiter.lus b/_tests/should_work/demo/mapiter.lus similarity index 100% rename from src/test/should_work/demo/mapiter.lus rename to _tests/should_work/demo/mapiter.lus diff --git a/src/test/should_work/demo/mappredef.lus b/_tests/should_work/demo/mappredef.lus similarity index 100% rename from src/test/should_work/demo/mappredef.lus rename to _tests/should_work/demo/mappredef.lus diff --git a/src/test/should_work/demo/plus.lus b/_tests/should_work/demo/plus.lus similarity index 100% rename from src/test/should_work/demo/plus.lus rename to _tests/should_work/demo/plus.lus diff --git a/src/test/should_work/demo/pre_x.lus b/_tests/should_work/demo/pre_x.lus similarity index 100% rename from src/test/should_work/demo/pre_x.lus rename to _tests/should_work/demo/pre_x.lus diff --git a/src/test/should_work/demo/rediter.lus b/_tests/should_work/demo/rediter.lus similarity index 100% rename from src/test/should_work/demo/rediter.lus rename to _tests/should_work/demo/rediter.lus diff --git a/src/test/should_work/demo/redoptest.lus b/_tests/should_work/demo/redoptest.lus similarity index 100% rename from src/test/should_work/demo/redoptest.lus rename to _tests/should_work/demo/redoptest.lus diff --git a/src/test/should_work/demo/sample_time_change.lus b/_tests/should_work/demo/sample_time_change.lus similarity index 100% rename from src/test/should_work/demo/sample_time_change.lus rename to _tests/should_work/demo/sample_time_change.lus diff --git a/src/test/should_work/demo/test.exp b/_tests/should_work/demo/test.exp similarity index 100% rename from src/test/should_work/demo/test.exp rename to _tests/should_work/demo/test.exp diff --git a/src/test/should_work/fab_test/bob.lus b/_tests/should_work/fab_test/bob.lus similarity index 100% rename from src/test/should_work/fab_test/bob.lus rename to _tests/should_work/fab_test/bob.lus diff --git a/src/test/should_work/fab_test/def.lus b/_tests/should_work/fab_test/def.lus similarity index 100% rename from src/test/should_work/fab_test/def.lus rename to _tests/should_work/fab_test/def.lus diff --git a/src/test/should_work/fab_test/ex.lus b/_tests/should_work/fab_test/ex.lus similarity index 100% rename from src/test/should_work/fab_test/ex.lus rename to _tests/should_work/fab_test/ex.lus diff --git a/src/test/should_work/fab_test/iter.lus b/_tests/should_work/fab_test/iter.lus similarity index 100% rename from src/test/should_work/fab_test/iter.lus rename to _tests/should_work/fab_test/iter.lus diff --git a/src/test/should_work/fab_test/iterate.lus b/_tests/should_work/fab_test/iterate.lus similarity index 100% rename from src/test/should_work/fab_test/iterate.lus rename to _tests/should_work/fab_test/iterate.lus diff --git a/src/test/should_work/fab_test/iterate.trace b/_tests/should_work/fab_test/iterate.trace similarity index 100% rename from src/test/should_work/fab_test/iterate.trace rename to _tests/should_work/fab_test/iterate.trace diff --git a/src/test/should_work/fab_test/iterate_var.trace b/_tests/should_work/fab_test/iterate_var.trace similarity index 100% rename from src/test/should_work/fab_test/iterate_var.trace rename to _tests/should_work/fab_test/iterate_var.trace diff --git a/src/test/should_work/fab_test/lecteur.lus b/_tests/should_work/fab_test/lecteur.lus similarity index 100% rename from src/test/should_work/fab_test/lecteur.lus rename to _tests/should_work/fab_test/lecteur.lus diff --git a/src/test/should_work/fab_test/lucky.lus b/_tests/should_work/fab_test/lucky.lus similarity index 100% rename from src/test/should_work/fab_test/lucky.lus rename to _tests/should_work/fab_test/lucky.lus diff --git a/src/test/should_work/fab_test/morel.lus b/_tests/should_work/fab_test/morel.lus similarity index 100% rename from src/test/should_work/fab_test/morel.lus rename to _tests/should_work/fab_test/morel.lus diff --git a/src/test/should_work/fab_test/morel2.lus b/_tests/should_work/fab_test/morel2.lus similarity index 100% rename from src/test/should_work/fab_test/morel2.lus rename to _tests/should_work/fab_test/morel2.lus diff --git a/src/test/should_work/fab_test/morel3.lus b/_tests/should_work/fab_test/morel3.lus similarity index 100% rename from src/test/should_work/fab_test/morel3.lus rename to _tests/should_work/fab_test/morel3.lus diff --git a/src/test/should_work/fab_test/morel4.lus b/_tests/should_work/fab_test/morel4.lus similarity index 100% rename from src/test/should_work/fab_test/morel4.lus rename to _tests/should_work/fab_test/morel4.lus diff --git a/src/test/should_work/fab_test/morel5.lus b/_tests/should_work/fab_test/morel5.lus similarity index 100% rename from src/test/should_work/fab_test/morel5.lus rename to _tests/should_work/fab_test/morel5.lus diff --git a/src/test/should_work/fab_test/noAlarm.lus b/_tests/should_work/fab_test/noAlarm.lus similarity index 100% rename from src/test/should_work/fab_test/noAlarm.lus rename to _tests/should_work/fab_test/noAlarm.lus diff --git a/src/test/should_work/fab_test/notTwo.lus b/_tests/should_work/fab_test/notTwo.lus similarity index 100% rename from src/test/should_work/fab_test/notTwo.lus rename to _tests/should_work/fab_test/notTwo.lus diff --git a/src/test/should_work/fab_test/onlyroll.lus b/_tests/should_work/fab_test/onlyroll.lus similarity index 100% rename from src/test/should_work/fab_test/onlyroll.lus rename to _tests/should_work/fab_test/onlyroll.lus diff --git a/src/test/should_work/fab_test/onlyroll2.lus b/_tests/should_work/fab_test/onlyroll2.lus similarity index 100% rename from src/test/should_work/fab_test/onlyroll2.lus rename to _tests/should_work/fab_test/onlyroll2.lus diff --git a/src/test/should_work/fab_test/test.exp b/_tests/should_work/fab_test/test.exp similarity index 100% rename from src/test/should_work/fab_test/test.exp rename to _tests/should_work/fab_test/test.exp diff --git a/src/test/should_work/fab_test/test.lus b/_tests/should_work/fab_test/test.lus similarity index 100% rename from src/test/should_work/fab_test/test.lus rename to _tests/should_work/fab_test/test.lus diff --git a/src/test/should_work/fab_test/test.res b/_tests/should_work/fab_test/test.res similarity index 100% rename from src/test/should_work/fab_test/test.res rename to _tests/should_work/fab_test/test.res diff --git a/src/test/should_work/fab_test/titi.lus b/_tests/should_work/fab_test/titi.lus similarity index 100% rename from src/test/should_work/fab_test/titi.lus rename to _tests/should_work/fab_test/titi.lus diff --git a/src/test/should_work/fab_test/toolate.lus b/_tests/should_work/fab_test/toolate.lus similarity index 100% rename from src/test/should_work/fab_test/toolate.lus rename to _tests/should_work/fab_test/toolate.lus diff --git a/src/test/should_work/fab_test/toto.lus b/_tests/should_work/fab_test/toto.lus similarity index 100% rename from src/test/should_work/fab_test/toto.lus rename to _tests/should_work/fab_test/toto.lus diff --git a/src/test/should_work/lionel/FillFollowedByRed.lus b/_tests/should_work/lionel/FillFollowedByRed.lus similarity index 100% rename from src/test/should_work/lionel/FillFollowedByRed.lus rename to _tests/should_work/lionel/FillFollowedByRed.lus diff --git a/src/test/should_work/lionel/Gyroscope.lus b/_tests/should_work/lionel/Gyroscope.lus similarity index 100% rename from src/test/should_work/lionel/Gyroscope.lus rename to _tests/should_work/lionel/Gyroscope.lus diff --git a/src/test/should_work/lionel/ProduitBool/produitBool.lus b/_tests/should_work/lionel/ProduitBool/produitBool.lus similarity index 100% rename from src/test/should_work/lionel/ProduitBool/produitBool.lus rename to _tests/should_work/lionel/ProduitBool/produitBool.lus diff --git a/src/test/should_work/lionel/ProduitBool/shiftFill_ludic.lus b/_tests/should_work/lionel/ProduitBool/shiftFill_ludic.lus similarity index 100% rename from src/test/should_work/lionel/ProduitBool/shiftFill_ludic.lus rename to _tests/should_work/lionel/ProduitBool/shiftFill_ludic.lus diff --git a/src/test/should_work/lionel/ProduitBool/shift_ludic.lus b/_tests/should_work/lionel/ProduitBool/shift_ludic.lus similarity index 100% rename from src/test/should_work/lionel/ProduitBool/shift_ludic.lus rename to _tests/should_work/lionel/ProduitBool/shift_ludic.lus diff --git a/src/test/should_work/lionel/arrays.lus b/_tests/should_work/lionel/arrays.lus similarity index 100% rename from src/test/should_work/lionel/arrays.lus rename to _tests/should_work/lionel/arrays.lus diff --git a/src/test/should_work/lionel/bug.lus b/_tests/should_work/lionel/bug.lus similarity index 100% rename from src/test/should_work/lionel/bug.lus rename to _tests/should_work/lionel/bug.lus diff --git a/src/test/should_work/lionel/calculs_max.lus b/_tests/should_work/lionel/calculs_max.lus similarity index 100% rename from src/test/should_work/lionel/calculs_max.lus rename to _tests/should_work/lionel/calculs_max.lus diff --git a/src/test/should_work/lionel/clock.lus b/_tests/should_work/lionel/clock.lus similarity index 100% rename from src/test/should_work/lionel/clock.lus rename to _tests/should_work/lionel/clock.lus diff --git a/src/test/should_work/lionel/deSimone.lus b/_tests/should_work/lionel/deSimone.lus similarity index 100% rename from src/test/should_work/lionel/deSimone.lus rename to _tests/should_work/lionel/deSimone.lus diff --git a/src/test/should_work/lionel/iterFibo.lus b/_tests/should_work/lionel/iterFibo.lus similarity index 100% rename from src/test/should_work/lionel/iterFibo.lus rename to _tests/should_work/lionel/iterFibo.lus diff --git a/src/test/should_work/lionel/mapiter.lus b/_tests/should_work/lionel/mapiter.lus similarity index 100% rename from src/test/should_work/lionel/mapiter.lus rename to _tests/should_work/lionel/mapiter.lus diff --git a/src/test/should_work/lionel/matrice.lus b/_tests/should_work/lionel/matrice.lus similarity index 100% rename from src/test/should_work/lionel/matrice.lus rename to _tests/should_work/lionel/matrice.lus diff --git a/src/test/should_work/lionel/matrice2.lus b/_tests/should_work/lionel/matrice2.lus similarity index 100% rename from src/test/should_work/lionel/matrice2.lus rename to _tests/should_work/lionel/matrice2.lus diff --git a/src/test/should_work/lionel/minus.lus b/_tests/should_work/lionel/minus.lus similarity index 100% rename from src/test/should_work/lionel/minus.lus rename to _tests/should_work/lionel/minus.lus diff --git a/src/test/should_work/lionel/moyenne.lus b/_tests/should_work/lionel/moyenne.lus similarity index 100% rename from src/test/should_work/lionel/moyenne.lus rename to _tests/should_work/lionel/moyenne.lus diff --git a/src/test/should_work/lionel/normal.lus b/_tests/should_work/lionel/normal.lus similarity index 100% rename from src/test/should_work/lionel/normal.lus rename to _tests/should_work/lionel/normal.lus diff --git a/src/test/should_work/lionel/pack1.lus b/_tests/should_work/lionel/pack1.lus similarity index 100% rename from src/test/should_work/lionel/pack1.lus rename to _tests/should_work/lionel/pack1.lus diff --git a/_tests/should_work/lionel/pilote-1.0.lus b/_tests/should_work/lionel/pilote-1.0.lus new file mode 100644 index 0000000000000000000000000000000000000000..1a81d5caf3ddfa0a86dc9629495479e245978686 --- /dev/null +++ b/_tests/should_work/lionel/pilote-1.0.lus @@ -0,0 +1,819 @@ +-- 22 jan 2009 +package util + +provides + +node observer(dataBoiteCP_IN, + localDataFromRead, + localErasedDataFromBoiteCP, + localCopyedDataFromBoiteCP, + localErasedDataFromPilote, + localCopyedDataFromPilote, + localErasedDataFromMem, + localCopyedDataFromMem : int; + productionEvent, + consumptionEvent, + eraseMemEvent, + eraseBoiteCPEvent, + erasePiloteEvent, + copyBoiteCPEvent, + copyPiloteEvent, + copyMemEvent : bool) +returns (retard, indiceCount : int; HindiceCount : bool); + + +body + +type accChangeTab = {numEvent : int; cpt : int; indice : int}; + +node change_tab2(tabIn : int^10; + indiceIn : int; + num_event : int) +returns (tabOut : int^10); +var accOut : accChangeTab; +let + accOut, tabOut = + fillred<<change_elt2, 10>>(accChangeTab{numEvent = num_event; cpt = 0; indice = indiceIn}, tabIn); +tel + + + +node change_elt2(accIn : accChangeTab; + --num_event : int; + --cptOut : int; + --indiceIn : int; + eltIn : int) +returns (accOut : accChangeTab; + --num_event : int; + --cptOut : int; + --indiceIn : int; + eltOut : int); +let + eltOut = if(accIn.indice = accIn.cpt) + then if accIn.numEvent=0 + then 1 + else if accIn.numEvent=1 or accIn.numEvent=3 or accIn.numEvent=7 + then eltIn-1 + else if accIn.numEvent=2 or accIn.numEvent=4 or accIn.numEvent=6 + then eltIn+1 + else eltIn + else eltIn; + + accOut = accChangeTab{numEvent = accIn.numEvent; + indice = accIn.indice; + cpt = accIn.cpt+1}; + +tel + + + + +type accObserver = {nbCopy : int^10; + indice : int}; + + +node observer(dataBoiteCP_IN, + localDataFromRead, + localErasedDataFromBoiteCP, + localCopyedDataFromBoiteCP, + localErasedDataFromPilote, + localCopyedDataFromPilote, + localErasedDataFromMem, + localCopyedDataFromMem : int; + productionEvent, + consumptionEvent, + eraseMemEvent, + eraseBoiteCPEvent, + erasePiloteEvent, + copyBoiteCPEvent, + copyPiloteEvent, + copyMemEvent : bool) +returns (retard, indiceCount : int; HindiceCount : bool); +var +-- accIterOut : accObserver;-- +-- nbrCopy : int^10; -- pour stocker le nombre de copies, nbrCopy[i] : nb de copies dans le syst?me d'un donn?e identifi?e par "i" + CptRetard : int^10; -- les horloges qui mesurent le retard correspondant ? chaque don?e (?) + + + numEvent_tab : bool^8;-- + value_tab : int^8;-- + nbrCopy : int^10; +-- indiceBidon : int; +let + numEvent_tab = [productionEvent, + consumptionEvent, + eraseMemEvent, + copyMemEvent, + eraseBoiteCPEvent, + copyBoiteCPEvent, + erasePiloteEvent, + copyPiloteEvent + ]; + value_tab = [dataBoiteCP_IN, + localDataFromRead, + localErasedDataFromMem, + localCopyedDataFromMem, + localErasedDataFromBoiteCP, + localCopyedDataFromBoiteCP, + localErasedDataFromPilote, + localCopyedDataFromPilote + ]; + + nbrCopy = updateNbrCopy(numEvent_tab, value_tab); + + CptRetard = updateCptRetard(nbrCopy); + + retard = calculRetard(consumptionEvent, CptRetard, localDataFromRead); + + indiceCount, HindiceCount = updateIndice(nbrCopy); + +-- nbrCopy = for(i=0;i<8;i++){ +-- if num_event_tab[i]=true +-- then nbrCopy = change_tab2(pre(nbrCopy), value_tab[i], i) +-- else nbrCopy = pre(nbrCopy) +-- } +tel + + + +type tIterRetard = {conEvent : bool; + dataFromRead : int; + retardCalcule : int; + cpt : int}; + + + + +node calculRetard(consumptionEvent : bool; + CptRetard : int^10; + localDataFromRead : int) +returns (retard : int); +var accOut : tIterRetard; +let + accOut = red<<updateRetard;10>>(tIterRetard{conEvent = consumptionEvent; + dataFromRead = localDataFromRead; + retardCalcule = -1; + cpt = 0}, + CptRetard); + retard = accOut.retardCalcule; +tel + + +node updateRetard(accIn : tIterRetard; elt : int) returns (accOut : tIterRetard); +let + accOut = tIterRetard{conEvent = accIn.conEvent; + dataFromRead = accIn.dataFromRead; + retardCalcule = -1 -> if accIn.conEvent and accIn.cpt=accIn.dataFromRead + then elt + else -1; + cpt = accIn.cpt+1}; +tel + + + + + + +node updateNbrCopy(numEvent_tab : bool^8; + value_tab : int^8) +returns (nbrCopy : int^10); +var accIterOut : accObserver; +let + accIterOut = accObserver{nbCopy = (-1)^10; + indice = 0} + -> red<<Niter;8>>(accObserver{ + nbCopy = pre(accIterOut.nbCopy); + indice = 0 + }, + numEvent_tab, value_tab); + nbrCopy = accIterOut.nbCopy; +tel + + +node Niter(accIn : accObserver; + --{tabIn : int^10; + -- indice : int; + --}; + numEvent : bool; + value_tab : int) +returns (accOut : accObserver); + --{tabOut : int^10; + -- indiceOut : int; + --}) +let + accOut = accObserver{nbCopy = if numEvent + then change_tab2(accIn.nbCopy, value_tab, accIn.indice) + else accIn.nbCopy; + indice = accIn.indice+1}; +tel + + + +-- indCount = -1 -> if consumptionEvent and (nbrCopy[localDataFromRead]=0) +-- then localDataFromRead +-- else -1; + +-- HrinsCount = false -> consumptionEvent and (nbrCopy[localDataFromRead]=0) + + +type tCounterIter = {indice : int; Hindice : bool; cpt : int}; + + + + + +node updateIndice(nbrCopy : int^10) +returns (indiceCount : int; + HindiceCount : bool); +var iterOut : tCounterIter; +let + iterOut = red<<countIter;10>>(tCounterIter{indice = -1 ; Hindice = false; cpt = 0}, nbrCopy); + indiceCount = iterOut.indice; + HindiceCount = iterOut.Hindice; +tel + +node countIter(accIn : tCounterIter; eltCopy : int) +returns (accOut : tCounterIter); +let + accOut = if pre(eltCopy<>-1) and pre(eltCopy<>0) and eltCopy=0 + then tCounterIter{indice = accIn.cpt; + Hindice = true; + cpt = accIn.cpt+1} + else tCounterIter{indice = accIn.indice; + Hindice = accIn.Hindice; + cpt = accIn.cpt+1}; +tel + + + + +----------- +node updateCptRetard(nbrCopy : int^10) +returns (CptRetard : int^10); +let + CptRetard = (-1)^10 -> map<<checkCopy;10>>(nbrCopy, pre(CptRetard)); +tel + + + + +node checkCopy(eltCopy : int; oldCptRetard : int) returns (newCptRetard : int); +let + newCptRetard = if(pre(eltCopy=-1) and eltCopy=1) + then 0 + else if pre(eltCopy<>-1) and pre(eltCopy<>0) and eltCopy=0 + then -1 + else oldCptRetard+1; +tel + + +end +package pilote +uses util; + +provides +node system(in : bool) returns (v : bool; + dataBoiteCP_IN, dataBoiteCP_OUT : int; + piloteData, readData : int; + getMem : bool; + localDataFromRead : int; + Hcapt, Hpilote, Happli : bool; + dataBoiteCP_PUT, dataBoiteCP_GET : bool; -- commandes de la boite aux lettres + semMemTakeP, semMemTakeR, semMemGive : bool; -- commandes du s?maphore + semMemAutP,semMemAutR : bool; + putMem : bool; + res : bool; + retard : int); + + +body + +node system (in : bool) +returns (v : bool; + dataBoiteCP_IN, dataBoiteCP_OUT : int; + piloteData, readData : int; + getMem : bool; + localDataFromRead : int; + Hcapt, Hpilote, Happli : bool; + dataBoiteCP_PUT, dataBoiteCP_GET : bool; -- commandes de la boite aux lettres + semMemTakeP, semMemTakeR, semMemGive : bool; -- commandes du s?maphore + semMemAutP,semMemAutR : bool; + putMem : bool; + res : bool; + retard : int); +--var --Hcapt, Hpilote, Happli : bool; -- les horloges + --dataBoiteCP_IN, + -- dataBoiteCP_OUT : int; -- donn?es en entr?es/sorties de la boite aux lettres +-- dataBoiteCP_PUT, dataBoiteCP_GET : bool; -- commandes de la boite aux lettres +-- semMemTakeP, semMemTakeR, semMemGive : bool; -- commandes du s?maphore +-- semMemAutP,semMemAutR : bool; -- autorisations en sortie du s?maphore + --piloteData, readData : int; + -- getMem, +-- putMem : bool; +var free, demandeR : bool; + HrinstCount : bool; indCount : int; + localErasedDataFromBoiteCP, + localCopiedDataFromBoiteCP, + localErasedDataFromPilote, + localCopiedDataFromPilote, + localErasedDataFromMem, + localCopiedDataFromMem : int; + productionEvent, + consumptionEvent, + eraseMemEvent, + eraseBoiteCPEvent, + erasePiloteEvent, + copyBoiteCPEvent, + copyPiloteEvent, + copyMemEvent : bool; +let + + (Hcapt, Hpilote, Happli) = ctrl(in); + + (dataBoiteCP_PUT, dataBoiteCP_IN, productionEvent) = capt(Hcapt, HrinstCount, indCount); + + (dataBoiteCP_OUT, localErasedDataFromBoiteCP, localCopiedDataFromBoiteCP, + copyBoiteCPEvent, eraseBoiteCPEvent) = boiteCP(dataBoiteCP_IN, dataBoiteCP_GET, dataBoiteCP_PUT); + + (semMemTakeP, putMem, dataBoiteCP_GET, piloteData, localErasedDataFromPilote, + erasePiloteEvent, copyPiloteEvent, localCopiedDataFromPilote) + = pilote(Hpilote, semMemAutP, dataBoiteCP_OUT); + + (semMemGive, readData, localErasedDataFromMem, localCopiedDataFromMem, + eraseMemEvent, copyMemEvent) = mem(getMem, putMem, piloteData); + (semMemAutP, semMemAutR, free, demandeR) = semMem(semMemTakeP, semMemTakeR, semMemGive); + + (getMem, semMemTakeR, localDataFromRead, consumptionEvent) = read(Happli, semMemAutR, readData); + + + retard, indCount, HrinstCount = observer(dataBoiteCP_IN, + localDataFromRead, + localErasedDataFromBoiteCP, + localCopiedDataFromBoiteCP, + localErasedDataFromPilote, + localCopiedDataFromPilote, + localErasedDataFromMem, + localCopiedDataFromMem, + productionEvent, + consumptionEvent, + eraseMemEvent, + eraseBoiteCPEvent, + erasePiloteEvent, + copyBoiteCPEvent, + copyPiloteEvent, + copyMemEvent); +-- une valeur bidon; + v = not(dataBoiteCP_IN=-1) and not(localDataFromRead=-1); + res = false -> v or pre(res); +tel + + + + +-- node observer(dataBoiteCP_IN, +-- localDataFromRead, +-- localErasedDataFromBoiteCP, +-- localCopyedDataFromBoiteCP, +-- localErasedDataFromPilote, +-- localCopyedDataFromPilote, +-- localErasedDataFromMem, +-- localCopyedDataFromMem : int; +-- productionEvent, +-- consumptionEvent, +-- eraseMemEvent, +-- eraseBoiteCPEvent, +-- erasePiloteEvent, +-- copyBoiteCPEvent, +-- copyPiloteEvent, +-- copyMemEvent : bool) +-- returns (retard, indCount : int, HrinsCount : bool); +-- var +-- nbrCopy : int^10; -- pour stocker le nombre de copies, nbrCopy[i] : nb de copies dans le syst?me d'un donn?e identifi?e par "i" +-- CptRetard : int^10; -- les horloges qui mesurent le retard correspondant ? chaque don?e (?) +-- let + + -- nbre de copie d'occurence dans le syst?me + --nbrCopy[dataBoiteCP_IN] = 0 -> if productionEvent + -- then 1 + -- else pre(nbrCopy[dataBoiteCP_IN]); + + +-- nbrCopy[localErasedDataFromBoiteCP] = if eraseBoiteCPEvent +-- then (pre(nbrCopy[localErasedDataFromBoiteCP])-1) +-- else pre(nbrCopy[localErasedDataFromBoiteCP]); + +-- nbrCopy[localCopyedDataFromBoiteCP] = if copyBoiteCPEvent +-- then (pre(nbrCopy[localCopyedDataFromBoiteCP])+1) +-- else pre(nbrCopy[localCopyedDataFromBoiteCP]); + +-- nbrCopy[localErasedDataFromMem] = if eraseMemEvent +-- then (pre(nbrCopy[localErasedDataFromMem])-1) +-- else pre(nbrCopy[localErasedDataFromMem]); + +-- nbrCopy[localCopyedDataFromMem] = if copyMemEvent +-- then (pre(nbrCopy[localCopyedDataFromMem])+1) +-- else pre(nbrCopy[localCopyedDataFromMem]); + +-- nbrCopy[localErasedDataFromPilote] = if erasePilotemEvent +-- then (pre(nbrCopy[localErasedDataFromPilote])-1) +-- else pre(nbrCopy[localErasedDataFromPilote]); + +-- nbrCopy[localCopyedDataFromPilote] = if copyPiloteEvent +-- then (pre(nbrCopy[localCopyedDataFromPilote])+1) +-- else pre(nbrCopy[localCopyedDataFromPilote]); + +-- nbrCopy[localDataFromRead] = 0 -> if consumptionEvent +-- then (pre(nbrCopy[localDataFromRead])-1) +-- else pre(nbrCopy[localDataFromRead]); + + + + +-- -- Horloges de cacul de retard +-- CptRetard[dataBoiteCP_IN] = -1 -> if productionEvent and (pre(CptRetard[dataBoiteCP_IN])=-1) and (nbrCopy[dataBoiteCP_IN]=1) +-- then 0 +-- else if (nbrCopy[dataBoiteCP_IN]=0) +-- then -1 +-- else (pre(CptRetard[dataBoiteCP_IN])+1); + + +-- -- cacul de retard a la reception d'une donn?e +-- retard = -1 -> if consumptionEvent +-- then CptRetard[localDataFromRead] +-- else -1; + +-- gerer la reutilisation des ompteur d'occurence +-- indCount = -1 -> if consumptionEvent and (nbrCopy[localDataFromRead]=0) +-- then localDataFromRead +-- else -1; + +-- HrinsCount = false -> consumptionEvent and (nbrCopy[localDataFromRead]=0) + +--tel + + + + + + + +node capt(Hcapt, + HrinstCount : bool; + indCount : int) +returns (dataPUT : bool; + stampedData : int; + productionEvent : bool);--stampedData : int when Hcapt); +var localCnt : int; + indCountTab : bool^10; + +let +--recherche d'un indice libre +--for (localCnt=0;indCountTab[localCnt]=true,localCnt); +-- localCnt = 0 -> if Hcapt +-- then pre(localCnt) + 1 +-- else pre(localCnt); + dataPUT = Hcapt; + stampedData = if Hcapt + then localCnt + else -1; +-- production observed + +-- il faut utiliser productionEvent = Hcapt +-- il faut utiliser dataCP_IN + productionEvent = Hcapt; + +-- gestion de num d'occurence +-- indCountTab[indCount] = false -> if HrinstCount +-- then false +-- else pre(indCountTab[indCount]); + +-- indCountTab[localCnt] = false -> if Hcapt +-- then true +-- else pre(indCountTab[localCnt]); + + localCnt, indCountTab = updateCnt(indCount, HrinstCount, Hcapt); + +tel + + + +type tUpdateCntElt = {indCnt : int; + HrinstCnt : bool; + Hcap : bool; + locCnt : int; + i : int; + locCntFound : bool}; + + + +node udpateCntElt(accIn : tUpdateCntElt; eltIn : bool) +returns (accOut : tUpdateCntElt; + eltOut : bool); +let + eltOut = if (accIn.i = accIn.indCnt) and accIn.HrinstCnt + then true else eltIn; + + accOut = tUpdateCntElt{indCnt = accIn.indCnt; + HrinstCnt = accIn.HrinstCnt; + Hcap = accIn.Hcap; + locCnt = if eltIn and accIn.Hcap and not(accIn.locCntFound) + then accIn.i + else accIn.locCnt; + i = accIn.i + 1; + locCntFound = (eltIn and accIn.Hcap) or accIn.locCntFound; + -- ? initialiser ? false !!!! + }; +tel + +node updateCnt(indCount : int; HrinstCount, Hcapt : bool) +returns (localCnt : int; + tab : bool^10); +var accOut : tUpdateCntElt; +let + accOut, tab = fillred<<udpateCntElt, 10>>(tUpdateCntElt{ + indCnt = indCount; + HrinstCnt = HrinstCount; + Hcap = Hcapt; + locCnt = -1; + i = 0; + locCntFound = false; + }, + false^10); + localCnt = accOut.locCnt; +tel + + + + + + + + + + + + +-- boite aux lettres +node boiteCP(dataIN : int; dataGET, dataPUT : bool) +returns (dataOUT : int; + localDataErasedFromBoiteCP : int; + localDataCopydFromBoiteCP : int; + copyBoiteCPEvent, erasedBoiteCPEvent : bool); +var localData : int; + pLocalData : int; +let + + localData = -1 -> if dataPUT + then dataIN + else if dataGET + then -1 + else pre localData; + -- observation dans Boite CP + -- ecrasement + localDataErasedFromBoiteCP = -1 -> if dataPUT + then pLocalData + else -1; + erasedBoiteCPEvent = dataPUT; + + localDataCopydFromBoiteCP = -1 -> if dataPUT + then localData + else -1; + copyBoiteCPEvent = dataPUT; + + + -- localData = dataIN when dataPUT; + + pLocalData = localData -> pre(localData); + + dataOUT = if dataGET + then pLocalData + else -1; +tel + + +node pilote(Hpilote, semAutP : bool; + dataBoiteCP : int) +returns (semMemTakeP, putMemP, dataGET : bool; + piloteData : int; + localDataErasedFromPilote : int; + erasedPiloteEvent, copyPiloteEvent : bool; + localDataCopiedFromPilote : int; + ); +var localData : int; +let + dataGET = Hpilote; + localData = if Hpilote + then dataBoiteCP + else -1; + semMemTakeP = Hpilote; + piloteData = if (semAutP and Hpilote) + then localData --current(localData) + else -1; + putMemP = if (semAutP and Hpilote) + then true + else false; + -- observation dans pilote + -- ecrasement + localDataErasedFromPilote = -1 -> if Hpilote + then pre localData + else -1; + erasedPiloteEvent = Hpilote; + + localDataCopiedFromPilote = -1 -> if Hpilote + then localData + else -1; + copyPiloteEvent = Hpilote; +tel + + + + + +-- semaphore Memoire partage +--node sem(semMemP, semMemR, semMemGive : bool) returns (semAutP,semAutR : bool); +--let +--semAutP = semMemGive when semMemP; +--semAutR = semMemGive when semMemR; +--tel + + + + + +node semMem(semMemTakeP, + semMemTakeR, + semMemGive : bool) +returns (semMemAutP : bool; + semMemAutR : bool; + free : bool; + demandeR : bool); +--var free : bool; +-- demandeR : bool; -- R a demand? le sem, mais il n'est pas encore libre +let + free = true -> ((pre(free) and (not semMemTakeP) and (not semMemTakeR)) + or + ((not semMemTakeP) and (not semMemTakeR) and semMemGive)); + + + -- semMemAutR = false -> (pre free) and (not semMemTakeP) and semMemTakeR; + + semMemAutP = false -> (pre free) and semMemTakeP; + + demandeR = false -> if semMemTakeR and semMemTakeP + then true + else if pre(semMemAutR) + then false + else pre demandeR; + +-- (semMemTakeR or pre(demandeR)); + semMemAutR = false -> (pre free) and (not semMemTakeP) and demandeR; +tel + + +-- node semMem2 +-- (semMemTakeP: bool; +-- semMemTakeR: bool; +-- semMemGive: bool) +-- returns +-- (semMemAutP: bool; +-- semMemAutR: bool; +-- free: bool; +-- demandeR: bool); +-- let +-- semMemAutP = (false -> ((pre free) and semMemTakeP)); +-- semMemAutR = (false -> (((pre free) and (not semMemTakeP)) and +-- demandeR)); +-- free = (true -> ((((pre free) and (not semMemTakeP)) and (not +-- semMemTakeR)) or (((not semMemTakeP) and (not semMemTakeR)) and semMemGive))) +-- ; +-- demandeR = (semMemTakeR -> (semMemTakeR or (pre demandeR))); +-- tel. + + + + +-- memoire partage +node mem(getMem, putMem : bool; + piloteData : int) +returns (semMemGive : bool; + readData : int; + localDataErasedFromMem, localDataCopiedFromMem : int; + erasedMemEvent : bool; + copyMemEvent : bool); --when getMem); +var localData : int; + demandeGetMem : bool; +let + semMemGive = not (getMem or putMem); + + localData = -1 -> if (putMem) + then piloteData + else pre(localData); -- when putMem; + readData = if demandeGetMem + then localData -- current(locaData) + else -1; + + + demandeGetMem = getMem -> if getMem + then true + else if pre(not(readData=-1)) + then false + else pre demandeGetMem; + + -- observation dans Mem + -- ecrasement + localDataErasedFromMem = -1 -> if putMem + then pre localData + else -1; + erasedMemEvent = putMem; + + localDataCopiedFromMem = -1 -> if putMem + then localData + else -1; + copyMemEvent = putMem; +tel + + + + +-- application +node read(Happli, semAutR : bool; + readData : int) +returns (getMemR, semMemR : bool; + localData : int; + consumptionEvent : bool); +--var localData : int; +let + semMemR = Happli; + getMemR = semAutR; -- and Happli; + -- if (semAutR and Happli) + --then true + --else false; + localData = readData;-- if Happli + -- then readData + -- else -1; + consumptionEvent= not (readData=-1); +tel + + + + +const periodePilote : int = 5; +const periodeCapt : int = 10; +const periodeAppli : int = 20; +const periodeDureeAppli : int = 7; +const periodeDureePilote : int = 2; +-- Horloges +node ctrl(in : bool) +returns (Hcapt, + Hpilote, + Happli : bool); +var cptC, + cptP, + cptA, + cptDureeP, + cptDureeA : int; + countDP, + countDA : bool; + Hduree_pilote, Hduree_appli : bool; +let + + Hpilote = (cptP=periodePilote); + Hcapt = (cptC=periodeCapt); + Happli = (cptA=periodeAppli); + Hduree_pilote = (cptDureeP=periodeDureePilote); + Hduree_appli = (cptDureeA=periodeDureeAppli); + + countDP = false -> if Hpilote + then true + else if (pre(cptDureeP)=periodeDureePilote) + then false + else pre(countDP); + countDA = false -> if Happli + then true + else if (pre(cptDureeA)=periodeDureeAppli) + then false + else pre(countDA); + + cptDureeP = 1 -> if countDP + then pre(cptDureeP)+1 + else 1; + + cptDureeA = 1 -> if countDA + then pre(cptDureeA)+1 + else 1; + + cptC = 1 -> if (pre(cptC)=periodeCapt) + then 1 + else pre(cptC)+1; + + cptP = 1 -> if (pre(cptP)=periodePilote) + then 1 + else pre(cptP)+1; + + cptA = 1 -> if (pre(cptA)=periodeAppli) + then 1 + else pre(cptA)+1; +tel + + +end \ No newline at end of file diff --git a/src/test/should_work/lionel/pipeline.lus b/_tests/should_work/lionel/pipeline.lus similarity index 100% rename from src/test/should_work/lionel/pipeline.lus rename to _tests/should_work/lionel/pipeline.lus diff --git a/src/test/should_work/lionel/predefOp.lus b/_tests/should_work/lionel/predefOp.lus similarity index 100% rename from src/test/should_work/lionel/predefOp.lus rename to _tests/should_work/lionel/predefOp.lus diff --git a/src/test/should_work/lionel/redIf.lus b/_tests/should_work/lionel/redIf.lus similarity index 100% rename from src/test/should_work/lionel/redIf.lus rename to _tests/should_work/lionel/redIf.lus diff --git a/src/test/should_work/lionel/remplissage-1.0.lus b/_tests/should_work/lionel/remplissage-1.0.lus similarity index 100% rename from src/test/should_work/lionel/remplissage-1.0.lus rename to _tests/should_work/lionel/remplissage-1.0.lus diff --git a/src/test/should_work/lionel/simpleRed.lus b/_tests/should_work/lionel/simpleRed.lus similarity index 100% rename from src/test/should_work/lionel/simpleRed.lus rename to _tests/should_work/lionel/simpleRed.lus diff --git a/src/test/should_work/lionel/test.exp b/_tests/should_work/lionel/test.exp similarity index 100% rename from src/test/should_work/lionel/test.exp rename to _tests/should_work/lionel/test.exp diff --git a/src/test/should_work/lionel/testSilus.lus b/_tests/should_work/lionel/testSilus.lus similarity index 100% rename from src/test/should_work/lionel/testSilus.lus rename to _tests/should_work/lionel/testSilus.lus diff --git a/src/test/should_work/lionel/triSel.lus b/_tests/should_work/lionel/triSel.lus similarity index 100% rename from src/test/should_work/lionel/triSel.lus rename to _tests/should_work/lionel/triSel.lus diff --git a/src/test/should_work/packEnvTest/Condact.lus b/_tests/should_work/packEnvTest/Condact.lus similarity index 100% rename from src/test/should_work/packEnvTest/Condact.lus rename to _tests/should_work/packEnvTest/Condact.lus diff --git a/src/test/should_work/packEnvTest/complex.lus b/_tests/should_work/packEnvTest/complex.lus similarity index 100% rename from src/test/should_work/packEnvTest/complex.lus rename to _tests/should_work/packEnvTest/complex.lus diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus b/_tests/should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus similarity index 100% rename from src/test/should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus rename to _tests/should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/main.lus b/_tests/should_work/packEnvTest/contractForElementSelectionInArray/main.lus similarity index 100% rename from src/test/should_work/packEnvTest/contractForElementSelectionInArray/main.lus rename to _tests/should_work/packEnvTest/contractForElementSelectionInArray/main.lus diff --git a/test-old/contractForElementSelectionInArray/noeudsIndependants.lus b/_tests/should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus similarity index 100% rename from test-old/contractForElementSelectionInArray/noeudsIndependants.lus rename to _tests/should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus b/_tests/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus similarity index 100% rename from src/test/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus rename to _tests/should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus diff --git a/src/test/should_work/packEnvTest/contractForElementSelectionInArray/tri.lus b/_tests/should_work/packEnvTest/contractForElementSelectionInArray/tri.lus similarity index 100% rename from src/test/should_work/packEnvTest/contractForElementSelectionInArray/tri.lus rename to _tests/should_work/packEnvTest/contractForElementSelectionInArray/tri.lus diff --git a/src/test/should_work/packEnvTest/iter.lus b/_tests/should_work/packEnvTest/iter.lus similarity index 100% rename from src/test/should_work/packEnvTest/iter.lus rename to _tests/should_work/packEnvTest/iter.lus diff --git a/src/test/should_work/packEnvTest/model.lus b/_tests/should_work/packEnvTest/model.lus similarity index 100% rename from src/test/should_work/packEnvTest/model.lus rename to _tests/should_work/packEnvTest/model.lus diff --git a/src/test/should_work/packEnvTest/modelInst.lus b/_tests/should_work/packEnvTest/modelInst.lus similarity index 100% rename from src/test/should_work/packEnvTest/modelInst.lus rename to _tests/should_work/packEnvTest/modelInst.lus diff --git a/src/test/should_work/packEnvTest/packages.lus b/_tests/should_work/packEnvTest/packages.lus similarity index 100% rename from src/test/should_work/packEnvTest/packages.lus rename to _tests/should_work/packEnvTest/packages.lus diff --git a/src/test/should_work/packEnvTest/packages2.lus b/_tests/should_work/packEnvTest/packages2.lus similarity index 100% rename from src/test/should_work/packEnvTest/packages2.lus rename to _tests/should_work/packEnvTest/packages2.lus diff --git a/src/test/should_work/packEnvTest/polymorphic_pack.lus b/_tests/should_work/packEnvTest/polymorphic_pack.lus similarity index 100% rename from src/test/should_work/packEnvTest/polymorphic_pack.lus rename to _tests/should_work/packEnvTest/polymorphic_pack.lus diff --git a/src/test/should_work/to_sort_out/asservi.lus b/_tests/should_work/to_sort_out/asservi.lus similarity index 100% rename from src/test/should_work/to_sort_out/asservi.lus rename to _tests/should_work/to_sort_out/asservi.lus diff --git a/src/test/should_work/to_sort_out/test.res b/_tests/should_work/to_sort_out/test.res similarity index 100% rename from src/test/should_work/to_sort_out/test.res rename to _tests/should_work/to_sort_out/test.res diff --git a/_tests/test.res.exp b/_tests/test.res.exp new file mode 100644 index 0000000000000000000000000000000000000000..b72f399cc3dd5f4286bf46bcc3565440b237dd06 --- /dev/null +++ b/_tests/test.res.exp @@ -0,0 +1,11284 @@ +Non-regression tests +usage: lus2lic [options] <file> | lus2lic -help + +-n, -node <string> + Set the main node (all items are compiled if unset) +-o, --output-file <string> + Set the output file name +-knc, --keep-nested-calls + Keep nested calls. By default, only one node per equation is generated. +-ei, --expand-iterators + Expand array iterators (i.e., generate iterator-free code). +-ee, --expand-enums + Translate enums into integers. +-esa, --expand-structs-and-arrays + Expand structures and arrays using as many variables as necessary (automatically impose '-ei') +-en, --expand-nodes + Expand the main node (use the first node if no one is specified). +-den, --do_not-expand-nodes <string> + Do not expand node (useful in the expand mode only of course). +-lv4, --lustre-v4 + Use Lustre V4 syntax (automatically impose '-ei -ee -esa'). +-ec, --expanded-code + Generate ec (actually just an alias for '-en -lv4 --no-prefix'). +-np, --no-prefix + Do not prefix variable names by their module (beware: variable names may clash with this option). +-version, --version + Print the current version and exit +-v, --verbose + Set the verbose level to 1 +-vl <int> Set the verbose level +-more Show hidden options (for dev purposes) +-- ../objlinux/lus2lic -vl 2 should_work/NONREG/ex.lus +-- should_work/NONREG/ex.lus +type bool_11 = bool^11 (*abstract in the source*); +type bool_11_22 = bool_11^22 (*abstract in the source*); +type int_1 = int^1 (*abstract in the source*); +type int_1_2 = int_1^2 (*abstract in the source*); +type int_1_2_3 = int_1_2^3 (*abstract in the source*); +type int_1_2_3_4 = int_1_2_3^4 (*abstract in the source*); +type ex::s = struct {x : int_1_2_3_4; y : ex::s1}; +type ex::s1 = struct {x : int; y : int_1_2_3_4}; +type ex::t = int_1_2_3^4; +type ex::t1 = int_1_2_3_4^4; +type ex::t2 = struct {a : int; b : bool_11_22}; +node ex::ex(a:ex::s) returns (b:int); +let + b = a.x[0][0][0][0] + a.y.y[0][0][0][0]; +tel +-- end of node ex::ex + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/COUNTER.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/COUNTER.lus + +node COUNTER::COUNTER( + init:int; + incr:int; + X:bool; + reset:bool) +returns ( + N:int); +var + PN:int; +let + PN = init -> pre (N); + N = if reset then init else if X then PN + incr else PN; +tel +-- end of node COUNTER::COUNTER + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/CURRENT.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/CURRENT.lus +node CURRENT::CURRENT(x:bool; y:bool when x) returns (z:bool when x); +let + z = y; +tel +-- end of node CURRENT::CURRENT + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/EDGE.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/EDGE.lus +node EDGE::EDGE(X:bool) returns (Y:bool); +let + Y = false -> X and not pre (X); +tel +-- end of node EDGE::EDGE + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/FALLING_EDGE.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/FALLING_EDGE.lus +node FALLING_EDGE::EDGE(X:bool) returns (Y:bool); +let + Y = false -> X and not pre (X); +tel +-- end of node FALLING_EDGE::EDGE +node FALLING_EDGE::FALLING_EDGE(X:bool) returns (Y:bool); +let + Y = FALLING_EDGE::EDGE(not X); +tel +-- end of node FALLING_EDGE::FALLING_EDGE + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/Int.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/Int.lus +type bool_8 = bool^8 (*abstract in the source*); +type Int8::Int = bool^8; +const Int8::n = 8; +const Int8::zero = [false, false, false, false, false, false, false, false]; +function Int8::add(x:bool_8; y:bool_8) returns (sum:bool_8); +var + co:bool; +let + (co, sum) = fillred<<Int8::fulladd, 8>>(false, x, y); +tel +-- end of node Int8::add + +function Int8::fulladd( + ci:bool; + x:bool; + y:bool) +returns ( + s:bool; + co:bool); +let + s = ci xor x xor y; + co = ci and x or x and y or y and ci; +tel +-- end of node Int8::fulladd +function Int8::incr(x:bool_8) returns (incr:bool_8); +var + co:bool; +let + (co, incr) = fillred<<Int8::fulladd, 8>>(true, x, [false, false, false, + false, false, false, false, false]); +tel +-- end of node Int8::incr +node mainPack::Nat(evt:bool; reset:bool) returns (nat:Int8::Int); +let + nat = if true -> reset then Int8::zero else if evt then Int8::incr(pre + (nat)) else pre (nat); +tel +-- end of node mainPack::Nat + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/PCOND.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/PCOND.lus + +node PCOND::PCOND( + h0:bool; + hA:bool when h0; + hB:bool when h0; + hC:bool when h0; + A:int when hA; + B:int when hB; + C:bool when hC; + hD:bool when hC; + D:bool when hD) +returns ( + hX:bool when h0; + X:int when hX); +let + hX = hC and current (hD) and hA and current (current (D)) or hB and not + current (current (D)); + X = if hA and current (current (D)) then current (A) else current (B) + when hX; +tel +-- end of node PCOND::PCOND + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/PCOND1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/PCOND1.lus + +node PCOND1::PCOND1( + h0:bool; + hA:bool when h0; + hB:bool when h0; + hC:bool when h0; + A:int when hA; + B:int when hB; + C:bool when hC; + hD:bool when hC; + D:bool when hD) +returns ( + hX:bool when h0); +let + hX = hC and current (hD) and h0 when h0; +tel +-- end of node PCOND1::PCOND1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/SOURIS.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/SOURIS.lus + +node SOURIS::SOURIS( + B1:bool; + B2:bool; + B3:bool; + TOP:bool) +returns ( + SIMPLE:bool; + DOUBLE:bool; + TRIPLE:bool; + BOUTON:int); +var + count:int; + prev:int; + date:int; + SIMPLE_2:bool; + clic:bool; + chgt:bool; + fin_tps:bool; + fin_tps2:bool; + etat0:bool; + etat1:bool; + etat2:bool; + etat3:bool; +let + date = 0 -> if etat2 or etat3 and pre (etat1) then count else pre (date); + chgt = false -> if not clic then false else if B3 and prev = 3 or B1 and + prev = 1 or B2 and prev = 2 or prev = 0 or not B1 and not B2 and not B3 + then false else true; + clic = B1 xor B2 xor B3 and not B1 and B2 and B3; + prev = 0 -> if pre (B1) then 1 else if pre (B2) then 2 else if pre (B3) + then 3 else pre (prev); + fin_tps = false -> if TOP then pre (count) > 6 else pre (count) > 7; + fin_tps2 = false -> if TOP then pre (count) > 4 else pre (count) > 5; + count = 0 -> if etat1 and pre (etat0) or pre (etat1) and chgt or pre + (etat2) and chgt or pre (etat3) and chgt then if TOP then 1 else 0 else + if etat1 and pre (etat2) or pre (etat3) then if TOP then pre (count) - pre + (date) + 1 else pre (count) - pre (date) else if TOP then pre (count) + 1 + else pre (count); + etat0 = true -> if pre (etat1) and fin_tps and not clic or pre (etat2) + and clic and not chgt or pre (etat2) and fin_tps or pre (etat3) and clic + and not chgt or pre (etat0) and not clic then true else false; + etat1 = false -> if pre (etat0) and clic or pre (etat2) and chgt or pre + (etat3) and chgt or fin_tps or pre (etat1) and not clic and not fin_tps or + pre (etat1) and chgt then true else false; + etat2 = false -> if pre (etat1) and clic and not fin_tps2 and not chgt or + pre (etat2) and not clic and not fin_tps then true else false; + etat3 = false -> if pre (etat1) and clic and fin_tps2 and not chgt or pre + (etat3) and not clic and not fin_tps then true else false; + BOUTON = 0 -> if SIMPLE and not pre (SIMPLE_2) or DOUBLE or TRIPLE then + prev else if SIMPLE and pre (SIMPLE_2) then pre (prev) else 0; + SIMPLE = false -> pre (etat1) and etat0 or pre (etat1) and chgt or pre + (etat3) and etat1 and fin_tps or pre (etat3) and etat1 and chgt or pre + (SIMPLE_2); + SIMPLE_2 = false -> pre (etat3) and etat1 and chgt or pre (etat1) and pre + (SIMPLE_2) and chgt; + DOUBLE = false -> pre (etat2) and chgt or pre (etat2) and fin_tps; + TRIPLE = false -> pre (etat3) and etat0 or pre (etat2) and not fin_tps and + not chgt and etat0; +tel +-- end of node SOURIS::SOURIS + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/STABLE.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/STABLE.lus +node STABLE::STABLE(set:bool; delay:int) returns (level:bool); +var + count:int; +let + level = count > 0; + count = if set then delay else if false -> pre (level) then pre (count) + - 1 else 0; +tel +-- end of node STABLE::STABLE + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/SWITCH.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/SWITCH.lus + +node SWITCH::SWITCH( + set:bool; + reset:bool; + initial:bool) +returns ( + level:bool); +let + level = initial -> if set and not pre (level) then true else if reset + then false else pre (level); +tel +-- end of node SWITCH::SWITCH + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/SWITCH1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/SWITCH1.lus + +node SWITCH1::SWITCH1( + set:bool; + reset:bool; + initial:bool) +returns ( + level:bool); +let + level = initial -> if set then true else if reset then false else pre + (level); +tel +-- end of node SWITCH1::SWITCH1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/TIME_STABLE.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/TIME_STABLE.lus +node TIME_STABLE::STABLE(set:bool; delay:int) returns (level:bool); +var + count:int; +let + level = count > 0; + count = if set then delay else if false -> pre (level) then pre (count) + - 1 else 0; +tel +-- end of node TIME_STABLE::STABLE + +node TIME_STABLE::TIME_STABLE( + set:bool; + second:bool; + delay:int) +returns ( + level:bool); +var + ck:bool; +let + level = current (TIME_STABLE::STABLE(set, delay when ck)); + ck = true -> set or second; +tel +-- end of node TIME_STABLE::TIME_STABLE + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/TIME_STABLE1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/TIME_STABLE1.lus + +node TIME_STABLE1::TIME1_STABLE1( + set:bool; + second:bool; + delay:int) +returns ( + level:bool); +var + count:int; +let + level = count > 0; + count = if set then delay else if second then if false -> pre (level) + then pre (count) - 1 else 0 else 0 -> pre (count); +tel +-- end of node TIME_STABLE1::TIME1_STABLE1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/Watch.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/Watch.lus +type Watch::ALARM_TIME_POSITION; +type Watch::ALARM_TIME_TYPE; +type Watch::DISPLAY_POSITION; +type Watch::DISPLAY_TYPE; +type Watch::LABELS_TYPE; +type Watch::MAIN_DISPLAY_TYPE; +type Watch::MINI_DISPLAY_TYPE; +type Watch::STATUS_TYPE; +type Watch::STOPWATCH_TIME_TYPE; +type Watch::WATCH_TIME_POSITION; +type Watch::WATCH_TIME_TYPE; +type Watch::string; +const Watch::ALARM_DURATION : int; +const Watch::INITIAL_ALARM_POSITION : Watch::ALARM_TIME_POSITION; +const Watch::INITIAL_ALARM_TIME : Watch::ALARM_TIME_TYPE; +const Watch::INITIAL_STOPWATCH_TIME : Watch::STOPWATCH_TIME_TYPE; +const Watch::INITIAL_WATCH_POSITION : Watch::WATCH_TIME_POSITION; +const Watch::INITIAL_WATCH_TIME : Watch::WATCH_TIME_TYPE; +const Watch::NULL_POSITION : Watch::DISPLAY_POSITION; +const Watch::stringAL : Watch::string; +const Watch::stringST : Watch::string; + +node Watch::ALARM( + toggle_24h:bool; + toggle_alarm:bool; + in_set:bool; + set:bool; + next_position:bool; + stop_beep:bool; + second:bool; + watch_time:Watch::WATCH_TIME_TYPE) +returns ( + time:Watch::ALARM_TIME_TYPE; + status:bool; + enhance:Watch::ALARM_TIME_POSITION; + beep:int); +var + position_set:Watch::ALARM_TIME_POSITION; + start_beeping:bool; + time_out:bool; + count:int; + internal_status:int; +let + start_beeping = Watch::COMPARE_WATCH_ALARM_TIME(watch_time, time) and + status; + status = internal_status = 1; + internal_status = 0 -> if toggle_alarm then if pre (internal_status) = 0 + then 1 else 0 else if Watch::EDGE(not in_set) and pre (internal_status) = + 0 then 1 else pre (internal_status); + count = 0 -> if start_beeping then Watch::ALARM_DURATION else if pre + (count) <> 0 and second then pre (count) - 1 else 0 -> pre (count); + time_out = false -> pre (count) <> 0 and count = 0; + beep = if Watch::TWO_STATES(false, start_beeping, stop_beep or time_out) + and second then 4 else 0; + time = Watch::INITIAL_ALARM_TIME -> if toggle_24h then + Watch::TOGGLE_24H_IN_ALARM_MODE(pre (time)) else if set then + Watch::SET_ALARM_TIME(pre (time), position_set) else pre (time); + enhance = position_set; + position_set = if true -> Watch::EDGE(in_set) then + Watch::INITIAL_ALARM_POSITION else if next_position then + Watch::NEXT_ALARM_TIME_POSITION(pre (position_set)) else pre + (position_set); +tel +-- end of node Watch::ALARM + +extern function Watch::ALARM_TIME_TO_MAIN_DISPLAY( + time:Watch::ALARM_TIME_TYPE) +returns ( + display:Watch::MAIN_DISPLAY_TYPE); + +extern function Watch::ALARM_TO_DISPLAY_POS( + apos:Watch::ALARM_TIME_POSITION) +returns ( + dpos:Watch::DISPLAY_POSITION); + +node Watch::BUTTONS( + UL:bool; + LL:bool; + UR:bool; + LR:bool) +returns ( + mode_is_watch:bool; + mode_is_stopwatch:bool; + mode_is_alarm:bool; + mode_is_set_watch:bool; + mode_is_set_alarm:bool; + toggle_24h:bool; + toggle_chime:bool; + toggle_alarm:bool; + next_watch_time_position:bool; + next_alarm_position:bool; + set_watch:bool; + set_alarm:bool; + start_stop:bool; + lap:bool; + stop_alarm_beep:bool); +var + mode_is_standard_watch:bool; + mode_is_standard_alarm:bool; +let + mode_is_watch = true -> if LL then if pre (mode_is_watch) then pre + (mode_is_set_watch) else if pre (mode_is_stopwatch) then false else not + pre (mode_is_set_alarm) else pre (mode_is_watch); + mode_is_stopwatch = false -> if LL then if pre (mode_is_watch) then not + pre (mode_is_set_watch) else false else pre (mode_is_stopwatch); + mode_is_alarm = false -> if LL then if pre (mode_is_watch) then false + else if pre (mode_is_stopwatch) then true else pre (mode_is_set_alarm) + else pre (mode_is_alarm); + mode_is_set_watch = if mode_is_watch then if UL then false -> not pre + (mode_is_set_watch) else false -> pre (mode_is_set_watch) else false; + mode_is_set_alarm = if mode_is_alarm then if UL then not pre + (mode_is_set_alarm) else pre (mode_is_set_alarm) else false; + mode_is_standard_watch = mode_is_watch and not mode_is_set_watch; + mode_is_standard_alarm = mode_is_alarm and not mode_is_set_alarm; + toggle_24h = LR and mode_is_standard_watch; + toggle_chime = LR and mode_is_standard_alarm; + toggle_alarm = UR and mode_is_standard_alarm; + next_watch_time_position = LL and mode_is_set_watch; + next_alarm_position = LL and mode_is_set_alarm; + set_watch = LR and mode_is_set_watch; + set_alarm = LR and mode_is_set_alarm; + start_stop = LR and mode_is_stopwatch; + lap = UR and mode_is_stopwatch; + stop_alarm_beep = UR; +tel +-- end of node Watch::BUTTONS + +extern function Watch::COMPARE_WATCH_ALARM_TIME( + watch_time:Watch::WATCH_TIME_TYPE; + alarm_time:Watch::ALARM_TIME_TYPE) +returns ( + result:bool); + +extern function Watch::CONFIRM_TIME( + time:Watch::WATCH_TIME_TYPE) +returns ( + new_time:Watch::WATCH_TIME_TYPE); + +node Watch::DISPLAY( + mode_is_watch:bool; + mode_is_stopwatch:bool; + mode_is_alarm:bool; + watch_time:Watch::WATCH_TIME_TYPE; + stopwatch_time:Watch::STOPWATCH_TIME_TYPE; + alarm_time:Watch::ALARM_TIME_TYPE; + position_enhanced:Watch::DISPLAY_POSITION; + status:Watch::STATUS_TYPE; + labels:Watch::LABELS_TYPE) +returns ( + display:Watch::DISPLAY_TYPE); +var + main_display:Watch::MAIN_DISPLAY_TYPE; + mini_display:Watch::MINI_DISPLAY_TYPE; + alpha_display:Watch::string; +let + display = Watch::MAKE_DISPLAY(main_display, mini_display, alpha_display, + status, position_enhanced, labels); + (main_display, mini_display, alpha_display) = if mode_is_watch then + (Watch::WATCH_TIME_TO_MAIN_DISPLAY(watch_time), + Watch::WATCH_DATE_TO_MINI_DISPLAY(watch_time), + Watch::WATCH_DAY_TO_ALPHA_DISPLAY(watch_time)) else if mode_is_stopwatch + then (Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY(stopwatch_time), + Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time), Watch::stringST) else + (Watch::ALARM_TIME_TO_MAIN_DISPLAY(alarm_time), + Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time), Watch::stringAL); +tel +-- end of node Watch::DISPLAY +node Watch::DIVIDE(scale:int) returns (quotient:bool); +var + n:int; +let + (n, quotient) = (0, true) -> ( if pre (n) + 1 = scale then (0, true) else + (pre (n) + 1, false)); +tel +-- end of node Watch::DIVIDE +node Watch::EDGE(b:bool) returns (edge:bool); +let + edge = b -> b and not pre (b); +tel +-- end of node Watch::EDGE + +extern function Watch::INCREMENT_STOPWATCH_TIME( + time:Watch::STOPWATCH_TIME_TYPE) +returns ( + newtime:Watch::STOPWATCH_TIME_TYPE); + +extern function Watch::INCREMENT_WATCH_TIME( + time:Watch::WATCH_TIME_TYPE) +returns ( + newtime:Watch::WATCH_TIME_TYPE); + +extern function Watch::INCREMENT_WATCH_TIME_IN_SET_MODE( + time:Watch::WATCH_TIME_TYPE; + position:Watch::WATCH_TIME_POSITION) +returns ( + new_time:Watch::WATCH_TIME_TYPE); + +extern function Watch::IS_O_CLOCK( + time:Watch::WATCH_TIME_TYPE) +returns ( + is_o_clock:bool); + +extern function Watch::IS_ZERO_MOD_10_MN( + time:Watch::STOPWATCH_TIME_TYPE) +returns ( + is_zero:bool); + +extern function Watch::LABELS( + mode_is_watch:bool; + mode_is_stopwatch:bool; + mode_is_alarm:bool; + mode_is_set_watch:bool; + mode_is_set_alarm:bool) +returns ( + labels:Watch::LABELS_TYPE); + +extern function Watch::MAKE_DISPLAY( + main:Watch::MAIN_DISPLAY_TYPE; + mini:Watch::MINI_DISPLAY_TYPE; + alpha:Watch::string; + status:Watch::STATUS_TYPE; + enhanced:Watch::DISPLAY_POSITION; + labels:Watch::LABELS_TYPE) +returns ( + display:Watch::DISPLAY_TYPE); +node Watch::MORE_RECENT(evt:bool; delay:int) returns (more_recent:bool); +var + deadline:int; +let + (more_recent, deadline) = if evt then (true, 0) else (false, delay) -> ( + if evt then (true, 0) else if pre (more_recent) then (deadline < delay, + pre (deadline) + 1) else (false, pre (deadline))); +tel +-- end of node Watch::MORE_RECENT + +extern function Watch::NEXT_ALARM_TIME_POSITION( + position:Watch::ALARM_TIME_POSITION) +returns ( + new_position:Watch::ALARM_TIME_POSITION); + +extern function Watch::NEXT_WATCH_TIME_POSITION( + position:Watch::WATCH_TIME_POSITION) +returns ( + new_position:Watch::WATCH_TIME_POSITION); + +extern function Watch::SET_ALARM_TIME( + time:Watch::ALARM_TIME_TYPE; + position:Watch::ALARM_TIME_POSITION) +returns ( + new_time:Watch::ALARM_TIME_TYPE); + +extern function Watch::SET_WATCH_TIME( + time:Watch::WATCH_TIME_TYPE; + position:Watch::WATCH_TIME_POSITION) +returns ( + new_time:Watch::WATCH_TIME_TYPE); +extern function Watch::SOMME(i1:int; i2:int; i3:int) returns (somme:int); + +extern function Watch::STATUS( + alarm_is_set:bool; + chime_is_set:bool; + stopwatch_running:bool; + stopwatch_lapping:bool) +returns ( + status:Watch::STATUS_TYPE); + +node Watch::STOPWATCH( + hs:bool; + start_stop:bool; + lap:bool) +returns ( + time:Watch::STOPWATCH_TIME_TYPE; + run_state:bool; + lap_state:bool; + beep:int); +var + reset:bool; + must_beep:bool; + internal_time:Watch::STOPWATCH_TIME_TYPE; +let + reset = false -> lap and pre (not run_state and not lap_state); + run_state = Watch::TWO_STATES(false, start_stop, start_stop); + lap_state = Watch::TWO_STATES(false, lap and run_state, lap); + time = current (internal_time when lap_state); + internal_time = if true -> reset then Watch::INITIAL_STOPWATCH_TIME else + if run_state and hs then Watch::INCREMENT_STOPWATCH_TIME(pre + (internal_time)) else pre (internal_time); + must_beep = if start_stop then true else if hs and run_state then + Watch::IS_ZERO_MOD_10_MN(internal_time) else false; + beep = if must_beep then 1 else 0; +tel +-- end of node Watch::STOPWATCH + +extern function Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY( + time:Watch::STOPWATCH_TIME_TYPE) +returns ( + display:Watch::MAIN_DISPLAY_TYPE); +extern function Watch::TIME_SCALE(bidon:int) returns (scale:int); + +extern function Watch::TOGGLE_24H_IN_ALARM_MODE( + time:Watch::ALARM_TIME_TYPE) +returns ( + newtime:Watch::ALARM_TIME_TYPE); + +extern function Watch::TOGGLE_24H_IN_WATCH_MODE( + time:Watch::WATCH_TIME_TYPE) +returns ( + newtime:Watch::WATCH_TIME_TYPE); + +node Watch::TWO_STATES( + init:bool; + set:bool; + reset:bool) +returns ( + state:bool); +let + state = init -> if set and not pre (state) then true else if reset and + pre (state) then false else pre (state); +tel +-- end of node Watch::TWO_STATES + +node Watch::WATCH( + second:bool; + toggle_24h:bool; + toggle_chime:bool; + in_set:bool; + next_position:bool; + set:bool) +returns ( + time:Watch::WATCH_TIME_TYPE; + enhance:Watch::WATCH_TIME_POSITION; + chime_is_set:bool; + beep:int); +var + position_set:Watch::WATCH_TIME_POSITION; + internal_chime_is_set:int; +let + internal_chime_is_set = 0 -> if toggle_chime then if pre + (internal_chime_is_set) = 0 then 1 else 0 else pre (internal_chime_is_set); + chime_is_set = internal_chime_is_set = 1; + beep = if second then if Watch::IS_O_CLOCK(time) and chime_is_set then 2 + else 0 else 0; + time = Watch::INITIAL_WATCH_TIME -> if not in_set then if second then + Watch::INCREMENT_WATCH_TIME(pre (time)) else if toggle_24h then + Watch::TOGGLE_24H_IN_WATCH_MODE(pre (time)) else if Watch::EDGE(not + in_set) then Watch::CONFIRM_TIME(pre (time)) else pre (time) else if + second then Watch::INCREMENT_WATCH_TIME_IN_SET_MODE(pre (time), + position_set) else if set then Watch::SET_WATCH_TIME(pre (time), + position_set) else pre (time); + enhance = position_set; + position_set = if true -> Watch::EDGE(in_set) then + Watch::INITIAL_WATCH_POSITION else if next_position then + Watch::NEXT_WATCH_TIME_POSITION(pre (position_set)) else pre + (position_set); +tel +-- end of node Watch::WATCH + +extern function Watch::WATCH_DATE_TO_MINI_DISPLAY( + time:Watch::WATCH_TIME_TYPE) +returns ( + display:Watch::MINI_DISPLAY_TYPE); + +extern function Watch::WATCH_DAY_TO_ALPHA_DISPLAY( + time:Watch::WATCH_TIME_TYPE) +returns ( + display:Watch::string); + +extern function Watch::WATCH_TIME_TO_MAIN_DISPLAY( + time:Watch::WATCH_TIME_TYPE) +returns ( + display:Watch::MAIN_DISPLAY_TYPE); + +extern function Watch::WATCH_TIME_TO_MINI_DISPLAY( + time:Watch::WATCH_TIME_TYPE) +returns ( + display:Watch::MINI_DISPLAY_TYPE); + +extern function Watch::WATCH_TO_DISPLAY_POS( + wpos:Watch::WATCH_TIME_POSITION) +returns ( + dpos:Watch::DISPLAY_POSITION); + +node Watch::Watch( + UPLEFT:bool; + LOWLEFT:bool; + UPRIGHT:bool; + LOWRIGHT:bool; + time_unit:bool) +returns ( + display:Watch::DISPLAY_TYPE; + beep:int); +var + watch_time:Watch::WATCH_TIME_TYPE; + watch_position_enhanced:Watch::WATCH_TIME_POSITION; + alarm_time:Watch::ALARM_TIME_TYPE; + alarm_position_enhanced:Watch::ALARM_TIME_POSITION; + stopwatch_time:Watch::STOPWATCH_TIME_TYPE; + position_enhanced:Watch::DISPLAY_POSITION; + status:Watch::STATUS_TYPE; + labels:Watch::LABELS_TYPE; + alarm_is_set:bool; + mode_is_watch:bool; + mode_is_stopwatch:bool; + mode_is_alarm:bool; + stopwatch_running:bool; + stopwatch_lapping:bool; + chime_is_set:bool; + toggle_24h:bool; + toggle_chime:bool; + toggle_alarm:bool; + watch_next_position:bool; + alarm_next_position:bool; + set_watch:bool; + set_alarm:bool; + mode_is_set_watch:bool; + mode_is_set_alarm:bool; + start_stop:bool; + lap:bool; + stop_alarm_beep:bool; + second:bool; + alarm_beep:int; + chime_beep:int; + stopwatch_beep:int; +let + display = Watch::DISPLAY(mode_is_watch, mode_is_stopwatch, mode_is_alarm, + watch_time, stopwatch_time, alarm_time, position_enhanced, status, labels); + beep = Watch::SOMME(alarm_beep, chime_beep, stopwatch_beep); + (alarm_time, alarm_is_set, alarm_position_enhanced, alarm_beep) = + Watch::ALARM(toggle_24h, toggle_alarm, mode_is_set_alarm, set_alarm, + alarm_next_position, stop_alarm_beep, second, watch_time); + labels = Watch::LABELS(mode_is_watch, mode_is_stopwatch, mode_is_alarm, + mode_is_set_watch, mode_is_set_alarm); + position_enhanced = if mode_is_set_watch then + Watch::WATCH_TO_DISPLAY_POS(watch_position_enhanced) else if + mode_is_set_alarm then Watch::ALARM_TO_DISPLAY_POS(alarm_position_enhanced) + else Watch::NULL_POSITION; + status = Watch::STATUS(alarm_is_set, chime_is_set, stopwatch_running, + stopwatch_lapping); + (watch_time, watch_position_enhanced, chime_is_set, chime_beep) = + Watch::WATCH(second, toggle_24h, toggle_chime, mode_is_set_watch, + watch_next_position, set_watch); + (stopwatch_time, stopwatch_running, stopwatch_lapping, stopwatch_beep) = + Watch::STOPWATCH(time_unit, start_stop, lap); + (mode_is_watch, mode_is_stopwatch, mode_is_alarm, mode_is_set_watch, + mode_is_set_alarm, toggle_24h, toggle_chime, toggle_alarm, + watch_next_position, alarm_next_position, set_watch, set_alarm, start_stop, + lap, stop_alarm_beep) = Watch::BUTTONS(UPLEFT, LOWLEFT, UPRIGHT, LOWRIGHT); + second = time_unit and current (Watch::DIVIDE(Watch::TIME_SCALE(0) when + time_unit)); +tel +-- end of node Watch::Watch + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X.lus + +node X::X( + c:bool; + n:int when c) +returns ( + d:bool; + m:int when c; + p:int when d); +let + m = 0 when c -> pre (m) + n; + d = c and current (m) <= 10; + p = 0 when d -> pre (p) + 1 when d; +tel +-- end of node X::X + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X1.lus +node X1::X1(b:bool; n:int) returns (m:int); +let + m = current (n when b); +tel +-- end of node X1::X1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X2.lus +node X2::X2(b:bool; n:int) returns (m:int); +let + m = 0 -> current (n when b); +tel +-- end of node X2::X2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X3.lus +node X3::X3(n:int; b:bool) returns (m:int); +var + c:bool when b; + d:bool when c; + p:int when b; + u:int when b; + q:int when c; + r:int when c; +let + c = p >= 0 when b; + p = n when b; + q = p when c; + d = q <= 10 when b when c; + r = current (q when d); + u = current (r); + m = current (u); +tel +-- end of node X3::X3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X6.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/X6.lus + +node X6::X6( + n:int; + b:bool) +returns ( + m:int; + c:bool when b; + d:bool when c; + p:int when b; + u:int when b; + q:int when c; + r:int when c); +let + c = p >= 0 when b; + p = n when b; + q = p when c; + d = q <= 10 when b when c; + r = current (q when d); + u = current (r); + m = current (u); +tel +-- end of node X6::X6 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/_N_uu.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/_N_uu.lus +node _N_uu::_N_uu(I_x:bool; I_y:bool; I_z:bool) returns (O_a:bool); +var + V_V135_A_forbiden:bool; + V_V111_X:bool; + V_V112_X:bool; + V_V136_B_forbiden:bool; + V_V118_X:bool; + V_V125_X:bool; + V_V119_X:bool; + V_V126_X:bool; +let + O_a = not V_V111_X and V_V135_A_forbiden and not V_V125_X and + V_V136_B_forbiden; + V_V112_X = false -> pre (I_y or V_V112_X); + V_V111_X = if I_y then I_x else if V_V112_X then I_x or pre (V_V111_X) + else true; + V_V119_X = false -> pre (I_y or V_V119_X); + V_V118_X = if I_y then I_x else if V_V119_X then I_x and pre (V_V118_X) + else true; + V_V126_X = false -> pre (V_V118_X or V_V126_X); + V_V125_X = if V_V118_X then I_z else if V_V126_X then I_z or pre + (V_V125_X) else true; + V_V135_A_forbiden = false -> if pre (V_V111_X) and not V_V111_X then true + else if pre (V_V125_X) and not V_V125_X then false else pre + (V_V135_A_forbiden); + V_V136_B_forbiden = true -> if pre (V_V125_X) and not V_V125_X then true + else if pre (V_V111_X) and not V_V111_X then false else pre + (V_V136_B_forbiden); +tel +-- end of node _N_uu::_N_uu + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/activation_ec.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/activation_ec.lus +node activation_ec::activation_ec(evt:bool) returns (scie:int); +var + V10_go_up:bool; +let + scie = 0 -> if evt then if V10_go_up then pre (scie) + 1 else pre (scie) + - 1 else pre (scie); + V10_go_up = true -> if pre (scie) >= 5 then false else if pre (scie) <= + 0 then true else pre (V10_go_up); +tel +-- end of node activation_ec::activation_ec + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/after.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/after.lus +node after::after(x:bool) returns (after:bool); +let + after = x or false -> pre (after); +tel +-- end of node after::after + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/alarme.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/alarme.lus +const alarme::delai_alarme = 6; +const alarme::delai_reprise = 4; +const alarme::delai_vigilence = 3; + +node alarme::alarme( + MA:bool; + code:bool; + pb_hab:bool; + pb_tmp:bool) +returns ( + alarme:bool; + en_marche:bool); +var + demande_entree:bool; + vigilence_partielle:bool; + reprise:bool; + tps_vigilence:int; + tps_reprise:int; + tps_alarme:int; +let + assert(#(MA, code)); + en_marche = alarme::bascule(false, MA, MA and pre (demande_entree)); + demande_entree = alarme::bascule(false, code, pre (tps_vigilence) = 0); + vigilence_partielle = alarme::bascule(false, alarme::edge(en_marche) or + alarme::edge(demande_entree), pre (tps_vigilence) = 0); + tps_vigilence = alarme::decompte(alarme::edge(en_marche) or + alarme::edge(demande_entree), 3, en_marche and pre (tps_vigilence) > 0); + tps_alarme = alarme::decompte(alarme::edge(alarme), 6, pre (alarme) and + pre (tps_alarme) > 0); + reprise = alarme::bascule(false, pre (alarme) and pre (tps_alarme) = 0, + pre (tps_reprise) = 0); + tps_reprise = alarme::decompte(alarme::edge(reprise), 4, pre (reprise) and + pre (tps_reprise > 0)); + alarme = false -> if en_marche and not reprise and pb_hab or pb_tmp and + not vigilence_partielle then true else if pre (alarme) and pre + (tps_alarme) = 0 or alarme::edge(not en_marche) then false else pre + (alarme); +tel +-- end of node alarme::alarme + +node alarme::bascule( + init:bool; + set:bool; + reset:bool) +returns ( + etat:bool); +let + etat = init -> if set and not pre (etat) then true else if reset and pre + (etat) then false else pre (etat); +tel +-- end of node alarme::bascule + +node alarme::decompte( + init:bool; + val_init:int; + decr:bool) +returns ( + n:int); +let + n = 0 -> if init then val_init else if decr then pre (n) - 1 else pre + (n); +tel +-- end of node alarme::decompte +node alarme::edge(in:bool) returns (edge:bool); +let + edge = false -> in and not pre (in); +tel +-- end of node alarme::edge + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/arbitre.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/arbitre.lus + +node arbitre::arbitre( + req0:bool; + req1:bool; + req2:bool; + req3:bool) +returns ( + ok:bool); +var + gr0:bool; + gr1:bool; + gr2:bool; + gr3:bool; +let + (gr0, gr1, gr2, gr3) = arbitre::mutex(req0, req1, req2, req3); + ok = #(gr0, gr1, gr2, gr3); +tel +-- end of node arbitre::arbitre + +node arbitre::mutex( + req0:bool; + req1:bool; + req2:bool; + req3:bool) +returns ( + grant0:bool; + grant1:bool; + grant2:bool; + grant3:bool); +var + token0:bool; + token1:bool; + token2:bool; + token3:bool; + new_token0:bool; + new_token1:bool; + new_token2:bool; + new_token3:bool; +let + (grant0, new_token0) = arbitre::process(req0, token0); + (grant1, new_token1) = arbitre::process(req1, token1); + (grant2, new_token2) = arbitre::process(req2, token2); + (grant3, new_token3) = arbitre::process(req3, token3); + token0 = true -> pre (new_token3); + token1 = false -> pre (new_token0); + token2 = false -> pre (new_token1); + token3 = false -> pre (new_token2); +tel +-- end of node arbitre::mutex + +node arbitre::my_switch( + set:bool; + reset:bool; + initial:bool) +returns ( + level:bool); +let + level = initial -> if set and not pre (level) then true else if reset + and pre (level) then false else pre (level); +tel +-- end of node arbitre::my_switch + +node arbitre::process( + request:bool; + token:bool) +returns ( + grant:bool; + new_token:bool); +let + grant = arbitre::my_switch(token and request, not request, token and + request); + new_token = false -> pre (token) and not request or arbitre::xedge(not + grant); +tel +-- end of node arbitre::process +extern node arbitre::xedge(x:bool) returns (y:bool); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/argos.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/argos.lus +node argos::argos(a:bool; b:bool) returns (s0:bool; s1:bool; s2:bool); +var + t0:bool; + t1:bool; + x:bool; + y:bool; +let + s0 = true -> pre (s0 and not a); + s1 = false -> pre (s1 or s0 and a and x); + s2 = false -> pre (s2 or s0 and a and not x); + y = s0 and a; + t0 = true -> pre (t0 and not b or t1 and b); + t1 = false -> pre (t1 and not b or t0 and b); + x = t0 and y; +tel +-- end of node argos::argos + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/assertion.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/assertion.lus + +node assertion::assertion( + a:bool; + b:bool; + c:bool; + d:bool) +returns ( + ok:bool); +let + assert(#(a)); + assert(#(a, b)); + assert(#(a, b, c)); + assert(#(a, b, c, d)); + ok = true; +tel +-- end of node assertion::assertion + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/aux.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/aux.lus +node aux::aux(ck:bool) returns (x:int); +let + x = pre (x) + 1; +tel +-- end of node aux::aux + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/aux1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/aux1.lus +node aux1::aux1(a:int; b:int) returns (c:int; d:int); +let + (c, d) = if a > 0 then pre (a, b) else (pre (a) + 1, pre (b) + 1); +tel +-- end of node aux1::aux1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/bascule.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/bascule.lus +node bascule::bascule(r:bool; s:bool) returns (q:bool; n:bool); +let + q = true -> not pre (r) and not pre (n); + n = false -> not pre (s) and not pre (q); +tel +-- end of node bascule::bascule + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/call.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/call.lus +node call::call(a:int; b:bool) returns (x:int; y:int); +var + u:int; + v:int; +let + (u, v) = call::p(a); + (x, y) = call::n(a, b); +tel +-- end of node call::call +extern function call::f(a:int) returns (b:int); +node call::n(a:int; b:bool) returns (x:int; y:int); +let + (x, y) = if b then (call::f(a), 0) else (0, a); +tel +-- end of node call::n +extern function call::p(a:int) returns (x:int; y:int); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck2.lus +node ck2::ck2(c:bool; d:bool when c; e:int when d) returns (n:int); +let + n = if c and current (d) then 0 else current (current (e)); +tel +-- end of node ck2::ck2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck3.lus +node ck3::ck3(a:bool; b:bool when a; c:bool when b) returns (x:bool); +let + x = current (current (c)); +tel +-- end of node ck3::ck3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck4.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck4.lus +node ck4::ck4(a:int when b; b:bool) returns (c:int); +let + c = current (a); +tel +-- end of node ck4::ck4 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck5.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck5.lus +node ck5::ck5(b:bool; c:bool) returns (e:bool); +let + e = current (ck5::edge(b when c)); +tel +-- end of node ck5::ck5 +node ck5::edge(x:bool) returns (y:bool); +let + y = false -> x and not pre (x); +tel +-- end of node ck5::edge + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck6.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck6.lus +node ck6::N(a:bool; m:int; n:int) returns (q:int; r:int when a); +let + q = m + n; + r = q when a; +tel +-- end of node ck6::N +node ck6::ck6(b:bool; c:bool; n:int; m:int) returns (k:int; l:int); +var + u:int when b; + v:int when b; + w:int when b; + cc:bool when b; + x:int when cc; +let + (u, v) = ck6::p(n when b); + (w, x) = ck6::N(cc, u, v); + cc = c when b; + k = current (w); + l = current (current (x)); +tel +-- end of node ck6::ck6 +extern function ck6::p(d:int) returns (e:int; f:int); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck7.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ck7.lus +node ck7::ck7(a:bool; m:int; n:int) returns (q:int; r:int when a); +let + q = m + n; + r = q when a; +tel +-- end of node ck7::ck7 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/clock.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/clock.lus + +extern node clock::all( + a:bool; + b:bool when a) +returns ( + c:bool when b; + d:bool when c); +node clock::clock(in:bool) returns (ok:bool); +var + v1:bool; + v4:bool; + v2:bool when v4; + v3:bool when v1; + v5:bool when v4; + v6:bool when v5; + v7:bool when v6; +let + v1 = clock::inOnIn(in, true when in); + v2 = in when v4; + v3 = clock::outOnIn(in, v1); + (v4, v5) = clock::outOnOut(pre (v4), pre (v4)); + (v6, v7) = clock::all(v4, v5); + ok = boolred<<3, 3, 7>>([v1, current (v2), current (v3), v4, current (v5), + current (current (v6)), current (current (current (v7)))]); +tel +-- end of node clock::clock +extern node clock::inOnIn(a:bool; b:bool when a) returns (c:bool); +extern node clock::outOnIn(a:bool; b:bool) returns (c:bool when b); + +extern node clock::outOnOut( + a:bool; + b:bool) +returns ( + c:bool; + d:bool when c); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/cminus.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/cminus.lus + +node cminus::TWO_BUTTONS( + on:bool; + off:bool; + init:bool) +returns ( + state:bool); +let +tel +-- end of node cminus::TWO_BUTTONS + +node cminus::TWO_STATES( + set:bool; + reset:bool; + init:bool) +returns ( + state:bool); +let + state = init -> if set and not pre (state) then true else if reset and + pre (state) then false else pre (state); +tel +-- end of node cminus::TWO_STATES + +node cminus::cminus( + e1:bool; + e2:bool; + e3:bool; + init:bool) +returns ( + ok:bool); +var + s1:bool; + s2:bool; +let + assert(not e1 and e2 -> true); + s1 = cminus::TWO_STATES(e1, e2, init); + s2 = cminus::TWO_BUTTONS(e1, e2, init); + ok = s1 = s2; +tel +-- end of node cminus::cminus + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/compteur.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/compteur.lus +node compteur::compteur(evt:bool) returns (cpt:int); +let + cpt = 0 -> pre (cpt) + if evt then 1 else 0; +tel +-- end of node compteur::compteur + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/count.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/count.lus +node count::count(x:int; y:int) returns (s:int); +let + s = 2 * x + y; +tel +-- end of node count::count + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/cpt.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/cpt.lus +node cpt::cpt(evt:bool; reset:bool) returns (cpt:int); +let + cpt = if reset then 0 else 0 -> pre (cpt) + if evt then 1 else 0; +tel +-- end of node cpt::cpt + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/cst.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/cst.lus +const cst::i : int; +const cst::j : int; +const cst::k : int; +node cst::cst(x:int) returns (y:int); +var + z:int; + t:int; +let + z = cst::i + cst::j; + t = cst::j - cst::k; + y = x + 2 * z + 3 * t; +tel +-- end of node cst::cst + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/deconne.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/deconne.lus +type deconne::pendule; +const deconne::G = 10.0; +const deconne::L = 2.0; +const deconne::T = 0.1; +extern function deconne::cos(x:real) returns (y:real); +node deconne::deconne(delta:real) returns (p:deconne::pendule); +var + teta:real; + x0:real; + y0:real; + x:real; + y:real; +let + teta = 3.14; + x0 = 0.; + y0 = 0.; + x = x0 + 2.0 * deconne::sin(teta); + y = y0 + 2.0 * deconne::cos(teta); + p = deconne::make_pend(x0, y0, x, y); +tel +-- end of node deconne::deconne + +extern function deconne::make_pend( + x0:real; + y0:real; + x:real; + y:real) +returns ( + p:deconne::pendule); +extern function deconne::sin(x:real) returns (y:real); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/dep.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/dep.lus +node dep::dep(x:int) returns (u:int; v:int; y:int); +let + u = x -> x + pre (x); + v = 0 -> pre (y) + 1; + y = 0 -> pre (v) + 1; +tel +-- end of node dep::dep + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/dependeur.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/dependeur.lus + +node dependeur::dependeur( + time_in_ms:int) +returns ( + hour:int; + minute:int; + second:int; + ms:int); +var + time_in_min:int; + time_in_second:int; +let + hour = time_in_min div 60; + minute = time_in_min mod 60; + time_in_min = time_in_second div 60; + second = time_in_second mod 60; + time_in_second = time_in_ms div 1000; + ms = time_in_ms mod 1000; +tel +-- end of node dependeur::dependeur + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/dependeur_struct.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/dependeur_struct.lus +type dependeur_struct::time = struct {h : int; m : int; s : int; ms : int}; + +node dependeur_struct::dependeur_struct( + time_in_ms:int) +returns ( + theTime:dependeur_struct::time); +var + time_in_min:int; + time_in_second:int; +let + theTime.h = time_in_min div 60; + theTime.m = time_in_min mod 60; + time_in_min = time_in_second div 60; + theTime.s = time_in_second mod 60; + time_in_second = time_in_ms div 1000; + theTime.ms = time_in_ms mod 1000; +tel +-- end of node dependeur_struct::dependeur_struct + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/drapfab.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/drapfab.lus + +node drapfab::drapfab( + bleu:bool; + rouge:bool; + vert:bool) +returns ( + a_or_i:bool; + direct:bool); +var + arret:bool; + indet:bool; +let + assert(#(bleu, rouge, vert)); + assert(bleu or rouge or vert); + direct = false -> rouge and pre (bleu) or vert and pre (rouge) or bleu and + pre (vert); + a_or_i = indet or arret; + indet = true -> rouge and pre (rouge) and not pre (false -> pre (rouge)) + or bleu and pre (bleu) and not pre (false -> pre (bleu)) or vert and pre + (vert) and not pre (false -> pre (vert)); + arret = false -> rouge and pre (rouge) and pre (false -> pre (rouge)) or + bleu and pre (bleu) and pre (false -> pre (bleu)) or vert and pre (vert) + and pre (false -> pre (vert)); +tel +-- end of node drapfab::drapfab + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/enum.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/enum.lus +type enum::color = enum {enum::blue, enum::white, enum::redd}; +type enum::couleur = enum {enum::bleu, enum::blanc, enum::rouge}; +node enum::boo(e:int) returns (c:enum::couleur; c2:enum::color); +let + c = if e = 0 then enum::bleu else if e = 1 then enum::blanc else + enum::rouge; + c2 = if e = 0 then enum::blue else if e = 1 then enum::white else + enum::redd; +tel +-- end of node enum::boo + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/enum0.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/enum0.lus +type enum0::color1 = enum {enum0::blue, enum0::white, enum0::black}; +type enum0::color2 = enum {enum0::green, enum0::orange, enum0::yellow}; + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/eq1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/eq1.lus + +node eq1::eq1( + a:bool; + b:bool; + c:bool; + d:bool; + e:bool) +returns ( + w:bool; + x:bool; + y:bool; + z:bool); +let + assert(not d and e); + w = if b or c then not d and e else false; + x = true; + y = #(c, d); + z = w <> c and not e; +tel +-- end of node eq1::eq1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ex.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/ex.lus +type bool_11 = bool^11 (*abstract in the source*); +type bool_11_22 = bool_11^22 (*abstract in the source*); +type int_1 = int^1 (*abstract in the source*); +type int_1_2 = int_1^2 (*abstract in the source*); +type int_1_2_3 = int_1_2^3 (*abstract in the source*); +type int_1_2_3_4 = int_1_2_3^4 (*abstract in the source*); +type ex::s = struct {x : int_1_2_3_4; y : ex::s1}; +type ex::s1 = struct {x : int; y : int_1_2_3_4}; +type ex::t = int_1_2_3^4; +type ex::t1 = int_1_2_3_4^4; +type ex::t2 = struct {a : int; b : bool_11_22}; +node ex::ex(a:ex::s) returns (b:int); +let + b = a.x[0][0][0][0] + a.y.y[0][0][0][0]; +tel +-- end of node ex::ex + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/exclusion.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/exclusion.lus + +node exclusion::exclusion( + a:bool; + b:bool; + c:bool; + d:bool) +returns ( + xor_a_b:bool; + xor_c_d:bool; + xor_a_b_c:bool; + xor_a_b_c_d:bool; + xor_xor_ab_xor_cd:bool); +let + xor_a_b = #(a, b); + xor_c_d = #(d, c); + xor_a_b_c = #(a, b, c); + xor_a_b_c_d = #(a, b, c, d); + xor_xor_ab_xor_cd = #(#(a, b), #(c, d)); +tel +-- end of node exclusion::exclusion + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/fby.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/fby.lus +node fby::followed_by(ck:bool) returns (x:int); +let + x = 0 -> pre (x) + 1; +tel +-- end of node fby::followed_by + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/flo.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/flo.lus +node flo::SWITCH(init:bool; on:bool; off:bool) returns (state:bool); +let +tel +-- end of node flo::SWITCH + +node flo::flo( + i1:bool; + i2:bool; + on1:bool; + on2:bool; + off1:bool; + off2:bool) +returns ( + flo:bool); +let + flo = flo::SWITCH(i1, on1, off1) and flo::SWITCH(i2, on2, off2); +tel +-- end of node flo::flo + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/fresh_name.lus +I use _0 as prefix for fresh var names. +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/fresh_name.lus +node fresh_name::fn(b:bool) returns (res:bool); +var + _n1e1_1:bool; +let + _n1e1_1 = not b; + res = fresh_name::n1(b, _n1e1_1); +tel +-- end of node fresh_name::fn +node fresh_name::n1(n1e1:bool; n1e2:bool) returns (n1s:bool); +var + n1b1:bool; + n1b2:bool; +let + n1b1 = n1e1 or n1e2; + n1b2 = n1e1 and n1e2; + n1s = n1b1 or n1b2; +tel +-- end of node fresh_name::n1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/hanane.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/hanane.lus +type int_4 = int^4 (*abstract in the source*); +type int_4_4 = int_4^4 (*abstract in the source*); +type int_4_4_4 = int_4_4^4 (*abstract in the source*); +type hanane::string = int^4; +type hanane::string2d = int_4^4; +type hanane::structT = struct {x : int; y : real; z : int_4_4_4}; +type hanane::structT_2 = hanane::structT^2 (*abstract in the source*); +type hanane::t1; +type hanane::t2; +type hanane::t3; +type hanane::tabStruct = hanane::structT^2; +const hanane::a = 4; +const hanane::b = true; +const hanane::c = 3.14; + +node hanane::hanane( + a1:bool; + b1:int_4_4 when a1; + c1:hanane::structT_2 when a1) +returns ( + res:bool when a1); +var + h1:int_4; + h2:hanane::structT_2; + h3:int when a1; + h4:real when a1; + h5:int_4_4_4 when a1; + h6:int_4_4; +let + res = h1[0] > 1 when a1; + h1 = current ( if pre (res) then b1[1] else b1[2]); + h2 = current (c1); + h3 = c1[0].x + c1[1].z[2][1][0]; + h4 = c1[1].y; + h5 = c1[1].z; + h6 = current (c1[1].z[2]); +tel +-- end of node hanane::hanane + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/impl_priority.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/impl_priority.lus +node impl_priority::test_impl_prio(x:int) returns (ok:bool); +let + ok = x = 1 => true; +tel +-- end of node impl_priority::test_impl_prio + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/import1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/import1.lus +extern node import1::imp(x:int) returns (y:int); +node import1::import1(a:int; b:int) returns (c:int); +let + c = import1::imp(a) + import1::imp(b); +tel +-- end of node import1::import1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/initial.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/initial.lus +node initial::initial(justDoIt:bool) returns (oa:bool; ob:int; oc:real); +let + oa = false -> pre (oa); + ob = 42 -> pre (ob); + oc = 42.42 -> pre (oc); +tel +-- end of node initial::initial + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/integrator.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/integrator.lus + +node integrator::integrator( + F:real; + STEP:real; + init:real) +returns ( + Y:real); +let + Y = init -> pre (Y) + F + pre (F) * STEP / 2.0; +tel +-- end of node integrator::integrator + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/long_et_stupide_nom_de_noeud.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/long_et_stupide_nom_de_noeud.lus + +node long_et_stupide_nom_de_noeud::long_et_stupide_nom_de_noeud( + long_parametre:int) +returns ( + long_et_stupide_nom_de_sortie:int); +let + long_et_stupide_nom_de_sortie = long_parametre + pre (long_parametre); +tel +-- end of node long_et_stupide_nom_de_noeud::long_et_stupide_nom_de_noeud + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/merge.lus +*** Error in file "merge.lus", line 7, col 15 to 17, token 'clk': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax1.lus +node minmax1::minmax1(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a < b then (a, b) else (b, a); +tel +-- end of node minmax1::minmax1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax2.lus +node minmax2::minmax(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a < b then (a, b) else (b, a); +tel +-- end of node minmax2::minmax +node minmax2::minmax2(a:int; b:int) returns (min:int; max:int); +let + (min, max) = minmax2::minmax(a, b); +tel +-- end of node minmax2::minmax2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax3.lus +node minmax3::minmax(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a <= b then (a, b) else (b, a); +tel +-- end of node minmax3::minmax + +node minmax3::minmax3( + a:int; + b:int; + c:int) +returns ( + min:int; + midle:int; + MAX:int); +var + min_ab:int; + MAX_ab:int; + MAX_minab_c:int; +let + (min_ab, MAX_ab) = minmax3::minmax(a, b); + (min, MAX_minab_c) = minmax3::minmax(min_ab, c); + (midle, MAX) = minmax3::minmax(MAX_ab, MAX_minab_c); +tel +-- end of node minmax3::minmax3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax4.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax4.lus +node minmax4::minmax(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a <= b then (a, b) else (b, a); +tel +-- end of node minmax4::minmax + +node minmax4::minmax4( + a:int; + b:int; + c:int; + d:int) +returns ( + n1:int; + n2:int; + n3:int; + n4:int); +var + min_ab:int; + MAX_ab:int; + min_cd:int; + MAX_cd:int; + MAX__minab_mincd:int; + min__MAXab_MAXcd:int; +let + (min_ab, MAX_ab) = minmax4::minmax(a, b); + (min_cd, MAX_cd) = minmax4::minmax(c, d); + (n1, MAX__minab_mincd) = minmax4::minmax(min_ab, min_cd); + (min__MAXab_MAXcd, n4) = minmax4::minmax(MAX_ab, MAX_cd); + (n2, n3) = minmax4::minmax(MAX__minab_mincd, min__MAXab_MAXcd); +tel +-- end of node minmax4::minmax4 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax4_bis.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/minmax4_bis.lus +node minmax4_bis::minmax(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a <= b then (a, b) else (b, a); +tel +-- end of node minmax4_bis::minmax + +node minmax4_bis::minmax4_bis( + a:int; + b:int; + c:int; + d:int) +returns ( + n1:int; + n2:int; + n3:int; + n4:int); +var + min_ab:int; + MAX_ab:int; + min_cd:int; + MAX_cd:int; + MAX__minab_mincd:int; + min__MAXab_MAXcd:int; +let + (min_ab, MAX_ab) = minmax4_bis::minmax(a, b); + (n2, n3) = minmax4_bis::minmax(MAX__minab_mincd, min__MAXab_MAXcd); + (n1, MAX__minab_mincd) = minmax4_bis::minmax(min_ab, min_cd); + (min__MAXab_MAXcd, n4) = minmax4_bis::minmax(MAX_ab, MAX_cd); + (min_cd, MAX_cd) = minmax4_bis::minmax(c, d); +tel +-- end of node minmax4_bis::minmax4_bis + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax5.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax5.lus +extern function minmax5::minmax(a:int; b:int) returns (min:int; max:int); + +node minmax5::minmax5( + a:int; + b:int; + c:int; + d:int) +returns ( + n1:int; + n2:int; + n3:int; + n4:int); +var + min_ab:int; + MAX_ab:int; + min_cd:int; + MAX_cd:int; + MAX__minab_mincd:int; + min__MAXab_MAXcd:int; +let + (min_ab, MAX_ab) = minmax5::minmax(a, b); + (min_cd, MAX_cd) = minmax5::minmax(c, d); + (n1, MAX__minab_mincd) = minmax5::minmax(min_ab, min_cd); + (min__MAXab_MAXcd, n4) = minmax5::minmax(MAX_ab, MAX_cd); + (n2, n3) = minmax5::minmax(MAX__minab_mincd, min__MAXab_MAXcd); +tel +-- end of node minmax5::minmax5 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax5_random.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/minmax5_random.lus + +extern function minmax5_random::minmax( + a:int; + b:int) +returns ( + min:int; + max:int); + +node minmax5_random::minmax5_random( + a:int; + b:int; + c:int; + d:int) +returns ( + n1:int; + n2:int; + n3:int; + n4:int); +var + min_ab:int; + MAX_ab:int; + min_cd:int; + MAX_cd:int; + MAX__minab_mincd:int; + min__MAXab_MAXcd:int; +let + (min__MAXab_MAXcd, n4) = minmax5_random::minmax(MAX_ab, MAX_cd); + (min_cd, MAX_cd) = minmax5_random::minmax(c, d); + (n1, MAX__minab_mincd) = minmax5_random::minmax(min_ab, min_cd); + (n2, n3) = minmax5_random::minmax(MAX__minab_mincd, min__MAXab_MAXcd); + (min_ab, MAX_ab) = minmax5_random::minmax(a, b); +tel +-- end of node minmax5_random::minmax5_random + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax6.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/minmax6.lus +node minmax6::minmax(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a <= b then (a, b) else (b, a); +tel +-- end of node minmax6::minmax + +node minmax6::minmax6( + a:int; + b:int; + c:int; + d:int; + e:int; + f:int) +returns ( + n1:int; + n2:int; + n3:int; + n4:int; + n5:int; + n6:int); +var + min_ab:int; + MAX_ab:int; + min_cd:int; + MAX_cd:int; + min_ef:int; + MAX_ef:int; + m1:int; + m2:int; + m4:int; + m5:int; + M1:int; + M2:int; + M3:int; + M5:int; +let + (min_ab, MAX_ab) = minmax6::minmax(a, b); + (min_cd, MAX_cd) = minmax6::minmax(c, d); + (min_ef, MAX_ef) = minmax6::minmax(e, f); + (m1, M1) = minmax6::minmax(min_cd, min_ef); + (m2, M2) = minmax6::minmax(MAX_ab, MAX_cd); + (n1, M3) = minmax6::minmax(min_ab, m1); + (m4, n6) = minmax6::minmax(M2, MAX_ef); + (m5, M5) = minmax6::minmax(M1, m2); + (n2, n3) = minmax6::minmax(M3, m5); + (n4, n5) = minmax6::minmax(M5, m4); +tel +-- end of node minmax6::minmax6 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm.lus +type mm::pair = struct {a : int; b : int}; +type mm::pairpair = struct {a : mm::pair; b : mm::pair}; +node mm::mm(a:int; b:int) returns (min:int; max:int); +let + (min, max) = if a > b then (b, a) else (a, b); +tel +-- end of node mm::mm + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm1.lus +type mm1::pair = struct {a : int; b : int}; +type mm1::pairpair = struct {a : mm1::pair; b : mm1::pair}; +node mm1::mm1(a:int; b:int) returns (y:mm1::pair); +let + (y.a, y.b) = if a > b then (b, a) else (a, b); +tel +-- end of node mm1::mm1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm22.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm22.lus +type mm22::pair = struct {a : int; b : int}; +type mm22::pairpair = struct {a : mm22::pair; b : mm22::pair}; +node mm22::mm22(a:int; b:int) returns (y:mm22::pair); +let + y.a = if a > b then b else a; + y.b = if a > b then a else b; +tel +-- end of node mm22::mm22 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mm3.lus +type mm3::pair = struct {a : int; b : int}; +type mm3::pairpair = struct {a : mm3::pair; b : mm3::pair}; +node mm3::mm3(a:mm3::pair) returns (y:mm3::pair); +let + (y.a, y.b) = if a.a > a.b then (a.b, a.a) else (a.a, a.b); +tel +-- end of node mm3::mm3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/model.lus +I use _0 as prefix for fresh var names. +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/model.lus +type p::elementType = int; +node p::_isEqualTo_(i1:int; i2:int) returns (o:bool); +let + o = u::egal(i1, i2); +tel +-- end of node p::_isEqualTo_ +node p::est_egal(i1:int; i2:int) returns (o:bool); +let + o = p::_isEqualTo_(i1, i2); +tel +-- end of node p::est_egal +node u::egal(i1:int; i2:int) returns (o:bool); +let + o = i1 = i2; +tel +-- end of node u::egal + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/model2.lus +I use _0 as prefix for fresh var names. +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/model2.lus +type p::elementType = int; +type p::elementTypeBis = int; +type p2::elementType = int; +type p2::elementTypeBis = int; +node p::_isEqualTo_(i1:int; i2:int) returns (o:bool); +let + o = u::egal(i1, i2); +tel +-- end of node p::_isEqualTo_ +node p::est_egal(i1:int; i2:int) returns (o:bool); +let + o = p::_isEqualTo_(i1, i2); +tel +-- end of node p::est_egal +node p2::_isEqualTo_(i1:int; i2:int) returns (o:bool); +let + o = Lustre::eq(i1, i2); +tel +-- end of node p2::_isEqualTo_ +node p2::est_egal(i1:int; i2:int) returns (o:bool); +let + o = p2::_isEqualTo_(i1, i2); +tel +-- end of node p2::est_egal +node u::egal(i1:int; i2:int) returns (o:bool); +let + o = i1 = i2; +tel +-- end of node u::egal + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse.lus +node mouse::edge(x:bool) returns (e:bool); +let + e = false -> x and not pre (x); +tel +-- end of node mouse::edge + +node mouse::mouse( + click:bool; + clock:bool; + delay:int) +returns ( + single_click:bool; + double_click:bool); +var + clock_decount:int; + counting:bool; + more_than_one_click:bool; +let + single_click = mouse::edge(not counting) and not false -> pre + (more_than_one_click); + double_click = mouse::edge(not counting) and false -> pre + (more_than_one_click); + more_than_one_click = click and false -> pre (counting); + counting = clock_decount > 0; + clock_decount = if click and true -> not pre (counting) then if clock + then delay - 1 else delay else if clock and false -> pre (counting) then + pre (clock_decount) - 1 else 0 -> pre (clock_decount); +tel +-- end of node mouse::mouse + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse1.lus + +node mouse1::mouse1( + click:bool; + clock:bool; + delay:int) +returns ( + single_click:bool; + double_click:bool); +var + clock_decount:int; + counting:bool; + more_than_one_click:bool; +let + single_click = not counting and not false -> pre (more_than_one_click); + more_than_one_click = click and false -> pre (counting); + double_click = not counting and false -> pre (more_than_one_click); + counting = clock_decount > 0; + clock_decount = if click and true -> not pre (counting) then if clock + then delay - 1 else delay else if clock and false -> pre (counting) then + pre (clock_decount) - 1 else 0 -> pre (clock_decount); +tel +-- end of node mouse1::mouse1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse2.lus +node mouse2::edge(x:bool) returns (e:bool); +let + e = false -> x and not pre (x); +tel +-- end of node mouse2::edge + +node mouse2::mouse2( + click:bool; + clock:bool; + delay:int) +returns ( + single:bool; + double:bool); +var + clock_decount:int; + counting:bool; + more_than_one_click:bool; +let + single = mouse2::edge(not counting) and not false -> pre + (more_than_one_click); + double = mouse2::edge(not counting) and false -> pre + (more_than_one_click); + more_than_one_click = click and false -> pre (counting); + counting = clock_decount > 0; + clock_decount = if click and true -> not pre (counting) then if clock + then delay - 1 else delay else if clock and false -> pre (counting) then + pre (clock_decount) - 1 else 0 -> pre (clock_decount); +tel +-- end of node mouse2::mouse2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/mouse3.lus + +node mouse3::mouse3( + click:bool; + clock:bool; + delay:int) +returns ( + clock_decount:int); +var + counting:bool; +let + counting = clock_decount > 0; + clock_decount = if click and true -> not pre (counting) then if clock + then delay - 1 else delay else if clock and false -> pre (counting) then + pre (clock_decount) - 1 else 0 -> pre (clock_decount); +tel +-- end of node mouse3::mouse3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/multiclock.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/multiclock.lus +node multiclock::moyenne(x:int; y:int) returns (m:int); +var + s:int; +let + m = s / 2; + s = x + y; +tel +-- end of node multiclock::moyenne + +node multiclock::multiclock( + x:int; + y:int; + c:bool; + z:int when c) +returns ( + s:int when c); +var + h:bool when c; + u:int when h; +let + h = true when c -> x + y when c < z; + u = z when h -> multiclock::moyenne(z when h, pre (u)); + s = current (u); +tel +-- end of node multiclock::multiclock + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc1.lus +node nc1::n1(n1e1:bool; n1e2:bool) returns (n1s:bool); +var + n1b1:bool; + n1b2:bool; +let + n1b1 = n1e1 or n1e2; + n1b2 = n1e1 and n1e2; + n1s = n1b1 or n1b2; +tel +-- end of node nc1::n1 +node nc1::nc1(nc1e1:bool; nc1e2:bool) returns (nc1s:bool); +var + nc1b1:bool; +let + nc1b1 = nc1::n1(nc1e1, nc1e2); + nc1s = nc1b1 or nc1e1; +tel +-- end of node nc1::nc1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc10.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc10.lus +node nc10::n1(n1e1:int) returns (n1s:int); +let + n1s = nc10::n2(n1e1, n1e1) + nc10::n2(2 * n1e1, 2 * n1e1); +tel +-- end of node nc10::n1 +node nc10::n2(n2e1:int; n2e2:int) returns (n2s:int); +let + n2s = nc10::n3(n2e1, n2e1) + nc10::n3(n2e2, n2e2); +tel +-- end of node nc10::n2 +node nc10::n3(n3e1:int; n3e2:int) returns (n3s:int); +var + n3i1:int; + n3i2:int; +let + (n3i1, n3i2) = nc10::n4(n3e1, n3e1, n3e2, n3e2); + n3s = n3i1 + n3i2; +tel +-- end of node nc10::n3 + +node nc10::n4( + n4e1:int; + n4e2:int; + n4e3:int; + n4e4:int) +returns ( + n4s1:int; + n4s2:int); +let + n4s1 = n4e1 + n4e2; + n4s2 = n4e3 + n4e4; +tel +-- end of node nc10::n4 +node nc10::nc10(nc10e1:int) returns (ok:bool); +var + nc10b1:int; +let + nc10b1 = nc10::n1(nc10e1); + ok = nc10b1 = nc10e1 * 24; +tel +-- end of node nc10::nc10 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc2.lus +node nc2::n1(n1e1:bool; n1e2:bool) returns (n1s:bool); +var + n1b1:bool; + n1b2:bool; +let + n1b1 = n1e1 or n1e2; + n1b2 = n1e1 and n1e2; + n1s = n1b1 or n1b2; +tel +-- end of node nc2::n1 +node nc2::nc2(nc2e1:bool; nc2e2:bool) returns (nc2s:bool); +var + nc2b1:bool; +let + nc2b1 = nc2::n1(nc2e1 or nc2e2, nc2e1 and nc2e2); + nc2s = nc2b1 and not nc2b1; +tel +-- end of node nc2::nc2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc3.lus +node nc3::n1(n1e1:bool; n1e2:bool) returns (n1s:bool); +var + n1b1:bool; + n1b2:bool; +let + n1b1 = n1e1 or n1e2; + n1b2 = n1e1 and n1e2; + n1s = n1b1 or n1b2; +tel +-- end of node nc3::n1 +node nc3::nc3(nc3e1:bool; nc3e2:bool) returns (nc3s:bool); +var + nc3b1:bool; + nc3b2:bool; +let + nc3b1 = nc3::n1(nc3e1 or nc3e2, nc3e1 and nc3e2); + nc3s = nc3b1 and not nc3b2; + nc3b2 = nc3::n1(nc3e1 and nc3e2, nc3e1 or nc3e2); +tel +-- end of node nc3::nc3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc4.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc4.lus +node nc4::n1(n1e1:bool; n1e2:bool) returns (n1s:bool); +var + n1b1:bool; + n1b2:bool; +let + n1b1 = n1e1 or n1e2; + n1b2 = n1e1 and n1e2; + n1s = n1b1 or n1b2; +tel +-- end of node nc4::n1 +node nc4::n2(n2e1:bool; n2e2:bool) returns (n2s:bool); +var + n2b1:bool; + n2b2:bool; +let + n2b1 = n2e1 and n2e2; + n2b2 = n2e1 or n2e2; + n2s = n2b1 and n2b2; +tel +-- end of node nc4::n2 +node nc4::nc4(nc4e1:bool; nc4e2:bool) returns (nc4s:bool); +var + nc4b1:bool; + nc4b2:bool; +let + nc4b1 = nc4::n1(nc4e1 or nc4e2, nc4e1 and nc4e2); + nc4s = nc4b1 and not nc4b2; + nc4b2 = nc4::n2(nc4e1 and nc4e2, nc4e1 or nc4e2); +tel +-- end of node nc4::nc4 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc5.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc5.lus +node nc5::n1(n1e1:int) returns (n1s:int); +let + n1s = nc5::n2(n1e1); +tel +-- end of node nc5::n1 +node nc5::n2(n2e1:int) returns (n2s:int); +let + n2s = nc5::n3(n2e1); +tel +-- end of node nc5::n2 +node nc5::n3(n3e1:int) returns (n3s:int); +let + n3s = nc5::n4(n3e1); +tel +-- end of node nc5::n3 +node nc5::n4(n4e1:int) returns (n4s:int); +let + n4s = n4e1 + 1; +tel +-- end of node nc5::n4 +node nc5::nc5(nc5e1:int) returns (ok:bool); +var + nc5b1:int; +let + nc5b1 = nc5::n1(nc5e1); + ok = nc5b1 = nc5e1 + 1; +tel +-- end of node nc5::nc5 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc6.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc6.lus +node nc6::n1(n1e1:int) returns (n1s:int); +let + n1s = nc6::n2(n1e1 + 1); +tel +-- end of node nc6::n1 +node nc6::n2(n2e1:int) returns (n2s:int); +let + n2s = nc6::n3(n2e1 + 1); +tel +-- end of node nc6::n2 +node nc6::n3(n3e1:int) returns (n3s:int); +let + n3s = nc6::n4(n3e1 + 1); +tel +-- end of node nc6::n3 +node nc6::n4(n4e1:int) returns (n4s:int); +let + n4s = n4e1 + 1; +tel +-- end of node nc6::n4 +node nc6::nc6(nc6e1:int) returns (ok:bool); +var + nc6b1:int; +let + nc6b1 = nc6::n1(nc6e1); + ok = nc6b1 = nc6e1 + 4; +tel +-- end of node nc6::nc6 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc7.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc7.lus +node nc7::n1(n1e1:int) returns (n1s:int); +let + n1s = nc7::n2(n1e1); +tel +-- end of node nc7::n1 +node nc7::n2(n2e1:int) returns (n2s:int); +let + n2s = nc7::n3(n2e1); +tel +-- end of node nc7::n2 +node nc7::n3(n3e1:int) returns (n3s:int); +let + n3s = nc7::n4(n3e1, n3e1, n3e1, n3e1, n3e1); +tel +-- end of node nc7::n3 + +node nc7::n4( + n4e1:int; + n4e2:int; + n4e3:int; + n4e4:int; + n4e5:int) +returns ( + n4s:int); +let + n4s = n4e1 + n4e2 + n4e3 + n4e4 + n4e5; +tel +-- end of node nc7::n4 +node nc7::nc7(nc7e1:int) returns (ok:bool); +var + nc7b1:int; +let + nc7b1 = nc7::n1(nc7e1); + ok = nc7b1 = nc7e1 * 5; +tel +-- end of node nc7::nc7 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc8.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc8.lus +node nc8::n1(n1e1:int) returns (n1s:int); +let + n1s = nc8::n2(n1e1, n1e1) + nc8::n2(n1e1, n1e1); +tel +-- end of node nc8::n1 +node nc8::n2(n2e1:int; n2e2:int) returns (n2s:int); +let + n2s = nc8::n3(n2e1, n2e1) + nc8::n3(n2e2, n2e2); +tel +-- end of node nc8::n2 +node nc8::n3(n3e1:int; n3e2:int) returns (n3s:int); +let + n3s = nc8::n4(n3e1, n3e1, n3e1, n3e1) + nc8::n4(n3e2, n3e2, n3e2, n3e2); +tel +-- end of node nc8::n3 +node nc8::n4(n4e1:int; n4e2:int; n4e3:int; n4e4:int) returns (n4s:int); +let + n4s = n4e1 + n4e2 + n4e3 + n4e4; +tel +-- end of node nc8::n4 +node nc8::nc8(nc8e1:int) returns (ok:bool); +var + nc8b1:int; +let + nc8b1 = nc8::n1(nc8e1); + ok = nc8b1 = nc8e1 * 32; +tel +-- end of node nc8::nc8 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc9.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nc9.lus +node nc9::n1(n1e1:int) returns (n1s:int); +let + n1s = nc9::n2(n1e1, n1e1) + nc9::n2(n1e1, n1e1); +tel +-- end of node nc9::n1 +node nc9::n2(n2e1:int; n2e2:int) returns (n2s:int); +let + n2s = nc9::n3(n2e1, n2e1) + nc9::n3(n2e2, n2e2); +tel +-- end of node nc9::n2 +node nc9::n3(n3e1:int; n3e2:int) returns (n3s:int); +var + n3i1:int; + n3i2:int; +let + (n3i1, n3i2) = nc9::n4(n3e1, n3e1, n3e2, n3e2); + n3s = n3i1 + n3i2; +tel +-- end of node nc9::n3 + +node nc9::n4( + n4e1:int; + n4e2:int; + n4e3:int; + n4e4:int) +returns ( + n4s1:int; + n4s2:int); +let + n4s1 = n4e1 + n4e2; + n4s2 = n4e3 + n4e4; +tel +-- end of node nc9::n4 +node nc9::nc9(nc9e1:int) returns (ok:bool); +var + nc9b1:int; +let + nc9b1 = nc9::n1(nc9e1); + ok = nc9b1 = nc9e1 * 16; +tel +-- end of node nc9::nc9 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nested.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/nested.lus +type int_3 = int^3 (*abstract in the source*); +type int_3_5 = int_3^5 (*abstract in the source*); +type int_3_5_42 = int_3_5^42 (*abstract in the source*); +node nested::incr(x:int) returns (y:int); +let + y = x + 1; +tel +-- end of node nested::incr +node nested::toto(x:int_3_5_42) returns (y:int_3_5_42); +let + y = Lustre::map<<Lustre::map<<Lustre::map<<nested::incr, 3>>, 5>>, + 42>>(x); +tel +-- end of node nested::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/node_caller1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/node_caller1.lus +node node_caller1::ex1(a:int) returns (b:int); +let + b = node_caller1::ex2(a) + 1; +tel +-- end of node node_caller1::ex1 +node node_caller1::ex2(a:int) returns (b:int); +let + b = node_caller1::ex3(a) + 2; +tel +-- end of node node_caller1::ex2 +node node_caller1::ex3(a:int) returns (b:int); +let + b = node_caller1::ex4(a) + 3; +tel +-- end of node node_caller1::ex3 +node node_caller1::ex4(a:int) returns (b:int); +let + b = node_caller1::ex5(a) + 4; +tel +-- end of node node_caller1::ex4 +node node_caller1::ex5(a:int) returns (b:int); +let + b = a - 700000; +tel +-- end of node node_caller1::ex5 +node node_caller1::node_caller1(a:int) returns (b:int); +let + b = node_caller1::ex1(a); +tel +-- end of node node_caller1::node_caller1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/o2l_feux_compl.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/o2l_feux_compl.lus + +node o2l_feux_compl::o2l_feux_compl( + TD:bool; + TI:bool; + CP:bool; + AB:bool; + LP:bool) +returns ( + veilleuses:bool; + codes:bool; + phares:bool; + anti_b:bool; + longue_p:bool); +var + o2l_A_0:bool; + o2l_P_0:bool; + o2l_A_1:bool; + o2l_P_1:bool; + o2l_A_2:bool; + o2l_P_2:bool; + o2l_A_3:bool; + o2l_P_3:bool; + o2l_A_4:bool; + o2l_P_4:bool; + o2l_A_5:bool; + o2l_P_5:bool; + o2l_A_6:bool; + o2l_P_6:bool; + o2l_A_7:bool; + o2l_P_7:bool; + o2l_A_8:bool; + o2l_P_8:bool; + o2l_A_9:bool; + o2l_P_9:bool; + o2l_A_10:bool; + o2l_P_10:bool; + o2l_A_11:bool; + o2l_P_11:bool; + o2l_A_12:bool; + o2l_P_12:bool; + o2l_A_13:bool; + o2l_P_13:bool; + o2l_A_14:bool; + o2l_P_14:bool; + o2l_A_15:bool; + o2l_P_15:bool; +let + assert(#(o2l_A_0, o2l_A_1, o2l_A_2, o2l_A_3, o2l_A_4, o2l_A_5, o2l_A_6, + o2l_A_7, o2l_A_8, o2l_A_9, o2l_A_10, o2l_A_11, o2l_A_12, o2l_A_13, + o2l_A_14, o2l_A_15)); + assert(#(o2l_P_0, o2l_P_1, o2l_P_2, o2l_P_3, o2l_P_4, o2l_P_5, o2l_P_6, + o2l_P_7, o2l_P_8, o2l_P_9, o2l_P_10, o2l_P_11, o2l_P_12, o2l_P_13, + o2l_P_14, o2l_P_15)); + o2l_P_0 = true -> pre (o2l_A_0); + o2l_A_0 = o2l_P_0 and not TD and not AB and not LP or o2l_P_1 and not TD + and not AB and LP or o2l_P_2 and not TD and AB and LP or o2l_P_3 and not TD + and AB and not LP or o2l_P_4 and TI and if TD then AB and LP else AB and + LP or o2l_P_5 and TI and if TD then AB and not LP else AB and not LP or + o2l_P_6 and TI and if TD then not AB and LP else not AB and LP or o2l_P_7 + and TI and if TD then not AB and not LP else not AB and not LP; + o2l_P_1 = false -> pre (o2l_A_1); + o2l_A_1 = o2l_P_0 and not TD and not AB and LP or o2l_P_1 and not TD and + not AB and not LP or o2l_P_2 and not TD and AB and not LP or o2l_P_3 and + not TD and AB and LP or o2l_P_4 and TI and if TD then AB and not LP else + AB and not LP or o2l_P_5 and TI and if TD then AB and LP else AB and LP or + o2l_P_6 and TI and if TD then not AB and not LP else not AB and not LP or + o2l_P_7 and TI and if TD then not AB and LP else not AB and LP; + o2l_P_2 = false -> pre (o2l_A_2); + o2l_A_2 = o2l_P_0 and not TD and AB and LP or o2l_P_1 and not TD and AB + and not LP or o2l_P_2 and not TD and not AB and not LP or o2l_P_3 and not + TD and not AB and LP or o2l_P_4 and TI and if TD then not AB and not LP + else not AB and not LP or o2l_P_5 and TI and if TD then not AB and LP else + not AB and LP or o2l_P_6 and TI and if TD then AB and not LP else AB and + not LP or o2l_P_7 and TI and if TD then AB and LP else AB and LP; + o2l_P_3 = false -> pre (o2l_A_3); + o2l_A_3 = o2l_P_0 and not TD and AB and not LP or o2l_P_1 and not TD and + AB and LP or o2l_P_2 and not TD and not AB and LP or o2l_P_3 and not TD and + not AB and not LP or o2l_P_4 and TI and if TD then not AB and LP else not + AB and LP or o2l_P_5 and TI and if TD then not AB and not LP else not AB + and not LP or o2l_P_6 and TI and if TD then AB and LP else AB and LP or + o2l_P_7 and TI and if TD then AB and not LP else AB and not LP; + o2l_P_4 = false -> pre (o2l_A_4); + o2l_A_4 = o2l_P_0 and TD and AB and LP or o2l_P_1 and TD and AB and not LP + or o2l_P_2 and TD and not AB and not LP or o2l_P_3 and TD and not AB and LP + or o2l_P_4 and not TI and not TD and not AB and not LP or o2l_P_5 and not + TI and not TD and not AB and LP or o2l_P_6 and not TI and not TD and AB and + not LP or o2l_P_7 and not TI and not TD and AB and LP or o2l_P_8 and TI and + if CP then not AB and not LP else not AB and not LP or o2l_P_9 and TI and + if CP then not AB and LP else not AB and LP or o2l_P_10 and TI and if CP + then AB and not LP else AB and not LP or o2l_P_11 and TI and if CP then AB + and LP else AB and LP or o2l_P_12 and TI and not AB and not LP or o2l_P_13 + and TI and not AB and LP or o2l_P_14 and TI and AB and not LP or o2l_P_15 + and TI and AB and LP; + o2l_P_5 = false -> pre (o2l_A_5); + o2l_A_5 = o2l_P_0 and TD and AB and not LP or o2l_P_1 and TD and AB and LP + or o2l_P_2 and TD and not AB and LP or o2l_P_3 and TD and not AB and not LP + or o2l_P_4 and not TI and not TD and not AB and LP or o2l_P_5 and not TI + and not TD and not AB and not LP or o2l_P_6 and not TI and not TD and AB + and LP or o2l_P_7 and not TI and not TD and AB and not LP or o2l_P_8 and TI + and if CP then not AB and LP else not AB and LP or o2l_P_9 and TI and if + CP then not AB and not LP else not AB and not LP or o2l_P_10 and TI and if + CP then AB and LP else AB and LP or o2l_P_11 and TI and if CP then AB and + not LP else AB and not LP or o2l_P_12 and TI and not AB and LP or o2l_P_13 + and TI and not AB and not LP or o2l_P_14 and TI and AB and LP or o2l_P_15 + and TI and AB and not LP; + o2l_P_6 = false -> pre (o2l_A_6); + o2l_A_6 = o2l_P_0 and TD and not AB and LP or o2l_P_1 and TD and not AB + and not LP or o2l_P_2 and TD and AB and not LP or o2l_P_3 and TD and AB and + LP or o2l_P_4 and not TI and not TD and AB and not LP or o2l_P_5 and not TI + and not TD and AB and LP or o2l_P_6 and not TI and not TD and not AB and + not LP or o2l_P_7 and not TI and not TD and not AB and LP or o2l_P_8 and TI + and if CP then AB and not LP else AB and not LP or o2l_P_9 and TI and if + CP then AB and LP else AB and LP or o2l_P_10 and TI and if CP then not AB + and not LP else not AB and not LP or o2l_P_11 and TI and if CP then not AB + and LP else not AB and LP or o2l_P_12 and TI and AB and not LP or o2l_P_13 + and TI and AB and LP or o2l_P_14 and TI and not AB and not LP or o2l_P_15 + and TI and not AB and LP; + o2l_P_7 = false -> pre (o2l_A_7); + o2l_A_7 = o2l_P_0 and TD and not AB and not LP or o2l_P_1 and TD and not + AB and LP or o2l_P_2 and TD and AB and LP or o2l_P_3 and TD and AB and not + LP or o2l_P_4 and not TI and not TD and AB and LP or o2l_P_5 and not TI and + not TD and AB and not LP or o2l_P_6 and not TI and not TD and not AB and LP + or o2l_P_7 and not TI and not TD and not AB and not LP or o2l_P_8 and TI + and if CP then AB and LP else AB and LP or o2l_P_9 and TI and if CP then + AB and not LP else AB and not LP or o2l_P_10 and TI and if CP then not AB + and LP else not AB and LP or o2l_P_11 and TI and if CP then not AB and not + LP else not AB and not LP or o2l_P_12 and TI and AB and LP or o2l_P_13 and + TI and AB and not LP or o2l_P_14 and TI and not AB and LP or o2l_P_15 and + TI and not AB and not LP; + o2l_P_8 = false -> pre (o2l_A_8); + o2l_A_8 = o2l_P_4 and not TI and TD and not AB and not LP or o2l_P_5 and + not TI and TD and not AB and LP or o2l_P_6 and not TI and TD and AB and not + LP or o2l_P_7 and not TI and TD and AB and LP or o2l_P_8 and not TI and not + CP and not AB and not LP or o2l_P_9 and not TI and not CP and not AB and LP + or o2l_P_10 and not TI and not CP and AB and not LP or o2l_P_11 and not TI + and not CP and AB and LP or o2l_P_12 and not TI and CP and not AB and not + LP or o2l_P_13 and not TI and CP and not AB and LP or o2l_P_14 and not TI + and CP and AB and not LP or o2l_P_15 and not TI and CP and AB and LP; + o2l_P_9 = false -> pre (o2l_A_9); + o2l_A_9 = o2l_P_4 and not TI and TD and not AB and LP or o2l_P_5 and not + TI and TD and not AB and not LP or o2l_P_6 and not TI and TD and AB and LP + or o2l_P_7 and not TI and TD and AB and not LP or o2l_P_8 and not TI and + not CP and not AB and LP or o2l_P_9 and not TI and not CP and not AB and + not LP or o2l_P_10 and not TI and not CP and AB and LP or o2l_P_11 and not + TI and not CP and AB and not LP or o2l_P_12 and not TI and CP and not AB + and LP or o2l_P_13 and not TI and CP and not AB and not LP or o2l_P_14 and + not TI and CP and AB and LP or o2l_P_15 and not TI and CP and AB and not + LP; + o2l_P_10 = false -> pre (o2l_A_10); + o2l_A_10 = o2l_P_4 and not TI and TD and AB and not LP or o2l_P_5 and not + TI and TD and AB and LP or o2l_P_6 and not TI and TD and not AB and not LP + or o2l_P_7 and not TI and TD and not AB and LP or o2l_P_8 and not TI and + not CP and AB and not LP or o2l_P_9 and not TI and not CP and AB and LP or + o2l_P_10 and not TI and not CP and not AB and not LP or o2l_P_11 and not TI + and not CP and not AB and LP or o2l_P_12 and not TI and CP and AB and not + LP or o2l_P_13 and not TI and CP and AB and LP or o2l_P_14 and not TI and + CP and not AB and not LP or o2l_P_15 and not TI and CP and not AB and LP; + o2l_P_11 = false -> pre (o2l_A_11); + o2l_A_11 = o2l_P_4 and not TI and TD and AB and LP or o2l_P_5 and not TI + and TD and AB and not LP or o2l_P_6 and not TI and TD and not AB and LP or + o2l_P_7 and not TI and TD and not AB and not LP or o2l_P_8 and not TI and + not CP and AB and LP or o2l_P_9 and not TI and not CP and AB and not LP or + o2l_P_10 and not TI and not CP and not AB and LP or o2l_P_11 and not TI and + not CP and not AB and not LP or o2l_P_12 and not TI and CP and AB and LP or + o2l_P_13 and not TI and CP and AB and not LP or o2l_P_14 and not TI and CP + and not AB and LP or o2l_P_15 and not TI and CP and not AB and not LP; + o2l_P_12 = false -> pre (o2l_A_12); + o2l_A_12 = o2l_P_8 and not TI and CP and not AB and not LP or o2l_P_9 and + not TI and CP and not AB and LP or o2l_P_10 and not TI and CP and AB and + not LP or o2l_P_11 and not TI and CP and AB and LP or o2l_P_12 and not TI + and not CP and not LP and not AB or o2l_P_13 and not TI and not CP and LP + and not AB or o2l_P_14 and not TI and not CP and not LP and AB or o2l_P_15 + and not TI and not CP and LP and AB; + o2l_P_13 = false -> pre (o2l_A_13); + o2l_A_13 = o2l_P_8 and not TI and CP and not AB and LP or o2l_P_9 and not + TI and CP and not AB and not LP or o2l_P_10 and not TI and CP and AB and LP + or o2l_P_11 and not TI and CP and AB and not LP or o2l_P_12 and not TI and + not CP and LP and not AB or o2l_P_13 and not TI and not CP and not LP and + not AB or o2l_P_14 and not TI and not CP and LP and AB or o2l_P_15 and not + TI and not CP and not LP and AB; + o2l_P_14 = false -> pre (o2l_A_14); + o2l_A_14 = o2l_P_8 and not TI and CP and AB and not LP or o2l_P_9 and not + TI and CP and AB and LP or o2l_P_10 and not TI and CP and not AB and not LP + or o2l_P_11 and not TI and CP and not AB and LP or o2l_P_12 and not TI and + not CP and not LP and AB or o2l_P_13 and not TI and not CP and LP and AB or + o2l_P_14 and not TI and not CP and not LP and not AB or o2l_P_15 and not TI + and not CP and LP and not AB; + o2l_P_15 = false -> pre (o2l_A_15); + o2l_A_15 = o2l_P_8 and not TI and CP and AB and LP or o2l_P_9 and not TI + and CP and AB and not LP or o2l_P_10 and not TI and CP and not AB and LP or + o2l_P_11 and not TI and CP and not AB and not LP or o2l_P_12 and not TI and + not CP and LP and AB or o2l_P_13 and not TI and not CP and not LP and AB or + o2l_P_14 and not TI and not CP and LP and not AB or o2l_P_15 and not TI and + not CP and not LP and not AB; + veilleuses = o2l_P_0 and TD or o2l_P_1 and TD or o2l_P_2 and TD or o2l_P_3 + and TD or o2l_P_4 and not TI and not TD or o2l_P_5 and not TI and not TD or + o2l_P_6 and not TI and not TD or o2l_P_7 and not TI and not TD or o2l_P_8 + and TI or o2l_P_9 and TI or o2l_P_10 and TI or o2l_P_11 and TI or o2l_P_12 + and TI or o2l_P_13 and TI or o2l_P_14 and TI or o2l_P_15 and TI; + codes = o2l_P_4 and if TI then TD else TD or o2l_P_5 and if TI then TD + else TD or o2l_P_6 and if TI then TD else TD or o2l_P_7 and if TI then TD + else TD or o2l_P_8 and not TI and not CP or o2l_P_9 and not TI and not CP + or o2l_P_10 and not TI and not CP or o2l_P_11 and not TI and not CP or + o2l_P_12 and not TI and CP or o2l_P_13 and not TI and CP or o2l_P_14 and + not TI and CP or o2l_P_15 and not TI and CP; + phares = o2l_P_8 and if TI then CP else CP or o2l_P_9 and if TI then CP + else CP or o2l_P_10 and if TI then CP else CP or o2l_P_11 and if TI then + CP else CP or o2l_P_12 and not TI and not CP or o2l_P_13 and not TI and not + CP or o2l_P_14 and not TI and not CP or o2l_P_15 and not TI and not CP; + anti_b = o2l_P_4 and if TI then TD else TD or o2l_P_5 and if TI then TD + else TD or o2l_P_8 and not TI and not CP and not AB or o2l_P_9 and not TI + and not CP and not AB or o2l_P_10 and not TI and not CP and AB or o2l_P_11 + and not TI and not CP and AB or o2l_P_12 and not TI and CP or o2l_P_13 and + not TI and CP; + longue_p = o2l_P_8 and if TI then CP else CP or o2l_P_10 and if TI then + CP else CP or o2l_P_12 and not TI and not CP and not LP or o2l_P_13 and not + TI and not CP and LP or o2l_P_14 and not TI and not CP and not LP or + o2l_P_15 and not TI and not CP and LP; +tel +-- end of node o2l_feux_compl::o2l_feux_compl + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/packed_cst.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/packed_cst.lus +const cst::i = 1; +const cst::j = 1; +const cst::k = 1; +node cst::cst(x:int) returns (y:int); +var + z:int; + t:int; +let + z = 1 + 1; + t = 1 - 1; + y = x + 2 * z + 3 * t; +tel +-- end of node cst::cst + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/param_node.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/param_node.lus +type int_3 = int^3 (*abstract in the source*); +node param_node::toto_3(a:int) returns (x:int_3); +let + x = toto_n_iplus_3(a); +tel +-- end of node param_node::toto_3 +node toto_n_iplus_3(a:int) returns (x:int_3); +var + v:int; +let + v = Lustre::iplus(a, 1); + x = v^3; +tel +-- end of node toto_n_iplus_3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/param_node2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/param_node2.lus +type bool_4 = bool^4 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +node mk_tab_bool_true_4(a:bool) returns (res:bool_4); +let + res = true^4; +tel +-- end of node mk_tab_bool_true_4 +node mk_tab_int_0_3(a:int) returns (res:int_3); +let + res = 0^3; +tel +-- end of node mk_tab_int_0_3 +node param_node2::tab_bool4(a:bool) returns (res:bool_4); +let + res = mk_tab_bool_true_4(a); +tel +-- end of node param_node2::tab_bool4 +node param_node2::tab_int3(a:int) returns (res:int_3); +let + res = mk_tab_int_0_3(a); +tel +-- end of node param_node2::tab_int3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/param_node3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/param_node3.lus +type int_3 = int^3 (*abstract in the source*); +node mk_tab_int_0_3(a:int) returns (res:int_3); +let + res = 0^3; +tel +-- end of node mk_tab_int_0_3 +node titi_int(a:int) returns (res:int_3); +let + res = mk_tab_int_0_3(a); +tel +-- end of node titi_int +node param_node3::xxx(a:int) returns (res:int_3); +let + res = titi_int(a); +tel +-- end of node param_node3::xxx + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/param_node4.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/param_node4.lus +type int_3 = int^3 (*abstract in the source*); +node param_node4::monplus(i1:int; i2:int) returns (o:int); +let + o = Lustre::iplus(i1, i2); +tel +-- end of node param_node4::monplus +node param_node4::toto_3(a:int) returns (x:int_3); +let + x = toto_n_monplus_3(a); +tel +-- end of node param_node4::toto_3 +node toto_n_monplus_3(a:int) returns (x:int_3); +var + v:int; +let + v = param_node4::monplus(a, 1); + x = v^3; +tel +-- end of node toto_n_monplus_3 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/param_struct.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/param_struct.lus +type param_struct::toto = struct {a : int; b : int}; +type param_struct::toto_3 = param_struct::toto^3 (*abstract in the source*); +const param_struct::c = param_struct::toto{a = 1; b = 1}; + +node mk_tab_param_struct::toto_toto_3( + a:param_struct::toto) +returns ( + res:param_struct::toto_3); +let + res = param_struct::toto{a=1;b=1}^3; +tel +-- end of node mk_tab_param_struct::toto_toto_3 + +node param_struct::tab_toto( + a:param_struct::toto) +returns ( + res:param_struct::toto_3); +let + res = mk_tab_param_struct::toto_toto_3(a); +tel +-- end of node param_struct::tab_toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/patrick.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/patrick.lus +node patrick::patrick(a:int; b:int; c:bool; d:bool) returns (s:int); +let + s = if c then a else 1 + if d then b else 4; +tel +-- end of node patrick::patrick + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/poussoir.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/poussoir.lus +node poussoir::ONE_BUTTON(change:bool; init:bool) returns (state:bool); +let + state = init -> if change then not pre (state) else pre (state); +tel +-- end of node poussoir::ONE_BUTTON + +node poussoir::TWO_STATES( + set:bool; + reset:bool; + init:bool) +returns ( + state:bool); +let + state = init -> if set and not pre (state) then true else if reset and + pre (state) then false else pre (state); +tel +-- end of node poussoir::TWO_STATES +node poussoir::poussoir(e3:bool; init:bool) returns (s3:bool; s4:bool); +let + s3 = poussoir::TWO_STATES(e3, e3, init); + s4 = poussoir::ONE_BUTTON(e3, init); +tel +-- end of node poussoir::poussoir + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/rs.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/rs.lus +node rs::rs(r:bool; s:bool) returns (q:bool); +var + n:bool; +let + q = false -> not pre (r) and not pre (n); + n = true -> not pre (s) and not pre (q); +tel +-- end of node rs::rs + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/s.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/s.lus +node s::s(a:int; b:int) returns (t:int); +let + assert(a = 0); + t = b; +tel +-- end of node s::s + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/simple.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/simple.lus +type simple::H = struct {x : simple::S; y : int}; +type simple::S; +type simple::T = int; +type simple::U = struct {a : int; b : simple::H}; +type simple::V = simple::U^4; +type simple::W = int^18; +const simple::c = true; +const simple::pi = 3.1416; +const simple::size = 16; +const simple::u = false; +extern function simple::f1(x:int) returns (y:int); +extern function simple::f2(u:int; v:int) returns (s:int; t:bool); +node simple::simple(e:bool; a:simple::U) returns (b:int); +var + x:int; +let + assert(e or a.a = 0); + x = a.a; + b = x + 1; +tel +-- end of node simple::simple + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/sincos.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/sincos.lus +node sincos::integrator(F:real; STEP:real; init:real) returns (Y:real); +let + Y = init -> pre (Y) + F + pre (F) * STEP / 2.0; +tel +-- end of node sincos::integrator +node sincos::sincos(omega:real) returns (sin:real; cos:real); +let + sin = omega * sincos::integrator(cos, 0.1, 0.0); + cos = omega * sincos::integrator(-sin, 0.1, 1.0); +tel +-- end of node sincos::sincos + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/speedcontrol.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/speedcontrol.lus +node speedcontrol::f(x:int) returns (y:int); +let + y = 0 -> pre (x) + 1; +tel +-- end of node speedcontrol::f +node speedcontrol::speedcontrol(c:bool) returns (counter:int); +let + counter = 0 -> speedcontrol::f(counter); +tel +-- end of node speedcontrol::speedcontrol + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/stopwatch.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/stopwatch.lus + +node stopwatch::simple_stopwatch( + time_unit:bool; + reset:bool; + start_stop:bool) +returns ( + time:int; + running:bool); +let + time = 0 -> if reset then 0 else if running and time_unit then pre + (time) + 1 else pre (time); + running = false -> if start_stop then not pre (running) else pre + (running); +tel +-- end of node stopwatch::simple_stopwatch + +node stopwatch::stopwatch( + time_unit:bool; + b1:bool; + b2:bool) +returns ( + time:int); +var + running:bool; + frozen:bool; + start_stop:bool; + reset:bool; + lap:bool; + internal_time:int; +let + (internal_time, running) = stopwatch::simple_stopwatch(time_unit, reset, + start_stop); + frozen = false -> if lap then not pre (frozen) else pre (frozen); + start_stop = b1; + reset = b2 and true -> not pre (running or frozen); + lap = b2 and false -> pre (running or frozen); + time = if frozen then pre (time) else internal_time; +tel +-- end of node stopwatch::stopwatch + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/testCA.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/testCA.lus + +node testCA::testCA( + time_in_ms:int) +returns ( + hour:int; + minute:int; + second:int; + ms:int); +var + time_in_min:int; + time_in_second:int; +let + hour = time_in_min div 60; + minute = time_in_min mod 60; + time_in_min = time_in_second div 60; + second = time_in_second mod 60; + time_in_second = time_in_ms div 1000; + ms = time_in_ms mod 1000; +tel +-- end of node testCA::testCA + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/test_clash.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/test_clash.lus +type test::t = bool; +const test::c = true; +node test::toto(x:bool) returns (y:bool); +let + y = test::tutu(x) and true; +tel +-- end of node test::toto +node test::tutu(x:bool) returns (y:bool); +let + y = x; +tel +-- end of node test::tutu + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/test_const.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/test_const.lus +type test_const::t_PACQ_bin_inputs = struct {valeur : bool; validite : bool}; +type test_const::t_binary = struct {valeur : bool; validite : bool}; +const test_const::PAS_DE_COMMANDE_PACQbis = test_const::t_binary{valeur = true; validite = false}; +const test_const::toto = true; + +node test_const::TDF_sans_PACQ( + dummy:bool) +returns ( + BINARY_INPUTS_PACQ_DIV_I:test_const::t_binary); +let + BINARY_INPUTS_PACQ_DIV_I = + test_const::t_binary{valeur=true;validite=false}; +tel +-- end of node test_const::TDF_sans_PACQ + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/test_node_expand.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/test_node_expand.lus +node test_node_expand::n(x:int; y:int) returns (a:int; b:int); +var + v1:int; + v2:int; +let + v1 = x + y; + v2 = x * y; + a = v1 * x; + b = v2 * y; +tel +-- end of node test_node_expand::n +node test_node_expand::test(i1:int; i2:int) returns (o1:int; o2:int); +let + (o1, o2) = test_node_expand::n(i1, i2); +tel +-- end of node test_node_expand::test + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/test_node_expand2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/test_node_expand2.lus +type int_2 = int^2 (*abstract in the source*); +node test_node_expand2::f(i:int) returns (o:int); +let + o = i + 1; +tel +-- end of node test_node_expand2::f +node test_node_expand2::n(x:int; y:int) returns (a:int; b:int); +var + v1:int; + v2:int; +let + assert(x > v1 + a); + v1 = x + y; + v2 = x * y; + a = v1 * x; + b = v2 * y; +tel +-- end of node test_node_expand2::n +node test_node_expand2::test(i:int_2) returns (o1:int; o2:int); +let + assert(i[1] <= o1 + o2); + (o1, o2) = test_node_expand2::n(i[0], + test_node_expand2::f(test_node_expand2::f(i[1]) + i[0])); +tel +-- end of node test_node_expand2::test + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/trivial.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/trivial.lus +node trivial::edge(x:bool) returns (e:bool); +let + e = false -> x and not pre (x); +tel +-- end of node trivial::edge +node trivial::trivial(x:bool) returns (y:bool); +let + y = trivial::edge(x); +tel +-- end of node trivial::trivial + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/trivial2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/trivial2.lus +node trivial2::edge(x:bool) returns (e:bool); +let + e = false -> x and not pre (x); +tel +-- end of node trivial2::edge +node trivial2::trivial2(x:bool) returns (y:bool); +let + y = trivial2::edge(trivial2::edge(x)); +tel +-- end of node trivial2::trivial2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/tuple.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/tuple.lus +node tuple::toto(x:int) returns (a:int; b:int; c:int); +let + (a, b, c) = if true then (x, x, x) else (x, x, x); +tel +-- end of node tuple::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/type_decl.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/NONREG/type_decl.lus +type type_decl::alias = int; +type type_decl::color = enum {type_decl::blue, type_decl::white, type_decl::black}; +type type_decl::pair = struct {a : int; b : int}; + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/uu.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/uu.lus +node uu::uu(x:bool; y:bool; z:bool) returns (a:bool); +var + V112_X:bool; + V111_X:bool; + V119_X:bool; + V118_X:bool; + V126_X:bool; + V125_X:bool; + V135_A_forbiden:bool; + V136_B_forbiden:bool; +let + a = not V111_X and V135_A_forbiden and not V125_X and V136_B_forbiden; + V112_X = false -> pre (y or V112_X); + V111_X = if y then x else if V112_X then x or pre (V111_X) else true; + V119_X = false -> pre (y or V119_X); + V118_X = if y then x else if V119_X then x and pre (V118_X) else true; + V126_X = false -> pre (V118_X or V126_X); + V125_X = if V118_X then z else if V126_X then z or pre (V125_X) else + true; + V135_A_forbiden = false -> if pre (V111_X) and not V111_X then true else + if pre (V125_X) and not V125_X then false else pre (V135_A_forbiden); + V136_B_forbiden = true -> if pre (V125_X) and not V125_X then true else + if pre (V111_X) and not V111_X then false else pre (V136_B_forbiden); +tel +-- end of node uu::uu + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/v1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/NONREG/v1.lus +node v1::v1(m:int; b:bool) returns (n:int); +let + n = if b then m else m - 1; +tel +-- end of node v1::v1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/access.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/access.lus +type int_1 = int^1 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type int_8 = int^8 (*abstract in the source*); +type real_1 = real^1 (*abstract in the source*); +type real_2 = real^2 (*abstract in the source*); +type real_4 = real^4 (*abstract in the source*); +type real_8 = real^8 (*abstract in the source*); +node quick_access_int_1_m1(tab:int_1; ix:int) returns (res:int); +let + res = if ix = 0 then tab[0] else -1; +tel +-- end of node quick_access_int_1_m1 +node quick_access_int_2_m1(tab:int_2; ix:int) returns (res:int); +let + res = if ix < 1 then quick_access_int_1_m1(tab[0 .. 0], ix) else + quick_access_int_1_m1(tab[1 .. 1], ix - 1); +tel +-- end of node quick_access_int_2_m1 +node quick_access_int_4_m1(tab:int_4; ix:int) returns (res:int); +let + res = if ix < 2 then quick_access_int_2_m1(tab[0 .. 1], ix) else + quick_access_int_2_m1(tab[2 .. 3], ix - 2); +tel +-- end of node quick_access_int_4_m1 +node quick_access_int_8_m1(tab:int_8; ix:int) returns (res:int); +let + res = if ix < 4 then quick_access_int_4_m1(tab[0 .. 3], ix) else + quick_access_int_4_m1(tab[4 .. 7], ix - 4); +tel +-- end of node quick_access_int_8_m1 + +node quick_access_real_1_m0d314ep1( + tab:real_1; + ix:int) +returns ( + res:real); +let + res = if ix = 0 then tab[0] else -0.314e+1; +tel +-- end of node quick_access_real_1_m0d314ep1 + +node quick_access_real_2_m0d314ep1( + tab:real_2; + ix:int) +returns ( + res:real); +let + res = if ix < 1 then quick_access_real_1_m0d314ep1(tab[0 .. 0], ix) else + quick_access_real_1_m0d314ep1(tab[1 .. 1], ix - 1); +tel +-- end of node quick_access_real_2_m0d314ep1 + +node quick_access_real_4_m0d314ep1( + tab:real_4; + ix:int) +returns ( + res:real); +let + res = if ix < 2 then quick_access_real_2_m0d314ep1(tab[0 .. 1], ix) else + quick_access_real_2_m0d314ep1(tab[2 .. 3], ix - 2); +tel +-- end of node quick_access_real_4_m0d314ep1 + +node quick_access_real_8_m0d314ep1( + tab:real_8; + ix:int) +returns ( + res:real); +let + res = if ix < 4 then quick_access_real_4_m0d314ep1(tab[0 .. 3], ix) else + quick_access_real_4_m0d314ep1(tab[4 .. 7], ix - 4); +tel +-- end of node quick_access_real_8_m0d314ep1 +node access::quick_access_int8(tab:int_8; ix:int) returns (res:int); +let + res = quick_access_int_8_m1(tab, ix); +tel +-- end of node access::quick_access_int8 +node access::quick_access_real8(tab:real_8; ix:int) returns (res:real); +let + res = quick_access_real_8_m0d314ep1(tab, ix); +tel +-- end of node access::quick_access_real8 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/consensus.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/Pascal/consensus.lus +type bool_1 = bool^1 (*abstract in the source*); +type bool_10 = bool^10 (*abstract in the source*); +type bool_2 = bool^2 (*abstract in the source*); +type bool_3 = bool^3 (*abstract in the source*); +type bool_4 = bool^4 (*abstract in the source*); +type bool_5 = bool^5 (*abstract in the source*); +type bool_6 = bool^6 (*abstract in the source*); +type bool_7 = bool^7 (*abstract in the source*); +type bool_8 = bool^8 (*abstract in the source*); +type bool_9 = bool^9 (*abstract in the source*); +node consensus::c8(T:bool_8) returns (a:bool); +let + a = consensus_8(T); +tel +-- end of node consensus::c8 +node consensus_1(T:bool_1) returns (a:bool); +let + a = T[0]; +tel +-- end of node consensus_1 +node consensus_2(T:bool_2) returns (a:bool); +let + a = T[0] and consensus_1(T[1 .. 1]); +tel +-- end of node consensus_2 +node consensus_3(T:bool_3) returns (a:bool); +let + a = T[0] and consensus_2(T[1 .. 2]); +tel +-- end of node consensus_3 +node consensus_4(T:bool_4) returns (a:bool); +let + a = T[0] and consensus_3(T[1 .. 3]); +tel +-- end of node consensus_4 +node consensus_5(T:bool_5) returns (a:bool); +let + a = T[0] and consensus_4(T[1 .. 4]); +tel +-- end of node consensus_5 +node consensus_6(T:bool_6) returns (a:bool); +let + a = T[0] and consensus_5(T[1 .. 5]); +tel +-- end of node consensus_6 +node consensus_7(T:bool_7) returns (a:bool); +let + a = T[0] and consensus_6(T[1 .. 6]); +tel +-- end of node consensus_7 +node consensus_8(T:bool_8) returns (a:bool); +let + a = T[0] and consensus_7(T[1 .. 7]); +tel +-- end of node consensus_8 +node consensus_9(T:bool_9) returns (a:bool); +let + a = T[0] and consensus_8(T[1 .. 8]); +tel +-- end of node consensus_9 +node consensus_10(T:bool_10) returns (a:bool); +let + a = T[0] and consensus_9(T[1 .. 9]); +tel +-- end of node consensus_10 +node consensus::main(T:bool_4) returns (c:bool); +let + c = consensus_4(T); +tel +-- end of node consensus::main +node consensus::main2(T:bool_10) returns (a:bool); +let + a = consensus_10(T); +tel +-- end of node consensus::main2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/consensus2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/Pascal/consensus2.lus +type bool_1 = bool^1 (*abstract in the source*); +type bool_2 = bool^2 (*abstract in the source*); +type bool_3 = bool^3 (*abstract in the source*); +type bool_4 = bool^4 (*abstract in the source*); +type bool_5 = bool^5 (*abstract in the source*); +type bool_6 = bool^6 (*abstract in the source*); +type bool_7 = bool^7 (*abstract in the source*); +type bool_8 = bool^8 (*abstract in the source*); +node consensus_1(T:bool_1) returns (a:bool); +let + a = T[0]; +tel +-- end of node consensus_1 +node consensus_2(T:bool_2) returns (a:bool); +let + a = T[0] and consensus_1(T[1 .. 1]); +tel +-- end of node consensus_2 +node consensus_3(T:bool_3) returns (a:bool); +let + a = T[0] and consensus_2(T[1 .. 2]); +tel +-- end of node consensus_3 +node consensus_4(T:bool_4) returns (a:bool); +let + a = T[0] and consensus_3(T[1 .. 3]); +tel +-- end of node consensus_4 +node consensus_5(T:bool_5) returns (a:bool); +let + a = T[0] and consensus_4(T[1 .. 4]); +tel +-- end of node consensus_5 +node consensus_6(T:bool_6) returns (a:bool); +let + a = T[0] and consensus_5(T[1 .. 5]); +tel +-- end of node consensus_6 +node consensus_7(T:bool_7) returns (a:bool); +let + a = T[0] and consensus_6(T[1 .. 6]); +tel +-- end of node consensus_7 +node consensus_8(T:bool_8) returns (a:bool); +let + a = T[0] and consensus_7(T[1 .. 7]); +tel +-- end of node consensus_8 +node consensus2::main(T:bool_8) returns (a:bool); +let + a = consensus_8(T); +tel +-- end of node consensus2::main + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/fby.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/fby.lus +node fby::rising_edge(X:bool) returns (ok:bool); +let + ok = false fby not X and X; +tel +-- end of node fby::rising_edge +node fby::rising_edge_bis(X:bool) returns (ok:bool); +let + ok = false fby not X fby X and X; +tel +-- end of node fby::rising_edge_bis + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/func_with_body.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/Pascal/func_with_body.lus +extern node func_with_body::ext(x:int) returns (y:int); +function func_with_body::trivial(x:int) returns (y:int); +let + y = 1; +tel +-- end of node func_with_body::trivial + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/heater_control.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/Pascal/heater_control.lus +const heater_control::DELTA = 0.5; +const heater_control::FAILURE = -999.0; +const heater_control::TMAX = 9.0; +const heater_control::TMIN = 6.0; +node heater_control::Average(a:real; b:real) returns (z:real); +let + z = a + b / 2.0; +tel +-- end of node heater_control::Average +node heater_control::Median(a:real; b:real; c:real) returns (z:real); +let + z = a + b + c - heater_control::min2(a, heater_control::min2(b, c)) - + heater_control::max2(a, heater_control::max2(b, c)); +tel +-- end of node heater_control::Median +node heater_control::abs(v:real) returns (a:real); +let + a = if v >= 0.0 then v else -v; +tel +-- end of node heater_control::abs + +node heater_control::alloftree( + f1:bool; + f2:bool; + f3:bool) +returns ( + r:bool); +let + r = f1 and f2 and f3; +tel +-- end of node heater_control::alloftree + +node heater_control::heater_control( + T:real; + T1:real; + T2:real; + T3:real) +returns ( + Heat_on:bool); +var + V12:bool; + V13:bool; + V23:bool; + Tguess:real; +let + V12 = heater_control::abs(T1 - T2) < 0.5; + V13 = heater_control::abs(T1 - T3) < 0.5; + V23 = heater_control::abs(T2 - T3) < 0.5; + Tguess = if heater_control::noneoftree(V12, V13, V23) then -999.0 else + if heater_control::oneoftree(V12, V13, V23) then heater_control::Median(T1, + T2, T3) else if heater_control::alloftree(V12, V13, V23) then + heater_control::Median(T1, T2, T3) else if V12 then + heater_control::Average(T1, T2) else if V13 then + heater_control::Average(T1, T3) else heater_control::Average(T2, T3); + Heat_on = true -> if Tguess = -999.0 then false else if Tguess < 6.0 + then true else if Tguess > 9.0 then false else pre (Heat_on); +tel +-- end of node heater_control::heater_control +node heater_control::max2(one:real; two:real) returns (m:real); +let + m = if one > two then one else two; +tel +-- end of node heater_control::max2 +node heater_control::min2(one:real; two:real) returns (m:real); +let + m = if one < two then one else two; +tel +-- end of node heater_control::min2 + +node heater_control::noneoftree( + f1:bool; + f2:bool; + f3:bool) +returns ( + r:bool); +let + r = not f1 and not f2 and not f3; +tel +-- end of node heater_control::noneoftree + +node heater_control::not_a_sauna( + T:real; + T1:real; + T2:real; + T3:real; + Heat_on:bool) +returns ( + ok:bool); +let + ok = true -> pre (T) < 9.0 + 1.0; +tel +-- end of node heater_control::not_a_sauna + +node heater_control::not_a_sauna2( + T:real; + T1:real; + T2:real; + T3:real; + Heat_on:bool) +returns ( + ok:bool); +let + ok = true -> pre (T) < 9.0 - 6.0; +tel +-- end of node heater_control::not_a_sauna2 + +node heater_control::oneoftree( + f1:bool; + f2:bool; + f3:bool) +returns ( + r:bool); +let + r = f1 and not f2 and not f3 or f2 and not f1 and not f3 or f3 and not f1 + and not f2; +tel +-- end of node heater_control::oneoftree + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/left.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/left.lus +type bool_100 = bool^100 (*abstract in the source*); +type left::truc = struct {a : bool_100; b : int}; +type left::truc_3 = left::truc^3 (*abstract in the source*); +node left::toto(x:bool) returns (t:left::truc_3); +let + t[0].a[0 .. 98 step 2][48 .. 0 step -2] = true^25; + t[0].a[0 .. 98 step 2][1 .. 49 step 2] = false^25; + t[0].a[1 .. 99 step 2][0] = true; + t[0].a[1 .. 99 step 2][1] = true; + t[0].a[5 .. 99 step 2] = false^48; + t[0].b = 42; + t[1 .. 2] = left::truc{a=true^100;b=0}^2; +tel +-- end of node left::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/newpacks.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/Pascal/newpacks.lus +type inter::selType = struct {i : int; b : bool; r : real}; +type pbool::t = bool; +type pint::t = int; +type preal::t = real; +const inter::n = -4; + +node inter::preced( + in:inter::selType) +returns ( + out:inter::selType; + out2:inter::selType); +let + out2 = inter::selType{i=0;b=true;r=0.0}; + out.i = pint::fby1(out2.i, in.i); + out.b = pbool::fby1(out2.b, in.b); + out.r = preal::fby1(out2.r, in.r); +tel +-- end of node inter::preced +node mainPack::preced(in:inter::selType) returns (out:inter::selType); +var + out2:inter::selType; +let + (out, out2) = inter::preced(in); +tel +-- end of node mainPack::preced +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +let + next = init -> pre (fb); +tel +-- end of node pbool::fby1 +node pint::fby1(init:int; fb:int) returns (next:int); +let + next = init -> pre (fb); +tel +-- end of node pint::fby1 +node preal::fby1(init:real; fb:real) returns (next:real); +let + next = init -> pre (fb); +tel +-- end of node preal::fby1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/onlyroll.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/Pascal/onlyroll.lus +const onlyroll::BID_LAST = 2.2; +const onlyroll::BID_VAL = 3.3; +const onlyroll::CROSS_CH_TOL_PITCH = 10.1; +const onlyroll::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll::CROSS_CH_TOL_YAW = 10.0; +const onlyroll::DELTA_PITCH = 3.0; +const onlyroll::DELTA_ROLL = 14.9; +const onlyroll::DELTA_YAW = 2.73; +const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.0; +const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; +const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::HORmaxP = 57.0; +const onlyroll::HORmaxR = 285.0; +const onlyroll::HORmaxY = 57.0; +const onlyroll::HORminP = -57.0; +const onlyroll::HORminR = -285.0; +const onlyroll::HORminY = -57.0; +const onlyroll::NRmaxP = 5.1; +const onlyroll::NRmaxR = 25.3; +const onlyroll::NRmaxY = 5.0; +const onlyroll::NRminP = -5.1; +const onlyroll::NRminR = -25.3; +const onlyroll::NRminY = -5.0; +const onlyroll::OneSecond = 10; +const onlyroll::SAFE_COUNTER_TIME = 3; +const onlyroll::TIME5 = 4; +const onlyroll::TIME_CROSS_ROLL = 3; +const onlyroll::TIME_ROLL = 3; +const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.1; + +node onlyroll::Allocator( + r1:bool; + r2:bool; + r3:bool; + r4:bool; + reset:bool) +returns ( + a1:bool; + a2:bool; + a3:bool; + a4:bool); +var + nb_aut:int; + already:int; +let + already = if true -> reset then 0 else pre (nb_aut); + a1 = r1 and already <= 1; + a2 = r2 and not r1 and already <= 1 or r1 and already = 0; + a3 = r3 and not r1 and not r2 and already <= 1 or #(r1, r2) and already = + 0; + a4 = r4 and not r1 and not r2 and not r3 and already <= 1 or #(r1, r2, r3) + and already = 0; + nb_aut = if true -> reset then 0 else pre (nb_aut) + if a1 then 1 else 0 + + if a2 then 1 else 0 + if a3 then 1 else 0 + if a4 then 1 else 0; +tel +-- end of node onlyroll::Allocator + +node onlyroll::Average( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +let + r = if f1 then if f2 then onlyroll::Average2(x3, x4) else if f3 then + onlyroll::Average2(x2, x4) else onlyroll::Average2(x3, x2) else if f2 then + if f1 then onlyroll::Average2(x3, x4) else if f3 then + onlyroll::Average2(x1, x4) else onlyroll::Average2(x3, x1) else if f3 then + if f2 then onlyroll::Average2(x1, x4) else if f4 then + onlyroll::Average2(x2, x1) else onlyroll::Average2(x4, x2) else if f2 then + onlyroll::Average2(x3, x1) else if f3 then onlyroll::Average2(x2, x1) else + onlyroll::Average2(x3, x2); +tel +-- end of node onlyroll::Average +node onlyroll::Average2(a:real; b:real) returns (z:real); +let + z = a + b / 2.0; +tel +-- end of node onlyroll::Average2 + +node onlyroll::Calculate( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + x:real); +var + zero_roll:bool; + one_roll:bool; + two_roll:bool; + three_roll:bool; + cpt_roll:int; +let + cpt_roll = 0 -> if three_roll then 3 else if pre (cpt_roll) > 0 then pre + (cpt_roll) - 1 else 0; + zero_roll = onlyroll::noneof(f1, f2, f3, f4); + one_roll = onlyroll::oneoffour(f1, f2, f3, f4); + two_roll = onlyroll::twooffour(f1, f2, f3, f4); + three_roll = onlyroll::threeoffour(f1, f2, f3, f4); + x = if zero_roll and cpt_roll = 0 then onlyroll::OlympicAverage(x1, x2, + x3, x4) else if one_roll and cpt_roll = 0 then onlyroll::Median(x1, x2, + x3, x4, f1, f2, f3, f4) else if two_roll and cpt_roll = 0 then + onlyroll::Average(x1, x2, x3, x4, f1, f2, f3, f4) else 1.0; +tel +-- end of node onlyroll::Calculate + +node onlyroll::Channel( + ongroundreset:bool; + inairreset:bool; + choffi:bool; + xai:real; + xbi:real; + disci:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + allowedi:bool) +returns ( + xi:real; + fi:bool; + aski:bool; + debug_localfailure:bool; + debug_cross_failure:bool; + debug_st:int); +var + local_failure:bool; +let + (xi, local_failure) = onlyroll::Monitor(xai, xbi, disci); + (fi, debug_cross_failure, debug_st, aski) = + onlyroll::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, + pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); + debug_localfailure = local_failure; +tel +-- end of node onlyroll::Channel + +node onlyroll::FailDetect( + local_failure:bool; + xi:real; + ongroundreset:bool; + inairreset:bool; + choffi:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + a:bool) +returns ( + failure:bool; + debug_cross_failure:bool; + debug_st:int; + r:bool); +var + cross_failure:bool; + ps:int; + state:int; + from1to2:bool; + from1to3:bool; + from2to3:bool; + from2to1:bool; + from3to1:bool; + NLfaults:bool; + will_latch:bool; + reset:bool; + foreign_failure:bool; +let + debug_st = state; + ps = pre (state); + state = 1 -> if ps = 1 then if pre (reset) then 1 else if pre + (from1to2) then 2 else if pre (from1to3) then 3 else 1 else if ps = 2 + then if pre (from2to1) then 1 else if pre (from2to3) then 3 else 2 else + if pre (from3to1) then 1 else 3; + failure = state = 2 or state = 3 or state = 1 and NLfaults; + reset = ongroundreset or inairreset and not cross_failure; + foreign_failure = pfother1 or pfother2 or pfother3; + NLfaults = choffi or local_failure; + from1to2 = will_latch and not onlyroll::InNominalRange(xi); + will_latch = cross_failure; + from1to3 = a and will_latch and onlyroll::InNominalRange(xi); + from2to3 = a and pre (will_latch) and foreign_failure or local_failure; + from3to1 = ongroundreset; + from2to1 = reset; + r = false -> pre (state) = 1 and cross_failure and + onlyroll::InNominalRange(xi) or pre (state) = 2 and pre (cross_failure) and + foreign_failure or local_failure; + cross_failure = onlyroll::values_nok(pfother1, pfother2, pfother3, xi, + pxother1, pxother2, pxother3); + debug_cross_failure = cross_failure; +tel +-- end of node onlyroll::FailDetect +node onlyroll::InHardoverRange(r:real) returns (i:bool); +let + i = r > 285.0 or r < -285.0; +tel +-- end of node onlyroll::InHardoverRange +node onlyroll::InNominalRange(r:real) returns (i:bool); +let + i = r < 25.3 and r > -25.3; +tel +-- end of node onlyroll::InNominalRange + +node onlyroll::Median( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +let + r = if f1 then onlyroll::MedianValue3(x2, x3, x4) else if f2 then + onlyroll::MedianValue3(x1, x3, x4) else if f3 then + onlyroll::MedianValue3(x1, x2, x4) else onlyroll::MedianValue3(x1, x2, x3); +tel +-- end of node onlyroll::Median +node onlyroll::MedianValue3(a:real; b:real; c:real) returns (z:real); +let + z = a + b + c - onlyroll::min2(a, onlyroll::min2(b, c)) - + onlyroll::max2(a, onlyroll::max2(b, c)); +tel +-- end of node onlyroll::MedianValue3 + +node onlyroll::Monitor( + xa:real; + xb:real; + disc:bool) +returns ( + local_value:real; + inline_monitor_failed:bool); +let + inline_monitor_failed = onlyroll::maintain(3, onlyroll::abs(xa - xb) > + 14.9) or disc; + local_value = xa; +tel +-- end of node onlyroll::Monitor + +node onlyroll::OlympicAverage( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = one + two + three + four - onlyroll::max4(one, two, three, four) - + onlyroll::min4(one, two, three, four) / 2.0; +tel +-- end of node onlyroll::OlympicAverage +node onlyroll::abs(v:real) returns (a:real); +let + a = if v >= 0.0 then v else -v; +tel +-- end of node onlyroll::abs +node onlyroll::maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; +let + cpt = if val then 1 else 0 -> if val then pre (cpt) + 1 else 0; + m = cpt >= n; +tel +-- end of node onlyroll::maintain +node onlyroll::max2(one:real; two:real) returns (m:real); +let + m = if one > two then one else two; +tel +-- end of node onlyroll::max2 + +node onlyroll::max4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = onlyroll::max2(onlyroll::max2(one, two), onlyroll::max2(three, four)); +tel +-- end of node onlyroll::max4 +node onlyroll::min2(one:real; two:real) returns (m:real); +let + m = if one < two then one else two; +tel +-- end of node onlyroll::min2 + +node onlyroll::min4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = onlyroll::min2(onlyroll::min2(one, two), onlyroll::min2(three, four)); +tel +-- end of node onlyroll::min4 + +node onlyroll::noneof( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = not f1 and not f2 and not f3 and not f4; +tel +-- end of node onlyroll::noneof + +node onlyroll::oneoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = f1 and not f2 and not f3 and not f4 or f2 and not f1 and not f3 and + not f4 or f3 and not f1 and not f2 and not f4 or f4 and not f1 and not f2 + and not f3; +tel +-- end of node onlyroll::oneoffour + +node onlyroll::onlyroll( + xa1:real; + xb1:real; + xa2:real; + xb2:real; + xa3:real; + xb3:real; + xa4:real; + xb4:real; + ongroundreset:bool; + inairreset:bool; + disc1:bool; + disc2:bool; + disc3:bool; + disc4:bool; + choff1:bool; + choff2:bool; + choff3:bool; + choff4:bool) +returns ( + x:real; + debug_localfailure1:bool; + debug_localfailure2:bool; + debug_localfailure3:bool; + debug_localfailure4:bool; + debug_cross_failure1:bool; + debug_cross_failure2:bool; + debug_cross_failure3:bool; + debug_cross_failure4:bool; + debug_ch_failed1:bool; + debug_ch_failed2:bool; + debug_ch_failed3:bool; + debug_ch_failed4:bool; + debug_st1:int; + debug_st2:int; + debug_st3:int; + debug_st4:int); +var + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool; + ask1:bool; + ask2:bool; + ask3:bool; + ask4:bool; + allowed1:bool; + allowed2:bool; + allowed3:bool; + allowed4:bool; +let + debug_ch_failed1 = f1; + debug_ch_failed2 = f2; + debug_ch_failed3 = f3; + debug_ch_failed4 = f4; + (x1, f1, ask1, debug_localfailure1, debug_cross_failure1, debug_st1) = + onlyroll::Channel(ongroundreset, inairreset, choff1, xa1, xb1, disc1, 0.0 + -> pre (x2), 0.0 -> pre (x3), 0.0 -> pre (x4), false -> pre (f2), false -> + pre (f3), false -> pre (f4), allowed1); + (x2, f2, ask2, debug_localfailure2, debug_cross_failure2, debug_st2) = + onlyroll::Channel(ongroundreset, inairreset, choff2, xa2, xb2, disc2, 0.0 + -> pre (x1), 0.0 -> pre (x3), 0.0 -> pre (x4), false -> pre (f1), false -> + pre (f3), false -> pre (f4), allowed2); + (x3, f3, ask3, debug_localfailure3, debug_cross_failure3, debug_st3) = + onlyroll::Channel(ongroundreset, inairreset, choff3, xa3, xb3, disc3, 0.0 + -> pre (x1), 0.0 -> pre (x2), 0.0 -> pre (x4), false -> pre (f1), false -> + pre (f2), false -> pre (f4), allowed3); + (x4, f4, ask4, debug_localfailure4, debug_cross_failure4, debug_st4) = + onlyroll::Channel(ongroundreset, inairreset, choff4, xa4, xb4, disc4, 0.0 + -> pre (x1), 0.0 -> pre (x2), 0.0 -> pre (x3), false -> pre (f1), false -> + pre (f2), false -> pre (f3), allowed4); + (allowed1, allowed2, allowed3, allowed4) = onlyroll::Allocator(ask1, ask2, + ask3, ask4, ongroundreset); + x = onlyroll::Calculate(x1, x2, x3, x4, f1, f2, f3, f4); +tel +-- end of node onlyroll::onlyroll + +node onlyroll::threeoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = onlyroll::oneoffour(not f1, not f2, not f3, not f4); +tel +-- end of node onlyroll::threeoffour + +node onlyroll::twooffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = f1 and f2 and not f3 and not f4 or f3 and not f2 and not f4 or f4 and + not f2 and not f3 or f2 and f1 and not f3 and not f4 or f3 and not f1 and + not f4 or f4 and not f1 and not f3 or f3 and f2 and not f1 and not f4 or f1 + and not f2 and not f4 or f4 and not f2 and not f1 or f4 and f2 and not f3 + and not f1 or f3 and not f2 and not f1 or f1 and not f2 and not f3; +tel +-- end of node onlyroll::twooffour + +node onlyroll::values_nok( + pfother1:bool; + pfother2:bool; + pfother3:bool; + xi:real; + pxother1:real; + pxother2:real; + pxother3:real) +returns ( + r:bool); +var + one:bool; + two:bool; + three:bool; +let + one = onlyroll::abs(xi - pxother1) > 51.0; + two = onlyroll::abs(xi - pxother2) > 51.0; + three = onlyroll::abs(xi - pxother3) > 51.0; + r = onlyroll::maintain(3, if pfother1 then if pfother2 then if pfother3 + then false else three else if pfother3 then two else two and three else + if pfother2 then if pfother3 then one else one and three else if pfother3 + then one and two else one and two and three); +tel +-- end of node onlyroll::values_nok + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/p.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/p.lus +type inter::selType = struct {i : int; b : bool; r : real}; +type pbool::t = bool; +type pint::t = int; +type preal::t = real; +const inter::n = -4; + +node inter::preced( + in:inter::selType) +returns ( + out:inter::selType; + out2:inter::selType); +let + out2 = inter::selType{i=0;b=true;r=0.0}; + out.i = pint::fby1(out2.i, in.i); + out.b = pbool::fby1(out2.b, in.b); + out.r = preal::fby1(out2.r, in.r); +tel +-- end of node inter::preced +node mainPack::preced(in:inter::selType) returns (out:inter::selType); +var + out2:inter::selType; +let + (out, out2) = inter::preced(in); +tel +-- end of node mainPack::preced +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +let + next = init -> pre (fb); +tel +-- end of node pbool::fby1 +node pint::fby1(init:int; fb:int) returns (next:int); +let + next = init -> pre (fb); +tel +-- end of node pint::fby1 +node preal::fby1(init:real; fb:real) returns (next:real); +let + next = init -> pre (fb); +tel +-- end of node preal::fby1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/packs.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/packs.lus +type inter::selType = struct {i : int; b : bool; r : real}; +type inter::toto = enum {inter::X, inter::Y}; +type mainPack::T = int^8; +type mainPack::couleurs = enum {mainPack::bleu, mainPack::rose, mainPack::jaune}; +type pbool::t = bool; +type pint::t = int; +type preal::t = real; +const inter::n = -4; +const mainPack::N = 8; +const mainPack::X = 8; + +node inter::preced( + in:inter::selType) +returns ( + out:inter::selType; + out2:inter::selType); +let + out2 = inter::selType{i=0;b=true;r=0.0}; + out.i = pint::fby1(out2.i, in.i); + out.b = pbool::fby1(out2.b, in.b); + out.r = preal::fby1(out2.r, in.r); +tel +-- end of node inter::preced +node mainPack::preced(in:inter::selType) returns (out:inter::selType); +var + out2:inter::selType; +let + (out, out2) = inter::preced(in); +tel +-- end of node mainPack::preced +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +let + next = init -> pre (fb); +tel +-- end of node pbool::fby1 +node pint::fby1(init:int; fb:int) returns (next:int); +let + next = init -> pre (fb); +tel +-- end of node pint::fby1 +node preal::fby1(init:real; fb:real) returns (next:real); +let + next = init -> pre (fb); +tel +-- end of node preal::fby1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/pfs.lus +*** Error in file "pfs.lus", line 43, col 22 to 22, token '[': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/struct.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/struct.lus +type struct::complex = struct {re : real = 0.; im : real = 0.}; + +node struct::plus( + a:struct::complex; + b:struct::complex) +returns ( + c:struct::complex); +let + c = struct::complex{re=a.re + b.re;im=a.im + b.im}; +tel +-- end of node struct::plus + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/struct0.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/struct0.lus +type struct0::Toto = struct {x : int = 1; y : int = 2}; +node struct0::bibi(dummy:int) returns (z:struct0::Toto); +let + z = struct0::Toto{x=3}; +tel +-- end of node struct0::bibi + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t.lus +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +const t::A = [[1, 1], [1, 1], [1, 1]]; +const t::B = [2, 2]; +node t::toto(x:bool) returns (a:int_2_3; b:int_2); +let + a = [[1, 1], [1, 1], [1, 1]]; + b = [2, 2]; +tel +-- end of node t::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t0.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t0.lus +type int_1 = int^1 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +extern function t0::max(x:int; y:int) returns (mx:int); +node t0::min(x:int; y:int) returns (mn:int); +let + mn = if x <= y then x else y; +tel +-- end of node t0::min +node t0::min_4(T:int_4) returns (mn:int); +let + mn = min_n_4(T); +tel +-- end of node t0::min_4 +node min_n_1(T:int_1) returns (mn:int); +let + mn = T[0]; +tel +-- end of node min_n_1 +node min_n_2(T:int_2) returns (mn:int); +let + mn = t0::min(T[0], min_n_1(T[1 .. 1])); +tel +-- end of node min_n_2 +node min_n_3(T:int_3) returns (mn:int); +let + mn = t0::min(T[0], min_n_2(T[1 .. 2])); +tel +-- end of node min_n_3 +node min_n_4(T:int_4) returns (mn:int); +let + mn = t0::min(T[0], min_n_3(T[1 .. 3])); +tel +-- end of node min_n_4 +node t0::t0(T:int_4) returns (mn:int); +let + mn = t0::min_4(T); +tel +-- end of node t0::t0 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t1.lus +type bool_1 = bool^1 (*abstract in the source*); +type bool_2 = bool^2 (*abstract in the source*); +type bool_3 = bool^3 (*abstract in the source*); +type bool_4 = bool^4 (*abstract in the source*); +node consensus_1(T:bool_1) returns (a:bool); +let + a = T[0]; +tel +-- end of node consensus_1 +node consensus_2(T:bool_2) returns (a:bool); +let + a = T[0] and consensus_1(T[1 .. 1]); +tel +-- end of node consensus_2 +node consensus_3(T:bool_3) returns (a:bool); +let + a = T[0] and consensus_2(T[1 .. 2]); +tel +-- end of node consensus_3 +node consensus_4(T:bool_4) returns (a:bool); +let + a = T[0] and consensus_3(T[1 .. 3]); +tel +-- end of node consensus_4 +node t1::consensus4(T:bool_4) returns (a:bool); +let + a = consensus_4(T); +tel +-- end of node t1::consensus4 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/t2.lus +type bool_1 = bool^1 (*abstract in the source*); +type bool_2 = bool^2 (*abstract in the source*); +type bool_3 = bool^3 (*abstract in the source*); +type bool_4 = bool^4 (*abstract in the source*); +type bool_5 = bool^5 (*abstract in the source*); +type bool_6 = bool^6 (*abstract in the source*); +node t2::consensus_6(X:bool_6) returns (c:bool); +let + c = fold_left_bool_bool_6_and(true, X); +tel +-- end of node t2::consensus_6 +node t2::consensus_6_bis(a:bool; X:bool_6) returns (c:bool); +let + c = fold_left_bool_bool_6_and(a, X); +tel +-- end of node t2::consensus_6_bis +node fold_left_bool_bool_1_and(a:bool; X:bool_1) returns (c:bool); +let + c = a; +tel +-- end of node fold_left_bool_bool_1_and +node fold_left_bool_bool_2_and(a:bool; X:bool_2) returns (c:bool); +let + c = fold_left_bool_bool_1_and(Lustre::and(a, X[0]), X[1 .. 1]); +tel +-- end of node fold_left_bool_bool_2_and +node fold_left_bool_bool_3_and(a:bool; X:bool_3) returns (c:bool); +let + c = fold_left_bool_bool_2_and(Lustre::and(a, X[0]), X[1 .. 2]); +tel +-- end of node fold_left_bool_bool_3_and +node fold_left_bool_bool_4_and(a:bool; X:bool_4) returns (c:bool); +let + c = fold_left_bool_bool_3_and(Lustre::and(a, X[0]), X[1 .. 3]); +tel +-- end of node fold_left_bool_bool_4_and +node fold_left_bool_bool_5_and(a:bool; X:bool_5) returns (c:bool); +let + c = fold_left_bool_bool_4_and(Lustre::and(a, X[0]), X[1 .. 4]); +tel +-- end of node fold_left_bool_bool_5_and +node fold_left_bool_bool_6_and(a:bool; X:bool_6) returns (c:bool); +let + c = fold_left_bool_bool_5_and(Lustre::and(a, X[0]), X[1 .. 5]); +tel +-- end of node fold_left_bool_bool_6_and +node t2::t2(X:bool_6) returns (c:bool); +let + c = t2::consensus_6(X); +tel +-- end of node t2::t2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/test.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/test.lus +type P1::titi = int^5; +const P1::y = 3; + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/trivial.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/Pascal/trivial.lus +node trivial::trivial(x:int) returns (y:int); +let + y = 1; +tel +-- end of node trivial::trivial + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/bad_call02.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/call/bad_call02.lus +node bad_call02::bad_call02(a:int; c:bool) returns (x:int when c); +let + x = a when c; +tel +-- end of node bad_call02::bad_call02 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call01.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call01.lus +node call01::call01(x:bool; y:bool) returns (z:bool); +let + z = call01::toto(x, y); +tel +-- end of node call01::call01 +extern function call01::momo(x:bool; y:bool) returns (z:bool); +node call01::toto(i1:bool; i2:bool) returns (o:bool); +let + o = Lustre::and(i1, i2); +tel +-- end of node call01::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call02.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call02.lus +node call02::call02(x:bool; y:bool) returns (z:bool); +let + z = call02::titi(x, y); +tel +-- end of node call02::call02 +node call02::titi(i1:bool; i2:bool) returns (o:bool); +let + o = call02::toto(i1, i2); +tel +-- end of node call02::titi +node call02::toto(i1:bool; i2:bool) returns (o:bool); +let + o = Lustre::and(i1, i2); +tel +-- end of node call02::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call03.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call03.lus +type bool_2 = bool^2 (*abstract in the source*); +node call03::call03(x:bool_2; y:bool_2) returns (z:bool_2); +let + z = call03::tutu(x, y); +tel +-- end of node call03::call03 +extern function call03::momo(x:bool; y:bool) returns (z:bool); +node call03::tutu(i1:bool_2; i2:bool_2) returns (o:bool_2); +let + o = Lustre::map<<Lustre::or, 2>>(i1, i2); +tel +-- end of node call03::tutu + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call04.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call04.lus +type bool_2 = bool^2 (*abstract in the source*); +node call04::call04(x:bool_2; y:bool_2) returns (z:bool_2); +let + z = call04::tutu(x, y); +tel +-- end of node call04::call04 +node call04::titi(i1:bool; i2:bool) returns (o:bool); +let + o = call04::toto(i1, i2); +tel +-- end of node call04::titi +node call04::toto(i1:bool; i2:bool) returns (o:bool); +let + o = Lustre::and(i1, i2); +tel +-- end of node call04::toto +node call04::tutu(i1:bool_2; i2:bool_2) returns (o:bool_2); +let + o = Lustre::map<<call04::titi, 2>>(i1, i2); +tel +-- end of node call04::tutu + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call05.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call05.lus +node call05::call05(x:bool; y:bool) returns (z:bool); +let + z = call05::momo(x, y); +tel +-- end of node call05::call05 +extern function call05::momo(x:bool; y:bool) returns (z:bool); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call06.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call06.lus +extern function call06::bip(x:bool; y:bool) returns (z:bool; t:bool); +node call06::call06(x:bool; y:bool) returns (z:bool; t:bool); +let + assert(x => z); + (z, t) = call06::bip(x, y); +tel +-- end of node call06::call06 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call07.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/call/call07.lus +node call07::call07(x:bool; y:bool; z:bool) returns (t:bool); +let + t = #(x, y, z); +tel +-- end of node call07::call07 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/clock.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/clock.lus +type bool_10 = bool^10 (*abstract in the source*); +type clock::s = struct {x : bool_10; y : bool}; +node clock::clock(a:bool; b:bool) returns (c:bool; d:bool when c); +var + z:bool; + z2:bool; + x:bool when z; + e:bool when a; +let + (z, x) = clock::clock3(true -> pre (z)); + e = b when a; + (c, d) = clock::clock4(a, b when a); + z2 = clock::clock5(a, b when a, c when e); +tel +-- end of node clock::clock + +extern node clock::clock2( + clock2_u:bool; + clock2_v:bool when clock2_u) +returns ( + clock2_y:bool); + +extern node clock::clock3( + clock3_u:bool) +returns ( + clock3_toto:bool; + clock3_y:bool when clock3_toto); + +extern node clock::clock4( + clock4_u:bool; + clock4_v:bool when clock4_u) +returns ( + clock4_x:bool; + clock4_y:bool when clock4_x); + +extern node clock::clock5( + x:bool; + y:bool when x; + z:bool when y) +returns ( + a:bool); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/clock2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/clock2.lus +node clock2::clock(a:bool; b:int) returns (c:int when a); +let + c = 1 + 1 + b when a; +tel +-- end of node clock2::clock + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/clock_ite.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/clock/clock_ite.lus +node clock_ite::clock(a:bool; b:bool) returns (c:bool when a); +let + c = if a when a then b when a else not b when a; +tel +-- end of node clock_ite::clock + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/when_enum.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/clock/when_enum.lus +type when_enum::t = enum {when_enum::A, when_enum::B, when_enum::C}; + +node when_enum::clock( + a:when_enum::t; + b:bool; + c:bool) +returns ( + x:bool when when_enum::A( + a); + y:bool when when_enum::A( + a)); +let + (x, y) = when_enum::toto(b when when_enum::A(a), c when when_enum::A(a)); +tel +-- end of node when_enum::clock +extern node when_enum::toto(u:bool; v:bool) returns (x:bool; y:bool); +extern node when_enum::tutu(u:when_enum::t) returns (x:bool); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/when_node.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/clock/when_node.lus + +node when_node::clock( + a:bool; + b:bool; + c:bool) +returns ( + x:bool when a; + y:bool when a); +let + (x, y) = current (when_node::toto(b when tutu(a), c when tutu(a))) when a; +tel +-- end of node when_node::clock +extern node when_node::toto(u:bool; v:bool) returns (x:bool; y:bool); +extern node when_node::tutu(u:bool) returns (x:bool); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/when_not.lus +*** Error in file "when_not.lus", line 7, col 12 to 17, token 'clock4': +*** +*** clock error: The two following clocks are not unifiable: + + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/clock/when_tuple.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/clock/when_tuple.lus + +node when_tuple::clock( + a:bool; + b:bool; + c:bool) +returns ( + x:bool when a; + y:bool when a); +let + (x, y) = when_tuple::toto(b, c when a); +tel +-- end of node when_tuple::clock + +node when_tuple::titi( + x:int; + clk:bool) +returns ( + a:int when clk; + b:int when clk; + c:int when clk); +let + (a, b, c) = x, x, x when clk; +tel +-- end of node when_tuple::titi +extern node when_tuple::toto(u:bool; v:bool) returns (x:bool; y:bool); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/Gyroscope2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/demo/Gyroscope2.lus +type bool_3 = bool^3 (*abstract in the source*); +type real_3 = real^3 (*abstract in the source*); +type real_4 = real^4 (*abstract in the source*); +type Gyroscope2::CFF_Eltstruct = struct {indx : int; indx_toChange : int; value : Gyroscope2::Valid_ChannelT}; +type Gyroscope2::CFF_struct = struct {indx : int; indx_toChange : int; tabToFill : Gyroscope2::Valid_ChannelT_3}; +type Gyroscope2::Faulty_Array = Gyroscope2::Faulty_ChannelT_4^3; +type Gyroscope2::Faulty_ChannelT = struct {valuea : real; valueb : real}; +type Gyroscope2::Faulty_ChannelT_4 = Gyroscope2::Faulty_ChannelT^4 (*abstract in the source*); +type Gyroscope2::Faulty_ChannelT_4_3 = Gyroscope2::Faulty_ChannelT_4^3 (*abstract in the source*); +type Gyroscope2::Valid_ChannelT = struct {local_failure : bool; local_value : real}; +type Gyroscope2::Valid_ChannelT_3 = Gyroscope2::Valid_ChannelT^3 (*abstract in the source*); +type Gyroscope2::Valid_ChannelT_4 = Gyroscope2::Valid_ChannelT^4 (*abstract in the source*); +const Gyroscope2::CROSS_CHANNEL_TOLERANCE = 1.0; +const Gyroscope2::DELTA_PITCH = 2.0; +const Gyroscope2::DELTA_ROLL = 2.0; +const Gyroscope2::DELTA_TO_GOD_PITCH = 2.0; +const Gyroscope2::DELTA_TO_GOD_ROLL = 2.0; +const Gyroscope2::DELTA_TO_GOD_YAW = 2.0; +const Gyroscope2::DELTA_YAW = 2.0; +const Gyroscope2::GOD_PITCH = 16.0; +const Gyroscope2::GOD_ROLL = 15.0; +const Gyroscope2::GOD_YAW = 14.0; + +node Gyroscope2::CFC_iter( + structIn:Gyroscope2::CFF_struct; + currentChannel:Gyroscope2::Valid_ChannelT) +returns ( + structOut:Gyroscope2::CFF_struct); +let + structOut = Gyroscope2::CFF_struct{indx=structIn.indx + + 1;indx_toChange=structIn.indx_toChange;tabToFill= if structIn.indx_toChange + = structIn.indx then structIn.tabToFill else + Gyroscope2::addOneChannel(structIn.indx, currentChannel, + structIn.tabToFill)}; +tel +-- end of node Gyroscope2::CFC_iter + +node Gyroscope2::Channel( + previousOutChannel:Gyroscope2::Valid_ChannelT_4; + nbInChannel:int; + inChannel:Gyroscope2::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real) +returns ( + nextOutChannel:Gyroscope2::Valid_ChannelT_4; + outChannel:Gyroscope2::Valid_ChannelT); +var + localChannel:Gyroscope2::Valid_ChannelT; +let + localChannel = + Gyroscope2::Valid_ChannelT{local_failure=Gyroscope2::abs(inChannel.valuea - + inChannel.valueb) > delta;local_value= if Gyroscope2::abs(inChannel.valuea + - inChannel.valueb) > delta then 0.0 else inChannel.valuea + + inChannel.valueb / 2.0}; + outChannel = + Gyroscope2::Valid_ChannelT{local_failure=localChannel.local_failure or + Gyroscope2::CrossFailDetect(nbInChannel, localChannel, + previousOutChannel);local_value=localChannel.local_value}; + nextOutChannel = previousOutChannel; +tel +-- end of node Gyroscope2::Channel + +node Gyroscope2::ComputeForeignChannels( + currentChannelIndx:int; + allChannels:Gyroscope2::Valid_ChannelT_4) +returns ( + foreignChannels:Gyroscope2::Valid_ChannelT_3); +var + acc_out:Gyroscope2::CFF_struct; + localtabToFill:Gyroscope2::Valid_ChannelT; +let + localtabToFill = + Gyroscope2::Valid_ChannelT{local_failure=false;local_value=0.0}; + acc_out = red<<Gyroscope2::CFC_iter, + 4>>(Gyroscope2::CFF_struct{indx=0;indx_toChange=currentChannelIndx;tabToFill=localtabToFill^3}, + allChannels); + foreignChannels = acc_out.tabToFill; +tel +-- end of node Gyroscope2::ComputeForeignChannels + +node Gyroscope2::CrossFailDetect( + currentChannel:int; + localChannel:Gyroscope2::Valid_ChannelT; + previousOutChannel:Gyroscope2::Valid_ChannelT_4) +returns ( + crossFailure:bool); +var + foreign_Channels:Gyroscope2::Valid_ChannelT_3; +let + foreign_Channels = Gyroscope2::ComputeForeignChannels(currentChannel, + previousOutChannel); + crossFailure = Gyroscope2::values_nok(localChannel, foreign_Channels); +tel +-- end of node Gyroscope2::CrossFailDetect + +node Gyroscope2::EvaluateAxis( + channels:Gyroscope2::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real) +returns ( + AxisValue:real); +var + resChannels:Gyroscope2::Valid_ChannelT_4; + dumbChannel:Gyroscope2::Valid_ChannelT_4; + initChannels:Gyroscope2::Valid_ChannelT_4; + fillredInit:Gyroscope2::Valid_ChannelT_4; +let + initChannels = + Gyroscope2::Valid_ChannelT{local_failure=false;local_value=0.0}^4; + (dumbChannel, resChannels) = fillred<<Gyroscope2::Channel, + 4>>(fillredInit, [0, 1, 2, 3], channels, delta^4, god^4, delta_to_god^4); + AxisValue = Gyroscope2::Voter(resChannels, god, delta_to_god); + fillredInit = initChannels -> pre (resChannels); +tel +-- end of node Gyroscope2::EvaluateAxis + +node Gyroscope2::Gyroscope2( + axis:Gyroscope2::Faulty_ChannelT_4_3) +returns ( + valid:bool); +var + secure_values:real_3; +let + secure_values = map<<Gyroscope2::EvaluateAxis, 3>>(axis, [2.0, 2.0, 2.0], + [15.0, 16.0, 14.0], [2.0, 2.0, 2.0]); + valid = red<<Gyroscope2::ValueIsSecureII, 3>>(true, secure_values, [2.0, + 2.0, 2.0], [15.0, 16.0, 14.0]); +tel +-- end of node Gyroscope2::Gyroscope2 + +node Gyroscope2::TooFar( + nbToFarIn:int; + channel:Gyroscope2::Faulty_ChannelT; + god:real; + delta_to_god:real) +returns ( + nbToFarOut:int); +let + nbToFarOut = if Gyroscope2::abs(channel.valuea - god) < delta_to_god then + nbToFarIn + 1 else nbToFarIn; +tel +-- end of node Gyroscope2::TooFar + +node Gyroscope2::ValueIsSecure( + secure_value:real; + delta_to_god_value:real; + god_value:real) +returns ( + is_valid:bool); +let + is_valid = Gyroscope2::abs(secure_value - god_value) < delta_to_god_value; +tel +-- end of node Gyroscope2::ValueIsSecure + +node Gyroscope2::ValueIsSecureII( + accu_in:bool; + secure_value:real; + delta_to_god_value:real; + god_value:real) +returns ( + is_valid:bool); +let + is_valid = Gyroscope2::abs(secure_value - god_value) < 2.0 and accu_in; +tel +-- end of node Gyroscope2::ValueIsSecureII + +node Gyroscope2::Voter( + channels:Gyroscope2::Valid_ChannelT_4; + god:real; + delta_to_god:real) +returns ( + vote:real); +var + globalSum:real; + nbValid:real; + mask:real_4; +let + nbValid = Gyroscope2::countValidChannels(channels); + globalSum = red<<Gyroscope2::sum, 4>>(0.0, mask); + vote = globalSum / nbValid; + mask = map<<Gyroscope2::masking, 4>>(channels); +tel +-- end of node Gyroscope2::Voter +node Gyroscope2::abs(in:real) returns (out:real); +let + out = if in < 0.0 then -in else in; +tel +-- end of node Gyroscope2::abs + +node Gyroscope2::addOneChannel( + indx_toChange:int; + channeltToAdd:Gyroscope2::Valid_ChannelT; + tabToFill:Gyroscope2::Valid_ChannelT_3) +returns ( + tabToFillAfter:Gyroscope2::Valid_ChannelT_3); +var + acc_out:Gyroscope2::CFF_Eltstruct; +let + (acc_out, tabToFillAfter) = fillred<<Gyroscope2::addOneChannelIter, + 3>>(Gyroscope2::CFF_Eltstruct{indx=0;indx_toChange=indx_toChange;value=channeltToAdd}, + tabToFill); +tel +-- end of node Gyroscope2::addOneChannel + +node Gyroscope2::addOneChannelIter( + acc_in:Gyroscope2::CFF_Eltstruct; + elt_in:Gyroscope2::Valid_ChannelT) +returns ( + acc_out:Gyroscope2::CFF_Eltstruct; + elt_out:Gyroscope2::Valid_ChannelT); +let + acc_out = Gyroscope2::CFF_Eltstruct{indx=acc_in.indx + + 1;indx_toChange=acc_in.indx_toChange;value=acc_in.value}; + elt_out = if acc_in.indx = acc_in.indx_toChange then acc_in.value else + elt_in; +tel +-- end of node Gyroscope2::addOneChannelIter + +node Gyroscope2::assumeChannel( + previousOutChannel:Gyroscope2::Valid_ChannelT_4; + nbInChannel:int; + inChannel:Gyroscope2::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +let + assumeOK = true; +tel +-- end of node Gyroscope2::assumeChannel + +node Gyroscope2::assumeEvaluateAxis( + channels:Gyroscope2::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +var + NbToFar:int; +let + NbToFar = red<<Gyroscope2::TooFar, 4>>(0, channels, god^4, + delta_to_god^4); + assumeOK = NbToFar <= 1; +tel +-- end of node Gyroscope2::assumeEvaluateAxis + +node Gyroscope2::assumeVoter( + channels:Gyroscope2::Valid_ChannelT_4; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +let + assumeOK = true; +tel +-- end of node Gyroscope2::assumeVoter + +node Gyroscope2::compare_rolls( + acc_in:Gyroscope2::Valid_ChannelT; + channel:Gyroscope2::Valid_ChannelT) +returns ( + acc_out:Gyroscope2::Valid_ChannelT; + diff:bool); +let + acc_out = acc_in; + diff = Gyroscope2::abs(acc_in.local_value - channel.local_value) > 1.0; +tel +-- end of node Gyroscope2::compare_rolls + +node Gyroscope2::countFalse( + accu_in:real; + elt_in:Gyroscope2::Valid_ChannelT) +returns ( + accu_out:real); +let + accu_out = if elt_in.local_failure then accu_in else accu_in + 1.0; +tel +-- end of node Gyroscope2::countFalse + +node Gyroscope2::countValidChannels( + channels:Gyroscope2::Valid_ChannelT_4) +returns ( + nb:real); +let + nb = red<<Gyroscope2::countFalse, 4>>(0.0, channels); +tel +-- end of node Gyroscope2::countValidChannels + +node Gyroscope2::guaranteeChannel( + previousOutChannel:Gyroscope2::Valid_ChannelT_4; + nbInChannel:int; + inChannel:Gyroscope2::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real; + nextOutChannel:Gyroscope2::Faulty_ChannelT_4; + outChannel:Gyroscope2::Valid_ChannelT) +returns ( + guaranteeOK:bool); +let + guaranteeOK = outChannel.local_failure or Gyroscope2::abs(inChannel.valuea + - outChannel.local_value) < delta and Gyroscope2::abs(inChannel.valueb - + outChannel.local_value) < delta; +tel +-- end of node Gyroscope2::guaranteeChannel + +node Gyroscope2::guaranteeEvaluateAxis( + channels:Gyroscope2::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real; + AxisValue:real) +returns ( + guaranteeOK:bool); +let + guaranteeOK = Gyroscope2::abs(AxisValue - god) < delta_to_god; +tel +-- end of node Gyroscope2::guaranteeEvaluateAxis + +node Gyroscope2::guaranteeVoter( + channels:Gyroscope2::Valid_ChannelT_4; + god:real; + delta_to_god:real; + vote:real) +returns ( + guaranteeOK:bool); +let + guaranteeOK = red<<Gyroscope2::iteratedVoter, 4>>(true, channels, god^4, + delta_to_god^4, vote^4); +tel +-- end of node Gyroscope2::guaranteeVoter + +node Gyroscope2::iteratedVoter( + acc_in:bool; + channel:Gyroscope2::Valid_ChannelT; + god:real; + delta_to_god:real; + vote:real) +returns ( + acc_out:bool); +let + acc_out = acc_in and channel.local_failure or Gyroscope2::abs(vote - + channel.local_value) < delta_to_god; +tel +-- end of node Gyroscope2::iteratedVoter + +node Gyroscope2::masking( + channel:Gyroscope2::Valid_ChannelT) +returns ( + out:real); +let + out = if channel.local_failure then 0.0 else channel.local_value; +tel +-- end of node Gyroscope2::masking + +node Gyroscope2::selectFailure( + from:Gyroscope2::Valid_ChannelT) +returns ( + failure:bool); +let + failure = from.local_failure; +tel +-- end of node Gyroscope2::selectFailure +node Gyroscope2::sum(accu_in:real; elt_in:real) returns (accu_out:real); +let + accu_out = accu_in + elt_in; +tel +-- end of node Gyroscope2::sum + +node Gyroscope2::values_nok( + localChannel:Gyroscope2::Valid_ChannelT; + foreign_Channels:Gyroscope2::Valid_ChannelT_3) +returns ( + cross_failure:bool); +var + diff:bool_3; + lc:Gyroscope2::Valid_ChannelT; +let + (lc, diff) = fillred<<Gyroscope2::compare_rolls, 3>>(localChannel, + foreign_Channels); + cross_failure = if Gyroscope2::selectFailure(foreign_Channels[0]) then + if Gyroscope2::selectFailure(foreign_Channels[1]) then if + Gyroscope2::selectFailure(foreign_Channels[2]) then false else diff[2] else + if Gyroscope2::selectFailure(foreign_Channels[2]) then diff[1] else + diff[1] and diff[2] else if Gyroscope2::selectFailure(foreign_Channels[1]) + then if Gyroscope2::selectFailure(foreign_Channels[2]) then diff[0] else + diff[0] and diff[2] else if Gyroscope2::selectFailure(foreign_Channels[2]) + then diff[0] and diff[1] else diff[0] and diff[1] and diff[2]; +tel +-- end of node Gyroscope2::values_nok + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/alias.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/alias.lus +type bool_2 = bool^2 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +const alias::SIZE = 3; +node alias::alias(a:bool) returns (b:bool; c:int); +let + b = alias::aliasPredefNot(a); + c = alias::aliasGivenNode(0, map<<Lustre::iplus, 3>>(0^3, 3^3)); +tel +-- end of node alias::alias +node alias::aliasBoolRed(i:bool_2) returns (o:bool); +let + o = Lustre::boolred<<0, 1, 2>>(i); +tel +-- end of node alias::aliasBoolRed +node alias::aliasGivenNode(a:int; b:int_3) returns (c:int); +let + c = alias::unNoeud(a, b); +tel +-- end of node alias::aliasGivenNode +node alias::aliasIterOp(i1:int; i2:int_3) returns (o:int); +let + o = Lustre::red<<Lustre::iplus, 3>>(i1, i2); +tel +-- end of node alias::aliasIterOp +node alias::aliasPredefNot(i:bool) returns (o:bool); +let + o = Lustre::not(i); +tel +-- end of node alias::aliasPredefNot +node alias::unNoeud(a:int; b:int_3) returns (c:int); +var + x:bool; +let + c = alias::aliasIterOp(a, b); + x = alias::aliasBoolRed([true, false]); +tel +-- end of node alias::unNoeud + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/bred.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/bred.lus +type bool_2 = bool^2 (*abstract in the source*); +node bred::bred(a:bool_2) returns (x:bool); +let + x = boolred<<0, 1, 2>>(a); +tel +-- end of node bred::bred + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/bred_lv4.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/bred_lv4.lus +type bool_2 = bool^2 (*abstract in the source*); +type bred_lv4::T1_ARRAY = bool^2; +node bred_lv4::bred(i_a:bool_2) returns (o_x:bool); +let + o_x = boolred<<0, 1, 2>>(i_a); +tel +-- end of node bred_lv4::bred + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/clock.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/clock.lus +node clock::clock(a:bool; b:bool) returns (c:bool; d:bool when c); +var + z:bool; + x:bool when z; + y:bool when x; +let + y = clock::clock2(a, b when a) when x; + (z, x) = clock::clock3(pre (z)); + (c, d) = clock::clock4(a, b when a); +tel +-- end of node clock::clock +extern node clock::clock2(u:bool; v:bool when u) returns (y:bool); +extern node clock::clock3(u:bool) returns (x:bool; y:bool when x); + +extern node clock::clock4( + u:bool; + v:bool when u) +returns ( + x:bool; + y:bool when x); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/clock1_2ms.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/demo/clock1_2ms.lus +node clock1_2ms::Clock1ms_node(dummy:bool) returns (Clock1ms:bool); +let + Clock1ms = true -> not pre (Clock1ms); +tel +-- end of node clock1_2ms::Clock1ms_node +node clock1_2ms::Clock2ms_node(dummy:bool) returns (Clock2ms:bool); +let + Clock2ms = true -> not pre (Clock2ms); +tel +-- end of node clock1_2ms::Clock2ms_node + +node clock1_2ms::clock1_2ms( + dummy:bool) +returns ( + Clock1ms:bool; + Clock2ms:bool when Clock1ms); +let + Clock1ms = clock1_2ms::Clock1ms_node(dummy); + Clock2ms = clock1_2ms::Clock2ms_node(dummy when Clock1ms); +tel +-- end of node clock1_2ms::clock1_2ms + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/decl.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/decl.lus +type bool_2 = bool^2 (*abstract in the source*); +type decl::coord = struct {x : real; y : real}; +type decl::coord_tab = decl::coord^1; +type decl::couleur = enum {decl::bleu, decl::blanc, decl::rouge}; +type decl::t1; +type decl::t1_8 = decl::t1^8 (*abstract in the source*); +type decl::t1_8_5 = decl::t1_8^5 (*abstract in the source*); +type decl::t2; +type decl::t3; +type decl::t4 = decl::t1^8; +type decl::t5 = decl::t1_8^5; +const decl::a : int; +const decl::b : int; +const decl::c : int; +const decl::d = true; +const decl::e = 8.5; +const decl::g = 4; +const decl::h = 2; + +extern node decl::decl( + a1:decl::t1; + b1:decl::t1; + c1:decl::t1) +returns ( + d1:bool); + +extern function decl::f1( + a1:decl::couleur; + b1:decl::couleur; + c1:decl::couleur) +returns ( + d1:bool_2); + +extern node decl::n2( + a1:decl::t1_8; + b1:decl::t1_8; + c1:decl::t1_8; + d1:bool) +returns ( + e1:decl::t1_8_5); + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/declaration.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/demo/declaration.lus +type bool_2 = bool^2 (*abstract in the source*); +type declaration::coord = struct {x : real; y : real}; +type declaration::coord_tab = declaration::coord^1; +type declaration::couleur = enum {declaration::bleu, declaration::blanc, declaration::rouge}; +type declaration::t1; +type declaration::t1_8 = declaration::t1^8 (*abstract in the source*); +type declaration::t1_8_5 = declaration::t1_8^5 (*abstract in the source*); +type declaration::t2; +type declaration::t3; +type declaration::t4 = declaration::t1^8; +type declaration::t5 = declaration::t1_8^5; +const declaration::a : int; +const declaration::b : int; +const declaration::c : int; +const declaration::d = true; +const declaration::e = 8.5; +const declaration::g = 4; +const declaration::h = 2; +node declaration::declaration(a1:int) returns (b1:int); +let + b1 = a1; +tel +-- end of node declaration::declaration + +extern function declaration::f1( + a1:declaration::couleur; + b1:declaration::couleur; + c1:declaration::couleur) +returns ( + d1:bool_2); + +extern node declaration::n1( + a1:declaration::t1; + b1:declaration::t1; + c1:declaration::t1) +returns ( + d1:bool); + +extern node declaration::n2( + a1:declaration::t1_8; + b1:declaration::t1_8; + c1:declaration::t1_8; + d1:bool) +returns ( + e1:declaration::t1_8_5); +node declaration::n4(a1:bool) returns (b1:bool); +var + c1:bool; +let + c1 = not false fby c1; + b1 = not a1 and c1; +tel +-- end of node declaration::n4 +node declaration::n5(a1:real) returns (b1:real); +var + c1:real; +let + b1 = a1 / c1; + c1 = 1.0; +tel +-- end of node declaration::n5 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/def.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/def.lus +type int_23 = int^23 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type int_4_4 = int_4^4 (*abstract in the source*); +type int_4_4_4 = int_4_4^4 (*abstract in the source*); +type def::string = int^4; +type def::string2d = int_4^4; +type def::structT = struct {x : int; y : real; z : int_4_4_4}; +type def::structT_2 = def::structT^2 (*abstract in the source*); +type def::t1; +type def::t2; +type def::t3; +type def::tabStruct = def::structT^2; +const def::a = 4; +const def::b = true; +const def::c = 3.14; +const def::id_int = 5; + +node def::def( + a1:bool; + b1:int_4_4 when a1; + c1:def::structT_2 when a1; + d1:int_23) +returns ( + res:bool when a1); +var + h1:int_4; + h2:def::structT_2; + h3:int when a1; + h4:real when a1; + h5:int_4_4_4 when a1; + h6:int_4_4; +let + res = pre (h1[0]) > 0 when a1; + h1[0] = current ( if res then b1[0][0] else b1[1][0]); + h1[1] = current ( if res then b1[0][1] else b1[1][1]); + h1[2] = current ( if res then b1[0][2] else b1[1][2]); + h1[3] = current ( if res then b1[0][3] else b1[1][3]); + h2[0] = current (c1[0]); + h2[1].x = current (c1[1].x); + h2[1].y = current (c1[1].y); + h2[1].z[0][0][0] = 0; + h2[1].z[0][0][1] = 0; + h2[1].z[0][0][2] = 0; + h2[1].z[0][0][3] = 0; + h2[1].z[0][1] = current (c1[1].z[0][1]); + h2[1].z[0][2] = current (c1[1].z[0][2]); + h2[1].z[0][3] = current (c1[1].z[0][3]); + h2[1].z[1] = current (c1[1].z[1]); + h2[1].z[2] = current (c1[1].z[1]); + h2[1].z[3] = current (c1[1].z[1]); + h3 = c1[0].x + c1[1].z[2][1][0]; + h4 = c1[1].y; + h5 = c1[1].z; + h6[2][0] = 0; + h6[2][1] = 1; + h6[2][2] = 2; + h6[2][3] = 3; + h6[1] = current (c1[1].z[2][1]); + h6[0] = current (c1[1].z[2][1]); + h6[3] = current (c1[1].z[2][1]); +tel +-- end of node def::def + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/filliter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/filliter.lus +type int_3 = int^3 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type filliter::t = int^5; +const filliter::NBC = 3; +node filliter::copie(acc_in:int) returns (acc_out:int; elt:int); +let + acc_out = acc_in; + elt = acc_in; +tel +-- end of node filliter::copie + +node filliter::filliter( + c:bool; + i1:int when c; + i2:int when c) +returns ( + s1:int_3 when c; + s2:int_3 when c); +var + x:int_4 when c; + bid1:int when c; + bid2:int when c; +let + s1 = x[0 .. 2]; + (bid1, x) = fill<<filliter::copie, 4>>(i1); + (bid2, s2) = fill<<filliter::incr_acc, 3>>(i2); +tel +-- end of node filliter::filliter +node filliter::incr_acc(acc_in:int) returns (acc_out:int; res:int); +let + res = acc_in; + acc_out = res + 1; +tel +-- end of node filliter::incr_acc + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/filter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/filter.lus +type filter::cdouble = struct {x : filter::complexe; y : filter::complexe}; +type filter::complexe = struct {x : real; y : real}; +node filter::filter(a:real; b:real) returns (ok:bool); +var + i:real; + z:filter::cdouble; +let + z.x.x = 0. -> i; + z.x.y = z.x.x; + z.y.x = z.x.x; + z.y.y = z.y.x; + i = 1.; + ok = z.y.y < z.y.x; +tel +-- end of node filter::filter + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/lustre_test1_ok.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/demo/lustre_test1_ok.lus +node lustre_test1_ok::TransFnc_1(E:real) returns (S:real); +var + Sm_1:real; +let + S = 1.0 * E - 0.5 * Sm_1; + Sm_1 = 0.0 -> pre (S); +tel +-- end of node lustre_test1_ok::TransFnc_1 + +node lustre_test1_ok::lustre_test1_ok( + In1:real; + cl1_2:bool; + cl1_4:bool; + In2:real; + cl2_6:bool when cl1_2; + In3:bool when cl1_4) +returns ( + out1:real; + Out2:real; + Out3:real); +var + Sum:real; + Unit_Delay1:real; + zoh1:real when cl1_4; + zoh2:real when cl2_6; + subsys1_Trigger:bool when cl1_4; + subsys1_s1:real when cl1_4; + subsys1_s2:real when cl1_4; + Unit_Delay1_:real when cl1_2; + Out2_:real when cl1_2; +let + Sum = In1 + Unit_Delay1; + Unit_Delay1_ = if cl2_6 then current (zoh2) else 0.0 when cl1_2 -> pre + (Unit_Delay1_); + Unit_Delay1 = if cl1_2 then current (Unit_Delay1_) else 0.0 -> pre + (Unit_Delay1); + zoh1 = In1 when cl1_4; + zoh2 = In2 when cl2_6; + out1 = Sum; + Out2_ = if cl2_6 then current (zoh2) else 0.0 when cl1_2 -> pre (Out2_); + Out2 = if cl1_2 then current (Out2_) else 0.0 -> pre (Out2); + Out3 = if cl1_4 then current (subsys1_s2) else 0.0 -> pre (Out3); + subsys1_Trigger = lustre_test1_ok::rising(In3); + subsys1_s1 = zoh1; + subsys1_s2 = if subsys1_Trigger then current + (lustre_test1_ok::subsys1(subsys1_s1 when subsys1_Trigger)) else 0.0 when + cl1_4 -> pre (subsys1_s2); +tel +-- end of node lustre_test1_ok::lustre_test1_ok +node lustre_test1_ok::rising(in:bool) returns (out:bool); +let + out = false -> in and not pre (in); +tel +-- end of node lustre_test1_ok::rising +node lustre_test1_ok::subsys1(s1:real) returns (s2:real); +var + Discrete_Filter:real; +let + Discrete_Filter = lustre_test1_ok::TransFnc_1(s1); + s2 = Discrete_Filter; +tel +-- end of node lustre_test1_ok::subsys1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/map_red_iter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/demo/map_red_iter.lus +type bool_20 = bool^20 (*abstract in the source*); +type int_20 = int^20 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type map_red_iter::INTNBC = int^20; +type map_red_iter::INTNBG = int^4; +type map_red_iter::T_ComChg = int; +type map_red_iter::T_EntreeGlob = struct {chg2gen : int_20; mesure_chgs : int_20; mesure_gens : int_4}; +type map_red_iter::T_EtatCharge = int; +type map_red_iter::T_InfoChgGlob = struct {chg2gen : int_20}; +type map_red_iter::T_InfoChgIndiv = struct {mesure_chg : int}; +type map_red_iter::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : int_20}; +type map_red_iter::T_InfoGenIndiv = struct {mesure_gen : int}; +const map_red_iter::NBC = 20; +const map_red_iter::NBG = 4; + +node map_red_iter::map_red_iter( + indice_gen:int; + InfoGenIndiv:map_red_iter::T_InfoGenIndiv; + InfoGenGlob:map_red_iter::T_InfoGenGlob; + TabEtatCharge:int_20; + TabComVal:bool_20) +returns ( + TabComChg:int_20); +var + bidon:int; +let + (bidon, TabComChg) = fillred<<map_red_iter::traite_genCore_itere, + 20>>(indice_gen, TabComVal, InfoGenGlob.chg2gen); +tel +-- end of node map_red_iter::map_red_iter + +node map_red_iter::traite_genCore_itere( + acc_in:int; + elt1:bool; + elt2:int) +returns ( + acc_out:int; + elt:int); +let + elt = if elt1 then elt2 else acc_in; + acc_out = acc_in; +tel +-- end of node map_red_iter::traite_genCore_itere + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mapdeRed.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mapdeRed.lus +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +const mapdeRed::m = 3; +const mapdeRed::n = 2; +const mapdeRed::p = 5; +node mapdeRed::incr(i:int) returns (accu:int; s:int); +let + accu = i + 1; + s = i; +tel +-- end of node mapdeRed::incr + +node mapdeRed::mapdeRed( + init:int_2; + init2:int) +returns ( + r:int_2; + T:int_2_3; + bid:int); +let + (bid, T) = fill<<Lustre::fill<<mapdeRed::incr, 2>>, 3>>(init2); + r = red<<Lustre::map<<Lustre::plus, 2>>, 3>>(init, T); +tel +-- end of node mapdeRed::mapdeRed + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mapinf.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mapinf.lus +type bool_10 = bool^10 (*abstract in the source*); +type int_10 = int^10 (*abstract in the source*); +node mapinf::mapinf(t1:int_10; t2:int_10) returns (res:bool_10); +let + res = map<<Lustre::lt, 10>>(t1, t2); +tel +-- end of node mapinf::mapinf + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mapiter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mapiter.lus +type int_7 = int^7 (*abstract in the source*); +type int_7_3 = int_7^3 (*abstract in the source*); +node mapiter::incr_tab(a:int) returns (b:int); +let + b = a + 1; +tel +-- end of node mapiter::incr_tab +node mapiter::mapiter(i1:int_7_3) returns (s1:int_7_3); +let + s1 = map<<Lustre::map<<mapiter::incr_tab, 7>>, 3>>(i1); +tel +-- end of node mapiter::mapiter + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mappredef.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/mappredef.lus +type bool_3 = bool^3 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +type mappredef::tab_bool = bool^3; +type mappredef::tab_int = int^3; +const mappredef::N = 3; + +node mappredef::mappredef( + x:bool_3; + a:int_3; + b:int_3) +returns ( + c:int_3; + d:int_3); +var + z:int; +let + z = if x[0] then a[0] else b[0]; + c = map<<Lustre::if, 3>>(x, a, b); + d = map<<Lustre::iuminus, 3>>(b); +tel +-- end of node mappredef::mappredef + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/plus.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/plus.lus +node plus::plus(a:int; b:int) returns (c:int; d:int; e:int; f:int); +let + c = a + b; + d = a + b; + e = if boolred<<0, 1, 2>>(true^2) then a else b; + f = if nor(c < b, c <= b) then a else b + if boolred<<0, 0, 2>>([c < b, + c <= b]) then a else b; +tel +-- end of node plus::plus + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/pre_x.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/pre_x.lus +node pre_x::pre_x(a:int; b:int) returns (x:bool); +let + x = false -> if pre (a) = pre (b) then not pre (x) else pre (x); +tel +-- end of node pre_x::pre_x + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/rediter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/rediter.lus +type int_5 = int^5 (*abstract in the source*); +type int_5_3 = int_5^3 (*abstract in the source*); +node rediter::max(init:int; a:int) returns (b:int); +let + b = if init > a then init else a; +tel +-- end of node rediter::max +node rediter::rediter(a:int_5_3) returns (b:int); +let + b = red<<Lustre::red<<rediter::max, 5>>, 3>>(0, a); +tel +-- end of node rediter::rediter + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/redoptest.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/redoptest.lus +type int_5 = int^5 (*abstract in the source*); +type int_5_3 = int_5^3 (*abstract in the source*); +node redoptest::max(init:int; a:int) returns (b:int); +let + b = if init > a then init else a; +tel +-- end of node redoptest::max +node redoptest::redoptest(a:int_5_3) returns (b:int); +let + b = red<<Lustre::red<<Lustre::plus, 5>>, 3>>(0, a); +tel +-- end of node redoptest::redoptest + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/demo/sample_time_change.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/demo/sample_time_change.lus +node sample_time_change::MainNode(In3:real) returns (Out2:real); +var + cl1_4_2:bool; + cl1_12_3:bool; + Out2_:real when cl1_4_2; +let + cl1_4_2 = sample_time_change::make_cl1_4_2(true); + cl1_12_3 = sample_time_change::make_cl1_12_3(true); + Out2_ = sample_time_change::sample_time_change(cl1_4_2, cl1_12_3, In3 when + cl1_12_3); + Out2 = if cl1_4_2 then current (Out2_) else 0.0 -> pre (Out2); +tel +-- end of node sample_time_change::MainNode +node sample_time_change::make_cl1_12_3(in:bool) returns (out:bool); +var + cl1:bool; + cl2:bool; + cl3:bool; + cl4:bool; + cl5:bool; + cl6:bool; + cl7:bool; + cl8:bool; + cl9:bool; + cl10:bool; + cl11:bool; + cl12:bool; + pha1:bool; + pha2:bool; + pha3:bool; +let + cl1 = true -> pre (cl2); + cl2 = false -> pre (cl3); + cl3 = false -> pre (cl4); + cl4 = false -> pre (cl5); + cl5 = false -> pre (cl6); + cl6 = false -> pre (cl7); + cl7 = false -> pre (cl8); + cl8 = false -> pre (cl9); + cl9 = false -> pre (cl10); + cl10 = false -> pre (cl11); + cl11 = false -> pre (cl12); + cl12 = false -> pre (cl1); + pha1 = false -> pre (cl1); + pha2 = false -> pre (pha1); + pha3 = false -> pre (pha2); + out = pha3; +tel +-- end of node sample_time_change::make_cl1_12_3 +node sample_time_change::make_cl1_4_2(in:bool) returns (out:bool); +var + cl1:bool; + cl2:bool; + cl3:bool; + cl4:bool; + pha1:bool; + pha2:bool; +let + cl1 = true -> pre (cl2); + cl2 = false -> pre (cl3); + cl3 = false -> pre (cl4); + cl4 = false -> pre (cl1); + pha1 = false -> pre (cl1); + pha2 = false -> pre (pha1); + out = pha2; +tel +-- end of node sample_time_change::make_cl1_4_2 + +node sample_time_change::sample_time_change( + cl1_4_2:bool; + cl1_12_3:bool; + In3:real when cl1_12_3) +returns ( + Out2:real when cl1_4_2); +var + Unit_Delay1:real when cl1_12_3; + Unit_Delay2:real when cl1_4_2; +let + Unit_Delay1 = 0.0 when cl1_12_3 -> pre (In3); + Unit_Delay2 = 0.0 when cl1_4_2 -> pre (Unit_Delay2); + Out2 = Unit_Delay2; +tel +-- end of node sample_time_change::sample_time_change + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/bob.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/bob.lus +node bob::bob(i:bool) returns (o:bool when i); +let + assert(true -> i <> pre (i)); + o = true -> pre (false -> pre (i)) when i; +tel +-- end of node bob::bob + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/def.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/def.lus +node def::def(i:bool) returns (a:bool; b:bool); +let + a = true; + b = false; +tel +-- end of node def::def + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/ex.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/ex.lus +node ex::ex(i:bool) returns (o:bool); +let + o = true -> pre (i) and ex::trueNode(i); +tel +-- end of node ex::ex +node ex::id(f:bool; a:bool) returns (g:bool); +let + g = f or a; +tel +-- end of node ex::id +node ex::trueNode(x:bool) returns (y:bool); +let + y = x or ex::id(true, false); +tel +-- end of node ex::trueNode + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/iter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/iter.lus +type int_5 = int^5 (*abstract in the source*); +const iter::n = 5; +node iter::filled(accu_in:int) returns (accu_out:int; elt:int); +let + accu_out = accu_in + 1; + elt = accu_in; +tel +-- end of node iter::filled + +node iter::garcia( + accu_in:int; + elt_in:int) +returns ( + accu_out:int; + elt_out:int); +let + accu_out = accu_in + 1; + elt_out = elt_in + accu_out; +tel +-- end of node iter::garcia + +node iter::iter( + init:int) +returns ( + Tab_out:int_5; + Red_plus:int; + zorroTab:int_5; + zorroAcc:int); +var + T_inter:int_5; + bidon:int; +let + (bidon, T_inter) = fill<<iter::filled, 5>>(init); + Tab_out = map<<iter::mapped, 5>>(T_inter); + Red_plus = red<<Lustre::iplus, 5>>(-100, Tab_out); + (zorroAcc, zorroTab) = fillred<<iter::garcia, 5>>(0, [0, 0, 0, 0, 0]); +tel +-- end of node iter::iter +node iter::mapped(elt_in:int) returns (elt_out:int); +let + elt_out = elt_in + 1; +tel +-- end of node iter::mapped +node iter::plus(accu_in:int; elt_in:int) returns (accu_out:int); +let + accu_out = accu_in + elt_in; +tel +-- end of node iter::plus + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/iterate.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/iterate.lus +type int_10 = int^10 (*abstract in the source*); + +node iterate::fill_redduced( + accu_in:int; + elt_in1:int; + elt_in2:int) +returns ( + accu_out:int; + elt_out1:int; + elt_out2:int; + elt_out3:int); +let + accu_out = accu_in + 1; + elt_out1 = elt_in1; + elt_out2 = elt_in2; + elt_out3 = elt_in1 + elt_in2; +tel +-- end of node iterate::fill_redduced + +node iterate::filled( + accu_in:int) +returns ( + accu_out:int; + elt_out1:int; + elt_out2:int); +let + accu_out = accu_in + 1; + elt_out1 = accu_in; + elt_out2 = accu_in * 2; +tel +-- end of node iterate::filled + +node iterate::iterate( + IN1:int_10; + IN2:int_10) +returns ( + OUT:int_10; + out_map1:int_10; + out_map2:int_10; + out_red1:int; + out_fill1:int_10; + out_fill2:int_10; + out_fillred1:int; + out_fillred2:int_10; + out_fillred3:int_10); +var + bidon:int; +let + (out_map1, out_map2) = map<<iterate::mapped, 10>>(IN1, IN2); + out_red1 = red<<iterate::redduced, 10>>(0, IN1, IN2); + (bidon, out_fill1, out_fill2) = fill<<iterate::filled, 10>>(0); + (out_fillred1, out_fillred2, out_fillred3, OUT) = + fillred<<iterate::fill_redduced, 10>>(0, IN1, IN2); +tel +-- end of node iterate::iterate + +node iterate::mapped( + elt_in1:int; + elt_in2:int) +returns ( + elt_out1:int; + elt_out2:int); +let + elt_out1 = elt_in1; + elt_out2 = elt_in2; +tel +-- end of node iterate::mapped + +node iterate::redduced( + accu_in:int; + elt_in1:int; + elt_in2:int) +returns ( + accu_out:int); +let + accu_out = accu_in + elt_in1 + elt_in2; +tel +-- end of node iterate::redduced + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/lecteur.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/lecteur.lus + +node lecteur::Controleur( + diff:int) +returns ( + vitesse:int; + Plus:bool; + Moins:bool); +let + vitesse = 0 -> pre (vitesse) + diff; + Plus = vitesse <= 9; + Moins = vitesse >= 11; +tel +-- end of node lecteur::Controleur + +node lecteur::Environnement( + diff:int; + Plus:bool; + Moins:bool) +returns ( + ok:bool); +let + ok = -4 <= diff and diff <= 4 and if true -> pre (Plus) then diff >= 1 + else true and if false -> pre (Moins) then diff <= -1 else true; +tel +-- end of node lecteur::Environnement +node lecteur::Propriete(vitesse:int) returns (ok:bool); +var + cpt:int; + acceptable:bool; +let + acceptable = 8 <= vitesse and vitesse <= 12; + cpt = 0 -> if acceptable then 0 else pre (cpt) + 1; + ok = true -> pre (cpt) < 15; +tel +-- end of node lecteur::Propriete +node lecteur::lecteur(diff:int) returns (ok:bool); +var + vitesse:int; + Plus:bool; + Moins:bool; + realiste:bool; +let + assert(realiste); + (vitesse, Plus, Moins) = lecteur::Controleur(diff); + realiste = lecteur::Environnement(diff, Plus, Moins); + ok = lecteur::Propriete(vitesse); +tel +-- end of node lecteur::lecteur + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/lucky.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/lucky.lus +node lucky::after(X:bool) returns (afterX:bool); +let + afterX = false -> pre (X or afterX); +tel +-- end of node lucky::after +node lucky::implies(X:bool; Y:bool) returns (XimpliesY:bool); +let + XimpliesY = not X or Y; +tel +-- end of node lucky::implies +node lucky::lucky(signal:int; action:bool) returns (alarm:bool); +var + active:bool; + begin:bool; + en:bool; +let + active = signal > 20 -> if pre (active) then signal > 10 else signal > + 20; + begin = active and false -> not pre (active); + en = not active and false -> pre (active); + alarm = not lucky::once_from_to(action, begin, en) or + lucky::stable(active) > 10; +tel +-- end of node lucky::lucky +node lucky::once_from_to(C:bool; A:bool; B:bool) returns (X:bool); +let + X = lucky::implies(B, false -> pre (lucky::once_since(C, A))); +tel +-- end of node lucky::once_from_to +node lucky::once_since(C:bool; A:bool) returns (X:bool); +let + X = if A then C else if lucky::after(A) then C or false -> pre (X) else + false; +tel +-- end of node lucky::once_since +node lucky::stable(i:bool) returns (o:int); +let + o = if true -> i = pre (i) then 1 + 0 -> pre (o) else 0; +tel +-- end of node lucky::stable + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/morel.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/morel.lus +type bool_3 = bool^3 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +type morel::arrayb = bool^3; +type morel::arrayi = int_2^3; +node morel::mcmorel(i:int) returns (t:int_2); +let + t = [i, i] -> [pre (t[0]) + 1, pre (t[1]) + 2]; +tel +-- end of node morel::mcmorel + +node morel::morel( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +let + (b1, b2, b3, i1, i2, i3) = morel::tab(b, i); +tel +-- end of node morel::morel + +node morel::tab( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +var + tabb:bool_3; + tabi:int_2_3; +let + (b1, b2, b3) = (tabb[0], tabb[1], tabb[2]); + (i1, i2, i3) = (tabi[0][0] + tabi[0][1], tabi[1][0] + tabi[1][1], + tabi[2][0] + tabi[2][1]); + tabb[0] = b; + tabb[1 .. 2] = [true, false]; + tabi[2] = morel::mcmorel(i); + tabi[0 .. 1] = [[10, 100], [1000, 10000]]; +tel +-- end of node morel::tab + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/morel2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/morel2.lus +type bool_3 = bool^3 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +type morel2::a2 = int^2; +type morel2::a32 = int_2^3; +type morel2::arrayb = bool^3; +type morel2::arrayi = int_2^3; +node morel2::mcmorel(i:int) returns (t:int_2); +let + t = [i, i] -> [pre (t[0]) + 1, pre (t[1]) + 2]; +tel +-- end of node morel2::mcmorel + +node morel2::morel2( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +var + tabb:bool_3; + tabi:int_2_3; + toto:int_2_3; +let + (b1, b2, b3) = (tabb[0], tabb[1], tabb[2]); + (i1, i2, i3) = (tabi[0][0] + tabi[0][1], tabi[1][0] + tabi[1][1], + tabi[2][0] + tabi[2][1]); + tabb[0] = b; + tabb[1 .. 2] = [true, false]; + toto[2] = morel2::mcmorel(i); + toto[0 .. 1] = [[10, 100], [1000, 10000]]; + tabi = toto; +tel +-- end of node morel2::morel2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/morel3.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/morel3.lus +type bool_3 = bool^3 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +type morel3::arrayb = bool^3; +type morel3::arrayi = int_2^3; +node morel3::mcmorel(i:int) returns (t:int_2); +let + t = [i, i] -> [1, pre (t[1]) + 2]; +tel +-- end of node morel3::mcmorel + +node morel3::morel3( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +let + (b1, b2, b3, i1, i2, i3) = morel3::tab(b, i); +tel +-- end of node morel3::morel3 + +node morel3::tab( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +var + tabb:bool_3; + tabi:int_2_3; +let + (b1, b2, b3) = (tabb[0], tabb[1], tabb[2]); + (i1, i2, i3) = (tabi[0][0] + tabi[0][1], tabi[1][0] + tabi[1][1], + tabi[2][0] + tabi[2][1]); + tabb[0] = b; + tabb[1 .. 2] = [true, false]; + tabi[2] = morel3::mcmorel(i); + tabi[0 .. 1] = [[10, 100], [1000, 10000]]; +tel +-- end of node morel3::tab + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/morel4.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/morel4.lus +type bool_3 = bool^3 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +type morel4::arrayb = bool^3; +type morel4::arrayi = int_2^3; +type morel4::toto = struct {titi : morel4::tube; tutu : bool}; +type morel4::tube = struct {in : int; out : int}; +node morel4::mcmorel(i:int) returns (t:int_2); +var + yo:morel4::toto; +let + yo.titi = morel4::tube{in=i;out=i + 1}; + yo.tutu = true; + t = [yo.titi.in, yo.titi.out] -> [pre (t[0]) + 1, pre (t[1])]; +tel +-- end of node morel4::mcmorel + +node morel4::morel4( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +let + (b1, b2, b3, i1, i2, i3) = morel4::tab(b, i); +tel +-- end of node morel4::morel4 + +node morel4::tab( + b:bool; + i:int) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +var + tabb:bool_3; + tabi:int_2_3; +let + (b1, b2, b3) = (tabb[0], tabb[1], tabb[2]); + (i1, i2, i3) = (tabi[0][0] + tabi[0][1], tabi[1][0] + tabi[1][1], + tabi[2][0] + tabi[2][1]); + tabb[0] = b; + tabb[1 .. 2] = [true, false]; + tabi[2] = morel4::mcmorel(i); + tabi[0 .. 1] = [[10, 100], [1000, 10000]]; +tel +-- end of node morel4::tab + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/morel5.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/morel5.lus +type bool_3 = bool^3 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_2_2 = int_2^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +type morel5::arrayb = bool^3; +type morel5::arrayi = int_2^3; +type morel5::toto = struct {titi : morel5::tube; tutu : bool}; +type morel5::tube = struct {in : int; out : int}; +node morel5::mcmorel(i:int) returns (t:int_2; u:int_2_2); +var + yo:morel5::toto; +let + yo.titi = morel5::tube{in=i;out=i + 1}; + yo.tutu = true; + t = [yo.titi.in, yo.titi.out] -> [pre (t[0]) + 1, pre (t[1])]; + u = [[10, 100], [1000, 10000]]; +tel +-- end of node morel5::mcmorel + +node morel5::morel5( + t:morel5::toto; + b:bool_3; + i:int_2_3) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +let + (b1, b2, b3, i1, i2, i3) = morel5::tab(t, b, i); +tel +-- end of node morel5::morel5 + +node morel5::tab( + yo:morel5::toto; + tabb:bool_3; + tabi:int_2_3) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +let + (b1, b2, b3) = (tabb[0], tabb[1], tabb[2] or yo.tutu); + (i1, i2, i3) = (tabi[0][0] + tabi[0][1], tabi[1][0] + tabi[1][1] + + yo.titi.in, tabi[2][0] + tabi[2][1] + yo.titi.out); +tel +-- end of node morel5::tab + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/noAlarm.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/noAlarm.lus +node noAlarm::noAlarm(alarm:bool) returns (ok:bool); +let + ok = not alarm; +tel +-- end of node noAlarm::noAlarm + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/notTwo.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/notTwo.lus +node notTwo::notTwo(a:bool; b:bool) returns (o:bool); +let + o = not a and b; +tel +-- end of node notTwo::notTwo + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/onlyroll.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/onlyroll.lus +const onlyroll::BID_LAST = 2.2; +const onlyroll::BID_VAL = 3.3; +const onlyroll::CROSS_CH_TOL_PITCH = 10.1; +const onlyroll::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll::CROSS_CH_TOL_YAW = 10.0; +const onlyroll::DELTA_PITCH = 3.0; +const onlyroll::DELTA_ROLL = 14.9; +const onlyroll::DELTA_YAW = 2.73; +const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.0; +const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; +const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::HORmaxP = 57.0; +const onlyroll::HORmaxR = 285.0; +const onlyroll::HORmaxY = 57.0; +const onlyroll::HORminP = -57.0; +const onlyroll::HORminR = -285.0; +const onlyroll::HORminY = -57.0; +const onlyroll::NRmaxP = 5.1; +const onlyroll::NRmaxR = 25.3; +const onlyroll::NRmaxY = 5.0; +const onlyroll::NRminP = -5.1; +const onlyroll::NRminR = -25.3; +const onlyroll::NRminY = -5.0; +const onlyroll::OneSecond = 10; +const onlyroll::SAFE_COUNTER_TIME = 3; +const onlyroll::TIME5 = 4; +const onlyroll::TIME_CROSS_ROLL = 3; +const onlyroll::TIME_ROLL = 3; +const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.1; + +node onlyroll::Allocator( + r1:bool; + r2:bool; + r3:bool; + r4:bool; + reset:bool) +returns ( + a1:bool; + a2:bool; + a3:bool; + a4:bool); +var + nb_aut:int; + already:int; +let + already = if true -> reset then 0 else pre (nb_aut); + a1 = r1 and already <= 1; + a2 = r2 and not r1 and already <= 1 or r1 and already = 0; + a3 = r3 and not r1 and not r2 and already <= 1 or #(r1, r2) and already = + 0; + a4 = r4 and not r1 and not r2 and not r3 and already <= 1 or #(r1, r2, r3) + and already = 0; + nb_aut = if true -> reset then 0 else pre (nb_aut) + if a1 then 1 else 0 + + if a2 then 1 else 0 + if a3 then 1 else 0 + if a4 then 1 else 0; +tel +-- end of node onlyroll::Allocator + +node onlyroll::Average( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +let + r = if f1 then if f2 then onlyroll::Average2(x3, x4) else if f3 then + onlyroll::Average2(x2, x4) else onlyroll::Average2(x3, x2) else if f2 then + if f1 then onlyroll::Average2(x3, x4) else if f3 then + onlyroll::Average2(x1, x4) else onlyroll::Average2(x3, x1) else if f3 then + if f2 then onlyroll::Average2(x1, x4) else if f4 then + onlyroll::Average2(x2, x1) else onlyroll::Average2(x4, x2) else if f2 then + onlyroll::Average2(x3, x1) else if f3 then onlyroll::Average2(x2, x1) else + onlyroll::Average2(x3, x2); +tel +-- end of node onlyroll::Average +node onlyroll::Average2(a:real; b:real) returns (z:real); +let + z = a + b / 2.0; +tel +-- end of node onlyroll::Average2 + +node onlyroll::Calculate( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + x:real); +var + zero_roll:bool; + one_roll:bool; + two_roll:bool; + three_roll:bool; + cpt_roll:int; +let + cpt_roll = 0 -> if three_roll then 3 else if pre (cpt_roll) > 0 then pre + (cpt_roll) - 1 else 0; + zero_roll = onlyroll::noneof(f1, f2, f3, f4); + one_roll = onlyroll::oneoffour(f1, f2, f3, f4); + two_roll = onlyroll::twooffour(f1, f2, f3, f4); + three_roll = onlyroll::threeoffour(f1, f2, f3, f4); + x = if zero_roll and cpt_roll = 0 then onlyroll::OlympicAverage(x1, x2, + x3, x4) else if one_roll and cpt_roll = 0 then onlyroll::Median(x1, x2, + x3, x4, f1, f2, f3, f4) else if two_roll and cpt_roll = 0 then + onlyroll::Average(x1, x2, x3, x4, f1, f2, f3, f4) else 1.0; +tel +-- end of node onlyroll::Calculate + +node onlyroll::Channel( + ongroundreset:bool; + inairreset:bool; + choffi:bool; + xai:real; + xbi:real; + disci:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + allowedi:bool) +returns ( + xi:real; + fi:bool; + aski:bool; + debug_localfailure:bool; + debug_cross_failure:bool; + debug_st:int); +var + local_failure:bool; +let + (xi, local_failure) = onlyroll::Monitor(xai, xbi, disci); + (fi, debug_cross_failure, debug_st, aski) = + onlyroll::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, + pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); + debug_localfailure = local_failure; +tel +-- end of node onlyroll::Channel + +node onlyroll::FailDetect( + local_failure:bool; + xi:real; + ongroundreset:bool; + inairreset:bool; + choffi:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + a:bool) +returns ( + failure:bool; + debug_cross_failure:bool; + debug_st:int; + r:bool); +var + cross_failure:bool; + ps:int; + state:int; + from1to2:bool; + from1to3:bool; + from2to3:bool; + from2to1:bool; + from3to1:bool; + NLfaults:bool; + will_latch:bool; + reset:bool; + foreign_failure:bool; +let + debug_st = state; + ps = 1 -> pre (state); + state = 1 -> if ps = 1 then if pre (reset) then 1 else if pre + (from1to2) then 2 else if pre (from1to3) then 3 else 1 else if ps = 2 + then if pre (from2to1) then 1 else if pre (from2to3) then 3 else 2 else + if pre (from3to1) then 1 else 3; + failure = state = 2 or state = 3 or state = 1 and NLfaults; + reset = ongroundreset or inairreset and not cross_failure; + foreign_failure = pfother1 or pfother2 or pfother3; + NLfaults = choffi or local_failure; + from1to2 = will_latch and not onlyroll::InNominalRange(xi); + will_latch = cross_failure; + from1to3 = a and will_latch and onlyroll::InNominalRange(xi); + from2to3 = a and pre (will_latch) and foreign_failure or local_failure; + from3to1 = ongroundreset; + from2to1 = reset; + r = false -> pre (state) = 1 and cross_failure or pre (state) = 2 and pre + (cross_failure) and foreign_failure or local_failure; + cross_failure = onlyroll::values_nok(pfother1, pfother2, pfother3, xi, + pxother1, pxother2, pxother3); + debug_cross_failure = cross_failure; +tel +-- end of node onlyroll::FailDetect +node onlyroll::InHardoverRange(r:real) returns (i:bool); +let + i = r > 285.0 or r < -285.0; +tel +-- end of node onlyroll::InHardoverRange +node onlyroll::InNominalRange(r:real) returns (i:bool); +let + i = r < 25.3 and r > -25.3; +tel +-- end of node onlyroll::InNominalRange + +node onlyroll::Median( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +let + r = if f1 then onlyroll::MedianValue3(x2, x3, x4) else if f2 then + onlyroll::MedianValue3(x1, x3, x4) else if f3 then + onlyroll::MedianValue3(x1, x2, x4) else onlyroll::MedianValue3(x1, x2, x3); +tel +-- end of node onlyroll::Median +node onlyroll::MedianValue3(a:real; b:real; c:real) returns (z:real); +let + z = a + b + c - onlyroll::min2(a, onlyroll::min2(b, c)) - + onlyroll::max2(a, onlyroll::max2(b, c)); +tel +-- end of node onlyroll::MedianValue3 + +node onlyroll::Monitor( + xa:real; + xb:real; + disc:bool) +returns ( + local_value:real; + inline_monitor_failed:bool); +let + inline_monitor_failed = onlyroll::maintain(3, onlyroll::abs(xa - xb) > + 14.9) or disc; + local_value = xa; +tel +-- end of node onlyroll::Monitor + +node onlyroll::OlympicAverage( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = one + two + three + four - onlyroll::max4(one, two, three, four) - + onlyroll::min4(one, two, three, four) / 2.0; +tel +-- end of node onlyroll::OlympicAverage +node onlyroll::abs(v:real) returns (a:real); +let + a = if v >= 0.0 then v else -v; +tel +-- end of node onlyroll::abs +node onlyroll::maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; +let + cpt = if val then 1 else 0 -> if val then pre (cpt) + 1 else 0; + m = cpt >= n; +tel +-- end of node onlyroll::maintain +node onlyroll::max2(one:real; two:real) returns (m:real); +let + m = if one > two then one else two; +tel +-- end of node onlyroll::max2 + +node onlyroll::max4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = onlyroll::max2(onlyroll::max2(one, two), onlyroll::max2(three, four)); +tel +-- end of node onlyroll::max4 +node onlyroll::min2(one:real; two:real) returns (m:real); +let + m = if one < two then one else two; +tel +-- end of node onlyroll::min2 + +node onlyroll::min4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = onlyroll::min2(onlyroll::min2(one, two), onlyroll::min2(three, four)); +tel +-- end of node onlyroll::min4 + +node onlyroll::noneof( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = not f1 and not f2 and not f3 and not f4; +tel +-- end of node onlyroll::noneof + +node onlyroll::oneoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = f1 and not f2 and not f3 and not f4 or f2 and not f1 and not f3 and + not f4 or f3 and not f1 and not f2 and not f4 or f4 and not f1 and not f2 + and not f3; +tel +-- end of node onlyroll::oneoffour + +node onlyroll::onlyroll( + xa1:real; + xb1:real; + xa2:real; + xb2:real; + xa3:real; + xb3:real; + xa4:real; + xb4:real; + ongroundreset:bool; + inairreset:bool; + disc1:bool; + disc2:bool; + disc3:bool; + disc4:bool; + choff1:bool; + choff2:bool; + choff3:bool; + choff4:bool) +returns ( + x:real; + debug_localfailure1:bool; + debug_localfailure2:bool; + debug_localfailure3:bool; + debug_localfailure4:bool; + debug_cross_failure1:bool; + debug_cross_failure2:bool; + debug_cross_failure3:bool; + debug_cross_failure4:bool; + debug_ch_failed1:bool; + debug_ch_failed2:bool; + debug_ch_failed3:bool; + debug_ch_failed4:bool; + debug_st1:int; + debug_st2:int; + debug_st3:int; + debug_st4:int); +var + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool; + ask1:bool; + ask2:bool; + ask3:bool; + ask4:bool; + allowed1:bool; + allowed2:bool; + allowed3:bool; + allowed4:bool; +let + debug_ch_failed1 = f1; + debug_ch_failed2 = f2; + debug_ch_failed3 = f3; + debug_ch_failed4 = f4; + (x1, f1, ask1, debug_localfailure1, debug_cross_failure1, debug_st1) = + onlyroll::Channel(ongroundreset, inairreset, choff1, xa1, xb1, disc1, 0.0 + -> pre (x2), 0.0 -> pre (x3), 0.0 -> pre (x4), false -> pre (f2), false -> + pre (f3), false -> pre (f4), allowed1); + (x2, f2, ask2, debug_localfailure2, debug_cross_failure2, debug_st2) = + onlyroll::Channel(ongroundreset, inairreset, choff2, xa2, xb2, disc2, 0.0 + -> pre (x1), 0.0 -> pre (x3), 0.0 -> pre (x4), false -> pre (f1), false -> + pre (f3), false -> pre (f4), allowed2); + (x3, f3, ask3, debug_localfailure3, debug_cross_failure3, debug_st3) = + onlyroll::Channel(ongroundreset, inairreset, choff3, xa3, xb3, disc3, 0.0 + -> pre (x1), 0.0 -> pre (x2), 0.0 -> pre (x4), false -> pre (f1), false -> + pre (f2), false -> pre (f4), allowed3); + (x4, f4, ask4, debug_localfailure4, debug_cross_failure4, debug_st4) = + onlyroll::Channel(ongroundreset, inairreset, choff4, xa4, xb4, disc4, 0.0 + -> pre (x1), 0.0 -> pre (x2), 0.0 -> pre (x3), false -> pre (f1), false -> + pre (f2), false -> pre (f3), allowed4); + (allowed1, allowed2, allowed3, allowed4) = pre (onlyroll::Allocator(ask1, + ask2, ask3, ask4, ongroundreset)); + x = onlyroll::Calculate(x1, x2, x3, x4, f1, f2, f3, f4); +tel +-- end of node onlyroll::onlyroll + +node onlyroll::threeoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = onlyroll::oneoffour(not f1, not f2, not f3, not f4); +tel +-- end of node onlyroll::threeoffour + +node onlyroll::twooffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = f1 and f2 and not f3 and not f4 or f3 and not f2 and not f4 or f4 and + not f2 and not f3 or f2 and f1 and not f3 and not f4 or f3 and not f1 and + not f4 or f4 and not f1 and not f3 or f3 and f2 and not f1 and not f4 or f1 + and not f2 and not f4 or f4 and not f2 and not f1 or f4 and f2 and not f3 + and not f1 or f3 and not f2 and not f1 or f1 and not f2 and not f3; +tel +-- end of node onlyroll::twooffour + +node onlyroll::values_nok( + pfother1:bool; + pfother2:bool; + pfother3:bool; + xi:real; + pxother1:real; + pxother2:real; + pxother3:real) +returns ( + r:bool); +var + one:bool; + two:bool; + three:bool; +let + one = onlyroll::abs(xi - pxother1) > 51.0; + two = onlyroll::abs(xi - pxother2) > 51.0; + three = onlyroll::abs(xi - pxother3) > 51.0; + r = onlyroll::maintain(3, if pfother1 then if pfother2 then if pfother3 + then false else three else if pfother3 then two else two and three else + if pfother2 then if pfother3 then one else one and three else if pfother3 + then one and two else one and two and three); +tel +-- end of node onlyroll::values_nok + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/onlyroll2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/onlyroll2.lus +const onlyroll2::BID_LAST = 2.2; +const onlyroll2::BID_VAL = 3.3; +const onlyroll2::CROSS_CH_TOL_PITCH = 10.1; +const onlyroll2::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll2::CROSS_CH_TOL_YAW = 10.0; +const onlyroll2::DELTA_PITCH = 3.0; +const onlyroll2::DELTA_ROLL = 14.9; +const onlyroll2::DELTA_YAW = 2.73; +const onlyroll2::FAIL_SAFE_PITCH_VALUE = 4.0; +const onlyroll2::FAIL_SAFE_ROLL_VALUE = 1.0; +const onlyroll2::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll2::HORmaxP = 57.0; +const onlyroll2::HORmaxR = 285.0; +const onlyroll2::HORmaxY = 57.0; +const onlyroll2::HORminP = -57.0; +const onlyroll2::HORminR = -285.0; +const onlyroll2::HORminY = -57.0; +const onlyroll2::NRmaxP = 5.1; +const onlyroll2::NRmaxR = 25.3; +const onlyroll2::NRmaxY = 5.0; +const onlyroll2::NRminP = -5.1; +const onlyroll2::NRminR = -25.3; +const onlyroll2::NRminY = -5.0; +const onlyroll2::OneSecond = 10; +const onlyroll2::SAFE_COUNTER_TIME = 3; +const onlyroll2::TIME5 = 4; +const onlyroll2::TIME_CROSS_ROLL = 3; +const onlyroll2::TIME_ROLL = 3; +const onlyroll2::XFAIL_SAFE_ROLL_VALUE = 1.1; + +node onlyroll2::Allocator( + r1:bool; + r2:bool; + r3:bool; + r4:bool; + reset:bool) +returns ( + a1:bool; + a2:bool; + a3:bool; + a4:bool); +var + nb_aut:int; + already:int; +let + already = if true -> reset then 0 else pre (nb_aut); + a1 = r1 and already <= 1; + a2 = r2 and not r1 and already <= 1 or r1 and already = 0; + a3 = r3 and not r1 and not r2 and already <= 1 or #(r1, r2) and already = + 0; + a4 = r4 and not r1 and not r2 and not r3 and already <= 1 or #(r1, r2, r3) + and already = 0; + nb_aut = if true -> reset then 0 else pre (nb_aut) + if a1 then 1 else 0 + + if a2 then 1 else 0 + if a3 then 1 else 0 + if a4 then 1 else 0; +tel +-- end of node onlyroll2::Allocator + +node onlyroll2::Average( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +let + r = if f1 then if f2 then onlyroll2::Average2(x3, x4) else if f3 then + onlyroll2::Average2(x2, x4) else onlyroll2::Average2(x3, x2) else if f2 + then if f1 then onlyroll2::Average2(x3, x4) else if f3 then + onlyroll2::Average2(x1, x4) else onlyroll2::Average2(x3, x1) else if f3 + then if f2 then onlyroll2::Average2(x1, x4) else if f4 then + onlyroll2::Average2(x2, x1) else onlyroll2::Average2(x4, x2) else if f2 + then onlyroll2::Average2(x3, x1) else if f3 then onlyroll2::Average2(x2, + x1) else onlyroll2::Average2(x3, x2); +tel +-- end of node onlyroll2::Average +node onlyroll2::Average2(a:real; b:real) returns (z:real); +let + z = a + b / 2.0; +tel +-- end of node onlyroll2::Average2 + +node onlyroll2::Calculate( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + x:real); +var + zero_roll:bool; + one_roll:bool; + two_roll:bool; + three_roll:bool; + cpt_roll:int; +let + cpt_roll = 0 -> if three_roll then 3 else if pre (cpt_roll) > 0 then pre + (cpt_roll) - 1 else 0; + zero_roll = onlyroll2::noneof(f1, f2, f3, f4); + one_roll = onlyroll2::oneoffour(f1, f2, f3, f4); + two_roll = onlyroll2::twooffour(f1, f2, f3, f4); + three_roll = onlyroll2::threeoffour(f1, f2, f3, f4); + x = if zero_roll and cpt_roll = 0 then onlyroll2::OlympicAverage(x1, x2, + x3, x4) else if one_roll and cpt_roll = 0 then onlyroll2::Median(x1, x2, + x3, x4, f1, f2, f3, f4) else if two_roll and cpt_roll = 0 then + onlyroll2::Average(x1, x2, x3, x4, f1, f2, f3, f4) else 1.0; +tel +-- end of node onlyroll2::Calculate + +node onlyroll2::Channel( + ongroundreset:bool; + inairreset:bool; + choffi:bool; + xai:real; + xbi:real; + disci:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + allowedi:bool) +returns ( + xi:real; + fi:bool; + aski:bool; + debug_localfailure:bool; + debug_cross_failure:bool; + debug_st:int); +var + local_failure:bool; +let + (xi, local_failure) = onlyroll2::Monitor(xai, xbi, disci); + (fi, debug_cross_failure, debug_st, aski) = + onlyroll2::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, + pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); + debug_localfailure = local_failure; +tel +-- end of node onlyroll2::Channel + +node onlyroll2::FailDetect( + local_failure:bool; + xi:real; + ongroundreset:bool; + inairreset:bool; + choffi:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + a:bool) +returns ( + failure:bool; + debug_cross_failure:bool; + debug_st:int; + r:bool); +var + cross_failure:bool; + ps:int; + state:int; + from1to2:bool; + from1to3:bool; + from2to3:bool; + from2to1:bool; + from3to1:bool; + NLfaults:bool; + will_latch:bool; + reset:bool; + foreign_failure:bool; +let + debug_st = state; + ps = 1 -> pre (state); + state = 1 -> if ps = 1 then if pre (reset) then 1 else if pre + (from1to2) then 2 else if pre (from1to3) then 3 else 1 else if ps = 2 + then if pre (from2to1) then 1 else if pre (from2to3) then 3 else 2 else + if pre (from3to1) then 1 else 3; + failure = state = 2 or state = 3 or state = 1 and NLfaults; + reset = ongroundreset or inairreset and not cross_failure; + foreign_failure = pfother1 or pfother2 or pfother3; + NLfaults = choffi or local_failure; + from1to2 = will_latch and not onlyroll2::InNominalRange(xi); + will_latch = cross_failure; + from1to3 = a and will_latch and onlyroll2::InNominalRange(xi); + from2to3 = a and pre (will_latch) and foreign_failure or local_failure; + from3to1 = ongroundreset; + from2to1 = reset; + r = false -> pre (state) = 1 and cross_failure or pre (state) = 2 and pre + (cross_failure) and foreign_failure or local_failure; + cross_failure = onlyroll2::values_nok(pfother1, pfother2, pfother3, xi, + pxother1, pxother2, pxother3); + debug_cross_failure = cross_failure; +tel +-- end of node onlyroll2::FailDetect +node onlyroll2::InHardoverRange(r:real) returns (i:bool); +let + i = r > 285.0 or r < -285.0; +tel +-- end of node onlyroll2::InHardoverRange +node onlyroll2::InNominalRange(r:real) returns (i:bool); +let + i = r < 25.3 and r > -25.3; +tel +-- end of node onlyroll2::InNominalRange + +node onlyroll2::Median( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +let + r = if f1 then onlyroll2::MedianValue3(x2, x3, x4) else if f2 then + onlyroll2::MedianValue3(x1, x3, x4) else if f3 then + onlyroll2::MedianValue3(x1, x2, x4) else onlyroll2::MedianValue3(x1, x2, + x3); +tel +-- end of node onlyroll2::Median +node onlyroll2::MedianValue3(a:real; b:real; c:real) returns (z:real); +let + z = a + b + c - onlyroll2::min2(a, onlyroll2::min2(b, c)) - + onlyroll2::max2(a, onlyroll2::max2(b, c)); +tel +-- end of node onlyroll2::MedianValue3 + +node onlyroll2::Monitor( + xa:real; + xb:real; + disc:bool) +returns ( + local_value:real; + inline_monitor_failed:bool); +let + inline_monitor_failed = onlyroll2::maintain(3, onlyroll2::abs(xa - xb) > + 14.9) or disc; + local_value = xa; +tel +-- end of node onlyroll2::Monitor + +node onlyroll2::OlympicAverage( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = one + two + three + four - onlyroll2::max4(one, two, three, four) - + onlyroll2::min4(one, two, three, four) / 2.0; +tel +-- end of node onlyroll2::OlympicAverage +node onlyroll2::abs(v:real) returns (a:real); +let + a = if v >= 0.0 then v else -v; +tel +-- end of node onlyroll2::abs +node onlyroll2::maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; +let + cpt = if val then 1 else 0 -> if val then pre (cpt) + 1 else 0; + m = cpt >= n; +tel +-- end of node onlyroll2::maintain +node onlyroll2::max2(one:real; two:real) returns (m:real); +let + m = if one > two then one else two; +tel +-- end of node onlyroll2::max2 + +node onlyroll2::max4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = onlyroll2::max2(onlyroll2::max2(one, two), onlyroll2::max2(three, + four)); +tel +-- end of node onlyroll2::max4 +node onlyroll2::min2(one:real; two:real) returns (m:real); +let + m = if one < two then one else two; +tel +-- end of node onlyroll2::min2 + +node onlyroll2::min4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +let + m = onlyroll2::min2(onlyroll2::min2(one, two), onlyroll2::min2(three, + four)); +tel +-- end of node onlyroll2::min4 + +node onlyroll2::noneof( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = not f1 and not f2 and not f3 and not f4; +tel +-- end of node onlyroll2::noneof + +node onlyroll2::oneoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = f1 and not f2 and not f3 and not f4 or f2 and not f1 and not f3 and + not f4 or f3 and not f1 and not f2 and not f4 or f4 and not f1 and not f2 + and not f3; +tel +-- end of node onlyroll2::oneoffour + +node onlyroll2::onlyroll2( + xa1:real; + xb1:real; + xa2:real; + xb2:real; + xa3:real; + xb3:real; + xa4:real; + xb4:real; + ongroundreset:bool; + inairreset:bool; + disc1:bool; + disc2:bool; + disc3:bool; + disc4:bool; + choff1:bool; + choff2:bool; + choff3:bool; + choff4:bool) +returns ( + x:real; + debug_localfailure1:bool; + debug_localfailure2:bool; + debug_localfailure3:bool; + debug_localfailure4:bool; + debug_cross_failure1:bool; + debug_cross_failure2:bool; + debug_cross_failure3:bool; + debug_cross_failure4:bool; + debug_ch_failed1:bool; + debug_ch_failed2:bool; + debug_ch_failed3:bool; + debug_ch_failed4:bool; + debug_st1:int; + debug_st2:int; + debug_st3:int; + debug_st4:int); +var + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool; + ask1:bool; + ask2:bool; + ask3:bool; + ask4:bool; + allowed1:bool; + allowed2:bool; + allowed3:bool; + allowed4:bool; +let + debug_ch_failed1 = f1; + debug_ch_failed2 = f2; + debug_ch_failed3 = f3; + debug_ch_failed4 = f4; + (x1, f1, ask1, debug_localfailure1, debug_cross_failure1, debug_st1) = + onlyroll2::Channel(ongroundreset, inairreset, choff1, xa1, xb1, disc1, 0.0 + -> pre (x2), 0.0 -> pre (x3), 0.0 -> pre (x4), false -> pre (f2), false -> + pre (f3), false -> pre (f4), allowed1); + (x2, f2, ask2, debug_localfailure2, debug_cross_failure2, debug_st2) = + onlyroll2::Channel(ongroundreset, inairreset, choff2, xa2, xb2, disc2, 0.0 + -> pre (x1), 0.0 -> pre (x3), 0.0 -> pre (x4), false -> pre (f1), false -> + pre (f3), false -> pre (f4), allowed2); + (x3, f3, ask3, debug_localfailure3, debug_cross_failure3, debug_st3) = + onlyroll2::Channel(ongroundreset, inairreset, choff3, xa3, xb3, disc3, 0.0 + -> pre (x1), 0.0 -> pre (x2), 0.0 -> pre (x4), false -> pre (f1), false -> + pre (f2), false -> pre (f4), allowed3); + (x4, f4, ask4, debug_localfailure4, debug_cross_failure4, debug_st4) = + onlyroll2::Channel(ongroundreset, inairreset, choff4, xa4, xb4, disc4, 0.0 + -> pre (x1), 0.0 -> pre (x2), 0.0 -> pre (x3), false -> pre (f1), false -> + pre (f2), false -> pre (f3), allowed4); + (allowed1, allowed2, allowed3, allowed4) = onlyroll2::Allocator(pre + (ask1), pre (ask2), pre (ask3), pre (ask4), ongroundreset); + x = onlyroll2::Calculate(x1, x2, x3, x4, f1, f2, f3, f4); +tel +-- end of node onlyroll2::onlyroll2 + +node onlyroll2::threeoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = onlyroll2::oneoffour(not f1, not f2, not f3, not f4); +tel +-- end of node onlyroll2::threeoffour + +node onlyroll2::twooffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +let + r = f1 and f2 and not f3 and not f4 or f3 and not f2 and not f4 or f4 and + not f2 and not f3 or f2 and f1 and not f3 and not f4 or f3 and not f1 and + not f4 or f4 and not f1 and not f3 or f3 and f2 and not f1 and not f4 or f1 + and not f2 and not f4 or f4 and not f2 and not f1 or f4 and f2 and not f3 + and not f1 or f3 and not f2 and not f1 or f1 and not f2 and not f3; +tel +-- end of node onlyroll2::twooffour + +node onlyroll2::values_nok( + pfother1:bool; + pfother2:bool; + pfother3:bool; + xi:real; + pxother1:real; + pxother2:real; + pxother3:real) +returns ( + r:bool); +var + one:bool; + two:bool; + three:bool; +let + one = onlyroll2::abs(xi - pxother1) > 51.0; + two = onlyroll2::abs(xi - pxother2) > 51.0; + three = onlyroll2::abs(xi - pxother3) > 51.0; + r = onlyroll2::maintain(3, if pfother1 then if pfother2 then if + pfother3 then false else three else if pfother3 then two else two and + three else if pfother2 then if pfother3 then one else one and three else + if pfother3 then one and two else one and two and three); +tel +-- end of node onlyroll2::values_nok + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/test.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/test.lus + +node test::test( + b1:bool; + b2:bool) +returns ( + b3:bool; + b4:bool; + b5:bool; + b6:bool); +let + (b3, b4, b5, b6) = (test::three_outputs(test::two_outputs(b1, b2), true), + false); +tel +-- end of node test::test + +node test::three_outputs( + c1:bool; + c2:bool; + c3:bool) +returns ( + c4:bool; + c5:bool; + c6:bool); +let + (c4, c5, c6) = (true, false, true) -> ( if c1 then (c1, c2, c3) else (c1, + c2, c3)); +tel +-- end of node test::three_outputs +node test::two_outputs(c1:bool; c2:bool) returns (c4:bool; c5:bool); +let + c4 = false -> pre (c1); + c5 = true -> pre (c2); +tel +-- end of node test::two_outputs + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/titi.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/titi.lus +node titi::titi(a:bool; b:bool) returns (x:bool); +let + x = current (a when b); +tel +-- end of node titi::titi + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/toolate.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/fab_test/toolate.lus +type int_2 = int^2 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +type int_5 = int^5 (*abstract in the source*); +type int_5_6 = int_5^6 (*abstract in the source*); +type toolate::bool4 = bool^5; +type toolate::really = real; +type toolate::tab1 = int^2; +type toolate::tab2 = int_3^4; +type toolate::tab3 = int_5_6^7; +const toolate::ze_const_int = 5; +node toolate::after(X:bool) returns (afterX:bool); +var + bidon1:bool; + bidon2:bool; +let + afterX = false -> pre (X or afterX) or bidon2 and bidon1; + (bidon1, bidon2) = toolate::bidon(X); +tel +-- end of node toolate::after +node toolate::bidon(in:bool) returns (out1:bool; out2:bool); +var + toto:int_2; +let + toto[0] = 10; + toto[1] = 5; + out1 = true or in and toto[0] < 20; + out2 = false and in; +tel +-- end of node toolate::bidon +node toolate::edge_detect(in:bool) returns (edge:bool); +var + bidon1:bool; + bidon2:bool; +let + edge = false -> in and not pre (in) or bidon2 and bidon1; + (bidon1, bidon2) = toolate::bidon(in); +tel +-- end of node toolate::edge_detect +node toolate::implies(X:bool; Y:bool) returns (XimpliesY:bool); +let + XimpliesY = not X or Y; +tel +-- end of node toolate::implies +node toolate::once_from_to(C:bool; A:bool; B:bool) returns (X:bool); +let + X = toolate::implies(B, false -> pre (toolate::once_since(C, A))); +tel +-- end of node toolate::once_from_to +node toolate::once_since(C:bool; A:bool) returns (X:bool); +let + X = if A then C else if toolate::after(A) then C or false -> pre (X) + else false; +tel +-- end of node toolate::once_since +node toolate::toolate(active:bool; action:bool) returns (alarm:bool); +var + begin:bool; + en:bool; +let + begin = active and false -> not pre (active); + en = not active and false -> pre (active); + alarm = not toolate::once_from_to(action, begin, en); +tel +-- end of node toolate::toolate + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/toto.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/fab_test/toto.lus +node toto::toto(a:bool; b:bool) returns (x:bool); +var + c:bool when b; +let + c = a when b; + x = current (current (a when b when c)); +tel +-- end of node toto::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/FillFollowedByRed.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/FillFollowedByRed.lus +type real_10 = real^10 (*abstract in the source*); + +node FillFollowedByRed::FillFollowedByRed( + initFill:real) +returns ( + ok:bool); +var + TabOutFill:real_10; + bidon:real; +let + (bidon, TabOutFill) = fill<<FillFollowedByRed::filled, 10>>(initFill); + ok = red<<FillFollowedByRed::reduced, 10>>(true, TabOutFill); +tel +-- end of node FillFollowedByRed::FillFollowedByRed + +node FillFollowedByRed::filled( + acc_in:real) +returns ( + acc_out:real; + elt_out:real); +let + acc_out = acc_in + 1.; + elt_out = acc_in + 1.; +tel +-- end of node FillFollowedByRed::filled + +node FillFollowedByRed::reduced( + acc_in:bool; + elt_in:real) +returns ( + ok:bool); +let + ok = acc_in and 0. < elt_in; +tel +-- end of node FillFollowedByRed::reduced + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/Gyroscope.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/Gyroscope.lus +type real_3 = real^3 (*abstract in the source*); +type real_4 = real^4 (*abstract in the source*); +type Gyroscope::Faulty_Array = Gyroscope::Faulty_ChannelT_4^3; +type Gyroscope::Faulty_ChannelT = struct {valuea : real; valueb : real}; +type Gyroscope::Faulty_ChannelT_4 = Gyroscope::Faulty_ChannelT^4 (*abstract in the source*); +type Gyroscope::Faulty_ChannelT_4_3 = Gyroscope::Faulty_ChannelT_4^3 (*abstract in the source*); +type Gyroscope::Valid_ChannelT = struct {local_failure : bool; local_value : real}; +type Gyroscope::Valid_ChannelT_4 = Gyroscope::Valid_ChannelT^4 (*abstract in the source*); +const Gyroscope::DELTA_PITCH = 2.0; +const Gyroscope::DELTA_ROLL = 2.0; +const Gyroscope::DELTA_TO_GOD_PITCH = 2.0; +const Gyroscope::DELTA_TO_GOD_ROLL = 2.0; +const Gyroscope::DELTA_TO_GOD_YAW = 2.0; +const Gyroscope::DELTA_YAW = 2.0; +const Gyroscope::GOD_PITCH = 16.0; +const Gyroscope::GOD_ROLL = 15.0; +const Gyroscope::GOD_YAW = 14.0; +const Gyroscope::TIME = 3; + +node Gyroscope::Channel( + inChannel:Gyroscope::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real) +returns ( + outChannel:Gyroscope::Valid_ChannelT); +var + maintain:bool; +let + maintain = Gyroscope::Maintain(3, Gyroscope::abs(inChannel.valuea - + inChannel.valueb) > delta); + outChannel = Gyroscope::Valid_ChannelT{local_failure=maintain;local_value= + if maintain then 0.0 else inChannel.valuea + inChannel.valueb / 2.0}; +tel +-- end of node Gyroscope::Channel + +node Gyroscope::EvaluateAxis( + channels:Gyroscope::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real) +returns ( + AxisValue:real); +var + resChannels:Gyroscope::Valid_ChannelT_4; + AxisValue2:real; +let + resChannels = map<<Gyroscope::Channel, 4>>(channels, delta^4, god^4, + delta_to_god^4); + AxisValue = Gyroscope::Voter(resChannels, god, delta_to_god); + AxisValue2 = Gyroscope::Voter2(resChannels, god, delta_to_god); +tel +-- end of node Gyroscope::EvaluateAxis + +node Gyroscope::Gyroscope( + axis:Gyroscope::Faulty_ChannelT_4_3) +returns ( + valid:bool); +var + secure_values:real_3; +let + secure_values = map<<Gyroscope::EvaluateAxis, 3>>(axis, [2.0, 2.0, 2.0], + [15.0, 16.0, 14.0], [2.0, 2.0, 2.0]); + valid = red<<Gyroscope::ValueIsSecureII, 3>>(true, secure_values, [2.0, + 2.0, 2.0], [15.0, 16.0, 14.0]); +tel +-- end of node Gyroscope::Gyroscope +node Gyroscope::Maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; +let + cpt = if val then 1 else 0 -> if val then Gyroscope::min_int(n, pre + (cpt) + 1) else 0; + m = cpt >= n; +tel +-- end of node Gyroscope::Maintain + +node Gyroscope::TooFar( + nbToFarIn:int; + channel:Gyroscope::Faulty_ChannelT; + god:real; + delta_to_god:real) +returns ( + nbToFarOut:int); +let + nbToFarOut = if Gyroscope::abs(channel.valuea - god) < delta_to_god then + nbToFarIn + 1 else nbToFarIn; +tel +-- end of node Gyroscope::TooFar + +node Gyroscope::ValueIsSecure( + secure_value:real; + delta_to_god_value:real; + god_value:real) +returns ( + is_valid:bool); +let + is_valid = Gyroscope::abs(secure_value - god_value) < delta_to_god_value; +tel +-- end of node Gyroscope::ValueIsSecure + +node Gyroscope::ValueIsSecureII( + accu_in:bool; + secure_value:real; + delta_to_god:real; + god_value:real) +returns ( + is_valid:bool); +let + is_valid = Gyroscope::abs(secure_value - god_value) < 2.0 and accu_in; +tel +-- end of node Gyroscope::ValueIsSecureII + +node Gyroscope::Voter( + channels:Gyroscope::Valid_ChannelT_4; + god:real; + delta_to_god:real) +returns ( + vote:real); +var + globalSum:real; + nbValid:real; + mask:real_4; +let + nbValid = Gyroscope::countValidChannels(channels); + globalSum = red<<Gyroscope::sum, 4>>(0.0, mask); + vote = globalSum / nbValid; + mask = map<<Gyroscope::masking, 4>>(channels); +tel +-- end of node Gyroscope::Voter + +node Gyroscope::Voter2( + channels:Gyroscope::Valid_ChannelT_4; + god:real; + delta_to_god:real) +returns ( + vote:real); +var + globalSum:real; + nbValid:real; + mask:real_4; +let + nbValid = 0.0; + globalSum = 0.0; + vote = 0.0; + mask = map<<Gyroscope::masking, 4>>(channels); +tel +-- end of node Gyroscope::Voter2 +node Gyroscope::abs(in:real) returns (out:real); +let + out = if in < 0.0 then -in else in; +tel +-- end of node Gyroscope::abs + +node Gyroscope::assumeChannel( + inChannel:Gyroscope::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +let + assumeOK = true; +tel +-- end of node Gyroscope::assumeChannel + +node Gyroscope::assumeEvaluateAxis( + channels:Gyroscope::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +var + NbToFar:int; +let + NbToFar = red<<Gyroscope::TooFar, 4>>(0, channels, god^4, delta_to_god^4); + assumeOK = NbToFar <= 1; +tel +-- end of node Gyroscope::assumeEvaluateAxis + +node Gyroscope::assumeSum( + accu_in:real; + elt_in:real) +returns ( + assumeOK:bool); +var + varBidon:real; +let + varBidon = 1.0; + assumeOK = varBidon < elt_in; +tel +-- end of node Gyroscope::assumeSum + +node Gyroscope::assumeVoter( + channels:Gyroscope::Valid_ChannelT_4; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +let + assumeOK = true; +tel +-- end of node Gyroscope::assumeVoter + +node Gyroscope::countFalse( + accu_in:real; + elt_in:Gyroscope::Valid_ChannelT) +returns ( + accu_out:real); +let + accu_out = if elt_in.local_failure then accu_in else accu_in + 1.0; +tel +-- end of node Gyroscope::countFalse + +node Gyroscope::countValidChannels( + channels:Gyroscope::Valid_ChannelT_4) +returns ( + nb:real); +let + nb = red<<Gyroscope::countFalse, 4>>(0.0, channels); +tel +-- end of node Gyroscope::countValidChannels + +node Gyroscope::guaranteeChannel( + inChannel:Gyroscope::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real; + outChannel:Gyroscope::Valid_ChannelT) +returns ( + guaranteeOK:bool); +let + guaranteeOK = outChannel.local_failure or Gyroscope::abs(inChannel.valuea + - outChannel.local_value) < delta and Gyroscope::abs(inChannel.valueb - + outChannel.local_value) < delta; +tel +-- end of node Gyroscope::guaranteeChannel + +node Gyroscope::guaranteeEvaluateAxis( + channels:Gyroscope::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real; + AxisValue:real) +returns ( + guaranteeOK:bool); +let + guaranteeOK = Gyroscope::abs(AxisValue - god) < delta_to_god; +tel +-- end of node Gyroscope::guaranteeEvaluateAxis + +node Gyroscope::guaranteeSum( + accu_in:real; + elt_in:real; + accu_out:real) +returns ( + guaranteeOK:bool); +var + otherVarBidon:real; +let + otherVarBidon = 1.0; + guaranteeOK = elt_in + otherVarBidon < accu_out; +tel +-- end of node Gyroscope::guaranteeSum + +node Gyroscope::guaranteeVoter( + channels:Gyroscope::Valid_ChannelT_4; + god:real; + delta_to_god:real; + vote:real) +returns ( + guaranteeOK:bool); +let + guaranteeOK = red<<Gyroscope::iteratedVoter, 4>>(true, channels, god^4, + delta_to_god^4, vote^4); +tel +-- end of node Gyroscope::guaranteeVoter + +node Gyroscope::iteratedVoter( + acc_in:bool; + channel:Gyroscope::Valid_ChannelT; + god:real; + delta_to_god:real; + vote:real) +returns ( + acc_out:bool); +let + acc_out = acc_in and channel.local_failure or Gyroscope::abs(vote - + channel.local_value) < delta_to_god; +tel +-- end of node Gyroscope::iteratedVoter + +node Gyroscope::masking( + channel:Gyroscope::Valid_ChannelT) +returns ( + out:real); +let + out = if channel.local_failure then 0.0 else channel.local_value; +tel +-- end of node Gyroscope::masking +node Gyroscope::min_int(n1:int; n2:int) returns (n:int); +let + n = if n1 > n2 then n2 else n1; +tel +-- end of node Gyroscope::min_int +node Gyroscope::sum(accu_in:real; elt_in:real) returns (accu_out:real); +let + accu_out = accu_in + elt_in; +tel +-- end of node Gyroscope::sum + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/ProduitBool/produitBool.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/ProduitBool/produitBool.lus +type bool_10 = bool^10 (*abstract in the source*); +type bool_20 = bool^20 (*abstract in the source*); +type bool_20_10 = bool_20^10 (*abstract in the source*); +type produitBool::T_isElementOf_ = struct {eltToSearch : bool; iselementof : bool}; +type produitBool::Tacc_in = struct {multiplieur : bool_10; rank : int}; +type produitBool::Tacc_inShift = struct {acc_in_PLC : produitBool::Tacc_in; actual_rank : int}; +type produitBool::Tacc_inShift2 = struct {multiplieur : bool_10; rank : int; actual_rank : int}; +type produitBool::iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; +const produitBool::size = 10; + +node produitBool::PLC( + acc_in:produitBool::Tacc_in; + multiplicande:bool) +returns ( + acc_out:produitBool::Tacc_in; + ligne:bool_20); +let + ligne = if multiplicande = false then multiplicande^20 else + produitBool::shift(acc_in); + acc_out = acc_in; +tel +-- end of node produitBool::PLC + +node produitBool::_isElementOf_( + e:bool; + t:bool_10) +returns ( + iselementof:bool); +var + acc_out:produitBool::T_isElementOf_; +let + acc_out = red<<produitBool::iterated_isElementOf_, + 10>>(produitBool::T_isElementOf_{eltToSearch=e;iselementof=false}, t); + iselementof = acc_out.iselementof; +tel +-- end of node produitBool::_isElementOf_ + +node produitBool::iterated_isElementOf_( + acc_in:produitBool::T_isElementOf_; + elt_in:bool) +returns ( + acc_out:produitBool::T_isElementOf_); +let + acc_out = + produitBool::T_isElementOf_{eltToSearch=acc_in.eltToSearch;iselementof=acc_in.iselementof + or acc_in.eltToSearch = elt_in}; +tel +-- end of node produitBool::iterated_isElementOf_ + +node produitBool::produitBool( + multiplicande:bool_10; + multiplieur:bool_10) +returns ( + matrice:bool_20_10); +let + matrice = true^20^10; +tel +-- end of node produitBool::produitBool + +node produitBool::selectElementOfRank_inArray_( + rankToSelect:int; + array:bool_10) +returns ( + elementSelected:bool); +var + iterationResult:produitBool::iteratedStruct; +let + iterationResult = red<<produitBool::selectOneStage, + 10>>(produitBool::iteratedStruct{currentRank=0;rankToSelect=rankToSelect;elementSelected=array[0]}, + array); + elementSelected = iterationResult.elementSelected; +tel +-- end of node produitBool::selectElementOfRank_inArray_ + +node produitBool::selectOneStage( + acc_in:produitBool::iteratedStruct; + currentElt:bool) +returns ( + acc_out:produitBool::iteratedStruct); +let + acc_out = produitBool::iteratedStruct{currentRank=acc_in.currentRank + + 1;rankToSelect=acc_in.rankToSelect;elementSelected= if acc_in.currentRank = + acc_in.rankToSelect then currentElt else acc_in.elementSelected}; +tel +-- end of node produitBool::selectOneStage + +node produitBool::shift( + acc_in:produitBool::Tacc_in) +returns ( + ligne:bool_20); +var + bidon:produitBool::Tacc_inShift2; +let + (bidon, ligne) = fill<<produitBool::shiftFill, + 20>>(produitBool::Tacc_inShift2{multiplieur=acc_in.multiplieur;rank=acc_in.rank;actual_rank=0}); +tel +-- end of node produitBool::shift + +node produitBool::shiftFill( + acc_in:produitBool::Tacc_inShift2) +returns ( + acc_out:produitBool::Tacc_inShift2; + elt_out:bool); +let + acc_out = + produitBool::Tacc_inShift2{multiplieur=acc_in.multiplieur;rank=acc_in.rank;actual_rank=acc_in.actual_rank + + 1}; + elt_out = if acc_in.actual_rank >= acc_in.rank and acc_in.actual_rank < + acc_in.rank + 10 then + produitBool::selectElementOfRank_inArray_(acc_in.actual_rank - acc_in.rank, + acc_in.multiplieur) else false; +tel +-- end of node produitBool::shiftFill + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/ProduitBool/shiftFill_ludic.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/ProduitBool/shiftFill_ludic.lus +type bool_10 = bool^10 (*abstract in the source*); +type shiftFill_ludic::T1_ARRAY = bool^10; +type shiftFill_ludic::T2_STRUCT = struct {multiplieur : bool_10; rank : int; actual_rank : int}; +type shiftFill_ludic::T3_STRUCT = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; +type shiftFill_ludic::T4_STRUCT = struct {multiplieur : bool_10; rank : int}; +type shiftFill_ludic::T5_STRUCT = struct {acc_in_PLC : shiftFill_ludic::T4_STRUCT; actual_rank : int}; +type shiftFill_ludic::T6_STRUCT = struct {eltToSearch : bool; iselementof : bool}; +type shiftFill_ludic::t_T_isElementOf_ = struct {eltToSearch : bool; iselementof : bool}; +type shiftFill_ludic::t_Tacc_in = struct {multiplieur : bool_10; rank : int}; +type shiftFill_ludic::t_Tacc_inShift = struct {acc_in_PLC : shiftFill_ludic::T4_STRUCT; actual_rank : int}; +type shiftFill_ludic::t_Tacc_inShift2 = struct {multiplieur : bool_10; rank : int; actual_rank : int}; +type shiftFill_ludic::t_iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; +const shiftFill_ludic::c_size = 10; + +node shiftFill_ludic::n_selectElementOfRank_inArray_( + i_rankToSelect:int; + i_array:bool_10) +returns ( + o_elementSelected:bool); +var + v_iterationResult:shiftFill_ludic::T3_STRUCT; +let + v_iterationResult = red<<shiftFill_ludic::n_selectOneStage, + 10>>(shiftFill_ludic::T3_STRUCT{currentRank=0;rankToSelect=i_rankToSelect;elementSelected=i_array[0]}, + i_array); + o_elementSelected = v_iterationResult.elementSelected; +tel +-- end of node shiftFill_ludic::n_selectElementOfRank_inArray_ + +node shiftFill_ludic::n_selectOneStage( + i_acc_in:shiftFill_ludic::T3_STRUCT; + i_currentElt:bool) +returns ( + o_acc_out:shiftFill_ludic::T3_STRUCT); +let + o_acc_out = shiftFill_ludic::T3_STRUCT{currentRank=i_acc_in.currentRank + + 1;rankToSelect=i_acc_in.rankToSelect;elementSelected= if + i_acc_in.currentRank = i_acc_in.rankToSelect then i_currentElt else + i_acc_in.elementSelected}; +tel +-- end of node shiftFill_ludic::n_selectOneStage + +node shiftFill_ludic::n_shiftFill( + i_acc_in:shiftFill_ludic::T2_STRUCT) +returns ( + o_acc_out:shiftFill_ludic::T2_STRUCT; + o_elt_out:bool); +let + o_acc_out = + shiftFill_ludic::T2_STRUCT{multiplieur=i_acc_in.multiplieur;rank=i_acc_in.rank;actual_rank=i_acc_in.actual_rank + + 1}; + o_elt_out = if i_acc_in.actual_rank >= i_acc_in.rank and + i_acc_in.actual_rank < i_acc_in.rank + 10 then + shiftFill_ludic::n_selectElementOfRank_inArray_(i_acc_in.actual_rank, + i_acc_in.multiplieur) else false; +tel +-- end of node shiftFill_ludic::n_shiftFill + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/ProduitBool/shift_ludic.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/ProduitBool/shift_ludic.lus +type bool_10 = bool^10 (*abstract in the source*); +type bool_20 = bool^20 (*abstract in the source*); +type shift_ludic::T1_ARRAY = bool^10; +type shift_ludic::T2_STRUCT = struct {multiplieur : bool_10; rank : int; actual_rank : int}; +type shift_ludic::T3_ARRAY = bool^20; +type shift_ludic::T4_STRUCT = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; +type shift_ludic::T5_STRUCT = struct {multiplieur : bool_10; rank : int}; +type shift_ludic::T6_STRUCT = struct {acc_in_PLC : shift_ludic::T5_STRUCT; actual_rank : int}; +type shift_ludic::T7_STRUCT = struct {eltToSearch : bool; iselementof : bool}; +type shift_ludic::t_T_isElementOf_ = struct {eltToSearch : bool; iselementof : bool}; +type shift_ludic::t_Tacc_in = struct {multiplieur : bool_10; rank : int}; +type shift_ludic::t_Tacc_inShift = struct {acc_in_PLC : shift_ludic::T5_STRUCT; actual_rank : int}; +type shift_ludic::t_Tacc_inShift2 = struct {multiplieur : bool_10; rank : int; actual_rank : int}; +type shift_ludic::t_iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; +const shift_ludic::c_size = 10; + +node shift_ludic::n_selectElementOfRank_inArray_( + i_rankToSelect:int; + i_array:bool_10) +returns ( + o_elementSelected:bool); +var + v_iterationResult:shift_ludic::T4_STRUCT; +let + v_iterationResult = red<<shift_ludic::n_selectOneStage, + 10>>(shift_ludic::T4_STRUCT{currentRank=0;rankToSelect=i_rankToSelect;elementSelected=i_array[0]}, + i_array); + o_elementSelected = v_iterationResult.elementSelected; +tel +-- end of node shift_ludic::n_selectElementOfRank_inArray_ + +node shift_ludic::n_selectOneStage( + i_acc_in:shift_ludic::T4_STRUCT; + i_currentElt:bool) +returns ( + o_acc_out:shift_ludic::T4_STRUCT); +let + o_acc_out = shift_ludic::T4_STRUCT{currentRank=i_acc_in.currentRank + + 1;rankToSelect=i_acc_in.rankToSelect;elementSelected= if + i_acc_in.currentRank = i_acc_in.rankToSelect then i_currentElt else + i_acc_in.elementSelected}; +tel +-- end of node shift_ludic::n_selectOneStage + +node shift_ludic::n_shift( + i_acc_in:shift_ludic::T5_STRUCT) +returns ( + o_ligne:bool_20); +var + v_bidon:shift_ludic::T2_STRUCT; +let + (v_bidon, o_ligne) = fill<<shift_ludic::n_shiftFill, + 20>>(shift_ludic::T2_STRUCT{multiplieur=i_acc_in.multiplieur;rank=i_acc_in.rank;actual_rank=0}); +tel +-- end of node shift_ludic::n_shift + +node shift_ludic::n_shiftFill( + i_acc_in:shift_ludic::T2_STRUCT) +returns ( + o_acc_out:shift_ludic::T2_STRUCT; + o_elt_out:bool); +let + o_acc_out = + shift_ludic::T2_STRUCT{multiplieur=i_acc_in.multiplieur;rank=i_acc_in.rank;actual_rank=i_acc_in.actual_rank + + 1}; + o_elt_out = if i_acc_in.actual_rank >= i_acc_in.rank and + i_acc_in.actual_rank < i_acc_in.rank + 10 then + shift_ludic::n_selectElementOfRank_inArray_(i_acc_in.actual_rank, + i_acc_in.multiplieur) else false; +tel +-- end of node shift_ludic::n_shiftFill + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/arrays.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/arrays.lus +type bool_4 = bool^4 (*abstract in the source*); +type bool_4_3 = bool_4^3 (*abstract in the source*); +type bool_4_3_2 = bool_4_3^2 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type int_4_3 = int_4^3 (*abstract in the source*); +type int_4_3_2 = int_4_3^2 (*abstract in the source*); +type arrays::byte = bool^4; +type arrays::long = bool_4_3^2; +type arrays::tab3d = int_4_3^2; +type arrays::word = bool_4^3; +const arrays::m = 3; +const arrays::n = 4; +const arrays::p = 2; +node arrays::add_byte(x:bool_4; y:bool_4) returns (s:bool_4); +var + co:bool; +let + (co, s) = fillred<<arrays::full_adder, 4>>(false, x, y); +tel +-- end of node arrays::add_byte +node arrays::add_long(x:bool_4_3_2; y:bool_4_3_2) returns (s:bool_4_3_2); +var + co:bool; +let + (co, s) = fillred<<Lustre::fillred<<Lustre::fillred<<arrays::full_adder, + 4>>, 3>>, 2>>(false, x, y); +tel +-- end of node arrays::add_long + +node arrays::arrays( + init_incr:int; + init_long:bool_4_3_2) +returns ( + ok:bool; + red_res:int; + fillred_res:bool_4_3_2); +var + fill_res:int_4_3_2; +let + red_res = arrays::big_sum(fill_res); + fill_res = arrays::big_incr(init_incr); + fillred_res = init_long -> arrays::add_long(init_long, pre (fillred_res)); + ok = false -> arrays::big_xor(fillred_res); +tel +-- end of node arrays::arrays +node arrays::big_incr(init:int) returns (x:int_4_3_2); +var + accout:int; +let + (accout, x) = fill<<Lustre::fill<<Lustre::fill<<arrays::incr, 4>>, 3>>, + 2>>(init); +tel +-- end of node arrays::big_incr +node arrays::big_or(x:bool_4_3_2) returns (s:bool); +let + s = red<<Lustre::red<<Lustre::red<<Lustre::or, 4>>, 3>>, 2>>(false, x); +tel +-- end of node arrays::big_or +node arrays::big_sum(x:int_4_3_2) returns (s:int); +let + s = red<<Lustre::red<<Lustre::red<<Lustre::plus, 4>>, 3>>, 2>>(0, x); +tel +-- end of node arrays::big_sum +node arrays::big_xor(x:bool_4_3_2) returns (s:bool); +let + s = red<<Lustre::red<<Lustre::red<<Lustre::xor, 4>>, 3>>, 2>>(false, x); +tel +-- end of node arrays::big_xor + +node arrays::full_adder( + ci:bool; + x:bool; + y:bool) +returns ( + co:bool; + s:bool); +let + s = ci xor x xor y; + co = if ci then x or y else x and y; +tel +-- end of node arrays::full_adder +node arrays::incr(accin:int) returns (accout:int; val:int); +let + accout = accin + 1; + val = accin; +tel +-- end of node arrays::incr + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/bug.lus +*** Error in file "bug.lus", line 2, col 6 to 10, token 'pack1': +*** unknown package + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/calculs_max.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/calculs_max.lus +type bool_10 = bool^10 (*abstract in the source*); +type int_10 = int^10 (*abstract in the source*); +type calculs_max::bool_arrays = bool^10; +type calculs_max::int_arrays = int^10; +type calculs_max::struct_fill_bool = struct {imax1 : int; imax2 : int; icourant : int}; +type calculs_max::struct_max = struct {max1 : int; max2 : int; imax1 : int; imax2 : int; icourant : int}; +const calculs_max::taille = 10; +node calculs_max::calculs_max(A:int_10) returns (res:bool_10); +var + local_struct:calculs_max::struct_max; + tmp:calculs_max::struct_fill_bool; +let + local_struct = red<<calculs_max::max, + 10>>(calculs_max::struct_max{max1=0;max2=0;imax1=-1;imax2=-1;icourant=0}, + A); + (tmp, res) = fill<<calculs_max::fill_bool, + 10>>(calculs_max::struct_fill_bool{imax1=local_struct.imax1;imax2=local_struct.imax2;icourant=0}); +tel +-- end of node calculs_max::calculs_max + +node calculs_max::fill_bool( + s_in:calculs_max::struct_fill_bool) +returns ( + s_out:calculs_max::struct_fill_bool; + elt:bool); +let + s_out = + calculs_max::struct_fill_bool{imax1=s_in.imax1;imax2=s_in.imax2;icourant=s_in.icourant + + 1}; + elt = s_in.icourant = s_in.imax1 or s_in.icourant = s_in.imax2; +tel +-- end of node calculs_max::fill_bool + +node calculs_max::max( + strin:calculs_max::struct_max; + ecourant:int) +returns ( + strout:calculs_max::struct_max); +let + strout = if ecourant <= strin.max2 then + calculs_max::struct_max{max1=strin.max1;max2=strin.max2;imax1=strin.imax1;imax2=strin.imax2;icourant=strin.icourant + + 1} else if ecourant > strin.max2 and ecourant <= strin.max1 then + calculs_max::struct_max{max1=strin.max1;max2=ecourant;imax1=strin.imax1;imax2=strin.icourant;icourant=strin.icourant + + 1} else + calculs_max::struct_max{max1=ecourant;max2=strin.max1;imax1=strin.icourant;imax2=strin.imax1;icourant=strin.icourant + + 1}; +tel +-- end of node calculs_max::max + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/clock.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/clock.lus +node clock::n1(ck:bool) returns (out:int when ck; ckout:bool); +var + cpt:int; +let + cpt = 0 -> pre (cpt) + 1; + out = cpt when ck; + ckout = ck; +tel +-- end of node clock::n1 +node clock::n2(ck:bool; in:int) returns (out:int when ck); +let + out = in when ck; +tel +-- end of node clock::n2 +node clock::system(ck1:bool) returns (out:int); +var + ckout:bool; + out1:int when ck1; +let + (out1, ckout) = clock::n1(ck1); + out = current (out1); +tel +-- end of node clock::system + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/deSimone.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/deSimone.lus +type bool_10 = bool^10 (*abstract in the source*); +type deSimone::cell_accu = struct {token : bool; grant : bool}; +type deSimone::tabType = bool^10; +const deSimone::size = 10; + +node deSimone::deSimone( + new_token:bool; + request:bool_10) +returns ( + acknowledge:bool_10); +var + accu_out:deSimone::cell_accu; +let + (accu_out, acknowledge) = fillred<<deSimone::oneCell, + 10>>(deSimone::cell_accu{token=new_token;grant=true}, request); +tel +-- end of node deSimone::deSimone + +node deSimone::oneCell( + accu_in:deSimone::cell_accu; + req:bool) +returns ( + accu_out:deSimone::cell_accu; + ackout:bool); +let + ackout = req and accu_in.token and accu_in.grant and not false -> pre + (ackout); + accu_out = deSimone::cell_accu{token=accu_in.token;grant=not req and + accu_in.grant}; +tel +-- end of node deSimone::oneCell +node deSimone::prop1(request:bool_10) returns (ok:bool); +var + acknowledge:bool_10; + nb_acknowledge:int; +let + acknowledge = deSimone::deSimone(true, request); + nb_acknowledge = red<<deSimone::prop1_iter, 10>>(0, acknowledge); + ok = nb_acknowledge <= 1; +tel +-- end of node deSimone::prop1 + +node deSimone::prop1_iter( + accu_in:int; + elt_in:bool) +returns ( + accu_out:int); +let + accu_out = accu_in + if elt_in then 1 else 0; +tel +-- end of node deSimone::prop1_iter + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/iterFibo.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/iterFibo.lus +type int_10 = int^10 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type iterFibo::T_fibo = int^2; +node iterFibo::fibo(accu_in:int_2) returns (accu_out:int_2; elt:int); +let + accu_out = [accu_in[0] + accu_in[1], accu_in[0]]; + elt = accu_in[0] + accu_in[1]; +tel +-- end of node iterFibo::fibo +node iterFibo::iterFibo(x:int; y:int) returns (T:int_10); +var + bidon:int_2; +let + (bidon, T) = fill<<iterFibo::fibo, 10>>([x, y]); +tel +-- end of node iterFibo::iterFibo + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/mapiter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/mapiter.lus +type any_2 = any^2 (*abstract in the source*); +type bool_2 = bool^2 (*abstract in the source*); +type bool_2_3 = bool_2^3 (*abstract in the source*); +type mapiter::Reg_L = bool^2; +type mapiter::T_Reg_H = bool_2^3; +const mapiter::H = 3; +const mapiter::L = 2; +node mapiter::bitalt(in:bool) returns (sacc:bool; out:bool); +let + sacc = not in; + out = in; +tel +-- end of node mapiter::bitalt +node mapiter::composemat(i1:bool_2_3; i2:bool_2_3) returns (s1:bool_2_3); +let + s1 = map<<Lustre::map<<Lustre::eq, 2>>, 3>>(i1, i2); +tel +-- end of node mapiter::composemat +node mapiter::fill_bitalt(in:bool) returns (sacc:bool; out:bool_2); +let + (sacc, out) = Lustre::fill<<mapiter::bitalt, 2>>(in); +tel +-- end of node mapiter::fill_bitalt +node mapiter::incr(init:int; b:bool) returns (res:int); +let + res = if b = true then init + 1 else init; +tel +-- end of node mapiter::incr +node mapiter::initmat(iacc:bool) returns (sacc:bool; R:bool_2_3); +let + (sacc, R) = fill<<mapiter::fill_bitalt, 3>>(iacc); +tel +-- end of node mapiter::initmat +node mapiter::map_egal(i1:any_2; i2:any_2) returns (o:bool_2); +let + o = Lustre::map<<Lustre::eq, 2>>(i1, i2); +tel +-- end of node mapiter::map_egal +node mapiter::mapiter(a:bool) returns (nbTrue:int); +var + bid1:bool; + bid2:bool; + init1:bool_2_3; + init2:bool_2_3; + XORMAT:bool_2_3; +let + (bid1, init1) = mapiter::initmat(a); + (bid2, init2) = mapiter::initmat(not a); + XORMAT = mapiter::composemat(init1, init2); + nbTrue = mapiter::reducemat(0, XORMAT); +tel +-- end of node mapiter::mapiter +node mapiter::red_incr(init:int; b:bool_2) returns (res:int); +let + res = Lustre::red<<mapiter::incr, 2>>(init, b); +tel +-- end of node mapiter::red_incr +node mapiter::reducemat(iacc:int; I:bool_2_3) returns (res:int); +let + res = red<<mapiter::red_incr, 3>>(iacc, I); +tel +-- end of node mapiter::reducemat + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/matrice.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/matrice.lus +type int_2 = int^2 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +type int_3_2 = int_3^2 (*abstract in the source*); +type matrice::T_fibo = int^2; +const matrice::m = 3; +const matrice::n = 2; +node matrice::fibo(accu_in:int_2) returns (accu_out:int_2; elt:int); +let + accu_out = [accu_in[0] + accu_in[1], accu_in[0]]; + elt = accu_in[0] + accu_in[1]; +tel +-- end of node matrice::fibo +node matrice::matrice(a:int) returns (sum:int; bid:int_2; T:int_3_2); +let + (bid, T) = fill<<Lustre::fill<<matrice::fibo, 3>>, 2>>([a, a]); + sum = red<<Lustre::red<<Lustre::plus, 3>>, 2>>(0, T); +tel +-- end of node matrice::matrice + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/matrice2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/matrice2.lus +const matrice2::m = 2; +const matrice2::n = 2; +node matrice2::matrice2(a:int) returns (res:int); +let + res = red<<Lustre::red<<Lustre::plus, 2>>, 2>>(0, 1^2^2); +tel +-- end of node matrice2::matrice2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/minus.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/minus.lus +type bool_3 = bool^3 (*abstract in the source*); +type bool_3_2 = bool_3^2 (*abstract in the source*); +const minus::m = 2; +const minus::n = 3; +node minus::bitalt(a:bool) returns (out:bool; b:bool); +let + b = a; + out = not a; +tel +-- end of node minus::bitalt + +node minus::minus( + a:bool_3_2; + b:bool_3_2; + c:bool_3_2) +returns ( + r:bool; + T1:bool_3_2; + T2:bool_3_2); +var + bid:bool; +let + T1 = map<<Lustre::map<<Lustre::if, 3>>, 2>>(a, b, c); + (bid, T2) = fill<<Lustre::fill<<minus::bitalt, 3>>, 2>>(a[0][0]); + r = red<<Lustre::red<<Lustre::xor, 3>>, 2>>(a[0][0], T1); +tel +-- end of node minus::minus + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/moyenne.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/moyenne.lus +type real_10 = real^10 (*abstract in the source*); +type moyenne::moyenne_accu = struct {sum : real; moyenne : real; rank : real}; +const moyenne::size = 10; +node moyenne::moyenne(Tab:real_10) returns (moy:real); +var + accu_out:moyenne::moyenne_accu; +let + accu_out = red<<moyenne::moyenne_step, + 10>>(moyenne::moyenne_accu{sum=0.0;moyenne=0.0;rank=0.0}, Tab); + moy = accu_out.moyenne; +tel +-- end of node moyenne::moyenne + +node moyenne::moyenne_step( + accu_in:moyenne::moyenne_accu; + elt_in:real) +returns ( + accu_out:moyenne::moyenne_accu); +let + accu_out = moyenne::moyenne_accu{sum=accu_in.sum + + elt_in;moyenne=accu_in.sum + elt_in / accu_in.rank + 1.0;rank=accu_in.rank + + 1.0}; +tel +-- end of node moyenne::moyenne_step + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/normal.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/normal.lus +type bool_20 = bool^20 (*abstract in the source*); +type bool_20_4 = bool_20^4 (*abstract in the source*); +type int_20 = int^20 (*abstract in the source*); +type int_20_4 = int_20^4 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type normal::INTNBC = int^20; +type normal::INTNBG = int^4; +type normal::T_ComChg = int; +type normal::T_EntreeGlob = struct {chg2gen : int_20; mesure_chgs : int_20; mesure_gens : int_4}; +type normal::T_EtatCharge = int; +type normal::T_InfoChgGlob = struct {chg2gen : int_20}; +type normal::T_InfoChgGlob_20 = normal::T_InfoChgGlob^20 (*abstract in the source*); +type normal::T_InfoChgIndiv = struct {mesure_chg : int}; +type normal::T_InfoChgIndiv_20 = normal::T_InfoChgIndiv^20 (*abstract in the source*); +type normal::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : int_20}; +type normal::T_InfoGenGlob_4 = normal::T_InfoGenGlob^4 (*abstract in the source*); +type normal::T_InfoGenIndiv = struct {mesure_gen : int}; +type normal::T_InfoGenIndiv_4 = normal::T_InfoGenIndiv^4 (*abstract in the source*); +const normal::COM_ERR = 0; +const normal::COM_OFF = 2; +const normal::COM_ON = 1; +const normal::EC_DELESTAGE = 4; +const normal::EC_LESTAGE = 3; +const normal::EC_NON_CTRL = 2; +const normal::EC_OFF = 1; +const normal::EC_ON = 0; +const normal::NBC = 20; +const normal::NBG = 4; +node normal::copie(acc_in:int) returns (acc_out:int; elt:int); +let + acc_out = acc_in; + elt = acc_in; +tel +-- end of node normal::copie +node normal::egal_indice(indice:int; val:int) returns (r:bool); +let + r = val = indice; +tel +-- end of node normal::egal_indice + +node normal::essai2( + a:int_20; + d:normal::T_InfoGenGlob) +returns ( + c:bool_20); +let + c = map<<normal::egal_indice, 20>>(a, d.chg2gen); +tel +-- end of node normal::essai2 + +node normal::essai3( + indice:int_20; + info:normal::T_InfoGenGlob) +returns ( + Connerie:bool_20); +let + Connerie = map<<normal::egal_indice, 20>>(indice, info.chg2gen); +tel +-- end of node normal::essai3 + +node normal::essai_traite_gen( + indice_gen:int; + infoGenGlob:normal::T_InfoGenGlob) +returns ( + TabComVal:bool_20); +var + Tab_indiceGen:int_20; + bid:int; +let + (bid, Tab_indiceGen) = fill<<normal::copie, 20>>(indice_gen); + TabComVal = map<<normal::egal_indice, 20>>(Tab_indiceGen, + infoGenGlob.chg2gen); +tel +-- end of node normal::essai_traite_gen + +node normal::extrCharge( + EntreeGlob:normal::T_EntreeGlob) +returns ( + TabInfoChgIndiv:normal::T_InfoChgIndiv_20; + TabInfoChgGlob:normal::T_InfoChgGlob_20); +let + TabInfoChgIndiv = normal::extract_tab_info_chg_indiv(EntreeGlob); + TabInfoChgGlob = normal::extract_info_chg_glob(EntreeGlob)^20; +tel +-- end of node normal::extrCharge + +node normal::extrGen( + EntreeGlob:normal::T_EntreeGlob) +returns ( + TabInfoGenIndiv:normal::T_InfoGenIndiv_4; + TabInfoGenGlob:normal::T_InfoGenGlob_4; + TabIndiceGen:int_4); +var + bid:int; +let + TabInfoGenIndiv = normal::extract_tab_info_gen_indiv(EntreeGlob); + TabInfoGenGlob = normal::extract_info_gen_glob(EntreeGlob)^4; + (bid, TabIndiceGen) = fill<<normal::incr_acc, 4>>(0); +tel +-- end of node normal::extrGen + +node normal::extract_info_chg_glob( + EntreeGlob:normal::T_EntreeGlob) +returns ( + InfoChgGlob:normal::T_InfoChgGlob); +let + InfoChgGlob = normal::T_InfoChgGlob{chg2gen=map<<normal::id, + 20>>(EntreeGlob.chg2gen)}; +tel +-- end of node normal::extract_info_chg_glob + +node normal::extract_info_gen_glob( + EntreeGlob:normal::T_EntreeGlob) +returns ( + InfoGenGlob:normal::T_InfoGenGlob); +let + InfoGenGlob = normal::T_InfoGenGlob{elt_bidon=0;chg2gen=map<<normal::id, + 20>>(EntreeGlob.chg2gen)}; +tel +-- end of node normal::extract_info_gen_glob + +node normal::extract_tab_info_chg_indiv( + EntreeGlob:normal::T_EntreeGlob) +returns ( + TabInfoChgIndiv:normal::T_InfoChgIndiv_20); +let + TabInfoChgIndiv = map<<normal::int2InfoChgIndiv, + 20>>(EntreeGlob.mesure_chgs); +tel +-- end of node normal::extract_tab_info_chg_indiv + +node normal::extract_tab_info_gen_indiv( + EntreeGlob:normal::T_EntreeGlob) +returns ( + TabInfoGenIndiv:normal::T_InfoGenIndiv_4); +let + TabInfoGenIndiv = map<<normal::int2InfoGenIndiv, + 4>>(EntreeGlob.mesure_gens); +tel +-- end of node normal::extract_tab_info_gen_indiv + +node normal::fusion_com( + AllTabComChg:int_20_4; + AllTabComVal:bool_20_4) +returns ( + TabComChg:int_20); +var + Vide:int_20; +let + Vide = 0^20; + TabComChg = red<<normal::fusion_tab_com, 4>>(Vide, AllTabComChg, + AllTabComVal); +tel +-- end of node normal::fusion_com + +node normal::fusion_tab_com( + acc_in:int_20; + TabCom:int_20; + TabVal:bool_20) +returns ( + acc_out:int_20); +let + acc_out = map<<normal::fusion_une_com, 20>>(acc_in, TabCom, TabVal); +tel +-- end of node normal::fusion_tab_com + +node normal::fusion_une_com( + in_com:int; + cur_com:int; + cur_val:bool) +returns ( + out_com:int); +let + out_com = if cur_val then cur_com else in_com; +tel +-- end of node normal::fusion_une_com +node normal::id(elt_in:int) returns (elt_out:int); +let + elt_out = elt_in; +tel +-- end of node normal::id +node normal::incr_acc(acc_in:int) returns (acc_out:int; res:int); +let + res = acc_in; + acc_out = res + 1; +tel +-- end of node normal::incr_acc + +node normal::int2InfoChgIndiv( + m:int) +returns ( + InfoChgIndiv:normal::T_InfoChgIndiv); +let + InfoChgIndiv = normal::T_InfoChgIndiv{mesure_chg=m}; +tel +-- end of node normal::int2InfoChgIndiv + +node normal::int2InfoGenIndiv( + m:int) +returns ( + InfoGenIndiv:normal::T_InfoGenIndiv); +let + InfoGenIndiv = normal::T_InfoGenIndiv{mesure_gen=m}; +tel +-- end of node normal::int2InfoGenIndiv + +node normal::normal( + EntreeGlob:normal::T_EntreeGlob) +returns ( + TabComChg:int_20); +var + TabInfoChgIndiv:normal::T_InfoChgIndiv_20; + TabInfoChgGlob:normal::T_InfoChgGlob_20; + TabEtatCharge:int_20; + TabInfoGenIndiv:normal::T_InfoGenIndiv_4; + TabInfoGenGlob:normal::T_InfoGenGlob_4; + TabIndiceGen:int_4; + AllTabComChg:int_20_4; + AllTabComVal:bool_20_4; +let + (TabInfoChgIndiv, TabInfoChgGlob) = normal::extrCharge(EntreeGlob); + TabEtatCharge = normal::traiteChg(TabInfoChgIndiv, TabInfoChgGlob); + (TabInfoGenIndiv, TabInfoGenGlob, TabIndiceGen) = + normal::extrGen(EntreeGlob); + (AllTabComChg, AllTabComVal) = normal::traiteGen(TabIndiceGen, + TabInfoGenIndiv, TabInfoGenGlob, TabEtatCharge); + TabComChg = normal::fusion_com(AllTabComChg, AllTabComVal); +tel +-- end of node normal::normal +node normal::trChItere(acc_in:int; elt:int) returns (acc_out:int); +let + acc_out = if acc_in > elt then acc_in else elt; +tel +-- end of node normal::trChItere + +node normal::traiteChg( + TabInfoChgIndiv:normal::T_InfoChgIndiv_20; + TabInfoChgGlob:normal::T_InfoChgGlob_20) +returns ( + TabEtatCharge:int_20); +let + TabEtatCharge = map<<normal::traite_charge, 20>>(TabInfoChgIndiv, + TabInfoChgGlob); +tel +-- end of node normal::traiteChg + +node normal::traiteGen( + TabIndiceGen:int_4; + TabInfoGenIndiv:normal::T_InfoGenIndiv_4; + TabInfoGenGlob:normal::T_InfoGenGlob_4; + TabEtatCharge:int_20) +returns ( + AllTabComChg:int_20_4; + AllTabComVal:bool_20_4); +let + (AllTabComChg, AllTabComVal) = map<<normal::traite_gen, 4>>(TabIndiceGen, + TabInfoGenIndiv, TabInfoGenGlob, TabEtatCharge^4); +tel +-- end of node normal::traiteGen + +node normal::traite_charge( + InfoChgIndiv:normal::T_InfoChgIndiv; + InfoChgGlob:normal::T_InfoChgGlob) +returns ( + EtatCharge:int); +let + EtatCharge = red<<normal::trChItere, 20>>(InfoChgIndiv.mesure_chg, + InfoChgGlob.chg2gen); +tel +-- end of node normal::traite_charge + +node normal::traite_gen( + indice_gen:int; + InfoGenIndiv:normal::T_InfoGenIndiv; + InfoGenGlob:normal::T_InfoGenGlob; + TabEtatCharge:int_20) +returns ( + TabComChg:int_20; + TabComVal:bool_20); +var + TabComVal_bis:bool_20; + TabIndiceGen:int_20; + bid:int; +let + TabComVal_bis = map<<normal::egal_indice, 20>>(TabIndiceGen, + InfoGenGlob.chg2gen); + (bid, TabIndiceGen) = fill<<normal::copie, 20>>(indice_gen); + TabComChg = normal::traite_gen_core(indice_gen, InfoGenIndiv, InfoGenGlob, + TabEtatCharge, TabComVal_bis); + TabComVal = map<<normal::egal_indice, 20>>(TabIndiceGen, + InfoGenGlob.chg2gen); +tel +-- end of node normal::traite_gen + +node normal::traite_genCore_itere( + acc_in:int; + elt1:bool; + elt2:int) +returns ( + acc_out:int; + elt:int); +let + elt = if elt1 then elt2 else acc_in; + acc_out = acc_in; +tel +-- end of node normal::traite_genCore_itere + +node normal::traite_gen_bis( + a:int; + c:normal::T_InfoGenGlob) +returns ( + e:bool_20); +var + loc_a:int_20; + bid:int; +let + (bid, loc_a) = fill<<normal::copie, 20>>(a); + e = map<<normal::egal_indice, 20>>(loc_a, c.chg2gen); +tel +-- end of node normal::traite_gen_bis + +node normal::traite_gen_core( + indice_gen:int; + InfoGenIndiv:normal::T_InfoGenIndiv; + InfoGenGlob:normal::T_InfoGenGlob; + TabEtatCharge:int_20; + TabComVal:bool_20) +returns ( + TabComChg:int_20); +var + bidon:int; +let + (bidon, TabComChg) = fillred<<normal::traite_genCore_itere, + 20>>(indice_gen, TabComVal, InfoGenGlob.chg2gen); +tel +-- end of node normal::traite_gen_core + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/pack1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/pack1.lus +const pack1::toto = 3; +node pack1::n1(ck:bool) returns (out:int when ck; ckout:bool); +var + cpt:int; +let + cpt = 0 -> pre (cpt) + 1; + out = cpt when ck; + ckout = ck; +tel +-- end of node pack1::n1 +node pack1::n2(ck:bool; in:int) returns (out:int when ck); +let + out = in when ck; +tel +-- end of node pack1::n2 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/pilote-1.0.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/pilote-1.0.lus +type bool_10 = bool^10 (*abstract in the source*); +type bool_8 = bool^8 (*abstract in the source*); +type int_10 = int^10 (*abstract in the source*); +type int_8 = int^8 (*abstract in the source*); +type pilote::tUpdateCntElt = struct {indCnt : int; HrinstCnt : bool; Hcap : bool; locCnt : int; i : int; locCntFound : bool}; +type util::accChangeTab = struct {numEvent : int; cpt : int; indice : int}; +type util::accObserver = struct {nbCopy : int_10; indice : int}; +type util::tCounterIter = struct {indice : int; Hindice : bool; cpt : int}; +type util::tIterRetard = struct {conEvent : bool; dataFromRead : int; retardCalcule : int; cpt : int}; +const pilote::periodeAppli = 20; +const pilote::periodeCapt = 10; +const pilote::periodeDureeAppli = 7; +const pilote::periodeDureePilote = 2; +const pilote::periodePilote = 5; + +node pilote::boiteCP( + dataIN:int; + dataGET:bool; + dataPUT:bool) +returns ( + dataOUT:int; + localDataErasedFromBoiteCP:int; + localDataCopydFromBoiteCP:int; + copyBoiteCPEvent:bool; + erasedBoiteCPEvent:bool); +var + localData:int; + pLocalData:int; +let + localData = -1 -> if dataPUT then dataIN else if dataGET then -1 else + pre (localData); + localDataErasedFromBoiteCP = -1 -> if dataPUT then pLocalData else -1; + erasedBoiteCPEvent = dataPUT; + localDataCopydFromBoiteCP = -1 -> if dataPUT then localData else -1; + copyBoiteCPEvent = dataPUT; + pLocalData = localData -> pre (localData); + dataOUT = if dataGET then pLocalData else -1; +tel +-- end of node pilote::boiteCP + +node pilote::capt( + Hcapt:bool; + HrinstCount:bool; + indCount:int) +returns ( + dataPUT:bool; + stampedData:int; + productionEvent:bool); +var + localCnt:int; + indCountTab:bool_10; +let + dataPUT = Hcapt; + stampedData = if Hcapt then localCnt else -1; + productionEvent = Hcapt; + (localCnt, indCountTab) = pilote::updateCnt(indCount, HrinstCount, Hcapt); +tel +-- end of node pilote::capt + +node pilote::ctrl( + in:bool) +returns ( + Hcapt:bool; + Hpilote:bool; + Happli:bool); +var + cptC:int; + cptP:int; + cptA:int; + cptDureeP:int; + cptDureeA:int; + countDP:bool; + countDA:bool; + Hduree_pilote:bool; + Hduree_appli:bool; +let + Hpilote = cptP = 5; + Hcapt = cptC = 10; + Happli = cptA = 20; + Hduree_pilote = cptDureeP = 2; + Hduree_appli = cptDureeA = 7; + countDP = false -> if Hpilote then true else if pre (cptDureeP) = 2 then + false else pre (countDP); + countDA = false -> if Happli then true else if pre (cptDureeA) = 7 then + false else pre (countDA); + cptDureeP = 1 -> if countDP then pre (cptDureeP) + 1 else 1; + cptDureeA = 1 -> if countDA then pre (cptDureeA) + 1 else 1; + cptC = 1 -> if pre (cptC) = 10 then 1 else pre (cptC) + 1; + cptP = 1 -> if pre (cptP) = 5 then 1 else pre (cptP) + 1; + cptA = 1 -> if pre (cptA) = 20 then 1 else pre (cptA) + 1; +tel +-- end of node pilote::ctrl + +node pilote::mem( + getMem:bool; + putMem:bool; + piloteData:int) +returns ( + semMemGive:bool; + readData:int; + localDataErasedFromMem:int; + localDataCopiedFromMem:int; + erasedMemEvent:bool; + copyMemEvent:bool); +var + localData:int; + demandeGetMem:bool; +let + semMemGive = not getMem or putMem; + localData = -1 -> if putMem then piloteData else pre (localData); + readData = if demandeGetMem then localData else -1; + demandeGetMem = getMem -> if getMem then true else if pre (not readData + = -1) then false else pre (demandeGetMem); + localDataErasedFromMem = -1 -> if putMem then pre (localData) else -1; + erasedMemEvent = putMem; + localDataCopiedFromMem = -1 -> if putMem then localData else -1; + copyMemEvent = putMem; +tel +-- end of node pilote::mem + +node pilote::pilote( + Hpilote:bool; + semAutP:bool; + dataBoiteCP:int) +returns ( + semMemTakeP:bool; + putMemP:bool; + dataGET:bool; + piloteData:int; + localDataErasedFromPilote:int; + erasedPiloteEvent:bool; + copyPiloteEvent:bool; + localDataCopiedFromPilote:int); +var + localData:int; +let + dataGET = Hpilote; + localData = if Hpilote then dataBoiteCP else -1; + semMemTakeP = Hpilote; + piloteData = if semAutP and Hpilote then localData else -1; + putMemP = if semAutP and Hpilote then true else false; + localDataErasedFromPilote = -1 -> if Hpilote then pre (localData) else + -1; + erasedPiloteEvent = Hpilote; + localDataCopiedFromPilote = -1 -> if Hpilote then localData else -1; + copyPiloteEvent = Hpilote; +tel +-- end of node pilote::pilote + +node pilote::read( + Happli:bool; + semAutR:bool; + readData:int) +returns ( + getMemR:bool; + semMemR:bool; + localData:int; + consumptionEvent:bool); +let + semMemR = Happli; + getMemR = semAutR; + localData = readData; + consumptionEvent = not readData = -1; +tel +-- end of node pilote::read + +node pilote::semMem( + semMemTakeP:bool; + semMemTakeR:bool; + semMemGive:bool) +returns ( + semMemAutP:bool; + semMemAutR:bool; + free:bool; + demandeR:bool); +let + free = true -> pre (free) and not semMemTakeP and not semMemTakeR or not + semMemTakeP and not semMemTakeR and semMemGive; + semMemAutP = false -> pre (free) and semMemTakeP; + demandeR = false -> if semMemTakeR and semMemTakeP then true else if pre + (semMemAutR) then false else pre (demandeR); + semMemAutR = false -> pre (free) and not semMemTakeP and demandeR; +tel +-- end of node pilote::semMem + +node pilote::system( + in:bool) +returns ( + v:bool; + dataBoiteCP_IN:int; + dataBoiteCP_OUT:int; + piloteData:int; + readData:int; + getMem:bool; + localDataFromRead:int; + Hcapt:bool; + Hpilote:bool; + Happli:bool; + dataBoiteCP_PUT:bool; + dataBoiteCP_GET:bool; + semMemTakeP:bool; + semMemTakeR:bool; + semMemGive:bool; + semMemAutP:bool; + semMemAutR:bool; + putMem:bool; + res:bool; + retard:int); +var + free:bool; + demandeR:bool; + HrinstCount:bool; + indCount:int; + localErasedDataFromBoiteCP:int; + localCopiedDataFromBoiteCP:int; + localErasedDataFromPilote:int; + localCopiedDataFromPilote:int; + localErasedDataFromMem:int; + localCopiedDataFromMem:int; + productionEvent:bool; + consumptionEvent:bool; + eraseMemEvent:bool; + eraseBoiteCPEvent:bool; + erasePiloteEvent:bool; + copyBoiteCPEvent:bool; + copyPiloteEvent:bool; + copyMemEvent:bool; +let + (Hcapt, Hpilote, Happli) = pilote::ctrl(in); + (dataBoiteCP_PUT, dataBoiteCP_IN, productionEvent) = pilote::capt(Hcapt, + HrinstCount, indCount); + (dataBoiteCP_OUT, localErasedDataFromBoiteCP, localCopiedDataFromBoiteCP, + copyBoiteCPEvent, eraseBoiteCPEvent) = pilote::boiteCP(dataBoiteCP_IN, + dataBoiteCP_GET, dataBoiteCP_PUT); + (semMemTakeP, putMem, dataBoiteCP_GET, piloteData, + localErasedDataFromPilote, erasePiloteEvent, copyPiloteEvent, + localCopiedDataFromPilote) = pilote::pilote(Hpilote, semMemAutP, + dataBoiteCP_OUT); + (semMemGive, readData, localErasedDataFromMem, localCopiedDataFromMem, + eraseMemEvent, copyMemEvent) = pilote::mem(getMem, putMem, piloteData); + (semMemAutP, semMemAutR, free, demandeR) = pilote::semMem(semMemTakeP, + semMemTakeR, semMemGive); + (getMem, semMemTakeR, localDataFromRead, consumptionEvent) = + pilote::read(Happli, semMemAutR, readData); + (retard, indCount, HrinstCount) = util::observer(dataBoiteCP_IN, + localDataFromRead, localErasedDataFromBoiteCP, localCopiedDataFromBoiteCP, + localErasedDataFromPilote, localCopiedDataFromPilote, + localErasedDataFromMem, localCopiedDataFromMem, productionEvent, + consumptionEvent, eraseMemEvent, eraseBoiteCPEvent, erasePiloteEvent, + copyBoiteCPEvent, copyPiloteEvent, copyMemEvent); + v = not dataBoiteCP_IN = -1 and not localDataFromRead = -1; + res = false -> v or pre (res); +tel +-- end of node pilote::system + +node pilote::udpateCntElt( + accIn:pilote::tUpdateCntElt; + eltIn:bool) +returns ( + accOut:pilote::tUpdateCntElt; + eltOut:bool); +let + eltOut = if accIn.i = accIn.indCnt and accIn.HrinstCnt then true else + eltIn; + accOut = + pilote::tUpdateCntElt{indCnt=accIn.indCnt;HrinstCnt=accIn.HrinstCnt;Hcap=accIn.Hcap;locCnt= + if eltIn and accIn.Hcap and not accIn.locCntFound then accIn.i else + accIn.locCnt;i=accIn.i + 1;locCntFound=eltIn and accIn.Hcap or + accIn.locCntFound}; +tel +-- end of node pilote::udpateCntElt + +node pilote::updateCnt( + indCount:int; + HrinstCount:bool; + Hcapt:bool) +returns ( + localCnt:int; + tab:bool_10); +var + accOut:pilote::tUpdateCntElt; +let + (accOut, tab) = fillred<<pilote::udpateCntElt, + 10>>(pilote::tUpdateCntElt{indCnt=indCount;HrinstCnt=HrinstCount;Hcap=Hcapt;locCnt=-1;i=0;locCntFound=false}, + false^10); + localCnt = accOut.locCnt; +tel +-- end of node pilote::updateCnt + +node util::Niter( + accIn:util::accObserver; + numEvent:bool; + value_tab:int) +returns ( + accOut:util::accObserver); +let + accOut = util::accObserver{nbCopy= if numEvent then + util::change_tab2(accIn.nbCopy, value_tab, accIn.indice) else + accIn.nbCopy;indice=accIn.indice + 1}; +tel +-- end of node util::Niter + +node util::calculRetard( + consumptionEvent:bool; + CptRetard:int_10; + localDataFromRead:int) +returns ( + retard:int); +var + accOut:util::tIterRetard; +let + accOut = red<<util::updateRetard, + 10>>(util::tIterRetard{conEvent=consumptionEvent;dataFromRead=localDataFromRead;retardCalcule=-1;cpt=0}, + CptRetard); + retard = accOut.retardCalcule; +tel +-- end of node util::calculRetard + +node util::change_elt2( + accIn:util::accChangeTab; + eltIn:int) +returns ( + accOut:util::accChangeTab; + eltOut:int); +let + eltOut = if accIn.indice = accIn.cpt then if accIn.numEvent = 0 then 1 + else if accIn.numEvent = 1 or accIn.numEvent = 3 or accIn.numEvent = 7 + then eltIn - 1 else if accIn.numEvent = 2 or accIn.numEvent = 4 or + accIn.numEvent = 6 then eltIn + 1 else eltIn else eltIn; + accOut = + util::accChangeTab{numEvent=accIn.numEvent;indice=accIn.indice;cpt=accIn.cpt + + 1}; +tel +-- end of node util::change_elt2 + +node util::change_tab2( + tabIn:int_10; + indiceIn:int; + num_event:int) +returns ( + tabOut:int_10); +var + accOut:util::accChangeTab; +let + (accOut, tabOut) = fillred<<util::change_elt2, + 10>>(util::accChangeTab{numEvent=num_event;cpt=0;indice=indiceIn}, tabIn); +tel +-- end of node util::change_tab2 + +node util::checkCopy( + eltCopy:int; + oldCptRetard:int) +returns ( + newCptRetard:int); +let + newCptRetard = if pre (eltCopy = -1) and eltCopy = 1 then 0 else if pre + (eltCopy <> -1) and pre (eltCopy <> 0) and eltCopy = 0 then -1 else + oldCptRetard + 1; +tel +-- end of node util::checkCopy + +node util::countIter( + accIn:util::tCounterIter; + eltCopy:int) +returns ( + accOut:util::tCounterIter); +let + accOut = if pre (eltCopy <> -1) and pre (eltCopy <> 0) and eltCopy = 0 + then util::tCounterIter{indice=accIn.cpt;Hindice=true;cpt=accIn.cpt + 1} + else + util::tCounterIter{indice=accIn.indice;Hindice=accIn.Hindice;cpt=accIn.cpt + + 1}; +tel +-- end of node util::countIter + +node util::observer( + dataBoiteCP_IN:int; + localDataFromRead:int; + localErasedDataFromBoiteCP:int; + localCopyedDataFromBoiteCP:int; + localErasedDataFromPilote:int; + localCopyedDataFromPilote:int; + localErasedDataFromMem:int; + localCopyedDataFromMem:int; + productionEvent:bool; + consumptionEvent:bool; + eraseMemEvent:bool; + eraseBoiteCPEvent:bool; + erasePiloteEvent:bool; + copyBoiteCPEvent:bool; + copyPiloteEvent:bool; + copyMemEvent:bool) +returns ( + retard:int; + indiceCount:int; + HindiceCount:bool); +var + CptRetard:int_10; + numEvent_tab:bool_8; + value_tab:int_8; + nbrCopy:int_10; +let + numEvent_tab = [productionEvent, consumptionEvent, eraseMemEvent, + copyMemEvent, eraseBoiteCPEvent, copyBoiteCPEvent, erasePiloteEvent, + copyPiloteEvent]; + value_tab = [dataBoiteCP_IN, localDataFromRead, localErasedDataFromMem, + localCopyedDataFromMem, localErasedDataFromBoiteCP, + localCopyedDataFromBoiteCP, localErasedDataFromPilote, + localCopyedDataFromPilote]; + nbrCopy = util::updateNbrCopy(numEvent_tab, value_tab); + CptRetard = util::updateCptRetard(nbrCopy); + retard = util::calculRetard(consumptionEvent, CptRetard, + localDataFromRead); + (indiceCount, HindiceCount) = util::updateIndice(nbrCopy); +tel +-- end of node util::observer +node util::updateCptRetard(nbrCopy:int_10) returns (CptRetard:int_10); +let + CptRetard = -1^10 -> map<<util::checkCopy, 10>>(nbrCopy, pre (CptRetard)); +tel +-- end of node util::updateCptRetard + +node util::updateIndice( + nbrCopy:int_10) +returns ( + indiceCount:int; + HindiceCount:bool); +var + iterOut:util::tCounterIter; +let + iterOut = red<<util::countIter, + 10>>(util::tCounterIter{indice=-1;Hindice=false;cpt=0}, nbrCopy); + indiceCount = iterOut.indice; + HindiceCount = iterOut.Hindice; +tel +-- end of node util::updateIndice + +node util::updateNbrCopy( + numEvent_tab:bool_8; + value_tab:int_8) +returns ( + nbrCopy:int_10); +var + accIterOut:util::accObserver; +let + accIterOut = util::accObserver{nbCopy=-1^10;indice=0} -> red<<util::Niter, + 8>>(util::accObserver{nbCopy=pre (accIterOut.nbCopy);indice=0}, + numEvent_tab, value_tab); + nbrCopy = accIterOut.nbCopy; +tel +-- end of node util::updateNbrCopy + +node util::updateRetard( + accIn:util::tIterRetard; + elt:int) +returns ( + accOut:util::tIterRetard); +let + accOut = + util::tIterRetard{conEvent=accIn.conEvent;dataFromRead=accIn.dataFromRead;retardCalcule=-1 + -> if accIn.conEvent and accIn.cpt = accIn.dataFromRead then elt else + -1;cpt=accIn.cpt + 1}; +tel +-- end of node util::updateRetard + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/pipeline.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/pipeline.lus +type bool_10 = bool^10 (*abstract in the source*); +const pipeline::size = 10; + +node pipeline::oneStep_pipe( + accu_in:bool; + elt_in:bool) +returns ( + accu_out:bool; + elt_out:bool); +let + elt_out = true -> pre (not accu_in); + accu_out = elt_in; +tel +-- end of node pipeline::oneStep_pipe +node pipeline::pipeline(in:bool_10) returns (out:bool_10); +var + accu_out:bool; +let + (accu_out, out) = fillred<<pipeline::oneStep_pipe, 10>>(true -> pre + (accu_out), in); +tel +-- end of node pipeline::pipeline + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/predefOp.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/predefOp.lus +type bool_2 = bool^2 (*abstract in the source*); +type bool_2_3 = bool_2^3 (*abstract in the source*); +type int_2 = int^2 (*abstract in the source*); +type int_2_3 = int_2^3 (*abstract in the source*); +type predefOp::Reg_L = bool^2; +type predefOp::T_Reg_H = bool_2^3; +type predefOp::T_Tab_H = int_2^3; +type predefOp::Tab_L = int^2; +const predefOp::H = 3; +const predefOp::L = 2; +node predefOp::bitalt(iacc:bool) returns (oacc:bool; res:bool); +let + res = iacc; + oacc = not res; +tel +-- end of node predefOp::bitalt + +node predefOp::composematbool( + i1:bool_2_3; + i2:bool_2_3) +returns ( + s1:bool_2_3); +let + s1 = map<<Lustre::map<<Lustre::impl, 2>>, 3>>(i1, i2); +tel +-- end of node predefOp::composematbool + +node predefOp::composematint( + i1:int_2_3; + i2:int_2_3) +returns ( + s1:int_2_3; + s2:bool_2_3); +let + s1 = map<<Lustre::map<<Lustre::div, 2>>, 3>>(i1, i2); + s2 = map<<Lustre::map<<Lustre::gte, 2>>, 3>>(i1, i2); +tel +-- end of node predefOp::composematint +node predefOp::incr(init:int; b:bool) returns (res:int); +let + res = if b = true then init + 1 else init; +tel +-- end of node predefOp::incr +node predefOp::incremental(iacc:int) returns (oacc:int; res:int); +let + res = iacc; + oacc = res + 1; +tel +-- end of node predefOp::incremental +node predefOp::initmatbool(iacc:bool) returns (sacc:bool; R:bool_2_3); +let + (sacc, R) = fill<<Lustre::fill<<predefOp::bitalt, 2>>, 3>>(iacc); +tel +-- end of node predefOp::initmatbool +node predefOp::initmatint(iacc:int) returns (sacc:int; R:int_2_3); +let + (sacc, R) = fill<<Lustre::fill<<predefOp::incremental, 2>>, 3>>(iacc); +tel +-- end of node predefOp::initmatint + +node predefOp::predefOp( + a:int) +returns ( + res:int; + init1:int_2_3; + init2:int_2_3; + matres1:int_2_3; + matres2:bool_2_3); +var + bid1:int; + bid2:int; +let + (bid1, init1) = predefOp::initmatint(a); + (bid2, init2) = predefOp::initmatint(a * a); + (matres1, matres2) = predefOp::composematint(init1, init2); + res = predefOp::reducematint(0, matres1); +tel +-- end of node predefOp::predefOp + +node predefOp::predefOp2( + a:bool) +returns ( + nbTrue:int; + init1:bool_2_3; + init2:bool_2_3; + XORMAT:bool_2_3); +var + bid1:bool; + bid2:bool; +let + (bid1, init1) = predefOp::initmatbool(a); + (bid2, init2) = predefOp::initmatbool(not a); + XORMAT = predefOp::composematbool(init1, init2); + nbTrue = predefOp::reducematbool(0, XORMAT); +tel +-- end of node predefOp::predefOp2 +node predefOp::reducematbool(iacc:int; I:bool_2_3) returns (res:int); +let + res = red<<Lustre::red<<predefOp::incr, 2>>, 3>>(iacc, I); +tel +-- end of node predefOp::reducematbool +node predefOp::reducematint(iacc:int; I:int_2_3) returns (res:int); +let + res = red<<Lustre::red<<Lustre::plus, 2>>, 3>>(iacc, I); +tel +-- end of node predefOp::reducematint + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/redIf.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/redIf.lus +type bool_3 = bool^3 (*abstract in the source*); +node redIf::monIf(a:bool; b:bool; c:bool) returns (r:bool); +let + r = if a then b else c; +tel +-- end of node redIf::monIf +node redIf::redIf(a:bool; b:bool_3; c:bool_3) returns (r:bool); +let + r = red<<redIf::monIf, 3>>(a, b, c); +tel +-- end of node redIf::redIf + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/remplissage-1.0.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/remplissage-1.0.lus +type bool_8 = bool^8 (*abstract in the source*); +type int_10 = int^10 (*abstract in the source*); +type int_8 = int^8 (*abstract in the source*); +type util::accChangeTab = struct {numEvent : int; cpt : int; indice : int}; +type util::accObserver = struct {nbCopy : int_10; indice : int}; +type util::tCounterIter = struct {indice : int; Hindice : bool; cpt : int}; +type util::tIterRetard = struct {conEvent : bool; dataFromRead : int; retardCalcule : int; cpt : int}; + +node util::Niter( + accIn:util::accObserver; + numEvent:bool; + value_tab:int) +returns ( + accOut:util::accObserver); +let + accOut = util::accObserver{nbCopy= if numEvent then + util::change_tab2(accIn.nbCopy, value_tab, accIn.indice) else + accIn.nbCopy;indice=accIn.indice + 1}; +tel +-- end of node util::Niter + +node util::calculRetard( + consumptionEvent:bool; + CptRetard:int_10; + localDataFromRead:int) +returns ( + retard:int); +var + accOut:util::tIterRetard; +let + accOut = red<<util::updateRetard, + 10>>(util::tIterRetard{conEvent=consumptionEvent;dataFromRead=localDataFromRead;retardCalcule=-1;cpt=0}, + CptRetard); + retard = accOut.retardCalcule; +tel +-- end of node util::calculRetard + +node util::change_elt2( + accIn:util::accChangeTab; + eltIn:int) +returns ( + accOut:util::accChangeTab; + eltOut:int); +let + eltOut = if accIn.indice = accIn.cpt then if accIn.numEvent = 0 then 1 + else if accIn.numEvent = 1 or accIn.numEvent = 3 or accIn.numEvent = 7 + then eltIn - 1 else if accIn.numEvent = 2 or accIn.numEvent = 4 or + accIn.numEvent = 6 then eltIn + 1 else eltIn else eltIn; + accOut = + util::accChangeTab{numEvent=accIn.numEvent;indice=accIn.indice;cpt=accIn.cpt + + 1}; +tel +-- end of node util::change_elt2 + +node util::change_tab2( + tabIn:int_10; + indiceIn:int; + num_event:int) +returns ( + tabOut:int_10); +var + accOut:util::accChangeTab; +let + (accOut, tabOut) = fillred<<util::change_elt2, + 10>>(util::accChangeTab{numEvent=num_event;cpt=0;indice=indiceIn}, tabIn); +tel +-- end of node util::change_tab2 + +node util::checkCopy( + eltCopy:int; + oldCptRetard:int) +returns ( + newCptRetard:int); +let + newCptRetard = if pre (eltCopy = -1) and eltCopy = 1 then 0 else if pre + (eltCopy <> -1) and pre (eltCopy <> 0) and eltCopy = 0 then -1 else + oldCptRetard + 1; +tel +-- end of node util::checkCopy + +node util::countIter( + accIn:util::tCounterIter; + eltCopy:int) +returns ( + accOut:util::tCounterIter); +let + accOut = if pre (eltCopy <> -1) and pre (eltCopy <> 0) and eltCopy = 0 + then util::tCounterIter{indice=accIn.cpt;Hindice=true;cpt=accIn.cpt + 1} + else + util::tCounterIter{indice=accIn.indice;Hindice=accIn.Hindice;cpt=accIn.cpt + + 1}; +tel +-- end of node util::countIter + +node util::observer( + dataBoiteCP_IN:int; + localDataFromRead:int; + localErasedDataFromBoiteCP:int; + localCopyedDataFromBoiteCP:int; + localErasedDataFromPilote:int; + localCopyedDataFromPilote:int; + localErasedDataFromMem:int; + localCopyedDataFromMem:int; + productionEvent:bool; + consumptionEvent:bool; + eraseMemEvent:bool; + eraseBoiteCPEvent:bool; + erasePiloteEvent:bool; + copyBoiteCPEvent:bool; + copyPiloteEvent:bool; + copyMemEvent:bool) +returns ( + retard:int; + indiceCount:int; + HindiceCount:bool); +var + CptRetard:int_10; + numEvent_tab:bool_8; + value_tab:int_8; + nbrCopy:int_10; +let + numEvent_tab = [productionEvent, consumptionEvent, eraseMemEvent, + copyMemEvent, eraseBoiteCPEvent, copyBoiteCPEvent, erasePiloteEvent, + copyPiloteEvent]; + value_tab = [dataBoiteCP_IN, localDataFromRead, localErasedDataFromMem, + localCopyedDataFromMem, localErasedDataFromBoiteCP, + localCopyedDataFromBoiteCP, localErasedDataFromPilote, + localCopyedDataFromPilote]; + nbrCopy = util::updateNbrCopy(numEvent_tab, value_tab); + CptRetard = util::updateCptRetard(nbrCopy); + retard = util::calculRetard(consumptionEvent, CptRetard, + localDataFromRead); + (indiceCount, HindiceCount) = util::updateIndice(nbrCopy); +tel +-- end of node util::observer +node util::updateCptRetard(nbrCopy:int_10) returns (CptRetard:int_10); +let + CptRetard = -1^10 -> map<<util::checkCopy, 10>>(nbrCopy, pre (CptRetard)); +tel +-- end of node util::updateCptRetard + +node util::updateIndice( + nbrCopy:int_10) +returns ( + indiceCount:int; + HindiceCount:bool); +var + iterOut:util::tCounterIter; +let + iterOut = red<<util::countIter, + 10>>(util::tCounterIter{indice=-1;Hindice=false;cpt=0}, nbrCopy); + indiceCount = iterOut.indice; + HindiceCount = iterOut.Hindice; +tel +-- end of node util::updateIndice + +node util::updateNbrCopy( + numEvent_tab:bool_8; + value_tab:int_8) +returns ( + nbrCopy:int_10); +var + accIterOut:util::accObserver; +let + accIterOut = util::accObserver{nbCopy=-1^10;indice=0} -> red<<util::Niter, + 8>>(util::accObserver{nbCopy=pre (accIterOut.nbCopy);indice=0}, + numEvent_tab, value_tab); + nbrCopy = accIterOut.nbCopy; +tel +-- end of node util::updateNbrCopy + +node util::updateRetard( + accIn:util::tIterRetard; + elt:int) +returns ( + accOut:util::tIterRetard); +let + accOut = + util::tIterRetard{conEvent=accIn.conEvent;dataFromRead=accIn.dataFromRead;retardCalcule=-1 + -> if accIn.conEvent and accIn.cpt = accIn.dataFromRead then elt else + -1;cpt=accIn.cpt + 1}; +tel +-- end of node util::updateRetard + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/simpleRed.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/simpleRed.lus +const simpleRed::m = 3; +const simpleRed::n = 2; +node simpleRed::simpleRed(a:int) returns (res:int); +let + res = red<<Lustre::iplus, 3>>(0, a^3); +tel +-- end of node simpleRed::simpleRed + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/testSilus.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/lionel/testSilus.lus +type bool_20 = bool^20 (*abstract in the source*); +type bool_20_4 = bool_20^4 (*abstract in the source*); +type int_20 = int^20 (*abstract in the source*); +type int_20_4 = int_20^4 (*abstract in the source*); +type int_4 = int^4 (*abstract in the source*); +type testSilus::BOOLNBC = bool^20; +type testSilus::INTNBC = int^20; +type testSilus::INTNBG = int^4; +type testSilus::T_ComChg = int; +type testSilus::T_ComChgNBC = int^20; +type testSilus::T_EntreeGlob = struct {chg2gen : int_20; mesure_chgs : int_20; mesure_gens : int_4}; +type testSilus::T_EtatCharge = int; +type testSilus::T_InfoChgGlob = struct {chg2gen : int_20}; +type testSilus::T_InfoChgGlob_20 = testSilus::T_InfoChgGlob^20 (*abstract in the source*); +type testSilus::T_InfoChgIndiv = struct {mesure_chg : int}; +type testSilus::T_InfoChgIndiv_20 = testSilus::T_InfoChgIndiv^20 (*abstract in the source*); +type testSilus::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : int_20}; +type testSilus::T_InfoGenGlob_4 = testSilus::T_InfoGenGlob^4 (*abstract in the source*); +type testSilus::T_InfoGenIndiv = struct {mesure_gen : int}; +type testSilus::T_InfoGenIndiv_4 = testSilus::T_InfoGenIndiv^4 (*abstract in the source*); +const testSilus::COM_ERR = 0; +const testSilus::COM_OFF = 2; +const testSilus::COM_ON = 1; +const testSilus::EC_DELESTAGE = 4; +const testSilus::EC_LESTAGE = 3; +const testSilus::EC_NON_CTRL = 2; +const testSilus::EC_OFF = 1; +const testSilus::EC_ON = 0; +const testSilus::NBC = 20; +const testSilus::NBG = 4; +node testSilus::copie(acc_in:int) returns (acc_out:int; elt:int); +let + acc_out = acc_in; + elt = acc_in; +tel +-- end of node testSilus::copie +node testSilus::egal_indice(indice:int; val:int) returns (r:bool); +let + r = val = indice; +tel +-- end of node testSilus::egal_indice + +node testSilus::extrCharge( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + TabInfoChgIndiv:testSilus::T_InfoChgIndiv_20; + TabInfoChgGlob:testSilus::T_InfoChgGlob_20); +let + TabInfoChgIndiv = testSilus::extract_tab_info_chg_indiv(EntreeGlob); + TabInfoChgGlob = testSilus::extract_info_chg_glob(EntreeGlob)^20; +tel +-- end of node testSilus::extrCharge + +node testSilus::extrGen( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + TabInfoGenIndiv:testSilus::T_InfoGenIndiv_4; + TabInfoGenGlob:testSilus::T_InfoGenGlob_4; + TabIndiceGen:int_4); +var + bidon:int; +let + TabInfoGenIndiv = testSilus::extract_tab_info_gen_indiv(EntreeGlob); + TabInfoGenGlob = testSilus::extract_info_gen_glob(EntreeGlob)^4; + (bidon, TabIndiceGen) = fill<<testSilus::incr_acc, 4>>(0); +tel +-- end of node testSilus::extrGen + +node testSilus::extract_info_chg_glob( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + InfoChgGlob:testSilus::T_InfoChgGlob); +let + InfoChgGlob = testSilus::T_InfoChgGlob{chg2gen=map<<testSilus::id, + 20>>(EntreeGlob.chg2gen)}; +tel +-- end of node testSilus::extract_info_chg_glob + +node testSilus::extract_info_gen_glob( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + InfoGenGlob:testSilus::T_InfoGenGlob); +let + InfoGenGlob = + testSilus::T_InfoGenGlob{elt_bidon=0;chg2gen=map<<testSilus::id, + 20>>(EntreeGlob.chg2gen)}; +tel +-- end of node testSilus::extract_info_gen_glob + +node testSilus::extract_tab_info_chg_indiv( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + TabInfoChgIndiv:testSilus::T_InfoChgIndiv_20); +let + TabInfoChgIndiv = map<<testSilus::int2InfoChgIndiv, + 20>>(EntreeGlob.mesure_chgs); +tel +-- end of node testSilus::extract_tab_info_chg_indiv + +node testSilus::extract_tab_info_gen_indiv( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + TabInfoGenIndiv:testSilus::T_InfoGenIndiv_4); +let + TabInfoGenIndiv = map<<testSilus::int2InfoGenIndiv, + 4>>(EntreeGlob.mesure_gens); +tel +-- end of node testSilus::extract_tab_info_gen_indiv + +node testSilus::fusion_com( + AllTabComChg:int_20_4; + AllTabComVal:bool_20_4) +returns ( + TabComChg:int_20); +var + Vide:int_20; +let + Vide = 0^20; + TabComChg = red<<testSilus::fusion_tab_com, 4>>(Vide, AllTabComChg, + AllTabComVal); +tel +-- end of node testSilus::fusion_com + +node testSilus::fusion_tab_com( + acc_in:int_20; + TabCom:int_20; + TabVal:bool_20) +returns ( + acc_out:int_20); +let + acc_out = map<<testSilus::fusion_une_com, 20>>(acc_in, TabCom, TabVal); +tel +-- end of node testSilus::fusion_tab_com + +node testSilus::fusion_une_com( + in_com:int; + cur_com:int; + cur_val:bool) +returns ( + out_com:int); +let + out_com = if cur_val then cur_com else in_com; +tel +-- end of node testSilus::fusion_une_com +node testSilus::id(elt_in:int) returns (elt_out:int); +let + elt_out = elt_in; +tel +-- end of node testSilus::id +node testSilus::incr_acc(acc_in:int) returns (acc_out:int; res:int); +let + res = acc_in; + acc_out = res + 1; +tel +-- end of node testSilus::incr_acc + +node testSilus::int2InfoChgIndiv( + m:int) +returns ( + InfoChgIndiv:testSilus::T_InfoChgIndiv); +let + InfoChgIndiv = testSilus::T_InfoChgIndiv{mesure_chg=m}; +tel +-- end of node testSilus::int2InfoChgIndiv + +node testSilus::int2InfoGenIndiv( + m:int) +returns ( + InfoGenIndiv:testSilus::T_InfoGenIndiv); +let + InfoGenIndiv = testSilus::T_InfoGenIndiv{mesure_gen=m}; +tel +-- end of node testSilus::int2InfoGenIndiv + +node testSilus::testSilus( + EntreeGlob:testSilus::T_EntreeGlob) +returns ( + TabComChg:int_20); +var + TabInfoChgIndiv:testSilus::T_InfoChgIndiv_20; + TabInfoChgGlob:testSilus::T_InfoChgGlob_20; + TabEtatCharge:int_20; + TabInfoGenIndiv:testSilus::T_InfoGenIndiv_4; + TabInfoGenGlob:testSilus::T_InfoGenGlob_4; + TabIndiceGen:int_4; + AllTabComChg:int_20_4; + AllTabComVal:bool_20_4; +let + (TabInfoChgIndiv, TabInfoChgGlob) = testSilus::extrCharge(EntreeGlob); + TabEtatCharge = testSilus::traiteChg(TabInfoChgIndiv, TabInfoChgGlob); + (TabInfoGenIndiv, TabInfoGenGlob, TabIndiceGen) = + testSilus::extrGen(EntreeGlob); + (AllTabComChg, AllTabComVal) = testSilus::traiteGen(TabIndiceGen, + TabInfoGenIndiv, TabInfoGenGlob, TabEtatCharge); + TabComChg = testSilus::fusion_com(AllTabComChg, AllTabComVal); +tel +-- end of node testSilus::testSilus +node testSilus::trChItere(acc_in:int; elt:int) returns (acc_out:int); +let + acc_out = if acc_in > elt then acc_in else elt; +tel +-- end of node testSilus::trChItere + +node testSilus::traiteChg( + TabInfoChgIndiv:testSilus::T_InfoChgIndiv_20; + TabInfoChgGlob:testSilus::T_InfoChgGlob_20) +returns ( + TabEtatCharge:int_20); +let + TabEtatCharge = map<<testSilus::traite_charge, 20>>(TabInfoChgIndiv, + TabInfoChgGlob); +tel +-- end of node testSilus::traiteChg + +node testSilus::traiteGen( + TabIndiceGen:int_4; + TabInfoGenIndiv:testSilus::T_InfoGenIndiv_4; + TabInfoGenGlob:testSilus::T_InfoGenGlob_4; + TabEtatCharge:int_20) +returns ( + AllTabComChg:int_20_4; + AllTabComVal:bool_20_4); +let + (AllTabComChg, AllTabComVal) = map<<testSilus::traite_gen, + 4>>(TabIndiceGen, TabInfoGenIndiv, TabInfoGenGlob, TabEtatCharge^4); +tel +-- end of node testSilus::traiteGen + +node testSilus::traite_charge( + InfoChgIndiv:testSilus::T_InfoChgIndiv; + InfoChgGlob:testSilus::T_InfoChgGlob) +returns ( + EtatCharge:int); +let + EtatCharge = red<<testSilus::trChItere, 20>>(InfoChgIndiv.mesure_chg, + InfoChgGlob.chg2gen); +tel +-- end of node testSilus::traite_charge + +node testSilus::traite_gen( + indice_gen:int; + InfoGenIndiv:testSilus::T_InfoGenIndiv; + InfoGenGlob:testSilus::T_InfoGenGlob; + TabEtatCharge:int_20) +returns ( + TabComChg:int_20; + TabComVal:bool_20); +var + TabIndiceGen:int_20; + bidon:int; +let + TabComChg = testSilus::traite_gen_core(indice_gen, InfoGenIndiv, + InfoGenGlob, TabEtatCharge, TabComVal); + TabComVal = map<<testSilus::egal_indice, 20>>(TabIndiceGen, + InfoGenGlob.chg2gen); + (bidon, TabIndiceGen) = fill<<testSilus::copie, 20>>(indice_gen); +tel +-- end of node testSilus::traite_gen + +node testSilus::traite_genCore_itere( + acc_in:int; + elt1:bool; + elt2:int) +returns ( + acc_out:int; + elt:int); +let + elt = if elt1 then elt2 else acc_in; + acc_out = acc_in; +tel +-- end of node testSilus::traite_genCore_itere + +node testSilus::traite_gen_core( + indice_gen:int; + InfoGenIndiv:testSilus::T_InfoGenIndiv; + InfoGenGlob:testSilus::T_InfoGenGlob; + TabEtatCharge:int_20; + TabComVal:bool_20) +returns ( + TabComChg:int_20); +var + bidon:int; +let + (bidon, TabComChg) = fillred<<testSilus::traite_genCore_itere, + 20>>(indice_gen, TabComVal, InfoGenGlob.chg2gen); +tel +-- end of node testSilus::traite_gen_core + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/triSel.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/lionel/triSel.lus +type int_50 = int^50 (*abstract in the source*); +type triSel::Exchange_accu = struct {MinVal : int; MinRank : int; RankFrom : int; CurrentVal : int; Rank : int}; +type triSel::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; +type triSel::Select_accu = struct {RankToFind : int; CurrentRank : int; Val : int}; +type triSel::Sort_accu = struct {CurrentRank : int; Tab : int_50}; +type triSel::sorted_iter_accu = struct {prev_elt : int; prop_is_tt : bool}; +type triSel::tabSize = int^50; +const triSel::size = 50; + +node triSel::Exchange_i_j( + accu_in:triSel::Exchange_accu; + eltIn:int) +returns ( + accu_out:triSel::Exchange_accu; + eltOut:int); +let + accu_out = + triSel::Exchange_accu{MinVal=accu_in.MinVal;MinRank=accu_in.MinRank;RankFrom=accu_in.RankFrom;CurrentVal=accu_in.CurrentVal;Rank=accu_in.Rank + + 1}; + eltOut = if accu_in.Rank = accu_in.MinRank then accu_in.CurrentVal else + if accu_in.Rank = accu_in.RankFrom then accu_in.MinVal else eltIn; +tel +-- end of node triSel::Exchange_i_j +node triSel::Sorted(TIn:int_50) returns (ok:bool); +var + accu_out:triSel::sorted_iter_accu; + TSorted:int_50; +let + TSorted = triSel::triSel(TIn); + accu_out = red<<triSel::sorted_iter, + 50>>(triSel::sorted_iter_accu{prev_elt=0;prop_is_tt=true}, TSorted); + ok = accu_out.prop_is_tt; +tel +-- end of node triSel::Sorted + +node triSel::UnarySort( + accu_in:triSel::Sort_accu; + eltIn:int) +returns ( + accu_out:triSel::Sort_accu); +var + accu_out_select:triSel::Select_accu; + accu_out_min:triSel::MinFR_accu; + accu_out_exchange:triSel::Exchange_accu; + localTab:int_50; +let + accu_out_min = red<<triSel::minFromRank, + 50>>(triSel::MinFR_accu{MinVal=0;MinRank=0;RankFrom=accu_in.CurrentRank;Rank=0}, + accu_in.Tab); + accu_out_select = red<<triSel::select, + 50>>(triSel::Select_accu{RankToFind=accu_in.CurrentRank;CurrentRank=0;Val=0}, + accu_in.Tab); + (accu_out_exchange, localTab) = fillred<<triSel::Exchange_i_j, + 50>>(triSel::Exchange_accu{MinVal=accu_out_min.MinVal;MinRank=accu_out_min.MinRank;RankFrom=accu_out_select.RankToFind;CurrentVal=accu_out_select.Val;Rank=0}, + accu_in.Tab); + accu_out = triSel::Sort_accu{CurrentRank=accu_in.CurrentRank + + 1;Tab=localTab}; +tel +-- end of node triSel::UnarySort + +node triSel::minFromRank( + accu_in:triSel::MinFR_accu; + TabEltIn:int) +returns ( + accu_out:triSel::MinFR_accu); +let + accu_out = triSel::MinFR_accu{MinVal= if accu_in.Rank = 0 or accu_in.Rank + = accu_in.RankFrom then TabEltIn else if accu_in.Rank >= accu_in.RankFrom + then if TabEltIn < accu_in.MinVal then TabEltIn else accu_in.MinVal else + accu_in.MinVal;MinRank= if accu_in.Rank = 0 or accu_in.Rank = + accu_in.RankFrom then accu_in.Rank else if accu_in.Rank >= + accu_in.RankFrom then if TabEltIn < accu_in.MinVal then accu_in.Rank else + accu_in.MinRank else + accu_in.MinRank;RankFrom=accu_in.RankFrom;Rank=accu_in.Rank + 1}; +tel +-- end of node triSel::minFromRank + +node triSel::select( + accu_in:triSel::Select_accu; + elt:int) +returns ( + accu_out:triSel::Select_accu); +let + accu_out = + triSel::Select_accu{RankToFind=accu_in.RankToFind;CurrentRank=accu_in.CurrentRank + + 1;Val= if accu_in.RankToFind = accu_in.CurrentRank then elt else + accu_in.Val}; +tel +-- end of node triSel::select + +node triSel::sorted_iter( + accu_in:triSel::sorted_iter_accu; + elt:int) +returns ( + accu_out:triSel::sorted_iter_accu); +let + accu_out = + triSel::sorted_iter_accu{prev_elt=elt;prop_is_tt=accu_in.prev_elt <= elt + and accu_in.prop_is_tt}; +tel +-- end of node triSel::sorted_iter +node triSel::triSel(TIn:int_50) returns (TSorted:int_50); +var + UnarySort_accu_out:triSel::Sort_accu; +let + UnarySort_accu_out = red<<triSel::UnarySort, + 50>>(triSel::Sort_accu{CurrentRank=0;Tab=TIn}, TIn); + TSorted = UnarySort_accu_out.Tab; +tel +-- end of node triSel::triSel + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/Condact.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/Condact.lus +type TestCondact::t1 = int; +type TestCondact::t2 = int; +node Main::Condact(c:bool; d:int; x:int) returns (y:int); +let + y = TestCondact::C(c, d, x); +tel +-- end of node Main::Condact +node TestCondact::C(c:bool; d:int; x:int) returns (y:int); +let + y = if c then TestCondact::n(x) else d -> pre (y); +tel +-- end of node TestCondact::C +node TestCondact::n(e:int) returns (s:int); +let + s = Util::carre(e); +tel +-- end of node TestCondact::n +node Util::carre(e:int) returns (s:int); +let + s = e * e; +tel +-- end of node Util::carre + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/complex.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/complex.lus +type complex::t = struct {re : real; im : real}; +const complex::i = complex::t{re = 0.; im = 1.}; +node complex::re(c:complex::t) returns (re:real); +let + re = c.re; +tel +-- end of node complex::re + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus +type int_10 = int^10 (*abstract in the source*); +type contractForElementSelectionInArray::elementType = int; +type contractForElementSelectionInArray::iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : int}; +const contractForElementSelectionInArray::size = 10; + +node contractForElementSelectionInArray::selectEltInArray( + array:int_10; + rankToSelect:int) +returns ( + elementSelected:int); +var + iterationResult:contractForElementSelectionInArray::iteratedStruct; +let + iterationResult = red<<contractForElementSelectionInArray::selectOneStage, + 10>>(contractForElementSelectionInArray::iteratedStruct{currentRank=0;rankToSelect=rankToSelect;elementSelected=0}, + array); + elementSelected = iterationResult.elementSelected; +tel +-- end of node contractForElementSelectionInArray::selectEltInArray + +node contractForElementSelectionInArray::selectOneStage( + acc_in:contractForElementSelectionInArray::iteratedStruct; + currentElt:int) +returns ( + acc_out:contractForElementSelectionInArray::iteratedStruct); +let + acc_out = + contractForElementSelectionInArray::iteratedStruct{currentRank=acc_in.currentRank + + 1;rankToSelect=acc_in.rankToSelect;elementSelected= if acc_in.currentRank + = acc_in.rankToSelect then currentElt else acc_in.elementSelected}; +tel +-- end of node contractForElementSelectionInArray::selectOneStage + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/contractForElementSelectionInArray/main.lus +I use _0 as prefix for fresh var names. +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/contractForElementSelectionInArray/main.lus +type int_10 = int^10 (*abstract in the source*); +type intArray::Exchange_accu = struct {MinVal : int; MinRank : int; RankFrom : int; CurrentVal : int; Rank : int}; +type intArray::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; +type intArray::Select_accu = struct {RankToFind : int; CurrentRank : int; Val : int}; +type intArray::Sort_accu = struct {CurrentRank : int; Tab : int_10}; +type intArray::T_isElementOf_ = struct {eltToSearch : int; iselementof : bool}; +type intArray::arrayType = int^10; +type intArray::currentRank_withMemorizedRank = struct {currentRank : int; rankOfMemorizedVal : int; memorizedVal : int}; +type intArray::elementType = int; +type intArray::forSortingAlgo = struct {previousElement : int; sortedUpToHere : bool}; +type intArray::iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : int}; +const intArray::size = 10; + +node intArray::Exchange_i_j( + accu_in:intArray::Exchange_accu; + eltIn:int) +returns ( + accu_out:intArray::Exchange_accu; + eltOut:int); +let + accu_out = + intArray::Exchange_accu{MinVal=accu_in.MinVal;MinRank=accu_in.MinRank;RankFrom=accu_in.RankFrom;CurrentVal=accu_in.CurrentVal;Rank=accu_in.Rank + + 1}; + eltOut = if accu_in.Rank = accu_in.MinRank then accu_in.CurrentVal else + if accu_in.Rank = accu_in.RankFrom then accu_in.MinVal else eltIn; +tel +-- end of node intArray::Exchange_i_j + +node intArray::UnarySort( + accu_in:intArray::Sort_accu; + eltIn:int) +returns ( + accu_out:intArray::Sort_accu); +var + accu_out_select:intArray::Select_accu; + accu_out_min:intArray::MinFR_accu; + accu_out_exchange:intArray::Exchange_accu; + localTab:int_10; +let + accu_out_min = red<<intArray::minFromRank, + 10>>(intArray::MinFR_accu{MinVal=0;MinRank=accu_in.CurrentRank;RankFrom=accu_in.CurrentRank;Rank=0}, + accu_in.Tab); + accu_out_select = red<<intArray::select, + 10>>(intArray::Select_accu{RankToFind=accu_in.CurrentRank;CurrentRank=0;Val=0}, + accu_in.Tab); + (accu_out_exchange, localTab) = fillred<<intArray::Exchange_i_j, + 10>>(intArray::Exchange_accu{MinVal=accu_out_min.MinVal;MinRank=accu_out_min.MinRank;RankFrom=accu_out_select.RankToFind;CurrentVal=accu_out_select.Val;Rank=0}, + accu_in.Tab); + accu_out = intArray::Sort_accu{CurrentRank=accu_in.CurrentRank + + 1;Tab=localTab}; +tel +-- end of node intArray::UnarySort +node intArray::_isElementOf_(e:int; t:int_10) returns (iselementof:bool); +var + acc_out:intArray::T_isElementOf_; +let + acc_out = red<<intArray::iterated_isElementOf_, + 10>>(intArray::T_isElementOf_{eltToSearch=e;iselementof=false}, t); + iselementof = acc_out.iselementof; +tel +-- end of node intArray::_isElementOf_ +node intArray::_isEqualTo_(i1:int; i2:int) returns (o:bool); +let + o = Lustre::eq(i1, i2); +tel +-- end of node intArray::_isEqualTo_ +node intArray::_isGreaterOrEqualTo_(e1:int; e2:int) returns (ge:bool); +let + ge = intArray::_isGreaterThan_(e1, e2) or intArray::_isEqualTo_(e1, e2); +tel +-- end of node intArray::_isGreaterOrEqualTo_ +node intArray::_isGreaterThan_(i:int; j:int) returns (res:bool); +let + res = util::igt(i, j); +tel +-- end of node intArray::_isGreaterThan_ + +node intArray::_isLoselySorted( + array:int_10) +returns ( + array_isLoselySorted:bool); +var + result:intArray::forSortingAlgo; +let + result = red<<intArray::isLocallyLoselySorted, + 10>>(intArray::forSortingAlgo{previousElement=array[0];sortedUpToHere=true}, + array); + array_isLoselySorted = result.sortedUpToHere; +tel +-- end of node intArray::_isLoselySorted +node intArray::getMaximumIn_(array:int_10) returns (maximumElement:int); +let + maximumElement = red<<intArray::selectMax, 10>>(array[0], array); +tel +-- end of node intArray::getMaximumIn_ +node intArray::getMinimumIn_(array:int_10) returns (minimumElement:int); +var + maximum:int; +let + maximum = intArray::getMaximumIn_(array); + minimumElement = red<<intArray::selectMin, 10>>(maximum, array); +tel +-- end of node intArray::getMinimumIn_ + +node intArray::getRank_ofMaximumIn_( + array:int_10) +returns ( + rankOfMaximumElement:int); +var + local:intArray::currentRank_withMemorizedRank; +let + local = red<<intArray::selectMaxRank, + 10>>(intArray::currentRank_withMemorizedRank{currentRank=0;rankOfMemorizedVal=0;memorizedVal=array[0]}, + array); + rankOfMaximumElement = local.rankOfMemorizedVal; +tel +-- end of node intArray::getRank_ofMaximumIn_ + +node intArray::getRank_ofMinimumIn_( + array:int_10) +returns ( + rankOfMinimumElement:int); +var + minElement:int; +let + minElement = intArray::getMinimumIn_(array); + rankOfMinimumElement = red<<intArray::selectMinRank, + 10>>(intArray::currentRank_withMemorizedRank{currentRank=0;rankOfMemorizedVal=0;memorizedVal=minElement}, + array).rankOfMemorizedVal; +tel +-- end of node intArray::getRank_ofMinimumIn_ + +node intArray::isLocallyLoselySorted( + acc_in:intArray::forSortingAlgo; + elt:int) +returns ( + acc_out:intArray::forSortingAlgo); +let + acc_out = + intArray::forSortingAlgo{previousElement=elt;sortedUpToHere=intArray::_isGreaterOrEqualTo_(elt, + acc_in.previousElement) and acc_in.sortedUpToHere}; +tel +-- end of node intArray::isLocallyLoselySorted + +node intArray::iterated_isElementOf_( + acc_in:intArray::T_isElementOf_; + elt_in:int) +returns ( + acc_out:intArray::T_isElementOf_); +let + acc_out = + intArray::T_isElementOf_{eltToSearch=acc_in.eltToSearch;iselementof=acc_in.iselementof + or intArray::_isEqualTo_(acc_in.eltToSearch, elt_in)}; +tel +-- end of node intArray::iterated_isElementOf_ + +node intArray::minFromRank( + accu_in:intArray::MinFR_accu; + TabEltIn:int) +returns ( + accu_out:intArray::MinFR_accu); +let + accu_out = intArray::MinFR_accu{MinVal= if accu_in.Rank <= + accu_in.RankFrom then TabEltIn else if accu_in.Rank >= accu_in.RankFrom + then if TabEltIn < accu_in.MinVal then TabEltIn else accu_in.MinVal else + accu_in.MinVal;MinRank= if accu_in.Rank > accu_in.RankFrom then if + TabEltIn < accu_in.MinVal then accu_in.Rank else accu_in.MinRank else + accu_in.MinRank;RankFrom=accu_in.RankFrom;Rank=accu_in.Rank + 1}; +tel +-- end of node intArray::minFromRank + +node intArray::select( + accu_in:intArray::Select_accu; + elt:int) +returns ( + accu_out:intArray::Select_accu); +let + accu_out = + intArray::Select_accu{RankToFind=accu_in.RankToFind;CurrentRank=accu_in.CurrentRank + + 1;Val= if accu_in.RankToFind = accu_in.CurrentRank then elt else + accu_in.Val}; +tel +-- end of node intArray::select + +node intArray::selectElementOfRank_inArray_( + rankToSelect:int; + array:int_10) +returns ( + elementSelected:int); +var + iterationResult:intArray::iteratedStruct; +let + iterationResult = red<<intArray::selectOneStage, + 10>>(intArray::iteratedStruct{currentRank=0;rankToSelect=rankToSelect;elementSelected=array[0]}, + array); + elementSelected = iterationResult.elementSelected; +tel +-- end of node intArray::selectElementOfRank_inArray_ +node intArray::selectMax(e1:int; e2:int) returns (e:int); +let + e = if intArray::_isGreaterThan_(e1, e2) then e1 else e2; +tel +-- end of node intArray::selectMax + +node intArray::selectMaxRank( + acc_in:intArray::currentRank_withMemorizedRank; + e1:int) +returns ( + acc_out:intArray::currentRank_withMemorizedRank); +let + acc_out = + intArray::currentRank_withMemorizedRank{currentRank=acc_in.currentRank + + 1;rankOfMemorizedVal= if intArray::_isGreaterThan_(e1, acc_in.memorizedVal) + then acc_in.currentRank else acc_in.rankOfMemorizedVal;memorizedVal= if + intArray::_isGreaterThan_(e1, acc_in.memorizedVal) then e1 else + acc_in.memorizedVal}; +tel +-- end of node intArray::selectMaxRank +node intArray::selectMin(e1:int; e2:int) returns (e:int); +let + e = if intArray::_isGreaterThan_(e1, e2) then e2 else e1; +tel +-- end of node intArray::selectMin + +node intArray::selectMinRank( + acc_in:intArray::currentRank_withMemorizedRank; + elt:int) +returns ( + acc_out:intArray::currentRank_withMemorizedRank); +let + acc_out = + intArray::currentRank_withMemorizedRank{currentRank=acc_in.currentRank + + 1;rankOfMemorizedVal= if intArray::_isEqualTo_(acc_in.memorizedVal, elt) + then acc_in.currentRank else + acc_in.rankOfMemorizedVal;memorizedVal=acc_in.memorizedVal}; +tel +-- end of node intArray::selectMinRank + +node intArray::selectOneStage( + acc_in:intArray::iteratedStruct; + currentElt:int) +returns ( + acc_out:intArray::iteratedStruct); +let + acc_out = intArray::iteratedStruct{currentRank=acc_in.currentRank + + 1;rankToSelect=acc_in.rankToSelect;elementSelected= if acc_in.currentRank = + acc_in.rankToSelect then currentElt else acc_in.elementSelected}; +tel +-- end of node intArray::selectOneStage +node intArray::sort_(array:int_10) returns (arraySorted:int_10); +var + UnarySort_accu_out:intArray::Sort_accu; +let + UnarySort_accu_out = red<<intArray::UnarySort, + 10>>(intArray::Sort_accu{CurrentRank=0;Tab=array}, array); + arraySorted = UnarySort_accu_out.Tab; +tel +-- end of node intArray::sort_ + +node main::main( + a:int_10) +returns ( + tri:int_10; + pos_min:int; + min:int; + pos_max:int; + max:int); +let + min = intArray::getMinimumIn_(a); + pos_min = intArray::getRank_ofMinimumIn_(a); + max = intArray::getMaximumIn_(a); + pos_max = intArray::getRank_ofMaximumIn_(a); + tri = intArray::sort_(a); +tel +-- end of node main::main +node util::igt(i:int; j:int) returns (res:bool); +let + res = i > j; +tel +-- end of node util::igt + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus +node noeudsIndependants::equals(a:int; b:int) returns (r:bool); +let + r = a = b; +tel +-- end of node noeudsIndependants::equals +node noeudsIndependants::gt(a:int; b:int) returns (r:bool); +let + r = a > b; +tel +-- end of node noeudsIndependants::gt + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus +I use _0 as prefix for fresh var names. +Error. No package has been provided + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/contractForElementSelectionInArray/tri.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/contractForElementSelectionInArray/tri.lus +type int_10 = int^10 (*abstract in the source*); +type tri::Exchange_accu = struct {MinVal : int; MinRank : int; RankFrom : int; CurrentVal : int; Rank : int}; +type tri::INTSIZE = int^10; +type tri::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; +type tri::Select_accu = struct {RankToFind : int; CurrentRank : int; Val : int}; +type tri::Sort_accu = struct {CurrentRank : int; Tab : int_10}; +type tri::sorted_iter_accu = struct {prev_elt : int; prop_is_tt : bool}; +const tri::size = 10; + +node tri::Exchange_i_j( + accu_in:tri::Exchange_accu; + eltIn:int) +returns ( + accu_out:tri::Exchange_accu; + eltOut:int); +let + accu_out = + tri::Exchange_accu{MinVal=accu_in.MinVal;MinRank=accu_in.MinRank;RankFrom=accu_in.RankFrom;CurrentVal=accu_in.CurrentVal;Rank=accu_in.Rank + + 1}; + eltOut = if accu_in.Rank = accu_in.MinRank then accu_in.CurrentVal else + if accu_in.Rank = accu_in.RankFrom then accu_in.MinVal else eltIn; +tel +-- end of node tri::Exchange_i_j +node tri::Sorted(TIn:int_10) returns (res:bool); +var + accu_out:tri::sorted_iter_accu; + TSorted:int_10; +let + TSorted = tri::main(TIn); + accu_out = red<<tri::sorted_iter, + 10>>(tri::sorted_iter_accu{prev_elt=0;prop_is_tt=true}, TSorted); + res = accu_out.prop_is_tt; +tel +-- end of node tri::Sorted + +node tri::UnarySort( + accu_in:tri::Sort_accu; + eltIn:int) +returns ( + accu_out:tri::Sort_accu); +var + accu_out_select:tri::Select_accu; + accu_out_min:tri::MinFR_accu; + accu_out_exchange:tri::Exchange_accu; + localTab:int_10; +let + accu_out_min = red<<tri::minFromRank, + 10>>(tri::MinFR_accu{MinVal=0;MinRank=accu_in.CurrentRank;RankFrom=accu_in.CurrentRank;Rank=0}, + accu_in.Tab); + accu_out_select = red<<tri::select, + 10>>(tri::Select_accu{RankToFind=accu_in.CurrentRank;CurrentRank=0;Val=0}, + accu_in.Tab); + (accu_out_exchange, localTab) = fillred<<tri::Exchange_i_j, + 10>>(tri::Exchange_accu{MinVal=accu_out_min.MinVal;MinRank=accu_out_min.MinRank;RankFrom=accu_out_select.RankToFind;CurrentVal=accu_out_select.Val;Rank=0}, + accu_in.Tab); + accu_out = tri::Sort_accu{CurrentRank=accu_in.CurrentRank + + 1;Tab=localTab}; +tel +-- end of node tri::UnarySort +node tri::main(TIn:int_10) returns (TSorted:int_10); +var + UnarySort_accu_out:tri::Sort_accu; +let + UnarySort_accu_out = red<<tri::UnarySort, + 10>>(tri::Sort_accu{CurrentRank=0;Tab=[7, 8, 4, 3, 2, 9, 1, 10, 2, 7]}, [7, + 8, 4, 3, 2, 9, 1, 10, 2, 7]); + TSorted = UnarySort_accu_out.Tab; +tel +-- end of node tri::main + +node tri::minFromRank( + accu_in:tri::MinFR_accu; + TabEltIn:int) +returns ( + accu_out:tri::MinFR_accu); +let + accu_out = tri::MinFR_accu{MinVal= if accu_in.Rank <= accu_in.RankFrom + then TabEltIn else if accu_in.Rank >= accu_in.RankFrom then if TabEltIn < + accu_in.MinVal then TabEltIn else accu_in.MinVal else + accu_in.MinVal;MinRank= if accu_in.Rank > accu_in.RankFrom then if + TabEltIn < accu_in.MinVal then accu_in.Rank else accu_in.MinRank else + accu_in.MinRank;RankFrom=accu_in.RankFrom;Rank=accu_in.Rank + 1}; +tel +-- end of node tri::minFromRank + +node tri::select( + accu_in:tri::Select_accu; + elt:int) +returns ( + accu_out:tri::Select_accu); +let + accu_out = + tri::Select_accu{RankToFind=accu_in.RankToFind;CurrentRank=accu_in.CurrentRank + + 1;Val= if accu_in.RankToFind = accu_in.CurrentRank then elt else + accu_in.Val}; +tel +-- end of node tri::select + +node tri::sorted_iter( + accu_in:tri::sorted_iter_accu; + elt:int) +returns ( + accu_out:tri::sorted_iter_accu); +let + accu_out = tri::sorted_iter_accu{prev_elt=elt;prop_is_tt=accu_in.prev_elt + <= elt and accu_in.prop_is_tt}; +tel +-- end of node tri::sorted_iter + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/iter.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/iter.lus +type int_3 = int^3 (*abstract in the source*); +type p::t = int; +const p::size = 3; +node main::main(t1:int_3; t2:int_3) returns (t12:int_3); +let + t12 = p::map2(t1, t2); +tel +-- end of node main::main +node p::map2(x:int_3; y:int_3) returns (z:int_3); +let + z = map<<p::n, 3>>(x, y); +tel +-- end of node p::map2 +node p::n(i1:int; i2:int) returns (o:int); +let + o = Lustre::iplus(i1, i2); +tel +-- end of node p::n + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/model.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/model.lus +type pint::t = int; +node pint::fby1(init:int; fb:int) returns (next:int); +let + next = init -> pre (fb); +tel +-- end of node pint::fby1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/modelInst.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/modelInst.lus +type Pbool::t = bool; +type Pint::t = int; +type Preal::t = real; +const main::pi = 3.14159; +node Pbool::n(init:bool; in:bool) returns (ok:bool); +let + ok = init -> pre (in); +tel +-- end of node Pbool::n +node Pint::n(init:int; in:int) returns (ok:int); +let + ok = init -> pre (in); +tel +-- end of node Pint::n +node Preal::n(init:real; in:real) returns (ok:real); +let + ok = init -> pre (in); +tel +-- end of node Preal::n + +node main::main( + i:int; + ray:real) +returns ( + oint:int; + obool:bool; + oreal:real); +let + oint = Pint::n(0, i); + obool = Pbool::n(true, i < 50); + oreal = Preal::n(0., 0. -> 3.14159 * ray * ray); +tel +-- end of node main::main + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/packages.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/packages.lus +type inter::selType = struct {i : int; b : bool; r : real}; +type pbool::t = bool; +type pint::t = int; +type preal::t = real; +const inter::n = -4; + +node inter::preced( + in:inter::selType) +returns ( + out:inter::selType; + out2:inter::selType); +let + out2 = inter::selType{i=0;b=true;r=0.}; + out.i = pint::fby1(out2.i, in.i); + out.b = pbool::fby1(out2.b, in.b); + out.r = preal::fby1(out2.r, in.r); +tel +-- end of node inter::preced +node mainPack::preced(in:inter::selType) returns (out:inter::selType); +var + out2:inter::selType; +let + (out, out2) = inter::preced(in); +tel +-- end of node mainPack::preced +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +let + next = init -> pre (fb); +tel +-- end of node pbool::fby1 +node pint::fby1(init:int; fb:int) returns (next:int); +let + next = init -> pre (fb); +tel +-- end of node pint::fby1 +node preal::fby1(init:real; fb:real) returns (next:real); +let + next = init -> pre (fb); +tel +-- end of node preal::fby1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/packages2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/packages2.lus +type inter::selType = struct {i : int; b : bool; r : real}; +type pbool::t = bool; +type pint::t = int; +type preal::t = real; +const inter::n = -4; + +node inter::preced( + in:inter::selType) +returns ( + out:inter::selType; + out2:inter::selType); +let + out2 = inter::selType{i=0;b=true;r=0.}; + out.i = pint::fby1(out2.i, in.i); + out.b = pbool::fby1(out2.b, in.b); + out.r = preal::fby1(out2.r, in.r); +tel +-- end of node inter::preced +node main::foo(in:int) returns (out:int); +let + out = in; +tel +-- end of node main::foo +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +let + next = init -> pre (fb); +tel +-- end of node pbool::fby1 +node pint::fby1(init:int; fb:int) returns (next:int); +let + next = init -> pre (fb); +tel +-- end of node pint::fby1 +node preal::fby1(init:real; fb:real) returns (next:real); +let + next = init -> pre (fb); +tel +-- end of node preal::fby1 + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/packEnvTest/polymorphic_pack.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/packEnvTest/polymorphic_pack.lus +type int_3 = int^3 (*abstract in the source*); +type p::t = int; +const p::size = 3; +node p::map2(x:int_3; y:int_3) returns (z:int_3); +let + z = map<<p::n, 3>>(x, y); +tel +-- end of node p::map2 +node p::n(i1:int; i2:int) returns (o:int); +let + o = Lustre::plus(i1, i2); +tel +-- end of node p::n + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/to_sort_out/asservi.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_work/to_sort_out/asservi.lus +type asservi::pendule; +const asservi::G = 10.0; +const asservi::L = 2.0; +const asservi::T = 0.1; +node asservi::D(x:real) returns (d:real); +let + d = 0.0 -> x - pre (x) / 0.1; +tel +-- end of node asservi::D +node asservi::I(dx:real) returns (x:real); +let + x = 0.0 -> pre (0.1 * dx + x); +tel +-- end of node asservi::I +node asservi::I2(d2x:real) returns (x:real); +var + dx:real; +let + dx = asservi::I(d2x); + x = dx -> 0.1 * dx + pre (x); +tel +-- end of node asservi::I2 +node asservi::PEND(d2x0:real; d2y0:real) returns (teta:real); +let + teta = asservi::I2(asservi::sin(teta) * d2y0 + 10.0 - asservi::cos(teta) * + d2x0 / 2.0); +tel +-- end of node asservi::PEND +node asservi::asservi(delta:real) returns (p:asservi::pendule); +var + d2x0:real; + d2y0:real; + teta:real; + x0:real; + y0:real; + x:real; + y:real; +let + d2y0 = 0.0; + d2x0 = delta -> 8.0 * 10.0 * asservi::sin(teta) / asservi::cos(teta) + + asservi::sqrt(1.0 * 10.0 * 2.0) * asservi::D(teta) + 0.5 * x0 / 2.0; + teta = asservi::PEND(delta -> d2x0, d2y0); + x = x0 + 2.0 * asservi::sin(teta); + y = y0 + 2.0 * asservi::cos(teta); + x0 = asservi::I2(d2x0); + y0 = asservi::I2(d2y0); + p = asservi::make_pend(x0, y0, x, y); +tel +-- end of node asservi::asservi +extern function asservi::cos(x:real) returns (y:real); +node asservi::jeu(x0:real; y0:real) returns (p:asservi::pendule); +var + d2x0:real; + d2y0:real; + teta:real; + x:real; + y:real; +let + d2x0 = asservi::D(asservi::D(x0)); + d2y0 = asservi::D(asservi::D(y0)); + teta = asservi::PEND(d2x0, d2y0); + x = x0 + 2.0 * asservi::sin(teta); + y = y0 + 2.0 * asservi::cos(teta); + p = asservi::make_pend(x0, y0, x, y); +tel +-- end of node asservi::jeu + +extern function asservi::make_pend( + x0:real; + y0:real; + x:real; + y:real) +returns ( + p:asservi::pendule); +extern function asservi::sin(x:real) returns (y:real); +extern function asservi::sqrt(x:real) returns (y:real); +Those tests are supposed to generate errors + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/clock/bad_call02.lus +*** Error in file "bad_call02.lus", line 6, col 4 to 4, token '=': +*** +*** clock error: The two following clocks are not unifiable: + + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/clock/bad_id.lus +*** Error in file "bad_id.lus", line 3, col 6 to 9, token 'toto': +*** +*** Unknown ident: b + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/clock/clock.lus +*** Error in file "clock.lus", line 23, col 12 to 17, token 'clock4': +*** +*** clock error: The two following clocks are not unifiable: + + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/clock/clock2.lus +*** Error in file "clock2.lus", line 6, col 22 to 22, token 'a': +*** the type of a clock cannot be int + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/clock/inonout.lus +*** Error in file "inonout.lus", line 3, col 46 to 46, token 'c': +*** unknown variable (c) + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/clock/when_enum.lus +*** Error in file "when_enum.lus", line 10, col 12 to 15, token 'toto': +*** +*** clock error: The two following clocks are not unifiable: + + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/activation1.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_fail/semantics/activation1.lus +node activation1::activation1(evt:bool; reset:bool) returns (scie:int); +var + go_up:bool; +let + go_up = true -> if pre (scie) >= 5 then false else if pre (scie) <= 0 + then true else pre (go_up); + scie = if reset then 0 else 0 -> if go_up then activation1::up(scie) + else activation1::down(scie); +tel +-- end of node activation1::activation1 +node activation1::down(in:int) returns (out:int); +let + out = pre (in) - 1; +tel +-- end of node activation1::down +node activation1::up(in:int) returns (out:int); +let + out = pre (in) + 1; +tel +-- end of node activation1::up + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/activation2.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_fail/semantics/activation2.lus +node activation2::activation2(evt:bool) returns (scie:int); +var + go_up:bool; +let + go_up = true -> if pre (scie) >= 5 then false else if pre (scie) <= 0 + then true else pre (go_up); + scie = 0 -> if evt then if go_up then activation2::up(scie) else + activation2::down(scie) else pre (scie); +tel +-- end of node activation2::activation2 +node activation2::down(in:int) returns (out:int); +let + out = pre (in) - 1; +tel +-- end of node activation2::down +node activation2::up(in:int) returns (out:int); +let + out = pre (in) + 1; +tel +-- end of node activation2::up + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/bad_call01.lus +*** Error in file "bad_call01.lus", line 2, col 13 to 16, token 'titi': +*** Recursion loop detected in node bad_call01::titi + node ref in file "bad_call01.lus", line 2, col 13 to 16, token 'titi' + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/bug.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/bug.lus +type int_2 = int^2 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +type int_5 = int^5 (*abstract in the source*); +type int_5_6 = int_5^6 (*abstract in the source*); +type bug::bool4 = bool^5; +type bug::really = real; +type bug::tab1 = int^2; +type bug::tab2 = int_3^4; +type bug::tab3 = int_5_6^7; +const bug::ze_const_int = 5; +node bug::after(X:bool) returns (afterX:bool); +var + bidon1:bool; + bidon2:bool; +let + afterX = false -> pre (X or afterX) or bidon2 and bidon1; + (bidon1, bidon2) = bug::bidon(X); +tel +-- end of node bug::after +node bug::bidon(in:bool) returns (out1:bool; out2:bool); +var + toto:int_2; +let + toto[0] = 10; + toto[1] = 5; + out1 = true or in and toto[0] < 20; + out2 = false and in; +tel +-- end of node bug::bidon + +node bug::bug( + active:bool; + action:bool; + intI:int; + realI:real) +returns ( + alarm:bool; + intO:int; + realO:real); +var + begin:bool; + en:bool; + x:int; + y:int; +let + begin = active -> bug::edge_detect(active); + en = bug::edge_detect(not active); + alarm = not bug::once_from_to(action, begin, en); + (intO, realO) = (5 + x + y, 10.0 - 10.0 - 10.0) -> (intI, pre (realO) * + realI); + x = 0 -> if active then y else pre (x) + 1; + y = 1 -> if active then pre (y) + 1 else x; +tel +-- end of node bug::bug +node bug::edge_detect(in:bool) returns (edge:bool); +var + bidon1:bool; + bidon2:bool; +let + edge = false -> in and not pre (in) or bidon2 and bidon1; + (bidon1, bidon2) = bug::bidon(in); +tel +-- end of node bug::edge_detect +node bug::implies(X:bool; Y:bool) returns (XimpliesY:bool); +let + XimpliesY = not X or Y; +tel +-- end of node bug::implies +node bug::once_from_to(C:bool; A:bool; B:bool) returns (X:bool); +let + X = bug::implies(B, false -> pre (bug::once_since(C, A))); +tel +-- end of node bug::once_from_to +node bug::once_since(C:bool; A:bool) returns (X:bool); +let + X = if A then C else if bug::after(A) then C or false -> pre (X) else + false; +tel +-- end of node bug::once_since + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/const.lus +*** Error in file "const.lus", line 19, col 42 to 43, token 'c4': +*** bad field declaration, ident already linked at line:19, col:10 to 11 + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/const2.lus +*** Error in file "const2.lus", line 4, col 18 to 22, token 'false': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/const3.lus +*** Error in file "const3.lus", line 2, col 17 to 17, token '/': +*** +*** can't eval constant: reals cannot be evaluated, sorry. + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/cpt_dc.lus +I use _0 as prefix for fresh var names. +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_fail/semantics/cpt_dc.lus +node cpt_dc::cpt_dc(evt:bool; reset:bool) returns (cpt:int); +var + _f3:bool; + _f4:int; +let + _f3 = false; + _f4 = cpt; + cpt = if reset then 0 else if _f3 then 0 else _f4 + if evt then 1 else + 0; +tel +-- end of node cpt_dc::cpt_dc + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/def.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/def.lus +type int_4 = int^4 (*abstract in the source*); +type def::int4 = int^4; +type def::st = struct {x : int_4}; +node def::def(a:bool) returns (b:def::st); +var + c:def::st; +let + b.x[0] = c.x[0]; + b.x[1] = c.x[0]; + b.x[2] = c.x[0]; + b.x[3] = c.x[0]; + c.x[0] = b.x[0]; + c.x[1] = b.x[1]; + c.x[2] = b.x[2]; + c.x[3] = b.x[3]; +tel +-- end of node def::def + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/import2.lus +*** Error in file "import2.lus", line 2, col 1 to 4, token 'node': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/m.lus +*** Error in file "m.lus", line 3, col 23 to 23, token ',': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/not_a_constant.lus +*** Error in file "not_a_constant.lus", line 10, col 23 to 24, token '--': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/piege.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_fail/semantics/piege.lus +node piege::aux1(in1:bool; in2:bool) returns (out:bool); +let + out = in1 or true -> pre (in2); +tel +-- end of node piege::aux1 +node piege::aux2(in1:bool; in2:bool) returns (out1:bool; out2:bool); +let + out1 = true -> pre (in1); + out2 = in2; +tel +-- end of node piege::aux2 +node piege::piege(in:bool) returns (out:bool); +let + out = in and piege::aux1(piege::aux2(out, out)); +tel +-- end of node piege::piege + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/tranche.lus +*** Error in file "tranche.lus", line 7, col 6 to 6, token 'n': +*** +*** can't eval constant: +*** cannot access this extern constant value + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/semantics/x.lus +*** Error in file "x.lus", line 4, col 7 to 7, token 'm': +*** Recursion loop detected: +*** const ref in file "x.lus", line 4, col 11 to 11, token 'x' + > const ref in file "x.lus", line 6, col 11 to 11, token 't' + > const ref in file "x.lus", line 8, col 11 to 11, token 'n' + > const ref in file "x.lus", line 2, col 11 to 11, token 'm' + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/syntax/old_style_and_pack.lus +*** Error in file "old_style_and_pack.lus", line 17, col 1 to 4, token 'node': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/syntax/record.lus +*** Error in file "record.lus", line 7, col 29 to 29, token '{': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/Gyro.lus +*** Error in file "Gyro.lus", line 11, col 42 to 42, token ',': +*** syntax error + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/bad_call03.lus +-- ../objlinux/lus2lic -vl 2 --nonreg-test +-- should_fail/type/bad_call03.lus +type anynum_3 = anynum^3 (*abstract in the source*); +type int_3 = int^3 (*abstract in the source*); +type real_3 = real^3 (*abstract in the source*); + +node bad_call03::bad_call03( + a:int_3; + b:int_3; + c:real_3; + d:real_3) +returns ( + x:int_3; + y:real_3); +let + x = bad_call03::toto(a, b); + y = bad_call03::toto(c, d); +tel +-- end of node bad_call03::bad_call03 +node bad_call03::titi(c:real_3; d:real_3) returns (y:real_3); +let + y = bad_call03::toto(c, d); +tel +-- end of node bad_call03::titi +node bad_call03::toto(i1:anynum_3; i2:anynum_3) returns (o:anynum_3); +let + o = Lustre::map<<Lustre::plus, 3>>(i1, i2); +tel +-- end of node bad_call03::toto + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/const2.lus +*** Error in file "const2.lus", line 16, col 12 to 13, token '<>': +*** type error: +*** type 'int * real' was provided whereas +*** type 'any * any' was expected +*** +*** int and real are not unifiable + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/packages.lus +*** Error in file "packages.lus", line 31, col 10 to 15, token 'preced': +*** provided node for inter::preced is not compatible with its implementation: +*** int and inter::selType are not unifiable + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/packages2.lus +*** Error in file "packages2.lus", line 5, col 8 to 8, token 'n': +*** provided node for stupid::n is not compatible with its implementation: +*** stupid::t1 <> int + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/parametric_node.lus +*** Error in file "parametric_node.lus", line 3, col 60 to 62, token 'int': +*** Bad (static) type argument: 'real' and 'int' differs. + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/parametric_node2.lus +*** Error in file "parametric_node2.lus", line 12, col 23 to 35, token 'Lustre::iplus': +*** Bad (static) node argument: wrong output type profile. + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/parametric_node3.lus +*** Error in file "parametric_node3.lus", line 10, col 18 to 23, token 'toto_n': +*** Bad number of (static) arguments: 3 expected, and 2 provided. + + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/type/parametric_node4.lus +*** Error in file "parametric_node4.lus", line 3, col 60 to 62, token 'int': +*** Bad (static) type argument: 'real' and 'int' differs. + diff --git a/src/test/test_ec.res.exp b/_tests/test_ec.res.exp similarity index 51% rename from src/test/test_ec.res.exp rename to _tests/test_ec.res.exp index 6223e86ab485c42fd262f88a649d74a810b1fb26..fbc9e39c438063c1db5709185f637c6136a4cb85 100644 --- a/src/test/test_ec.res.exp +++ b/_tests/test_ec.res.exp @@ -1,260 +1,254 @@ ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/COUNTER.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/COUNTER.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/CURRENT.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/CURRENT.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/EDGE.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/EDGE.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/FALLING_EDGE.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/FALLING_EDGE.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/Int.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/Int.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/PCOND.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/PCOND.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/PCOND1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/PCOND1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/SOURIS.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/SOURIS.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/STABLE.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/STABLE.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/SWITCH.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/SWITCH.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/SWITCH1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/SWITCH1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/TIME_STABLE.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/TIME_STABLE.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/TIME_STABLE1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/TIME_STABLE1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/Watch.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/Watch.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 60 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/X.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/X.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/X1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/X1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/X2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/X2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/X3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/X3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/X6.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/X6.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/_N_uu.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/_N_uu.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/activation_ec.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/activation_ec.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/after.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/after.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/alarme.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/alarme.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/arbitre.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/arbitre.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 28 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/argos.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/argos.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/assertion.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/assertion.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/aux.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/aux.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/aux1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/aux1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/bascule.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/bascule.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/call.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/call.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 15 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ck2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ck2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ck3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ck3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ck4.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ck4.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ck5.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ck5.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ck6.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ck6.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ck7.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ck7.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/clock.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/clock.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/cminus.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/cminus.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/compteur.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/compteur.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/count.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/count.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/cpt.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/cpt.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/cst.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/cst.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/deconne.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/deconne.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/dep.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/dep.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/dependeur.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/dependeur.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/dependeur_struct.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/dependeur_struct.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/drapfab.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/drapfab.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/enum.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/enum.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/enum0.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/enum0.lus -o /tmp/xx.ec ec2c /tmp/xx.ec +EcParse: ec file must contain one node syntax errors... -syntax error - at line 14 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/eq1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/eq1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/ex.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/ex.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/exclusion.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/exclusion.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/fby.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/fby.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/flo.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/flo.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/fresh_name.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/fresh_name.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/hanane.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/hanane.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/impl_priority.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/impl_priority.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/import1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/import1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/initial.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/initial.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/integrator.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/integrator.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/long_et_stupide_nom_de_noeud.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/long_et_stupide_nom_de_noeud.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/merge.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/merge.lus -o /tmp/xx.ec *** Error in file "merge.lus", line 7, col 15 to 17, token 'clk': *** syntax error @@ -263,295 +257,295 @@ EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax4.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax4.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax4_bis.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax4_bis.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax5.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax5.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax5_random.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax5_random.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/minmax6.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/minmax6.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mm.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mm.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mm1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mm1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mm22.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mm22.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mm3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mm3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/model.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/model.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 11 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/model2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/model2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mouse.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mouse.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mouse1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mouse1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mouse2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mouse2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/mouse3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/mouse3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/multiclock.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/multiclock.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc10.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc10.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc4.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc4.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc5.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc5.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc6.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc6.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc7.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc7.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc8.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc8.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nc9.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nc9.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/nested.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/nested.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/node_caller1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/node_caller1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/o2l_feux_compl.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/o2l_feux_compl.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/packed_cst.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/packed_cst.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/param_node.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/param_node.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/param_node2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/param_node2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/param_node3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/param_node3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/param_node4.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/param_node4.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/param_struct.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/param_struct.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/patrick.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/patrick.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/poussoir.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/poussoir.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/rs.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/rs.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/s.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/s.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/simple.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/simple.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 7 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/sincos.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/sincos.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/speedcontrol.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/speedcontrol.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/stopwatch.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/stopwatch.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/testCA.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/testCA.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/test_clash.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/test_clash.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/test_const.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/test_const.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/test_node_expand.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/test_node_expand.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/test_node_expand2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/test_node_expand2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/trivial.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/trivial.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/trivial2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/trivial2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/tuple.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/tuple.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/type_decl.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/type_decl.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/uu.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/uu.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/NONREG/v1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/NONREG/v1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/access.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/access.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/consensus.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/consensus.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/consensus2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/consensus2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/fby.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/fby.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/func_with_body.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/func_with_body.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/heater_control.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/heater_control.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/left.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/left.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/newpacks.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/newpacks.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/onlyroll.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/onlyroll.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/p.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/p.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... -syntax error - at line 5 +syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/packs.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/packs.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/pfs.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/pfs.lus -o /tmp/xx.ec *** Error in file "pfs.lus", line 43, col 22 to 22, token '[': *** syntax error @@ -560,106 +554,101 @@ EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/struct.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/struct.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/struct0.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/struct0.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/t.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/t.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/t0.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/t0.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 13 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/t1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/t1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/t2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/t2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/test.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/test.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -Segmentation fault +EcParse: ec file must contain one node +syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/Pascal/trivial.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/Pascal/trivial.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/bad_call02.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/bad_call02.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call01.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call01.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 10 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call02.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call02.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call03.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call03.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 28 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call04.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call04.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call05.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call05.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call06.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call06.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/call/call07.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/call/call07.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/clock.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/clock.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... -syntax error - at line 11 +syntax error - at line 12 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/clock2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/clock2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/clock_ite.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/clock_ite.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/when_enum.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/when_enum.lus -o /tmp/xx.ec Error. *** Cannot generate V4 style Lustre for programs with enumerated clocks (yet), sorry. ec2c /tmp/xx.ec EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/when_node.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/when_node.lus -o /tmp/xx.ec Error. *** Cannot generate V4 style Lustre for programs with enumerated clocks (yet), sorry. ec2c /tmp/xx.ec EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/when_not.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/when_not.lus -o /tmp/xx.ec *** Error in file "when_not.lus", line 7, col 12 to 17, token 'clock4': *** *** clock error: The two following clocks are not unifiable: @@ -672,215 +661,211 @@ EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/clock/when_tuple.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/clock/when_tuple.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 23 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/Gyroscope2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/Gyroscope2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/alias.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/alias.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/bred.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/bred.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/bred_lv4.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/bred_lv4.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/clock.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/clock.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... -syntax error - at line 5 +syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/clock1_2ms.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/clock1_2ms.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/decl.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/decl.lus -o /tmp/xx.ec ec2c /tmp/xx.ec +EcParse: ec file must contain one node syntax errors... -syntax error - at line 93 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/declaration.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/declaration.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 23 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/def.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/def.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/filliter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/filliter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/filter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/filter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/lustre_test1_ok.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/lustre_test1_ok.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/map_red_iter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/map_red_iter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/mapdeRed.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/mapdeRed.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/mapinf.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/mapinf.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/mapiter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/mapiter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/mappredef.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/mappredef.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/plus.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/plus.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/pre_x.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/pre_x.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/rediter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/rediter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/redoptest.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/redoptest.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/demo/sample_time_change.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/demo/sample_time_change.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/bob.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/bob.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/def.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/def.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/ex.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/ex.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/iter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/iter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/iterate.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/iterate.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/lecteur.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/lecteur.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/lucky.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/lucky.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/morel.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/morel.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/morel2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/morel2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/morel3.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/morel3.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/morel4.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/morel4.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/morel5.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/morel5.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/noAlarm.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/noAlarm.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/notTwo.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/notTwo.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/onlyroll.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/onlyroll.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/onlyroll2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/onlyroll2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/test.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/test.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/titi.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/titi.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/toolate.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/toolate.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/fab_test/toto.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/fab_test/toto.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/FillFollowedByRed.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/FillFollowedByRed.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/Gyroscope.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/Gyroscope.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/ProduitBool/produitBool.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/ProduitBool/produitBool.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/ProduitBool/shiftFill_ludic.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/ProduitBool/shiftFill_ludic.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/ProduitBool/shift_ludic.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/ProduitBool/shift_ludic.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/arrays.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/arrays.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/bug.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/bug.lus -o /tmp/xx.ec *** Error in file "bug.lus", line 2, col 6 to 10, token 'pack1': *** unknown package @@ -889,160 +874,158 @@ EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/calculs_max.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/calculs_max.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/clock.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/clock.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/deSimone.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/deSimone.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/iterFibo.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/iterFibo.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/mapiter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/mapiter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/matrice.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/matrice.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/matrice2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/matrice2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/minus.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/minus.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/moyenne.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/moyenne.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/normal.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/normal.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/pack1.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/pack1.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/pilote-1.0.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/pilote-1.0.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/pipeline.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/pipeline.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/predefOp.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/predefOp.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/redIf.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/redIf.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/remplissage-1.0.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/remplissage-1.0.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/simpleRed.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/simpleRed.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/testSilus.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/testSilus.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/lionel/triSel.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/lionel/triSel.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/Condact.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/Condact.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 11 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/complex.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/complex.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 7 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/main.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/main.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 7 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus -o /tmp/xx.ec Error. No package has been provided ec2c /tmp/xx.ec EcParse : Can't open file '/tmp/xx.ec' syntax errors... ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/tri.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/contractForElementSelectionInArray/tri.lus -o /tmp/xx.ec ec2c /tmp/xx.ec ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/iter.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/iter.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/model.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/model.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/modelInst.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/modelInst.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/packages.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/packages.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/packages2.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/packages2.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/packEnvTest/polymorphic_pack.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/packEnvTest/polymorphic_pack.lus -o /tmp/xx.ec ec2c /tmp/xx.ec syntax errors... syntax error - at line 6 ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -ec should_work/to_sort_out/asservi.lus -o /tmp/xx.ec +====> ../objlinux/lus2lic --nonreg-test -ec should_work/to_sort_out/asservi.lus -o /tmp/xx.ec ec2c /tmp/xx.ec -syntax errors... -syntax error - at line 19 diff --git a/src/test/test_lv4.res.exp b/_tests/test_lv4.res.exp similarity index 73% rename from src/test/test_lv4.res.exp rename to _tests/test_lv4.res.exp index 1e5f5f923368dad0671ff54038c4713a72d86682..6d7b4e66b7a93d7daf28ab1ebb0f9a1b782c8180 100644 --- a/src/test/test_lv4.res.exp +++ b/_tests/test_lv4.res.exp @@ -1,28 +1,28 @@ ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/COUNTER.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/COUNTER.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus COUNTER__COUNTER --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/CURRENT.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/CURRENT.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus CURRENT__CURRENT --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/EDGE.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/EDGE.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus EDGE__EDGE --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/FALLING_EDGE.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/FALLING_EDGE.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus FALLING_EDGE__EDGE --Pollux Version 2.3a lus2ec /tmp/xx.lus FALLING_EDGE__FALLING_EDGE --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/Int.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/Int.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus Int8__fulladd --Pollux Version 2.3a lus2ec /tmp/xx.lus Int8__incr @@ -33,49 +33,49 @@ lus2ec /tmp/xx.lus mainPack__Nat --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/PCOND.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/PCOND.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus PCOND__PCOND --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/PCOND1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/PCOND1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus PCOND1__PCOND1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/SOURIS.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/SOURIS.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus SOURIS__SOURIS --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/STABLE.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/STABLE.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus STABLE__STABLE --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/SWITCH.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/SWITCH.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus SWITCH__SWITCH --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/SWITCH1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/SWITCH1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus SWITCH1__SWITCH1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/TIME_STABLE.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/TIME_STABLE.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus TIME_STABLE__STABLE --Pollux Version 2.3a lus2ec /tmp/xx.lus TIME_STABLE__TIME_STABLE --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/TIME_STABLE1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/TIME_STABLE1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus TIME_STABLE1__TIME1_STABLE1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/Watch.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/Watch.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus Watch__TWO_STATES --Pollux Version 2.3a lus2ec /tmp/xx.lus Watch__DIVIDE @@ -98,47 +98,47 @@ lus2ec /tmp/xx.lus Watch__MORE_RECENT --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/X.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/X.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus X__X --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/X1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/X1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus X1__X1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/X2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/X2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus X2__X2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/X3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/X3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus X3__X3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/X6.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/X6.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus X6__X6 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/_N_uu.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/_N_uu.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus _N_uu___N_uu --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/activation_ec.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/activation_ec.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus activation_ec__activation_ec --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/after.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/after.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus after__after --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/alarme.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/alarme.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus alarme__edge --Pollux Version 2.3a lus2ec /tmp/xx.lus alarme__bascule @@ -149,7 +149,7 @@ lus2ec /tmp/xx.lus alarme__alarme --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/arbitre.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/arbitre.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus arbitre__my_switch --Pollux Version 2.3a lus2ec /tmp/xx.lus arbitre__process @@ -160,73 +160,73 @@ lus2ec /tmp/xx.lus arbitre__arbitre --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/argos.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/argos.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus argos__argos --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/assertion.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/assertion.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus assertion__assertion --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/aux.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/aux.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus aux__aux --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/aux1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/aux1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus aux1__aux1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/bascule.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/bascule.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus bascule__bascule --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/call.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/call.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call__n --Pollux Version 2.3a lus2ec /tmp/xx.lus call__call --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ck2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ck2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ck2__ck2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ck3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ck3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ck3__ck3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ck4.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ck4.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ck4__ck4 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ck5.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ck5.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ck5__edge --Pollux Version 2.3a lus2ec /tmp/xx.lus ck5__ck5 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ck6.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ck6.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ck6__N --Pollux Version 2.3a lus2ec /tmp/xx.lus ck6__ck6 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ck7.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ck7.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ck7__ck7 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/clock.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/clock.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock__clock --Pollux Version 2.3a syntax error detected while reading `when` (token 32) line 6 in main file xx.lus @@ -234,7 +234,7 @@ lus2ec /tmp/xx.lus clock__clock 1 PolluxErrors found ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/cminus.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/cminus.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus cminus__TWO_STATES --Pollux Version 2.3a lus2ec /tmp/xx.lus cminus__TWO_BUTTONS @@ -243,200 +243,201 @@ lus2ec /tmp/xx.lus cminus__cminus --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/compteur.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/compteur.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus compteur__compteur --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/count.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/count.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus count__count --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/cpt.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/cpt.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus cpt__cpt --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/cst.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/cst.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus cst__cst --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/deconne.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/deconne.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus deconne__deconne --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/dep.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/dep.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus dep__dep --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/dependeur.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/dependeur.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus dependeur__dependeur --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/dependeur_struct.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/dependeur_struct.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus dependeur_struct__dependeur_struct --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/drapfab.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/drapfab.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus drapfab__drapfab --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/enum.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/enum.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus enum__boo --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/enum0.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/enum0.lus -o /tmp/xx.lus ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/eq1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/eq1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus eq1__eq1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/ex.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/ex.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ex__ex --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/exclusion.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/exclusion.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus exclusion__exclusion --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/fby.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/fby.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus fby__followed_by --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/flo.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/flo.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus flo__SWITCH --Pollux Version 2.3a lus2ec /tmp/xx.lus flo__flo --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/fresh_name.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/fresh_name.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus fresh_name__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus fresh_name__fn --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/hanane.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/hanane.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus hanane__hanane --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/impl_priority.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/impl_priority.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus impl_priority__test_impl_prio --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/import1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/import1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus import1__import1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/initial.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/initial.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus initial__initial --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/integrator.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/integrator.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus integrator__integrator --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/long_et_stupide_nom_de_noeud.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/long_et_stupide_nom_de_noeud.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus long_et_stupide_nom_de_noeud__long_et_stupide_nom_de_noeud --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/merge.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/merge.lus -o /tmp/xx.lus *** Error in file "merge.lus", line 7, col 15 to 17, token 'clk': *** syntax error +Error should_work/NONREG/merge.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax1__minmax1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax2__minmax --Pollux Version 2.3a lus2ec /tmp/xx.lus minmax2__minmax2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax3__minmax --Pollux Version 2.3a lus2ec /tmp/xx.lus minmax3__minmax3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax4.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax4.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax4__minmax --Pollux Version 2.3a lus2ec /tmp/xx.lus minmax4__minmax4 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax4_bis.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax4_bis.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax4_bis__minmax --Pollux Version 2.3a lus2ec /tmp/xx.lus minmax4_bis__minmax4_bis --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax5.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax5.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax5__minmax5 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax5_random.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax5_random.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax5_random__minmax5_random --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/minmax6.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/minmax6.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minmax6__minmax --Pollux Version 2.3a lus2ec /tmp/xx.lus minmax6__minmax6 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mm.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mm.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mm__mm --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mm1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mm1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mm1__mm1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mm22.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mm22.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mm22__mm22 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mm3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mm3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mm3__mm3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/model.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/model.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus u__egal --Pollux Version 2.3a lus2ec /tmp/xx.lus p___isEqualTo_ @@ -445,7 +446,7 @@ lus2ec /tmp/xx.lus p__est_egal --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/model2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/model2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus p2___isEqualTo_ --Pollux Version 2.3a lus2ec /tmp/xx.lus p2__est_egal @@ -458,45 +459,45 @@ lus2ec /tmp/xx.lus p__est_egal --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mouse.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mouse.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mouse__edge --Pollux Version 2.3a lus2ec /tmp/xx.lus mouse__mouse --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mouse1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mouse1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mouse1__mouse1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mouse2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mouse2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mouse2__edge --Pollux Version 2.3a lus2ec /tmp/xx.lus mouse2__mouse2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/mouse3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/mouse3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mouse3__mouse3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/multiclock.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/multiclock.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus multiclock__moyenne --Pollux Version 2.3a lus2ec /tmp/xx.lus multiclock__multiclock --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc1__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc1__nc1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc10.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc10.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc10__n4 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc10__n3 @@ -509,21 +510,21 @@ lus2ec /tmp/xx.lus nc10__nc10 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc2__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc2__nc2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc3__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc3__nc3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc4.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc4.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc4__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc4__n2 @@ -532,7 +533,7 @@ lus2ec /tmp/xx.lus nc4__nc4 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc5.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc5.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc5__n4 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc5__n3 @@ -545,7 +546,7 @@ lus2ec /tmp/xx.lus nc5__nc5 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc6.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc6.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc6__n4 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc6__n3 @@ -558,7 +559,7 @@ lus2ec /tmp/xx.lus nc6__nc6 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc7.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc7.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc7__n4 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc7__n3 @@ -571,7 +572,7 @@ lus2ec /tmp/xx.lus nc7__nc7 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc8.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc8.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc8__n4 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc8__n3 @@ -584,7 +585,7 @@ lus2ec /tmp/xx.lus nc8__nc8 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nc9.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nc9.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nc9__n4 --Pollux Version 2.3a lus2ec /tmp/xx.lus nc9__n3 @@ -597,14 +598,14 @@ lus2ec /tmp/xx.lus nc9__nc9 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/nested.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/nested.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus nested__incr --Pollux Version 2.3a lus2ec /tmp/xx.lus nested__toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/node_caller1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/node_caller1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus node_caller1__ex5 --Pollux Version 2.3a lus2ec /tmp/xx.lus node_caller1__ex4 @@ -619,24 +620,24 @@ lus2ec /tmp/xx.lus node_caller1__node_caller1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/o2l_feux_compl.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/o2l_feux_compl.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus o2l_feux_compl__o2l_feux_compl --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/packed_cst.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/packed_cst.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus cst__cst --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/param_node.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/param_node.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus toto_n_iplus_3 --Pollux Version 2.3a lus2ec /tmp/xx.lus param_node__toto_3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/param_node2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/param_node2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mk_tab_int_0_3 --Pollux Version 2.3a lus2ec /tmp/xx.lus param_node2__tab_int3 @@ -647,7 +648,7 @@ lus2ec /tmp/xx.lus param_node2__tab_bool4 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/param_node3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/param_node3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mk_tab_int_0_3 --Pollux Version 2.3a lus2ec /tmp/xx.lus titi_int @@ -656,7 +657,7 @@ lus2ec /tmp/xx.lus param_node3__xxx --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/param_node4.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/param_node4.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus param_node4__monplus --Pollux Version 2.3a lus2ec /tmp/xx.lus toto_n_monplus_3 @@ -665,19 +666,19 @@ lus2ec /tmp/xx.lus param_node4__toto_3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/param_struct.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/param_struct.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mk_tab__param_struct__toto_toto_3 --Pollux Version 2.3a lus2ec /tmp/xx.lus param_struct__tab_toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/patrick.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/patrick.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus patrick__patrick --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/poussoir.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/poussoir.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus poussoir__TWO_STATES --Pollux Version 2.3a lus2ec /tmp/xx.lus poussoir__ONE_BUTTON @@ -686,22 +687,22 @@ lus2ec /tmp/xx.lus poussoir__poussoir --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/rs.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/rs.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus rs__rs --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/s.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/s.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus s__s --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/simple.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/simple.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus simple__simple --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/sincos.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/sincos.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus sincos__integrator --Pollux Version 2.3a lus2ec /tmp/xx.lus sincos__sincos @@ -714,45 +715,45 @@ PolluxError 636 in Net::DeadlockNotify: Deadlock detected ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/speedcontrol.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/speedcontrol.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus speedcontrol__f --Pollux Version 2.3a lus2ec /tmp/xx.lus speedcontrol__speedcontrol --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/stopwatch.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/stopwatch.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus stopwatch__simple_stopwatch --Pollux Version 2.3a lus2ec /tmp/xx.lus stopwatch__stopwatch --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/testCA.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/testCA.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus testCA__testCA --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/test_clash.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/test_clash.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus test__tutu --Pollux Version 2.3a lus2ec /tmp/xx.lus test__toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/test_const.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/test_const.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus test_const__TDF_sans_PACQ --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/test_node_expand.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/test_node_expand.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus test_node_expand__n --Pollux Version 2.3a lus2ec /tmp/xx.lus test_node_expand__test --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/test_node_expand2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/test_node_expand2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus test_node_expand2__f --Pollux Version 2.3a lus2ec /tmp/xx.lus test_node_expand2__n @@ -761,39 +762,39 @@ lus2ec /tmp/xx.lus test_node_expand2__test --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/trivial.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/trivial.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus trivial__edge --Pollux Version 2.3a lus2ec /tmp/xx.lus trivial__trivial --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/trivial2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/trivial2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus trivial2__edge --Pollux Version 2.3a lus2ec /tmp/xx.lus trivial2__trivial2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/tuple.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/tuple.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus tuple__toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/type_decl.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/type_decl.lus -o /tmp/xx.lus ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/uu.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/uu.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus uu__uu --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/NONREG/v1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/NONREG/v1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus v1__v1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/access.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/access.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus quick_access_real_1_m0d314ep1 --Pollux Version 2.3a lus2ec /tmp/xx.lus quick_access_real_2_m0d314ep1 @@ -816,7 +817,7 @@ lus2ec /tmp/xx.lus access__quick_access_int8 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/consensus.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/consensus.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus consensus_1 --Pollux Version 2.3a lus2ec /tmp/xx.lus consensus_2 @@ -845,7 +846,7 @@ lus2ec /tmp/xx.lus consensus__c8 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/consensus2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/consensus2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus consensus_1 --Pollux Version 2.3a lus2ec /tmp/xx.lus consensus_2 @@ -866,19 +867,19 @@ lus2ec /tmp/xx.lus consensus2__main --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/fby.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/fby.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus fby__rising_edge_bis --Pollux Version 2.3a lus2ec /tmp/xx.lus fby__rising_edge --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/func_with_body.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/func_with_body.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus func_with_body__trivial --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/heater_control.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/heater_control.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus heater_control__not_a_sauna2 --Pollux Version 2.3a lus2ec /tmp/xx.lus heater_control__min2 @@ -903,12 +904,12 @@ lus2ec /tmp/xx.lus heater_control__not_a_sauna --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/left.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/left.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus left__toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/newpacks.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/newpacks.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus preal__fby1 --Pollux Version 2.3a lus2ec /tmp/xx.lus pbool__fby1 @@ -921,7 +922,7 @@ lus2ec /tmp/xx.lus mainPack__preced --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/onlyroll.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/onlyroll.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus onlyroll__noneof --Pollux Version 2.3a lus2ec /tmp/xx.lus onlyroll__oneoffour @@ -972,7 +973,7 @@ lus2ec /tmp/xx.lus onlyroll__InHardoverRange --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/p.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/p.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus preal__fby1 --Pollux Version 2.3a lus2ec /tmp/xx.lus pbool__fby1 @@ -985,7 +986,7 @@ lus2ec /tmp/xx.lus mainPack__preced --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/packs.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/packs.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus preal__fby1 --Pollux Version 2.3a lus2ec /tmp/xx.lus pbool__fby1 @@ -998,28 +999,29 @@ lus2ec /tmp/xx.lus mainPack__preced --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/pfs.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/pfs.lus -o /tmp/xx.lus *** Error in file "pfs.lus", line 43, col 22 to 22, token '[': *** syntax error +Error should_work/Pascal/pfs.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/struct.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/struct.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus struct__plus --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/struct0.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/struct0.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus struct0__bibi --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/t.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/t.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus t__toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/t0.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/t0.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus min_n_1 --Pollux Version 2.3a lus2ec /tmp/xx.lus t0__min @@ -1036,7 +1038,7 @@ lus2ec /tmp/xx.lus t0__t0 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/t1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/t1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus consensus_1 --Pollux Version 2.3a lus2ec /tmp/xx.lus consensus_2 @@ -1049,7 +1051,7 @@ lus2ec /tmp/xx.lus t1__consensus4 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/t2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/t2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus fold_left_bool_bool_1_and --Pollux Version 2.3a lus2ec /tmp/xx.lus fold_left_bool_bool_2_and @@ -1070,27 +1072,27 @@ lus2ec /tmp/xx.lus t2__consensus_6_bis --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/test.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/test.lus -o /tmp/xx.lus ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/Pascal/trivial.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/Pascal/trivial.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus trivial__trivial --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/bad_call02.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/bad_call02.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus bad_call02__bad_call02 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call01.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call01.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call01__toto --Pollux Version 2.3a lus2ec /tmp/xx.lus call01__call01 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call02.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call02.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call02__toto --Pollux Version 2.3a lus2ec /tmp/xx.lus call02__titi @@ -1099,14 +1101,14 @@ lus2ec /tmp/xx.lus call02__call02 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call03.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call03.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call03__tutu --Pollux Version 2.3a lus2ec /tmp/xx.lus call03__call03 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call04.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call04.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call04__toto --Pollux Version 2.3a lus2ec /tmp/xx.lus call04__titi @@ -1117,22 +1119,22 @@ lus2ec /tmp/xx.lus call04__call04 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call05.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call05.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call05__call05 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call06.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call06.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call06__call06 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/call/call07.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/call/call07.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus call07__call07 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/clock.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/clock.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock__clock --Pollux Version 2.3a syntax error detected while reading `when` (token 32) line 11 in main file xx.lus @@ -1140,25 +1142,27 @@ lus2ec /tmp/xx.lus clock__clock 1 PolluxErrors found ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/clock2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/clock2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock2__clock --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/clock_ite.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/clock_ite.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock_ite__clock --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/when_enum.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/when_enum.lus -o /tmp/xx.lus Error. *** Cannot generate V4 style Lustre for programs with enumerated clocks (yet), sorry. +Error should_work/clock/when_enum.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/when_node.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/when_node.lus -o /tmp/xx.lus Error. *** Cannot generate V4 style Lustre for programs with enumerated clocks (yet), sorry. +Error should_work/clock/when_node.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/when_not.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/when_not.lus -o /tmp/xx.lus *** Error in file "when_not.lus", line 7, col 12 to 17, token 'clock4': *** *** clock error: The two following clocks are not unifiable: @@ -1166,16 +1170,17 @@ Error. *** Cannot generate V4 style Lustre for programs with enumerated clocks ( *** on clock4_u on base +Error should_work/clock/when_not.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/clock/when_tuple.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/clock/when_tuple.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus when_tuple__titi --Pollux Version 2.3a lus2ec /tmp/xx.lus when_tuple__clock --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/Gyroscope2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/Gyroscope2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus Gyroscope2__abs --Pollux Version 2.3a lus2ec /tmp/xx.lus Gyroscope2__ValueIsSecureII @@ -1232,7 +1237,7 @@ lus2ec /tmp/xx.lus Gyroscope2__guaranteeVoter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/alias.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/alias.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus alias__aliasIterOp --Pollux Version 2.3a lus2ec /tmp/xx.lus alias__aliasBoolRed @@ -1247,17 +1252,17 @@ lus2ec /tmp/xx.lus alias__alias --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/bred.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/bred.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus bred__bred --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/bred_lv4.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/bred_lv4.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus bred_lv4__bred --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/clock.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/clock.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock__clock --Pollux Version 2.3a syntax error detected while reading `when` (token 32) line 6 in main file xx.lus @@ -1265,7 +1270,7 @@ lus2ec /tmp/xx.lus clock__clock 1 PolluxErrors found ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/clock1_2ms.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/clock1_2ms.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock1_2ms__Clock1ms_node --Pollux Version 2.3a lus2ec /tmp/xx.lus clock1_2ms__Clock2ms_node @@ -1274,10 +1279,10 @@ lus2ec /tmp/xx.lus clock1_2ms__clock1_2ms --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/decl.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/decl.lus -o /tmp/xx.lus ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/declaration.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/declaration.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus declaration__declaration --Pollux Version 2.3a lus2ec /tmp/xx.lus declaration__n4 @@ -1286,12 +1291,12 @@ lus2ec /tmp/xx.lus declaration__n5 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/def.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/def.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus def__def --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/filliter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/filliter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus filliter__copie --Pollux Version 2.3a lus2ec /tmp/xx.lus filliter__incr_acc @@ -1300,12 +1305,12 @@ lus2ec /tmp/xx.lus filliter__filliter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/filter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/filter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus filter__filter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/lustre_test1_ok.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/lustre_test1_ok.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus lustre_test1_ok__rising --Pollux Version 2.3a lus2ec /tmp/xx.lus lustre_test1_ok__TransFnc_1 @@ -1319,62 +1324,62 @@ PolluxError 997 in Op::NewClock: (case 1) Invalid clock combination in equation of zoh2 in node lustre_test1_ok__lustre_test1_ok ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/map_red_iter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/map_red_iter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus map_red_iter__traite_genCore_itere --Pollux Version 2.3a lus2ec /tmp/xx.lus map_red_iter__map_red_iter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/mapdeRed.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/mapdeRed.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mapdeRed__incr --Pollux Version 2.3a lus2ec /tmp/xx.lus mapdeRed__mapdeRed --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/mapinf.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/mapinf.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mapinf__mapinf --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/mapiter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/mapiter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mapiter__incr_tab --Pollux Version 2.3a lus2ec /tmp/xx.lus mapiter__mapiter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/mappredef.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/mappredef.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mappredef__mappredef --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/plus.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/plus.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus plus__plus --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/pre_x.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/pre_x.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus pre_x__pre_x --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/rediter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/rediter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus rediter__max --Pollux Version 2.3a lus2ec /tmp/xx.lus rediter__rediter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/redoptest.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/redoptest.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus redoptest__max --Pollux Version 2.3a lus2ec /tmp/xx.lus redoptest__redoptest --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/demo/sample_time_change.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/demo/sample_time_change.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus sample_time_change__make_cl1_4_2 --Pollux Version 2.3a lus2ec /tmp/xx.lus sample_time_change__make_cl1_12_3 @@ -1385,17 +1390,17 @@ lus2ec /tmp/xx.lus sample_time_change__MainNode --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/bob.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/bob.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus bob__bob --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/def.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/def.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus def__def --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/ex.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/ex.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus ex__id --Pollux Version 2.3a lus2ec /tmp/xx.lus ex__trueNode @@ -1404,7 +1409,7 @@ lus2ec /tmp/xx.lus ex__ex --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/iter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/iter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus iter__filled --Pollux Version 2.3a lus2ec /tmp/xx.lus iter__mapped @@ -1417,7 +1422,7 @@ lus2ec /tmp/xx.lus iter__plus --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/iterate.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/iterate.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus iterate__mapped --Pollux Version 2.3a lus2ec /tmp/xx.lus iterate__redduced @@ -1430,7 +1435,7 @@ lus2ec /tmp/xx.lus iterate__iterate --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/lecteur.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/lecteur.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus lecteur__Propriete --Pollux Version 2.3a lus2ec /tmp/xx.lus lecteur__Controleur @@ -1441,7 +1446,7 @@ lus2ec /tmp/xx.lus lecteur__lecteur --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/lucky.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/lucky.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus lucky__implies --Pollux Version 2.3a lus2ec /tmp/xx.lus lucky__after @@ -1456,7 +1461,7 @@ lus2ec /tmp/xx.lus lucky__lucky --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/morel.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/morel.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus morel__mcmorel --Pollux Version 2.3a lus2ec /tmp/xx.lus morel__tab @@ -1465,14 +1470,14 @@ lus2ec /tmp/xx.lus morel__morel --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/morel2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/morel2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus morel2__mcmorel --Pollux Version 2.3a lus2ec /tmp/xx.lus morel2__morel2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/morel3.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/morel3.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus morel3__mcmorel --Pollux Version 2.3a lus2ec /tmp/xx.lus morel3__tab @@ -1481,7 +1486,7 @@ lus2ec /tmp/xx.lus morel3__morel3 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/morel4.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/morel4.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus morel4__mcmorel --Pollux Version 2.3a lus2ec /tmp/xx.lus morel4__tab @@ -1490,7 +1495,7 @@ lus2ec /tmp/xx.lus morel4__morel4 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/morel5.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/morel5.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus morel5__tab --Pollux Version 2.3a lus2ec /tmp/xx.lus morel5__morel5 @@ -1499,17 +1504,17 @@ lus2ec /tmp/xx.lus morel5__mcmorel --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/noAlarm.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/noAlarm.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus noAlarm__noAlarm --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/notTwo.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/notTwo.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus notTwo__notTwo --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/onlyroll.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/onlyroll.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus onlyroll__noneof --Pollux Version 2.3a lus2ec /tmp/xx.lus onlyroll__oneoffour @@ -1560,7 +1565,7 @@ lus2ec /tmp/xx.lus onlyroll__InHardoverRange --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/onlyroll2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/onlyroll2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus onlyroll2__noneof --Pollux Version 2.3a lus2ec /tmp/xx.lus onlyroll2__oneoffour @@ -1611,7 +1616,7 @@ lus2ec /tmp/xx.lus onlyroll2__InHardoverRange --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/test.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/test.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus test__three_outputs --Pollux Version 2.3a lus2ec /tmp/xx.lus test__two_outputs @@ -1620,12 +1625,12 @@ lus2ec /tmp/xx.lus test__test --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/titi.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/titi.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus titi__titi --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/toolate.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/toolate.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus toolate__bidon --Pollux Version 2.3a lus2ec /tmp/xx.lus toolate__edge_detect @@ -1642,12 +1647,12 @@ lus2ec /tmp/xx.lus toolate__toolate --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/fab_test/toto.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/fab_test/toto.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus toto__toto --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/FillFollowedByRed.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/FillFollowedByRed.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus FillFollowedByRed__reduced --Pollux Version 2.3a lus2ec /tmp/xx.lus FillFollowedByRed__filled @@ -1656,7 +1661,7 @@ lus2ec /tmp/xx.lus FillFollowedByRed__FillFollowedByRed --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/Gyroscope.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/Gyroscope.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus Gyroscope__abs --Pollux Version 2.3a lus2ec /tmp/xx.lus Gyroscope__ValueIsSecureII @@ -1707,7 +1712,7 @@ lus2ec /tmp/xx.lus Gyroscope__guaranteeVoter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/ProduitBool/produitBool.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/ProduitBool/produitBool.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus produitBool__iterated_isElementOf_ --Pollux Version 2.3a lus2ec /tmp/xx.lus produitBool___isElementOf_ @@ -1726,7 +1731,7 @@ lus2ec /tmp/xx.lus produitBool__PLC --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/ProduitBool/shiftFill_ludic.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/ProduitBool/shiftFill_ludic.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus shiftFill_ludic__n_selectOneStage --Pollux Version 2.3a lus2ec /tmp/xx.lus shiftFill_ludic__n_selectElementOfRank_inArray_ @@ -1735,7 +1740,7 @@ lus2ec /tmp/xx.lus shiftFill_ludic__n_shiftFill --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/ProduitBool/shift_ludic.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/ProduitBool/shift_ludic.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus shift_ludic__n_selectOneStage --Pollux Version 2.3a lus2ec /tmp/xx.lus shift_ludic__n_selectElementOfRank_inArray_ @@ -1746,7 +1751,7 @@ lus2ec /tmp/xx.lus shift_ludic__n_shift --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/arrays.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/arrays.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus arrays__incr --Pollux Version 2.3a lus2ec /tmp/xx.lus arrays__big_sum @@ -1767,13 +1772,14 @@ lus2ec /tmp/xx.lus arrays__add_byte --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/bug.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/bug.lus -o /tmp/xx.lus *** Error in file "bug.lus", line 2, col 6 to 10, token 'pack1': *** unknown package +Error should_work/lionel/bug.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/calculs_max.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/calculs_max.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus calculs_max__max --Pollux Version 2.3a lus2ec /tmp/xx.lus calculs_max__fill_bool @@ -1782,7 +1788,7 @@ lus2ec /tmp/xx.lus calculs_max__calculs_max --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/clock.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/clock.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus clock__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus clock__system @@ -1794,7 +1800,7 @@ lus2ec /tmp/xx.lus clock__n2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/deSimone.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/deSimone.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus deSimone__oneCell --Pollux Version 2.3a lus2ec /tmp/xx.lus deSimone__prop1_iter @@ -1805,14 +1811,14 @@ lus2ec /tmp/xx.lus deSimone__prop1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/iterFibo.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/iterFibo.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus iterFibo__fibo --Pollux Version 2.3a lus2ec /tmp/xx.lus iterFibo__iterFibo --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/mapiter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/mapiter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus mapiter__incr --Pollux Version 2.3a lus2ec /tmp/xx.lus mapiter__bitalt @@ -1833,33 +1839,33 @@ lus2ec /tmp/xx.lus mapiter__mapiter --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/matrice.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/matrice.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus matrice__fibo --Pollux Version 2.3a lus2ec /tmp/xx.lus matrice__matrice --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/matrice2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/matrice2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus matrice2__matrice2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/minus.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/minus.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus minus__bitalt --Pollux Version 2.3a lus2ec /tmp/xx.lus minus__minus --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/moyenne.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/moyenne.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus moyenne__moyenne_step --Pollux Version 2.3a lus2ec /tmp/xx.lus moyenne__moyenne --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/normal.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/normal.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus normal__int2InfoChgIndiv --Pollux Version 2.3a lus2ec /tmp/xx.lus normal__extract_tab_info_chg_indiv @@ -1916,14 +1922,14 @@ lus2ec /tmp/xx.lus normal__traite_gen_bis --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/pack1.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/pack1.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus pack1__n1 --Pollux Version 2.3a lus2ec /tmp/xx.lus pack1__n2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/pilote-1.0.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/pilote-1.0.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus pilote__ctrl --Pollux Version 2.3a lus2ec /tmp/xx.lus pilote__udpateCntElt @@ -1968,14 +1974,14 @@ lus2ec /tmp/xx.lus pilote__system --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/pipeline.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/pipeline.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus pipeline__oneStep_pipe --Pollux Version 2.3a lus2ec /tmp/xx.lus pipeline__pipeline --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/predefOp.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/predefOp.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus predefOp__incr --Pollux Version 2.3a lus2ec /tmp/xx.lus predefOp__bitalt @@ -2000,14 +2006,14 @@ lus2ec /tmp/xx.lus predefOp__predefOp --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/redIf.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/redIf.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus redIf__monIf --Pollux Version 2.3a lus2ec /tmp/xx.lus redIf__redIf --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/remplissage-1.0.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/remplissage-1.0.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus util__change_elt2 --Pollux Version 2.3a lus2ec /tmp/xx.lus util__change_tab2 @@ -2032,12 +2038,12 @@ lus2ec /tmp/xx.lus util__observer --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/simpleRed.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/simpleRed.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus simpleRed__simpleRed --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/testSilus.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/testSilus.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus testSilus__int2InfoChgIndiv --Pollux Version 2.3a lus2ec /tmp/xx.lus testSilus__extract_tab_info_chg_indiv @@ -2086,7 +2092,7 @@ lus2ec /tmp/xx.lus testSilus__testSilus --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/lionel/triSel.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/lionel/triSel.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus triSel__minFromRank --Pollux Version 2.3a lus2ec /tmp/xx.lus triSel__select @@ -2103,7 +2109,7 @@ lus2ec /tmp/xx.lus triSel__Sorted --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/Condact.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/Condact.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus Util__carre --Pollux Version 2.3a lus2ec /tmp/xx.lus TestCondact__n @@ -2114,19 +2120,19 @@ lus2ec /tmp/xx.lus Main__Condact --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/complex.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/complex.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus complex__re --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus contractForElementSelectionInArray__selectOneStage --Pollux Version 2.3a lus2ec /tmp/xx.lus contractForElementSelectionInArray__selectEltInArray --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/main.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/main.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus util__igt --Pollux Version 2.3a lus2ec /tmp/xx.lus intArray___isGreaterThan_ @@ -2177,18 +2183,19 @@ lus2ec /tmp/xx.lus main__main --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/noeudsIndependants.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus noeudsIndependants__equals --Pollux Version 2.3a lus2ec /tmp/xx.lus noeudsIndependants__gt --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus -o /tmp/xx.lus Error. No package has been provided +Error should_work/packEnvTest/contractForElementSelectionInArray/packageTableau.lus: no /tmp/xx.lus file ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/tri.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/contractForElementSelectionInArray/tri.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus tri__minFromRank --Pollux Version 2.3a lus2ec /tmp/xx.lus tri__select @@ -2205,7 +2212,7 @@ lus2ec /tmp/xx.lus tri__Sorted --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/iter.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/iter.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus p__n --Pollux Version 2.3a lus2ec /tmp/xx.lus p__map2 @@ -2214,12 +2221,12 @@ lus2ec /tmp/xx.lus main__main --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/model.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/model.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus pint__fby1 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/modelInst.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/modelInst.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus Pint__n --Pollux Version 2.3a lus2ec /tmp/xx.lus Preal__n @@ -2230,7 +2237,7 @@ lus2ec /tmp/xx.lus main__main --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/packages.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/packages.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus preal__fby1 --Pollux Version 2.3a lus2ec /tmp/xx.lus pbool__fby1 @@ -2243,7 +2250,7 @@ lus2ec /tmp/xx.lus mainPack__preced --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/packages2.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/packages2.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus preal__fby1 --Pollux Version 2.3a lus2ec /tmp/xx.lus pbool__fby1 @@ -2256,14 +2263,14 @@ lus2ec /tmp/xx.lus main__foo --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/packEnvTest/polymorphic_pack.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/packEnvTest/polymorphic_pack.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus p__n --Pollux Version 2.3a lus2ec /tmp/xx.lus p__map2 --Pollux Version 2.3a ---------------------------------------------------------------------- -====> ../lus2lic --nonreg-test -lv4 should_work/to_sort_out/asservi.lus -o /tmp/xx.lus +====> ../objlinux/lus2lic --nonreg-test -lv4 should_work/to_sort_out/asservi.lus -o /tmp/xx.lus lus2ec /tmp/xx.lus asservi__D --Pollux Version 2.3a lus2ec /tmp/xx.lus asservi__I diff --git a/alire b/alire new file mode 100644 index 0000000000000000000000000000000000000000..648a0c2e903b00dc1a67db97ddfeb0255f4cedee --- /dev/null +++ b/alire @@ -0,0 +1,4 @@ + +git clone file:///usr/local/src/lustre/repos/lus2lic.git lus2lic + + diff --git a/condact.lus b/condact.lus new file mode 100644 index 0000000000000000000000000000000000000000..661886aeb3bd71090b360af1eee861436055c475 --- /dev/null +++ b/condact.lus @@ -0,0 +1,12 @@ + +node toto(a,b: int) returns (x,y,z: int); +let + x = a + b; + y = 0 fby y + 1; + z = x fby z + a; +tel + +node titi(c: bool; a,b:int) returns (x,y,z: int); +let + (x, y, z) = condact<<toto, (11, 42, 12)>>(c, a, b); +tel diff --git a/condact2.lus b/condact2.lus new file mode 100644 index 0000000000000000000000000000000000000000..84d176b0c0ea7841eec3b3ac2bf5a37e8e28cbff --- /dev/null +++ b/condact2.lus @@ -0,0 +1,6 @@ + + +node truc(c,x,y : int) returns (o: int); +let + o = condact<<+, 0>>(c,x,y); +tel diff --git a/lazy.notes.ml b/lazy.notes.ml new file mode 100644 index 0000000000000000000000000000000000000000..9b1f906542786ef6c792966cb27bd061cea43451 --- /dev/null +++ b/lazy.notes.ml @@ -0,0 +1,25 @@ + +#DBG: LazyCompiler.node_check_interface 'Lustre::map<<node oper = Lustre::or, const size = 42>>' +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'Lustre::map<<node oper = Lustre::or, const size = 42>>' NOT FOUND +#DBG: LazyCompiler.node_check 'Lustre::map<<node oper = Lustre::or, const size = 42>>' +#DBG: LazyCompiler.x_check 'in file "/home/raymond/git/lus2lic/test_static/predef01.lus", line 6, col 6 to 8, token 'map'' +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'Lustre::map<<node oper = Lustre::or, const size = 42>>' NOT FOUND +*** Can not find package 'Lustre' in the following packages: + + + +let x_check + (tab : ('x_key, 'x_eff Eff.check_flag) Hashtbl.t) + (find_x : SymbolTab.t -> Ident.t -> Lxm.t -> ('x_info Lxm.srcflagged) SymbolTab.elt) + (x_check_do : t -> 'x_key -> Lxm.t -> SymbolTab.t -> bool -> Ident.pack_name -> x_info srcflagged -> 'x_eff) + (lookup_x_eff : ('x_key, 'x_eff Eff.check_flag) Hashtbl.t -> 'x_key -> Lxm.t -> 'x_eff) + (pack_of_x_key : 'x_key -> string ) + (name_of_x_key : 'x_key -> string) + (this : t) + (x_key : 'x_key) + (lxm : Lxm.t) +: 'x_eff + + + +NodeStaticArgEff of (Ident.t * node_key) diff --git a/map.lus b/map.lus new file mode 100644 index 0000000000000000000000000000000000000000..2b5b772b34e0784c354b63e32101e53fdc160945 --- /dev/null +++ b/map.lus @@ -0,0 +1,18 @@ + +node myplus<<type t>>(x, y : t) returns (o : t); +let + o = x + y; +tel + +node titi<<type t>> = map<<myplus<<t>>,4>>; + +node toto(x,y: int^4) returns (o: int^4); +let + o = map<<+, 4>>(x,y); + (* o = titi<<int>>(x,y); *) +tel + +node tutu(x,y: real^4) returns (o: real^4); +let + o = titi<<real>>(x,y); +tel diff --git a/moretests/Makefile b/moretests/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..3bb12357d44b66bbc6000dd4a353c905456d2088 --- /dev/null +++ b/moretests/Makefile @@ -0,0 +1,135 @@ + +OBJDIR=../obj$(HOSTTYPE) + +LC0=$(OBJDIR)/lus2lic +LC=$(OBJDIR)/lus2lic -vl 2 +LC2=$(OBJDIR)/lus2lic + +NL="----------------------------------------------------------------------\\n" +filter_line=grep -v Opening\ file + +OK_LUS=$(shell find should_work -name "*.lus" -print | LC_ALL=C sort -n) + +KO_LUS=$(shell find should_fail -name "*.lus" -print | LC_ALL=C sort -n) + +ALL_LUS=$(OK_LUS) $(KO_LUS) + +LIC=$(shell find should_work -name "*.lic" -print | LC_ALL=C sort -n) + + +when: + for d in ${ALL_LUS}; do \ + ls $$d; \ + grep -n " when" $$d; \ + done +tgz: + tar cvfz lustre_non_reg_files.tgz should_work should_fail + + +lic: + /bin/echo "generate all possible lic files" + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC2) $$d -o $$d.lic " ;\ + $(LC2) $$d -o $$d.lic ;\ + done + +xxx: + /bin/echo "reentrant ?" + for d in ${LIC}; do \ + /bin/echo -e "\n$(NL)====> $(LC2) $$d " ;\ + $(LC2) $$d > /dev/null ;\ + done + + +begin: + /bin/echo "Non-regression tests" > test_ok.res + /bin/echo "Those tests are supposed to generate errors" > test_ko.res + + +unit: + $(LC0) -unit >> test_ok.res 2>&1 + +help: + $(LC0) -help >> test_ok.res 2>&1 + +version: + $(LC0) --version + +FILTER= grep -v "file was generated by" | grep -v " on " | grep -v "Opening file " + +do_not_exist: + $(LC) do_not_exist.lus | $(FILTER) >> test_ko.res 2>&1 || true + +test_lic: begin unit help version do_not_exist + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC) --nonreg-test $$d" >> test_ok.res; \ + $(LC) --nonreg-test $$d >> test_ok.res 2>&1 ;\ + done; \ + for d in ${KO_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC) --nonreg-test $$d" >> test_ko.res; \ + $(LC) --nonreg-test $$d >> test_ko.res 2>&1 ;\ + done; \ + rm -f test.res ; cat test_ok.res test_ko.res | $(FILTER) > test.res ;\ + diff -u test.res.exp test.res > test.diff || \ + (cat test.diff ; /bin/echo "cf test.diff"; exit 1) +utest_lic: + cp test.res test.res.exp + + +errors_nb: + /bin/echo -e "There were $(shell grep Error test_ok.res | wc -l) errors." + /bin/echo -e "There were $(shell grep Warning test_ok.res | wc -l) Warnings." + +errors:errors_nb + /bin/echo -e "There were $(shell grep Warning test_ok.res | wc -l) Warnings." + grep Warning test_ok.res || true + /bin/echo -e "There were $(shell grep Error test_ok.res | wc -l) errors." + grep "*** Error" test_ok.res + + + + + +test_ec: + rm -f test_ec.res + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC0) --nonreg-test -ec $$d -o /tmp/xx.ec" >> test_ec.res; \ + $(LC0) -ec --nonreg-test $$d -o /tmp/xx.ec >> test_ec.res 2>&1 ;\ + /bin/echo -e "ec2c /tmp/xx.ec" >> test_ec.res; \ + (ec2c /tmp/xx.ec >> test_ec.res 2>&1 && /bin/echo -n "ok ") || /bin/echo " KO ($$d)!";\ + done; \ + diff -u test_ec.res.exp test_ec.res > test_ec.diff || \ + (cat test_ec.diff ; /bin/echo "cf test_ec.diff"; exit 1) + + +utest_ec: + cp test_ec.res test_ec.res.exp + +test_lv4: + rm test_lv4.res || /bin/echo ""; + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC0) --nonreg-test -lv4 $$d -o /tmp/xx.lus" >> test_lv4.res; \ + $(LC0) --nonreg-test -lv4 $$d -o /tmp/xx.lus >> test_lv4.res 2>&1 ;\ + if [ ! -f /tmp/xx.lus ]; then echo "Error $$d: no /tmp/xx.lus file" >> test_lv4.res 2>&1; fi ;\ + for node in `lusinfo /tmp/xx.lus nodes`; do \ + /bin/echo -e "lus2ec /tmp/xx.lus $$node" >> test_lv4.res; \ + (lus2ec /tmp/xx.lus $$node >> \ + test_lv4.res 2>&1 && /bin/echo -n "ok ") \ + || /bin/echo " KO ($$d)!";\ + done; \ + done; \ + diff -u test_lv4.res.exp test_lv4.res > test_lv4.diff || \ + (cat test_lv4.diff ; /bin/echo "cf test_lv4.diff"; exit 1) + + +utest_lv4: + cp test_lv4.res test_lv4.res.exp + +test: test_lic test_ec test_lv4 +utest: utest_lic utest_ec utest_lv4 + + +clean: + for d in ${ALL_LUS}; do \ + rm $$d.lic; \ + done diff --git a/moretests/should_fail/misc/wrongmap.lus b/moretests/should_fail/misc/wrongmap.lus new file mode 100644 index 0000000000000000000000000000000000000000..c4dc3c2941d1bba5e34627ad9cb4c03f4347b945 --- /dev/null +++ b/moretests/should_fail/misc/wrongmap.lus @@ -0,0 +1,6 @@ + + +node overplus = map<<+,4>>; + +node do_bool(x,y: bool^4) returns (o: bool^4); +let o = overplus(x,y); tel diff --git a/moretests/should_work/aliases/alias.lus b/moretests/should_work/aliases/alias.lus new file mode 100644 index 0000000000000000000000000000000000000000..1fe4d82fba3d1c9b7350961a1f48e385f466ba1d --- /dev/null +++ b/moretests/should_work/aliases/alias.lus @@ -0,0 +1,22 @@ + + +const toto = 42; + +const huit = 9; -- gnark gnark + +type t = enum { Bleu, Blanc }; + +type a = int^toto; + +const c : t = Bleu; +const c2 : t; + +type t1 = bool^4^5; + +type bool_4 ; -- Ah ah !! +type bool_4a ; -- Ah ah !! +type bool_4b ; -- Ah ah !! + +type str = { foo: t^toto^huit; bar : t1 }; + + diff --git a/moretests/should_work/aliases/ex.lus b/moretests/should_work/aliases/ex.lus new file mode 100644 index 0000000000000000000000000000000000000000..6cd5764fc7c5f1810f97c561a64e7427d3ed182a --- /dev/null +++ b/moretests/should_work/aliases/ex.lus @@ -0,0 +1,10 @@ +type + t = int^1^2^3^4; + t1 = t^4; + t2 = {a: int; b: bool^11^22}; + s1 = {x:int; y:t}; + s = {x:t; y:s1}; +node ex(a: s) returns (b: int); +let + b = a.x[0][0][0][0] + a.y.y[0][0][0][0]; +tel diff --git a/moretests/test.res.exp b/moretests/test.res.exp new file mode 100644 index 0000000000000000000000000000000000000000..8136841aec96ba48e2f78fe536ba740999956687 --- /dev/null +++ b/moretests/test.res.exp @@ -0,0 +1,113 @@ +Non-regression tests +usage: lus2lic [options] <file> | lus2lic -help + +-n, -node <string> + Set the main node (all items are compiled if unset) +-o, --output-file <string> + Set the output file name +-knc, --keep-nested-calls + Keep nested calls. By default, only one node per equation is generated. +-ei, --expand-iterators + Expand array iterators (i.e., generate iterator-free code). +-ee, --expand-enums + Translate enums into integers. +-esa, --expand-structs-and-arrays + Expand structures and arrays using as many variables as necessary (automatically impose '-ei') +-en, --expand-nodes + Expand the main node (use the first node if no one is specified). +-den, --do_not-expand-nodes <string> + Do not expand node (useful in the expand mode only of course). +-lv4, --lustre-v4 + Use Lustre V4 syntax (automatically impose '-ei -ee -esa'). +-ec, --expanded-code + Generate ec (actually just an alias for '-en -lv4 --no-prefix'). +-np, --no-prefix + Do not prefix variable names by their module (beware: variable names may clash with this option). +-version, --version + Print the current version and exit +-v, --verbose + Set the verbose level to 1 +-vl <int> Set the verbose level +-more Show hidden options (for dev purposes) + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/aliases/alias.lus +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/aliases/alias.lus +type bool_4 = bool^4 (*abstract in the source*); +type bool_4_5 = bool_4^5 (*abstract in the source*); +type alias::a = int^42; +type alias::bool_4; +type alias::bool_4a; +type alias::bool_4b; +type alias::str = struct {foo : alias::t_42_9; bar : bool_4_5}; +type alias::t = enum {alias::Bleu, alias::Blanc}; +type alias::t1 = bool_4^5; +type alias::t_42 = alias::t^42 (*abstract in the source*); +type alias::t_42_9 = alias::t_42^9 (*abstract in the source*); +const alias::c2 : alias::t; +const alias::huit = 9; +const alias::toto = 42; + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_work/aliases/ex.lus +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'ex::ex' NOT FOUND +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'ex::ex' NOT FOUND +#DBG: LazyCompiler.node_check_do 'ex::ex' (in file "ex.lus", line 0, col 0 to 0, token 'compile all items') +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f (anynum * anynum) with (int * int) gives Unif with any(num) = int +#DBG: UnifyType.f (anynum * anynum) with (int * int) gives Unif with any(num) = int +-- ../objlinux/lus2lic -vl 2 --nonreg-test should_work/aliases/ex.lus +type bool_11 = bool^11 (*abstract in the source*); +type bool_11_22 = bool_11^22 (*abstract in the source*); +type int_1 = int^1 (*abstract in the source*); +type int_1_2 = int_1^2 (*abstract in the source*); +type int_1_2_3 = int_1_2^3 (*abstract in the source*); +type int_1_2_3_4 = int_1_2_3^4 (*abstract in the source*); +type ex::s = struct {x : int_1_2_3_4; y : ex::s1}; +type ex::s1 = struct {x : int; y : int_1_2_3_4}; +type ex::t = int_1_2_3^4; +type ex::t1 = int_1_2_3_4^4; +type ex::t2 = struct {a : int; b : bool_11_22}; +node ex::ex(a:ex::s) returns (b:int); +let + b = a.x[0][0][0][0] + a.y.y[0][0][0][0]; +tel +-- end of node ex::ex +Those tests are supposed to generate errors + +---------------------------------------------------------------------- +====> ../objlinux/lus2lic -vl 2 --nonreg-test should_fail/misc/wrongmap.lus +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'wrongmap::do_bool' NOT FOUND +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'wrongmap::do_bool' NOT FOUND +#DBG: LazyCompiler.node_check_do 'wrongmap::do_bool' (in file "wrongmap.lus", line 0, col 0 to 0, token 'compile all items') +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: UnifyType.f () with () gives Equal +#DBG: LazyCompiler.lookup_node_exp_eff: node key 'wrongmap::overplus' NOT FOUND +#DBG: LazyCompiler.node_check_do 'wrongmap::overplus' (in file "wrongmap.lus", line 6, col 9 to 16, token 'overplus') +#DBG: UnifyType.f () with () gives Equal +#DBG: GetEff.translate_val_exp CALL_n 'overplus gives type: anynum^4 * anynum^4 -> anynum^4 +#DBG: UnifyType.f (anynum^4 * anynum^4) with (bool^4 * bool^4) gives Ko +*** Error in file "wrongmap.lus", line 6, col 9 to 16, token 'overplus': +*** type error: +*** while unifing (anynum^4 * anynum^4) with (bool^4 * bool^4) +*** get 'bool' where 'int' or 'real' was expected + diff --git a/multipar.lus b/multipar.lus new file mode 100644 index 0000000000000000000000000000000000000000..4960985dced7e6d33907e9d67be6d549811e5a1d --- /dev/null +++ b/multipar.lus @@ -0,0 +1,27 @@ + +(* Verif des static args *) + +node bok(x:int)returns(y:int); +let + y = (x * (x + 1)) / 2; +tel + +node sil<< + node f(x:int)returns(y:int) +>>(x:int)returns(y:int); +let + y = x + f<<bok>>(x); +tel + +node lis<< + node g(x:int)returns(y:int) +>>(x:int)returns(y:int); +let + y = x * g(x); +tel + + +node gup(x: int) returns (y:int); +let + y = 2 * sil<< lis >>(x); +tel diff --git a/nodeparam.lus b/nodeparam.lus new file mode 100644 index 0000000000000000000000000000000000000000..4c4e6b8d7883066b4fc7322916b3469c8aa8b530 --- /dev/null +++ b/nodeparam.lus @@ -0,0 +1,14 @@ + + +node f<<node g(x,y: int) returns (z: int)>>(x,y: int) returns (z:int); +let + z = g(x,g(x,y)); +tel + +node g<<const k:int>>(x,y:int) returns (z:int); +let + z = x+y+k; +tel + + +node h = f<< g<<42>> >>; diff --git a/over2.lus b/over2.lus new file mode 100644 index 0000000000000000000000000000000000000000..c80faf870c9683c716ea0c5e4c19ab881d40cae6 --- /dev/null +++ b/over2.lus @@ -0,0 +1,28 @@ + + +--type zetype = int^4; + +(* +node overplus = map<<+,4>>; + +node overmat = map<<overplus, 7>> + +node toto(x,y: int^4^7) returns (o: int^4^7); +let o = overmat(x,y); tel + +node titi(x,y: int^4^7) returns (o: int^4^7); +let o = map<<overplus, 7>>(x,y); tel + +node tutu(x,y: real^4) returns (o: real^4); +let o = overplus(x,y); tel +*) + +node tata(x,y: int^13^22) returns (o: int^13^22); +let o = map<< + map<<+,13>>, + 22>>(x,y); tel + +(* +node bibi(x,y: int^55) returns (o: int^55); +let o = map<<+,55>>(x,y); tel +*) diff --git a/over3.lus b/over3.lus new file mode 100644 index 0000000000000000000000000000000000000000..7a4fe54cc8d0ffa1ed58bcafd8b16b7057f6418b --- /dev/null +++ b/over3.lus @@ -0,0 +1,7 @@ + +(* une macro user-defined surchargée *) + +node mypoly<<const n : int; type t; node f (i:t) returns (o:t)>>(x, y: t^n) returns (z: t^n); +let + z = map<<+, n>>(x,y); +tel diff --git a/overload.lus b/overload.lus new file mode 100644 index 0000000000000000000000000000000000000000..7d02f8730f8171c8c8a92e8ec523aec154bc7d04 --- /dev/null +++ b/overload.lus @@ -0,0 +1,11 @@ + + +type zetype = int^4; + +node overplus = map<<+,4>>; + +node do_int(x,y: int^4) returns (o: int^4); +let o = overplus(x,y); tel + +node do_real(x,y: real^4) returns (o: real^4); +let o = overplus(x,y); tel diff --git a/rundbg b/rundbg new file mode 100755 index 0000000000000000000000000000000000000000..34d3b94fff49e4b3b83fb78d264ff1da587edea5 --- /dev/null +++ b/rundbg @@ -0,0 +1,4 @@ +#!/bin/bash +make dc +OBJDIR=./obj$HOSTTYPE +readline-editor ocamldebug -I $OBJDIR $OBJDIR/lus2lic $* diff --git a/sargs.lus b/sargs.lus new file mode 100644 index 0000000000000000000000000000000000000000..6fc97bcb46e167a32fd12c27c8af8672ebcb2121 --- /dev/null +++ b/sargs.lus @@ -0,0 +1,13 @@ + +(* Verif des static args *) + + +node pluton<<const n:int>>(x: int) returns (y:int); +let + y = n + x; +tel + +node saturne(x: int) returns (y:int); +let + y = 2 * pluton<<42.0>>(x); +tel diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 3619d0f8c56c9204c559a8196a1146de1eec6036..0000000000000000000000000000000000000000 --- a/src/Makefile +++ /dev/null @@ -1,184 +0,0 @@ - -OCAMLMAKEFILE = ./OCamlMakefile -RESULT=lus2lic$(EXE) - -LIBS = str unix - -OCAMLC=ocamlc -OCAMLOPT=ocamlopt - -ifeq ($(HOSTTYPE),cross-win32) - OCAMLC=/usr/i586-mingw32msvc/bin/ocamlc - OCAMLOPT=/usr/i586-mingw32msvc/bin/ocamlopt - OCAMLDEP=/usr/i586-mingw32msvc/bin/ocamldep - OCAMLRUN=/usr/i586-mingw32msvc/bin/ocamlrun - OCAMLLIB = `/usr/i586-mingw32msvc/bin/ocamlc -where` -endif - - -ifeq ($(HOSTTYPE),cygwin) -CFLAGS=-mno-cygwin -endif - -#OCAMLNCFLAGS=-inline 100 -unsafe -noassert -ccopt -O9 - -ifndef SOURCES -SOURCES = \ - ./version.ml \ - ./verbose.mli \ - ./verbose.ml \ - ./filenameExtras.mli \ - ./filenameExtras.ml \ - ./global.ml \ - ./ident.mli \ - ./ident.ml \ - ./lxm.mli \ - ./lxm.ml \ - ./errors.ml \ - ./predef.ml \ - ./syntaxTreeCore.ml \ - ./syntaxTree.ml \ - ./solveIdent.mli \ - ./solveIdent.ml \ - ./parserUtils.ml \ - ./parser.mly \ - ./lexer.mll \ - ./syntaxTabUtils.mli \ - ./syntaxTabUtils.ml \ - ./instanciateModel.mli \ - ./instanciateModel.ml \ - ./symbolTab.mli \ - ./symbolTab.ml \ - ./eff.ml \ - ./name.mli \ - ./name.ml \ - ./polymorphism.ml \ - ./licDump.ml \ - ./unifyType.mli \ - ./unifyType.ml \ - ./unifyClock.mli \ - ./unifyClock.ml \ - ./syntaxTab.mli \ - ./syntaxTab.ml \ - ./predefEvalType.mli \ - ./predefEvalType.ml \ - ./predefEvalConst.mli \ - ./predefEvalConst.ml \ - ./predefEvalClock.mli \ - ./predefEvalClock.ml \ - ./evalConst.mli \ - ./evalConst.ml \ - ./evalType.mli \ - ./evalType.ml \ - ./evalClock.mli \ - ./evalClock.ml \ - ./structArrayExpand.mli \ - ./structArrayExpand.ml \ - ./uniqueOutput.mli \ - ./uniqueOutput.ml \ - ./split.mli \ - ./split.ml \ - ./inline.mli \ - ./inline.ml \ - ./getEff.mli \ - ./getEff.ml \ - ./nodesExpand.mli \ - ./nodesExpand.ml \ - ./lazyCompiler.ml \ - ./lazyCompiler.mli \ - ./compile.ml \ - ./main.ml -endif - -# Be sure to build those files before doing something else -# since they are needed by $(RESULT) -PRE_TARGETS=./version.ml - -MLONLY_SOURCES=$(filter %.ml %.mll %.mly, $(SOURCES)) - -all: - make bc - -############################################################################## -# searching for untested code -test/ocamlprof.dump: pbc -prof: test/ocamlprof.dump - make test || true - mkdir prof || rm prof/* - for d in ${SOURCES}; do \ - ocamlprof -F "ocamlprof: " -f test/ocamlprof.dump $$d > prof/$$d ;\ - done - -# Upsate the test coverage rate -coverage: - rm test/ocamlprof.dump || true - make clean - make prof - grep -n -e "(\* ocamlprof: 0 \*)" prof/*.ml | grep -v "assert false" > dead.grep - grep -n -e "(\* ocamlprof: " prof/*.ml | grep -v "assert false" > all.grep - DEAD_HITS=`wc -l dead.grep | cut -f 1 -d " "`;\ - ALL_HITS=`wc -l all.grep | cut -f 1 -d " "`;\ - SOL=`echo "scale=2 ; $$DEAD_HITS * 100 / $$ALL_HITS " | bc ` ;\ - echo "$$DEAD_HITS / $$ALL_HITS = $$SOL %" > untested_line_counter - make clean - cat untested_line_counter - -##############################################################################" - -# for using the debugger -debug: - mkdir -p mli - mv *.mli mli/ - make MLONLY=yes SOURCES="$(MLONLY_SOURCES)" dc || true - mv mli/*.mli . - - -include $(OCAMLMAKEFILE) - -# cf ../release-lv6/Makefile pour une install complete. -verimag: - cp lus2lic /usr/local/tools/lustre-v6/current/bin - cp lus2lic /home/jahier/lurette/i386-linux-gcc3/bin/ - -tags: - /local/jahier/jahier/bin/otags $(SOURCES) $(shell ocamlc -where)/*.mli - -.PHONY: test - -test: $(RESULT) - cd test; make test - -test_ec: $(RESULT) - cd test; make test_ec - -utest: $(RESULT) - cd test; make utest - -diff: - cd ..; make diff - -cia: - cd ..; make cia - -ci: - cd ..; make ci - -wc: - wc $(SOURCES) - - -dot2ps: - dot -Tps lus2lic.dot > lus2lic.dot.ps -# Specific rule (version) - -.PRECIOUS: version.ml - -version.ml: - echo "(* Automatically generated from src/Makefile *) " > version.ml - echo "let tool = \"lus2lic\"" >> version.ml - echo "let branch = \"$(shell utils/get_branch_name)\"" >> version.ml - echo "let commit = \"$(shell utils/get_commit_number)\"" >> version.ml - echo "let sha_1 = \"$(shell utils/get_sha_1)"\">> version.ml - echo "let str = (branch ^ \".\" ^ commit)">> version.ml - - diff --git a/src/builtIn.ml b/src/builtIn.ml new file mode 100644 index 0000000000000000000000000000000000000000..ef9e5b5b6400fff89f68f4c8720650ae62071025 --- /dev/null +++ b/src/builtIn.ml @@ -0,0 +1,199 @@ +open Eff +open Errors + +(* -- UTILES ---------------------------------------------------*) +(* Extract the node and the constant from a list of static args *) +let get_node_and_int_const + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: (Eff.node_key * int) = + match sargs with + | [ NodeStaticArgEff (_,nk); ConstStaticArgEff carg ] -> ( + let c = match carg with + | (_, Int_const_eff c) -> c + | (_, Abstract_const_eff(_,_,Int_const_eff c, true)) -> c + | (_, zcl) -> + let msg = "immediate integer expected, but get \"" + ^ (LicDump.string_of_const_eff zcl) + ^ "\"\n" + in raise (Compile_error(lxm, msg)) + in + (nk, c) + ) + | _ -> + let msg = "*** an integer and a node are expected.\n" in + raise (Compile_error(lxm, msg)) + +(* transforme en array une variable *) +let var_to_array (c:int) (vi: Eff.var_info) : Eff.var_info = +{ vi with var_type_eff = Array_type_eff(vi.var_type_eff,c) } + +(*** +MESSAGES D'ERREUR : +Pour rester homogène, utiliser les fonctions de PredefEvalType: + raise_type_error (provided: string) (expect: string) (msg: string) + raise_arity_error (msg:string) (provided:int) (expect:int) +*) +let raise_type_error = PredefEvalType.raise_type_error +let raise_arity_error = PredefEvalType.raise_arity_error +exception EvalType_error = PredefEvalType.EvalType_error + +(* +On a éventuellement besoin du node_exp des args +*) +let rec do_node + (nk2nd: Eff.node_key -> Eff.node_exp) + (nk: Eff.node_key) + (lxm: Lxm.t) +: (Eff.node_exp) = + let (pk,id) = fst nk in + match (pk, id) with + | ("Lustre", "map") -> do_map nk2nd nk lxm + | ("Lustre", "red") + | ("Lustre", "fill") + | ("Lustre", "fillred") -> do_fillred nk2nd nk lxm + | ("Lustre", "boolred") -> do_boolred nk2nd nk lxm + | ("Lustre", "condact") -> do_condact nk2nd nk lxm + | _ -> raise Not_found + +(*-------------------------------------------------------------------- +MAP +---------------------------------------------------------------------- + Given : + - A node n of type: a_1 * ... * a_n -> b_1 * ... * b_k + - A (int) const c +Gen a node of type : a_1^c * ... * a_n^c -> b_1^c * ... * b_k^c +--------------------------------------------------------------------*) +and do_map nk2nd nk lxm = + let sargs = snd nk in + let (np, c) = get_node_and_int_const lxm sargs in + let nd = nk2nd np in + let ins = nd.inlist_eff in + let outs = nd.outlist_eff in + { + node_key_eff = nk; + inlist_eff = List.map (var_to_array c) ins; + outlist_eff = List.map (var_to_array c) outs; + loclist_eff = None; + def_eff = BuiltInEff nk; + has_mem_eff = nd.has_mem_eff; + is_safe_eff = nd.is_safe_eff; + } +(*-------------------------------------------------------------------- +FILLRED +---------------------------------------------------------------------- + Given : + - A node : aa * a_1 * ... * a_n -> aa * b_1 * ... * b_k + - An int c +Gen a node : aa * a_1^c * ... * a_n^c -> aa * b_1^c * ... * b_k^c +--------------------------------------------------------------------*) +and do_fillred nk2nd nk lxm = + let sargs = snd nk in + let (np, c) = get_node_and_int_const lxm sargs in + let nd = nk2nd np in + let ins = nd.inlist_eff in + let outs = nd.outlist_eff in + let _ = assert (ins <> [] && outs <> []) in + let ins' = (List.hd ins)::(List.map (var_to_array c) (List.tl ins)) in + let outs' = (List.hd outs)::(List.map (var_to_array c) (List.tl outs)) in + (* pas d'unif : egalité et c'est tout ! *) + let t1 = (List.hd ins').var_type_eff in + let t2 = (List.hd outs').var_type_eff in + if t1 <> t2 then + let msg = Printf.sprintf + "node can't be used in iterator, first input type '%s' differs from first output type '%s'" + (LicDump.string_of_type_eff t1) + (LicDump.string_of_type_eff t2) + in + raise (Compile_error(lxm, msg)) + else + { + node_key_eff = nk; + inlist_eff = ins'; + outlist_eff = outs'; + loclist_eff = None; + def_eff = BuiltInEff nk; + has_mem_eff = nd.has_mem_eff; + is_safe_eff = nd.is_safe_eff; + } +(*-------------------------------------------------------------------- +CONDACT +---------------------------------------------------------------------- + Given : + - A node n of type: a_1 * ... * a_n -> b_1 * ... * b_k + - A (tuple) const: b_1 * ... * b_k +Gen a node of type : bool * a_1 * ... * a_n -> b_1 * ... * b_k +---------------------------------------------------------------------*) +and do_condact nk2nd nk lxm = +try + let sargs = snd nk in + let np, dflt = + match sargs with + | [NodeStaticArgEff(_,np) ; ConstStaticArgEff(_,dflt)] -> np, dflt + | _ -> assert false + in + (* recherche le profil de np ... *) + let ne = nk2nd np in + let inlist = ne.inlist_eff in + let outlist = ne.outlist_eff in + (* dflt_types doit êre compatiple avec outlist *) + let dflt_types = types_of_const dflt in + let out_types = List.map (fun x -> x.var_type_eff) outlist in + let matches = try + UnifyType.is_matched out_types dflt_types + with UnifyType.Match_failed msg -> + raise (Compile_error(lxm, "in condact default output "^msg)) + in + let out_types = Eff.apply_type_matches matches out_types in + let in_types = Eff.apply_type_matches matches + (Bool_type_eff::(List.map (fun x -> x.var_type_eff) inlist)) + in + (* ok pour les args statiques, le profil dynamique est : *) + let ins = Eff.create_var_list SyntaxTreeCore.VarInput in_types in + let outs = Eff.create_var_list SyntaxTreeCore.VarOutput out_types in + { + node_key_eff = nk; + inlist_eff = ins; + outlist_eff = outs; + loclist_eff = None; + def_eff = BuiltInEff nk; + has_mem_eff = ne.has_mem_eff; + is_safe_eff = ne.is_safe_eff; + } +with +| EvalType_error msg -> raise (Compile_error(lxm, "type error: "^msg)) + + + + +(*-------------------------------------------------------------------- +BOOLRED +---------------------------------------------------------------------- + Given + - 3 integer constant i, j, k + + returns the profile bool^k -> bool +---------------------------------------------------------------------*) +and do_boolred nk2nd nk lxm = + let sargs = snd nk in + let (i,j,k) = match sargs with + | [ + ConstStaticArgEff(_,Int_const_eff i); + ConstStaticArgEff(_,Int_const_eff j); + ConstStaticArgEff(_,Int_const_eff k) + ] -> i,j,k + | _ -> raise (Compile_error(lxm, "\n*** type error: 3 int were expected")) + in + let ins = Eff.create_var_list SyntaxTreeCore.VarInput [ Array_type_eff(Bool_type_eff,k) ] in + let outs = Eff.create_var_list SyntaxTreeCore.VarOutput [ Bool_type_eff ] in + { + node_key_eff = nk; + inlist_eff = ins; + outlist_eff = outs; + loclist_eff = None; + def_eff = BuiltInEff nk; + (* ???? *) + has_mem_eff = true; + is_safe_eff = true; + } + diff --git a/src/compile.ml b/src/compile.ml index 27557a1352ac9e3e060595e081f6492f1359a171..58a097d0794992207b93a56dbc87ce856373315b 100644 --- a/src/compile.ml +++ b/src/compile.ml @@ -28,25 +28,25 @@ let (doit : SyntaxTree.pack_or_model list -> Ident.idref option -> unit) = priorité dans l'ordre *) let lzcomp = LazyCompiler.create syntax_tab in - if Verbose.get_level () > 2 then SyntaxTab.dump syntax_tab; - Ident.set_dft_pack_name (first_pack_in srclist); - - match main_node with - | None -> LazyCompiler.compile_all lzcomp - | Some main_node -> - (* la clée "absolue" du main node (pas d'args statiques) *) - let main_node_key = - Eff.make_simple_node_key (Ident.long_of_idref main_node) - in - Verbose.printf - "-- MAIN NODE: \"%s\"\n" - (LicDump.string_of_node_key_rec main_node_key); - - if !Global.compile_all_items then - LazyCompiler.compile_all lzcomp - else - ignore(LazyCompiler.node_check lzcomp main_node_key - (match Ident.pack_of_idref main_node with - | None -> Lxm.dummy "" - | Some pn -> Lxm.dummy (Ident.pack_name_to_string pn))) - + Verbose.exe ~level:2 (fun () -> SyntaxTab.dump syntax_tab); + Ident.set_dft_pack_name (first_pack_in srclist); + + let zelic = match main_node with + | None -> LazyCompiler.compile_all lzcomp + | Some main_node -> + if !Global.compile_all_items then + LazyCompiler.compile_all lzcomp + else + LazyCompiler.compile_node lzcomp main_node + in + + (* élimination polymorphisme surcharge *) + let zelic = DoNoPoly.doit zelic in + + (* alias des types array *) + let zelic = DoAliasTypes.doit zelic in + + (* split des equations (1 eq = 1 op) *) + let zelic = DoSplit.doit zelic in + + LicPrg.to_file !Global.oc zelic diff --git a/src/doAliasTypes.ml b/src/doAliasTypes.ml new file mode 100644 index 0000000000000000000000000000000000000000..f68afb3b27157552aef26c0ea43045afcb9373fb --- /dev/null +++ b/src/doAliasTypes.ml @@ -0,0 +1,127 @@ + +(* +Source 2 source transformation : +- toutes les expressions de type sans NOM + (donc uniquement des tableaux immédiats ?) + sont traquées et remplacées par un alias +*) + +open Eff + + +let doit (inp : LicPrg.t) : LicPrg.t = + (* n.b. on fait un minumum d'effet de bord pour + pas avoir trop d'acummulateur ... *) + let atab = Hashtbl.create 10 in + let res = ref inp in + + (** UTILE : nommage des alias d'array *) + let array_ident ty sz = + let tid = Eff.ident_of_type ty in + let sfx = Printf.sprintf "%s_%d" (snd tid) sz in + let id = LicPrg.fresh_type_id !res (fst tid) sfx in + id + in + + (** UTILE : cherche/crée un alias de type *) + let rec alias_type te = + match te with + | Array_type_eff (ty, sz) -> ( + let ty = alias_type ty in + let te = Array_type_eff (ty, sz) in + try + let ref_te = Hashtbl.find atab te in +(* +Verbose.printf "--> alias_type %s = %s ^ %d FOUND : %s\n" +(LicDump.string_of_type_eff te) +(LicDump.string_of_type_eff ty) +sz +(LicDump.string_of_type_eff ref_te); +*) + ref_te + with Not_found -> ( + let id = array_ident ty sz in + let ref_te = Abstract_type_eff (id, te) in + res := LicPrg.add_type id ref_te !res; + Hashtbl.add atab te ref_te; +(* +Verbose.printf "--> alias_type %s = %s ^ %d NOT FOUND, gives: %s\n" +(LicDump.string_of_type_eff te) +(LicDump.string_of_type_eff ty) +sz +(LicDump.string_of_type_eff ref_te); +*) + ref_te + ) + ) | _ -> te + in + + (** TRAITE LES TYPES *) + let do_type k te = + let te' = match te with + | Array_type_eff (tel, sz) -> + let tel' = alias_type tel in + Array_type_eff (tel', sz) + | Struct_type_eff (id, fields) -> + let do_field (id, (tf, co)) = + (id, (alias_type tf, co)) + in + Struct_type_eff (id, List.map do_field fields) + | _ -> te + in + if (te = te') then () + else + res := LicPrg.add_type k te' !res + in + LicPrg.iter_types do_type inp; + + (** TRAITE LES CONSTANTES *) + let do_const k ec = + let ec' = match ec with + | Extern_const_eff (i, te) -> + let te' = alias_type te in + Extern_const_eff (i, te') + | Abstract_const_eff (i, te, c, b) -> + let te' = alias_type te in + Abstract_const_eff (i, te', c, b) + | Array_const_eff (cl, te) -> + let te' = alias_type te in + Array_const_eff (cl, te') + | Bool_const_eff _ + | Int_const_eff _ + | Real_const_eff _ + | Enum_const_eff _ + | Struct_const_eff _ + | Tuple_const_eff _ -> ec + in + if (ec = ec') then () + else + (* n.b. add=replace *) + res := LicPrg.add_const k ec' !res + in + LicPrg.iter_consts do_const inp ; + + (** TRAITE LES NOEUDS *) + let do_node k en = + (* n.b. les Eff.type_ apparraissent uniquement dans les var infos *) + let do_var vi = + let ty = alias_type vi.var_type_eff in + {vi with var_type_eff = ty} + in + let en' = { en with + inlist_eff = (List.map do_var en.inlist_eff); + outlist_eff = (List.map do_var en.outlist_eff); + loclist_eff = ( + match en.loclist_eff with + | Some vl -> Some (List.map do_var vl) + | None -> None + ) + } in + (* on fait pas dans la dentelle, on remplace ... *) + res := LicPrg.add_node k en' !res + in + LicPrg.iter_nodes do_node inp; + !res + + + diff --git a/src/doNoPoly.ml b/src/doNoPoly.ml new file mode 100644 index 0000000000000000000000000000000000000000..3cd556c715916da4bedf4a006746961df83409dd --- /dev/null +++ b/src/doNoPoly.ml @@ -0,0 +1,190 @@ + +(* +Source 2 source transformation : +élimine polymorphisme et surcharge + +CONDITION : +- il est préférable d'appeler + ce module AVANT DoAliasTypes, + sinon on risque d'avoir des alias bizarres, du style : + 'anynum_4_7_int' + au lieu de + 'int_4_7' + Mais bon, normalement c'est quand même correct ... +*) + +open Lxm +open Eff + +let dbg=Some (Verbose.get_flag "poly") + +(** utile : on ne traite que les poly non externe *) +let node_is_poly ne = + (Eff.node_is_poly ne) && not (Eff.node_is_extern ne) + +let types_of_operands ops = + match ops with OperEff vl -> + List.flatten (List.map Eff.type_of_val_exp vl) + +(* transforme un type match en pseudo-arg statique + plus homogene ... *) +let static_args_of_matches matches = + List.map (fun (tv, te) -> + let tid = Eff.string_of_type_var tv in + TypeStaticArgEff (tid, te) + ) matches + +let rec doit (inprg : LicPrg.t) : LicPrg.t = + (* n.b. on fait un minumum d'effet de bord pour + pas avoir trop d'acummulateur ... *) + let res = ref LicPrg.empty in + + (** TRAITE LES TYPES *) + let do_type k (te:Eff.type_) = + res := LicPrg.add_type k te !res + in + LicPrg.iter_types do_type inprg; + + (** TRAITE LES CONSTANTES *) + let do_const k (ec: Eff.const) = + res := LicPrg.add_const k ec !res + in + LicPrg.iter_consts do_const inprg ; + + (** TRAITE LES NOEUDS : *) + let rec do_node k (ne:Eff.node_exp) = ( + if node_is_poly ne then + (* pour les noeuds polymorphes/surchagés, on fait rien du tout *) + Verbose.printf "### Warning: no code generated for polymorphic/overloaded node '%s'\n" + (Eff.string_of_node_key ne.node_key_eff) + else + let def' = match ne.def_eff with + | BuiltInEff _ + | ExternEff -> ne.def_eff + | AbstractEff _ -> assert false + | BodyEff nb -> + BodyEff (do_body [] nb) + in + res := LicPrg.add_node k { ne with def_eff = def'} !res + ) + (** TRAITEMENT DES BODY *) + and do_body + (m: Eff.type_matches) + (nb: Eff.node_body) + : Eff.node_body = + (* parcours les expressions du body + à la recherche d'appel ne noeuds poly *) + let do_assert a = + Lxm.flagit ( + do_exp m a.it + ) a.src + and do_eq eq = + Lxm.flagit ( + fst eq.it, + do_exp m (snd eq.it) + ) eq.src + in + { + asserts_eff = List.map do_assert nb.asserts_eff; + eqs_eff = List.map do_eq nb.eqs_eff; + } + (* TRAITEMENT DES EXP : on passe en parametre un Eff.type_matches *) + and do_exp + (m: Eff.type_matches) + (e: Eff.val_exp) + : Eff.val_exp = + let typ' = Eff.apply_type_matches m e.ve_typ in + let core' = match e.ve_core with + | CallByPosEff (posop, OperEff ops) -> ( + let ops' = OperEff (List.map (do_exp m) ops) in + match posop.it with + | PREDEF_CALL (pop,sas) -> + (* 12/07 ICI version provisoise : + les macros predef n'existe plus ! (ce sont des calls classiques + *) + assert (sas = []); + CallByPosEff (posop, ops') + | CALL nk -> + let ne = LicPrg.find_node inprg nk.it in + let nk' = if node_is_poly ne then ( + Verbose.exe ~flag:dbg (fun () -> + Printf.fprintf stderr "#DBG: CALL poly node %s\n" + (Lxm.details posop.src)); + let intypes = types_of_operands ops' in + let (inpars, _) = Eff.profile_of_node_exp ne in + let tmatches = UnifyType.is_matched inpars intypes in + {it=solve_poly tmatches nk.it ne; src=nk.src} + ) else nk in + let posop' = Lxm.flagit (CALL nk') posop.src in + CallByPosEff (posop', ops') + | x -> + (* dans tout les autre cas, raf ? *) + CallByPosEff (posop, ops') + ) + | CallByNameEff (namop, idops) -> + let idops' = List.map (fun (id, ve) -> (id, (do_exp m) ve)) idops in + CallByNameEff (namop, idops') + in + { e with ve_core = core'; ve_typ = typ' } + (* TRAITEMENT DES PARAMS STATIQUES *) + and do_static_arg + (m: Eff.type_matches) + (a: Eff.static_arg) + : Eff.static_arg = + match a with + | ConstStaticArgEff (id, cst) -> a + | TypeStaticArgEff (id, ty) -> a + | NodeStaticArgEff (id, nk) -> ( + match nk with + | (("Lustre",_),[]) -> a + | _ -> + let ne = LicPrg.find_node inprg nk in + let nk' = solve_poly m nk ne in + NodeStaticArgEff (id, nk') + ) + (** Gros du boulot : + soit un noeud poly, soit un profil attendu, + fabrique s'il n'existe pas déjà , un noeud non poly adéquat ... + *) + and solve_poly + (tmatches: Eff.type_matches) + (nk: Eff.node_key) + (ne: Eff.node_exp) + : Eff.node_key = + Verbose.printf ~flag:dbg + "#DBG: DoNoPoly.solve_poly nk='%s'\n# prof=%s'\n# matches='%s'\n" + (Eff.string_of_node_key nk) + (Eff.string_of_type_profile (Eff.profile_of_node_exp ne)) + (Eff.string_of_type_matches tmatches) + ; + let do_var vi = + { vi with var_type_eff = Eff.subst_matches tmatches vi.var_type_eff } + in + (* nouvelle clé unique = ancienne + tmatches *) + let (nid, sargs) = nk in + let sargs' = sargs@(static_args_of_matches tmatches) in + let nk' = (nid, sargs') in + let def' = match ne.def_eff with + | ExternEff + | AbstractEff _ -> assert false + | BuiltInEff (bid, sas) -> BuiltInEff (bid, List.map (do_static_arg tmatches) sas) + | BodyEff nb -> BodyEff (do_body tmatches nb) + in + let ne' = { + node_key_eff = nk'; + inlist_eff = List.map do_var ne.inlist_eff; + outlist_eff = List.map do_var ne.outlist_eff; + loclist_eff = (match ne.loclist_eff with + | None -> None + | Some vl -> Some (List.map do_var vl) + ); + def_eff = def'; + has_mem_eff = ne.has_mem_eff; + is_safe_eff = ne.is_safe_eff; + } in + res := LicPrg.add_node nk' ne' !res; + nk' + in + (*LET's GO *) + LicPrg.iter_nodes do_node inprg; + !res diff --git a/src/split.ml b/src/doSplit.ml similarity index 58% rename from src/split.ml rename to src/doSplit.ml index 2a5d735993d5160e860a5548d02e695db374b2fb..092a9e73de19a186675249c0389791ee18d289e3 100644 --- a/src/split.ml +++ b/src/doSplit.ml @@ -1,14 +1,23 @@ -(** Time-stamp: <modified the 01/06/2011 (at 13:45) by Erwan Jahier> *) +(* +Source 2 source transformation : + +1 opérateur par équation + +Réutilise ~ texto le Split d'R1 + +CONDITION : +- après DoNoPoly (et DoAliasType ?) +*) open Lxm open Eff -open Predef + +let dbg=Some (Verbose.get_flag "split") (********************************************************************************) -(* stuff to create fresh var names. *) -let new_var node_env type_eff clock_eff = - let id = Ident.of_string (Name.new_local_var ("v")) in +let new_var getid type_eff clock_eff = + let id = getid "v" in let var = { var_name_eff = id; @@ -17,18 +26,14 @@ let new_var node_env type_eff clock_eff = Should i rather put something sensible there ? *) var_type_eff = type_eff; var_clock_eff = id,clock_eff; - } - in - Hashtbl.add node_env.lenv_vars id var; + } in var - (********************************************************************************) (* functions that deal with tuple breaking *) - let rec (get_vel_from_tuple : val_exp -> val_exp list) = function - | { core = CallByPosEff({it=Eff.TUPLE }, OperEff vel) } -> + | { ve_core = CallByPosEff({it=Eff.TUPLE }, OperEff vel) } -> List.flatten (List.map get_vel_from_tuple vel) | ve -> [ve] @@ -40,25 +45,25 @@ let to_be_broken = function | CallByPosEff({ it = Eff.CURRENT }, _) -> true | CallByPosEff({ it = Eff.TUPLE }, _) -> true | CallByPosEff({ it = Eff.WHEN _ }, _) -> true - | CallByPosEff({ it = Eff.Predef(Predef.IF_n, []) }, _) -> true + | CallByPosEff({ it = Eff.PREDEF_CALL(Predef.IF_n, []) }, _) -> true | _ -> false let (break_it : val_exp -> val_exp list) = fun ve -> let nvel = - match ve.core with - | CallByPosEff({it=Eff.Predef(Predef.IF_n,[]);src=lxm}, OperEff [c;ve1;ve2]) -> + match ve.ve_core with + | CallByPosEff({it=Eff.PREDEF_CALL(Predef.IF_n,[]);src=lxm}, OperEff [c;ve1;ve2]) -> let vel1 = get_vel_from_tuple ve1 and vel2 = get_vel_from_tuple ve2 in List.map2 (fun ve1 ve2 -> - { core = - CallByPosEff({it=Eff.Predef(Predef.IF_n,[]);src=lxm}, + { ve_core = + CallByPosEff({it=Eff.PREDEF_CALL(Predef.IF_n,[]);src=lxm}, OperEff [c;ve1;ve2]); - typ = ve1.typ; - clk = ve1.clk; + ve_typ = ve1.ve_typ; + ve_clk = ve1.ve_clk; } ) vel1 @@ -69,7 +74,7 @@ let (break_it : val_exp -> val_exp list) = List.map (fun ve -> { ve with - core=CallByPosEff({it=WHEN clk ; src=lxm }, OperEff [ve])}) + ve_core=CallByPosEff({it=WHEN clk ; src=lxm }, OperEff [ve])}) vel | CallByPosEff({it=Eff.TUPLE ; src=lxm }, OperEff vel) -> @@ -77,13 +82,13 @@ let (break_it : val_exp -> val_exp list) = List.map (fun ve -> { ve with - core=CallByPosEff({it=Eff.TUPLE ; src=lxm }, OperEff [ve])}) + ve_core=CallByPosEff({it=Eff.TUPLE ; src=lxm }, OperEff [ve])}) vel | CallByPosEff({it=op ; src=lxm }, OperEff [ve]) -> let vel = get_vel_from_tuple ve in List.map - (fun ve -> { ve with core=CallByPosEff({it=op;src=lxm}, OperEff [ve])}) + (fun ve -> { ve with ve_core=CallByPosEff({it=op;src=lxm}, OperEff [ve])}) vel | CallByPosEff({it=op ; src=lxm }, OperEff [ve1;ve2]) -> @@ -92,26 +97,26 @@ let (break_it : val_exp -> val_exp list) = in List.map2 (fun ve1 ve2 -> - { core = CallByPosEff({it=op ; src=lxm }, OperEff [ve1;ve2]); - typ = ve1.typ; - clk = ve1.clk } + { ve_core = CallByPosEff({it=op ; src=lxm }, OperEff [ve1;ve2]); + ve_typ = ve1.ve_typ; + ve_clk = ve1.ve_clk } ) vel1 vel2 | _ -> assert false (* dead code since it is guarded by to_be_broken... *) in - let tl = ve.typ - and cl = ve.clk in - let nvel = List.map2 (fun nve t -> { nve with typ = [t]; clk=cl } ) nvel ve.typ in - assert(ve.typ = tl); + let tl = ve.ve_typ + and cl = ve.ve_clk in + let nvel = List.map2 (fun nve t -> { nve with ve_typ = [t]; ve_clk=cl } ) nvel ve.ve_typ in + assert(ve.ve_typ = tl); nvel let (split_tuples:Eff.eq_info Lxm.srcflagged list -> Eff.eq_info Lxm.srcflagged list) = fun eql -> let split_one_eq eq = let { src = lxm_eq ; it = (lhs, n_rhs) } = eq in - if List.length lhs > 1 && (to_be_broken n_rhs.core) then + if List.length lhs > 1 && (to_be_broken n_rhs.ve_core) then let vel = break_it n_rhs in let eqs = try List.map2 (fun lhs ve -> [lhs], ve) lhs vel @@ -126,11 +131,7 @@ let (split_tuples:Eff.eq_info Lxm.srcflagged list -> Eff.eq_info Lxm.srcflagged in List.flatten (List.map split_one_eq eql) - -(********************************************************************************) - (********************************************************************************) - (* The functions below accumulate (1) the new equations (2) the fresh variables. @@ -138,20 +139,20 @@ let (split_tuples:Eff.eq_info Lxm.srcflagged list -> Eff.eq_info Lxm.srcflagged type split_acc = (Eff.eq_info srcflagged) list * Eff.var_info list (* exported *) -let rec (eq : node_env -> Eff.eq_info Lxm.srcflagged -> split_acc) = - fun node_env { src = lxm_eq ; it = (lhs, rhs) } -> - let n_rhs, (neqs, nlocs) = split_val_exp false true node_env rhs in +let rec (eq : LicPrg.id_generator -> Eff.eq_info Lxm.srcflagged -> split_acc) = + fun getid { src = lxm_eq ; it = (lhs, rhs) } -> + let n_rhs, (neqs, nlocs) = split_val_exp false true getid rhs in { src = lxm_eq ; it = (lhs, n_rhs) }::neqs, nlocs and (split_eq_acc : - node_env -> split_acc -> Eff.eq_info srcflagged -> split_acc) = - fun node_env (eqs, locs) equation -> - let (neqs, nlocs) = eq node_env equation in + LicPrg.id_generator -> split_acc -> Eff.eq_info srcflagged -> split_acc) = + fun getid (eqs, locs) equation -> + let (neqs, nlocs) = eq getid equation in (split_tuples (eqs@neqs), locs@nlocs) -and (split_val_exp : bool -> bool -> node_env -> Eff.val_exp -> +and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Eff.val_exp -> Eff.val_exp * split_acc) = - fun when_flag top_level node_env ve -> + fun when_flag top_level getid ve -> (* [when_flag] is true is the call is made from a "when" statement. We need this flag in order to know if it is necessary to add a when on constants. Indeed, in Lustre V6, it is not necessary @@ -163,22 +164,23 @@ and (split_val_exp : bool -> bool -> node_env -> Eff.val_exp -> But is is not forbidden either! so we need to make sure that there is no "when"... *) - match ve.core with - | CallByPosEff({it=Eff.IDENT _}, _) -> ve, ([],[]) + match ve.ve_core with + | CallByPosEff({it=Eff.VAR_REF _}, _) -> ve, ([],[]) + | CallByPosEff({it=Eff.CONST_REF _}, _) -> ve, ([],[]) - | CallByPosEff({src=lxm;it=Eff.Predef(Predef.TRUE_n,_)}, _) - | CallByPosEff({src=lxm;it=Eff.Predef(Predef.FALSE_n,_)}, _) - | CallByPosEff({src=lxm;it=Eff.Predef(Predef.ICONST_n _,_)}, _) - | CallByPosEff({src=lxm;it=Eff.Predef(Predef.RCONST_n _,_)}, _) + | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.TRUE_n,_)}, _) + | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.FALSE_n,_)}, _) + | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.ICONST_n _,_)}, _) + | CallByPosEff({src=lxm;it=Eff.PREDEF_CALL(Predef.RCONST_n _,_)}, _) (* We do not create an intermediary variable for those, but *) -> if not when_flag then - let clk = ve.clk in + let clk = ve.ve_clk in match (List.hd clk) with | On(clock,_) -> let clk_exp = SyntaxTreeCore.NamedClock (Lxm.flagit clock lxm) in - { ve with core = + { ve with ve_core = CallByPosEff({src=lxm;it=Eff.WHEN clk_exp},OperEff [ve])}, ([],[]) @@ -192,24 +194,24 @@ and (split_val_exp : bool -> bool -> node_env -> Eff.val_exp -> let fl, eql, vl = List.fold_left (fun (fl_acc, eql_acc, vl_acc) (fn, fv) -> - let fv, (eql, vl) = split_val_exp false false node_env fv in + let fv, (eql, vl) = split_val_exp false false getid fv in ((fn,fv)::fl_acc, eql@eql_acc, vl@vl_acc) ) ([],[],[]) fl in - let rhs = { ve with core = CallByNameEff (by_name_op_eff, List.rev fl) } in + let rhs = { ve with ve_core = CallByNameEff (by_name_op_eff, List.rev fl) } in if top_level then rhs, (eql, vl) else (* create the var for the current call *) - let clk_l = ve.clk in - let typ_l = ve.typ in - let nv_l = List.map2 (new_var node_env.local) typ_l clk_l in + let clk_l = ve.ve_clk in + let typ_l = ve.ve_typ in + let nv_l = List.map2 (new_var getid) typ_l clk_l in let nve = match nv_l with - | [nv] -> { ve with core = + | [nv] -> { ve with ve_core = CallByPosEff( - Lxm.flagit (Eff.IDENT (Ident.to_idref nv.var_name_eff)) lxm, + Lxm.flagit (Eff.VAR_REF (nv.var_name_eff)) lxm, OperEff [] )} | _ -> assert false @@ -227,67 +229,67 @@ and (split_val_exp : bool -> bool -> node_env -> Eff.val_exp -> (* for WITH and HAT, a particular treatment is done because the val_exp is attached to them *) | Eff.WITH(ve) -> - let ve, (eql, vl) = split_val_exp false false node_env ve in + let ve, (eql, vl) = split_val_exp false false getid ve in let by_pos_op_eff = Lxm.flagit (Eff.WITH(ve)) lxm in let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in rhs, (eql, vl) | Eff.HAT(i,ve) -> - let ve, (eql, vl) = split_val_exp false false node_env ve in + let ve, (eql, vl) = split_val_exp false false getid ve in let by_pos_op_eff = Lxm.flagit (Eff.HAT(i, ve)) lxm in let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in rhs, (eql, vl) | Eff.WHEN ve -> (* should we create a var for the clock? *) - let vel,(eql, vl) = split_val_exp_list true false node_env vel in + let vel,(eql, vl) = split_val_exp_list true false getid vel in let by_pos_op_eff = Lxm.flagit (Eff.WHEN(ve)) lxm in let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in rhs, (eql, vl) | Eff.ARRAY vel -> - let vel, (eql, vl) = split_val_exp_list false false node_env vel in + let vel, (eql, vl) = split_val_exp_list false false getid vel in let by_pos_op_eff = Lxm.flagit (Eff.ARRAY(vel)) lxm in let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in rhs, (eql, vl) | _ -> - let vel, (eql, vl) = split_val_exp_list false false node_env vel in + let vel, (eql, vl) = split_val_exp_list false false getid vel in let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in rhs, (eql, vl) in - let rhs = { ve with core = rhs } in + let rhs = { ve with ve_core = rhs } in if top_level || by_pos_op_eff.it = TUPLE then rhs, (eql, vl) else (* create the var for the current call *) - let clk_l = ve.clk in - let typ_l = ve.typ in - let nv_l = List.map2 (new_var node_env.local) typ_l clk_l in + let clk_l = ve.ve_clk in + let typ_l = ve.ve_typ in + let nv_l = List.map2 (new_var getid) typ_l clk_l in let nve = match nv_l with | [nv] -> { - typ = [nv.var_type_eff]; - clk = clk_l; - core = CallByPosEff( - Lxm.flagit (Eff.IDENT (Ident.to_idref nv.var_name_eff)) lxm, + ve_typ = [nv.var_type_eff]; + ve_clk = clk_l; + ve_core = CallByPosEff( + Lxm.flagit (Eff.VAR_REF (nv.var_name_eff)) lxm, OperEff []) } | _ -> { - typ = List.map (fun v -> v.var_type_eff) nv_l; - clk = clk_l; - core = CallByPosEff( + ve_typ = List.map (fun v -> v.var_type_eff) nv_l; + ve_clk = clk_l; + ve_core = CallByPosEff( Lxm.flagit Eff.TUPLE lxm, OperEff (List.map ( fun nv -> let nnv = { - core = CallByPosEff + ve_core = CallByPosEff (Lxm.flagit - (Eff.IDENT (Ident.to_idref nv.var_name_eff)) lxm, + (Eff.VAR_REF (nv.var_name_eff)) lxm, OperEff []); - typ = [nv.var_type_eff]; - clk = [snd nv.var_clock_eff] + ve_typ = [nv.var_type_eff]; + ve_clk = [snd nv.var_clock_eff] } in nnv @@ -303,43 +305,64 @@ and (split_val_exp : bool -> bool -> node_env -> Eff.val_exp -> ) and (split_val_exp_list : bool -> - bool -> node_env -> Eff.val_exp list -> Eff.val_exp list * split_acc) = - fun when_flag top_level node_env vel -> + bool -> LicPrg.id_generator -> Eff.val_exp list -> Eff.val_exp list * split_acc) = + fun when_flag top_level getid vel -> let vel, accl = - List.split (List.map (split_val_exp when_flag top_level node_env) vel) + List.split (List.map (split_val_exp when_flag top_level getid) vel) in let eqll,vll = List.split accl in let eql, vl = List.flatten eqll, List.flatten vll in (vel,(eql,vl)) (* exported *) -and (node : node_env -> Eff.node_exp -> Eff.node_exp) = - fun n_env n -> - let _ = - Verbose.printf ~level:3 "*** Splitting node %s\n" - (LicDump.string_of_node_key_iter n.node_key_eff); - flush stdout - in - match n.def_eff with - | ExternEff - | AbstractEff None -> n - | AbstractEff (Some pn) -> - { n with def_eff = AbstractEff (Some (node n_env pn)) } - | BodyEff b -> - let loc = match n.loclist_eff with None -> [] | Some l -> l in - let (neqs, nv) = List.fold_left (split_eq_acc n_env) ([], loc) b.eqs_eff in - let asserts = List.map (fun x -> x.it) b.asserts_eff in - let lxm_asserts = List.map (fun x -> x.src) b.asserts_eff in - let nasserts,(neqs_asserts,nv_asserts) = - split_val_exp_list false true n_env asserts - in - let nasserts = List.map2 Lxm.flagit nasserts lxm_asserts in - let (neqs, nv) = (neqs@neqs_asserts, nv@nv_asserts) in - let nb = { eqs_eff = neqs ; asserts_eff = nasserts } in - let res = - { n with - loclist_eff = Some nv; - def_eff = BodyEff nb - } - in - res +and split_node (getid: LicPrg.id_generator) (n: Eff.node_exp) : Eff.node_exp = + Verbose.printf ~flag:dbg "*** Splitting node %s\n" + (LicDump.string_of_node_key_iter n.node_key_eff); + let res = match n.def_eff with + | ExternEff + | BuiltInEff _ + | AbstractEff None -> n + | AbstractEff (Some pn) -> + { n with def_eff = AbstractEff (Some (split_node getid pn)) } + | BodyEff b -> + let loc = match n.loclist_eff with None -> [] | Some l -> l in + let (neqs, nv) = List.fold_left (split_eq_acc getid) ([], loc) b.eqs_eff in + let asserts = List.map (fun x -> x.it) b.asserts_eff in + let lxm_asserts = List.map (fun x -> x.src) b.asserts_eff in + let nasserts,(neqs_asserts,nv_asserts) = + split_val_exp_list false true getid asserts + in + let nasserts = List.map2 Lxm.flagit nasserts lxm_asserts in + let (neqs, nv) = (neqs@neqs_asserts, nv@nv_asserts) in + let nb = { eqs_eff = neqs ; asserts_eff = nasserts } in + { n with loclist_eff = Some nv; def_eff = BodyEff nb } + in + res + +let rec doit (inprg : LicPrg.t) : LicPrg.t = + (* n.b. on fait un minumum d'effet de bord pour + pas avoir trop d'acummulateur ... *) + let res = ref LicPrg.empty in + + (** TRAITE LES TYPES *) + let do_type k (te:Eff.type_) = + res := LicPrg.add_type k te !res + in + LicPrg.iter_types do_type inprg; + + (** TRAITE LES CONSTANTES *) + let do_const k (ec: Eff.const) = + res := LicPrg.add_const k ec !res + in + LicPrg.iter_consts do_const inprg ; + + (** TRAITE LES NOEUDS : *) + let rec do_node k (ne:Eff.node_exp) = + (* On passe en parametre un constructeur de nouvelle variable locale *) + let getid = LicPrg.fresh_var_id_generator inprg ne in + let ne' = split_node getid ne in + res := LicPrg.add_node k ne' !res + in + (*LET's GO *) + LicPrg.iter_nodes do_node inprg; + !res diff --git a/src/eff.ml b/src/eff.ml index 1f5ae5708e9049014bf039374882399df7e37228..650799b2f8af43d98eb706a004e8015537c18283 100644 --- a/src/eff.ml +++ b/src/eff.ml @@ -84,11 +84,14 @@ ----------------------------------------------------------------------*) +open Errors open Printf open Lxm open SyntaxTree (* open SyntaxTreeCore *) +let dbg = Some (Verbose.get_flag "lazyc") + (*--------------------------------------------------------------------- Type : id_solver ----------------------------------------------------------------------- @@ -96,8 +99,10 @@ Type : id_solver pour résoudre les réferences aux idents. (voir par exemple EvalConst, EvalType) -N.B. On fournit les constructeurs des id_solver courants, voir : - +N.B. + +- On fournit les constructeurs des id_solver courants + ----------------------------------------------------------------------*) type id_solver = { (* XXX I should not have [idref] in this module !!! *) @@ -105,7 +110,7 @@ type id_solver = { id2type : Ident.idref -> Lxm.t -> type_; id2node : Ident.idref -> static_arg list -> Lxm.t -> node_exp; id2var : Ident.idref -> Lxm.t -> var_info; - symbols : SymbolTab.t; + global_symbols : SymbolTab.t; } (*--------------------------------------------------------------------- @@ -128,10 +133,18 @@ and type_ = | Array_type_eff of type_ * int | Struct_type_eff of Ident.long * (Ident.t * (type_ * const option)) list - | Any - | Overload + | TypeVar of type_var (* [Overload] is like [Any], except that it can only be [int] or [real] *) +and type_var = + | Any + | AnyNum +(* Utile : +- arguments et profils +*) +(* A VIRER A MOYEN TERME ! *) +and node_profile = (Ident.t * type_) list * (Ident.t * type_) list +and profile = type_ list * type_ list and slice_info = { (** Dénotation de tranche de tableau correcte : @@ -162,16 +175,21 @@ and left = and eq_info = left list * val_exp and val_exp = - { core : val_exp_core ; - typ : type_ list ; + { ve_core : val_exp_core ; + ve_typ : type_ list ; (* An empty list means that its type has not been computed (EvalType.f) yet. a cleaner solution would be to define two versions of val_exp: one with type info, and one without. But it is a big mutually recursive thing, and doing that would be a little bit heavy... *) - clk : clock list + ve_clk : clock list (* ditto *) } +(** CallByPosEff est (sans doute ?) + le BON endroit pour stocker l'information de 'matches', + i.e. est-ce qu'un 'type_matches' a été nécessaire + pour typer l'appel de l'opérateur ? +*) and val_exp_core = | CallByPosEff of (by_pos_op srcflagged * operands) | CallByNameEff of @@ -185,9 +203,11 @@ and by_name_op = and by_pos_op = - | Predef of Predef.op * static_arg list - | CALL of node_exp srcflagged - | IDENT of Ident.idref (* should be an Ident.t or long, really... *) + | PREDEF_CALL of Predef.op * static_arg list + | CALL of node_key srcflagged + (* | IDENT of Ident.idref (* should be an Ident.t or long, really... *) *) + | CONST_REF of Ident.long + | VAR_REF of Ident.t | PRE | ARROW @@ -240,6 +260,7 @@ and const = | Struct_const_eff of ((Ident.t * const) list * type_) (* type_ tableau : liste des valeurs + type_ des elts + taille *) | Array_const_eff of (const list * type_) + | Tuple_const_eff of const list (*--------------------------------------------------------------------- Type: val ----------------------------------------------------------------------- @@ -289,6 +310,7 @@ and clock = N.B. une horloge formelle est soit None (base) soit l'index d'une entrée (0..nb entrées-1). Les formal-clocks sont créées au cours du type-checking (et pas du clock-checking) + *) and node_exp = { node_key_eff : node_key; @@ -298,11 +320,15 @@ and node_exp = { def_eff : node_def; has_mem_eff : bool; is_safe_eff : bool; - is_polym_eff : bool + (* is_polym_eff : bool *) } +and type_matches = (type_var * type_) list + and node_def = | ExternEff + | BuiltInEff of node_key + (* ICI A QUOI CA SERT ???? *) | AbstractEff of node_exp option (* None if extern in the provide part *) | BodyEff of node_body @@ -315,9 +341,11 @@ and node_body = { and item_key = Ident.long and node_key = item_key * static_arg list and static_arg = + (* may be a tuple *) | ConstStaticArgEff of (Ident.t * const) | TypeStaticArgEff of (Ident.t * type_) - | NodeStaticArgEff of (Ident.t * sarg_node_eff * node_exp) + (* | NodeStaticArgEff of (Ident.t * sarg_node_eff * node_exp) *) + | NodeStaticArgEff of (Ident.t * node_key) and sarg_node_eff = node_key * var_info list * var_info list @@ -337,7 +365,7 @@ type 'a check_flag = | Incorrect -let (profile_of_node_exp : node_exp -> type_ list * type_ list) = +let (profile_of_node_exp : node_exp -> profile) = fun ne -> List.map (fun vi -> vi.var_type_eff) ne.inlist_eff, List.map (fun vi -> vi.var_type_eff) ne.outlist_eff @@ -382,7 +410,8 @@ type local_env = { (* lenv_globals : pack_env ; *) lenv_types : (Ident.t, type_) Hashtbl.t ; lenv_const : (Ident.t, const) Hashtbl.t ; - lenv_nodes : (Ident.t, sarg_node_eff) Hashtbl.t ; + (* lenv_nodes : (Ident.t, sarg_node_eff) Hashtbl.t ; *) + lenv_nodes : (Ident.t, node_key) Hashtbl.t ; lenv_vars : (Ident.t, var_info) Hashtbl.t ; } @@ -398,9 +427,14 @@ let (lookup_type: local_env -> Ident.idref -> Lxm.t -> type_) = fun env id lxm -> Hashtbl.find env.lenv_types (Ident.name_of_idref id) -let (lookup_node: - local_env -> Ident.idref -> static_arg list -> Lxm.t -> sarg_node_eff) = - fun env id sargs lmx -> +let lookup_node + (env: local_env) + (id: Ident.idref) + (sargs: static_arg list) + (lxm: Lxm.t) +(* : sarg_node_eff = *) +: node_key = + Hashtbl.find env.lenv_nodes (Ident.name_of_idref id) let (lookup_const: local_env -> Ident.idref -> Lxm.t -> const) = @@ -411,28 +445,6 @@ let (lookup_var: local_env -> Ident.t -> Lxm.t -> var_info) = fun env id lmx -> Hashtbl.find env.lenv_vars id - -let (make_local_env : node_key -> local_env) = - fun nk -> - let res = - { - lenv_node_key = nk; - lenv_types = Hashtbl.create 0; - lenv_const = Hashtbl.create 0; - lenv_nodes = Hashtbl.create 0; - lenv_vars = Hashtbl.create 0; - } - in - (* fill tables using static arg info *) - List.iter - (function - | ConstStaticArgEff(id,ce) -> Hashtbl.add res.lenv_const id ce - | TypeStaticArgEff(id,te) -> Hashtbl.add res.lenv_types id te - | NodeStaticArgEff(id, ne, _) -> Hashtbl.add res.lenv_nodes id ne - ) - (snd nk); - - res (****************************************************************************) (** [type_are_compatible t1 t2] checks that t1 is compatible with t2, i.e., @@ -443,10 +455,10 @@ let (type_are_compatible : type_ -> type_ -> bool) = | External_type_eff (id1), External_type_eff (id2) -> id1 = id2 | External_type_eff _, _ -> true | Abstract_type_eff _, _ -> true - | Any, _ -> true - | _, Any -> true - | Overload, Real_type_eff | Real_type_eff, Overload - | Overload, Int_type_eff | Int_type_eff, Overload -> true + | TypeVar Any, _ -> true + | _, TypeVar Any -> true + | (TypeVar AnyNum), Real_type_eff | Real_type_eff, (TypeVar AnyNum) + | (TypeVar AnyNum), Int_type_eff | Int_type_eff, (TypeVar AnyNum) -> true | t1, t2 -> t1 = t2 let rec (clock_are_equals : clock -> clock -> bool) = @@ -461,6 +473,17 @@ let (var_are_compatible : var_info -> var_info -> bool) = (type_are_compatible v1.var_type_eff v2.var_type_eff) && (clock_are_equals (snd v1.var_clock_eff) (snd v2.var_clock_eff)) +let ident_of_type = function + | Bool_type_eff -> Ident.out_of_pack "bool" + | Int_type_eff -> Ident.out_of_pack "int" + | Real_type_eff -> Ident.out_of_pack "real" + | External_type_eff id + | Abstract_type_eff (id, _) + | Enum_type_eff (id, _) + | Struct_type_eff (id, _) -> id + | TypeVar Any -> Ident.out_of_pack "any" + | (TypeVar AnyNum) -> Ident.out_of_pack "anynum" + | _ -> assert false (****************************************************************************) @@ -468,6 +491,7 @@ let (var_are_compatible : var_info -> var_info -> bool) = let (make_simple_node_key : Ident.long -> node_key) = fun nkey -> (nkey, []) +(* OBSOLETE ET UN PEU FAUX ! *) let rec (subst_type : type_ -> type_ -> type_) = fun t teff_ext -> match teff_ext with (* substitutes [t] in [teff_ext] *) @@ -482,24 +506,77 @@ let rec (subst_type : type_ -> type_ -> type_) = | Struct_type_eff(l, fl) -> Struct_type_eff( l, List.map (fun (id,(teff,copt)) -> (id,(subst_type t teff,copt))) fl) - | Any - | Overload -> t - -let rec (is_polymorphic : type_ -> bool) = + | TypeVar Any + | (TypeVar AnyNum) -> t + +(* *) +let rec subst_matches (matches: type_matches) (t: type_) : type_ = + match t with + | Bool_type_eff + | Int_type_eff + | Real_type_eff + | External_type_eff _ + | Enum_type_eff _ -> t + (* normallement, seul cas récursif ? *) + | Array_type_eff(telts,i) -> + Array_type_eff(subst_matches matches telts, i) + (* NE DEVRAIENT PAS ETRE RECURSIFS + on utilse paranoid au cas où ... + *) + | Abstract_type_eff(l,td) -> + Verbose.exe ~flag:Global.paranoid ( fun () -> + let t' = Abstract_type_eff(l,subst_matches matches td) in + if t <> t' then + assert false + ); + t + | Struct_type_eff(l,fl) -> + Verbose.exe ~flag:Global.paranoid ( fun () -> + let t' = Struct_type_eff( + l, List.map (fun (id,(teff,copt)) -> (id,(subst_matches matches teff, copt))) fl) + in + if t <> t' then + assert false + ); + t + | TypeVar tvar -> + try (List.assoc tvar matches) with Not_found -> t + +let apply_type_matches (matches: type_matches) (tl: type_ list) : type_ list = + match matches with + | [] -> tl + | _ -> List.map (subst_matches matches) tl + + +let rec (type_is_poly : type_ -> bool) = fun t -> match t with | Bool_type_eff | Int_type_eff | Real_type_eff | External_type_eff _ - | Abstract_type_eff _ | Enum_type_eff(_) -> false - | Any - | Overload -> true - | Array_type_eff(teff_ext,i) -> is_polymorphic teff_ext + (* peut-être un alias ! *) + | Abstract_type_eff (id,te) -> type_is_poly te + | TypeVar Any + | (TypeVar AnyNum) -> true + | Array_type_eff(teff_ext,i) -> type_is_poly teff_ext | Struct_type_eff(l, fl) -> - List.exists (fun (_,(teff,_)) -> is_polymorphic teff) fl + List.exists (fun (_,(teff,_)) -> type_is_poly teff) fl +let node_is_poly (ne:node_exp) : bool = + (* let it, ot = profile_of_node_exp ne in *) + let varispoly v = type_is_poly v.var_type_eff in + List.exists varispoly ne.inlist_eff + || + List.exists varispoly ne.outlist_eff +let node_is_extern (ne:node_exp) : bool = + match ne.def_eff with + | ExternEff -> true + | _ -> false + +(* Ne doit être appelée que pour les constantes simple +*) let (type_of_const: const -> type_) = function | Bool_const_eff _ -> Bool_type_eff @@ -510,6 +587,20 @@ let (type_of_const: const -> type_) = | Enum_const_eff (s, teff) -> teff | Struct_const_eff (fl, teff) -> teff | Array_const_eff (ct, teff) -> Array_type_eff (teff, List.length ct) + | Tuple_const_eff cl -> + print_internal_error "Eff.type_of_const" "should not have been called for a tuple"; + assert false + +let type_of_val_exp ve = ve.ve_typ + +(* accepte un UNIQUE niveau de tuple +*) +let (types_of_const: const -> type_ list) = + function + | Tuple_const_eff cl -> List.map type_of_const cl + | c -> [type_of_const c] + +(* const list *) (* Ignore the abstraction layer (necessary when expanding struct) *) (* XXX not used anymore. This is very suspect... *) @@ -538,13 +629,120 @@ let (clock_of_left: left -> clock) = fun left -> snd (var_info_of_left left).var_clock_eff - - -let find_var_info lxm vars id = - try Hashtbl.find vars.SyntaxTreeCore.vartable id - with Not_found -> - raise (Errors.Compile_error (lxm,"\n*** Unknown ident: " ^ (Ident.to_string id))) - +(* utils N.B peut etre different de LicDump ! *) +let string_of_ident x = + if !Global.no_prefix then + Ident.no_pack_string_of_long x + else + Ident.string_of_long x + +let rec string_of_type = function + | Bool_type_eff -> "bool" + | Int_type_eff -> "int" + | Real_type_eff -> "real" + | External_type_eff (name) -> (string_of_ident name) + | Abstract_type_eff (name, t) -> (string_of_ident name) + | Enum_type_eff (name, _) -> (string_of_ident name) + | Array_type_eff (ty, sz) -> + Printf.sprintf "%s^%d" (string_of_type ty) sz + | Struct_type_eff (name, _) -> (string_of_ident name) + | TypeVar Any -> "any" + | (TypeVar AnyNum) -> "anynum" + +and string_of_type_list = function + | [] -> "" + | [x] -> string_of_type x + | l -> String.concat " * " (List.map string_of_type l) + +and string_of_type_profile (i, o) = + (string_of_type_list i)^" -> "^(string_of_type_list o) + +and string_of_clock = function + | BaseEff -> " on base" + | ClockVar i -> " on 'c"^(string_of_int i) + | On (id, ck) -> " on "^(Ident.string_of_clk id)^(string_of_clock ck) + +and string_of_const = function + | Bool_const_eff true -> "true" + | Bool_const_eff false -> "false" + | Int_const_eff i -> (sprintf "%d" i) + | Real_const_eff r -> r + | Extern_const_eff (s,_) -> (string_of_ident s) + | Abstract_const_eff (s,t,v,_) -> (string_of_ident s) + | Enum_const_eff (s,_) -> (string_of_ident s) + | Struct_const_eff (fl, t) -> + let string_of_field (id, veff) = + (Ident.to_string id)^" = "^ (string_of_const veff) + in + Printf.sprintf "%s{%s}" + (string_of_type t) + (String.concat "; " (List.map string_of_field fl)) + | Array_const_eff (ctab, t) -> + Printf.sprintf "[%s]" + (String.concat ", " (List.map string_of_const ctab)) + | Tuple_const_eff cl -> + Printf.sprintf "(%s)" + (String.concat ", " (List.map string_of_const cl)) + +and string_of_var_info x = + (Ident.to_string x.var_name_eff) ^ ":"^(string_of_type x.var_type_eff)^(string_of_clock (snd x.var_clock_eff)) +and string_of_var_list vl = String.concat " ; " (List.map string_of_var_info vl) + +and string_of_node_key = function +| (ik, []) -> + (string_of_ident ik) +| (ik, sargs) -> Printf.sprintf "%s<<%s>>" + (string_of_ident ik) + (String.concat ", " (List.map string_of_static_arg sargs)) + +and string_of_static_arg = function +| ConstStaticArgEff (id, ceff) -> Printf.sprintf "const %s = %s" id (string_of_const ceff) +| TypeStaticArgEff (id, teff) -> Printf.sprintf "type %s = %s" id (string_of_type teff) +(* | NodeStaticArgEff (id, ((long,sargs), _, _), _) -> *) +| NodeStaticArgEff (id, nk) -> + Printf.sprintf "node %s = %s" id (string_of_node_key nk) + +and string_of_type_var tv = string_of_type (TypeVar tv) +and string_of_type_matches pm = + let sotm (tv,t) = Printf.sprintf "%s <- %s" + (string_of_type_var tv) (string_of_type t) + in + String.concat ", " (List.map sotm pm) + +let string_of_node_exp ne = + (Printf.sprintf " node_key_eff = %s\n" (string_of_node_key ne.node_key_eff)) +^ (Printf.sprintf " inlist_eff = %s\n" (string_of_var_list ne.inlist_eff)) +^ (Printf.sprintf " outlist_eff = %s\n" (string_of_var_list ne.outlist_eff)) + (* ne.loclist_eff : var_info list option; (* None => extern or abstract *) *) + (* ne.def_eff : node_def; *) + (* ne.has_mem_eff : bool; *) + (* ne.is_safe_eff : bool; *) + +(* NodeStaticArgEff of (Ident.t * sarg_node_eff * node_exp) *) +(* sarg_node_eff = node_key * var_info list * var_info list *) + +(* utile : liste standard de var_info a partir de liste de type *) +let create_var_list nat tl = ( + let pfx = match nat with + | SyntaxTreeCore.VarInput -> "i" + | SyntaxTreeCore.VarOutput -> "o" + | SyntaxTreeCore.VarLocal -> assert false + in + let cpt = ref 0 in + let dovar t = ( + let i = !cpt in + let id = Printf.sprintf "%s%d" pfx i in + incr cpt; + { + var_name_eff = id; + var_nature_eff = nat; + var_number_eff = i; + var_type_eff = t; + (* ???? *) + var_clock_eff = (id, BaseEff); + } + ) in List.map dovar tl +) (*--------------------------------------------------------------------- Une erreur associée à un noeud + 1 lexeme dans le fichier source @@ -552,3 +750,35 @@ Une erreur associ exception Compile_node_error of node_key * Lxm.t * string exception Global_node_error of node_key * string +let (make_local_env : node_key -> local_env) = + fun nk -> + Verbose.printf ~flag:dbg "#make_local_env %s\n" (string_of_node_key nk); + let res = + { + lenv_node_key = nk; + lenv_types = Hashtbl.create 0; + lenv_const = Hashtbl.create 0; + lenv_nodes = Hashtbl.create 0; + lenv_vars = Hashtbl.create 0; + } + in + (* fill tables using static arg info *) + List.iter + (function + | ConstStaticArgEff(id,ce) -> Hashtbl.add res.lenv_const id ce + | TypeStaticArgEff(id,te) -> Hashtbl.add res.lenv_types id te + (* | NodeStaticArgEff(id, ne, _) -> Hashtbl.add res.lenv_nodes id ne *) + | NodeStaticArgEff(id, nk) -> Hashtbl.add res.lenv_nodes id nk + ) + (snd nk); + + res + +let dump_local_env oc e = + let pt i t = Printf.fprintf oc "# type %s = %s\n" i (string_of_type t) in + Hashtbl.iter pt e.lenv_types; + let pc i t = Printf.fprintf oc "# const %s = %s\n" i (string_of_const t) in + Hashtbl.iter pc e.lenv_const; + (* let pn i (n,_,_) = Printf.fprintf oc "# node %s = %s\n" i (string_of_node_key n) in *) + let pn i nk = Printf.fprintf oc "# node %s = %s\n" i (string_of_node_key nk) in + Hashtbl.iter pn e.lenv_nodes; diff --git a/src/evalClock.ml b/src/evalClock.ml index 2df562fc6036fb7bcb59a959ae3440790392dc40..75f72658c4c13378a660943766dbd3e122138c90 100644 --- a/src/evalClock.ml +++ b/src/evalClock.ml @@ -195,7 +195,7 @@ let rec (f : Lxm.t -> Eff.id_solver -> subst -> Eff.val_exp -> Eff.clock list -> in let inf_clks = List.map (fun (id,clk) -> id, apply_subst2 s clk) inf_clks in let clks = snd (List.split inf_clks) in - let ve = { ve with clk = clks } in + let ve = { ve with ve_clk = clks } in Verbose.print_string ~level:3 ( "Clocking the expression '" ^ (LicDump.string_of_val_exp_eff ve) ^"': "^ (LicDump.string_of_clock2 (List.hd clks)) ^"\n"); @@ -205,7 +205,7 @@ let rec (f : Lxm.t -> Eff.id_solver -> subst -> Eff.val_exp -> Eff.clock list -> and f_aux id_solver s ve = let (cel, s), lxm = - match ve.core with + match ve.ve_core with | CallByPosEff ({it=posop; src=lxm}, OperEff args) -> eval_by_pos_clock id_solver posop lxm args s, lxm @@ -216,8 +216,8 @@ and f_aux id_solver s ve = in let new_clk = snd (List.split cel) in let s, ve = - if ve.clk = [] then (s, { ve with clk = new_clk }) else - let s = List.fold_left2 (UnifyClock.f lxm) s ve.clk new_clk in + if ve.ve_clk = [] then (s, { ve with ve_clk = new_clk }) else + let s = List.fold_left2 (UnifyClock.f lxm) s ve.ve_clk new_clk in s, ve in apply_subst_val_exp s ve, cel, s @@ -324,19 +324,19 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp (* nb: the args have been put inside the HAT_eff constructor *) - | Eff.IDENT idref,args -> ( - try ([var_info_eff_to_clock_eff (id_solver.id2var idref lxm)], s) - with Unknown_var(lxm, idref) -> ( - try - let _const = id_solver.id2const idref lxm in - let s, clk = UnifyClock.new_clock_var s in - [Ident.of_idref idref, clk], s - with Unknown_constant _ -> - raise (Unknown_var(lxm, idref)) - ) - ) - | Eff.CALL node_exp_eff,args -> - let (cil_arg, cil_res) = get_clock_profile node_exp_eff.it in + | Eff.VAR_REF id,args -> + let vi = UglyStuff.var_info_of_ident id_solver id lxm in + ([var_info_eff_to_clock_eff vi], s) + + | Eff.CONST_REF idl,args -> + let _const = UglyStuff.const_eff_of_item_key id_solver idl lxm in + let s, clk = UnifyClock.new_clock_var s in + ([Ident.of_long idl, clk], s) + + | Eff.CALL nkf,args -> + let node_key = nkf.it in + let node_exp_eff = UglyStuff.node_exp_of_node_key id_solver node_key lxm in + let (cil_arg, cil_res) = get_clock_profile node_exp_eff in let s, rel_base = UnifyClock.new_clock_var s in (* the value of the base clock of a node is actually relative to the context into which the node is called. @@ -371,7 +371,7 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp let (_,clk,s) = f_aux id_solver s (List.hd args) in clk,s - | Eff.Predef (op,sargs),args -> + | Eff.PREDEF_CALL (op,sargs),args -> let args, clk_args, s = f_list id_solver s args in let flat_clk_args = List.flatten clk_args in (* => mono-clock! *) let _,flat_clk_args = List.split flat_clk_args in @@ -380,7 +380,7 @@ and (eval_by_pos_clock : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> Eff.val_exp let _clk,s = UnifyClock.list lxm flat_clk_args s in List.map (List.map (apply_subst s)) clk_args, s in - PredefEvalClock.f op lxm sargs s clk_list + PredefEvalClock.f id_solver op lxm sargs s clk_list (* may have tuples as arguments *) | Eff.TUPLE,args diff --git a/src/evalConst.ml b/src/evalConst.ml index fb3eb5a5b98a5bc274aed539b64ff077be70474d..1c1e0780d5ce7c0b8c4562cb2cac9c02d7faf9de 100644 --- a/src/evalConst.ml +++ b/src/evalConst.ml @@ -76,8 +76,8 @@ let (make_array_const : Eff.const list list -> Eff.const) = if (t = xtyp) then x else raise (EvalConst_error( "type error in array, "^ - (LicDump.string_of_type_eff4msg xtyp)^ - " mixed with " ^ LicDump.string_of_type_eff4msg t + (Eff.string_of_type xtyp)^ + " mixed with " ^ (Eff.string_of_type t) )) ) ) @@ -117,8 +117,8 @@ let make_struct_const sprintf "\n*** type error in struct %s, %s instead of %s" (Ident.string_of_long tnm) - (LicDump.string_of_type_eff4msg vt) - (LicDump.string_of_type_eff4msg ft) + (Eff.string_of_type vt) + (Eff.string_of_type ft) )) ) ) with Not_found -> ( @@ -142,7 +142,7 @@ let make_struct_const sprintf "\n*** %s is not a field of struct %s" (Ident.to_string id) - (LicDump.string_of_type_eff4msg(teff)) + (Eff.string_of_type(teff)) )) in Hashtbl.iter raise_error arg_tab ; @@ -152,7 +152,7 @@ let make_struct_const | _ -> raise (EvalConst_error( sprintf "struct type expected instead of %s" - (LicDump.string_of_type_eff4msg teff) + (Eff.string_of_type teff) )) ) @@ -259,8 +259,8 @@ let rec f raise(EvalConst_error( sprintf "\n*** type combination error, can't concat %s with %s" - (LicDump.string_of_type_eff4msg(t0)) - (LicDump.string_of_type_eff4msg(t1)) + (Eff.string_of_type(t0)) + (Eff.string_of_type(t1)) )) ) | [_;_] -> @@ -314,7 +314,7 @@ let rec f raise (EvalConst_error (Printf.sprintf "%s is not a field of struct %s" (Ident.to_string fid) - (LicDump.string_of_type_eff4msg(typ)))) + (Eff.string_of_type(typ)))) ) | [x] -> type_error_const [x] "struct type" | x -> arity_error_const x "1" @@ -332,10 +332,10 @@ let rec f -> if sargs = [] then let effargs = (List.map rec_eval_const args) in - PredefEvalConst.f op lxm [] effargs + PredefEvalConst.f env op.it lxm [] effargs else (* Well, it migth be possible after all... TODO *) - not_evaluable_construct (op2string op) + not_evaluable_construct (op2string op.it) ) (* FIN DE : eval_by_pos_const *) @@ -415,7 +415,7 @@ and (eval_array_size: Eff.id_solver -> val_exp -> int) = raise(EvalArray_error(sprintf "bad array size %d" sz)) | [x] -> raise(EvalArray_error(sprintf "bad array size, int expected but get %s" - (LicDump.string_of_type_eff4msg(Eff.type_of_const x)))) + (Eff.string_of_type(Eff.type_of_const x)))) | _ -> raise(EvalArray_error(sprintf "bad array size, int expected, not a tuple")) @@ -451,7 +451,7 @@ and eval_array_index " is extern")) | [x] -> raise(EvalArray_error(sprintf "bad array index, int expected but get %s" - (LicDump.string_of_type_eff4msg(Eff.type_of_const x))) + (Eff.string_of_type(Eff.type_of_const x))) ) | _ -> raise(EvalArray_error( sprintf "bad array index, int expected but get a tuple")) @@ -494,7 +494,7 @@ and eval_array_slice (env : Eff.id_solver) (sl : slice_info) (lxm : Lxm.t) = | [Int_const_eff s] -> s (* ok *) | [x] -> raise(EvalArray_error( sprintf "bad array step, int expected but get %s" - (LicDump.string_of_type_eff4msg (Eff.type_of_const x)))) + (Eff.string_of_type (Eff.type_of_const x)))) | _ -> raise(EvalArray_error( sprintf "bad array step, int expected but get a tuple")) ) diff --git a/src/evalType.ml b/src/evalType.ml index 09d3302d435e4f2f60af70067f6df6eae75f652c..e684da079162e8d71d9ac3c3fee02de817c5a604 100644 --- a/src/evalType.ml +++ b/src/evalType.ml @@ -2,8 +2,6 @@ open Predef -open PredefEvalType -open PredefEvalConst open SyntaxTree open SyntaxTreeCore open Eff @@ -11,15 +9,34 @@ open Printf open Lxm open Errors +(*** +MESSAGES D'ERREUR : +Pour rester homogène, utiliser les fonctions de PredefEvalType: + raise_type_error (provided: string) (expect: string) (msg: string) + raise_arity_error (msg:string) (provided:int) (expect:int) +*) +let raise_type_error = PredefEvalType.raise_type_error +let raise_arity_error = PredefEvalType.raise_arity_error +exception EvalType_error = PredefEvalType.EvalType_error +exception EvalConst_error = PredefEvalConst.EvalConst_error - +let dbgpoly = Some (Verbose.get_flag "poly") (******************************************************************************) let finish_me msg = print_string ("\n\tXXX evalType.ml:"^msg^" -> finish me!\n") + + +(******************************** +ACCES AUX INFOS DEJA COMPILEES, +SOLUTION INTERMEDIARE A REVOIR : +voir UglyStuff +*) + + let rec (f : Eff.id_solver -> Eff.val_exp -> Eff.val_exp * Eff.type_ list) = fun id_solver ve -> let ve_core, tl = - match ve.core with + match ve.ve_core with | CallByPosEff ({it=posop; src=lxm}, OperEff args) -> ( let posop_opt, args, tl = try eval_by_pos_type id_solver posop lxm args @@ -41,53 +58,71 @@ let rec (f : Eff.id_solver -> Eff.val_exp -> Eff.val_exp * Eff.type_ list) = in CallByNameEff ({it=nmop; src=lxm}, nmargs ), tl in - { core = ve_core; typ = tl ; clk = ve.clk }, tl + { ve_core = ve_core; ve_typ = tl ; ve_clk = ve.ve_clk }, tl -and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> - Eff.val_exp list -> +and eval_by_pos_type + (id_solver: Eff.id_solver) + (posop: Eff.by_pos_op) + (lxm: Lxm.t) + (args: Eff.val_exp list) +: ( Eff.by_pos_op option (* For op that hold a val_exp, we return the modified op *) * Eff.val_exp list (* The args with type info added *) * Eff.type_ list (* The type of the val_exp "posop(args)" *) - ) = - fun id_solver posop lxm args -> + ) = match posop with - | Eff.Predef (op,sargs) -> ( + | PREDEF_CALL (op,sargs) -> ( let args, targs = List.split (List.map (f id_solver) args) in - let tve = PredefEvalType.f op lxm sargs targs in + (* ICI pas de matches possible ? *) + let tve = PredefEvalType.f id_solver op lxm sargs targs in None, args, tve ) - | Eff.CALL node_exp_eff -> - let lti = List.map (fun v -> v.var_type_eff) node_exp_eff.it.inlist_eff in - let lto = List.map (fun v -> v.var_type_eff) node_exp_eff.it.outlist_eff in - let args, t_argsl = List.split (List.map (f id_solver) args) in - let t_args = List.flatten t_argsl in - let llti = List.length lti and lt_args = List.length t_args in - let tve = - if llti <> lt_args then - raise (EvalType_error(sprintf - "\n*** arity error: %d argument(s) are expected, whereas %d is/are provided" - llti lt_args)) - else - (match UnifyType.f lti t_args with - | UnifyType.Equal -> lto - | UnifyType.Unif subst -> List.map (subst_type subst) lto - | UnifyType.Ko msg -> raise (Compile_error(lxm, msg)) - ) - in - None, args, tve - - | Eff.IDENT id -> ( - let tve = (* [id] migth be a constant, but also a variable *) - try [(id_solver.id2var id lxm).var_type_eff] - with - Unknown_var(lxm, idref) -> - try [Eff.type_of_const (id_solver.id2const id lxm)] - with Unknown_constant _ -> - raise (Unknown_var(lxm, idref)) - in - None, [], tve - ) + | Eff.CALL nkf -> + let node_key = nkf.it in + (* let node_exp_eff = id_solver.id2node node_key lxm in *) + let node_exp_eff = UglyStuff.node_exp_of_node_key id_solver node_key lxm in + let (lti, lto) = Eff.profile_of_node_exp node_exp_eff in + let args, t_argsl = List.split (List.map (f id_solver) args) in + let t_args = List.flatten t_argsl in + let llti = List.length lti and lt_args = List.length t_args in + let _ = if llti <> lt_args then + raise_arity_error "" lt_args llti + in + (* lti = expecteds, t_args = given *) + let tmatches = try UnifyType.is_matched lti t_args + with UnifyType.Match_failed msg -> ( + let msg' = Printf.sprintf + "\n*** while unifing (%s) with (%s)" + (Eff.string_of_type_list lti) + (Eff.string_of_type_list t_args) + in raise (EvalType_error(msg'^msg)) + ) in + let tve = match tmatches with + | [] -> lto + | _ -> + Verbose.exe ~flag:dbgpoly (fun () -> + Printf.fprintf stderr "#DBG: EvalType of CALL '%s' (%s)\n" + (Eff.string_of_node_key node_key) + (Lxm.details lxm); + Printf.fprintf stderr "# unifying '%s' with '%s'\n" + (Eff.string_of_type_list lti) + (Eff.string_of_type_list t_args) ; + Printf.fprintf stderr "# required matches %s\n" + (Eff.string_of_type_matches tmatches) + ); + Eff.apply_type_matches tmatches lto + in + (None, args, tve) + | Eff.CONST_REF idl -> + let ceff = UglyStuff.const_eff_of_item_key id_solver idl lxm in + let tve = [Eff.type_of_const ceff] in + None, [], tve + | Eff.VAR_REF id -> + let tve = [ + (UglyStuff.var_info_of_ident id_solver id lxm).var_type_eff + ] in + None, [], tve | Eff.WITH(ve) -> let ve, tve = f id_solver ve in Some(Eff.WITH(ve)), [], tve @@ -96,24 +131,18 @@ and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> let args, targs = List.split (List.map (f id_solver) args) in None, args, List.flatten targs - | Eff.CONCAT -> ( - let args, targs = List.split (List.map (f id_solver) args) in - let tve = - match targs with - | [[Array_type_eff (teff0, size0)]; [Array_type_eff (teff1, size1)]] -> - let teff = - match UnifyType.f [teff0] [teff1] with - | UnifyType.Equal -> teff1 - | UnifyType.Unif subst -> subst_type subst teff1 - | UnifyType.Ko msg -> raise (Compile_error(lxm, msg)) - in - [Array_type_eff (teff, size0+size1)] - | _ -> - raise(EvalType_error(sprintf "arity error: 2 expected instead of %d" - (List.length args))) + | Eff.CONCAT -> + let args, targs = List.split (List.map (f id_solver) args) in + let tve = match targs with + | [ [Array_type_eff (t0, s0)]; [Array_type_eff (t1, s1)]] -> + if t0 = t1 then [Array_type_eff (t0, s0+s1)] + else + raise_type_error (List.flatten targs) [] + "two arrays of the same type was expected" + | _ -> + raise_arity_error "" (List.length args) 2 in None, args, tve - ) | Eff.STRUCT_ACCESS (fid) -> assert (List.length args = 1); let arg, targ = f id_solver (List.hd args) in @@ -123,16 +152,17 @@ and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> try fst (List.assoc fid fl) with Not_found -> raise ( - PredefEvalType.EvalType_error + EvalType_error (Printf.sprintf "%s is not a field of struct %s" (Ident.to_string fid) - (LicDump.string_of_type_eff4msg (List.hd targ)))) + (Eff.string_of_type (List.hd targ)))) ) - | [x] -> PredefEvalType.type_error [x] "struct type" - | x -> PredefEvalType.arity_error x "1" + | [x] -> raise_type_error [x] [] "some struct type was expected" + | x -> raise_arity_error "" (List.length x) 1 in None, [arg], [teff_field] + | Eff.ARRAY_ACCES(i) -> assert (List.length args = 1); let arg, targ = f id_solver (List.hd args) in @@ -141,14 +171,13 @@ and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> | [Array_type_eff(teff_elt, size)] -> size, teff_elt | _ -> let msg = - "\n*** Type error: '"^(LicDump.string_of_type_eff_list4msg targ) ^ + "\n*** Type error: '"^(Eff.string_of_type_list targ) ^ "' was expected to be an array" in raise (Compile_error(lxm, msg)) in let _ = if ((i >= 0) && (i < sz)) then () else - raise( - EvalType_error(sprintf "array index %d out of bounds 0..%d" i (sz-1))) + raise(EvalType_error(sprintf "array index %d out of bounds 0..%d" i (sz-1))) in None, [arg], [teff] @@ -161,7 +190,7 @@ and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> | _ -> raise (Compile_error( lxm, "\n*** Type error: '" ^ - (LicDump.string_of_type_eff_list targ) ^ + (Eff.string_of_type_list targ) ^ "' was expected to be an array")) in let _ = if ((sieff.se_first >= 0) && (sieff.se_first < sz)) then () else @@ -214,14 +243,14 @@ and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> | Eff.Enum_type_eff _ -> () | teff -> let msg = "the type of a clock cannot be " ^ - (LicDump.string_of_type_eff4msg teff) + (Eff.string_of_type teff) in raise(Compile_error(lxm,msg)) ) in match targs with | [teff] -> None, args, teff - | _ -> raise(EvalType_error("arity error (1 arg expected)")) + | _ -> raise_arity_error "" (List.length targs) 1 ) | Eff.ARROW | Eff.FBY -> ( @@ -229,67 +258,60 @@ and (eval_by_pos_type : Eff.id_solver -> Eff.by_pos_op -> Lxm.t -> match targs with | [init; teff] -> if init = teff then None, args, teff else raise(EvalType_error("type mismatch. ")) - | _ -> raise(EvalType_error("arity error (2 args expected)")) + | _ -> raise_arity_error "" (List.length targs) 2 ) | Eff.CURRENT | Eff.PRE -> ( let args, targs = List.split (List.map (f id_solver) args) in match targs with | [teff] -> None, args, teff - | _ -> raise(EvalType_error("arity error (1 arg expected)")) + | _ -> raise_arity_error "" (List.length targs) 1 ) | Eff.MERGE _ -> finish_me "merge"; assert false +(** + Juste pour les structures ... +*) +and eval_by_name_type + (id_solver: Eff.id_solver) + (namop: Eff.by_name_op) + (lxm: Lxm.t) + (namargs: (Ident.t Lxm.srcflagged * Eff.val_exp) list ) +(* renvoie la lsite de modif de champs compilée + le type du résultat *) +: (Ident.t Lxm.srcflagged * Eff.val_exp) list * Eff.type_ list += match namop with -and (eval_by_name_type : Eff.id_solver -> Eff.by_name_op -> Lxm.t -> - (Ident.t Lxm.srcflagged * Eff.val_exp) list -> - (Ident.t Lxm.srcflagged * Eff.val_exp) list * Eff.type_ list) = - fun id_solver namop lxm namargs -> - match namop with - | Eff.STRUCT_anonymous -> - (* ??? comment faire ici pour recuperer son type ??? + | Eff.STRUCT_anonymous -> + (* ??? comment faire ici pour recuperer son type ??? il faut que je recherche à l'aide des noms de champs le type structure qui va bien ! - creer une table [liste des noms de champs -> ident de type structure] ? - rajouter dans la table a sa creation une entree dont le nom est composé du nom des champs ? - *) - finish_me "anonymous struct not yet supported"; - assert false - (* failwith "Finish me: anonymous struct not yet supported" *) - - | Eff.STRUCT (pn,opid) -> - let struct_type = id_solver.id2type opid lxm in - let namargs = - match struct_type with - | Struct_type_eff(sn, fl) -> - let namargs = - List.map - (fun (fn,fv) -> - let lxm = fn.src in - let (ft,fopt) = - try List.assoc fn.it fl with Not_found -> - let msg = "type error: bad field"^(Ident.to_string fn.it) in - raise (Compile_error(lxm, msg)) - in - (* let's check the type of fv *) - let fv, fv_type = f id_solver fv in - let _fv_type = (* XXX ignored? *) - match UnifyType.f [ft] fv_type with - | UnifyType.Unif t -> t - | UnifyType.Equal -> ft - | UnifyType.Ko msg -> raise (Compile_error(lxm, msg)) - in - (fn,fv) - ) - namargs - in - namargs -(* Struct_type_eff(sn, fl) *) - | _ -> - raise (Compile_error(lxm, "type error: a structure is expected")) - - in - namargs, [struct_type] + *) + finish_me "anonymous struct not yet supported"; + assert false + + | Eff.STRUCT (pn,opid) -> + let struct_type = id_solver.id2type opid lxm in + match struct_type with + | Struct_type_eff(sn, fl) -> + let do_field_assign (fn, fv) = + (* traitement d'un ''field_name = field_value'' *) + let (ft,fopt) = try + List.assoc fn.it fl + with Not_found -> + let msg = "type error: bad field"^(Ident.to_string fn.it) in + raise (Compile_error(lxm, msg)) + in + (* let's check the type of fv *) + let fv, fv_type = f id_solver fv in + if fv_type = [ft] then (fn,fv) + else raise_type_error fv_type [ft] + ("while checking struct field "^(Lxm.details fn.src)) + in + let namargs = List.map do_field_assign namargs + in (namargs, [struct_type]) + | _ -> raise (Compile_error(lxm, "type error: a structure is expected")) diff --git a/src/evalType.mli b/src/evalType.mli index 271057154dd8a46c7f31209ea7661329172b3460..623fe2d8b66591dd571f09152e3cefb7d7d83845 100644 --- a/src/evalType.mli +++ b/src/evalType.mli @@ -4,7 +4,10 @@ (** Evaluates the type of an expression, and return a val_exp with its "typ" field updated (and ditto for the type of its sub expr). +Modif 12/07 : +- Travaille au niveau Eff, donc on vire Eff.id_solver qui + travaille au niveau syntaxique + *) val f : Eff.id_solver -> Eff.val_exp -> Eff.val_exp * Eff.type_ list - diff --git a/src/getEff.ml b/src/getEff.ml index e69bcec37ca800c8426cf902af8406513f473444..07e77684e3b8d6a012d98764e499e9d0ef854021 100644 --- a/src/getEff.ml +++ b/src/getEff.ml @@ -9,11 +9,14 @@ open Eff open Errors open Ident +(** debug flag: on prend le meme que LazyCompiler ... *) +let dbg = Some(Verbose.get_flag "lazyc") + (******************************************************************************) exception GetEffType_error of string (* exported *) -let rec (typ:Eff.id_solver -> SyntaxTreeCore.type_exp -> Eff.type_) = +let rec (of_type: Eff.id_solver -> SyntaxTreeCore.type_exp -> Eff.type_) = fun env texp -> try ( match texp.it with @@ -22,7 +25,7 @@ let rec (typ:Eff.id_solver -> SyntaxTreeCore.type_exp -> Eff.type_) = | Real_type_exp -> Real_type_eff | Named_type_exp s -> env.id2type s texp.src | Array_type_exp (elt_texp, szexp) -> - let elt_teff = typ env elt_texp in + let elt_teff = of_type env elt_texp in try let sz = EvalConst.eval_array_size env szexp in Array_type_eff (elt_teff, sz) @@ -40,14 +43,14 @@ let (add_pack_name : id_solver -> Lxm.t -> Ident.idref -> Ident.idref) = | None -> let id = Ident.of_idref cc in let pn = - SymbolTab.find_pack_of_const id_solver.symbols id lxm + SymbolTab.find_pack_of_const id_solver.global_symbols id lxm in Ident.make_idref pn id with _ -> cc (* raise en error? *) (* exported *) -let rec (clock : Eff.id_solver -> SyntaxTreeCore.var_info -> Eff.id_clock)= +let rec (of_clock : Eff.id_solver -> SyntaxTreeCore.var_info -> Eff.id_clock)= fun id_solver v -> match v.var_clock with | Base -> v.var_name, BaseEff @@ -82,9 +85,9 @@ and (type_check_equation: Eff.id_solver -> Lxm.t -> Eff.left list -> (fun le re -> if le <> re then let msg = "type mismatch: \n***\t'" - ^ (LicDump.string_of_type_eff4msg le) ^ + ^ (Eff.string_of_type le) ^ "' (left-hand-side) \n*** is not compatible with \n***\t'" - ^ (LicDump.string_of_type_eff4msg re) ^ "' (right-hand-side)" + ^ (Eff.string_of_type re) ^ "' (right-hand-side)" in raise (Compile_error(lxm, msg)) ) @@ -99,45 +102,115 @@ and (clock_check_equation:Eff.id_solver -> Lxm.t -> UnifyClock.subst -> let _, right_part_clks, s = EvalClock.f lxm id_solver s ve_eff clk_list in EvalClock.check_res lxm s lpl_eff right_part_clks - (******************************************************************************) -let (dump_polymorphic_nodes : Eff.type_ -> unit) = - fun t -> - let node_stack = Polymorphism.unstack_polymorphic_nodes t in - List.iter - (fun (nenv, node) -> - let nnodes = [node] in - List.iter - (fun (node) -> - let str = LicDump.node_of_node_exp_eff node in - output_string !Global.oc str - ) - nnodes; - ) - node_stack +(* +ICI : BEQUILLE(S) +on fait un lookup dans la table des operateurs +pour rechercher leurs (éventuels) parametres statiques : +TRAITER LES MACROS PREDEF : +- ici, on juste besoin de fabriquer les arguments statiques effectifs + à partir des arguments donnés et des args attendus. +- on cherche pas à faire rentrer dans le moule, on délègue -(******************************************************************************) -let (get_static_params_from_idref : SymbolTab.t -> Lxm.t -> Ident.idref -> - static_param srcflagged list) = - fun symbols lxm idref -> - try - match SymbolTab.find_node symbols (Ident.name_of_idref idref) lxm with - | SymbolTab.Local ni -> ni.it.static_params - | SymbolTab.Imported(imported_node, params) -> params - with _ -> - (* can occur for static node parameters, which cannot - themselves have static parameters. A better solution ougth - to be to add node static parameters in the SymbolTab.t - however (in Lazycompiler.node_check_do most probably). *) - [] +*) +(* pour abstraire la nature des params statiques *) +type abstract_static_param = + | ASP_const of Ident.t + | ASP_type of Ident.t + | ASP_node of Ident.t + +let do_abstract_static_param x = +match x.it with + | StaticParamType id -> ASP_type id + | StaticParamConst (id,_) -> ASP_const id + | StaticParamNode (id,_,_,_) -> ASP_node id + + +let get_abstract_static_params + (symbols: SymbolTab.t) + (lxm: Lxm.t) + (idref: Ident.idref) +: abstract_static_param list = + + Verbose.exe ~flag:dbg (fun () -> + Printf.fprintf stderr "#DBG: GetEff.get_abstract_static %s\n" + (Ident.raw_string_of_idref idref) + ) ; + match (idref.id_pack, idref.id_id) with + | (Some "Lustre", "map") + | (Some "Lustre", "red") + | (Some "Lustre", "fill") + | (Some "Lustre", "fillred") -> [ ASP_node "oper"; ASP_const "size" ] + | (Some "Lustre", "boolred") -> [ ASP_const "min"; ASP_const "max"; ASP_const "size"] + | (Some "Lustre", "condact") -> [ ASP_node "oper"; ASP_const "dflt" ] + | _ -> ( + try + let spl = match SymbolTab.find_node symbols (Ident.name_of_idref idref) lxm with + | SymbolTab.Local ni -> ni.it.static_params + | SymbolTab.Imported(imported_node, params) -> params + in List.map do_abstract_static_param spl + with _ -> + (* can occur for static node parameters, which cannot + themselves have static parameters. A better solution ougth + to be to add node static parameters in the SymbolTab.t + however (in Lazycompiler.node_check_do most probably). + + OUI MAIS GROS BUG : qu'est-ce-qui se passe si si le + 'static node parameter' porte le meme nom qu'un noeud + existant dans SymbolTab ??? + + C'est clairement pas la bonne méthode ... + Voir + bas ... + + *) + [] + ) (* exported *) -let rec (node : Eff.id_solver -> SyntaxTreeCore.node_exp srcflagged -> - Eff.node_exp) = - fun id_solver { src = lxm; it=(idref, static_args) } -> - let static_params = get_static_params_from_idref id_solver.symbols lxm idref in - let static_args_eff = + +let rec of_node + (id_solver : Eff.id_solver) (ne: SyntaxTreeCore.node_exp srcflagged) : Eff.node_exp = + + Verbose.exe ~flag:dbg (fun () -> + Printf.fprintf stderr "\n\n#DBG: ENTERING GetEff.of_node \'"; + SyntaxTreeDump.print_node_exp stderr ne.it; + Printf.fprintf stderr "'\n\n"; + + ); + let lxm = ne.src in + let (idref, static_args) = ne.it in + (* pas tres beau : on corrige le idref des predefs ... *) + let idref = match (idref.id_pack, idref.id_id) with + | (None, "map") + | (None, "red") + | (None, "fill") + | (None, "fillred") + | (None, "boolred") + | (None, "condact") -> {idref with id_pack = Some "Lustre"} + | _ -> idref + in + (* BUG des param statique node avec le meme nom + qu'un node template global : + pis-aller : si static_args = [], + on a peut-etre affaire à un static param node, donc + on appelle directement id_solver.id2node et c'est lui + qui plantera si ce n'est pas le cas et qu'il fallait + des static_args... + si static_args <> [], de toute maniere ca ne peut PAS + etre un static param node + *) + + (* NOUVELLE VERSION ÉPURÉE : + ON ne fait AUCUNE vérif de cohérence de types pour les param statiques, + on ne vérifie QUE la nature (pour pouvoir résoudre les args qui sont des idents + A FAIRE + TARD ? !! + *) + let static_args_eff = match static_args with + | [] -> [] + | _ -> + (* on en proffite pour corriger le idref en y rajoutant l'eventuel pack *) + let static_params = get_abstract_static_params id_solver.global_symbols lxm idref in let sp_l = List.length static_params and sa_l = List.length static_args in if (sp_l <> sa_l) then @@ -150,140 +223,75 @@ let rec (node : Eff.id_solver -> SyntaxTreeCore.node_exp srcflagged -> List.map2 (check_static_arg id_solver) static_params static_args - in - id_solver.id2node idref static_args_eff lxm - + in + let res = id_solver.id2node idref static_args_eff lxm in + Verbose.exe ~flag:dbg (fun () -> + Printf.fprintf stderr "\n#DBG: LEAVING GetEff.of_node \'"; + SyntaxTreeDump.print_node_exp stderr ne.it; + Printf.fprintf stderr "'\n"; + Printf.fprintf stderr " RESULT:\n%s\n" (Eff.string_of_node_exp res); + ); + res + +and check_static_arg + (node_id_solver: Eff.id_solver) + (asp: abstract_static_param) + (sa: SyntaxTreeCore.static_arg srcflagged) +: Eff.static_arg = +( + (* 1ere passe : + on utilise expected juste pour résoudre la nature, + on "compile" les args + *) + let nature_error nat = + let msg = Printf.sprintf "Bad static argument nature, a %s was expected" nat in + raise (Compile_error(sa.src, msg)) + in + let res = match (sa.it, asp) with + (* ident vs type *) + | (StaticArgIdent idref, ASP_type id) -> + let teff = node_id_solver.id2type idref sa.src in + TypeStaticArgEff (id, teff) + (* type_exp vs type *) + | (StaticArgType te, ASP_type id) -> + let teff = of_type node_id_solver te in + TypeStaticArgEff (id, teff) + (* ident vs const *) + | (StaticArgIdent idref, ASP_const id) -> + let ceff = node_id_solver.id2const idref sa.src in + ConstStaticArgEff (id, ceff) + (* val_exp vs const *) + | (StaticArgConst ce, ASP_const id) -> ( + let ceff = EvalConst.f node_id_solver ce in + match ceff with + | [ceff] -> ConstStaticArgEff (id,ceff) + | _ -> assert false (* should not occur *) + ) + (* id vs node *) + | (StaticArgIdent idref, ASP_node id) -> + let sargs = [] in + let neff = node_id_solver.id2node idref sargs sa.src in + NodeStaticArgEff (id, neff.node_key_eff) + (* node exp vs node *) + | (StaticArgNode (CALL_n ne), ASP_node id) -> + let neff = of_node node_id_solver ne in + NodeStaticArgEff (id, neff.node_key_eff) + (* node exp vs node *) + | (StaticArgNode (Predef_n (op,sargs)), ASP_node id) -> + (* ICI : campagne de suppression de Eff.PREDEF_CALL: pas de macros ! *) + assert (sargs = []); + let opeff = PredefEvalType.make_node_exp_eff node_id_solver None op.it sa.src [] in + NodeStaticArgEff (id, opeff.node_key_eff) + | (_, ASP_type _) -> nature_error "type" + | (_, ASP_const _) -> nature_error "constant" + | (_, ASP_node _) -> nature_error "node" + in res +) -(** [check_static_arg this pn id sa (symbols, acc)] compile a static arg - into a static_arg -*) -and (check_static_arg : Eff.id_solver -> - SyntaxTreeCore.static_param srcflagged -> - SyntaxTreeCore.static_arg srcflagged -> - Eff.static_arg) = - fun node_id_solver sp sa -> - - let rec (eff_type_and_type_exp_are_equal: - Eff.type_ -> SyntaxTreeCore.type_exp_core -> bool) = - fun teff texp -> - match teff, texp with - | Bool_type_eff, Bool_type_exp - | Real_type_eff, Real_type_exp - | Int_type_eff, Int_type_exp -> true - | Abstract_type_eff(l,_), Named_type_exp idref -> - l = Ident.long_of_idref idref - | External_type_eff(l), Named_type_exp idref -> - (* This seems a little bit wrong *) - l = Ident.long_of_idref idref - - | _ , Named_type_exp idref -> true - - | Array_type_eff(teff_ext,i),Array_type_exp(texp,j) -> - i=(EvalConst.eval_array_size node_id_solver j) - & (eff_type_and_type_exp_are_equal teff texp.it) - - | Any,_ -> assert false (* for TTB, polymorphism is not supported *) - | Overload, _ -> assert false (* ditto *) - | Struct_type_eff(_),_ -> assert false (* impossible *) - | Enum_type_eff(_),_ -> assert false (* ditto *) - | _ -> false - in - let check_type_arg type_eff type_exp = - if not (eff_type_and_type_exp_are_equal type_eff type_exp.it) then - let msg = "Bad (static) type argument: '" ^ - (LicDump.string_of_type_eff4msg type_eff) ^ - "' and '" ^ (string_of_type_exp type_exp) ^ "' differs." - in - raise (Compile_error(type_exp.src, msg)) - else () - in - - let type_check_var_info acc vi_eff vi_exp = acc & - eff_type_and_type_exp_are_equal vi_eff.var_type_eff vi_exp.it.var_type.it - in - let type_check_var_info_list vil_eff vil_exp = - List.fold_left2 type_check_var_info true vil_eff vil_exp - in - let check_node_arg neff vii vio = - let str = "Bad (static) node argument: " in - if (List.length neff.inlist_eff) <> (List.length vii) then - raise (Compile_error(sa.src, str ^ "arity error (inputs).")) - else if (List.length neff.outlist_eff) <> (List.length vio) then - raise (Compile_error(sa.src, str ^ "arity error (outputs).")) - else if not (type_check_var_info_list neff.inlist_eff vii) then - raise (Compile_error(sa.src, str ^ "wrong input type profile.")) - else if not (type_check_var_info_list neff.outlist_eff vio) then - raise (Compile_error(sa.src, str ^ "wrong output type profile.")) - else (neff.inlist_eff, neff.outlist_eff) - in - - let sa_eff = - match sa.it, sp.it with - | StaticArgIdent idref, StaticParamConst(id, type_exp) -> - let ceff = node_id_solver.id2const idref sa.src in - let t_ceff = type_of_const ceff in - check_type_arg t_ceff type_exp; - ConstStaticArgEff (id, ceff) - - | StaticArgIdent idref, StaticParamType(id) -> - let teff = node_id_solver.id2type idref sa.src in - TypeStaticArgEff (id, teff) - - | StaticArgConst ce, StaticParamConst(id, type_exp) -> ( - let ceff = EvalConst.f node_id_solver ce in - let t_ceff = type_of_const (List.hd ceff) in - check_type_arg t_ceff type_exp; - match ceff with - | [ceff] -> ConstStaticArgEff (id,ceff) - | _ -> assert false (* should not occur *) - ) - | StaticArgType te, StaticParamType id -> - let teff = typ node_id_solver te in - TypeStaticArgEff (id, teff) - - | StaticArgIdent idref, StaticParamNode(id, vii, vio,_) -> - (* idref is an alias, hence it cannot have static argument *) - let sargs = [] in - let neff = node_id_solver.id2node idref sargs sa.src in - let (inlist, outlist) = check_node_arg neff vii vio in - NodeStaticArgEff (id, (neff.node_key_eff, inlist, outlist), neff) - - | StaticArgNode(CALL_n ne), StaticParamNode(id,vii,vio,_) -> - let neff = node node_id_solver ne in - let (inlist, outlist) = check_node_arg neff vii vio in - NodeStaticArgEff (id, (neff.node_key_eff, inlist, outlist), neff) - - | StaticArgNode(Predef_n (op,sargs)), StaticParamNode(id,vii,vio,_) -> - let sargs_eff = - translate_predef_static_args node_id_solver sargs sa.src - in - let opeff = PredefEvalType.make_node_exp_eff None op sa.src sargs_eff in - let (inlist, outlist) = check_node_arg opeff vii vio in - NodeStaticArgEff (id, (opeff.node_key_eff, inlist, outlist), opeff) - - | StaticArgNode( - (MERGE_n _|ARRAY_SLICE_n _|ARRAY_ACCES_n _|STRUCT_ACCESS_n _|IDENT_n _ - |ARRAY_n|HAT_n|CONCAT_n|WITH_n(_)|TUPLE_n|WHEN_n(_)|CURRENT_n|FBY_n - |ARROW_n|PRE_n)), _ -> assert false - - | StaticArgType _, StaticParamNode(id,_,_,_) - | StaticArgType _, StaticParamConst(id,_) - - | StaticArgNode _, StaticParamType(id) - | StaticArgNode _, StaticParamConst(id,_) - - | StaticArgConst _, StaticParamNode(id,_,_,_) - | StaticArgConst _, StaticParamType(id) - -> - assert false (* can it occur actually? Let's wait it occurs...*) - in - sa_eff - - (******************************************************************************) (* exported *) -and (eq:Eff.id_solver -> SyntaxTreeCore.eq_info srcflagged -> Eff.eq_info srcflagged) = +and (of_eq: Eff.id_solver -> SyntaxTreeCore.eq_info srcflagged -> Eff.eq_info srcflagged) = fun id_solver eq_info -> let (lpl, ve) = eq_info.it in let lpl_eff = List.map (translate_left_part id_solver) lpl @@ -377,85 +385,52 @@ and (translate_val_exp : Eff.id_solver -> UnifyClock.subst -> in let s, vef_core = match by_pos_op with - (* put that in another module ? yes, see above.*) - | Predef_n(Map, sargs) - | Predef_n(Fill, sargs) - | Predef_n(Red, sargs) - | Predef_n(FillRed, sargs) - | Predef_n(BoolRed, sargs) -> - (* We will make use of [vel_eff] to resolve the polymorphism *) - let vel_eff, type_ll = - List.split (List.map (EvalType.f id_solver) vel_eff) - in - let type_l : Eff.type_ list = List.flatten type_ll in - let sargs_eff = translate_predef_static_args id_solver sargs lxm in - let iter_op = match by_pos_op with - Predef_n(op,_) -> op | _ -> assert false - in - let iter_profile = match by_pos_op with - | Predef_n(Map,_) -> - PredefEvalType.map_profile lxm sargs_eff - | Predef_n(Fill,_) | Predef_n(Red,_) | Predef_n(FillRed,_) -> - PredefEvalType.fillred_profile lxm sargs_eff - | Predef_n(BoolRed,_) -> - PredefEvalType.boolred_profile lxm sargs_eff - | _ -> assert false - in - let type_l_exp = snd (List.split (fst iter_profile)) in - let sargs_eff = - if List.length type_l <> List.length type_l_exp then - let str = Printf.sprintf - "the iterator has a wrong arity: %s instead of %s" - (string_of_int (List.length type_l)) - (string_of_int (List.length type_l_exp)) - in - raise (Compile_error(lxm, str)) - else - match UnifyType.f type_l type_l_exp with - | UnifyType.Equal -> sargs_eff - | UnifyType.Unif typ -> - (* The iterated nodes was polymorphic, but we know here - that the type variable was [typ]. - *) - dump_polymorphic_nodes typ; - List.map (instanciate_type typ) sargs_eff - - | UnifyType.Ko str -> raise (Compile_error(lxm, str)) - in - s, mk_by_pos_op (Eff.Predef(iter_op, sargs_eff)) - - (* other predef operators *) - | Predef_n(op, args) -> - assert (args=[]); s, mk_by_pos_op(Predef (op,[])) - + (* put that in another module ? yes, see above.*) + | Predef_n(op, sargs) -> ( + (* 12/07 SOLUTION INTERMEDIAIRE + - les macros predefs ne sont plus traitées ici + on les transforme en CALL standard + N.B. on garde pour l'instant la notion de + PREDEF_CALL pour les op simple, mais à terme + ça devrait disparaitre aussi ... + *) + match sargs with + | [] -> s, mk_by_pos_op(PREDEF_CALL (op.it,[])) + | _ -> + (* on re-construit une SyntaxTreeCore.node_exp srcflagged + parce que c'est ca qu'attend of_node ... + *) + let node_exp_f = flagit (Predef.op_to_idref op.it, sargs) op.src in + let neff = of_node id_solver node_exp_f in + let ceff = Eff.CALL (flagit neff.node_key_eff node_exp_f.src) in + Verbose.exe ~flag:dbg (fun () -> + Printf.fprintf stderr "#DBG: GetEff.translate_val_exp CALL '%!"; + SyntaxTreeDump.print_node_exp stderr node_exp_f.it; + Printf.fprintf stderr " gives type: %s\n%!" + (Eff.string_of_type_profile (profile_of_node_exp neff)) + ) ; + (s, mk_by_pos_op ceff) + ) | CALL_n node_exp_f -> - s, mk_by_pos_op(Eff.CALL (flagit (node id_solver node_exp_f) - node_exp_f.src)) + let neff = of_node id_solver node_exp_f in + let ceff = Eff.CALL (flagit neff.node_key_eff node_exp_f.src) in + Verbose.exe ~flag:dbg (fun () -> + Printf.fprintf stderr "#DBG: GetEff.translate_val_exp CALL_n "; + SyntaxTreeDump.print_node_exp stderr node_exp_f.it; + Printf.fprintf stderr " gives type: %s\n%!" + (Eff.string_of_type_profile (profile_of_node_exp neff)) + ) ; + (s, mk_by_pos_op ceff) | IDENT_n idref -> ( - try + try + let var = id_solver.id2var idref lxm in + s, mk_by_pos_op(Eff.VAR_REF var.var_name_eff) + with _ -> let s, const = UnifyClock.const_to_val_eff lxm false s (id_solver.id2const idref lxm) in - s, const.core - with - | Unknown_constant _ -> (* In case idref is not a static constant. *) ( - match Ident.pack_of_idref idref with - | Some pn -> s, mk_by_pos_op(Eff.IDENT idref) - (** Constant with a pack name are treated as - Eff.IDENT. *) - | None -> - try - (* try to add its pack name... *) - let id = Ident.of_idref idref in - let pn = - SymbolTab.find_pack_of_const id_solver.symbols id lxm - in - let idref = Ident.make_idref pn id in - s, mk_by_pos_op(Eff.IDENT (idref)) - with _ -> - s, mk_by_pos_op(Eff.IDENT idref) - ) - ) + s, const.ve_core + ) | CURRENT_n -> s, mk_by_pos_op Eff.CURRENT | PRE_n -> s, mk_by_pos_op Eff.PRE @@ -509,7 +484,7 @@ and (translate_val_exp : Eff.id_solver -> UnifyClock.subst -> in s, vef_core, lxm in - let vef, tl = EvalType.f id_solver { core=vef_core; typ=[]; clk = [] } in + let vef, tl = EvalType.f id_solver { ve_core=vef_core; ve_typ=[]; ve_clk = [] } in let vef, _, s = EvalClock.f lxm id_solver s vef [] in s, vef @@ -521,7 +496,7 @@ and translate_by_name_op id_solver op = | None -> (* If no pack name is provided, we lookup it in the symbol table *) let id = Ident.of_idref idref in - let pn = SymbolTab.find_pack_of_type id_solver.symbols id op.src in + let pn = SymbolTab.find_pack_of_type id_solver.global_symbols id op.src in STRUCT (pn, idref) | Some pn -> STRUCT (pn, idref) @@ -530,138 +505,44 @@ and translate_field id_solver s (id, ve) = s, (id, ve) (* XXX autre nom, autre module ? + node_of_static_arg : appelé QUAND ON SAIT qu'un sarg doit etre un NODE + const_of_static_arg : appelé QUAND ON SAIT qu'un sarg doit etre une CONST + + -> sert pour les macros predefs ca fait partie de la definition des iterateurs d'une certaine maniere... -> créer 2 modules, Iterator + IteratorSemantics *) -and get_const id_solver const_or_const_ident lxm = +and const_of_static_arg id_solver const_or_const_ident lxm = match const_or_const_ident with - | StaticArgConst(c) -> List.hd (EvalConst.f id_solver c) + | StaticArgConst(c) -> ( + match EvalConst.f id_solver c with + | [x] -> x + | xl -> + (* EvalConst.f ne fabrique PAS de tuple, on le fait ici *) + Tuple_const_eff xl + ) | StaticArgIdent(id) -> id_solver.id2const id lxm | StaticArgType _ | StaticArgNode _ -> raise (Compile_error(lxm, "a constant was expected")) -and get_node id_solver node_or_node_ident lxm = +and node_of_static_arg id_solver node_or_node_ident lxm = match node_or_node_ident with | StaticArgIdent(id) -> let sargs = [] in (* it is an alias: no static arg *) id_solver.id2node id sargs lxm - | StaticArgNode(CALL_n ne) -> node id_solver ne - | StaticArgNode(Predef_n (op,sargs)) -> - let sargs_eff = translate_predef_static_args id_solver sargs lxm in - PredefEvalType.make_node_exp_eff None op lxm sargs_eff + | StaticArgNode(CALL_n ne) -> of_node id_solver ne + | StaticArgNode(Predef_n (op,[])) -> + PredefEvalType.make_node_exp_eff id_solver None op.it lxm [] + | StaticArgNode(Predef_n (op,_)) -> assert false + | StaticArgNode(_) -> assert false | StaticArgType _ | StaticArgConst _ -> raise (Compile_error(lxm, "a node was expected")) - -and (instanciate_type: Eff.type_ -> Eff.static_arg -> Eff.static_arg) = - fun t sarg -> - let make_long pstr idstr = - Ident.long_of_idref { id_pack = Some pstr ; id_id = idstr } - in - let instanciate_var_info vi = - { vi with var_type_eff = Eff.subst_type t vi.var_type_eff } - in - match sarg with - | ConstStaticArgEff _ -> sarg - | TypeStaticArgEff _ -> sarg (* we cannot denote polymorphic type... *) - | NodeStaticArgEff(id,((node, sargs),il,ol),neff) -> - let node = match Ident.idref_of_long node with - | { id_pack = Some "Lustre" ; id_id = "times" } -> - let op = if t = Int_type_eff then "itimes" else "rtimes" in - make_long "Lustre" op - | { id_pack = Some "Lustre" ; id_id = "slash" } -> - let op = if t = Int_type_eff then "islash" else "rslash" in - make_long "Lustre" op - | { id_pack = Some "Lustre" ; id_id = "plus" } -> - let op = if t = Int_type_eff then "iplus" else "rplus" in - make_long "Lustre" op - | { id_pack = Some "Lustre" ; id_id = "minus" } -> - let op = if t = Int_type_eff then "iminus" else "rminus" in - make_long "Lustre" op - | { id_pack = Some "Lustre" ; id_id = "uminus" } -> - let op = if t = Int_type_eff then "iuminus" else "ruminus" in - make_long "Lustre" op - | { id_pack = Some "Lustre" ; id_id = "div" } -> - let op = if t = Int_type_eff then "div" else "rdiv" in - make_long "Lustre" op - - (* polymorphic op. what should be done for type different from - int and real? - *) - - (* Lustre::ilt and co are not compiled yet. *) - (* | { id_pack = Some "Lustre" ; id_id = "lt" } -> *) - (* let op = if t = Int_type_eff then "ilt" *) - (* else if t = Real_type_eff then "rlt" else "lt" in *) - (* make_long "Lustre" op *) - (* | { id_pack = Some "Lustre" ; id_id = "gt" } -> *) - (* let op = if t = Int_type_eff then "igt" *) - (* else if t = Real_type_eff then "rgt" else "gt" in *) - (* make_long "Lustre" op *) - (* | { id_pack = Some "Lustre" ; id_id = "lte" } -> *) - (* let op = if t = Int_type_eff then "ilte" *) - (* else if t = Real_type_eff then "rlte" else "lte" in *) - (* make_long "Lustre" op *) - (* | { id_pack = Some "Lustre" ; id_id = "gte" } -> *) - (* let op = if t = Int_type_eff then "igte" *) - (* else if t = Real_type_eff then "rgte" else "gte" in *) - (* make_long "Lustre" op *) - - | { id_pack = Some "Lustre" ; id_id = "equal" } -> - let op = if t = Int_type_eff then "iequal" - else if t = Real_type_eff then "requal" - else if t = Bool_type_eff then "bequal" else "equal" in - make_long "Lustre" op - | { id_pack = Some "Lustre" ; id_id = "diff" } -> - let op = if t = Int_type_eff then "idiff" - else if t = Real_type_eff then "rdiff" - else if t = Bool_type_eff then "bdiff" else "diff" in - make_long "Lustre" op - - | _ -> node - in - let il = List.map instanciate_var_info il - and ol = List.map instanciate_var_info ol - in - let neff = { - neff with - node_key_eff = (node,sargs); - inlist_eff = il; - outlist_eff = ol; - } - in - NodeStaticArgEff(id,((node,sargs),il,ol),neff) - -(* exported *) -and (translate_predef_static_args: Eff.id_solver -> - SyntaxTreeCore.static_arg srcflagged list -> Lxm.t -> - Eff.static_arg list) = - fun id_solver sargs lxm -> - match sargs with - | [] -> [] - | [{src=lxm_c1;it=c1}; {src=lxm_c2;it=c2}; {src=lxm_c3;it=c3}] -> - [ - ConstStaticArgEff(Ident.of_string "min", get_const id_solver c1 lxm_c1); - ConstStaticArgEff(Ident.of_string "max", get_const id_solver c2 lxm_c2); - ConstStaticArgEff(Ident.of_string "size",get_const id_solver c3 lxm_c3) - ] - - | [{src=lxm_n;it=node}; {src=lxm_c;it=const}] -> - let node_eff = get_node id_solver node lxm_n in - let node_arg = - node_eff.node_key_eff, node_eff.inlist_eff, node_eff.outlist_eff - in - [NodeStaticArgEff(Ident.of_string "node", node_arg, node_eff); - ConstStaticArgEff(Ident.of_string "size",get_const id_solver const lxm_c)] - | _ -> - raise (Compile_error(lxm, "bad arguments number for array iterator")) - - and (translate_slice_info : Eff.id_solver -> SyntaxTreeCore.slice_info -> Lxm.t -> Eff.slice_info) = fun id_solver si lxm -> @@ -670,7 +551,7 @@ and (translate_slice_info : Eff.id_solver -> SyntaxTreeCore.slice_info -> (**********************************************************************************) (* exported *) -let (assertion : Eff.id_solver -> SyntaxTreeCore.val_exp Lxm.srcflagged -> +let (of_assertion : Eff.id_solver -> SyntaxTreeCore.val_exp Lxm.srcflagged -> Eff.val_exp Lxm.srcflagged) = fun id_solver vef -> let s, val_exp_eff = translate_val_exp id_solver UnifyClock.empty_subst vef.it in @@ -680,7 +561,7 @@ let (assertion : Eff.id_solver -> SyntaxTreeCore.val_exp Lxm.srcflagged -> (fun ve -> if ve <> Bool_type_eff then let msg = "type mismatch: \n\tthe content of the assertion is of type " - ^ (LicDump.string_of_type_eff4msg ve) + ^ (Eff.string_of_type ve) ^ " whereas it shoud be a Boolean\n" in raise (Compile_error(vef.src, msg)) diff --git a/src/getEff.mli b/src/getEff.mli index 4df77c6ecd25dc7655a53e479102991be6f8d76e..6ab0678fcb47866b0704d5d5ccb71ee17563ccae 100644 --- a/src/getEff.mli +++ b/src/getEff.mli @@ -13,8 +13,8 @@ - checks the arguments and the parameters are compatible (i.e., that they unify) *) -val typ : Eff.id_solver -> SyntaxTreeCore.type_exp -> Eff.type_ -val clock: Eff.id_solver -> SyntaxTreeCore.var_info -> Eff.id_clock +val of_type : Eff.id_solver -> SyntaxTreeCore.type_exp -> Eff.type_ +val of_clock : Eff.id_solver -> SyntaxTreeCore.var_info -> Eff.id_clock (** A [node_exp] is a name plus a list of static arguments. @@ -24,21 +24,11 @@ val clock: Eff.id_solver -> SyntaxTreeCore.var_info -> Eff.id_clock - check they are compatible with the node signature check the type of the static arguments ( *) -val node : Eff.id_solver -> SyntaxTreeCore.node_exp Lxm.srcflagged -> +val of_node : Eff.id_solver -> SyntaxTreeCore.node_exp Lxm.srcflagged -> Eff.node_exp -val eq : Eff.id_solver -> SyntaxTreeCore.eq_info Lxm.srcflagged -> +val of_eq : Eff.id_solver -> SyntaxTreeCore.eq_info Lxm.srcflagged -> Eff.eq_info Lxm.srcflagged -val assertion : Eff.id_solver -> SyntaxTreeCore.val_exp Lxm.srcflagged -> +val of_assertion : Eff.id_solver -> SyntaxTreeCore.val_exp Lxm.srcflagged -> Eff.val_exp Lxm.srcflagged - - -(** Useful to type check node aliased by array iterators *) -val translate_predef_static_args: - Eff.id_solver -> SyntaxTreeCore.static_arg Lxm.srcflagged list -> - Lxm.t -> Eff.static_arg list - -(** Instanciate the frozen polymorphic nodes using the type in -argument, and (Lic)dump them (cf Polymorphism). *) -val dump_polymorphic_nodes : Eff.type_ -> unit diff --git a/src/global.ml b/src/global.ml index 2a4ec53a11e3e394b13a0cc52480cb56d0b93b1f..d2bd5f1b8e5065cd6852335b829a1a63800b9fb9 100644 --- a/src/global.ml +++ b/src/global.ml @@ -3,6 +3,11 @@ (** Some global variables. *) +(* flag 'paranoid' utile pour forcer (via le mecanisme Verbose.exe) + des vérifs de trucs douteux ... +*) +let paranoid = Some (Verbose.get_flag "paranoid") + (* to compute line/col *) let line_num = ref 1 let line_start_pos = ref 0 @@ -42,3 +47,5 @@ let lexbuf_of_file_name file = line_start_pos := 0; current_file := file; Lexing.from_channel inchannel + + diff --git a/src/ident.ml b/src/ident.ml index 38f54c5e3e7021ce57c66a27c6ca44debcf0eee1..b0d5e32d3153660a9eb72c36341bc1d93fe7a4e6 100644 --- a/src/ident.ml +++ b/src/ident.ml @@ -67,9 +67,14 @@ let (pack_name_to_string : pack_name -> string) = let (string_of_long : long -> string) = - fun (pn, id) -> - if !Global.ec then pn ^"__"^ id else - if !Global.lv4 then pn ^"__"^ id else pn ^"::"^ id + fun (pn, id) -> + let sep = + if !Global.ec || !Global.lv4 then "__" else "::" + in + match pn with + | "" -> id + | _ -> Printf.sprintf "%s%s%s" pn sep id + let (string_of_long2 : long -> string) = fun (pn, id) -> pn ^"::"^ id @@ -115,6 +120,8 @@ let idref_of_string s = ( | _ -> raise (Failure ("idref_of_string: \""^s^"\" not a proper ident")) ) +let out_of_pack s = ("", s) + let (long_of_string : string -> long) = fun s -> match (Str.split (Str.regexp "::") s) with @@ -131,6 +138,14 @@ let string_of_idref i = ( (p^"::"^i.id_id) | None -> i.id_id ) +let raw_string_of_idref i = ( + let p = match i.id_pack with + | Some p -> "Some \""^p^"\"" + | None -> "None" + in + Printf.sprintf "(%s, \"%s\")" p i.id_id +) + let (wrap_idref : idref -> string -> string -> idref) = fun { id_pack = p ; id_id = id } pref suff -> @@ -153,6 +168,10 @@ let (idref_of_long : long -> idref) = fun (pn,id) -> { id_pack = Some pn ; id_id = id } +let (idref_of_id : t -> idref) = + fun id -> + { id_pack = None ; id_id = id } + let (make_idref : pack_name -> t -> idref) = fun pn id -> { id_pack = Some pn ; id_id = id } diff --git a/src/ident.mli b/src/ident.mli index 1f8183663af150267d1dc4248124290cfd7cb554..5ec32af4e026f31bd965f4496eeee8bc5ca997de 100644 --- a/src/ident.mli +++ b/src/ident.mli @@ -3,7 +3,7 @@ type t = string type long = t * t -type pack_name +type pack_name = t val to_string : t -> string val of_string : string -> t @@ -22,6 +22,9 @@ val long_of_string : string -> long val make_long : pack_name -> t -> long +(* lift simple string to long WITH EMPTY PACK *) +val out_of_pack : string -> long + val set_dft_pack_name : pack_name -> unit (* TODO: a renommer et a abstraire ?? @@ -47,6 +50,7 @@ val make_idref : pack_name -> t -> idref val string_of_idref : idref -> string +val raw_string_of_idref : idref -> string val of_idref : idref -> t val to_idref : t -> idref @@ -58,6 +62,7 @@ val pack_of_idref : idref -> pack_name option val long_of_idref : idref -> long val idref_of_long : long -> idref +val idref_of_id : t -> idref type clk = idref * t (* The Clock constructor, and the clock variable. diff --git a/src/inline.ml b/src/inline.ml deleted file mode 100644 index 9a8d68f06cb3aa5741669139793aa1fc87929e89..0000000000000000000000000000000000000000 --- a/src/inline.ml +++ /dev/null @@ -1,461 +0,0 @@ -(** Time-stamp: <modified the 01/06/2011 (at 10:48) by Erwan Jahier> *) - - -open Lxm -open Eff - -(********************************************************************************) -(* stuff to create fresh var names. *) -let new_var str node_env type_eff clock_eff = - let id = Ident.of_string (Name.new_local_var str) in - let var = - { - var_name_eff = id; - var_nature_eff = SyntaxTreeCore.VarLocal; - var_number_eff = -1; (* this field is used only for i/o. - Should i rather put something sensible there ? *) - var_type_eff = type_eff; - var_clock_eff = id, clock_eff; - } - in - Hashtbl.add node_env.local.lenv_vars id var; - var - -(********************************************************************************) -(* A small util function followed by a quick unit test. *) -let rec fill i size = if i >= size then [] else i::(fill (i+1) size) -let _ = assert (fill 0 5 = [0;1;2;3;4]) - -let (elt_type_of_array : Eff.type_ list -> Eff.type_) = - function - | [Array_type_eff(t, _)] -> t - | _ -> assert false (* it ougth to be an array... *) - -let rec (list_map3: - ('a -> 'b -> 'c -> 'd) -> 'a list -> 'b list -> 'c list -> 'd list) = - fun f l1 l2 l3 -> - match (l1, l2, l3) with - | ([], [], []) -> [] - | (e1::t1, e2::t2, e3::t3) -> (f e1 e2 e3)::(list_map3 f t1 t2 t3) - | _ -> (* should not occur *) - print_string "*** list_map3 called with lists of different size.\n"; - flush stdout; - assert false - - - -let (check_clock_and_type : - Eff.id_solver -> Lxm.t -> val_exp -> Eff.type_ -> Eff.id_clock -> unit) = - fun id_solver lxm rhs exp_type (_,exp_clock) -> - (* Let's be paranoiac and check types and clocks of the expression - this function generates. - - Moreover, this fills some tables that may be used by - the call to Split.eq below....*) - let rhs, rhs_tl = EvalType.f id_solver rhs in - if (rhs_tl <> [exp_type]) then assert false; - try ignore(EvalClock.f lxm id_solver UnifyClock.empty_subst rhs [exp_clock]) - with _ -> assert false - -(********************************************************************************) -(* The functions below accumulate - (1) the new equations - (2) the fresh variables. - -*) -type inline_acc = (Eff.eq_info srcflagged) list * Eff.var_info list -(* * Eff.node_exp list *) - -let rec (inline_eq: Eff.node_env -> inline_acc -> Eff.eq_info srcflagged -> inline_acc) = - fun node_env (eqs_acc, locs_acc) eq -> - let { src = lxm_eq ; it = (lhs, rhs) } = eq in - let (eqs, locs) = [],[] in - let neqs, nlocs = - match rhs.core with - | CallByPosEff( - {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "map"),sargs)}})}, - OperEff args) - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.Map, sargs)}, OperEff args) - -> - (* Given - - a node n of type: tau_1 * ... * tau_n -> teta_1 * ... * teta_l - - and an integer c - - The profile of map<<node,c>> is: - tau_1^c * ... * tau_n^c -> teta_1^c * ... * teta_l^c - and - - Y1, ... ,Yl = map<<node; c>>(X1,...,Xk) - <=> - for all i = 0, ..., c-1; (Y1[i], ... ,Yl[i]) = N(X_1[i], ... ,X_k[i]) - *) - let (node,c) = match sargs with - | [ConstStaticArgEff(_,Int_const_eff(c)) ; NodeStaticArgEff(_,_node_key, node)] - | [NodeStaticArgEff(_,_node_key,node) ; ConstStaticArgEff(_,Int_const_eff(c))] -> - node, c - | _ -> assert false (* todo: issue an error *) - in - let node = flagit node lxm_ve in - let index_list = fill 0 c in - (List.fold_left - (fun (eqs,locs) i -> - let lhs = List.map - (fun lp -> - let t_elt = elt_type_of_array [type_of_left lp] in - LeftArrayEff(lp, i, t_elt)) - lhs - in - let args = - List.map - (fun arg -> - let targ = arg.typ in - let t_elt = elt_type_of_array targ in - let op_flg = { src = lxm_ve ; it = ARRAY_ACCES(i) } in - let narg = { - core = CallByPosEff(op_flg, OperEff [arg]); - typ = [t_elt]; - clk = arg.clk - } - in - narg - ) - args - in - let nrhs = { rhs with core = - CallByPosEff({ src = lxm_ve ; it = (CALL node)}, OperEff args) } - in - let eq = { src = lxm_eq ; it = (lhs, nrhs) } in - (eq::eqs,locs) - ) - (eqs,locs) - index_list) - - - | CallByPosEff( - {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "red"),sargs)}})}, - OperEff args) - | CallByPosEff( - {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "fill"),sargs)}})}, - OperEff args) - | CallByPosEff( - {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "fillred"),sargs)}})}, - OperEff args) - - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.Fill, sargs)}, OperEff args) - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.Red, sargs)}, OperEff args) - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.FillRed,sargs)}, OperEff args) - -> - (* Given - - a node n of type - tau * tau_1 * ... * tau_n -> tau * teta_1 * ... * teta_l - - a integer c - - the fillred expression has the profile: - tau * tau_1^c * ... * tau_n^c -> tau * teta_1^c * ... * teta_l^c - - acc_out, Y1, ... ,Yl = fillred<<node; c>>(acc_in,X1,...,Xk) - <=> - exists acc_0, ..., acc_c-1, where acc_o=acc_in, and acc_c-1=acc_out - such that, for all i = 0, ..., c-1; - (acc_i+1, Y1[i], ... ,Yl[i]) = N(acc_i,X_1[i], ... ,X_k[i]) - *) - let (id,node,c) = match sargs with - | [ConstStaticArgEff(_,Int_const_eff(c)) ; NodeStaticArgEff(id,_,node)] - | [NodeStaticArgEff(id,_,node) ; ConstStaticArgEff(_,Int_const_eff(c))] -> - id, node, c - | _ -> assert false (* todo: issue an error *) - in - let node = flagit node lxm_ve in - let index_list = fill 0 c in - (* Retreive acc_in and acc_out *) - let acc_out = List.hd lhs in - let lhs = List.tl lhs in - let acc_in = List.hd args in - let args = List.tl args in - let type_exp,clock_exp = - List.hd (acc_in.typ), - List.hd (acc_in.clk) - in - let (acc_vars : var_info list) = - let rec f i acc = - if i = 0 then acc else - f (i-1) ((new_var "acc" node_env type_exp clock_exp)::acc) - in - (* coquetry: reverse the list to have the name in a nice order *) - List.rev(f (c-1) []) - in - let (acc_left_list : left list) = - (List.map (fun vi -> LeftVarEff(vi,lxm_ve)) acc_vars)@[acc_out] - in - let (acc_rigth_list : val_exp list) = - acc_in::( - List.map - (fun vi -> - let id = Ident.to_idref vi.var_name_eff in - let op_flg = { src = lxm_ve ; it = IDENT id } in - let ve = { - typ = [vi.var_type_eff]; - clk = [snd vi.var_clock_eff]; - core = CallByPosEff(op_flg, OperEff []) } - in - ve - ) - acc_vars) - in - let neqs = - list_map3 - (fun i acc_left acc_rigth -> - let args = - List.map - (fun arg -> - let t_elt = elt_type_of_array arg.typ in - let op_flg = {src = lxm_ve ; it = ARRAY_ACCES(i)} in - let new_arg = - { core = CallByPosEff(op_flg, OperEff [arg]); - typ=[t_elt]; - clk=[clock_exp]; - } - in - new_arg - ) - args - in - let args = acc_rigth::args in - let lhs = - List.map - (fun lp -> - let t_elt = elt_type_of_array [type_of_left lp] in - LeftArrayEff(lp,i,t_elt)) - lhs - in - let lhs = acc_left::lhs in - let tl = List.map Eff.type_of_left lhs in - let cl = List.map - (fun l -> (Eff.var_info_of_left l).var_clock_eff) lhs - in - let rhs = { - typ = tl; - clk = List.map snd cl; - core = CallByPosEff({src=lxm_ve;it = (CALL node)}, OperEff args) } - in - let eq = { src = lxm_eq ; it = (lhs, rhs) } in - eq - ) - index_list - acc_left_list - acc_rigth_list - in - (List.rev_append neqs eqs, List.append acc_vars locs) - - - | CallByPosEff( - {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "diese"),_)}})}, - OperEff args) - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.DIESE_n,_)}, OperEff args) -> - (* a diese is a particular kind of boolred: - #(A,...,an) = boolred(1,1,n)([a1,...,an]) - *) - let clk = rhs.clk in - let n = List.length args in - let sargs = [ConstStaticArgEff(Ident.of_string "i",Int_const_eff 1); - ConstStaticArgEff(Ident.of_string "j",Int_const_eff 1); - ConstStaticArgEff(Ident.of_string "k",Int_const_eff n) - ] - in - let boolred_op = Eff.Predef(Predef.BoolRed,sargs) in - let arg = { - typ = [Array_type_eff(Bool_type_eff,n) ]; - clk = clk; - core = CallByPosEff({src=lxm_ve;it= ARRAY args}, OperEff [])} in - let rhs = { - typ = [Bool_type_eff]; - clk = clk; - core = CallByPosEff({src=lxm_ve;it=boolred_op}, OperEff [arg]) } - in - let eq = { src = lxm_eq ; it = (lhs, rhs) } in - inline_eq node_env (eqs, locs) eq - - | CallByPosEff( - {src=lxm_ve;it=CALL ({it = {node_key_eff = (("Lustre", "nor"),_)}})}, - OperEff args) - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.NOR_n,_)}, OperEff args) -> - (* a nor is a particular kind of boolred too: - #(A,...,an) = boolred(0,0,n)([a1,...,an]) - *) - let clk = rhs.clk in - let n = List.length args in - let sargs = [ConstStaticArgEff(Ident.of_string "i",Int_const_eff 0); - ConstStaticArgEff(Ident.of_string "j",Int_const_eff 0); - ConstStaticArgEff(Ident.of_string "k",Int_const_eff n) - ] - in - let boolred_op = Eff.Predef(Predef.BoolRed,sargs) in - let arg = { - typ = [Array_type_eff(Bool_type_eff,n) ]; - clk = clk; - core = CallByPosEff({src=lxm_ve;it=ARRAY args}, OperEff []) } - in - let rhs = { - typ = [Bool_type_eff]; - clk = clk; - core = CallByPosEff({src=lxm_ve;it=boolred_op}, OperEff [arg]) } - in - let eq = { src = lxm_eq ; it = (lhs, rhs) } in - inline_eq node_env (eqs, locs) eq - - | CallByPosEff({src=lxm_ve;it=CALL ( - {it = {node_key_eff = (("Lustre", "boolred"),sargs)}})}, - OperEff args) - | CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.BoolRed,sargs)}, - OperEff args) -> - (* Given - - 3 integers i, j, k - boolref<<i,j,k>> has the profile: bool^n -> bool - - and - res = boolred<<i,j,k>>(A); - <=> - cpt = (if A[0] then 1 else 0) + ... + (if A[k-1] then 1 else 0); - res = i <= cpt && cpt <= j; - *) - let rhs_clk = rhs.clk in - let (i,j,k) = - match sargs with - | [ConstStaticArgEff(_,Int_const_eff i); - ConstStaticArgEff(_,Int_const_eff j); - ConstStaticArgEff(_,Int_const_eff k) - ] -> - (i,j,k) - | _ -> assert false - in - let index_list = fill 0 k in - let lp = try List.hd lhs with Not_found -> assert false in - let res_clock = (Eff.var_info_of_left lp).var_clock_eff in - let cpt = new_var "cpt" node_env Int_type_eff (snd res_clock) in - let id_of_int i = Predef.ICONST_n(Ident.of_string (string_of_int i)) in - let rhs = (* i <= cpt && cpt <= j; *) - let i_op = { it = Predef(id_of_int i,[]) ; src = lxm_ve } - and j_op = { it = Predef(id_of_int j,[]) ; src = lxm_ve } - and cpt_op = { it = IDENT (Ident.to_idref cpt.var_name_eff);src=lxm_ve } - and and_op = { it = Predef(Predef.AND_n,[]) ; src = lxm_ve } - and inf_op = { it = Predef(Predef.LTE_n,[]) ; src = lxm_ve } in - let i_eff = { clk=rhs_clk; typ = [Int_type_eff]; core = CallByPosEff(i_op, OperEff []) } - and j_eff = { clk=rhs_clk; typ = [Int_type_eff]; core = CallByPosEff(j_op, OperEff [])} - and cpt_eff = { clk=rhs_clk; typ = [Int_type_eff]; core = CallByPosEff(cpt_op, OperEff []) } - in - let i_inf_cpt = { clk=rhs_clk; typ = [Bool_type_eff]; - core = CallByPosEff(inf_op,OperEff[i_eff;cpt_eff]) } - and cpt_if_j = { clk=rhs_clk; typ = [Bool_type_eff]; - core = CallByPosEff(inf_op,OperEff[cpt_eff;j_eff]) } - in - { clk=rhs_clk; typ = [Bool_type_eff]; - core = CallByPosEff(and_op, OperEff [i_inf_cpt; cpt_if_j]) } - in - let eq = - check_clock_and_type node_env.global lxm_eq rhs Bool_type_eff res_clock; - { src = lxm_eq ; it = (lhs, rhs) } - in - let eq_cpt = - let lhs = [LeftVarEff(cpt,lxm_ve)] in - (* (if A[0] then 1 else 0) + ... + (if A[k-1] then 1 else 0) *) - let zero = { - clk = rhs_clk; typ = [Int_type_eff]; - core = CallByPosEff({it=Predef(id_of_int 0,[]);src=lxm_ve},OperEff[])} - and one = { - clk = rhs_clk; - typ = [Int_type_eff]; - core = CallByPosEff({it=Predef(id_of_int 1,[]);src=lxm_ve},OperEff[]) } - and plus_op = { it = Predef(Predef.IPLUS_n,[]) ; src = lxm_ve } - and ite_op = { it = Predef(Predef.IF_n,[]) ; src = lxm_ve } - in - let array, type_elt = - match args with - | [arg] -> arg,elt_type_of_array arg.typ - | _ -> assert false - in - let make_ite i = (* returns '(if A[i] then 1 else 0)' *) - let a_op = { it = ARRAY_ACCES(i) ; src = lxm_ve } in - let a_i = { clk = rhs_clk; typ = [type_elt]; - core = CallByPosEff(a_op, OperEff [array]) } - in - let nve = { - clk=rhs_clk; typ = [Int_type_eff]; - core = CallByPosEff(ite_op, OperEff [a_i;one;zero]) } - in - nve - in - let rhs = - List.fold_left - (fun acc i -> - let nve = { - clk=rhs_clk; typ = [Int_type_eff]; - core = CallByPosEff(plus_op, OperEff [acc; make_ite i]) } - in - nve - ) - (make_ite (List.hd index_list)) - (List.tl index_list) - in - check_clock_and_type node_env.global lxm_eq rhs Int_type_eff res_clock; - { src = lxm_eq ; it = (lhs, rhs) } - in - (eq::eq_cpt::eqs, cpt::locs) - - (* All the other operators (trying to avoid a too brutal catch-all...) *) - | CallByPosEff - ({it=( - CALL _| Predef _ |MERGE _|ARRAY_SLICE _|ARRAY_ACCES _|STRUCT_ACCESS _|ARRAY _ - |HAT (_, _)|WITH _|WHEN _|IDENT _|CONCAT|TUPLE - |CURRENT|FBY|ARROW|PRE)}, OperEff args) - -> - let _ = - Verbose.printf ~level:3 "*** Inlining iterators: nothing to do in %s\n" - (LicDump.string_of_val_exp_eff rhs); - flush stdout - in - (eq::eqs, locs) - | CallByNameEff _ -> - (eq::eqs, locs) - in - (* nb: we could recursively inline iterators contained in [OperEff args] ; - but when compiled with !Global.one_op_per_equation, it is not necessary - *) - (* fixpoint *) - let neq = List.hd neqs in - if neq = eq then - (neqs@eqs_acc, nlocs@locs_acc) - else - let locs_acc = nlocs@locs_acc in - let neqs, nlocs = List.split (List.map (inline_eq node_env ([], [])) neqs) in - (List.flatten neqs)@eqs_acc, - (List.flatten nlocs)@locs_acc - -(* exported *) -and (iterators : Eff.node_env -> Eff.node_exp -> Eff.node_exp) = - fun node_env n -> - let _ = - Verbose.printf ~level:3 "*** Inlining iterators of node %s\n" - (LicDump.string_of_node_key_iter n.node_key_eff); - flush stdout - in - match n.def_eff with - | ExternEff - | AbstractEff None -> n - | AbstractEff (Some pn) -> - let node_exp = iterators node_env pn in - { n with def_eff = AbstractEff (Some node_exp) } - | BodyEff b -> - Name.reset_local_var_prefix "acc"; - Name.reset_local_var_prefix "cpt"; - let nv = match n.loclist_eff with None -> [] | Some l -> l in - let (neqs, nv) = - List.fold_left (inline_eq node_env) ([], nv) b.eqs_eff - in - let nb = { b with eqs_eff = List.rev neqs } in - let res = - { n with - loclist_eff = Some nv; - def_eff = BodyEff nb - } - in - res diff --git a/src/inline.mli b/src/inline.mli deleted file mode 100644 index 83986dda7911e27ba93c7a9fe124530ee19283ec..0000000000000000000000000000000000000000 --- a/src/inline.mli +++ /dev/null @@ -1,11 +0,0 @@ -(** Time-stamp: <modified the 30/05/2011 (at 17:12) by Erwan Jahier> *) - - -(** Inline (expand) iterators. - - The node local_env is provided so that we can update its table, as - we add some fresh local variables during the code transmation. - -*) -val iterators : Eff.node_env -> Eff.node_exp -> Eff.node_exp -(* * Eff.node_exp list *) diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index 2c88c838aa55a762808fe730d3e74891aabfeb0d..90c79a37e4c586af7f286b932f162f48aff64a6b 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -7,6 +7,9 @@ open SyntaxTree open SyntaxTreeCore open Eff +(** DEBUG FLAG POUR CE MODULE : *) +let dbg = Some (Verbose.get_flag "lazyc") + let finish_me msg = print_string ("\n\tXXX LazyCompiler:"^msg^" -> finish me!\n") (******************************************************************************) @@ -49,23 +52,27 @@ let (create : SyntaxTab.t -> t) = fun tbl -> let nodes_tbl = Hashtbl.create 0 in let prov_nodes_tbl = Hashtbl.create 0 in +(* GESTION DES OP PREDEF LAISSE A DESIRER ! + 12/07 on garde cette beqyuille, mais faudra + sans doute revoir plus globalement ... +*) List.iter - (fun op -> + (fun op -> let op_str = Predef.op2string op in - let op_eff = PredefEvalType.make_node_exp_eff None op (Lxm.dummy op_str) [] in + let op_eff = PredefEvalType.make_simple_node_exp_eff None op (Lxm.dummy op_str) in let op_key = Predef.op_to_long op, [] in Hashtbl.add nodes_tbl op_key (Eff.Checked op_eff); Hashtbl.add prov_nodes_tbl op_key (Eff.Checked op_eff) - ) - Predef.iterable_op; + ) + Predef.iterable_op; { - src_tab = tbl; - types = Hashtbl.create 0; - consts = Hashtbl.create 0; - nodes = nodes_tbl; - prov_types = Hashtbl.create 0; - prov_consts = Hashtbl.create 0; - prov_nodes = prov_nodes_tbl; + src_tab = tbl; + types = Hashtbl.create 0; + consts = Hashtbl.create 0; + nodes = nodes_tbl; + prov_types = Hashtbl.create 0; + prov_consts = Hashtbl.create 0; + prov_nodes = prov_nodes_tbl; } (******************************************************************************) @@ -121,9 +128,9 @@ let (create : SyntaxTab.t -> t) = o tabulates its result o takes an x_key and returns an [x_eff] o lookups its (syntaxic) definition (x_info) via the symbolTab.t - o calls [GetEff.X] to translate its sub-terms + o calls [GetEff.of_X] to translate its sub-terms - - [GetEff.X] + - [GetEff.of_X] o takes a [x_exp] (i.e., an expression) and returns an [x_eff] o compute the effective static args (for nodes) o calls [solve_x_idref] (via [id_solver]) to translate its sub-terms @@ -151,45 +158,64 @@ let (create : SyntaxTab.t -> t) = functions will lead to the definition of 6 functions: [type_check], [const_check], [node_check], [type_check_interface], [const_check_interface], [node_check_interface]. + *) let x_check - tab find_x x_check_do lookup_x_eff pack_of_x_key name_of_x_key this x_key lxm = - try lookup_x_eff tab x_key lxm - with Not_found -> - Hashtbl.add tab x_key Eff.Checking; - let (x_pack,xn) = (pack_of_x_key x_key, name_of_x_key x_key) in - let x_pack_symbols = SyntaxTab.pack_body_env this.src_tab x_pack in - let x_def = match find_x x_pack_symbols xn lxm with - | SymbolTab.Local x_def -> x_def - | SymbolTab.Imported (lid,_) -> - print_string ("*** " ^ (Ident.string_of_long lid) ^ "???\n" ^ - (Lxm.details lxm)); - assert false (* should not occur *) - in - let res = x_check_do this x_key lxm x_pack_symbols false x_pack x_def in + (* tab find_x x_check_do lookup_x_eff pack_of_x_key name_of_x_key this x_key lxm = *) + (tab : ('x_key, 'x_eff Eff.check_flag) Hashtbl.t) + (find_x : SymbolTab.t -> Ident.t -> Lxm.t -> ('x_info Lxm.srcflagged) SymbolTab.elt) + (x_check_do : t -> 'x_key -> Lxm.t -> SymbolTab.t -> bool -> Ident.pack_name -> 'x_info srcflagged -> 'x_eff) + (x_builtin : t -> 'x_key -> Lxm.t -> 'x_eff) + (lookup_x_eff : ('x_key, 'x_eff Eff.check_flag) Hashtbl.t -> 'x_key -> Lxm.t -> 'x_eff) + (pack_of_x_key : 'x_key -> string ) + (name_of_x_key : 'x_key -> string) + (this : t) + (x_key : 'x_key) + (lxm : Lxm.t) +: 'x_eff = + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.x_check '%s'\n" (Lxm.details lxm); + try lookup_x_eff tab x_key lxm + with Not_found -> ( + let res = try x_builtin this x_key lxm + with Not_found -> + Hashtbl.add tab x_key Eff.Checking; + let (x_pack,xn) = (pack_of_x_key x_key, name_of_x_key x_key) in + let x_pack_symbols = SyntaxTab.pack_body_env this.src_tab x_pack in + let x_def = match find_x x_pack_symbols xn lxm with + | SymbolTab.Local x_def -> x_def + | SymbolTab.Imported (lid,_) -> + print_string ("*** " ^ (Ident.string_of_long lid) ^ "???\n" ^ + (Lxm.details lxm)); + assert false (* should not occur *) + in + x_check_do this x_key lxm x_pack_symbols false x_pack x_def + in Hashtbl.replace tab x_key (Eff.Checked res); res + ) let x_check_interface - tab find_x x_check x_check_interface_do lookup_x_eff + tab find_x x_check x_check_interface_do x_builtin lookup_x_eff pack_of_x_key name_of_x_key this x_key lxm = try lookup_x_eff tab x_key lxm with Not_found -> - Hashtbl.add tab x_key Eff.Checking; - let (xp,xn) = (pack_of_x_key x_key, name_of_x_key x_key) in - let xp_prov_symbols_opt = SyntaxTab.pack_prov_env this.src_tab xp lxm in - let res = (* [xp] migth have no provided symbol table *) - match xp_prov_symbols_opt with - | None -> - (* if [xp] have no provided symbol table, the whole package is exported. *) - x_check this x_key lxm - | Some xp_prov_symbols -> - let x_def = match find_x xp_prov_symbols xn lxm with - | SymbolTab.Local x -> x - | SymbolTab.Imported _ -> assert false (* should not occur *) - in - x_check_interface_do this x_key lxm xp_prov_symbols xp x_def - in + let res = ( + try x_builtin this x_key lxm + with Not_found -> + Hashtbl.add tab x_key Eff.Checking; + let (xp,xn) = (pack_of_x_key x_key, name_of_x_key x_key) in + let xp_prov_symbols_opt = SyntaxTab.pack_prov_env this.src_tab xp lxm in + match xp_prov_symbols_opt with + | None -> + (* if [xp] have no provided symbol table, the whole package is exported. *) + x_check this x_key lxm + | Some xp_prov_symbols -> + let x_def = match find_x xp_prov_symbols xn lxm with + | SymbolTab.Local x -> x + | SymbolTab.Imported _ -> assert false (* should not occur *) + in + x_check_interface_do this x_key lxm xp_prov_symbols xp x_def + ) in Hashtbl.replace tab x_key (Eff.Checked res); res @@ -206,47 +232,68 @@ let (lookup_type_eff: (Eff.item_key, Eff.type_ Eff.check_flag) Hashtbl.t -> Ident.long -> Lxm.t -> Eff.type_) = lookup_x_eff "type ref " (fun k -> k) + +let (type_builtin : t -> Ident.long -> Lxm.t -> Eff.type_) = +fun _ _ _ -> raise Not_found + let (lookup_const_eff:(Eff.item_key, Eff.const Eff.check_flag) Hashtbl.t -> Ident.long -> Lxm.t -> Eff.const) = lookup_x_eff "const ref " (fun k -> k) -let (lookup_node_exp_eff: - (Eff.node_key, Eff.node_exp Eff.check_flag) Hashtbl.t -> - Eff.node_key -> Lxm.t -> Eff.node_exp) = - fun tbl key lxm -> - try +let (const_builtin : t -> Ident.long -> Lxm.t -> Eff.const) = +fun _ _ _ -> raise Not_found + +(* +LES NOEUDS (MACROS) BUILD-IN +sont trackés ici pour court-circuiter le node_check normal +(qui nécessite un node_info) +*) +let lookup_node_exp_eff + (tbl: (Eff.node_key, Eff.node_exp Eff.check_flag) Hashtbl.t) + (key: Eff.node_key) + (lxm: Lxm.t) +: Eff.node_exp = + try let node_exp = lookup_x_eff "node ref " (fun k -> fst k) tbl key lxm in - Verbose.exe ~level:3 - (fun () -> - Printf.printf "\n*** %s Founded! \n" (LicDump.string_of_node_key_iter key); - flush stdout - ); - node_exp - with - Not_found -> - if fst (fst key) = "Lustre" then ( - let msg = (LicDump.string_of_node_key_iter key) ^ ": unknown Lustre operator. "^ - "\n*** Available operators in the current scope are:\n" ^ - (Hashtbl.fold (fun nk _ acc -> acc ^ - ("\t - "^ (LicDump.string_of_node_key_iter nk) ^ "\n")) tbl "") - in - raise (Compile_error(lxm, msg)) - ) - else - ( - Verbose.exe ~level:3 - ( fun () -> - Printf.printf "\n*** Don't find %s in " - (LicDump.string_of_node_key_iter key); - Hashtbl.iter (fun nk _ -> - Printf.printf "%s, " (LicDump.string_of_node_key_iter nk); - ) tbl; - flush stdout - ); - raise Not_found - ) -(* lookup_x_eff "node ref " (fun k -> fst k) *) + Verbose.printf ~flag:dbg + "#DBG: LazyCompiler.lookup_node_exp_eff: FOUND node key '%s'\n" + (Eff.string_of_node_key key) + ; + node_exp + with Not_found -> ( + Verbose.exe ~flag:dbg ( + fun () -> + Printf.fprintf stderr "#DBG: LazyCompiler.lookup_node_exp_eff: node key '%s' NOT FOUND\n" + (Eff.string_of_node_key key); + flush stderr + ); + raise Not_found + ) + +let node_builtin + (this: t) + (key: Eff.node_key) + (lxm: Lxm.t) +: Eff.node_exp = + (* 12/07 *) + (* ICI => courtcircuite les macros built-in *) + let nk2nd = fun nk -> + try + match Hashtbl.find this.nodes nk with + | Eff.Checked res -> res + | _ -> assert false + with Not_found -> assert false + in + let node_exp = BuiltIn.do_node nk2nd key lxm in + Verbose.printf ~flag:dbg + "#DBG: LazyCompiler.lookup_node_exp_eff: BUILT-IN node key '%s'\n" + (Eff.string_of_node_key key) + ; + Hashtbl.replace this.nodes key (Eff.Checked node_exp); + Hashtbl.replace this.prov_nodes key (Eff.Checked node_exp); + node_exp +(* lookup_x_eff "node ref " (fun k -> fst k) *) (** This function performs the identifier (idref) resolution, @@ -270,9 +317,10 @@ let solve_x_idref try match (find_x symbols s lxm) with | SymbolTab.Local x_info -> + let x_key = to_x_key currpack s in if provide_flag - then x_check_interface this (to_x_key currpack s) lxm - else x_check this (to_x_key currpack s) lxm + then x_check_interface this x_key lxm + else x_check this x_key lxm | SymbolTab.Imported(fid,params) -> let (pi,si) = (Ident.pack_of_long fid, Ident.of_long fid) in @@ -298,30 +346,50 @@ let find_var_info lxm vars id = (* And now we can start the big mutually recursive definition... *) (** Tabulated version of [type_check_do]. *) -let rec (type_check : t -> Ident.long -> Lxm.t -> Eff.type_) = - fun this -> - x_check this.types SymbolTab.find_type type_check_do lookup_type_eff +let rec type_check + (this: t) + (key: Ident.long) + (lxm: Lxm.t) +: Eff.type_ = + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.type_check '%s'\n" (Ident.string_of_long2 key); + x_check this.types SymbolTab.find_type type_check_do type_builtin lookup_type_eff Ident.pack_of_long Ident.of_long this + key lxm (** Tabulated version of [const_check_do]. *) -and (const_check : t -> Ident.long -> Lxm.t -> Eff.const) = - fun this -> - x_check this.consts SymbolTab.find_const const_check_do lookup_const_eff +and const_check + (this: t) + (key: Ident.long) + (lxm: Lxm.t) +: Eff.const = + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.const_check '%s'\n" (Ident.string_of_long2 key); + x_check this.consts SymbolTab.find_const const_check_do const_builtin lookup_const_eff Ident.pack_of_long Ident.of_long this + key lxm (** Tabulated version of [type_check_interface_do]. *) -and (type_check_interface: t -> Ident.long -> Lxm.t -> Eff.type_) = - fun this -> +and type_check_interface + (this: t) + (key: Ident.long) + (lxm: Lxm.t) +: Eff.type_ = + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.type_check_interface '%s'\n" (Ident.string_of_long2 key); x_check_interface this.prov_types SymbolTab.find_type type_check type_check_interface_do - lookup_type_eff Ident.pack_of_long Ident.of_long this + type_builtin lookup_type_eff Ident.pack_of_long Ident.of_long this + key lxm (** Tabulated version of [const_check_interface_do]. *) -and (const_check_interface: t -> Ident.long -> Lxm.t -> Eff.const) = - fun this -> +and const_check_interface + (this: t) + (key: Ident.long) + (lxm: Lxm.t) +: Eff.const = + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.const_check_interface '%s'\n" (Ident.string_of_long2 key); x_check_interface this.prov_consts SymbolTab.find_const const_check const_check_interface_do - lookup_const_eff Ident.pack_of_long Ident.of_long this + const_builtin lookup_const_eff Ident.pack_of_long Ident.of_long this + key lxm (** solving type and constant references *) and (solve_type_idref : t -> SymbolTab.t -> bool -> Ident.pack_name -> @@ -359,9 +427,9 @@ and (type_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> raise(Compile_error ( type_def.src, ("provided type \n\t" ^ - (LicDump.string_of_type_eff4msg prov_type_eff) ^ + (Eff.string_of_type prov_type_eff) ^ "\n is not compatible with its implementation \n\t" ^ - (LicDump.string_of_type_eff4msg body_type_eff)))) + (Eff.string_of_type body_type_eff)))) and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> @@ -386,9 +454,9 @@ and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> raise(Compile_error ( const_def.src, ("provided constant type \n***\t" ^ - (LicDump.string_of_type_eff4msg teff) ^ + (Eff.string_of_type teff) ^ " is not compatible with its implementation \n***\t" ^ - (LicDump.string_of_type_eff4msg body_teff) ^ ""))) + (Eff.string_of_type body_teff) ^ ""))) else if is_exported then @@ -403,9 +471,9 @@ and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> raise(Compile_error ( const_def.src, ("provided constant type \n***\t" ^ - (LicDump.string_of_type_eff4msg teff) ^ + (Eff.string_of_type teff) ^ " is not compatible with its implementation \n***\t" ^ - (LicDump.string_of_type_eff4msg body_teff) ^ ""))) + (Eff.string_of_type body_teff) ^ ""))) else if is_exported && body_const_eff <> v then raise(Compile_error (const_def.src, " constant values mismatch")) @@ -425,6 +493,9 @@ and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> raise(Compile_error ( const_def.src, "\n*** provided constant does not match with its definition.")) + | Eff.Tuple_const_eff _, _ -> + print_internal_error "LazyCompiler.const_check_interface_do" "should not have been called for a tuple"; + assert false and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> @@ -438,7 +509,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> id2const = solve_const_idref this symbols provide_flag pack_name; id2type = solve_type_idref this symbols provide_flag pack_name; id2node = solve_node_idref this symbols provide_flag pack_name; - symbols = symbols; + global_symbols = symbols; } in let type_eff = @@ -452,7 +523,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> with e -> External_type_eff (lid) ) - | AliasedType (s, texp) -> GetEff.typ id_solver texp + | AliasedType (s, texp) -> GetEff.of_type id_solver texp | EnumType (s, clst) -> ( let n = Ident.make_long pack_name s in let add_pack_name x = Ident.make_long pack_name x.it in @@ -461,7 +532,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> | StructType sti -> ( let make_field (fname : Ident.t) = let field_def = Hashtbl.find sti.st_ftable fname in - let teff = GetEff.typ id_solver field_def.it.fd_type in + let teff = GetEff.of_type id_solver field_def.it.fd_type in match field_def.it.fd_value with | None -> (fname, (teff, None)) | Some vexp -> ( @@ -473,8 +544,8 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> raise (Compile_error(field_def.src, Printf.sprintf " this field is declared as '%s' but evaluated as '%s'" - (LicDump.string_of_type_eff4msg teff) - (LicDump.string_of_type_eff4msg tv))) + (Eff.string_of_type teff) + (Eff.string_of_type tv))) ) | [] -> assert false (* should not occur *) | _::_ -> @@ -490,7 +561,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> let is_struct_or_array = match type_eff with | Array_type_eff(_) | Struct_type_eff(_) -> true - | Any | Overload | Bool_type_eff | Int_type_eff | Real_type_eff + | TypeVar _ | Bool_type_eff | Int_type_eff | Real_type_eff | External_type_eff(_) | Abstract_type_eff(_) | Enum_type_eff(_) -> false in @@ -499,7 +570,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> && (not (!Global.expand_structs & is_struct_or_array)) (* && not !Global.ec (* ec does not need type decl at all *) *) then - output_string !Global.oc (LicDump.type_decl type_name type_eff); + (); type_eff ) with @@ -523,14 +594,14 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> id2const = solve_const_idref this symbols provide_flag currpack; id2type = solve_type_idref this symbols provide_flag currpack; id2node = solve_node_idref this symbols provide_flag currpack; - symbols = symbols; + global_symbols = symbols; } in let const_eff = match const_def.it with | ExternalConst (id, texp, val_opt) -> let lid = Ident.make_long currpack id in - let teff = GetEff.typ id_solver texp in + let teff = GetEff.of_type id_solver texp in if provide_flag then match val_opt with | None -> @@ -555,7 +626,7 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> (* indeed, how can a body constant be extern and have a value? *) ) | EnumConst (id, texp) -> - Enum_const_eff ((Ident.make_long currpack id), GetEff.typ id_solver texp) + Enum_const_eff ((Ident.make_long currpack id), GetEff.of_type id_solver texp) | DefinedConst (id, texp_opt, vexp ) -> ( match (EvalConst.f id_solver vexp) with @@ -563,14 +634,14 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> match texp_opt with | None -> ceff | Some texp -> ( - let tdecl = GetEff.typ id_solver texp in + let tdecl = GetEff.of_type id_solver texp in let teff = Eff.type_of_const ceff in if (tdecl = teff ) then ceff else raise (Compile_error (const_def.src, Printf.sprintf " this constant is declared as '%s' but evaluated as '%s'" - (LicDump.string_of_type_eff4msg tdecl) - (LicDump.string_of_type_eff4msg teff) + (Eff.string_of_type tdecl) + (Eff.string_of_type teff) ))) ) | [] -> assert false (* should not occur *) @@ -579,9 +650,9 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> ) in let is_struct_or_array = match const_eff with - | Struct_const_eff _ -> true - | Array_const_eff _ -> true - | _ -> false + | Struct_const_eff _ -> true + | Array_const_eff _ -> true + | _ -> false in let is_extern_const = match const_eff with @@ -598,8 +669,7 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool -> && (not !Global.ec) (* ec does not need constant decl, except extern ones *) ) || is_extern_const then - output_string !Global.oc (LicDump.const_decl cn const_eff); - + (); const_eff ) with Recursion_error (root, stack) -> ( (* capte et complete/stoppe les recursions *) @@ -617,6 +687,11 @@ and (node_check_interface_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> SyntaxTreeCore.node_info srcflagged -> Eff.node_exp) = fun this nk lxm symbols pn node_def -> + (* DEUX checks : + - le "complet" donne 'body_node_exp_eff' qui sera stocké comme le vrai résultat + - le "provide" donne 'prov_node_exp_eff', non stocké, sert à vérifier la + cohérence avec l'éventuelle déclaration 'provide' + *) let body_node_exp_eff = node_check this nk lxm in let prov_node_exp_eff = node_check_do this nk lxm symbols true pn node_def in (** [type_eff_are_compatible t1 t2] checks that t1 is compatible with t2, i.e., @@ -626,7 +701,7 @@ and (node_check_interface_do: t -> Eff.node_key -> Lxm.t -> ("provided node for " ^ (Ident.string_of_long (fst nk)) ^ " is not compatible with its implementation: ") in - let str_of_var = LicDump.type_string_of_var_info_eff4msg in + let str_of_var = Eff.string_of_var_info in let type_is_not_comp v1 v2 = not (Eff.var_are_compatible v1 v2) in (* Checking the type profile (w.r.t the body and the provided part) *) @@ -637,13 +712,6 @@ and (node_check_interface_do: t -> Eff.node_key -> Lxm.t -> in let topt = UnifyType.profile_is_compatible nk node_def.src (iptypes,ibtypes) (optypes,obtypes) - in - let _ = - (* the type profile seems ok, but it may need to unfreeze some - polymorphic nodes *) - match topt with - | None -> () - | Some t -> GetEff.dump_polymorphic_nodes t in if prov_node_exp_eff.node_key_eff <> body_node_exp_eff.node_key_eff @@ -692,21 +760,38 @@ and (node_check_interface_do: t -> Eff.node_key -> Lxm.t -> | _,_ -> prov_node_exp_eff -and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> - bool -> Ident.pack_name -> SyntaxTreeCore.node_info srcflagged -> - Eff.node_exp) = - fun this nk lxm symbols provide_flag pack_name node_def -> +(* +LE GROS DU BOULOT +- suivant "provide_flag" : check d'interface (provide) ou le check de la définition + (n.b. provide_flag influence la résolution des idents dans l'env local de check) +*) +and node_check_do + (this: t) + (nk: Eff.node_key) + (lxm: Lxm.t) + (symbols: SymbolTab.t) + (provide_flag: bool) + (pack_name: Ident.pack_name) + (node_def: SyntaxTreeCore.node_info srcflagged) + : Eff.node_exp = +(* START node_check_do *) +( + Verbose.printf ~flag:dbg + "#DBG: ENTERING node_check_do '%s'\n (%s)\n" + (Eff.string_of_node_key nk) + (Lxm.details lxm) + ; let lxm = node_def.src in (* Creates a local_env with just the global bindings, local bindinds will be added later (side effect) *) let local_env = make_local_env nk in let _ = - Verbose.exe ~level:3 + Verbose.exe ~flag:dbg ( fun () -> - Printf.printf "*** local_env while entering (node_check_do %s):\n" - (LicDump.string_of_node_key_rec nk); - LicDump.dump_local_env local_env; + Printf.printf "# local_env while entering (node_check_do %s):\n" + (Eff.string_of_node_key nk); + Eff.dump_local_env stderr local_env; flush stdout ) in @@ -724,7 +809,8 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> (fun id lxm -> try lookup_const local_env id lxm with Not_found -> - solve_const_idref this symbols provide_flag pack_name id lxm); + solve_const_idref this symbols provide_flag pack_name id lxm + ); id2type = (fun id lxm -> try lookup_type local_env id lxm @@ -743,9 +829,9 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> id2node = (fun id sargs lxm -> (try - let (node_id,sargs), inlist, outlist = lookup_node local_env id sargs lxm in - let node_id = Ident.idref_of_long node_id in - solve_node_idref this symbols provide_flag pack_name node_id sargs lxm + let (node_id,sargs) = Eff.lookup_node local_env id sargs lxm in + let node_id = Ident.idref_of_long node_id in + solve_node_idref this symbols provide_flag pack_name node_id sargs lxm (* node_check this (node_id,[]) lxm *) with @@ -754,7 +840,9 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> | _ -> assert false) ); - symbols = symbols; + (* ATTENTION EN SE SERVANT DE CA ! + ne tient pas compte des params statiques du noeud ! *) + global_symbols = symbols; } in let make_node_eff id node_def_eff = ( @@ -762,7 +850,7 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> Verbose.exe ~level:3 ( fun () -> Printf.printf "*** local_env while entering (make_node_eff %s):\n" (Ident.to_string id); - LicDump.dump_local_env local_env + Eff.dump_local_env stderr local_env ); (********************************************************) (* LOCAL CONSTANTS are evaluated and added to local_env *) @@ -770,120 +858,120 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> (* init intermediate table *) let sz = List.length node_def.it.loc_consts in let temp_const_eff_tab : (Ident.long, Eff.const Eff.check_flag) Hashtbl.t = - Hashtbl.create sz + Hashtbl.create sz in let temp_const_def_tab : (Ident.t,(Lxm.t * SyntaxTreeCore.type_exp option * SyntaxTreeCore.val_exp)) Hashtbl.t = - Hashtbl.create sz + Hashtbl.create sz in let init_local_const (lxm, cinfo) = ( - match cinfo with - | DefinedConst (i,topt,ve) -> ( - Verbose.printf ~level:3 " * local const %s will be treated\n" i; - Hashtbl.add temp_const_def_tab i (lxm,topt,ve) - ) - | ExternalConst _ - | EnumConst _ -> ( - let msg = "*** abstract constant bot allowed within node " - in - raise (Compile_error(lxm, msg)) - ) + match cinfo with + | DefinedConst (i,topt,ve) -> ( + Verbose.printf ~level:3 " * local const %s will be treated\n" i; + Hashtbl.add temp_const_def_tab i (lxm,topt,ve) + ) + | ExternalConst _ + | EnumConst _ -> ( + let msg = "*** abstract constant bot allowed within node " + in + raise (Compile_error(lxm, msg)) + ) ) in - List.iter init_local_const node_def.it.loc_consts ; - (* differs from node_id_solver only on id2const *) - let rec local_id_solver = { + List.iter init_local_const node_def.it.loc_consts ; + (* differs from node_id_solver only on id2const *) + let rec local_id_solver = { id2var = node_id_solver.id2var; id2const = local_id2const; id2type = node_id_solver.id2type; id2node = node_id_solver.id2node; - symbols = node_id_solver.symbols; - } - and treat_local_const id = ( - Verbose.printf ~level:3 " * call treat_local_const %s\n" id; - let id_key = ("", id) in - try ( - let ce = lookup_const_eff temp_const_eff_tab id_key lxm in - Verbose.printf ~level:3 " * const %s already treated = %s\n" + global_symbols = node_id_solver.global_symbols; + } + and treat_local_const id = ( + Verbose.printf ~level:3 " * call treat_local_const %s\n" id; + let id_key = ("", id) in + try ( + let ce = lookup_const_eff temp_const_eff_tab id_key lxm in + Verbose.printf ~level:3 " * const %s already treated = %s\n" id (LicDump.string_of_const_eff ce); - ce - ) with Not_found -> ( - let (lxmdef, toptdef, vedef) = Hashtbl.find temp_const_def_tab id in - Verbose.printf ~level:3 " * const %s not yet treated ...\n" id ; - (* yes, not yet checked *) - Hashtbl.add temp_const_eff_tab id_key Checking ; - (* computes the value with EvalConst.f id_solver ve ... *) - let ce = match (EvalConst.f local_id_solver vedef) with - | [ceff] -> ( - match toptdef with - | None -> ceff - | Some texp -> ( - let tdecl = GetEff.typ local_id_solver texp in - let teff = Eff.type_of_const ceff in - if (tdecl = teff ) then ceff else - raise (Compile_error ( + ce + ) with Not_found -> ( + let (lxmdef, toptdef, vedef) = Hashtbl.find temp_const_def_tab id in + Verbose.printf ~level:3 " * const %s not yet treated ...\n" id ; + (* yes, not yet checked *) + Hashtbl.add temp_const_eff_tab id_key Checking ; + (* computes the value with EvalConst.f id_solver ve ... *) + let ce = match (EvalConst.f local_id_solver vedef) with + | [ceff] -> ( + match toptdef with + | None -> ceff + | Some texp -> ( + let tdecl = GetEff.of_type local_id_solver texp in + let teff = Eff.type_of_const ceff in + if (tdecl = teff ) then ceff else + raise (Compile_error ( lxmdef, Printf.sprintf - " this constant is declared as '%s' but evaluated as '%s'" - (LicDump.string_of_type_eff4msg tdecl) - (LicDump.string_of_type_eff4msg teff) - ))) - ) - | [] -> assert false (* should not occur *) - | _::_ -> raise (Compile_error(lxmdef, "bad constant value: tuple not allowed")) - in - Verbose.printf ~level:3 " * const %s evaluated to %s\n" + " this constant is declared as '%s' but evaluated as '%s'" + (Eff.string_of_type tdecl) + (Eff.string_of_type teff) + ))) + ) + | [] -> assert false (* should not occur *) + | _::_ -> raise (Compile_error(lxmdef, "bad constant value: tuple not allowed")) + in + Verbose.printf ~level:3 " * const %s evaluated to %s\n" id (LicDump.string_of_const_eff ce); - Hashtbl.replace temp_const_eff_tab id_key (Checked ce) ; - ce - ) - ) - and local_id2const idrf lxm = ( - (* is id a local const ? *) - try ( - (* certainly NOT if id has a pack *) - let id = if (Ident.pack_of_idref idrf = None) - then Ident.name_of_idref idrf - else raise Not_found - in - let ce = treat_local_const id in - ce - ) with Not_found -> ( - (* not a local constant -> search in global env *) - Verbose.printf ~level:3 " * %s not a local const, should be global ?" (Ident.string_of_idref idrf); - let ce = node_id_solver.id2const idrf lxm in - Verbose.printf ~level:3 " YES -> %s\n" (LicDump.string_of_const_eff ce); - ce - ) - ) in - (* iters local_id2const n eeach declared constant *) - Hashtbl.iter (fun id _ -> let _ = treat_local_const id in ()) temp_const_def_tab ; - (* Finally, adds each local const to ICI *) - let add_local_const idref ceck = ( - Verbose.printf ~level:3 " * add_local_const %s = %s\n" - (snd idref) - (match ceck with - | Checking -> "Checking" - | Checked ce -> (LicDump.string_of_const_eff ce) - | Incorrect -> "Incorrect" - ); - match ceck with - | Checked ce -> Hashtbl.add local_env.lenv_const (snd idref) ce - | _ -> assert false - ) in - Hashtbl.iter add_local_const temp_const_eff_tab ; + Hashtbl.replace temp_const_eff_tab id_key (Checked ce) ; + ce + ) + ) + and local_id2const idrf lxm = ( + (* is id a local const ? *) + try ( + (* certainly NOT if id has a pack *) + let id = if (Ident.pack_of_idref idrf = None) + then Ident.name_of_idref idrf + else raise Not_found + in + let ce = treat_local_const id in + ce + ) with Not_found -> ( + (* not a local constant -> search in global env *) + Verbose.printf ~level:3 " * %s not a local const, should be global ?" (Ident.string_of_idref idrf); + let ce = node_id_solver.id2const idrf lxm in + Verbose.printf ~level:3 " YES -> %s\n" (LicDump.string_of_const_eff ce); + ce + ) + ) in + (* iters local_id2const n eeach declared constant *) + Hashtbl.iter (fun id _ -> let _ = treat_local_const id in ()) temp_const_def_tab ; + (* Finally, adds each local const to ICI *) + let add_local_const idref ceck = ( + Verbose.printf ~level:3 " * add_local_const %s = %s\n" + (snd idref) + (match ceck with + | Checking -> "Checking" + | Checked ce -> (LicDump.string_of_const_eff ce) + | Incorrect -> "Incorrect" + ); + match ceck with + | Checked ce -> Hashtbl.add local_env.lenv_const (snd idref) ce + | _ -> assert false + ) in + Hashtbl.iter add_local_const temp_const_eff_tab ; - (********************************************************) + (********************************************************) (* LOCAL FLOWS are added to local_env *) - (********************************************************) + (********************************************************) (* (i.e. ins,outs,locs) *) match node_def.it.vars with | None -> assert false (* a node with a body should have a profile *) | Some vars -> - let is_polymorphic = ref false in + (* let is_polymorphic = ref false in *) let type_args id = let vi = find_var_info lxm vars id in - let t_eff = GetEff.typ node_id_solver vi.it.var_type in - let _ = if Eff.is_polymorphic t_eff then is_polymorphic := true in - let c_eff = GetEff.clock node_id_solver vi.it in + let t_eff = GetEff.of_type node_id_solver vi.it.var_type in + (* let _ = if Eff.is_polymorphic t_eff then is_polymorphic := true in *) + let c_eff = GetEff.of_clock node_id_solver vi.it in let vi_eff = { var_name_eff = vi.it.var_name; var_nature_eff = vi.it.var_nature; @@ -965,7 +1053,7 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> def_eff = node_def_eff (); has_mem_eff = node_def.it.has_mem; is_safe_eff = node_def.it.is_safe; - is_polym_eff = !is_polymorphic + (* is_polym_eff = !is_polymorphic *) } ) in (* let's go *) @@ -979,10 +1067,10 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> after the local_env.lenv_vars has been filled *) - let eq_eff = List.map (GetEff.eq node_id_solver) nb.eqs in + let eq_eff = List.map (GetEff.of_eq node_id_solver) nb.eqs in BodyEff { asserts_eff = - List.map (GetEff.assertion node_id_solver) nb.asserts; + List.map (GetEff.of_assertion node_id_solver) nb.asserts; eqs_eff = eq_eff; } ) @@ -991,21 +1079,29 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> | Alias({it= alias;src=lxm}) -> ( let aliased_node = match alias with - | Predef_n((Predef.NOR_n|Predef.DIESE_n), sargs) -> - raise (Compile_error (lxm, "Can not alias 'nor' nor '#', sorry")) - - | Predef_n(predef_op, sargs) -> - let sargs_eff = - GetEff.translate_predef_static_args node_id_solver sargs lxm - in - let predef_op_eff = - PredefEvalType.make_node_exp_eff - (Some node_def.it.has_mem) predef_op lxm sargs_eff - in - predef_op_eff - + (* 12/07 SOLUTION INTERMEDIAIRE + - les macros predefs sont traitées comme des call + *) + | Predef_n(op, []) -> + let predef_op = op.it in + let _ = match predef_op with + | Predef.NOR_n | Predef.DIESE_n -> + raise (Compile_error (lxm, "Can not alias 'nor' nor '#', sorry")) + | _ -> () + in + let predef_op_eff = + PredefEvalType.make_node_exp_eff node_id_solver + (Some node_def.it.has_mem) predef_op lxm [] + in + predef_op_eff + | Predef_n(op, sargs) -> + (* on re-construit une SyntaxTreeCore.node_exp srcflagged + parce que c'est ca qu'attend of_node ... + *) + let node_alias = flagit (Predef.op_to_idref op.it, sargs) op.src in + GetEff.of_node node_id_solver node_alias | CALL_n(node_alias) -> - GetEff.node node_id_solver node_alias + GetEff.of_node node_id_solver node_alias | (MERGE_n _|ARRAY_SLICE_n _|ARRAY_ACCES_n _|STRUCT_ACCESS_n _ |IDENT_n _|ARRAY_n|HAT_n|CONCAT_n|WITH_n(_)|TUPLE_n|WHEN_n _ |CURRENT_n|FBY_n|ARROW_n|PRE_n) @@ -1024,7 +1120,7 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> List.map (fun id -> find_var_info lxm vars id) vars.SyntaxTreeCore.inlist, List.map (fun id -> find_var_info lxm vars id) vars.SyntaxTreeCore.outlist in - let aux vi = GetEff.typ node_id_solver vi.it.var_type in + let aux vi = GetEff.of_type node_id_solver vi.it.var_type in let (il_decl, ol_decl) = List.map aux vi_il, List.map aux vi_ol in let i_unif_res = UnifyType.f il_decl il and o_unif_res = UnifyType.f ol_decl ol @@ -1032,12 +1128,14 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> (match i_unif_res with | UnifyType.Ko msg -> raise(Compile_error(lxm, msg)) | UnifyType.Equal -> () - | UnifyType.Unif t -> GetEff.dump_polymorphic_nodes t + | UnifyType.Unif t -> () + (* GetEff.dump_polymorphic_nodes t *) ); (match o_unif_res with | UnifyType.Ko msg -> raise(Compile_error (lxm, msg)) | UnifyType.Equal -> () - | UnifyType.Unif t -> GetEff.dump_polymorphic_nodes t + | UnifyType.Unif t -> () + (* GetEff.dump_polymorphic_nodes t *) ); (* ok, there are compatible. We use the declared profile. *) (il_decl, ol_decl) @@ -1052,48 +1150,24 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> vil vol node_def.src with Not_found -> assert false (* defense against List.assoc *) in - - (* XXX useless ?? deja fait dans Eff.make_alias_node:564 - essayer d'enlever voir quand tout marchera. - *) - (* Check that the declared profile (if any) matches with the alias *) -(* match node_def.it.vars with *) -(* | None -> alias_node *) -(* | Some vars -> *) -(* let vi_il, vi_ol = *) -(* List.map (fun id -> find_var_info lxm vars id) vars.inlist, *) -(* List.map (fun id -> find_var_info lxm vars id) vars.outlist *) -(* in *) -(* let aux vi = GetEff.typ node_id_solver vi.it.var_type *) -(* in *) -(* let (il,ol) = Eff.profile_of_node_exp alias_node in *) -(* let (il_exp, ol_exp) = List.map aux vi_il, List.map aux vi_ol in *) -(* let i_unif_res = UnifyType.f il_exp il *) -(* and o_unif_res = UnifyType.f ol_exp ol *) -(* in *) -(* (match i_unif_res with *) -(* | UnifyType.Ko msg -> raise(Compile_error(lxm, msg)) *) -(* | UnifyType.Equal -> () *) -(* | UnifyType.Unif t -> GetEff.dump_polymorphic_nodes t *) -(* ); *) -(* (match o_unif_res with *) -(* | UnifyType.Ko msg -> raise(Compile_error (lxm, msg)) *) -(* | UnifyType.Equal -> () *) -(* | UnifyType.Unif t -> GetEff.dump_polymorphic_nodes t *) -(* ); *) - alias_node - ) - (* End Alias *) + alias_node + ) + (* End Alias *) in let current_env = { local = local_env; global = node_id_solver; } in - let res = source_to_source provide_flag current_env res in let _ = UniqueOutput.check res node_def.src in - gen_code provide_flag current_env res; + (* gen_code provide_flag current_env res; *) + Verbose.printf ~flag:dbg + "#DBG: EXITING node_check_do '%s'\n" + (Eff.string_of_node_key nk) + ; res +) +(*END node_check_do *) (* [make_alias_node aliased_node alias_nk node_id_solver_vars_opt lxm] @@ -1109,9 +1183,16 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> a non-polymorphic profile is given in the package provided part. In such a case, we can use the types of the provided part (itl and otl) instead of the polymorphic ones. *) -and (make_alias_node : node_exp -> node_key -> local_env -> id_solver -> - var_info list -> var_info list -> Lxm.t -> node_exp) = - fun aliased_node alias_nk local_env node_id_solver vil vol lxm -> + +and make_alias_node + (aliased_node: node_exp) + (alias_nk: node_key) + (local_env: local_env) + (node_id_solver: id_solver) + (vil: var_info list) + (vol: var_info list) + (lxm: Lxm.t) +: node_exp = Verbose.printf ~level:3 "*** Eff.make_alias_node %s \n" (Ident.long_to_string (fst alias_nk)); flush stdout; @@ -1119,24 +1200,23 @@ and (make_alias_node : node_exp -> node_key -> local_env -> id_solver -> let tl = List.map type_of_left outs in let cl = List.map (fun l -> (var_info_of_left l).var_clock_eff) outs in let (aliased_node_call : val_exp) = - { core = + { ve_core = CallByPosEff( - (Lxm.flagit (CALL(Lxm.flagit aliased_node lxm)) lxm, + (Lxm.flagit (CALL(Lxm.flagit aliased_node.node_key_eff lxm)) lxm, OperEff (List.map (fun vi -> (* build operands*) let ve = { - typ = [vi.var_type_eff]; - clk = [snd vi.var_clock_eff]; - core = CallByPosEff( - Lxm.flagit (IDENT( - Ident.to_idref vi.var_name_eff)) lxm, OperEff [])} - in - ve + ve_typ = [vi.var_type_eff]; + ve_clk = [snd vi.var_clock_eff]; + ve_core = CallByPosEff( + Lxm.flagit (VAR_REF(vi.var_name_eff)) lxm, OperEff [])} + in + ve ) vil))); - typ = tl; - clk = List.map snd cl; + ve_typ = tl; + ve_clk = List.map snd cl; } in let alias_node = @@ -1150,7 +1230,7 @@ and (make_alias_node : node_exp -> node_key -> local_env -> id_solver -> { asserts_eff = []; eqs_eff = [Lxm.flagit (outs, aliased_node_call) lxm] }); - is_polym_eff = List.exists is_polymorphic (List.map (fun vi -> vi.var_type_eff) (vil@vol)); + (* is_polym_eff = List.exists is_polymorphic (List.map (fun vi -> vi.var_type_eff) (vil@vol)); *) } in (* update the local_env table *) @@ -1165,115 +1245,17 @@ and (make_alias_node : node_exp -> node_key -> local_env -> id_solver -> in alias_node -and (gen_code : bool -> Eff.node_env -> Eff.node_exp -> unit) = - fun provide_flag current_env nexp -> - let nk = nexp.node_key_eff in - let is_extern_oper = - match nexp.def_eff with - | ExternEff | AbstractEff None -> true - | AbstractEff (Some _) | BodyEff _ -> false - in - let is_main_node = - if !Global.main_node = "" then ( - (* if no main node is provided, we take the first node we find, - that has a non-empty body. *) - match nexp.def_eff with - | ExternEff | AbstractEff _ -> false - | BodyEff _ -> - Global.main_node := Ident.string_of_long (fst nk); - true - ) - else - (nk = (Ident.long_of_string !Global.main_node, [])) - in - let nexp = - if !Global.expand_nodes && is_main_node - then NodesExpand.f current_env.local nexp - else nexp - in - let nexp_struct = - (* nb: we print res_struct, but do not return it from - node_check, because the structure and array expansion - modify (instanciate) the node profiles. *) - if - (!Global.expand_structs && not (nexp.is_polym_eff) - && ((not !Global.expand_nodes || is_main_node) (* it is useless otherwise *) - ) || is_extern_oper) - then - ( - Verbose.printf ~level:3 "-- Expand node %s \n" (Ident.long_to_string (fst nk)); - StructArrayExpand.node current_env.global current_env.local nexp - ) - else - nexp - in - if not provide_flag then - ( - if not !Global.expand_nodes || is_extern_oper || is_main_node then - if nexp.is_polym_eff then - Polymorphism.push_on_polymorphic_node_stack (current_env, nexp_struct) - else - let str = LicDump.node_of_node_exp_eff nexp_struct in - output_string !Global.oc str - ); - - - -(* Apply various source to source transformations, according to command-line options ; - + fix-point on generated nodes -*) -and (source_to_source : bool -> Eff.node_env -> Eff.node_exp -> Eff.node_exp) = - fun provide_flag current_env nexp -> - let rec aux nl_done nl_todo = - match nl_todo with - | [] -> assert false - | nexp::tail -> - (* - We need to split.node before Inline.iterators to be able to deal - with equations like: - x = n(map<<Lustre::iplus; 3>>(y); - Indeed, Inline.iterators does not recursively inline its argument - (it could, but it currently does not). - - Then, we need to split.node after Inline.iterators - again because iterator inlining creates some equations - that migth need some splitting... - *) - let _ = Name.reset_local_var_prefix "v" in (* coquetry *) - let nexp = - if !Global.one_op_per_equation - then Split.node current_env nexp - else nexp - in - let nexp = - if !Global.inline_iterator - then Inline.iterators current_env nexp - else nexp - in - let nexp = - if !Global.one_op_per_equation - then Split.node current_env nexp - else nexp - in - let nl_todo = tail in - let nl_done = nl_done @ [nexp] in - if nl_todo = [] then nl_done else aux nl_done nl_todo - in - match aux [] [nexp] with - | [] -> assert false - | nexp::new_nodes -> - (* The main node is printed outside - (indeed, we do not apply UniqueOutput.check only to generated nodes) - *) - List.iter (gen_code provide_flag current_env) new_nodes; - nexp - - - (** builds a [node_key] and calls [node_check] *) -and (solve_node_idref : t -> SymbolTab.t -> bool -> Ident.pack_name -> Ident.idref -> - Eff.static_arg list -> Lxm.t -> Eff.node_exp) = - fun this symbols provide_flag currpack idr sargs lxm -> +and solve_node_idref + (this: t) + (symbols: SymbolTab.t) + (provide_flag: bool) + (currpack: Ident.pack_name) + (idr: Ident.idref) + (sargs: Eff.static_arg list) + (lxm: Lxm.t) +: Eff.node_exp = + solve_x_idref node_check_interface node_check SymbolTab.find_node "node" (fun p id -> @@ -1285,27 +1267,38 @@ and (solve_node_idref : t -> SymbolTab.t -> bool -> Ident.pack_name -> Ident.idr ) this symbols provide_flag currpack idr sargs lxm -and (node_check: t -> Eff.node_key -> Lxm.t -> Eff.node_exp) = - fun this nk lxm -> - try - x_check this.nodes SymbolTab.find_node node_check_do lookup_node_exp_eff - (fun nk -> Ident.pack_of_long (fst nk)) - (fun nk -> Ident.of_long (fst nk)) - this nk lxm - with - Recursion_error (n, stack) -> - let msg = "Recursion loop detected in node " ^ (Ident.string_of_long (fst nk)) in - let msg = msg ^ "\n*** "^ (Ident.string_of_long n) ^ " depends on itself\n " +and node_check + (this: t) + (nk: Eff.node_key) + (lxm: Lxm.t) +: Eff.node_exp = + + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.node_check '%s'\n" (Eff.string_of_node_key nk); + try ( + let pack_of_x_key = fun nk -> Ident.pack_of_long (fst nk) in + let name_of_x_key = fun nk -> Ident.of_long (fst nk) in + x_check this.nodes SymbolTab.find_node node_check_do node_builtin lookup_node_exp_eff + pack_of_x_key + name_of_x_key + this nk lxm + ) with + Recursion_error (n, stack) -> + let msg = "Recursion loop detected in node " ^ (Ident.string_of_long (fst nk)) in + let msg = msg ^ "\n*** "^ (Ident.string_of_long n) ^ " depends on itself\n " ^ (String.concat "\n*****" stack) in raise (Compile_error (lxm, msg)) -and (node_check_interface: - t -> Eff.node_key -> Lxm.t -> Eff.node_exp) = - fun this nk -> +and node_check_interface + (this: t) + (nk: Eff.node_key) + (lxm: Lxm.t) +: Eff.node_exp = + Verbose.printf ~flag:dbg "#DBG: LazyCompiler.node_check_interface '%s'\n" (Eff.string_of_node_key nk); x_check_interface this.prov_nodes SymbolTab.find_node node_check - node_check_interface_do lookup_node_exp_eff + node_check_interface_do node_builtin lookup_node_exp_eff (fun nk -> Ident.pack_of_long (fst nk)) (fun nk -> Ident.of_long (fst nk)) this nk + lxm @@ -1329,7 +1322,7 @@ let compile_all_item this label x_check_interface string_of_x_key let compile_all_types pack_name this = compile_all_item this "type" type_check_interface Ident.string_of_long - LicDump.string_of_type_eff4msg (fun id -> Ident.make_long pack_name id) + Eff.string_of_type (fun id -> Ident.make_long pack_name id) let compile_all_constants pack_name this = compile_all_item this "const" const_check_interface Ident.string_of_long @@ -1352,9 +1345,40 @@ let compile_all_nodes pack_name this id ni_f = Eff.profile_of_node_exp (fun id -> (Ident.make_long pack_name id, [])) id ni_f +(**** to_lic : translate the (finalized) internal structure + into a proper LicPrg, for forthcoming manip and other prg 2 prg + transformations + N.B. items belonging to the "Lustre" virtual pack are not + taken into account +*) -let (compile_all :t -> unit) = - fun this -> +let to_lic (this:t) : LicPrg.t = + (* normally, only checked and correct programs are lic'ified *) + let unflag = function Checked x -> x | _ -> assert false in + let add_item add_x k v prg = + match Ident.pack_of_long k with + | "Lustre" -> prg + | _ -> add_x k (unflag v) prg + in + let add_node k v prg = + Verbose.printf ~flag:dbg + "#DBG: LazyCompiler.to_lic: node key '%s'\n" + (Eff.string_of_node_key k) + ; + match Ident.pack_of_long (fst k) with + (* | "Lustre" -> prg *) + | _ -> LicPrg.add_node k (unflag v) prg + in + let res = LicPrg.empty in + let res = Hashtbl.fold (add_item LicPrg.add_type) this.types res in + let res = Hashtbl.fold (add_item LicPrg.add_const) this.consts res in + let res = Hashtbl.fold add_node this.nodes res in + res + +(**** Entry points of the module : + either compile a single node or everithing ... +*) +let compile_all (this:t) : LicPrg.t = let testpack pack_name = ( Verbose.printf ~level:3 " * package %s\n" (Ident.pack_name_to_string pack_name); let prov_symbols = @@ -1376,10 +1400,27 @@ let (compile_all :t -> unit) = let plist = SyntaxTab.pack_list this.src_tab in Verbose.print_string ~level:3 "*** Dump the exported items of the packages.\n"; try - List.iter testpack plist + List.iter testpack plist; + to_lic this with Recursion_error (n, stack) -> let msg = "Recursion loop detected in node " ^ (Ident.string_of_long n) in let msg = msg ^ "\n*****" ^ (String.concat "\n*****" stack) in raise (Compile_error (Lxm.dummy "", msg)) +let compile_node (this:t) (main_node:Ident.idref) : LicPrg.t = + (* la clée "absolue" du main node (pas d'args statiques) *) + let main_node_key = + Eff.make_simple_node_key (Ident.long_of_idref main_node) + in + Verbose.printf + "-- MAIN NODE: \"%s\"\n" + (LicDump.string_of_node_key_rec main_node_key); + + let lxm = match Ident.pack_of_idref main_node with + | None -> Lxm.dummy "" + | Some pn -> Lxm.dummy (Ident.pack_name_to_string pn) + in + let _ = node_check this main_node_key lxm in + to_lic this + diff --git a/src/lazyCompiler.mli b/src/lazyCompiler.mli index 43a079b8848eef2ff70cec7ec47d975e63671eb2..30894ead556b03fb3e3720c230f69b6548eb1b6d 100644 --- a/src/lazyCompiler.mli +++ b/src/lazyCompiler.mli @@ -15,9 +15,9 @@ val create : SyntaxTab.t -> t (** Compiles one node *) -val node_check : t -> Eff.node_key -> Lxm.t -> Eff.node_exp +val compile_node : t -> Ident.idref -> LicPrg.t exception Recursion_error of Ident.long * string list (* compile all items *) -val compile_all : t -> unit +val compile_all : t -> LicPrg.t diff --git a/src/licDump.ml b/src/licDump.ml index ef7dd5300a7df90ee6f1917a21d6fab34620d1b0..a61918e4b511020dc45f29c0a17c06969022e21e 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,5 +1,6 @@ (** Time-stamp: <modified the 01/06/2011 (at 11:33) by Erwan Jahier> *) +open Errors open Printf open Lxm open Eff @@ -15,8 +16,6 @@ let (dump_long : Ident.long -> string) = fun x -> (* let str = Ident.string_of_long id in *) (* Str.global_replace (Str.regexp "::") "__" str *) -let type_alias_table = Hashtbl.create 0 - (******************************************************************************) @@ -33,16 +32,13 @@ let _ = assert (get_rank 5 [1;3;5] = 3) (* check it is a non-singleton tuple *) -let rec (is_a_tuple : Eff.val_exp -> bool) = - function - | { core = CallByPosEff ({ it = TUPLE }, OperEff [ve]) } -> is_a_tuple ve - | { core = CallByPosEff ({ it = TUPLE }, OperEff vel) } -> List.length vel > 1 +let rec is_a_tuple (e:Eff.val_exp) : bool = + match e.ve_core with + | CallByPosEff ({ it = TUPLE }, OperEff [ve]) -> is_a_tuple ve + | CallByPosEff ({ it = TUPLE }, OperEff vel) -> List.length vel > 1 | _ -> false (******************************************************************************) -(* prefix used to prefix user type name in order to avoid name clashed with - the alias type name that are generated by the compiler. *) -let prefix = "_" let rec string_of_const_eff = function @@ -63,37 +59,45 @@ let rec string_of_const_eff = else (dump_long s) | Struct_const_eff (fl, t) -> ( - let string_of_field = - function (id, veff) -> - (Ident.to_string id)^" = "^ (string_of_const_eff veff) - in - let flst = List.map string_of_field fl in - (string_of_type_eff t)^"{"^(String.concat "; " flst)^"}" + let string_of_field = + function (id, veff) -> + (Ident.to_string id)^" = "^ (string_of_const_eff veff) + in + let flst = List.map string_of_field fl in + (string_of_type_eff t)^"{"^(String.concat "; " flst)^"}" ) | Array_const_eff (ctab, t) -> ( - let vl = List.map string_of_const_eff ctab in - "["^(String.concat ", " vl)^"]" + let vl = List.map string_of_const_eff ctab in + "["^(String.concat ", " vl)^"]" ) + | Tuple_const_eff cl -> ( + string_of_const_eff_list cl + ) + +and string_of_const_eff_list = + function + | [c] -> string_of_const_eff c + | cl -> "(" ^ (String.concat ", " (List.map string_of_const_eff cl)) ^ ")" (* modify numbers notations in such a way that they become "valid" identifiers. Policy: - - minus (-) becomes "m" - - plus (+) becomes "p" - - dot (d) becomes "d" + - minus (-) becomes "m" + - plus (+) becomes "p" + - dot (d) becomes "d" *) and correct_num_string s = - let res = String.copy s in - let cpt = ref 0 in - let f c = ( - let _ = match c with - | '-' -> (res.[!cpt] <- 'm') - | '+' -> (res.[!cpt] <- 'p') - | '.' -> (res.[!cpt] <- 'd') - | _ -> () - in incr cpt - ) in - String.iter f s; - res + let res = String.copy s in + let cpt = ref 0 in + let f c = ( + let _ = match c with + | '-' -> (res.[!cpt] <- 'm') + | '+' -> (res.[!cpt] <- 'p') + | '.' -> (res.[!cpt] <- 'd') + | _ -> () + in incr cpt + ) in + String.iter f s; + res and string_ident_of_const_eff c = (* that version generates a string that is a valid lic ident, in order to use it @@ -112,6 +116,12 @@ and string_ident_of_const_eff c = | _ -> assert false ) | Array_const_eff (ctab, t) -> string_of_type_eff t + | Tuple_const_eff cl -> string_of_const_eff_list cl + +and string_ident_of_const_eff_list cl = + match cl with + | [c] -> string_ident_of_const_eff c + | _ -> "(" ^ (String.concat ", " (List.map string_ident_of_const_eff cl)) ^ ")" and string_of_const_eff_opt = function | None -> "" @@ -122,7 +132,7 @@ and string_def_of_type_eff = function | Int_type_eff -> "int" | Real_type_eff -> "real" | External_type_eff (i) -> dump_long i - | Abstract_type_eff (i, t) -> string_def_of_type_eff t ^ " -- abstract in the source " + | Abstract_type_eff (i, t) -> string_def_of_type_eff t ^ " (*abstract in the source*)" | Enum_type_eff (i, sl) -> assert (sl <>[]); if !Global.expand_enums then @@ -134,116 +144,31 @@ and string_def_of_type_eff = function | Struct_type_eff (name, fl) -> assert (fl <>[]); let f sep acc (id, (type_eff, const_eff_opt)) = - acc ^ sep ^ (Ident.to_string id) ^ " : " ^ - (string_of_type_eff type_eff) ^ - match const_eff_opt with - None -> "" - | Some ce -> " = " ^ (string_of_const_eff ce) + acc ^ sep ^ (Ident.to_string id) ^ " : " ^ + (string_of_type_eff type_eff) ^ + match const_eff_opt with + None -> "" + | Some ce -> " = " ^ (string_of_const_eff ce) in "struct " ^ - (List.fold_left (f "; ") (f "" " {" (List.hd fl)) (List.tl fl)) ^ "}" - - | Any -> "a" - | Overload -> "o" + (List.fold_left (f "; ") (f "" " {" (List.hd fl)) (List.tl fl)) ^ "}" + + | TypeVar Any -> "a" + | TypeVar AnyNum -> "o" (* exported *) -and string_of_type_eff = function - | Bool_type_eff -> "bool" - | Int_type_eff -> "int" - | Real_type_eff -> "real" - | External_type_eff (name) -> prefix ^ (dump_long name) - | Abstract_type_eff (name, t) -> prefix ^ (dump_long name) - (* string_of_type_eff t *) - | Enum_type_eff (name, _) -> prefix ^ (dump_long name) - | Array_type_eff (ty, sz) -> array_alias ty sz - | Struct_type_eff (name, _) -> prefix ^ (dump_long name) - | Any -> string_of_type_eff (Polymorphism.get_type ()) - | Overload -> string_of_type_eff (Polymorphism.get_type ()) - - -and string_of_type_eff4msg = function - | Bool_type_eff -> "bool" - | Int_type_eff -> "int" - | Real_type_eff -> "real" - | External_type_eff (name) -> prefix ^ (dump_long name) - | Abstract_type_eff (name, t) -> prefix ^ (dump_long name) - (* string_of_type_eff4msg t *) - | Enum_type_eff (name, _) -> prefix ^ (dump_long name) - | Array_type_eff (ty, sz) -> (string_of_type_eff4msg ty) ^ "^" ^(string_of_int sz) - | Struct_type_eff (name, _) -> prefix ^ (dump_long name) - | Any -> "'a" - | Overload -> "'o" - - -(******************************************************************************) -(** Stuff to manage generated type alias - - Indeed instead of printing: - - node toto(x: int ^ 4) ... - - we want to print something like : - - type int4 = int ^ 4; - node toto(x: int4) ... - - That may occur only for array actually. - - To do that, we maintain a table of type alias that we fill each time - we want to print (via string_of_type_eff) a type that is not a named type. - Then, at the end, we will dump that table in the lic file. - - This table is filled by [array_alias]. -*) -and (array_alias : Eff.type_ -> int -> string) = - fun t size -> - let array_t = Array_type_eff(t,size) in - try Hashtbl.find type_alias_table array_t - with Not_found -> - let alias_t = string_of_type_eff t in - let res = Name.array_type array_t (alias_t ^ "_" ^(string_of_int size)) in - Hashtbl.add type_alias_table array_t res; - res - -(* exported *) -and dump_type_alias oc = - let p = output_string oc in - if Hashtbl.length type_alias_table > 0 then p "-- automatically defined aliases:\n"; - Hashtbl.iter - (fun type_eff alias_name -> - try - p ("type " ^ alias_name ^ " = " ^ (string_def_of_type_eff type_eff)^";\n") - with Polymorphism.Exc -> () - ) - type_alias_table - -(******************************************************************************) -(* exported *) -and (type_eff_list_to_string : Eff.type_ list -> string) = - fun tel -> - let str_l = List.map string_of_type_eff4msg tel in - String.concat "*" str_l - -and string_of_type_eff_list = function - | [] -> "" - | [x] -> string_of_type_eff x - | l -> String.concat " * " (List.map string_of_type_eff l) - -and string_of_type_eff_list4msg = function - | [] -> "" - | [x] -> string_of_type_eff4msg x - | l -> String.concat " * " (List.map string_of_type_eff4msg l) +(* On prend le meme que Eff *) +and string_of_type_eff = Eff.string_of_type - (* for printing recursive node *) and string_of_node_key_rec (nkey: node_key) = match nkey with | (ik, []) -> dump_long ik | (ik, salst) -> let astrings = List.map static_arg2string_bis salst in - let name = sprintf "%s_%s" (Ident.no_pack_string_of_long ik) (String.concat "_" astrings) in + let name = sprintf "%s_%s" (Ident.no_pack_string_of_long ik) (String.concat "_" astrings) in (Name.node_key nkey name) (* for printing iterators *) @@ -251,29 +176,52 @@ and string_of_node_key_iter (nkey: node_key) = match nkey with | (ik, []) -> dump_long ik | (ik, salst) -> - let astrings = List.map (static_arg2string) salst in - sprintf "%s<<%s>>" (Ident.string_of_long ik) (String.concat ", " astrings) + let astrings = List.map (static_arg2string) salst in + sprintf "%s<<%s>>" (Ident.string_of_long ik) (String.concat ", " astrings) + +(* pour ecrire UN NIVEAU d'arg statique (cf. BuiltIn *) +and string_of_node_key_def (nkey: node_key) = + match nkey with + | (ik, []) -> dump_long ik + | (ik, salst) -> + let astrings = List.map (string_of_static_arg) salst in + sprintf "%s<<%s>>" (Ident.string_of_long ik) (String.concat ", " astrings) +and string_of_static_arg (sa : Eff.static_arg) = + match sa with + | ConstStaticArgEff (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff) + | TypeStaticArgEff (id, teff) -> sprintf "%s" (string_of_type_eff teff) + | NodeStaticArgEff (id, nk) -> string_of_node_key_rec nk + + (* for inventing a name to parametrized nodes *) and static_arg2string_bis (sa : Eff.static_arg) = match sa with | ConstStaticArgEff (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff) | TypeStaticArgEff (id, teff) -> sprintf "%s" (string_of_type_eff teff) - | NodeStaticArgEff (id, ((long, _sargs), _, _), _) -> - sprintf "%s" (Ident.no_pack_string_of_long long) + (* | NodeStaticArgEff (id, ((long, _sargs), _, _), _) -> *) + | NodeStaticArgEff (id, (long,_)) -> + sprintf "%s" (Ident.no_pack_string_of_long long) (* for printing recursive node and iterators *) and static_arg2string (sa : Eff.static_arg) = match sa with | ConstStaticArgEff (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff) | TypeStaticArgEff (id, teff) -> sprintf "%s" (string_of_type_eff teff) - | NodeStaticArgEff (id, ((long,sargs), _, _), _) -> + (* | NodeStaticArgEff (id, ((long,sargs), _, _), _) -> *) + | NodeStaticArgEff (id, (long,sargs)) -> string_of_node_key_iter (long,sargs) -(* sprintf "%s" (dump_long long) *) +(* sprintf "%s" (dump_long long) *) + +and static_arg2string_rec (sa : Eff.static_arg) = + match sa with + | ConstStaticArgEff (id, ceff) -> sprintf "%s" (string_ident_of_const_eff ceff) + | TypeStaticArgEff (id, teff) -> sprintf "%s" (string_of_type_eff teff) + (* | NodeStaticArgEff (id, ((long,sargs), _, _), _) -> *) + | NodeStaticArgEff (id, (long,sargs)) -> + string_of_node_key_rec (long,sargs) +(* sprintf "%s" (dump_long long) *) -and (string_of_var_info_eff4msg: Eff.var_info -> string) = - fun x -> - (Ident.to_string x.var_name_eff) ^ ":"^(string_of_type_eff4msg x.var_type_eff) and (string_of_var_info_eff: Eff.var_info -> string) = fun x -> @@ -283,10 +231,6 @@ and (type_string_of_var_info_eff: Eff.var_info -> string) = fun x -> (string_of_type_eff x.var_type_eff) ^ (string_of_clock2 (snd x.var_clock_eff)) -and (type_string_of_var_info_eff4msg: Eff.var_info -> string) = - fun x -> (string_of_type_eff4msg x.var_type_eff) ^ - (string_of_clock2 (snd x.var_clock_eff)) - and string_of_decl var_info_eff = let vt_str = (Ident.to_string var_info_eff.var_name_eff) ^ ":" ^ @@ -336,34 +280,34 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st in let str = match posop.it,vel with - | Predef (Predef.NOT_n,_), [ve1] -> + | PREDEF_CALL (Predef.NOT_n,_), [ve1] -> ((op2string Predef.NOT_n) ^ " " ^ (if is_a_tuple ve1 then (tuple_par [ve1]) else sov ve1)) - | Predef (Predef.DIESE_n,_), [ve1] -> + | PREDEF_CALL (Predef.DIESE_n,_), [ve1] -> if !Global.lv4 then sov ve1 (* lv4 does no accept to apply # on One var only! *) else ((op2string Predef.DIESE_n) ^ (tuple_par [ve1])) - | Predef (Predef.IF_n,_), [ve1; ve2; ve3] -> - let ve2str = string_of_val_exp_eff ve2 in - let ve2str = if is_a_tuple ve2 then "("^ve2str^")" else ve2str in - let ve3str = string_of_val_exp_eff ve3 in - let ve3str = if is_a_tuple ve3 then "("^ve3str^")" else ve3str in - " if " ^ (string_of_val_exp_eff ve1) ^ - " then " ^ ve2str ^ " else " ^ ve3str - - | Predef(op,sargs), vel -> - if Predef.is_infix op then ( - match vel with - | [ve1; ve2] -> - (string_of_val_exp_eff ve1) ^ " " ^ (op2string op) ^ - " " ^ (string_of_val_exp_eff ve2) - | _ -> assert false - ) - else - ((op2string op) ^ - (if sargs = [] then + | PREDEF_CALL (Predef.IF_n,_), [ve1; ve2; ve3] -> + let ve2str = string_of_val_exp_eff ve2 in + let ve2str = if is_a_tuple ve2 then "("^ve2str^")" else ve2str in + let ve3str = string_of_val_exp_eff ve3 in + let ve3str = if is_a_tuple ve3 then "("^ve3str^")" else ve3str in + " if " ^ (string_of_val_exp_eff ve1) ^ + " then " ^ ve2str ^ " else " ^ ve3str + + | PREDEF_CALL(op,sargs), vel -> + if Predef.is_infix op then ( + match vel with + | [ve1; ve2] -> + (string_of_val_exp_eff ve1) ^ " " ^ (op2string op) ^ + " " ^ (string_of_val_exp_eff ve2) + | _ -> assert false + ) + else + ((op2string op) ^ + (if sargs = [] then match op with | Predef.ICONST_n _ | Predef.RCONST_n _ | Predef.NOT_n | Predef.UMINUS_n | Predef.IUMINUS_n | Predef.RUMINUS_n @@ -373,113 +317,111 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st else "<<" ^ (String.concat ", " (List.map (static_arg2string) sargs)) - ^ ">>" ^ (tuple_par vel))) - - | CALL nee, _ -> ( - if nee.it.def_eff = ExternEff then - if !Global.lv4 then - (match nee.it.node_key_eff with - (* predef op that are iterated are translated into node_exp ; - hence, we need to do (again) a particular threatment to have - a node ouput (i.e., "2>a" vs "Lustre::lt(2,a)" *) - | ("Lustre","uminus"), [] -> " -" ^ sov (hd vel) - | ("Lustre","iuminus"), [] -> " -" ^ sov (hd vel) - | ("Lustre","ruminus"), [] -> " -" ^ sov (hd vel) - | ("Lustre","not"), [] -> " not " ^ sov (hd vel) - - | ("Lustre","lt"), [] -> sov (hd vel) ^ " < " ^ sov (hd (tl vel)) - | ("Lustre","lte"), [] -> sov (hd vel) ^ " <= " ^ sov (hd (tl vel)) - | ("Lustre","gt"), [] -> sov (hd vel) ^ " > " ^ sov (hd (tl vel)) - | ("Lustre","gte"), [] -> sov (hd vel) ^ " >= " ^ sov (hd (tl vel)) - | ("Lustre","eq"), [] -> sov (hd vel) ^ " = " ^ sov (hd (tl vel)) - | ("Lustre","neq"), [] -> sov (hd vel) ^ " <> " ^ sov (hd (tl vel)) - | ("Lustre","diff"), [] -> sov (hd vel) ^ " <> " ^ sov (hd (tl vel)) - | ("Lustre","plus"), [] -> sov (hd vel) ^ " + " ^ sov (hd (tl vel)) - | ("Lustre","iplus"), [] -> sov (hd vel) ^ " + " ^ sov (hd (tl vel)) - | ("Lustre","rplus"), [] -> sov (hd vel) ^ " + " ^ sov (hd (tl vel)) - | ("Lustre","minus"), [] -> sov (hd vel) ^ " - " ^ sov (hd (tl vel)) - | ("Lustre","iminus"), [] -> sov (hd vel) ^ " - " ^ sov (hd (tl vel)) - | ("Lustre","rminus"), [] -> sov (hd vel) ^ " - " ^ sov (hd (tl vel)) - | ("Lustre","div"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) - | ("Lustre","idiv"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) - | ("Lustre","rdiv"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) - | ("Lustre","times"), [] -> sov (hd vel) ^ " * " ^ sov (hd (tl vel)) - | ("Lustre","rtimes"), [] -> sov (hd vel) ^ " * " ^ sov (hd (tl vel)) - | ("Lustre","itimes"), [] -> sov (hd vel) ^ " * " ^ sov (hd (tl vel)) - | ("Lustre","slash"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) - | ("Lustre","rslash"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) - | ("Lustre","islash"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) - - | ("Lustre","impl"), [] -> sov (hd vel) ^ " => " ^ sov (hd (tl vel)) - | ("Lustre","mod"), [] -> sov (hd vel) ^ " mod " ^ sov (hd (tl vel)) - - | ("Lustre","and"), [] -> sov (hd vel) ^ " and " ^ sov (hd (tl vel)) - | ("Lustre","or"), [] -> sov (hd vel) ^ " or " ^ sov (hd (tl vel)) - | ("Lustre","xor"), [] -> sov (hd vel) ^ " xor " ^ sov (hd (tl vel)) - - | ("Lustre","if"), [] -> - " if " ^ sov (hd vel) ^ " then " ^ sov (hd (tl vel)) - ^ " else " ^ sov (hd (tl (tl vel))) - - | _ -> - ((string_of_node_key_iter nee.it.node_key_eff) ^ (tuple_par vel)) - ) - else - ((string_of_node_key_iter nee.it.node_key_eff) ^ (tuple_par vel)) - else - (* recursive node cannot be extern *) - ((string_of_node_key_rec nee.it.node_key_eff) ^ (tuple_par vel)) - ) - | IDENT idref, _ -> Ident.string_of_idref idref - | PRE, _ -> "pre " ^ (tuple_par vel) - | ARROW, [ve1; ve2] -> - (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^ + ^ ">>" ^ (tuple_par vel))) + + | (CALL nkl,_) -> ( + let nk = nkl.it in + if !Global.lv4 then + (match nk with + (* predef op that are iterated are translated into node_exp ; + hence, we need to do (again) a particular threatment to have + a node ouput (i.e., "2>a" vs "Lustre::lt(2,a)" *) + | ("Lustre","uminus"), [] -> " -" ^ sov (hd vel) + | ("Lustre","iuminus"), [] -> " -" ^ sov (hd vel) + | ("Lustre","ruminus"), [] -> " -" ^ sov (hd vel) + | ("Lustre","not"), [] -> " not " ^ sov (hd vel) + + | ("Lustre","lt"), [] -> sov (hd vel) ^ " < " ^ sov (hd (tl vel)) + | ("Lustre","lte"), [] -> sov (hd vel) ^ " <= " ^ sov (hd (tl vel)) + | ("Lustre","gt"), [] -> sov (hd vel) ^ " > " ^ sov (hd (tl vel)) + | ("Lustre","gte"), [] -> sov (hd vel) ^ " >= " ^ sov (hd (tl vel)) + | ("Lustre","eq"), [] -> sov (hd vel) ^ " = " ^ sov (hd (tl vel)) + | ("Lustre","neq"), [] -> sov (hd vel) ^ " <> " ^ sov (hd (tl vel)) + | ("Lustre","diff"), [] -> sov (hd vel) ^ " <> " ^ sov (hd (tl vel)) + | ("Lustre","plus"), [] -> sov (hd vel) ^ " + " ^ sov (hd (tl vel)) + | ("Lustre","iplus"), [] -> sov (hd vel) ^ " + " ^ sov (hd (tl vel)) + | ("Lustre","rplus"), [] -> sov (hd vel) ^ " + " ^ sov (hd (tl vel)) + | ("Lustre","minus"), [] -> sov (hd vel) ^ " - " ^ sov (hd (tl vel)) + | ("Lustre","iminus"), [] -> sov (hd vel) ^ " - " ^ sov (hd (tl vel)) + | ("Lustre","rminus"), [] -> sov (hd vel) ^ " - " ^ sov (hd (tl vel)) + | ("Lustre","div"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) + | ("Lustre","idiv"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) + | ("Lustre","rdiv"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) + | ("Lustre","times"), [] -> sov (hd vel) ^ " * " ^ sov (hd (tl vel)) + | ("Lustre","rtimes"), [] -> sov (hd vel) ^ " * " ^ sov (hd (tl vel)) + | ("Lustre","itimes"), [] -> sov (hd vel) ^ " * " ^ sov (hd (tl vel)) + | ("Lustre","slash"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) + | ("Lustre","rslash"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) + | ("Lustre","islash"), [] -> sov (hd vel) ^ " / " ^ sov (hd (tl vel)) + + | ("Lustre","impl"), [] -> sov (hd vel) ^ " => " ^ sov (hd (tl vel)) + | ("Lustre","mod"), [] -> sov (hd vel) ^ " mod " ^ sov (hd (tl vel)) + + | ("Lustre","and"), [] -> sov (hd vel) ^ " and " ^ sov (hd (tl vel)) + | ("Lustre","or"), [] -> sov (hd vel) ^ " or " ^ sov (hd (tl vel)) + | ("Lustre","xor"), [] -> sov (hd vel) ^ " xor " ^ sov (hd (tl vel)) + + | ("Lustre","if"), [] -> + " if " ^ sov (hd vel) ^ " then " ^ sov (hd (tl vel)) + ^ " else " ^ sov (hd (tl (tl vel))) + + | _ -> + ((string_of_node_key nk) ^ (tuple_par vel)) + ) else + ((string_of_node_key_rec nk) ^ (tuple_par vel)) + ) + | CONST_REF idl, _ -> dump_long idl + | VAR_REF id, _ -> id + | PRE, _ -> "pre " ^ (tuple_par vel) + | ARROW, [ve1; ve2] -> + (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^ " -> " ^ (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2) - | FBY, [ve1; ve2] -> + | FBY, [ve1; ve2] -> if !Global.lv4 then (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^ " -> pre " ^ (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2) else - (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) + (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1) ^ " fby " ^ (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2) - | WHEN clk, vel -> (tuple vel) ^ (string_of_clock_exp clk) + | WHEN clk, vel -> (tuple vel) ^ (string_of_clock_exp clk) - | CURRENT,_ -> "current " ^ tuple_par vel - | TUPLE,_ -> (tuple vel) - | WITH(ve),_ -> (string_of_val_exp_eff ve) - | CONCAT, [ve1; ve2] -> - (string_of_val_exp_eff ve1) ^ " | " ^ (string_of_val_exp_eff ve2) - | HAT (i, ve), _ -> (string_of_val_exp_eff ve) ^ "^" ^ (string_of_int i) - | ARRAY vel, _ -> tuple_square vel - | STRUCT_ACCESS(id), [ve1] -> - (string_of_val_exp_eff ve1) ^ "." ^ (Ident.to_string id) + | CURRENT,_ -> "current " ^ tuple_par vel + | TUPLE,_ -> (tuple vel) + | WITH(ve),_ -> (string_of_val_exp_eff ve) + | CONCAT, [ve1; ve2] -> + (string_of_val_exp_eff ve1) ^ " | " ^ (string_of_val_exp_eff ve2) + | HAT (i, ve), _ -> (string_of_val_exp_eff ve) ^ "^" ^ (string_of_int i) + | ARRAY vel, _ -> tuple_square vel + | STRUCT_ACCESS(id), [ve1] -> + (string_of_val_exp_eff ve1) ^ "." ^ (Ident.to_string id) - | ARRAY_ACCES(i), [ve1] -> - (string_of_val_exp_eff ve1) ^ "[" ^ (string_of_int i) ^ "]" + | ARRAY_ACCES(i), [ve1] -> + (string_of_val_exp_eff ve1) ^ "[" ^ (string_of_int i) ^ "]" - | ARRAY_SLICE(si_eff), [ve1] -> - (string_of_val_exp_eff ve1) ^ (string_of_slice_info_eff si_eff) + | ARRAY_SLICE(si_eff), [ve1] -> + (string_of_val_exp_eff ve1) ^ (string_of_slice_info_eff si_eff) - | ARRAY_SLICE(_), _ -> assert false (* todo *) - | MERGE _, _ -> assert false (* todo *) - (* | ITERATOR _, _ -> assert false (* todo *) *) + | ARRAY_SLICE(_), _ -> assert false (* todo *) + | MERGE _, _ -> assert false (* todo *) + (* | ITERATOR _, _ -> assert false (* todo *) *) (* Cannot happen *) - | ARROW, _ -> assert false - | FBY, _ -> assert false - | CONCAT, _ -> assert false - | STRUCT_ACCESS(_), _ -> assert false - | ARRAY_ACCES(i), _ -> assert false + | ARROW, _ -> assert false + | FBY, _ -> assert false + | CONCAT, _ -> assert false + | STRUCT_ACCESS(_), _ -> assert false + | ARRAY_ACCES(i), _ -> assert false in let do_not_parenthesize = function - | IDENT _,_ - | Predef((Predef.ICONST_n _), _),_ - | Predef((Predef.RCONST_n _), _),_ - | Predef((Predef.FALSE_n), _),_ - | Predef((Predef.TRUE_n), _),_ + | VAR_REF _,_ + | CONST_REF _,_ + | PREDEF_CALL((Predef.ICONST_n _), _),_ + | PREDEF_CALL((Predef.RCONST_n _), _),_ + | PREDEF_CALL((Predef.FALSE_n), _),_ + | PREDEF_CALL((Predef.TRUE_n), _),_ | ARRAY_ACCES _,_ | STRUCT_ACCESS _,_ -> true | _,_ -> false @@ -499,15 +441,16 @@ and (string_of_by_pos_op_eff: Eff.by_pos_op srcflagged -> Eff.val_exp list -> st ("(" ^ str ^ ")") -and string_of_val_exp_eff ve = string_of_val_exp_eff_core ve.core +and string_of_val_exp_eff ve = string_of_val_exp_eff_core ve.ve_core and string_of_val_exp_eff_core ve_core = match ve_core with | CallByPosEff (by_pos_op_eff, OperEff vel) -> + (* ICI : on pourrait afficher en commentaire l'éventuel type_matches ? *) (string_of_by_pos_op_eff by_pos_op_eff vel) | CallByNameEff(by_name_op_eff, fl) -> (match by_name_op_eff.it with - | STRUCT (pn,idref) -> prefix ^ ( + | STRUCT (pn,idref) -> ( match Ident.pack_of_idref idref with | Some pn -> Ident.string_of_idref idref @@ -515,16 +458,16 @@ and string_of_val_exp_eff_core ve_core = let idref = Ident.make_idref pn (Ident.of_idref idref) in Ident.string_of_idref idref ) - | STRUCT_anonymous -> "") ^ - "{" ^ (String.concat ";" - (List.map - (fun (id,veff) -> - let str = string_of_val_exp_eff veff in - (Ident.to_string id.it) ^ "=" ^ - (if is_a_tuple veff then ("("^ str^")") else str) - ) - fl)) ^ - "}" + | STRUCT_anonymous -> "") ^ + "{" ^ (String.concat ";" + (List.map + (fun (id,veff) -> + let str = string_of_val_exp_eff veff in + (Ident.to_string id.it) ^ "=" ^ + (if is_a_tuple veff then ("("^ str^")") else str) + ) + fl)) ^ + "}" and wrap_long_line str = @@ -532,17 +475,17 @@ and wrap_long_line str = let str_list = Str.split (Str.regexp " ") str in let new_str, reste = List.fold_left - (fun (accl, acc_str) str -> - let new_acc_str = acc_str ^ " " ^ str in - if - String.length new_acc_str > 75 - then - (accl ^ acc_str ^ "\n\t" , str) - else - (accl, new_acc_str) - ) - ("","") - str_list + (fun (accl, acc_str) str -> + let new_acc_str = acc_str ^ " " ^ str in + if + String.length new_acc_str > 75 + then + (accl ^ acc_str ^ "\n\t" , str) + else + (accl, new_acc_str) + ) + ("","") + str_list in new_str ^ " " ^ reste @@ -568,36 +511,37 @@ and wrap_long_profile str = if String.length str < 75 then str else "\n"^( Str.global_replace (Str.regexp "returns") "\nreturns" - (Str.global_replace (Str.regexp "(") "(\n\t" - (Str.global_replace (Str.regexp "; ") ";\n\t" str))) + (Str.global_replace (Str.regexp "(") "(\n\t" + (Str.global_replace (Str.regexp "; ") ";\n\t" str))) and (profile_of_node_exp_eff: Eff.node_exp -> string) = fun neff -> ("(" ^ (string_of_type_decl_list neff.inlist_eff "; ") ^ ") returns (" ^ - (string_of_type_decl_list neff.outlist_eff "; ") ^ ");\n") + (string_of_type_decl_list neff.outlist_eff "; ") ^ ")") and (string_of_node_def : Eff.node_def -> string list) = function | ExternEff + | BuiltInEff _ | AbstractEff _ -> [] | BodyEff node_body_eff -> - List.append - (List.map string_of_assert node_body_eff.asserts_eff) - (List.map string_of_eq node_body_eff.eqs_eff) + List.append + (List.map string_of_assert node_body_eff.asserts_eff) + (List.map string_of_eq node_body_eff.eqs_eff) (* exported *) and (type_decl: Ident.long -> Eff.type_ -> string) = fun tname teff -> - "type " ^ prefix ^ (dump_long tname) ^ + "type " ^ (dump_long tname) ^ (match teff with | Enum_type_eff (_) -> if !Global.expand_enums then ";\n" else " = " ^ (string_def_of_type_eff teff) ^ ";\n" - | External_type_eff (_) - | Abstract_type_eff(_,External_type_eff (_)) -> ";\n" - | _ -> " = " ^ (string_def_of_type_eff teff) ^ ";\n" + | External_type_eff (_) + | Abstract_type_eff(_,External_type_eff (_)) -> ";\n" + | _ -> " = " ^ (string_def_of_type_eff teff) ^ ";\n" ) (* exported *) @@ -608,13 +552,13 @@ and (const_decl: Ident.long -> Eff.const -> string) = (match ceff with | Enum_const_eff(id, t) -> if !Global.expand_enums then - (begin_str ^ ":"^(string_of_type_eff t) ^ ";\n") + (begin_str ^ " : "^(string_of_type_eff t) ^ ";\n") else (* generate abstract constant *) "" | Extern_const_eff _ | Abstract_const_eff _ -> - begin_str ^ ":" ^ (string_of_type_eff (Eff.type_of_const ceff)) ^ + begin_str ^ " : " ^ (string_of_type_eff (Eff.type_of_const ceff)) ^ (* (if !Global.ec then ".\n" else *) (";\n") | Struct_const_eff _ @@ -622,38 +566,58 @@ and (const_decl: Ident.long -> Eff.const -> string) = | Bool_const_eff _ | Int_const_eff _ | Real_const_eff _ -> begin_str ^ " = " ^ end_str + | Tuple_const_eff _ -> + print_internal_error "LicDump.const_decl" "should not have been called for a tuple"; + assert false ) (* exported *) -and (node_of_node_exp_eff: Eff.node_exp -> string) = - fun neff -> - wrap_long_profile ( - (if - neff.def_eff = ExternEff - && not (!Global.lv4) (* no extern kwd in v4... *) - then "extern " - else "") ^ - (if !Global.lv4 then - (* node and function does not have the same meaning in v4... *) - (if neff.def_eff = ExternEff then "function " else "node ") - else - (if neff.has_mem_eff then "node " else "function ") - ) ^ - (string_of_node_key_rec neff.node_key_eff) ^ - (profile_of_node_exp_eff neff)) ^ - (match neff.def_eff with - | ExternEff -> "" - | AbstractEff _ -> "" - | BodyEff _ -> - ((match neff.loclist_eff with None -> "" | Some [] -> "" - | Some l -> - "var\n " ^ (string_of_type_decl_list l ";\n ") ^ ";\n") ^ - "let\n " ^ - (String.concat "\n " (string_of_node_def neff.def_eff)) ^ - "\ntel\n-- end of node " ^ - (string_of_node_key_rec neff.node_key_eff) ^ "\n" - ) +and node_of_node_exp_eff + (neff: Eff.node_exp) +: string = + wrap_long_profile ( + + ( + if neff.def_eff = ExternEff && not (!Global.lv4) + (* no extern kwd in v4... *) + then "extern " else "" + )^( + if !Global.lv4 then ( + (* node and function does not have the same meaning in v4... *) + if neff.def_eff = ExternEff then "function " else "node " + ) else ( + if neff.has_mem_eff then "node " else "function " + ) + )^( + string_of_node_key_rec neff.node_key_eff + )^( + profile_of_node_exp_eff neff + ) + )^( + match neff.def_eff with + | ExternEff -> ";\n" + | BuiltInEff nk -> ( + (* on écrit juste un alias *) + " = "^ + (string_of_node_key_def nk)^ + (";\n") + ) + | AbstractEff _ -> ";\n" + | BodyEff _ -> ( + ";\n"^ + ( + match neff.loclist_eff with + | None -> "" + | Some [] -> "" + | Some l -> + "var\n " ^ (string_of_type_decl_list l ";\n ") ^ ";\n" + ) ^ + "let\n " ^ + (String.concat "\n " (string_of_node_def neff.def_eff)) ^ + "\ntel\n-- end of node " ^ + (string_of_node_key_rec neff.node_key_eff) ^ "\n" + ) ) @@ -730,12 +694,3 @@ let print_global_node_error lxm nkey msg = ( flush stderr ) - -(* debug *) -let dump_local_env e = ( - let pt i t = Printf.printf "type %s = %s\n" i (string_of_type_eff t) in - Hashtbl.iter pt e.lenv_types; - let pc i t = Printf.printf "const %s = %s\n" i (string_of_const_eff t) in - Hashtbl.iter pc e.lenv_const; -) - diff --git a/src/licDump.mli b/src/licDump.mli index 5e433de3e98ac9b33055b0838fe692b59caea436..4269138e0e53dc80582bab081ec7886e42ec3f76 100644 --- a/src/licDump.mli +++ b/src/licDump.mli @@ -23,12 +23,6 @@ val type_string_of_var_info_eff: Eff.var_info -> string val type_string_of_var_info_eff4msg: Eff.var_info -> string val string_of_slice_info_eff : Eff.slice_info -> string - - -(* Dump all the aliases that were introduced during the compilation process *) -val dump_type_alias : out_channel -> unit - - (* used for error msgs *) val string_of_clock_exp : SyntaxTreeCore.clock_exp -> string val string_of_clock2 : Eff.clock -> string diff --git a/src/licPrg.ml b/src/licPrg.ml new file mode 100644 index 0000000000000000000000000000000000000000..80f36440028ee5c2e1dc6f86ca95a7bfee0dc492 --- /dev/null +++ b/src/licPrg.ml @@ -0,0 +1,203 @@ + +(* Réorganisation de la compil : + Un LicPrg est : + - un programme Lustre SIMPLE, vérifié et cohérent, + à base de Eff.xx + - du lv6, on passe à LicPrg via LazyCompiler, qui fait + UNIQUEMENT le boulot de base : + * dé-packaging + * résolution de l'ordre sup statique, y compris la + récursion, en tirant "le fil" du main node + * SAUF pour les macros prédéfinies (non-programmables) + * résolution de la surcharge + - les transformations (expansions etc.) qui étaient faites + dans LazyCompiler sont (appelées à devenir) des phases + apr coup du type LicPrg -> LicPrg +*) +(* + Pas très différent des infos de LazyCompiler.t + Sauf que on utilise des map + +*) + +module ItemKeyMap = struct + include Map.Make ( + struct + type t = Eff.item_key + let compare = compare + end + ) + let dummy () = "dummy item: add things below to complete the module" +end + +module NodeKeyMap = struct + include Map.Make ( + struct + type t = Eff.node_key + let compare = compare + end + ) + let dummy () = "dummy item: add things below to complete the module" +end + +type t = { + types : Eff.type_ ItemKeyMap.t; + consts : Eff.const ItemKeyMap.t; + nodes : Eff.node_exp NodeKeyMap.t; + (* consts : (Eff.item_key, Eff.const Eff.check_flag) Hashtbl.t; *) + (* nodes : (Eff.node_key, Eff.node_exp Eff.check_flag) Hashtbl.t; *) +} + +let empty = { + types = ItemKeyMap.empty; + consts = ItemKeyMap.empty; + nodes = NodeKeyMap.empty +} + +(* KoKêterie : pour changer ds suffixes + numériques, produit : + a, b, c, d, e, aa, ab, ac, ad, ae, etc ... +Pour tester : +for i = 0 to 42 do +Printf.printf "%3d -> %s\n" i (pretty_sfx i) +done +*) +let rec pretty_sfx i = + if i = 0 then "" + else + (pretty_sfx ((i-1)/5))^(Char.escaped (char_of_int (97 + (i-1) mod 5))) + +(** CREER DES IDENTS TOUT FRAIS *) +let fresh_type_id this pname pfx = + let rec fresh x = + let id = Printf.sprintf "%s%s" pfx (pretty_sfx x) in + let res = Ident.make_long pname id in + if ItemKeyMap.mem res this.types then fresh (x+1) + else res + in + fresh 0 + +(** RECHERCHE *) +let find_type this k = ItemKeyMap.find k this.types +let find_const this k = ItemKeyMap.find k this.consts +let find_node this k = NodeKeyMap.find k this.nodes + + +(** PARCOURS *) +let fold_consts (f: Eff.item_key -> Eff.const -> 'a -> 'a) (this:t) (accin:'a) : 'a = + ItemKeyMap.fold f this.consts accin +let fold_types (f: Eff.item_key -> Eff.type_ -> 'a -> 'a) (this:t) (accin:'a) : 'a = + ItemKeyMap.fold f this.types accin +let fold_nodes (f: Eff.node_key -> Eff.node_exp -> 'a -> 'a) (this:t) (accin:'a) : 'a = + NodeKeyMap.fold f this.nodes accin + +let iter_consts (f: Eff.item_key -> Eff.const -> unit) (this:t) : unit = + ItemKeyMap.iter f this.consts +let iter_types (f: Eff.item_key -> Eff.type_ -> unit) (this:t) : unit = + ItemKeyMap.iter f this.types +let iter_nodes (f: Eff.node_key -> Eff.node_exp -> unit) (this:t) : unit = + NodeKeyMap.iter f this.nodes + + + +let add_type (k:Eff.item_key) (v:Eff.type_) (prg:t) : t = + { prg with types = ItemKeyMap.add k v prg.types } + +let add_const (k:Eff.item_key) (v:Eff.const) (prg:t) : t = + { prg with consts = ItemKeyMap.add k v prg.consts } + +let add_node (k:Eff.node_key) (v:Eff.node_exp) (prg:t) : t = +Verbose.printf ~level:3 "## LicPrg.add_node %s\n" (LicDump.string_of_node_key_rec k); + { prg with nodes = NodeKeyMap.add k v prg.nodes } + + +let dump_entete oc = + let time = Unix.localtime (Unix.time ()) in + let sys_call, _ = Array.fold_left + (fun (acc,i) x -> + if 70 < i + (String.length x) then + acc ^ "\n--\t\t" ^ x, String.length ("\n--\t\t" ^ x) + else + acc ^ " " ^ x , (i+1+(String.length x)) + ) + ("",0) + Sys.argv + and + date = Printf.sprintf "%d/%02d/%02d" + (1900+time.Unix.tm_year) + (time.Unix.tm_mon+1) + (time.Unix.tm_mday) + and + time_str = Printf.sprintf "%02d:%02d:%02d" + (time.Unix.tm_hour) + (time.Unix.tm_min) + (time.Unix.tm_sec) + (* and user = Unix.getlogin () *) + and hostname = Unix.gethostname () + in + (* Printf.fprintf oc "-- lus2lic version %s\n" Version.str; *) + (* Printf.fprintf oc "-- cmd: %s\n" sys_call; *) + (* Printf.fprintf oc "-- host: %s date: %s time: %s\n" hostname date time_str *) + Printf.fprintf oc "-- This file was generated by lus2lic version %s.\n" Version.str; + Printf.fprintf oc "-- %s\n" sys_call; + Printf.fprintf oc "-- on %s the %s at %s\n" hostname date time_str + +let to_file (oc: out_channel) (this:t) = + dump_entete oc; + (* On imprime dans l'ordre du iter, donc pas terrible ??? + *) + ItemKeyMap.iter + (fun tn te -> output_string !Global.oc (LicDump.type_decl tn te)) this.types; + ItemKeyMap.iter + (fun cn ce -> output_string !Global.oc (LicDump.const_decl cn ce)) this.consts; + + (* Pour les noeuds, pas sur que ça marche tant qu'on n'a + pas séparés les transformations source_to_source du LazyCompiler : + en cas d'expansion, il y avait cette remarque : + nb: we print res_struct, but do not return it from + node_check, because the structure and array expansion + modify (instanciate) the node profiles. + + On n'affiche PAS les extern Lustre::... + *) + + NodeKeyMap.iter ( + fun _ nexp -> + match nexp.Eff.node_key_eff with + (* inutile d'écrire les noeuds predefs *) + | (("Lustre",_),[]) -> () + | _ -> output_string !Global.oc (LicDump.node_of_node_exp_eff nexp) + ) + this.nodes + +(* GENERATEUR DE NOM DE VARIABLES *) +type id_generator = string -> string + +let fresh_var_id_generator : t -> Eff.node_exp -> id_generator = +fun prg ne -> + let cpt = ref 0 in + let forbidden = Hashtbl.create 100 in + let _ = iter_consts (fun i c -> match c with + | Eff.Extern_const_eff (s,_) + | Eff.Abstract_const_eff (s,_,_,_) + | Eff.Enum_const_eff (s,_) -> Hashtbl.add forbidden (snd s) () + | _ -> () + ) prg in + let dovar vi = Hashtbl.add forbidden vi.Eff.var_name_eff () in + let _ = List.iter dovar ne.Eff.inlist_eff in + let _ = List.iter dovar ne.Eff.outlist_eff in + let _ = match ne.Eff.loclist_eff with + | Some l -> List.iter dovar l | None -> () + in + let rec dogen (pfx: string) : string = + let id = Printf.sprintf "%s%02d" pfx !cpt in + incr cpt; + try ( + let _ = Hashtbl.find forbidden id in + dogen pfx + ) with Not_found -> ( + Hashtbl.add forbidden id (); + id + ) + in + dogen diff --git a/src/licPrg.mli b/src/licPrg.mli new file mode 100644 index 0000000000000000000000000000000000000000..2bba067fb8ed65df33f7bda1df69ed3a5eb01681 --- /dev/null +++ b/src/licPrg.mli @@ -0,0 +1,37 @@ + +type t + +val add_type : Eff.item_key -> Eff.type_ -> t -> t +val add_const : Eff.item_key -> Eff.const -> t -> t +val add_node : Eff.node_key -> Eff.node_exp -> t -> t + +val empty : t + +(* fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b *) + +val fold_consts : (Eff.item_key -> Eff.const -> 'a -> 'a) -> t -> 'a -> 'a +val fold_types : (Eff.item_key -> Eff.type_ -> 'a -> 'a) -> t -> 'a -> 'a +val fold_nodes : (Eff.node_key -> Eff.node_exp -> 'a -> 'a) -> t -> 'a -> 'a + +val iter_consts : (Eff.item_key -> Eff.const -> unit) -> t -> unit +val iter_types : (Eff.item_key -> Eff.type_ -> unit) -> t -> unit +val iter_nodes : (Eff.node_key -> Eff.node_exp -> unit) -> t -> unit + +val to_file : out_channel -> t -> unit + +val find_type : t -> Eff.item_key -> Eff.type_ +val find_const : t -> Eff.item_key -> Eff.const +val find_node : t -> Eff.node_key -> Eff.node_exp + +val fresh_type_id : t -> Ident.pack_name -> string -> Ident.long + +(* utile : générateur de noms de flow 'frais' + ATTENTION ! si on en utilise plusieurs + en meme temps, il ne doivent pas interferer ! +*) +type id_generator = string -> string +(* Initialisé avec +- le programme (pour éviter les constantes existantes) +- le noeud auquel on veut ajouter des variables +Et renvoie un générateur d'id unique prefixe -> nom *) +val fresh_var_id_generator : t -> Eff.node_exp -> id_generator diff --git a/src/main.ml b/src/main.ml index 96bdec1f8f629d6bff7078ff3abf5b51ee8b52af..5b810f7403d361a9b59e650aea7ac6f31feffa3a 100644 --- a/src/main.ml +++ b/src/main.ml @@ -59,161 +59,11 @@ let test_lex ( lexbuf ) = ( done ) -(*--------------------------------------------------------- -Les args sont des variables GLOBALES ----------------------------------------------------------*) - -let print_version = function (x: unit) -> ( - print_string (Version.str ^ "\n") -) - -let usage_msg = - "usage: "^(Version.tool)^" [options] <lustre files>\nwhere [options] can be:" - -let rec arg_list = [ - ( "--node", Arg.String(fun x -> Global.main_node := x; Global.compile_all_items := false), - "<node>" - ); - ( "-n", Arg.String(fun x -> Global.main_node := x; Global.compile_all_items := false), - "<node>\n\t Set the main node (all items are compiled if unset)" - ); - - ( "--output-file", Arg.String(fun x -> Global.outfile := x), "<file>" - ); - ( "-o", Arg.String(fun x -> Global.outfile := x), - "<file>\n\t Set the output file name." - ); - - ( "--keep-nested-calls", Arg.Unit (fun _ -> Global.one_op_per_equation := false), - "" - ); - ( "-knc", Arg.Unit (fun _ -> Global.one_op_per_equation := false), - "\n\t Keep nested calls. By default, only one node per equation is generated." - ); - - ( "--expand-iterators", Arg.Unit (fun _ -> Global.inline_iterator := true), - "" - ); - ( "-ei", Arg.Unit (fun _ -> Global.inline_iterator := true), - "\n\t Expand array iterators (i.e., generate iterator-free code)." - ); - - ( "--expand-enums", Arg.Unit (fun _ -> Global.expand_enums := true), - "" - ); - ( "-ee", Arg.Unit (fun _ -> Global.expand_enums := true), - "\n\t Translate enums into integers." - ); - - ( "--expand-structs-and-arrays", Arg.Unit - (fun _ -> Global.expand_structs := true;Global.inline_iterator := true), - "" - ); - ( "-esa", Arg.Unit - (fun _ -> Global.expand_structs := true;Global.inline_iterator := true), - "\n\t Expand structures and arrays using as many variables as necessary (automatically impose '-ei')." - ); - - ( "--expand-nodes", Arg.Unit (fun _ -> Global.expand_nodes := true), - "" - ); - ( "-en", Arg.Unit (fun _ -> Global.expand_nodes := true), - "\n\t Expand the main node (use the first node if no one is specified)." - ); - - ( "--do-not-expand-node", Arg.String add_dont_expand_nodes, - "<node>" - ); - ( "-den", Arg.String add_dont_expand_nodes, - "<node>\n\t Do not expand node (useful in the expand mode only of course)." - ); - - ( "--lustre-v4", Arg.Unit - (fun _ -> set_v4_options ()), - "\t" - ); - - ( "-lv4", Arg.Unit - (fun _ -> set_v4_options ()), - "\n\t Use Lustre V4 syntax (automatically impose '-ei -ee -esa')." - ); - - ( "--expanded-code", Arg.Unit - (fun _ -> set_ec_options ()), - "" - ); - ( "-ec", Arg.Unit - (fun _ -> set_ec_options ()), - "\n\t Generate ec (actually just an alias for '-en -lv4 --no-prefix')." - ); - - ( "--no-prefix", Arg.Unit - (fun _ -> Global.no_prefix := true), - "\n\t Do not prefix variable names by their module (beware: variable names may clash with this option)." - ); - - ("--test-lexer",Arg.Set Global.tlex,"Internal option used to test the lexer"); - ("-tlex",Arg.Set Global.tlex,""); - - ( "--verbose-level", Arg.Int(fun vl -> Verbose.set_level vl ), "<int>" - ); - ( "-vl", Arg.Int(fun vl -> Verbose.set_level vl ), - "<int>\n\t Set the verbose level." - ); - - ( "--verbose", Arg.Unit (fun vl -> Verbose.set_level 1 ), - "" - ); - ( "-v", Arg.Unit (fun vl -> Verbose.set_level 1 ), - "\n\t Set the verbose level to 1." - ); - - ( "--version", Arg.Unit(fun x -> print_version () ; exit 0), - "" - ); - ( "-version", Arg.Unit(fun x -> print_version () ; exit 0), - "\n\t Display the current version of the tool." - ); - - ( "-unit", Arg.Unit (fun x -> Global.run_unit_test := true), - "\n\t Run some (internal) unit tests" - ); - - ("--nonreg-test", Arg.Unit(fun _ -> Global.nonreg_test := true), - ""); - - ("-h", Arg.Unit (fun _ -> (Arg.usage arg_list usage_msg; exit 0)), "" ); - ("-help", Arg.Unit (fun _ -> (Arg.usage arg_list usage_msg; exit 0)),"" ); - ("--help", Arg.Unit (fun _ -> (Arg.usage arg_list usage_msg; exit 0)), - "\n\t Display this message." ) -] -and set_v4_options () = - Global.lv4 := true; - Global.inline_iterator := true; - Global.expand_enums := true; - Global.expand_structs := true -and set_ec_options () = - set_v4_options (); - Global.ec := true; - Global.no_prefix := true; - Global.expand_nodes := true - -and add_dont_expand_nodes str = - Global.dont_expand_nodes := str::!Global.dont_expand_nodes -and - parse_args () = ( - Arg.parse arg_list (* liste des options *) - Global.add_infile (* arg par defaut = fichier d'entree *) - usage_msg (* message d'erreur *) - ; - () - ) - - (* Retourne un SyntaxTree.t *) let lus_load lexbuf = let tree = Parser.program Lexer.lexer lexbuf in Name.update_fresh_var_prefix (); + (* ICI *) SolveIdent.recognize_predef_op tree @@ -328,6 +178,7 @@ let (get_source_list : string list -> SyntaxTree.pack_or_model list) = p::packed_list +(* let dump_entete oc = let time = Unix.localtime (Unix.time ()) in let sys_call, _ = Array.fold_left @@ -362,6 +213,7 @@ let dump_entete oc = (* "by "^ user ^ *) " the " ^ date ^ " at " ^ time_str ^ "\n\n"); flush oc +*) let my_exit i = @@ -371,14 +223,17 @@ let my_exit i = let main = ( (* Compile.init_appli () ; *) - parse_args (); - if Verbose.get_level() > 2 then Gc.set { (Gc.get ()) with Gc.verbose = 0x01 }; + (* parse_args (); *) + let args = MainArgs.parse Sys.argv in + Verbose.exe ~level:3 (fun () -> + Gc.set { (Gc.get ()) with Gc.verbose = 0x01 } + ); if !Global.run_unit_test then ( UnifyType.unit_test (); exit 0 ); if (!Global.infiles = []) then ( - Arg.usage arg_list usage_msg ; + MainArgs.usage stderr args; exit 1 ); try ( @@ -388,10 +243,10 @@ let main = ( Some (Ident.idref_of_string !Global.main_node) in if !Global.outfile <> "" then Global.oc := open_out !Global.outfile; - dump_entete !Global.oc; Compile.doit nsl main_node; - LicDump.dump_type_alias !Global.oc; - if Verbose.get_level() > 2 then Gc.print_stat stdout; + Verbose.exe ~level:3 (fun () -> + Gc.print_stat stdout + ); close_out !Global.oc ) with Sys_error(s) -> diff --git a/src/mainArgs.ml b/src/mainArgs.ml new file mode 100644 index 0000000000000000000000000000000000000000..b7ec488dd10c949a12988e3b340352209bee0749 --- /dev/null +++ b/src/mainArgs.ml @@ -0,0 +1,277 @@ +(* +Le manager d'argument adapté de celui de lutin, plus joli +N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global, +du coup, le fait de rendre un type "t" est une koketerie ! +*) +open Version +open Verbose +open Arg + +let tool_name = Version.tool +let usage_msg = "usage: "^tool_name^" [options] <file> | "^tool_name^" -help" + +type t = { + mutable _opts : (string * Arg.spec * string) list; (* classical Arg option tab used by Arg.parse *) + mutable _user_man : (string * string list) list; (* ad hoc tab for pretty prtting usage *) + mutable _hidden_man: (string * string list) list; (* ad hoc tab for pretty prtting usage *) + mutable _others: string list; + mutable _margin : int; + +} + +let (make_opt : unit -> t) = + fun () -> + { + _opts = []; + _user_man = []; + _hidden_man = []; + _others = []; + _margin = 12; +} + + +(* all unrecognized options are accumulated *) +let (add_other : t -> string -> unit) = + fun opt s -> + opt._others <- s::opt._others + +let pspec os opt (c, ml) = ( + let (m1, oth) = match ml with + | h::t -> (h,t) + | _ -> ("",[]) + in + let t2 = String.make opt._margin ' ' in + let cl = String.length c in + let t1 = if (cl < opt._margin ) then + String.make (opt._margin - cl) ' ' + else + "\n"^t2 + in + Printf.fprintf os "%s%s%s" c t1 m1; + List.iter (function x -> Printf.fprintf os "\n%s%s" t2 x) oth ; + Printf.fprintf os "\n" ; +) + +let usage os opt = ( + let l = List.rev opt._user_man in + Printf.fprintf os "%s\n\n" usage_msg; + List.iter (pspec os opt) l +) +let help opt ()= ( + usage stdout opt; + exit 0 +) +let full_usage os opt = ( + Printf.fprintf os "%s\n" usage_msg; + let l = List.rev opt._user_man in + List.iter (pspec os opt) l; + let l = List.rev (opt._hidden_man) in + List.iter (pspec os opt) l +) +let full_help opt ()= ( + full_usage stdout opt; + exit 0 +) + +let unexpected s opt = ( + prerr_string ("unexpected argument \""^s^"\""); + prerr_newline (); + usage stderr opt; + exit 1 +) +let file_notfound f opt = ( + prerr_string ("File not found: \""^f^"\""); + prerr_newline (); + usage stderr opt; + exit 1 +) + +let (mkopt : t -> string list -> ?hide:bool -> ?arg:string -> Arg.spec -> string list -> unit) = + fun opt ol ?(hide=false) ?(arg="") se ml -> + let treto o = opt._opts <- (o, se, "")::opt._opts in + List.iter treto ol ; + let col1 = (String.concat ", " ol)^arg in + if hide + then opt._hidden_man <- (col1, ml)::opt._hidden_man + else opt._user_man <- (col1, ml)::opt._user_man + (* + let tabs = String.make (col - (String.length o) - (String.length arg)) ' ' in + (* (o, se, arg^tabs^m) *) + (o, se, arg^"\n "^m) + *) + +(* utils *) +let set_v4_options () = + Global.lv4 := true; + Global.inline_iterator := true; + Global.expand_enums := true; + Global.expand_structs := true +let set_ec_options () = + set_v4_options (); + Global.ec := true; + Global.no_prefix := true; + Global.expand_nodes := true + +(*** USER OPTIONS TAB **) +let mkoptab (opt:t) : unit = ( + mkopt opt + ["-n";"-node"] + ~arg:" <string>" + (Arg.String(function x -> + Global.main_node := x; + Global.compile_all_items := false)) + ["Set the main node (all items are compiled if unset)"] + ; + mkopt opt + ["-o";"--output-file"] + ~arg:" <string>" + (Arg.String(function x -> + Global.outfile := x)) + ["Set the output file name"] + ; + mkopt opt + ["-knc"; "--keep-nested-calls"] + (Arg.Unit (fun _ -> Global.one_op_per_equation := false)) + ["Keep nested calls. By default, only one node per equation is generated."] + ; + mkopt opt + ["-ei"; "--expand-iterators"] + (Arg.Unit (fun _ -> Global.inline_iterator := true)) + ["Expand array iterators (i.e., generate iterator-free code)."] + ; + mkopt opt + ["-ee"; "--expand-enums"] + (Arg.Unit (fun _ -> Global.expand_enums := true)) + [" Translate enums into integers."] + ; + mkopt opt + ["-esa"; "--expand-structs-and-arrays"] + (Arg.Unit (fun _ -> + Global.expand_structs := true; + Global.inline_iterator := true)) + ["Expand structures and arrays using as many variables as necessary (automatically impose '-ei')"] + ; + mkopt opt + ["-en"; "--expand-nodes"] + (Arg.Unit (fun _ -> Global.expand_nodes := true)) + ["Expand the main node (use the first node if no one is specified)."] + ; + mkopt opt + ["-den"; "--do_not-expand-nodes"] + ~arg:" <string>" + (Arg.String (fun str -> + Global.dont_expand_nodes := str::!Global.dont_expand_nodes + )) + ["Do not expand node (useful in the expand mode only of course)."] + ; + mkopt opt + ["-lv4"; "--lustre-v4"] + (Arg.Unit (fun _ -> set_v4_options ())) + ["Use Lustre V4 syntax (automatically impose '-ei -ee -esa')."] + ; + mkopt opt + ["-ec"; "--expanded-code"] + (Arg.Unit (fun _ -> set_ec_options ())) + ["Generate ec (actually just an alias for '-en -lv4 --no-prefix')."] + ; + mkopt opt + ["-np"; "--no-prefix"] + (Arg.Set Global.no_prefix) + ["Do not prefix variable names by their module (beware: variable names may clash with this option)."] + ; + + mkopt opt + ["-version"; "--version"] + (Arg.Unit(function _ -> Printf.fprintf stderr "%s\n" Version.str; exit 0)) + ["Print the current version and exit"] + ; + (* verbose *) + mkopt opt + ["-v"; "--verbose"] + (Arg.Unit(function _ -> Verbose.on () )) + ["Set the verbose level to 1"] + ; + mkopt opt + ["-vl"] + ~arg:" <int>" + (Arg.Int(function i -> Verbose.set i)) + ["Set the verbose level"] + ; + + (* to show Hidden opt *) + mkopt opt + ["-more"] + (* (Arg.Unit(fun _ -> opt._see_all_options <- true)) *) + (Arg.Unit (full_help opt)) + ["Show hidden options (for dev purposes)"]; + (* HIDDEN *) + + (* test lexical *) + mkopt opt ~hide:true + ["-tlex"; "--test-lexer"] + (Arg.Set Global.tlex) + ["Test the lexical analysis"] + ; + (* test syntaxique + mkopt opt ~hide:true + ["-tparse"] + (Arg.Unit(function _ -> opt._gen_mode <- GenLuc ; opt._test_parse <- true ; ())) + ["Test the syntactic analysis"] + ; + *) + mkopt opt ~hide:true + ["-unit"] + (Arg.Set Global.run_unit_test) + ["Run some (internal) unit tests"] + ; + mkopt opt ~hide:true + ["--nonreg-test"] + (Arg.Set Global.nonreg_test) + ["(internal)"] + ; + (* misc degub flag *) + mkopt opt ~hide:true + ["-dbg"; "--debug"] + (Arg.Symbol + ( Verbose.flag_list (), fun s -> let f = Verbose.get_flag s in Verbose.set_flag f)) + [ "<dbg_flag>"; + "Possible dbg_flag are: " ^(String.concat ", " (Verbose.flag_list())) ] +) + + +let first_line b = ( + try ( + let f = String.index b '\n' in + String.sub b 0 f + ) with Not_found -> b +) + + +let current = ref 0;; + +(* La ``méthode'' principale *) +let parse argv = ( + let opt = make_opt() in + let save_current = !current in + try ( + mkoptab opt; + Arg.parse_argv ~current:current argv opt._opts (add_other opt) usage_msg; + (List.iter + (fun f -> + if (String.sub f 0 1 = "-") then + unexpected f opt + else if not (Sys.file_exists f) then + file_notfound f opt + else () + ) + opt._others + ); + Global.infiles := (List.rev opt._others); + current := save_current; + opt + ) with + (* only 1rst line is interesting ! *) + | Bad msg -> Printf.fprintf stderr "%s\n" (first_line msg); usage stderr opt; exit 2; + | Help msg -> help opt (); +) + diff --git a/src/mainArgs.mli b/src/mainArgs.mli new file mode 100644 index 0000000000000000000000000000000000000000..b00eae1dee6572dbd084b7e504fb21e1a878084e --- /dev/null +++ b/src/mainArgs.mli @@ -0,0 +1,12 @@ + +(* koketeri, vu qu'on continu à ranger concetement + les options dans des var. globales ! (cf Global +*) +type t + +(* La ``méthode'' principale *) +val parse : string array -> t + +val usage : out_channel -> t -> unit +val full_usage : out_channel -> t -> unit + diff --git a/src/name.ml b/src/name.ml index b64d0c18521864fcb7907fd2b21cd5cf400c9ba9..b3d21733d201182b98e840590e2ea45ddc60e345 100644 --- a/src/name.ml +++ b/src/name.ml @@ -121,9 +121,10 @@ let (update_fresh_var_prefix : unit -> unit) = else ( let new_prefix = ("_" ^ (string_of_int index)) in fresh_var_prefix := new_prefix ; - if (Verbose.get_level()>1) then ( - print_string ("I use " ^ new_prefix ^ " as prefix for fresh var names.\n"); - flush stdout + Verbose.exe ~level:1 ( + fun () -> + prerr_string ("I use " ^ new_prefix ^ " as prefix for fresh var names.\n"); + flush stderr ) ) diff --git a/src/nodesExpand.ml b/src/nodesExpand.ml index a51c66b6333fd20217ab64af6fc3e53226fb461f..cb70979e2b24ba161d333b405f13d361ddedf761 100644 --- a/src/nodesExpand.ml +++ b/src/nodesExpand.ml @@ -10,7 +10,7 @@ open Predef (* stuff to create fresh var names. XXX code dupl. with Split.new_var *) -let new_var str node_env type_eff clock_eff = +let new_var str ze_env type_eff clock_eff = let id = Ident.of_string (Name.new_local_var str) in (* let id = Ident.of_string (Name.new_local_var "h") in *) let var = @@ -23,7 +23,7 @@ let new_var str node_env type_eff clock_eff = var_clock_eff = clock_eff; } in - Hashtbl.add node_env.lenv_vars id var; + Hashtbl.add ze_env.local.lenv_vars id var; var (********************************************************************************) @@ -32,8 +32,8 @@ let get_locals node = | None -> [] | Some l -> l -let rec (get_node_body : Eff.local_env -> Eff.node_exp -> Eff.node_body option) = - fun node_env node -> +let rec (get_node_body : Eff.node_env -> Eff.node_exp -> Eff.node_body option) = + fun ze_env node -> match node.def_eff with | ExternEff | AbstractEff None -> None @@ -60,24 +60,22 @@ and subst_in_left s left = and (subst_in_val_exp : subst -> val_exp -> val_exp) = fun s ve -> let newve = { - ve with core = - match ve.core with + ve with ve_core = + match ve.ve_core with | CallByPosEff (by_pos_op, OperEff vel) -> let lxm = by_pos_op.src in let by_pos_op = by_pos_op.it in let vel = List.map (subst_in_val_exp s) vel in let by_pos_op = match by_pos_op with - - | IDENT idref -> - let idref = + | CONST_REF idl -> CONST_REF idl + | VAR_REF id -> + let id' = try - let id = Ident.of_idref idref in let var = snd(List.find (fun (v,_) -> v.var_name_eff = id) s) in - let idref = Ident.to_idref var.var_name_eff in - idref - with Not_found -> idref + var.var_name_eff + with Not_found -> id in - IDENT idref + VAR_REF id' | WITH(ve) -> WITH(subst_in_val_exp s ve) | HAT(i,ve) -> HAT(i, subst_in_val_exp s ve) @@ -87,7 +85,7 @@ and (subst_in_val_exp : subst -> val_exp -> val_exp) = let var = snd(List.find (fun (v,_) -> v.var_name_eff = cv) s) in let cv = var.var_name_eff in WHEN(SyntaxTreeCore.NamedClock {src=lxm;it=(cc,cv)}) - | Predef _| CALL _ | PRE | ARROW | FBY | CURRENT | TUPLE + | PREDEF_CALL _| CALL _ | PRE | ARROW | FBY | CURRENT | TUPLE | CONCAT | STRUCT_ACCESS _ | ARRAY_ACCES _ | ARRAY_SLICE _ | MERGE _ (* | CONST _ *) -> by_pos_op @@ -115,18 +113,18 @@ type acc = * (Eff.eq_info srcflagged) list (* equations *) * Eff.var_info list (* new local vars *) -let (mk_fresh_loc : Eff.local_env -> var_info -> var_info) = - fun node_env v -> - new_var (Ident.to_string v.var_name_eff) node_env v.var_type_eff v.var_clock_eff +let (mk_fresh_loc : Eff.node_env -> var_info -> var_info) = + fun ze_env v -> + new_var (Ident.to_string v.var_name_eff) ze_env v.var_type_eff v.var_clock_eff -let (mk_input_subst: Eff.local_env -> Lxm.t -> var_info list -> +let (mk_input_subst: Eff.node_env -> Lxm.t -> var_info list -> Eff.val_exp list -> acc -> subst * acc) = - fun node_env lxm vl vel acc -> + fun ze_env lxm vl vel acc -> List.fold_left2 (fun (s,(a_acc,e_acc,v_acc)) v ve -> (* we create a new var for each node argument, which is a little bit « bourrin » if ever ve is a simple ident... *) - let nv = mk_fresh_loc node_env v in + let nv = mk_fresh_loc ze_env v in let neq = [LeftVarEff(nv,lxm)],ve in let neq = flagit neq lxm in (v,nv)::s,(a_acc, neq::e_acc, nv::v_acc) @@ -136,20 +134,20 @@ let (mk_input_subst: Eff.local_env -> Lxm.t -> var_info list -> vel (* create fresh vars if necessary *) -let (mk_output_subst : Eff.local_env -> Lxm.t -> var_info list -> Eff.left list -> +let (mk_output_subst : Eff.node_env -> Lxm.t -> var_info list -> Eff.left list -> acc -> subst * acc) = - fun node_env lxm vl leftl acc -> + fun ze_env lxm vl leftl acc -> List.fold_left2 (fun (s,acc) v left -> match left with | LeftVarEff(v2,lxm) -> (v,v2)::s, acc | _ -> - let nv = mk_fresh_loc node_env v in - let nv_idref = Ident.to_idref nv.var_name_eff in + let nv = mk_fresh_loc ze_env v in + let nv_id = nv.var_name_eff in let nve = { - core = CallByPosEff({it=IDENT nv_idref;src = lxm },OperEff []); - typ = [nv.var_type_eff]; - clk = [snd nv.var_clock_eff] + ve_core = CallByPosEff({it=VAR_REF nv_id;src = lxm },OperEff []); + ve_typ = [nv.var_type_eff]; + ve_clk = [snd nv.var_clock_eff] } in let neq = [left], nve in @@ -168,19 +166,21 @@ let (mk_output_subst : Eff.local_env -> Lxm.t -> var_info list -> Eff.left list vl leftl -let rec (expand_eq : Eff.local_env -> acc -> Eff.eq_info Lxm.srcflagged -> acc) = - fun node_env (asserts, eqs, locs) { src = lxm_eq ; it = eq } -> - match expand_eq_aux node_env eq with +let rec (expand_eq : Eff.node_env -> acc -> Eff.eq_info Lxm.srcflagged -> acc) = + fun ze_env (asserts, eqs, locs) { src = lxm_eq ; it = eq } -> + match expand_eq_aux ze_env eq with | None -> asserts, { src = lxm_eq ; it = eq }::eqs, locs | Some(nasserts, neqs, nlocs) -> List.rev_append nasserts asserts, List.rev_append neqs eqs, List.rev_append nlocs locs -and (expand_eq_aux: Eff.local_env -> Eff.eq_info -> acc option)= - fun node_env (lhs,ve) -> - match ve.core with - | CallByPosEff( { it = Eff.CALL node ; src = lxm }, OperEff vel) -> +and (expand_eq_aux: Eff.node_env -> Eff.eq_info -> acc option)= + fun ze_env (lhs,ve) -> + match ve.ve_core with + | CallByPosEff( { it = Eff.CALL node_key ; src = lxm }, OperEff vel) -> + let node = UglyStuff.node_exp_of_node_key ze_env.global node_key.it lxm in + let node = flagit node lxm in let node = match node.it.def_eff with | AbstractEff (Some n) -> { it = n ; src = lxm } | _ -> node @@ -191,49 +191,49 @@ and (expand_eq_aux: Eff.local_env -> Eff.eq_info -> acc option)= then None else - (match get_node_body node_env node.it with + (match get_node_body ze_env node.it with | None -> None | Some node_body -> let node_eqs = node_body.eqs_eff and asserts = node_body.asserts_eff in let node = node.it in let node_locs = get_locals node in - let fresh_locs = List.map (mk_fresh_loc node_env) node_locs in + let fresh_locs = List.map (mk_fresh_loc ze_env) node_locs in let acc = [],[],fresh_locs in - let is,acc = mk_input_subst node_env lxm node.inlist_eff vel acc in - let os,acc = mk_output_subst node_env lxm node.outlist_eff lhs acc in + let is,acc = mk_input_subst ze_env lxm node.inlist_eff vel acc in + let os,acc = mk_output_subst ze_env lxm node.outlist_eff lhs acc in let ls = mk_loc_subst node_locs fresh_locs in let s = List.rev_append is (List.rev_append os ls) in let node_eqs = List.map (substitute s) node_eqs in let subst_assert x = Lxm.flagit (subst_in_val_exp s x.it) x.src in let asserts = List.map subst_assert asserts in - let acc = List.fold_left (expand_eq node_env) acc node_eqs in - let acc = List.fold_left (expand_assert node_env) acc asserts in + let acc = List.fold_left (expand_eq ze_env) acc node_eqs in + let acc = List.fold_left (expand_assert ze_env) acc asserts in Some acc ) | CallByPosEff (_, _) | CallByNameEff (_, _) -> None -and (expand_assert : Eff.local_env -> acc -> val_exp srcflagged -> acc) = +and (expand_assert : Eff.node_env -> acc -> val_exp srcflagged -> acc) = fun n_env (a_acc,e_acc,v_acc) ve -> let lxm = ve.src in let ve = ve.it in let clk = Ident.of_string "dummy_expand_assert", BaseEff in let assert_var = new_var "assert" n_env Bool_type_eff clk in let assert_eq = Lxm.flagit ([LeftVarEff(assert_var,lxm)], ve) lxm in - let assert_op = Eff.IDENT(Ident.to_idref assert_var.var_name_eff) in + let assert_op = Eff.VAR_REF(assert_var.var_name_eff) in let nve = { - core = CallByPosEff((Lxm.flagit assert_op lxm, OperEff [])); - typ = [Bool_type_eff]; - clk = [BaseEff] + ve_core = CallByPosEff((Lxm.flagit assert_op lxm, OperEff [])); + ve_typ = [Bool_type_eff]; + ve_clk = [BaseEff] } in expand_eq n_env ((Lxm.flagit nve lxm)::a_acc, e_acc, assert_var::v_acc) assert_eq (* exported *) -let (f : Eff.local_env -> Eff.node_exp -> Eff.node_exp) = +let (f : Eff.node_env -> Eff.node_exp -> Eff.node_exp) = fun n_env n -> match n.def_eff with | ExternEff diff --git a/src/nodesExpand.mli b/src/nodesExpand.mli index 5b3cb7d31f17b06cd4b43c3beb77edd26f10d774..555deee31e1e86182cd1490cb01afd27050327fe 100644 --- a/src/nodesExpand.mli +++ b/src/nodesExpand.mli @@ -68,4 +68,4 @@ *) -val f : Eff.local_env -> Eff.node_exp -> Eff.node_exp +val f : Eff.node_env -> Eff.node_exp -> Eff.node_exp diff --git a/src/parser.mly b/src/parser.mly index edb887d5264fde3c982d423d69ee7ade45e15412..b01dd885984738e2d432b1d95e4a086b91faa1c4 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -835,29 +835,29 @@ ClockExpr: ; PredefOp: /* ebnf:print=short */ - TK_NOT { {src=$1; it=Predef_n(NOT_n,[])} } + TK_NOT { make_predef_posop $1 NOT_n } | TK_FBY { {src=$1; it=FBY_n} } | TK_PRE { {src=$1; it=PRE_n} } | TK_CURRENT{ {src=$1; it=CURRENT_n} } | TK_ARROW { {src=$1; it=ARROW_n} } - | TK_AND { {src=$1; it=Predef_n(AND_n,[]) } } - | TK_OR { {src=$1; it=Predef_n(OR_n,[]) } } - | TK_XOR { {src=$1; it=Predef_n(XOR_n,[]) } } - | TK_IMPL { {src=$1; it=Predef_n(IMPL_n,[]) } } - | TK_EQ { {src=$1; it=Predef_n(EQ_n,[]) } } - | TK_NEQ { {src=$1; it=Predef_n(NEQ_n,[]) } } - | TK_LT { {src=$1; it=Predef_n(LT_n,[]) } } - | TK_LTE { {src=$1; it=Predef_n(LTE_n,[]) } } - | TK_GT { {src=$1; it=Predef_n(GT_n,[]) } } - | TK_GTE { {src=$1; it=Predef_n(GTE_n,[]) } } - | TK_DIV { {src=$1; it=Predef_n(DIV_n,[]) } } - | TK_MOD { {src=$1; it=Predef_n(MOD_n,[]) } } - | TK_MINUS { {src=$1; it=Predef_n(MINUS_n,[]) } } - | TK_PLUS { {src=$1; it=Predef_n(PLUS_n,[]) } } - | TK_SLASH { {src=$1; it=Predef_n(SLASH_n,[]) } } - | TK_STAR { {src=$1; it=Predef_n(TIMES_n,[]) } } - | TK_IF { {src=$1; it=Predef_n(IF_n,[]) } } + | TK_AND { make_predef_posop $1 AND_n } + | TK_OR { make_predef_posop $1 OR_n } + | TK_XOR { make_predef_posop $1 XOR_n } + | TK_IMPL { make_predef_posop $1 IMPL_n } + | TK_EQ { make_predef_posop $1 EQ_n } + | TK_NEQ { make_predef_posop $1 NEQ_n } + | TK_LT { make_predef_posop $1 LT_n } + | TK_LTE { make_predef_posop $1 LTE_n } + | TK_GT { make_predef_posop $1 GT_n } + | TK_GTE { make_predef_posop $1 GTE_n } + | TK_DIV { make_predef_posop $1 DIV_n } + | TK_MOD { make_predef_posop $1 MOD_n } + | TK_MINUS { make_predef_posop $1 MINUS_n } + | TK_PLUS { make_predef_posop $1 PLUS_n } + | TK_SLASH { make_predef_posop $1 SLASH_n } + | TK_STAR { make_predef_posop $1 TIMES_n } + | TK_IF { make_predef_posop $1 IF_n } ; /* nothing to do here !!! @@ -1016,11 +1016,11 @@ SurelyType: { {src=$1.src; it = Array_type_exp ($1 , $3) } } ; -/* SimpleExp = statically evaluable exp */ +/* SimpleExp = (hopefuly) statically evaluable exp */ SimpleExp: Constant { $1 } | IdentRef { leafexp $1.src (IDENT_n $1.it) } - | TK_OPEN_PAR SimpleExp TK_CLOSE_PAR { $2 } + | SimpleTuple { $1 } | TK_NOT SimpleExp { unexp_predef $1 NOT_n $2 } | TK_MINUS SimpleExp %prec TK_UMINUS { unexp_predef $1 UMINUS_n $2 } @@ -1045,6 +1045,20 @@ SimpleExp: { ternexp_predef $1 IF_n $2 $4 $6 } ; +SimpleTuple: + | TK_OPEN_PAR SimpleExpList TK_CLOSE_PAR + { + (match $2 with + | [x] -> x + | l -> naryexp $1 TUPLE_n (List.rev l) ) + } + +SimpleExpList: SimpleExp + { [$1] } + | SimpleExpList TK_COMA SimpleExp + { $3::$1 } + ; + /* Appel fonctionnel par nom */ /* NB Actuellement, uniquement pour les structures, @@ -1084,7 +1098,7 @@ CallByNameParam: { ({it=Lxm.id $1;src=$1} , $3) } ; -/* WARNING ! : les listes sont crées à l'envers */ +/* WARNING ! : les listes sont créées à l'envers */ ExpressionList: Expression { [$1] } | ExpressionList TK_COMA Expression @@ -1093,13 +1107,13 @@ ExpressionList: Expression Constant: /* ebnf:print=short */ TK_TRUE - { (leafexp $1 (Predef_n(TRUE_n,[]))) } + { (leafexp_predef $1 TRUE_n) } | TK_FALSE - { (leafexp $1 (Predef_n(FALSE_n,[]))) } + { (leafexp_predef $1 FALSE_n) } | IntConst - { (leafexp $1 (Predef_n((ICONST_n (Lxm.id $1)),[]))) } + { (leafexp_predef $1 (ICONST_n (Lxm.id $1))) } | RealConst - { (leafexp $1 (Predef_n((RCONST_n (Lxm.id $1)),[]))) } + { (leafexp_predef $1 ((RCONST_n (Lxm.id $1)))) } ; IntConst: /* ebnf:print=ignore */ diff --git a/src/parserUtils.ml b/src/parserUtils.ml index d5bab635807fd7fe3c98a6238448a354d2f15358..b29abc93840bd9639694e18ec891a7b21a2a74fb 100644 --- a/src/parserUtils.ml +++ b/src/parserUtils.ml @@ -120,22 +120,43 @@ let flat_twice_flagged_list (** Utilitaries to build [val_exp] *) -let leafexp lxm op = CallByPos({src = lxm ; it = op }, Oper []) +let make_predef_posop lxm op = + let op = flagit op lxm in + {src = lxm ; it = Predef_n (op,[]) } -let unexp lxm op e1 = CallByPos( {src = lxm ; it = op }, Oper [e1] ) -let unexp_predef lxm op e1 = CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1] ) +let leafexp lxm op = + CallByPos({src = lxm ; it = op }, Oper []) -let binexp lxm op e1 e2 = CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2] ) -let binexp_predef lxm op e1 e2 = CallByPos( {src = lxm ; it = Predef_n (op,[]) }, - Oper [e1 ; e2] ) +let leafexp_predef lxm op = + let op = flagit op lxm in + CallByPos({src = lxm ; it = Predef_n (op,[]) }, Oper []) + +let unexp lxm op e1 = + CallByPos( {src = lxm ; it = op }, Oper [e1] ) + +let unexp_predef lxm op e1 = + let op = flagit op lxm in + CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1] ) + +let binexp lxm op e1 e2 = + CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2] ) + +let binexp_predef lxm op e1 e2 = + let op = flagit op lxm in + CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1 ; e2] ) let ternexp lxm op e1 e2 e3 = CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2; e3] ) -let ternexp_predef lxm op e1 e2 e3 = CallByPos( {src = lxm ; it = Predef_n (op,[]) }, - Oper [e1 ; e2; e3] ) -let naryexp lxm op elst = CallByPos( {src = lxm ; it = op }, Oper elst ) -let naryexp_predef lxm op elst = CallByPos( {src = lxm ; it = Predef_n (op,[]) }, - Oper elst ) +let ternexp_predef lxm op e1 e2 e3 = + let op = flagit op lxm in + CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper [e1 ; e2; e3] ) + +let naryexp lxm op elst = + CallByPos( {src = lxm ; it = op }, Oper elst ) + +let naryexp_predef lxm op elst = + let op = flagit op lxm in + CallByPos( {src = lxm ; it = Predef_n (op,[]) }, Oper elst ) let bynameexp lxm op nelst = CallByName( {src = lxm ; it = op } , nelst ) @@ -445,11 +466,10 @@ let (threat_slice_start : Lxm.t -> val_exp -> val_exp option -> slice_info srcfl let int_to_val_exp istr = try ignore (int_of_string istr); - CallByPos(flagit (Predef_n(ICONST_n (Ident.of_string(istr)),[])) lxm, - Oper []) + let ic = flagit (ICONST_n (Ident.of_string(istr))) lxm in + CallByPos(flagit (Predef_n (ic, [])) lxm, Oper []) with _ -> - CallByPos(flagit (IDENT_n (Ident.idref_of_string(istr))) lxm, - Oper []) + CallByPos(flagit (IDENT_n (Ident.idref_of_string(istr))) lxm, Oper []) in match Str.split (Str.regexp (Str.quote "..")) str with | [first] -> diff --git a/src/polymorphism.ml b/src/polymorphism.ml deleted file mode 100644 index bc30f9af0d797c1587e41e5cd9145657735a2381..0000000000000000000000000000000000000000 --- a/src/polymorphism.ml +++ /dev/null @@ -1,48 +0,0 @@ - -open Eff - -(* exported *) -exception Exc - -let type_ref = ref None - -(* exported *) -let get_type () = - match !type_ref with - | None -> raise Exc - | Some t -> t - - -let (set_type : Eff.type_ -> unit) = - fun t -> - type_ref := Some t - -(* exported *) -let (reset_type : unit -> unit) = (* To be called in order to avoid silent bugs *) - fun () -> - type_ref := None - - -(******************************************************************************) - -let polymorphic_node_stack : (Eff.node_env * Eff.node_exp) Stack.t = Stack.create () - -(* exported *) -let (push_on_polymorphic_node_stack : Eff.node_env * Eff.node_exp -> unit) = - fun n -> - Stack.push n polymorphic_node_stack - -(* exported *) -let (unstack_polymorphic_nodes : - Eff.type_ -> (Eff.node_env * Eff.node_exp) list) = - fun t -> - let _ = set_type t in - let rec aux l = - if Stack.is_empty polymorphic_node_stack then l else - let x = Stack.pop polymorphic_node_stack in - x::(aux l) - in - let res = aux [] in - res - - diff --git a/src/polymorphism.mli b/src/polymorphism.mli deleted file mode 100644 index f37cc0f13bca98971606281fb8ac9019741a1b88..0000000000000000000000000000000000000000 --- a/src/polymorphism.mli +++ /dev/null @@ -1,41 +0,0 @@ -(** Handling polymorphic nodes. - - XXX I'm not particularly happy with the way all this is done... - - Anyway, the idea is the following. As soon as we try (in - LazyCompiler) to dump a polymorphic node, we push it on a stack - (push_on_polymorphic_node_stack), instead of dumping it, as we - have decided that lic does not accept polymorphic nodes. This - ougth to occur in a unique situation: when an array iterator is - called over a polymorphic operator, e.g., in x = - map<<+,3>>([1;2;3],[1;2;3]); - - in such a situation, we do generate a polymorphic Eff.node_exp - for the expression "map<<+,3>>" (but we don't LicDump it). But - once we get that node_exp (in GetEff.translate_val_exp), by - unifying the node_exp with the dynamic arguments, we know that - the type variable was (here, an integer). Hence, we can now - print the instanciated node (unstack_polymorphic_nodes). - - Note that it is a stack because array iterators can be nested. - -*) - - -(* To deal with polymorphism: raised when a polymorphic expr is generated. *) -exception Exc - - -val get_type : unit -> Eff.type_ - -(* Should be unnecessary, but calling it at the appriopriate - place would avoid silent bugs *) -val reset_type : unit -> unit - -val push_on_polymorphic_node_stack : Eff.node_env * Eff.node_exp -> unit - -(** We have added the StructArrayExpand.node and Inline.iterators - functions as parameter of this function to break module - dependency loops. -*) -val unstack_polymorphic_nodes : Eff.type_ -> (Eff.node_env * Eff.node_exp) list diff --git a/src/predef.ml b/src/predef.ml index 8c6719b6563c609c46368d4a750e7bb9e8e3ec89..9ad2f52f72b3d47d5407671f63a4542fae0555f3 100644 --- a/src/predef.ml +++ b/src/predef.ml @@ -51,14 +51,8 @@ type op = | RSLASH_n | RTIMES_n -(* Array iterator *) - | Map - | Fill - | Red - | FillRed - | BoolRed - (* can occur into an array iterator *) +(* GESTION DES OP PREDEF LAISSE A DESIRER *) let iterable_op = [ NOT_n; REAL2INT_n; INT2REAL_n; AND_n; OR_n; XOR_n; IMPL_n; DIV_n; MOD_n; IUMINUS_n; IMINUS_n; IPLUS_n; ISLASH_n; ITIMES_n; @@ -108,11 +102,6 @@ let op2string = function | RPLUS_n -> "+" | RSLASH_n -> "/" | RTIMES_n -> "*" - | Map -> "map" - | Fill -> "fill" - | Red -> "red" - | FillRed -> "fillred" - | BoolRed -> "boolred" let op2string_long = function | EQ_n -> "eq" @@ -145,7 +134,9 @@ let is_infix = function | MOD_n | IF_n | MINUS_n | PLUS_n | SLASH_n | TIMES_n | IMINUS_n | IPLUS_n | ISLASH_n | ITIMES_n | RMINUS_n | RPLUS_n | RSLASH_n | RTIMES_n -> true - | ICONST_n _ | RCONST_n _ | BoolRed | FillRed | Red | Fill | Map | RUMINUS_n + | ICONST_n _ | RCONST_n _ + + | RUMINUS_n | IUMINUS_n | UMINUS_n | DIESE_n | NOR_n | INT2REAL_n | REAL2INT_n | NOT_n | FALSE_n | TRUE_n -> false @@ -201,12 +192,18 @@ let (string_to_op : string -> op) = | "rslash" -> RSLASH_n | "rtimes" -> RTIMES_n +(* Condact = predefined macro-op *) + (* | "condact" -> CondAct *) + + (* array iterator *) +(* | "map" -> Map | "fill" -> Fill | "red" -> Red | "fillred" -> FillRed | "boolred" -> BoolRed +*) | _ -> raise Not_found @@ -222,6 +219,12 @@ let (op_to_long : op -> Ident.long) = Ident.make_long (Ident.pack_name_of_string "Lustre") (Ident.of_string (op2string_long op)) + +let (op_to_idref : op -> Ident.idref) = + fun op -> + Ident.make_idref + (Ident.pack_name_of_string "Lustre") + (Ident.of_string (op2string_long op)) (*********************************************************************************) (* Automatically generate the latex documentation associated to predefined diff --git a/src/predefEvalClock.ml b/src/predefEvalClock.ml index 6c91c7b82165679b75865f7228ec17b0c56995c2..4e435f3edf85668c6271c470d95dacf2e293fb77 100644 --- a/src/predefEvalClock.ml +++ b/src/predefEvalClock.ml @@ -34,25 +34,13 @@ let if_clock_profile lxm sargs s = let rec fill x n = if n > 0 then (x::(fill x (n-1))) else [] -let fillred_clock_profile lxm sargs s clks = - let (_, lto) = PredefEvalType.fillred_profile lxm sargs in - let clks = List.flatten clks in - fill (List.hd clks) (List.length lto), s - -let map_clock_profile lxm sargs s clks = - let (_, lto) = PredefEvalType.map_profile lxm sargs in - let clks = List.flatten clks in - fill (List.hd clks) (List.length lto), s - -let boolred_clock_profile lxm sargs s clks = - let (_, lto) = PredefEvalType.boolred_profile lxm sargs in - let clks = List.flatten clks in - fill (List.hd clks) (List.length lto), s - - (* This table contains the clock profile of predefined operators *) -let (f: op -> Lxm.t -> Eff.static_arg list -> clocker) = - fun op lxm sargs s -> +let f + (id_solver: Eff.id_solver) + (op: op) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: clocker = fun s -> match op with | TRUE_n | FALSE_n | ICONST_n _ | RCONST_n _ -> constant_profile (Predef.op2string op) s @@ -67,9 +55,5 @@ let (f: op -> Lxm.t -> Eff.static_arg list -> clocker) = -> op_profile s | IF_n -> if_clock_profile lxm sargs s - | Red | Fill | FillRed -> fillred_clock_profile lxm sargs s - | Map -> map_clock_profile lxm sargs s - | BoolRed -> boolred_clock_profile lxm sargs s - diff --git a/src/predefEvalClock.mli b/src/predefEvalClock.mli index 0cf63d80854b6bd7e424e09d94e050afe8d0c471..8162e6fe63277cd424dba1be5c27dd6c93448ff4 100644 --- a/src/predefEvalClock.mli +++ b/src/predefEvalClock.mli @@ -6,4 +6,4 @@ type clocker = UnifyClock.subst -> Eff.id_clock list list -> Eff.id_clock list * UnifyClock.subst -val f: Predef.op -> Lxm.t -> Eff.static_arg list -> clocker +val f: Eff.id_solver -> Predef.op -> Lxm.t -> Eff.static_arg list -> clocker diff --git a/src/predefEvalConst.ml b/src/predefEvalConst.ml index 868afad5fb4720bd752e730ca91ac7ad6f379f4d..f36e10c9e5dbd2e1c5e8d5d9a5bcc7af662334cd 100644 --- a/src/predefEvalConst.ml +++ b/src/predefEvalConst.ml @@ -120,11 +120,15 @@ let (boolred_evaluator : int -> int -> const_evaluator) = (* exported *) -let (f: op -> Lxm.t -> Eff.static_arg list -> const_evaluator) = - fun op lxm sargs ll -> +let f + (id_solver: Eff.id_solver) + (op: op) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: const_evaluator = fun ll -> (* we first check the type so that we do not need to check it during the const evaluation *) - ignore (PredefEvalType.f op lxm sargs (List.map (List.map Eff.type_of_const) ll)); + ignore (PredefEvalType.f id_solver op lxm sargs (List.map (List.map Eff.type_of_const) ll)); match op with | TRUE_n -> sb_evaluator true ll | FALSE_n -> sb_evaluator false ll @@ -163,6 +167,8 @@ let (f: op -> Lxm.t -> Eff.static_arg list -> const_evaluator) = | RTIMES_n -> fff_evaluator ( *.) ll | NOR_n -> boolred_evaluator 0 0 ll | DIESE_n -> boolred_evaluator 1 1 ll +(* + | CondAct -> assert false | Map -> assert false | Fill -> assert false | Red -> assert false @@ -175,6 +181,7 @@ let (f: op -> Lxm.t -> Eff.static_arg list -> const_evaluator) = ] -> boolred_evaluator i j ll +*) | _ -> assert false (*********************************************************************************) diff --git a/src/predefEvalConst.mli b/src/predefEvalConst.mli index 79d4ad274556ad9f75a66b1bceea6a292bd8d78c..4fa8cefea59aba627cf9e4635bee93ae9b167942 100644 --- a/src/predefEvalConst.mli +++ b/src/predefEvalConst.mli @@ -10,6 +10,6 @@ val arity_error_const : Eff.const list -> string -> 'a type const_evaluator = Eff.const evaluator (* That function says how to statically evaluate constants *) -val f: +val f: Eff.id_solver -> Predef.op -> Lxm.t -> Eff.static_arg list -> const_evaluator diff --git a/src/predefEvalType.ml b/src/predefEvalType.ml index 82a8feef9c91521b8054dfca6f77191bdc1dd9b8..335dbfee716c4ad8faf5a93157563ac60d8ff055 100644 --- a/src/predefEvalType.ml +++ b/src/predefEvalType.ml @@ -5,6 +5,7 @@ open Lxm open Errors open UnifyType open Eff +open LicDump (* exported *) type typer = Eff.type_ Predef.evaluator @@ -16,26 +17,34 @@ exception EvalType_error of string (* exported *) let (type_error : Eff.type_ list -> string -> 'a) = fun tel expect -> - let str_l = List.map LicDump.string_of_type_eff4msg tel in + let str_l = List.map Eff.string_of_type tel in let str_provided = String.concat "*" str_l in raise (EvalType_error( ("\n*** type '" ^ str_provided ^ "' was provided" ^ (if expect = "" then "" else (" whereas\n*** type '" ^expect^"' was expected"))))) -let (type_error2 : string -> string -> string -> 'a) = - fun provided expect msg -> +let raise_type_error + (prov: Eff.type_ list) + (expec: Eff.type_ list) + (msg: string) += raise (EvalType_error( + let pr = Eff.string_of_type_list prov in + let ex = Eff.string_of_type_list expec in + ( + "\n*** type '" ^ pr ^ "' was provided" ^ ( + if ex = "" then "" + else (" whereas\n*** type '" ^ex^"' was expected") + ) ^ ( + if msg = "" then "" else ("\n*** " ^ msg) + ) + ) +)) + +let raise_arity_error (msg:string) (get:int) (expect:int) = raise (EvalType_error( - ("\n*** type '" ^ provided ^ "' was provided" ^ - (if expect = "" then "" - else (" whereas\n*** type '" ^expect^"' was expected")) ^ - (if msg = "" then "" else ("\n*** " ^ msg))))) - -let (arity_error : 'a list -> string -> 'b) = - fun v expect -> - raise (EvalType_error( - Printf.sprintf "\n*** arity error: %d argument%s, whereas %s were expected" - (List.length v) (if List.length v>1 then "s" else "") expect)) + Printf.sprintf "\n*** arity error%s: %d argument%s, whereas %d were expected" + msg get (if get>1 then "s" else "") expect)) (*********************************************************************************) (* a few local alias to make the node profile below more readable. *) @@ -60,13 +69,13 @@ let i_profile = [],[id "o", i] let r_profile = [],[id "o", r] (** polymorphic operator profiles *) -let aab_profile = [(id "i1",Any);(id "i2",Any)], [(id "o", b)] (* 'a -> 'a -> bool*) -let baaa_profile = [(id "c", b);(id "b1",Any);(id "b2",Any)], [(id "o",Any)] +let aab_profile = [(id "i1",(TypeVar Any));(id "i2",(TypeVar Any))], [(id "o", b)] (* 'a -> 'a -> bool*) +let baaa_profile = [(id "c", b);(id "b1",(TypeVar Any));(id "b2",(TypeVar Any))], [(id "o",(TypeVar Any))] (* for if-then-else *) (** overloaded operator profiles *) -let oo_profile = [(id "i",Overload)], [(id "o",Overload)] -let ooo_profile = [(id "i1",Overload);(id "i2",Overload)], [(id "o",Overload)] +let oo_profile = [(id "i",(TypeVar AnyNum))], [(id "o",(TypeVar AnyNum))] +let ooo_profile = [(id "i1",(TypeVar AnyNum));(id "i2",(TypeVar AnyNum))], [(id "o",(TypeVar AnyNum))] (** iterators profiles *) (* [type_to_array_type [x1;...;xn] c] returns the array type [x1^c;...;xn^c] *) @@ -75,82 +84,137 @@ let (type_to_array_type: Eff.var_info list -> int -> (Ident.t * Eff.type_) list) List.map (fun vi -> vi.var_name_eff, Array_type_eff(vi.var_type_eff,c)) l (* Extract the node and the constant from a list of static args *) -let (get_node_and_constant: Lxm.t -> - Eff.static_arg list -> Eff.item_key * var_info list * var_info list * int) = - fun lxm sargs -> - match sargs with - | [NodeStaticArgEff(_,((n,_), inlist, outlist), _); - ConstStaticArgEff(_,Int_const_eff c)] -> n, inlist, outlist, c +let get_node_and_int_const + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: (Eff.node_key * int) = + + match sargs with + | [ NodeStaticArgEff (_,nk); ConstStaticArgEff carg ] -> ( + let c = match carg with + | (_, Int_const_eff c) -> c + | (_, Abstract_const_eff(_,_,Int_const_eff c, true)) -> c + | (_, zcl) -> + let msg = "immediate integer expected, but get \"" + ^ (LicDump.string_of_const_eff zcl) + ^ "\"\n" + in raise (Compile_error(lxm, msg)) + in + (nk, c) + ) + | _ -> + let msg = "*** an integer and a node are expected.\n" in + raise (Compile_error(lxm, msg)) - | [NodeStaticArgEff(_,((n,_), inlist, outlist), _); - ConstStaticArgEff(_, Abstract_const_eff(l,_,Int_const_eff c, true))] -> - n, inlist, outlist, c +(*--------------------------------------------------------------------- +Typers for predef macros/iterators +---------------------------------------------------------------------*) - | [NodeStaticArgEff(_,_,_); ConstStaticArgEff(_, Extern_const_eff(l, _))] -> - let msg = "an integer is expected, whereas an extern constant (" ^ - (Ident.string_of_long l) ^ ") was provided.\n" - in - raise (Compile_error(lxm, msg)) - | [NodeStaticArgEff(_,_,_); ConstStaticArgEff(_, Abstract_const_eff(l,_,_, false))] -> - let msg = "an integer is expected, whereas an abstract constant (" ^ - (Ident.string_of_long l) ^ ") was provided.\n" - in - raise (Compile_error(lxm, msg)) - | [NodeStaticArgEff(_,((n,_), inlist, outlist),_); ConstStaticArgEff(_, const)] -> - let msg = "an integer is expected, whereas a " ^ - (LicDump.string_of_type_eff4msg (Eff.type_of_const const)) ^ - " was provided.\n" - in - raise (Compile_error(lxm, msg)) - | _ -> - let msg = "*** an integer and a node are expected.\n" in - raise (Compile_error(lxm, msg)) +let get_id_type vi = vi.var_name_eff, vi.var_type_eff -let map_profile = - (* Given - - a node n of type: tau_1 * ... * tau_n -> teta_1 * ... * teta_l - - a constant c (nb : sargs = [n,c]) - - The profile of map is: tau_1^c * ... * tau_n^c -> teta_1^c * ... * teta_l^c - *) - fun lxm sargs -> - let (n, inlist, outlist, c) = get_node_and_constant lxm sargs in - let lti = type_to_array_type inlist c in - let lto = type_to_array_type outlist c in - let res = (lti, lto) in +let condact_profile + (id_solver: Eff.id_solver) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: Eff.node_profile = +try +(*-------------------------------------------------------------------- +CONDACT +---------------------------------------------------------------------- + Given : + - A node n of type: a_1 * ... * a_n -> b_1 * ... * b_k + - A (tuple) const: b_1 * ... * b_k +Gen a node of type : bool * a_1 * ... * a_n -> b_1 * ... * b_k +---------------------------------------------------------------------*) + let nk, dflt = + match sargs with + | [NodeStaticArgEff(_,nk) ; ConstStaticArgEff(_,dflt)] -> nk, dflt + | _ -> assert false + in + (* recherche le profil de nk ... *) + let ne = UglyStuff.node_exp_of_node_key id_solver nk lxm in + let inlist = ne.inlist_eff in + let outlist = ne.outlist_eff in + + (* dflt_types doit êre compatiple avec outlist *) + let dflt_types = types_of_const dflt in + let dl = List.length dflt_types in + let ol = List.length outlist in + Verbose.printf ~level:3 " condact_profile: dflt=%s\n" (string_of_const_eff dflt); + let _ = if (dl <> ol) then + raise_arity_error " in condact default arg" dl ol in + let out_types = List.map (fun x -> x.var_type_eff) outlist in + + let _ = if dflt_types <> out_types then + raise_type_error dflt_types out_types "in condact default arg" + in + (* ok pour les args statiques, le profil dynamique est : *) + (("_", Bool_type_eff)::(List.map get_id_type inlist), List.map get_id_type outlist) +with +| EvalType_error msg -> raise (Compile_error(lxm, "type error: "^msg)) + + +let map_profile + (id_solver: Eff.id_solver) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: Eff.node_profile = +(*-------------------------------------------------------------------- +MAP +---------------------------------------------------------------------- + Given : + - A node n of type: a_1 * ... * a_n -> b_1 * ... * b_k + - A (int) const c +Gen a node of type : a_1^c * ... * a_n^c -> b_1^c * ... * b_k^c +--------------------------------------------------------------------*) + let (nk, c) = get_node_and_int_const lxm sargs in + (* recherche le profil de nk ... *) + let ne = UglyStuff.node_exp_of_node_key id_solver nk lxm in + let inlist = ne.inlist_eff in + let outlist = ne.outlist_eff in + let lti = type_to_array_type inlist c in + let lto = type_to_array_type outlist c in + let res = (lti, lto) in res -let get_id_type vi = vi.var_name_eff, vi.var_type_eff - -let (fillred_profile : Lxm.t -> Eff.static_arg list -> - (Ident.t * Eff.type_) list * (Ident.t * Eff.type_) list) = - (* Given - - a node n of type tau * tau_1 * ... * tau_n -> tau * teta_1 * ... * teta_l - - a constant c (nb : sargs = [n,c]) - - returns the profile: - tau * tau_1^c * ... * tau_n^c -> tau * teta_1^c * ... * teta_l^c - *) - fun lxm sargs -> - let (n, inlist, outlist, c) = get_node_and_constant lxm sargs in - let _ = assert(inlist <> [] && outlist <> []) in - let lti = (get_id_type (List.hd inlist)):: - type_to_array_type (List.tl inlist) c in - let lto = (get_id_type (List.hd outlist)):: - type_to_array_type (List.tl outlist) c in - let (id1, t1) = List.hd lti and (id2, t2) = List.hd lto in - let res = - if t1 = t2 then (lti,lto) else - (* if they are not equal, they migth be unifiable *) - match UnifyType.f [t1] [t2] with - | Equal -> (lti,lto) - | Unif t -> - (List.map (fun (id,tid) -> id, subst_type t tid) lti, - List.map (fun (id,tid) -> id, subst_type t tid) lto) - | Ko(msg) -> raise (Compile_error(lxm, msg)) - in - res +let fillred_profile + (id_solver: Eff.id_solver) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: Eff.node_profile = +(*-------------------------------------------------------------------- +FILLRED +---------------------------------------------------------------------- + Given : + - A node : aa * a_1 * ... * a_n -> aa * b_1 * ... * b_k + - An int c +Gen a node : aa * a_1^c * ... * a_n^c -> aa * b_1^c * ... * b_k^c +--------------------------------------------------------------------*) + + let (nk, c) = get_node_and_int_const lxm sargs in + (* recherche le profil de nk ... *) + let ne = UglyStuff.node_exp_of_node_key id_solver nk lxm in + let inlist = ne.inlist_eff in + let outlist = ne.outlist_eff in + + let _ = assert(inlist <> [] && outlist <> []) in + let lti = (get_id_type (List.hd inlist)):: + type_to_array_type (List.tl inlist) c in + let lto = (get_id_type (List.hd outlist)):: + type_to_array_type (List.tl outlist) c in + let (id1, t1) = List.hd lti and (id2, t2) = List.hd lto in + let res = + if t1 = t2 then (lti,lto) else + (* if they are not equal, they migth be unifiable *) + match UnifyType.f [t1] [t2] with + | Equal -> (lti,lto) + | Unif t -> + (List.map (fun (id,tid) -> id, subst_type t tid) lti, + List.map (fun (id,tid) -> id, subst_type t tid) lto) + | Ko(msg) -> raise (Compile_error(lxm, msg)) + in + res (* let fill_profile = fillred_profile *) (* Given @@ -172,8 +236,11 @@ let (fillred_profile : Lxm.t -> Eff.static_arg list -> returns the profile bool^k -> bool *) -let boolred_profile = - fun lxm sargs -> +let boolred_profile + (id_solver: Eff.id_solver) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: Eff.node_profile = let (get_three_constants: Lxm.t -> Eff.static_arg list -> int * int * int) = fun lxm sargs -> match sargs with @@ -184,14 +251,22 @@ let boolred_profile = in let (_i,_j,k) = get_three_constants lxm sargs in [id "i", (Array_type_eff(Bool_type_eff,k))], [id "o", b] - -type node_profile = (Ident.t * Eff.type_) list * (Ident.t * Eff.type_) list - - -let (op2profile : Predef.op -> Lxm.t -> Eff.static_arg list -> node_profile) = - fun op lxm sargs -> +(*---------------------------------------------------------------------*) + +let op2profile +(* BEQUILLE *) + (id_solver_opt: Eff.id_solver option) + (op: Predef.op) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: Eff.node_profile = + let id_solver () = + match id_solver_opt with + | Some s -> s + | None -> assert false + in let res = match op with | TRUE_n | FALSE_n -> b_profile @@ -209,9 +284,6 @@ let (op2profile : Predef.op -> Lxm.t -> Eff.static_arg list -> node_profile) = | MINUS_n | PLUS_n | TIMES_n | SLASH_n -> ooo_profile | RMINUS_n | RPLUS_n | RTIMES_n | RSLASH_n -> rrr_profile | DIV_n | MOD_n | IMINUS_n | IPLUS_n | ISLASH_n | ITIMES_n -> iii_profile - | Red | Fill | FillRed -> fillred_profile lxm sargs - | Map -> map_profile lxm sargs - | BoolRed -> boolred_profile lxm sargs | NOR_n | DIESE_n -> assert false (* XXX The current representation of node_profile prevent us @@ -224,17 +296,26 @@ let (op2profile : Predef.op -> Lxm.t -> Eff.static_arg list -> node_profile) = *) in res + (* exported *) -let (make_node_exp_eff : - bool option -> op -> Lxm.t -> Eff.static_arg list -> Eff.node_exp) = - fun has_mem op lxm sargs -> +(* VERSION GÉNÉRALE, valable + pour les MACROS, et qui necessite donc un Eff.id_solver +*) +let make_node_exp_eff + (id_solver: Eff.id_solver) + (has_mem: bool option) + (op: op) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: Eff.node_exp = + let id = Predef.op_to_long op in - let (lti,lto) = op2profile op lxm sargs in + let (lti,lto) = op2profile (Some id_solver) op lxm sargs in let i = ref 0 in - let is_polymorphic = ref false in + (* let is_polymorphic = ref false in *) let to_var_info_eff nature (vid, te) = let res = - if Eff.is_polymorphic te then is_polymorphic := true ; + (* if Eff.is_polymorphic te then is_polymorphic := true ; *) { var_name_eff = vid; var_nature_eff = nature; @@ -257,17 +338,67 @@ let (make_node_exp_eff : def_eff = ExternEff; has_mem_eff = (match has_mem with Some b -> b | None -> true); is_safe_eff = true; - is_polym_eff = + (* is_polym_eff = *) +(* List.exists (fun vi -> Eff.is_polymorphic vi.var_type_eff) inlist_eff || *) +(* List.exists (fun vi -> Eff.is_polymorphic vi.var_type_eff) outlist_eff *) + (* !is_polymorphic *) + } + in + res + +(* VERSION SIMPLE, valable + UNIQUEMENT pour les NON MACROS +*) +let make_simple_node_exp_eff + (has_mem: bool option) + (op: op) + (lxm: Lxm.t) +: Eff.node_exp = + + let id = Predef.op_to_long op in + let (lti,lto) = op2profile None op lxm [] in + let i = ref 0 in + (* let is_polymorphic = ref false in *) + let to_var_info_eff nature (vid, te) = + let res = + (* if Eff.is_polymorphic te then is_polymorphic := true ; *) + { + var_name_eff = vid; + var_nature_eff = nature; + var_number_eff = !i; + var_type_eff = te; + var_clock_eff = vid,BaseEff; + } + in + incr i; + res + in + let inlist_eff = List.map (to_var_info_eff SyntaxTreeCore.VarInput) lti in + let outlist_eff = (i:=0;List.map (to_var_info_eff SyntaxTreeCore.VarOutput) lto) in + let res = + { + node_key_eff = id,[] ; + inlist_eff = inlist_eff; + outlist_eff = outlist_eff; + loclist_eff = None; + def_eff = ExternEff; + has_mem_eff = (match has_mem with Some b -> b | None -> true); + is_safe_eff = true; + (* is_polym_eff = *) (* List.exists (fun vi -> Eff.is_polymorphic vi.var_type_eff) inlist_eff || *) (* List.exists (fun vi -> Eff.is_polymorphic vi.var_type_eff) outlist_eff *) - !is_polymorphic + (* !is_polymorphic *) } in res (* exported *) -let (f : op -> Lxm.t -> Eff.static_arg list -> typer) = - fun op lxm sargs ll -> +let f + (id_solver: Eff.id_solver) + (op: op) + (lxm: Lxm.t) + (sargs: Eff.static_arg list) +: typer = fun ll -> match op with | IF_n -> ( (* VERRUE 1 *) @@ -278,7 +409,7 @@ let (f : op -> Lxm.t -> Eff.static_arg list -> typer) = | [[Bool_type_eff]; t; e] -> if t = e then t else (type_error (List.flatten [[Bool_type_eff]; t; e]) "bool*any*any") - | x -> (arity_error x "3") + | x -> (raise_arity_error "" (List.length x) 3) ) | (NOR_n | DIESE_n) -> (* VERRUE 2 : cf XXX above: therefore i define an ad-hoc @@ -291,29 +422,26 @@ let (f : op -> Lxm.t -> Eff.static_arg list -> typer) = [Bool_type_eff] | _ -> (* general case *) - let node_eff = make_node_exp_eff (Some false) op lxm sargs in + let node_eff = make_node_exp_eff id_solver (Some false) op lxm sargs in let lti = List.map (fun v -> v.var_type_eff) node_eff.inlist_eff and lto = List.map (fun v -> v.var_type_eff) node_eff.outlist_eff in let l = List.flatten ll in if (List.length l <> List.length lti) then - arity_error [l] (string_of_int (List.length lti)) + raise_arity_error "" (List.length l) (List.length lti) + else if (l = []) then + (* useless to call UnifyType.f ! *) + lto else match UnifyType.f lti l with | Equal -> lto - | Unif Any -> - type_error2 - (LicDump.type_eff_list_to_string l) - (LicDump.type_eff_list_to_string lti) + | Unif (TypeVar Any) -> + raise_type_error l lti "could not instanciate polymorphic type" - | Unif Overload -> - type_error2 - (LicDump.type_eff_list_to_string l) - (LicDump.type_eff_list_to_string lti) + | Unif (TypeVar AnyNum) -> + raise_type_error l lti "could not instanciate overloaded type" - | Unif t -> List.map (subst_type t) lto | Ko(str) -> - type_error2 (LicDump.type_eff_list_to_string l) - (LicDump.type_eff_list_to_string lti) str + raise_type_error l lti str diff --git a/src/predefEvalType.mli b/src/predefEvalType.mli index 76839f7eb6879b7d09ab2f7983b1a94e72e0a71b..688514b83885f6d53a342ecd69003dce6ba67362 100644 --- a/src/predefEvalType.mli +++ b/src/predefEvalType.mli @@ -3,24 +3,25 @@ type typer = Eff.type_ Predef.evaluator exception EvalType_error of string -val type_error : Eff.type_ list -> string -> 'a -val arity_error : 'a list -> string -> 'b +(* val type_error : Eff.type_ list -> string -> 'a *) +val raise_arity_error : string -> int -> int -> 'b +val raise_type_error : Eff.type_ list -> Eff.type_ list -> string -> 'a (* Provides the type profile of predef operators. More precisely, given an operator and a list of types, This function checks that the provided types are ok, and returns the list of the operator output types. *) -val f : Predef.op -> Lxm.t -> Eff.static_arg list -> typer +val f : Eff.id_solver -> Predef.op -> Lxm.t -> Eff.static_arg list -> typer (* Does not work for NOR_n and DIESE_n! *) +(* PIS ALLER : 2 versions + - une pour les macros, qui nécessite un Eff.id_solver pour traiter les Eff.static_arg list + - l'autre pour les noeuds simple qui peut être utilisée statiquement +*) val make_node_exp_eff : - bool option -> Predef.op -> Lxm.t -> Eff.static_arg list -> Eff.node_exp - - -type node_profile = (Ident.t * Eff.type_) list * (Ident.t * Eff.type_) list + Eff.id_solver -> bool option -> Predef.op -> Lxm.t -> Eff.static_arg list -> Eff.node_exp -val fillred_profile : Lxm.t -> Eff.static_arg list -> node_profile -val map_profile : Lxm.t -> Eff.static_arg list -> node_profile -val boolred_profile : Lxm.t -> Eff.static_arg list -> node_profile +val make_simple_node_exp_eff : + bool option -> Predef.op -> Lxm.t -> Eff.node_exp diff --git a/src/solveIdent.ml b/src/solveIdent.ml index 3417d2a4e184ae8f8da74b91ba93438e93571edd..5276cb9687379c50a9401ce98ed00a8c73055515 100644 --- a/src/solveIdent.ml +++ b/src/solveIdent.ml @@ -17,6 +17,8 @@ open Lxm let flag f x_flg = Lxm.flagit (f x_flg.it) x_flg.src +let flag2 f x_flg = Lxm.flagit (f x_flg) x_flg.src + let fopt f = function None -> None | Some x -> Some (f x) @@ -60,36 +62,37 @@ and r_by_name_static_arg (id,arg) = | StaticArgIdent(idref) -> ( match get_predef idref with | None -> StaticArgIdent idref - | Some predef -> StaticArgNode (Predef_n (predef,[])) + | Some predef -> StaticArgNode (Predef_n (flagit predef arg.src,[])) ) | StaticArgConst(ve) -> StaticArgConst(r_val_exp ve) | StaticArgType(te) -> StaticArgType(te) - | StaticArgNode(by_pos_op) -> StaticArgNode(r_by_pos_op by_pos_op) + | StaticArgNode(by_pos_op) -> StaticArgNode(r_by_pos_op (flagit by_pos_op arg.src)) in id, Lxm.flagit arg_it arg.src and r_static_arg arg = - match arg with + match arg.it with | StaticArgIdent(idref) -> ( match get_predef idref with | None -> StaticArgIdent idref - | Some predef -> StaticArgNode (Predef_n (predef,[])) + | Some predef -> StaticArgNode (Predef_n (flagit predef arg.src,[])) ) | StaticArgConst(ve) -> StaticArgConst(r_val_exp ve) | StaticArgType(te) -> StaticArgType(te) - | StaticArgNode(by_pos_op) -> StaticArgNode(r_by_pos_op by_pos_op) + | StaticArgNode(by_pos_op) -> StaticArgNode(r_by_pos_op (flagit by_pos_op arg.src)) -and r_by_pos_op = function +and r_by_pos_op arg = + match arg.it with | Predef_n(op,args) -> Predef_n(op,args) (* assert false *) | CALL_n { src=lxm;it=(idref,sargs) } -> ( match get_predef idref with | None -> CALL_n { src=lxm;it= r_node_exp (idref,sargs) } - | Some op -> Predef_n (op, List.map (flag r_static_arg) sargs) + | Some op -> Predef_n (flagit op arg.src, List.map (flag2 r_static_arg) sargs) ) | IDENT_n(idref) -> ( match get_predef idref with | None -> IDENT_n(idref) - | Some op -> Predef_n (op,[]) + | Some op -> Predef_n (flagit op arg.src,[]) ) | ARRAY_ACCES_n(val_exp) -> ARRAY_ACCES_n(r_val_exp val_exp) | ARRAY_SLICE_n(slice_info) -> ARRAY_SLICE_n(r_slice_info slice_info) @@ -97,7 +100,7 @@ and r_by_pos_op = function | x -> x and r_node_exp (idref, sargs) = - (idref, List.map (flag r_static_arg) sargs) + (idref, List.map (flag2 r_static_arg) sargs) and r_slice_info si = { @@ -108,7 +111,7 @@ and r_slice_info si = { and r_val_exp = function | CallByPos (by_pos_op, Oper vel) -> - CallByPos(flag r_by_pos_op by_pos_op, Oper (List.map r_val_exp vel)) + CallByPos(flag2 r_by_pos_op by_pos_op, Oper (List.map r_val_exp vel)) | CallByName(by_name_op, args) -> CallByName(by_name_op, List.map (fun (id, ve) -> id, r_val_exp ve) args) @@ -150,7 +153,7 @@ and r_node_def = function | Extern -> Extern | Abstract -> Abstract | Body(node_body) -> Body(r_node_body node_body) - | Alias(by_pos_op) -> Alias(flag r_by_pos_op by_pos_op) + | Alias(by_pos_op) -> Alias(flag2 r_by_pos_op by_pos_op) and r_packbody pb = Hashtbl.iter diff --git a/src/split.mli b/src/split.mli deleted file mode 100644 index 8b65975a0a092a8f8ad9381d86f59c1325d30732..0000000000000000000000000000000000000000 --- a/src/split.mli +++ /dev/null @@ -1,33 +0,0 @@ -(** Time-stamp: <modified the 31/05/2011 (at 09:52) by Erwan Jahier> *) - - -(** Split the equations of a node into several ones, in such a way - that there is only one operator per equation. The rationale for - doing that is to make the clock checking trivial in the lic code - (indeed, nested node call makes it tricky). - - We also split tuples. For example, the equation: - - (a, b, c) = (1, 2, 3) -> titi(x); - - is splitted into 4 equations: - - a = 1 -> _v1; - b = 2 -> _v2; - c = 3 -> _v3; - (_v1, _v2, _v3) = titi(x); - - The node local_env is provided so that we can update its table, as - we add some fresh local variables during the code transmation. -*) - - -val node : Eff.node_env -> Eff.node_exp -> Eff.node_exp - - -(** Split an equation in to several ones ; also returns - - the new variables to be declared - - new nodes that were invented in order to deal with nested iterators -*) -val eq : Eff.node_env -> Eff.eq_info Lxm.srcflagged -> - (Eff.eq_info Lxm.srcflagged) list * Eff.var_info list diff --git a/src/structArrayExpand.ml b/src/structArrayExpand.ml index d56620e19c6623243ac7874566d0f7b8df7500f3..86ebbe66c6e3083d716cd097f48bbd9226e6c557 100644 --- a/src/structArrayExpand.ml +++ b/src/structArrayExpand.ml @@ -61,7 +61,10 @@ let clone_var node_env vi str type_eff = let id = Ident.of_string (str) in let clk_id = Ident.of_string str in let type_eff = match type_eff with - Any | Overload -> Polymorphism.get_type () + TypeVar Any | TypeVar AnyNum -> + Errors.print_internal_error "StructArrayExpand.clone" "should not have been called for a any(num) var"; + assert false + | _ -> type_eff in let var = @@ -80,7 +83,9 @@ let clone_var node_env vi str type_eff = let rec (is_a_basic_type : Eff.type_ -> bool) = function | Array_type_eff _ | Struct_type_eff _ -> false - | Any | Overload -> is_a_basic_type (Polymorphism.get_type ()) + | TypeVar Any | TypeVar AnyNum -> + Errors.print_internal_error "StructArrayExpand.is_a_basic_type" "should not have been called for a any(num) var"; + assert false | Abstract_type_eff(_, teff) -> is_a_basic_type teff | External_type_eff(_) | Enum_type_eff (_, _) @@ -142,10 +147,9 @@ let rec (gen_var_trees : fun make_leave prefix teff -> let loop = gen_var_trees make_leave in match teff with - | Any | Overload -> - let teff = Polymorphism.get_type () in - L (make_leave prefix teff) - + | TypeVar Any | TypeVar AnyNum -> + Errors.print_internal_error "StructArrayExpand.gen_var_trees" "should not have been called for a any(num) var"; + assert false | Bool_type_eff | Int_type_eff | Real_type_eff | Enum_type_eff(_) | External_type_eff(_) -> @@ -214,8 +218,8 @@ let (expand_left : Eff.local_env -> left -> left list) = let rec (make_new_loc : Eff.local_env -> Eff.id_solver -> Lxm.t -> acc -> Eff.val_exp -> acc * var_info) = fun nenv id_solver lxm acc ve -> - let teff = List.hd ve.typ in - let ceff = List.hd ve.clk in + let teff = List.hd ve.ve_typ in + let ceff = List.hd ve.ve_clk in let nv = new_var "v" nenv teff ceff in let neq = [LeftVarEff(nv,lxm)], ve in let neq = flagit neq lxm in @@ -226,88 +230,100 @@ let rec (make_new_loc : Eff.local_env -> Eff.id_solver -> Lxm.t -> acc -> and (var_trees_of_val_exp : Eff.local_env -> Eff.id_solver -> acc -> Eff.val_exp -> acc * Eff.val_exp var_tree) = fun nenv id_solver acc ve -> + let make_val_exp nenv lxm vi prefix teff = let prefix = (Ident.to_string vi.var_name_eff) ^ prefix in - let idref = Ident.idref_of_string prefix in - { core = CallByPosEff({src=lxm;it=(IDENT idref)}, OperEff []); - typ = [vi.var_type_eff] ; - clk = [snd vi.var_clock_eff] } + let id = prefix in + { + ve_core = CallByPosEff({src=lxm;it=(VAR_REF id)}, OperEff []); + ve_typ = [vi.var_type_eff] ; + ve_clk = [snd vi.var_clock_eff] + } in let loop = var_trees_of_val_exp nenv id_solver acc in - match ve.core with - | CallByPosEff (by_pos_op, OperEff vel) -> + match ve.ve_core with + | CallByPosEff (by_pos_op, OperEff vel) -> ( let lxm = by_pos_op.src in let by_pos_op = by_pos_op.it in - (match by_pos_op with - | STRUCT_ACCESS (id) -> - let ve = try List.hd vel with _ -> assert false in - (match loop ve with - | acc, S fl -> acc, List.assoc id fl - | _, (A _ | L _) -> assert false - ) - | ARRAY_ACCES (i) -> - let ve = try List.hd vel with _ -> assert false in - (match loop ve with - | acc, A array -> acc, List.nth array i - | _, (S _ | L _) -> assert false - ) - | ARRAY_SLICE (si) -> - let ve = try List.hd vel with _ -> assert false in - (match loop ve with - | acc, A array -> - let index_list = index_list_of_slice_info si in - let l = List.map (fun i -> List.nth array i) index_list in - acc, A l - | _, (S _ | L _) -> assert false - ) - | IDENT idref -> ( - try - let const = - id_solver.id2const idref lxm in - let s, ve_const = - UnifyClock.const_to_val_eff lxm true UnifyClock.empty_subst const - in - let ve_const,acc = - match ve_const.core with - | CallByPosEff ({it=IDENT _},_) -> - (* in order to avoid a potential infinite loop *) - (ve_const, acc) - | _ -> expand_val_exp nenv id_solver acc ve_const - in - (acc, L (ve_const)) - - with Errors.Unknown_constant _ -> - try - let vi = id_solver.id2var idref lxm in - (acc, - gen_var_trees (make_val_exp nenv lxm vi) "" vi.var_type_eff) - with _ -> - let msg = + match by_pos_op with + | STRUCT_ACCESS (id) -> ( + let ve = try List.hd vel with _ -> assert false in + match loop ve with + | acc, S fl -> acc, List.assoc id fl + | _, (A _ | L _) -> assert false + ) + | ARRAY_ACCES (i) -> ( + let ve = try List.hd vel with _ -> assert false in + match loop ve with + | acc, A array -> acc, List.nth array i + | _, (S _ | L _) -> assert false + + ) + | ARRAY_SLICE (si) -> ( + let ve = try List.hd vel with _ -> assert false in + match loop ve with + | acc, A array -> + let index_list = index_list_of_slice_info si in + let l = List.map (fun i -> List.nth array i) index_list in + acc, A l + + | _, (S _ | L _) -> assert false + ) + | VAR_REF id -> ( + try + let vi = UglyStuff.var_info_of_ident id_solver id lxm in + (acc, gen_var_trees (make_val_exp nenv lxm vi) "" vi.var_type_eff) + + with _ -> + let msg = "\n*** during Array expansion: '"^ - (Ident.string_of_idref idref)^ - "': Unknown variable.\n*** Current variables are: " ^ - (Hashtbl.fold - (fun id vi_eff acc -> acc ^ (Format.sprintf "\n\t%s" - (LicDump.string_of_var_info_eff4msg vi_eff))) - nenv.lenv_vars "") - in - raise (Errors.Compile_error(lxm, msg)) - - ) - | WITH(_) | HAT(_) | CONCAT | ARRAY(_) - | Predef _ | CALL _ | MERGE _ - | PRE | ARROW | FBY | CURRENT | WHEN _ | TUPLE - -> - (* Create a new loc var to alias such expressions *) - let acc, nloc = make_new_loc nenv id_solver lxm acc ve in - acc, - gen_var_trees (make_val_exp nenv lxm nloc) "" nloc.var_type_eff - ) - | CallByNameEff(by_name_op, fl) -> - let lxm = by_name_op.src in + (id)^ + "': Unknown variable.\n"^ + "*** Current variables are: "^ + (Hashtbl.fold + (fun i v acc -> acc^(Printf.sprintf "\n\t%s" (Eff.string_of_var_info v))) + nenv.lenv_vars "") + in + raise (Errors.Compile_error(lxm, msg)) + ) + | CONST_REF idl -> ( + try + let const = UglyStuff.const_eff_of_item_key id_solver idl lxm in + let s, ve_const = + UnifyClock.const_to_val_eff lxm true UnifyClock.empty_subst const + in + let ve_const,acc = + match ve_const.ve_core with + | CallByPosEff ({it=CONST_REF _},_) -> + (* in order to avoid a potential infinite loop *) + (ve_const, acc) + + | _ -> expand_val_exp nenv id_solver acc ve_const + in (acc, L (ve_const)) + with _ -> + let msg = + "\n*** during Array expansion: '"^ + (Ident.string_of_long idl)^ + "': Unknown variable.\n"^ + "*** Current variables are: "^ + (Hashtbl.fold + (fun i v acc -> acc^(Printf.sprintf "\n\t%s" (Eff.string_of_var_info v))) + nenv.lenv_vars "") + in + raise (Errors.Compile_error(lxm, msg)) + ) + | WITH(_) | HAT(_) | CONCAT | ARRAY(_) + | PREDEF_CALL _ | CALL _ | MERGE _ + | PRE | ARROW | FBY | CURRENT | WHEN _ | TUPLE -> ( + (* Create a new loc var to alias such expressions *) + let acc, nloc = make_new_loc nenv id_solver lxm acc ve in + acc, gen_var_trees (make_val_exp nenv lxm nloc) "" nloc.var_type_eff + ) + ) + | CallByNameEff(by_name_op, fl) -> + let lxm = by_name_op.src in let acc, nloc = make_new_loc nenv id_solver lxm acc ve in - acc, - gen_var_trees (make_val_exp nenv lxm nloc) "" nloc.var_type_eff + acc, gen_var_trees (make_val_exp nenv lxm nloc) "" nloc.var_type_eff and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list) = fun lxm left_list ve -> @@ -320,12 +336,12 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list) in the rigth part) *) let rec aux ve = (* flatten val exp*) - match ve.core with + match ve.ve_core with | CallByPosEff ({it= TUPLE}, OperEff vel) -> List.flatten (List.map aux vel) | CallByPosEff (unop, OperEff [ve1]) -> let ve1l = aux ve1 in List.map - (fun ve1 -> { ve1 with core = CallByPosEff (unop, OperEff [ve1])} ) + (fun ve1 -> { ve1 with ve_core = CallByPosEff (unop, OperEff [ve1])} ) ve1l | CallByPosEff (binop, OperEff [ve1;ve2]) -> let ve1l, ve2l = aux ve1, aux ve2 in @@ -342,11 +358,11 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list) else List.map2 (fun ve1 ve2 -> - { ve with core = CallByPosEff (binop, OperEff [ve1;ve2])}) + { ve with ve_core = CallByPosEff (binop, OperEff [ve1;ve2])}) ve1l ve2l - | CallByPosEff ({it= Predef(IF_n,[]); src=lxm}, OperEff [cond; ve1; ve2]) -> + | CallByPosEff ({it= PREDEF_CALL(IF_n,[]); src=lxm}, OperEff [cond; ve1; ve2]) -> let ve1l, ve2l = aux ve1, aux ve2 in if (List.length ve1l <> List.length ve2l) then @@ -362,8 +378,8 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list) else List.map2 (fun ve1 ve2 -> - { ve with core = - CallByPosEff ({it= Predef(IF_n,[]); src=lxm}, + { ve with ve_core = + CallByPosEff ({it= PREDEF_CALL(IF_n,[]); src=lxm}, OperEff [cond;ve1;ve2])} ) ve1l @@ -381,7 +397,7 @@ and (break_tuple : Lxm.t -> left list -> val_exp -> Eff.eq_info srcflagged list) (fun l ve -> let clk = [snd (Eff.var_info_of_left l).var_clock_eff] in { src = lxm ; - it = ([l], { ve with typ = [Eff.type_of_left l] ; clk = clk}) } + it = ([l], { ve with ve_typ = [Eff.type_of_left l] ; ve_clk = clk}) } ) left_list vel @@ -407,7 +423,7 @@ and expand_val_exp_list n_env id_solver acc vel = and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp -> val_exp * acc) = fun n_env id_solver acc ve -> - match ve.core with + match ve.ve_core with | CallByPosEff (by_pos_op, OperEff vel) -> let lxm = by_pos_op.src in let by_pos_op = by_pos_op.it in @@ -427,7 +443,7 @@ and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp -> let vel,acc = expand_val_exp_list n_env id_solver acc vel in TUPLE, acc, vel - | CONCAT | Predef _ | CALL _ | MERGE _ + | CONCAT | PREDEF_CALL _ | CALL _ | MERGE _ | PRE | ARROW | FBY | CURRENT | WHEN _ | TUPLE -> let vel,acc = expand_val_exp_list n_env id_solver acc vel in @@ -436,7 +452,8 @@ and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp -> | STRUCT_ACCESS (_) | ARRAY_ACCES (_) | ARRAY_SLICE (_) - | IDENT _ -> + | VAR_REF _ + | CONST_REF _ -> let acc, vt = try var_trees_of_val_exp n_env id_solver acc ve with (Not_found | Failure _) -> assert false (* just a defense against nth and assoc *) @@ -445,7 +462,7 @@ and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp -> in let newve = CallByPosEff(Lxm.flagit by_pos_op lxm, OperEff vel) in - let newve = { ve with core = newve } in + let newve = { ve with ve_core = newve } in (* if newve.core <> ve.core then ( *) (* EvalClock.copy newve ve *) (* ); *) @@ -455,7 +472,7 @@ and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp -> (* we want to print fields in the order of the type. Moreover, we have to deal with default value. *) - let teff = ve.typ in + let teff = ve.ve_typ in match teff with | [Struct_type_eff(_,fl)] -> let lxm = by_name_op.src in @@ -484,9 +501,9 @@ and (expand_val_exp: Eff.local_env -> Eff.id_solver -> acc -> val_exp -> fl in let newve = { - typ = ve.typ; - clk = ve.clk; - core=CallByPosEff({ src=lxm ; it=TUPLE }, OperEff (List.rev vel)) + ve_typ = ve.ve_typ; + ve_clk = ve.ve_clk; + ve_core=CallByPosEff({ src=lxm ; it=TUPLE }, OperEff (List.rev vel)) } in (* if newve.core <> ve.core then ( *) @@ -514,7 +531,9 @@ and (expand_var_info: Eff.local_env -> Eff.id_solver -> var_info list * acc -> let rec aux teff = match teff with | Abstract_type_eff (_, teff) -> aux teff - | Any | Overload -> aux (Polymorphism.get_type ()) + | TypeVar Any | TypeVar AnyNum -> + Errors.print_internal_error "StructArrayExpand.expand_var_info" "should not have been called for a any(num) var"; + assert false | Struct_type_eff (name, fl) -> List.fold_left (fun (vil,acc) (fn, (ft,_const_opt)) -> @@ -562,6 +581,7 @@ let rec (node : Eff.id_solver -> Eff.local_env -> Eff.node_exp -> Eff.node_exp) let n = match n.def_eff with | ExternEff + | BuiltInEff _ | AbstractEff None -> n | AbstractEff (Some pn) -> { n with def_eff = AbstractEff (Some (node is n_env pn)) } diff --git a/src/symbolTab.mli b/src/symbolTab.mli index 1c2240c3106c551a538858c54ac1c598c2901d1a..ac54fd034908d9167321873bf90e22ef8027c5ed 100644 --- a/src/symbolTab.mli +++ b/src/symbolTab.mli @@ -51,3 +51,4 @@ val iter_types: t -> (Ident.t -> (type_info Lxm.srcflagged) elt -> unit) -> unit val iter_consts: t ->(Ident.t -> (const_info Lxm.srcflagged) elt -> unit) -> unit val iter_nodes : t ->(Ident.t -> (node_info Lxm.srcflagged) elt -> unit) -> unit + diff --git a/src/syntaxTreeCore.ml b/src/syntaxTreeCore.ml index 071a608417e53dbafae9c40f76a953779e741ab7..52918dcb63d40e0dc7f131c3b6e6e419397c6332 100644 --- a/src/syntaxTreeCore.ml +++ b/src/syntaxTreeCore.ml @@ -88,7 +88,7 @@ and slice_info = { and by_pos_op = (* zeroaire *) - | Predef_n of Predef.op * static_arg srcflagged list (* e.g., map<<toto,3>> *) + | Predef_n of Predef.op srcflagged * static_arg srcflagged list (* e.g., map<<toto,3>> *) | CALL_n of node_exp srcflagged (* e.g., a_node<<xx>> *) | IDENT_n of Ident.idref (* constant or variable *) diff --git a/src/syntaxTreeDump.ml b/src/syntaxTreeDump.ml index de36de22410ee0fc06b1a8dd9fe681e04ceef6a6..8d5fdffaa54901db309c29eb5b9361f24392c503 100644 --- a/src/syntaxTreeDump.ml +++ b/src/syntaxTreeDump.ml @@ -10,20 +10,15 @@ open Format (***********************************************************************************) (* exported *) -let static_arg_to_string arg = - match arg.it with - | StaticArgIdent id -> Ident.string_of_idref id - | StaticArgConst ve -> "const xxx" - | StaticArgType te -> "type xxx" - | StaticArgNode ne -> "node xxx" -let (op2string : SyntaxTreeCore.by_pos_op -> string) = +let rec (op2string : SyntaxTreeCore.by_pos_op -> string) = fun op -> match op with (* unaires *) - | Predef_n(op,sargs) -> (Predef.op2string op) ^ + | Predef_n(op,sargs) -> (Predef.op2string op.it) ^ (if sargs = [] then "" else "<<" ^ (String.concat ", " (List.map static_arg_to_string sargs)) ^ ">>") + | (CALL_n ne) -> string_of_node_exp ne.it | (PRE_n ) -> "pre" | (CURRENT_n) -> "current" (* binaires *) @@ -35,7 +30,6 @@ let (op2string : SyntaxTreeCore.by_pos_op -> string) = | (FBY_n ) -> "fby" | (WITH_n(_,_,_)) -> "with" | (TUPLE_n ) -> assert false - | (CALL_n _ ) -> assert false | (ARRAY_n ) -> assert false | (ARRAY_ACCES_n _ ) -> assert false | (ARRAY_SLICE_n sl) -> assert false @@ -45,7 +39,7 @@ let (op2string : SyntaxTreeCore.by_pos_op -> string) = (***********************************************************************************) (* exported *) -let rec packbody (os: Format.formatter) (pkg: SyntaxTree.packbody) = +and packbody (os: Format.formatter) (pkg: SyntaxTree.packbody) = let dump_def (d: item_ident) = try ( (match d with @@ -380,54 +374,59 @@ and dump_val_exp_list (os : formatter) (xl: val_exp list) = ( and dump_by_pos_exp (os: Format.formatter) (oper: by_pos_op) (pars: operands) = ( match (oper, pars) with - (Predef_n (TRUE_n,_), Oper []) -> dump_leaf_exp os "true" - | (Predef_n (FALSE_n,_), Oper []) -> dump_leaf_exp os "false" - | (Predef_n (ICONST_n s, _), Oper []) -> dump_leaf_exp os (Ident.to_string s) - | (Predef_n (RCONST_n s, _), Oper []) -> dump_leaf_exp os (Ident.to_string s) | (IDENT_n id,Oper []) -> dump_leaf_exp os (Ident.string_of_idref id) - (* unaires *) - | (Predef_n (NOT_n,_), Oper [p0]) -> dump_unary_exp os "not" p0 - | (Predef_n (UMINUS_n,_), Oper [p0]) -> dump_unary_exp os "-" p0 - | (Predef_n (RUMINUS_n,_), Oper [p0]) -> dump_unary_exp os "-" p0 - | (Predef_n (IUMINUS_n,_), Oper [p0]) -> dump_unary_exp os "-" p0 | (PRE_n, Oper [p0]) -> dump_unary_exp os "pre" p0 | (CURRENT_n, Oper [p0]) -> dump_unary_exp os "current" p0 - | (Predef_n (REAL2INT_n,_), Oper [p0]) -> dump_unary_exp os "int" p0 - | (Predef_n (INT2REAL_n,_), Oper [p0]) -> dump_unary_exp os "real" p0 - (* binaires *) | (ARROW_n, Oper [p0;p1]) -> dump_binary_exp os "->" p0 p1 | (FBY_n, Oper [p0;p1]) -> dump_binary_exp os "fby" p0 p1 | (WHEN_n _, Oper [p0;p1]) -> dump_binary_exp os "when" p0 p1 - | (Predef_n (AND_n,_), Oper [p0;p1]) -> dump_binary_exp os "and" p0 p1 - | (Predef_n (OR_n,_), Oper [p0;p1]) -> dump_binary_exp os "or" p0 p1 - | (Predef_n (XOR_n,_), Oper [p0;p1]) -> dump_binary_exp os "xor" p0 p1 - | (Predef_n (IMPL_n,_), Oper [p0;p1]) -> dump_binary_exp os "=>" p0 p1 - | (Predef_n (EQ_n,_), Oper [p0;p1]) -> dump_binary_exp os "=" p0 p1 - | (Predef_n (NEQ_n,_), Oper [p0;p1]) -> dump_binary_exp os "<>" p0 p1 - | (Predef_n (LT_n,_), Oper [p0;p1]) -> dump_binary_exp os "<" p0 p1 - | (Predef_n (LTE_n,_), Oper [p0;p1]) -> dump_binary_exp os "<=" p0 p1 - | (Predef_n (GT_n,_), Oper [p0;p1]) -> dump_binary_exp os ">" p0 p1 - | (Predef_n (GTE_n,_), Oper [p0;p1]) -> dump_binary_exp os ">=" p0 p1 - | (Predef_n (DIV_n,_), Oper [p0;p1]) -> dump_binary_exp os "div" p0 p1 - | (Predef_n (MOD_n,_), Oper [p0;p1]) -> dump_binary_exp os "mod" p0 p1 - | (Predef_n (MINUS_n,_), Oper [p0]) -> dump_unary_exp os "-" p0 - | (Predef_n (RMINUS_n,_), Oper [p0]) -> dump_unary_exp os "-" p0 - | (Predef_n (IMINUS_n,_), Oper [p0]) -> dump_unary_exp os "-" p0 - | (Predef_n (PLUS_n,_), Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1 - | (Predef_n (RPLUS_n,_), Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1 - | (Predef_n (IPLUS_n,_), Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1 - | (Predef_n (SLASH_n,_), Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1 - | (Predef_n (RSLASH_n,_), Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1 - | (Predef_n (ISLASH_n,_), Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1 - | (Predef_n (TIMES_n,_), Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1 - | (Predef_n (RTIMES_n,_), Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1 - | (Predef_n (ITIMES_n,_), Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1 + + | (Predef_n (x,_), _) -> ( + match (x.it, pars) with + | (TRUE_n, Oper []) -> dump_leaf_exp os "true" + | (FALSE_n, Oper []) -> dump_leaf_exp os "false" + | (ICONST_n s, Oper []) -> dump_leaf_exp os (Ident.to_string s) + | (RCONST_n s, Oper []) -> dump_leaf_exp os (Ident.to_string s) + (* unaires *) + | (NOT_n, Oper [p0]) -> dump_unary_exp os "not" p0 + | (UMINUS_n, Oper [p0]) -> dump_unary_exp os "-" p0 + | (RUMINUS_n, Oper [p0]) -> dump_unary_exp os "-" p0 + | (IUMINUS_n, Oper [p0]) -> dump_unary_exp os "-" p0 + | (REAL2INT_n, Oper [p0]) -> dump_unary_exp os "int" p0 + | (INT2REAL_n, Oper [p0]) -> dump_unary_exp os "real" p0 + (* binaires *) + | (AND_n, Oper [p0;p1]) -> dump_binary_exp os "and" p0 p1 + | (OR_n, Oper [p0;p1]) -> dump_binary_exp os "or" p0 p1 + | (XOR_n, Oper [p0;p1]) -> dump_binary_exp os "xor" p0 p1 + | (IMPL_n, Oper [p0;p1]) -> dump_binary_exp os "=>" p0 p1 + | (EQ_n, Oper [p0;p1]) -> dump_binary_exp os "=" p0 p1 + | (NEQ_n, Oper [p0;p1]) -> dump_binary_exp os "<>" p0 p1 + | (LT_n, Oper [p0;p1]) -> dump_binary_exp os "<" p0 p1 + | (LTE_n, Oper [p0;p1]) -> dump_binary_exp os "<=" p0 p1 + | (GT_n, Oper [p0;p1]) -> dump_binary_exp os ">" p0 p1 + | (GTE_n, Oper [p0;p1]) -> dump_binary_exp os ">=" p0 p1 + | (DIV_n, Oper [p0;p1]) -> dump_binary_exp os "div" p0 p1 + | (MOD_n, Oper [p0;p1]) -> dump_binary_exp os "mod" p0 p1 + | (MINUS_n, Oper [p0]) -> dump_unary_exp os "-" p0 + | (RMINUS_n, Oper [p0]) -> dump_unary_exp os "-" p0 + | (IMINUS_n, Oper [p0]) -> dump_unary_exp os "-" p0 + | (PLUS_n, Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1 + | (RPLUS_n, Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1 + | (IPLUS_n, Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1 + | (SLASH_n, Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1 + | (RSLASH_n, Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1 + | (ISLASH_n, Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1 + | (TIMES_n, Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1 + | (RTIMES_n, Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1 + | (ITIMES_n, Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1 + | (IF_n, Oper [p0;p1;p2]) -> dump_ternary_exp os "if" "then" "else" p0 p1 p2 + | (NOR_n, Oper pl) -> dump_nary_exp os "nor" pl + | (DIESE_n, Oper pl) -> dump_nary_exp os "#" pl + | (_,_) -> assert false + ) | (HAT_n, Oper [p0;p1]) -> dump_binary_exp os "^" p0 p1 | (CONCAT_n, Oper [p0;p1]) -> dump_binary_exp os "|" p0 p1 - | (Predef_n (IF_n,_), Oper [p0;p1;p2]) -> dump_ternary_exp os "if" "then" "else" p0 p1 p2 | (WITH_n(_), Oper [p0;p1;p2]) -> dump_ternary_exp os "with" "then" "else" p0 p1 p2 - | (Predef_n (NOR_n,_), Oper pl) -> dump_nary_exp os "nor" pl - | (Predef_n (DIESE_n,_), Oper pl) -> dump_nary_exp os "#" pl | (TUPLE_n, Oper pl) -> dump_nary_exp os "" pl | (CALL_n s, Oper pl) -> fprintf os "%a(@,%a@,)" dump_node_exp s.it dump_val_exp_list pl @@ -439,7 +438,6 @@ and dump_by_pos_exp (os: Format.formatter) (oper: by_pos_op) (pars: operands) = | (STRUCT_ACCESS_n fld, Oper [p0]) -> fprintf os "%a.%s" dump_val_exp p0 (Ident.to_string fld) - | (Predef_n (_,_),_) -> assert false (* | (ITERATOR_n _, _) -> assert false *) | (MERGE_n _,_) -> assert false @@ -499,15 +497,40 @@ and dump_nary_exp fprintf os "%s(@,%a@,)" s dump_val_exp_list ops ) -and dump_node_exp +and string_of_node_exp (id, sal) = + (Ident.string_of_idref id) ^ + (if sal = [] then "" else + "<<" ^ (String.concat ", " (List.map static_arg_to_string sal)) ^ ">>") + +and static_arg_to_string arg = + match arg.it with + | StaticArgIdent id -> Ident.string_of_idref id + | StaticArgConst ve -> "const xxx" + | StaticArgType te -> "type xxx" + | StaticArgNode op -> "node "^(op2string op) + +and dump_node_exp os ne = + fprintf os "%s" (string_of_node_exp ne) + +and dump_static_sarg_list (os : Format.formatter) - ((id, sal): node_exp) - = - fprintf os "%s" (Ident.string_of_idref id) ; - ( match sal with - [] -> () - | lst -> (fprintf os "<< @,%a@, >>" dump_static_arg_list lst) - ) + (lst: (static_arg srcflagged) list) + = ( + match lst with + | [] -> () + | [sa] -> fprintf os "%a" dump_static_sarg sa.it + | sa::reste -> + fprintf os "%a, @,%a" dump_static_sarg sa.it dump_static_sarg_list reste + ) +and dump_static_sarg + (os : Format.formatter) + (sa: static_arg) + = + match sa with + | StaticArgIdent id -> fprintf os "%s" (Ident.string_of_idref id) + | StaticArgConst ve -> fprintf os "const %a" dump_val_exp ve + | StaticArgType te -> fprintf os "type %a" dump_type_exp te + | StaticArgNode op -> fprintf os "node %s" (op2string op) and dump_static_arg_list (os : Format.formatter) @@ -515,15 +538,16 @@ and dump_static_arg_list = ( match lst with | [] -> () - | [sa] -> fprintf os "%a" dump_static_arg sa.it + | [sa] -> fprintf os "%a" dump_static_arg sa | sa::reste -> - fprintf os "%a, @,%a" dump_static_arg sa.it dump_static_arg_list reste + fprintf os "%a, @,%a" dump_static_arg sa dump_static_arg_list reste ) and dump_static_arg (os : Format.formatter) - ((id,sa): Ident.t * static_arg) - = (Ident.to_string id) ^ " = " ^ - match sa with + ((id,sa): Ident.t * static_arg srcflagged) + = + fprintf os "%s = " (Ident.to_string id); + match sa.it with | StaticArgIdent id -> fprintf os "%s" (Ident.string_of_idref id) | StaticArgConst ve -> fprintf os "const %a" dump_val_exp ve | StaticArgType te -> fprintf os "type %a" dump_type_exp te @@ -637,3 +661,14 @@ let modelinfo (os: Format.formatter) (mf: SyntaxTree.model_info srcflagged) = ( Format.fprintf os "@]@." ) +let print_val_exp oc ve = + let os = Format.formatter_of_out_channel oc in + dump_val_exp os ve; + pp_print_flush os () + + +let print_node_exp oc ne = + let os = Format.formatter_of_out_channel oc in + dump_node_exp os ne; + pp_print_flush os () + diff --git a/src/syntaxTreeDump.mli b/src/syntaxTreeDump.mli index b48fe9922df508bf1b135898739080ed6430abe8..0c91491480f9e9bb4ae6e104ac6b704cb1a748aa 100644 --- a/src/syntaxTreeDump.mli +++ b/src/syntaxTreeDump.mli @@ -11,6 +11,10 @@ val op2string : SyntaxTreeCore.by_pos_op -> string (**/**) +val print_val_exp : out_channel -> SyntaxTreeCore.val_exp -> unit +val print_node_exp : out_channel -> SyntaxTreeCore.node_exp -> unit + + val dump_val_exp : Format.formatter -> SyntaxTreeCore.val_exp -> unit val dump_type_exp : Format.formatter -> SyntaxTreeCore.type_exp -> unit -val dump_static_arg : Format.formatter -> SyntaxTreeCore.static_arg -> unit +val dump_static_arg : Format.formatter -> Ident.t * SyntaxTreeCore.static_arg Lxm.srcflagged -> unit diff --git a/src/uglyStuff.ml b/src/uglyStuff.ml new file mode 100644 index 0000000000000000000000000000000000000000..6a01b4bbd3e1d1e6a3d08f8979dc5ca6cbc43e3f --- /dev/null +++ b/src/uglyStuff.ml @@ -0,0 +1,35 @@ + +(** + Des béquilles et autres trucs moches qui ne devraient etre refaits ... +*) + + +(** +ACCES AUX INFOS DEJA COMPILEES, + +- EvalType utilise le mécanisme id_solver pour acceder aux +infos déjà compilées, alors que c'est pas fait pour... +- Y'a un probleme de gestion d'environnement a revoir ... +*) +let node_exp_of_node_key + (id_solver: Eff.id_solver) + (node_key: Eff.node_key) + (lxm : Lxm.t) +: Eff.node_exp = + let (id, sargs) = node_key in + id_solver.Eff.id2node (Ident.idref_of_long id) sargs lxm + +let var_info_of_ident + (id_solver: Eff.id_solver) + (id: Ident.t) + (lxm : Lxm.t) +: Eff.var_info = + id_solver.Eff.id2var (Ident.idref_of_id id) lxm + +let const_eff_of_item_key + (id_solver: Eff.id_solver) + (id: Eff.item_key) + (lxm : Lxm.t) +: Eff.const = + id_solver.Eff.id2const (Ident.idref_of_long id) lxm + diff --git a/src/unifyClock.ml b/src/unifyClock.ml index 57c20b98db92484b70898980412e5052a9f8e366..8567b997277bb9dad047e6a0dbbf2ee4e53aa0be 100644 --- a/src/unifyClock.ml +++ b/src/unifyClock.ml @@ -195,7 +195,7 @@ let rec (apply_subst2:subst -> Eff.clock -> Eff.clock) = let rec (apply_subst_val_exp : subst -> Eff.val_exp -> Eff.val_exp) = fun s ve -> let ve_core = - match ve.core with + match ve.ve_core with | CallByPosEff (by_pos_op, OperEff vel) -> let vel = List.map (apply_subst_val_exp s) vel in CallByPosEff (by_pos_op, OperEff vel) @@ -205,8 +205,8 @@ let rec (apply_subst_val_exp : subst -> Eff.val_exp -> Eff.val_exp) = in CallByNameEff(by_name_op, fl) in - let new_clk = List.map (apply_subst s) ve.clk in - let ve = { ve with core = ve_core ; clk = new_clk } in + let new_clk = List.map (apply_subst s) ve.ve_clk in + let ve = { ve with ve_core = ve_core ; ve_clk = new_clk } in ve @@ -275,26 +275,26 @@ let rec (const_to_val_eff: Lxm.t -> bool -> subst -> const -> subst * val_exp) = fun lxm expand_const s const -> let mk_by_pos_op by_pos_op_eff = let s, clk = new_clock_var s in - { core = CallByPosEff(flagit by_pos_op_eff lxm, OperEff []) ; - typ = [type_of_const const] ; - clk = [clk]; + { ve_core = CallByPosEff(flagit by_pos_op_eff lxm, OperEff []) ; + ve_typ = [type_of_const const] ; + ve_clk = [clk]; } in let id_of_int i = Ident.of_string (string_of_int i) in match const with | Bool_const_eff b -> - s, mk_by_pos_op (Predef((if b then Predef.TRUE_n else Predef.FALSE_n), [])) + s, mk_by_pos_op (PREDEF_CALL((if b then Predef.TRUE_n else Predef.FALSE_n), [])) | Int_const_eff i -> - s, mk_by_pos_op (Predef((Predef.ICONST_n (id_of_int i)),[])) + s, mk_by_pos_op (PREDEF_CALL((Predef.ICONST_n (id_of_int i)),[])) | Real_const_eff r -> - s, mk_by_pos_op (Predef((Predef.RCONST_n (Ident.of_string r)),[])) + s, mk_by_pos_op (PREDEF_CALL((Predef.RCONST_n (Ident.of_string r)),[])) | Enum_const_eff (l, _) - | Extern_const_eff (l, _) -> s, mk_by_pos_op (IDENT (Ident.idref_of_long l)) + | Extern_const_eff (l, _) -> s, mk_by_pos_op (CONST_REF l) | Abstract_const_eff (l, teff, c, is_exported) -> if expand_const then const_to_val_eff lxm expand_const s c - else s, mk_by_pos_op (IDENT (Ident.idref_of_long l)) + else s, mk_by_pos_op (CONST_REF l) | Array_const_eff (ct, _) -> let s, vel = @@ -327,7 +327,11 @@ let rec (const_to_val_eff: Lxm.t -> bool -> subst -> const -> subst * val_exp) = fl in let fl = List.rev fl in - s, { core = (CallByNameEff(name_op_flg, fl)); - typ = [stype] ; - clk = [BaseEff] + s, { ve_core = (CallByNameEff(name_op_flg, fl)); + ve_typ = [stype] ; + ve_clk = [BaseEff] } + | Tuple_const_eff _ -> + print_internal_error "UnifyClock.const_to_val_eff" "should not have been called for a tuple"; + assert false + diff --git a/src/unifyType.ml b/src/unifyType.ml index 3c863be21ba093633b55c23d8857f303046a72cf..662b0eb04392d1f8541f073e54614507a65eb71f 100644 --- a/src/unifyType.ml +++ b/src/unifyType.ml @@ -1,14 +1,30 @@ (** Time-stamp: <modified the 03/03/2009 (at 18:00) by Erwan Jahier> *) +(* +12/07. Premier pas vers une méthode un peu plus standard : + + renvoie un Eff.type_matches, i.e. une liste + d'assoc. (TypeVar * type_) + - Evidemment, comme on a en dur uniquement 2 TypeVar possible + ça reste très limité ... +*) + open Eff +(** DEBUG FLAG *) +let dbg = Some(Verbose.get_flag "typing") + (* exported *) type t = | Equal | Unif of Eff.type_ | Ko of string (* a msg explaining why the unification failed *) -let teff2str = LicDump.string_of_type_eff4msg +let teff2str = Eff.string_of_type +let string_of_t = function + | Equal -> "Equal" + | Unif e -> "Unif with any(num) = "^(teff2str e) + | Ko _ -> "Ko" + let (is_overloadable : Eff.type_ -> bool) = function | Int_type_eff -> true @@ -21,8 +37,8 @@ let rec (contains : Eff.type_ -> Eff.type_ -> bool) = fun t1 t2 -> if t1 = t2 then true else match t1 with - | Any - | Overload + | (TypeVar Any) + | TypeVar AnyNum | Bool_type_eff | Int_type_eff | Real_type_eff @@ -31,64 +47,115 @@ let rec (contains : Eff.type_ -> Eff.type_ -> bool) = | Abstract_type_eff (_, teff) -> false | Array_type_eff(teff,i) -> contains teff t2 | Struct_type_eff(l, fl) -> - List.exists (fun (_,(teff,_)) -> contains teff t2) fl + List.exists (fun (_,(teff,_)) -> contains teff t2) fl -(* exported *) -let (f : Eff.type_ list -> Eff.type_ list -> t) = fun l1 l2 -> - let rec (unify_type_eff : Eff.type_ -> Eff.type_ -> t) = - fun t1 t2 -> +(* exported +What for ? +Inutile d'essayer de ressembler à un vrai algo d'unification de type : +- c'est PAS de l'unification, c'est du "matching" avec des jockers +- on a exactement 2 jockers +- c'est disymétrique : on a un expected avec des jockers + et un given, et on doit arriver à s'en sortir ... +*) +let f (l1: Eff.type_ list) (l2: Eff.type_ list): t = + let rec unify_type_eff (t1:Eff.type_) (t2: Eff.type_) : t = if t1 = t2 then Equal else - match (t1,t2) with - | Array_type_eff(teff_ext1,i1), Array_type_eff(teff_ext2,i2) -> - if i1 <> i2 then Ko "\n*** incompatible array size" else - unify_type_eff teff_ext1 teff_ext2 - - | Struct_type_eff(l1, fl1), Struct_type_eff(l2, fl2) -> - if l1 <> l2 then Ko "\n*** incompatible structure" else - let fl1 = List.map (fun (_,(te,_)) -> te) fl1 - and fl2 = List.map (fun (_,(te,_)) -> te) fl2 in - List.fold_left2 unify_do_acc Equal fl1 fl2 - - | Overload, Any - | Any, Overload -> Unif Overload - - | t, Any - | Any, t -> - if contains t Any || contains t Overload then - Ko(("\n*** " ^ teff2str t1) ^ " and " ^ (teff2str t2) ^ - " are not unifiable (there is a cycle)") - else - Unif t - - | t, Overload - | Overload, t -> - if contains t Any || contains t Overload then - Ko("\n*** " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^ - " are not unifiable (there is a cycle)") - else if is_overloadable t then - Unif t - else - Ko("\n*** " ^ (teff2str t) ^ " should be an integer or a real") - - | _ -> - Ko("\n*** " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^ - " are not unifiable") + match (t1,t2) with + | Array_type_eff(teff_ext1,i1), Array_type_eff(teff_ext2,i2) -> + if i1 <> i2 then Ko "\n*** incompatible array size" + else unify_type_eff teff_ext1 teff_ext2 + | Struct_type_eff(l1, fl1), Struct_type_eff(l2, fl2) -> + if l1 <> l2 then Ko "\n*** incompatible structure" else + (** USELESS ??? *) + let fl1 = List.map (fun (_,(te,_)) -> te) fl1 + and fl2 = List.map (fun (_,(te,_)) -> te) fl2 in + List.fold_left2 unify_do_acc Equal fl1 fl2 + | TypeVar AnyNum, TypeVar Any + | TypeVar Any, TypeVar AnyNum -> Unif (TypeVar AnyNum) + | t, TypeVar Any | (TypeVar Any), t -> + if contains t (TypeVar Any) || contains t (TypeVar AnyNum) then + Ko(("\n*** " ^ teff2str t1) ^ " and " ^ (teff2str t2) ^ + " are not unifiable (there is a cycle)") + else Unif t + | t, TypeVar AnyNum + | TypeVar AnyNum, t -> + if contains t (TypeVar Any) || contains t (TypeVar AnyNum) then + Ko("\n*** " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^ + " are not unifiable (there is a cycle)") + else if is_overloadable t then Unif t + else + Ko("\n*** get '" ^ (teff2str t) ^ "' where 'int' or 'real' was expected") + | _ -> + Ko("\n*** " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^ + " are not unifiable") and (unify_do_acc: t -> Eff.type_ -> Eff.type_ -> t) = fun acc te1 te2 -> match acc, unify_type_eff te1 te2 with - | Equal, Equal -> Equal - | Ko msg, _ - | _, Ko msg -> Ko msg - | Unif t, Equal - | Equal, Unif t -> Unif t - | Unif t1, Unif t2 -> if t1 = t2 then acc else - Ko("\n*** " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^ - " are not unifiable") + | Equal, Equal -> Equal + | Ko msg, _ + | _, Ko msg -> Ko msg + | Unif t, Equal + | Equal, Unif t -> Unif t + | Unif t1, Unif t2 -> if t1 = t2 then acc else + Ko("\n*** " ^ (teff2str t1) ^ " and " ^ (teff2str t2) ^ + " are not unifiable") in - assert (List.length l1 = List.length l2); - List.fold_left2 unify_do_acc Equal l1 l2 + assert (List.length l1 = List.length l2); + let res = List.fold_left2 unify_do_acc Equal l1 l2 in + Verbose.printf ~flag:dbg + "#DBG: UnifyType.f (%s) with (%s) gives %s\n" + (Eff.string_of_type_list l1) + (Eff.string_of_type_list l2) + (string_of_t res) + ; + res + +(****** MATCH ASSYMETRIQUE +On le fait avec un fold_left2 +N.B. : +Eff.type_matches = (type_var * type_) list +(c'est un peu du luxe vu qu'on n'a que 2 jockers possibles) +*) +exception Match_failed of string + +(* UTILE : try_assoc curmatches tvar t + - si existe (tvar, t') dans curmatches, + * renvoie curmatches si t=t' + * raise Match_failed sinon + - sinon ajoute (tvar, t) à curmatches +*) +let try_assoc curmatches tvar t = + try ( + let t' = List.assoc tvar curmatches in + if (t = t') then curmatches + else + raise (Match_failed( + Printf.sprintf "\n*** %s can't be matched both by %s and %s" + (teff2str (TypeVar tvar)) (teff2str t) (teff2str t') + )) + ) with Not_found -> (tvar,t)::curmatches + + +let is_matched (expect_l: Eff.type_ list) (given_l: Eff.type_ list) : Eff.type_matches = + (** Traite 1 type, accumule dans curmatches *) + let rec do_type (curmatches:Eff.type_matches) (expect:Eff.type_) (given:Eff.type_) : Eff.type_matches = + if (given = expect) then curmatches else + match (expect, given) with + | (TypeVar Any, t) -> try_assoc curmatches Any t + | (TypeVar AnyNum, Int_type_eff) -> try_assoc curmatches AnyNum Int_type_eff + | (TypeVar AnyNum, Real_type_eff) -> try_assoc curmatches AnyNum Real_type_eff + | Array_type_eff(teff_ext1,i1), Array_type_eff(teff_ext2,i2) -> + if i1 <> i2 then raise (Match_failed("\n*** incompatible array sizes")) + else do_type curmatches teff_ext1 teff_ext2 + (* Dans tous les autres cas échoue *) + | _ -> raise(Match_failed( + Printf.sprintf "\n*** %s can't be matched by %s" + (teff2str expect) (teff2str given) + )) + in + List.fold_left2 do_type [] expect_l given_l (************************************************************************************) @@ -97,11 +164,11 @@ let i = Int_type_eff let r = Real_type_eff let b = Bool_type_eff let e = External_type_eff (Ident.long_of_string "Toto::t") -let o = Overload -let a = Any +let o = TypeVar AnyNum +let a = (TypeVar Any) let array t c = Array_type_eff(t,c) let struc t = Struct_type_eff ((Ident.long_of_string "T::t"), - [(Ident.of_string "x"),(t,None)]) + [(Ident.of_string "x"),(t,None)]) let unify_failed = function Ko(_) -> true | _ -> false let to_string = function @@ -128,24 +195,24 @@ let rec gen_random_type_eff () = | 3 -> e | 4 -> array (gen_random_type_eff ()) 42 | 5 -> struc (gen_random_type_eff ()) - | 6 -> Any - | _ -> Overload + | 6 -> (TypeVar Any) + | _ -> TypeVar AnyNum let gen_unifiable_typeff_of_size size = let rec aux tl1 tl2 = let ntl1 = (gen_random_type_eff ())::tl1 and ntl2 = (gen_random_type_eff ())::tl2 in if unify_failed (f ntl1 ntl2) then - aux tl1 tl2 + aux tl1 tl2 else - if List.length ntl1 = size then (ntl1,ntl2) else aux ntl1 ntl2 + if List.length ntl1 = size then (ntl1,ntl2) else aux ntl1 ntl2 in aux [] [] let (type_eff_list_to_string : Eff.type_ list -> string) = fun tel -> - let str_l = List.map LicDump.string_of_type_eff4msg tel in + let str_l = List.map teff2str tel in String.concat "*" str_l @@ -165,9 +232,9 @@ let unit_test () = for i = 1 to 1000 do let (tl1, tl2) = gen_unifiable_typeff_of_size (1+ Random.int 10) in Verbose.print_string ~level:3 ( - " ==> try UnifyType.proposition1 with lists " ^ - (type_eff_list_to_string tl1) ^ " and " ^ - (type_eff_list_to_string tl2) ^ "\n"); + " ==> try UnifyType.proposition1 with lists " ^ + (type_eff_list_to_string tl1) ^ " and " ^ + (type_eff_list_to_string tl2) ^ "\n"); assert (proposition1 tl1 tl2) done @@ -189,24 +256,23 @@ let (profile_is_compatible: node_key -> Lxm.t -> Eff.type_ list * Eff.type_ list Eff.type_ list * Eff.type_ list -> Eff.type_ option) = fun nk lxm (ins1, ins2) (outs1, outs2) -> let to_any t = match t with (* consider abstract types as alpha types *) - | Abstract_type_eff(name, _) -> Any + | Abstract_type_eff(name, _) -> (TypeVar Any) | t -> t in - let sot = LicDump.string_of_type_eff4msg in let msg_prefix = ("provided node for " ^ (Ident.string_of_long (fst nk)) ^ " is not compatible with its implementation: ") in let apply_subst s t = try List.assoc t s with Not_found -> t in let unif_types (subst,topt) t_prov t_body = - if t_body = Any || t_body = Overload then + if t_body = TypeVar Any || t_body = TypeVar AnyNum then (* Migth occur when a model is instanciated with a polymorphic operator, - such as Lustre::eq. In such a case, we obtain an Any or an Overload - from the implementation part ; the solution then is to replace that Any + such as Lustre::eq. In such a case, we obtain a (TypeVar Any) or a TypeVar AnyNum + from the implementation part ; the solution then is to replace that (TypeVar Any) type by the type of the provided part. *) ( - assert (t_prov <> Any); - assert (t_prov <> Overload); + assert (t_prov <> (TypeVar Any)); + assert (t_prov <> TypeVar AnyNum); assert (topt = None || topt = Some t_prov); (* at most one type var per op *) (subst, Some t_prov) ) @@ -219,7 +285,7 @@ let (profile_is_compatible: node_key -> Lxm.t -> Eff.type_ list * Eff.type_ list (match t_prov with | Abstract_type_eff(_, tbody) -> if tbody <> t && t_prov <> t_body then - let msg = msg_prefix ^ "\n*** "^(sot tbody)^" <> "^(sot t) in + let msg = msg_prefix ^ "\n*** "^(teff2str tbody)^" <> "^(teff2str t) in raise(Errors.Compile_error (lxm, msg)) | _ -> () ); diff --git a/src/unifyType.mli b/src/unifyType.mli index d5a8178493be1430a087576948b7228d9943171b..8792b98de4253951296fd34f2f4f303761d9abe5 100644 --- a/src/unifyType.mli +++ b/src/unifyType.mli @@ -26,3 +26,13 @@ val unit_test : unit -> unit val profile_is_compatible: Eff.node_key -> Lxm.t -> Eff.type_ list * Eff.type_ list -> Eff.type_ list * Eff.type_ list -> Eff.type_ option + +(** nouvelle version assymétrique : +'ismatched expected_type_list given_type_list' renvoie : + - la liste des matches nécessaires dans 'expected_type_list' pour + le rendre "egal" à 'given_type_list' + (n.b. vide si completement egal !) + - raise Match_failed si pas possible +*) +exception Match_failed of string +val is_matched : Eff.type_ list -> Eff.type_ list -> Eff.type_matches diff --git a/src/uniqueOutput.ml b/src/uniqueOutput.ml index 842ac35eeafec8096f74777b71f2cd6d5b90d27a..588e7224834c336fd2c1edd5fac5cbd91b2c163c 100644 --- a/src/uniqueOutput.ml +++ b/src/uniqueOutput.ml @@ -215,6 +215,7 @@ let (check : Eff.node_exp -> Lxm.t -> unit) = in match node.def_eff with | ExternEff + | BuiltInEff _ | AbstractEff _ -> () | BodyEff{ eqs_eff = eql } -> let lel = List.flatten (List.map (fun {it=(left,_)} -> left) eql) in diff --git a/src/verbose.ml b/src/verbose.ml index ed10721b006ab77b7b5c4482d7a5d3a441ff49f1..64db59f45397adfc10c0cea709b9e5e7f28ea5b4 100644 --- a/src/verbose.ml +++ b/src/verbose.ml @@ -2,6 +2,8 @@ module : Verbose date : ------------------------------------------------------------------------ +-- New: 2010/11, debug flag system + description : Affichage verbeux avec appel "printf-like" : @@ -21,23 +23,50 @@ N.B. VERSION GORE : le kprintf n'est appel ----------------------------------------------------------------------*) +type flag = bool ref + +let _flag_tab : (string, flag) Hashtbl.t = Hashtbl.create 10 +(* warning: last in first ! *) +let _flag_list : string list ref = ref [] + +let get_flag s = ( + try ( + Hashtbl.find _flag_tab s + ) with Not_found -> ( + let res = ref false in + Hashtbl.add _flag_tab s res; + _flag_list := s::!_flag_list; + res + ) +) +let set_flag f = (f := true) +let flag_list () = !_flag_list (* type msg = string Lazy.t *) let _level = ref 0 -let set_level (l:int) = ( _level := l ) -let get_level () = !_level +let on () = ( _level := 1 ) +let off () = ( _level := 0 ) +let set (l:int) = ( _level := l ) + +let level () = !_level + +let do_verbose flag level = match flag with +| None -> !_level >= level +| Some f -> !f (**** VERSION PAS TROP GORE *****) -let printf ?(level=1) s = Printf.kprintf - (fun t -> if (!_level >= level) then (print_string t; flush stdout) else ()) s +let printf ?(level=1) ?(flag=None) s = + Printf.kprintf (fun t -> if (do_verbose flag level) then (prerr_string t; flush stderr) else ()) s + +let print_string ?(level=1) ?(flag=None) s = + if (do_verbose flag level) then (prerr_string s; flush stderr) + -let print_string ?(level=1) s = - if (!_level >= level) then (print_string s; flush stdout) +let exe ?(level=1) ?(flag=None) f = + if (do_verbose flag level) then f () else () -let exe ?(level=1) p = - if (!_level >= level) then p () (**** VERSION GORE *****) (* diff --git a/src/verbose.mli b/src/verbose.mli index e08817db6241cc09da8ac7f5a1f85bf6f4474593..1d2b4d4c156c13ded5665b5d0cfe2a89ffce48a5 100644 --- a/src/verbose.mli +++ b/src/verbose.mli @@ -1,5 +1,3 @@ -(** Time-stamp: <modified the 28/01/2008 (at 14:13) by Erwan Jahier> *) - (*---------------------------------------------------------------------- module : Verbose date : @@ -12,10 +10,38 @@ Verbose.put "format" args... ----------------------------------------------------------------------*) +val on : unit -> unit +val off : unit -> unit +val set : int -> unit + + +(* GESTION DES FLAGS DE VERBBOSE POUR LE DEBUG "FIN" +Usage typique : + +- dans un module Toto, faire au début : + +let dbgflag = Global.get_dbg_flag "Toto" + +- puis utiliser dans le code : + +Verbose.printf ~flag:dbg ... +Verbose.exe ~flag:dbg ... + +- si "-dbg Toto" est passé en arguments + tout les Verbose seront pris en compte +*) +type flag +val get_flag : string -> flag +val set_flag : flag -> unit +val flag_list : unit -> string list + +(* val level : unit -> int *) -val set_level : int -> unit -val get_level : unit -> int +(* print/execute if EITHER: + - level (dflt=1) is >= than the set level + - flag is set +*) -val printf : ?level:int -> ('a, unit, string, unit) format4 -> 'a -val exe : ?level:int -> (unit -> unit) -> unit -val print_string : ?level:int -> string -> unit +val printf : ?level:int -> ?flag:flag option -> ('a, unit, string, unit) format4 -> 'a +val print_string : ?level:int -> ?flag:flag option -> string -> unit +val exe : ?level:int -> ?flag:flag option -> (unit -> unit) -> unit diff --git a/t.lus b/t.lus new file mode 100644 index 0000000000000000000000000000000000000000..c8dd9a0d58d01921e34185bf5b32211d41bcaf61 --- /dev/null +++ b/t.lus @@ -0,0 +1,11 @@ + +const toto = 42; + +type t = enum { Bleu, Blanc }; + +type a = int^toto; + +const c : t = Bleu; +const c2 : t; + +const t1 : bool^4^5; diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9c9c80dbcb0cd91bd8c2ab294d0471be3db09422 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,139 @@ + +OBJDIR=../obj$(HOSTTYPE) + +LC0=$(OBJDIR)/lus2lic +LC=$(OBJDIR)/lus2lic -vl 2 +LC2=$(OBJDIR)/lus2lic + +NL="----------------------------------------------------------------------\\n" +filter_line=grep -v Opening\ file + +OK_LUS=$(shell find should_work -name "*.lus" -print | LC_ALL=C sort -n) + +KO_LUS=$(shell find should_fail -name "*.lus" -print | LC_ALL=C sort -n) + +ALL_LUS=$(OK_LUS) $(KO_LUS) + +all: + echo $(ALL_LUS) + +LIC=$(shell find should_work -name "*.lic" -print | LC_ALL=C sort -n) + + +when: + for d in ${ALL_LUS}; do \ + ls $$d; \ + grep -n " when" $$d; \ + done +tgz: + tar cvfz lustre_non_reg_files.tgz should_work should_fail + + +lic: + /bin/echo "generate all possible lic files" + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC2) $$d -o $$d.lic " ;\ + $(LC2) $$d -o $$d.lic ;\ + done + +xxx: + /bin/echo "reentrant ?" + for d in ${LIC}; do \ + /bin/echo -e "\n$(NL)====> $(LC2) $$d " ;\ + $(LC2) $$d > /dev/null ;\ + done + + +begin: + /bin/echo "Non-regression tests" > test_ok.res + /bin/echo "Those tests are supposed to generate errors" > test_ko.res + + +unit: + $(LC0) -unit >> test_ok.res 2>&1 + +help: + $(LC0) -help >> test_ok.res 2>&1 + +version: + $(LC0) --version + +FILTER= grep -v "file was generated by" | grep -v " on " | grep -v "Opening file " + +do_not_exist: + $(LC) do_not_exist.lus | $(FILTER) >> test_ko.res 2>&1 || true + +test_lic: begin unit help version do_not_exist + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC) --nonreg-test $$d" >> test_ok.res; \ + $(LC) --nonreg-test $$d >> test_ok.res 2>&1 ;\ + done; \ + for d in ${KO_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC) --nonreg-test $$d" >> test_ko.res; \ + $(LC) --nonreg-test $$d >> test_ko.res 2>&1 ;\ + done; \ + rm -f test.res ; cat test_ok.res test_ko.res | $(FILTER) > test.res ;\ + diff -u test.res.exp test.res > test.diff || \ + (cat test.diff ; /bin/echo "cf test.diff"; exit 1) +utest_lic: + cp test.res test.res.exp + + +errors_nb: + /bin/echo -e "There were $(shell grep Error test_ok.res | wc -l) errors." + /bin/echo -e "There were $(shell grep Warning test_ok.res | wc -l) Warnings." + +errors:errors_nb + /bin/echo -e "There were $(shell grep Warning test_ok.res | wc -l) Warnings." + grep Warning test_ok.res || true + /bin/echo -e "There were $(shell grep Error test_ok.res | wc -l) errors." + grep "*** Error" test_ok.res + + + + + +test_ec: + rm -f test_ec.res + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC0) --nonreg-test -ec $$d -o /tmp/xx.ec" >> test_ec.res; \ + $(LC0) -ec --nonreg-test $$d -o /tmp/xx.ec >> test_ec.res 2>&1 ;\ + /bin/echo -e "ec2c /tmp/xx.ec" >> test_ec.res; \ + (ec2c /tmp/xx.ec >> test_ec.res 2>&1 && /bin/echo -n "ok ") || /bin/echo " KO ($$d)!";\ + done; \ + diff -u test_ec.res.exp test_ec.res > test_ec.diff || \ + (cat test_ec.diff ; /bin/echo "cf test_ec.diff"; exit 1) + + +utest_ec: + cp test_ec.res test_ec.res.exp + +test_lv4: + rm test_lv4.res || /bin/echo ""; + for d in ${OK_LUS}; do \ + /bin/echo -e "\n$(NL)====> $(LC0) --nonreg-test -lv4 $$d -o /tmp/xx.lus" >> test_lv4.res; \ + $(LC0) --nonreg-test -lv4 $$d -o /tmp/xx.lus >> test_lv4.res 2>&1 ;\ + if [ ! -f /tmp/xx.lus ]; then echo "Error $$d: no /tmp/xx.lus file" >> test_lv4.res 2>&1; fi ;\ + for node in `lusinfo /tmp/xx.lus nodes`; do \ + /bin/echo -e "lus2ec /tmp/xx.lus $$node" >> test_lv4.res; \ + (lus2ec /tmp/xx.lus $$node >> \ + test_lv4.res 2>&1 && /bin/echo -n "ok ") \ + || /bin/echo " KO ($$d)!";\ + done; \ + done; \ + diff -u test_lv4.res.exp test_lv4.res > test_lv4.diff || \ + (cat test_lv4.diff ; /bin/echo "cf test_lv4.diff"; exit 1) + + +utest_lv4: + cp test_lv4.res test_lv4.res.exp + +test: test_lic test_ec test_lv4 +utest: utest_lic utest_ec utest_lv4 + + +clean: + rm -f *.c *.h *.ec + for d in ${ALL_LUS}; do \ + rm $$d.lic; \ + done diff --git a/src/test/should_work/call/bad_call02.lus b/tests/should_work/call/bad_call02.lus similarity index 100% rename from src/test/should_work/call/bad_call02.lus rename to tests/should_work/call/bad_call02.lus diff --git a/src/test/should_work/call/call01.lus b/tests/should_work/call/call01.lus similarity index 100% rename from src/test/should_work/call/call01.lus rename to tests/should_work/call/call01.lus diff --git a/src/test/should_work/call/call02.lus b/tests/should_work/call/call02.lus similarity index 100% rename from src/test/should_work/call/call02.lus rename to tests/should_work/call/call02.lus diff --git a/src/test/should_work/call/call03.lus b/tests/should_work/call/call03.lus similarity index 100% rename from src/test/should_work/call/call03.lus rename to tests/should_work/call/call03.lus diff --git a/src/test/should_work/call/call04.lus b/tests/should_work/call/call04.lus similarity index 100% rename from src/test/should_work/call/call04.lus rename to tests/should_work/call/call04.lus diff --git a/src/test/should_work/call/call05.lus b/tests/should_work/call/call05.lus similarity index 100% rename from src/test/should_work/call/call05.lus rename to tests/should_work/call/call05.lus diff --git a/src/test/should_work/call/call06.lus b/tests/should_work/call/call06.lus similarity index 100% rename from src/test/should_work/call/call06.lus rename to tests/should_work/call/call06.lus diff --git a/src/test/should_work/call/call07.lus b/tests/should_work/call/call07.lus similarity index 100% rename from src/test/should_work/call/call07.lus rename to tests/should_work/call/call07.lus diff --git a/tests/should_work/poly/ply01.lus b/tests/should_work/poly/ply01.lus new file mode 100644 index 0000000000000000000000000000000000000000..f0fc303becd5149449ffb8053faa388d0b21f64b --- /dev/null +++ b/tests/should_work/poly/ply01.lus @@ -0,0 +1,9 @@ + +(* ne passe pas DoNotPoly ... *) +node truc = map<<+,42>>; + +(* PASSE DoNotPoly ... *) +node trac = map<<Lustre::iplus,42>>; + +(* ne passe pas DoNotPoly ... *) +node main = truc; diff --git a/tests/should_work/poly/ply02.lus b/tests/should_work/poly/ply02.lus new file mode 100644 index 0000000000000000000000000000000000000000..74cb4dba69ab0f319e2062e70c8ad206418668ca --- /dev/null +++ b/tests/should_work/poly/ply02.lus @@ -0,0 +1,9 @@ + +(* ne passe pas DoNotPoly ... *) +node truc = map<<+,42>>; + +(* PASSE DoNotPoly en spécialisant truc ! ... *) +node main(x,y: int) returns (o: int^42); +let + o = if (x < y) then 0^42 else truc(x^42, y^42); +tel diff --git a/tests/should_work/poly/ply03.lus b/tests/should_work/poly/ply03.lus new file mode 100644 index 0000000000000000000000000000000000000000..57f13fb7a563993f6234f1ba3618b992dc8fc656 --- /dev/null +++ b/tests/should_work/poly/ply03.lus @@ -0,0 +1,5 @@ + +node main(x,y: int) returns (o: int^42); +let + o = if (x < y) then 0^42 else map<<+,42>>(x^42, y^42); +tel diff --git a/tests/should_work/static/cond01.lus b/tests/should_work/static/cond01.lus new file mode 100644 index 0000000000000000000000000000000000000000..f2865250592b9dc3fbb8dacc0cf32c7ae0ad6f12 --- /dev/null +++ b/tests/should_work/static/cond01.lus @@ -0,0 +1,5 @@ + +node main(c: bool; x,y:int) returns (o: int); +let + o = condact<<+,0>>(c,x,y); +tel diff --git a/tests/should_work/static/predef01.lus b/tests/should_work/static/predef01.lus new file mode 100644 index 0000000000000000000000000000000000000000..ff456acaeab74be76250bde531b19723cb835c41 --- /dev/null +++ b/tests/should_work/static/predef01.lus @@ -0,0 +1,7 @@ + + + +node main(x,y: bool^42) returns (o: bool^42); +let + o = map<<or, 42>>(x,y); +tel diff --git a/tests/should_work/static/predef02.lus b/tests/should_work/static/predef02.lus new file mode 100644 index 0000000000000000000000000000000000000000..5f5822e9f90e0fc9e9d3e2eebea7f024194569b2 --- /dev/null +++ b/tests/should_work/static/predef02.lus @@ -0,0 +1,7 @@ + + + +node main(x: bool^42) returns (o: bool); +let + o = red<<or, 42>>(false,x); +tel diff --git a/tests/should_work/static/predef03.lus b/tests/should_work/static/predef03.lus new file mode 100644 index 0000000000000000000000000000000000000000..c9e9dcac95e3973048686871023c9a070cea8b5d --- /dev/null +++ b/tests/should_work/static/predef03.lus @@ -0,0 +1,7 @@ + + + +node main(x: bool^13) returns (o: bool); +let + o = boolred<<1,2,13>>(x); +tel diff --git a/tests/should_work/static/ts01.lus b/tests/should_work/static/ts01.lus new file mode 100644 index 0000000000000000000000000000000000000000..c1c07f8c04f0b34572c98a243b214fb666495af6 --- /dev/null +++ b/tests/should_work/static/ts01.lus @@ -0,0 +1,9 @@ + +-- ok + +node ma_macro<<const i : int>>(x: int) returns (y: int); +let + y = i + x; +tel + +node main = ma_macro<<32>>; diff --git a/tests/should_work/static/ts02.lus b/tests/should_work/static/ts02.lus new file mode 100644 index 0000000000000000000000000000000000000000..d13971cc86c9f0f0ae6874973c7eb4626a9f54b0 --- /dev/null +++ b/tests/should_work/static/ts02.lus @@ -0,0 +1,10 @@ + +-- KO, mais pas où il faudrait ... + +node ma_macro<<const i : int>>(x: int) returns (y: int); +let + y = i + x; +tel + +-- n.b. ko à l'utilisation uniquement +node main = ma_macro<<32.0>>; diff --git a/tests/should_work/static/ts03.lus b/tests/should_work/static/ts03.lus new file mode 100644 index 0000000000000000000000000000000000000000..f5ab1442cc6ef52826f801ef8276102f2bf2c735 --- /dev/null +++ b/tests/should_work/static/ts03.lus @@ -0,0 +1,11 @@ + +-- KO + +node ma_macro<<const i : int>>(x: int) returns (y: int); +let + y = i + x; +tel + +--*** Bad static argument nature, a constant was expected + +node main = ma_macro<<+>>; diff --git a/ts04.lus b/ts04.lus new file mode 100644 index 0000000000000000000000000000000000000000..c1c07f8c04f0b34572c98a243b214fb666495af6 --- /dev/null +++ b/ts04.lus @@ -0,0 +1,9 @@ + +-- ok + +node ma_macro<<const i : int>>(x: int) returns (y: int); +let + y = i + x; +tel + +node main = ma_macro<<32>>; diff --git a/src/utils/doit b/utils/doit similarity index 100% rename from src/utils/doit rename to utils/doit diff --git a/src/utils/get_branch_name b/utils/get_branch_name similarity index 100% rename from src/utils/get_branch_name rename to utils/get_branch_name diff --git a/src/utils/get_commit_number b/utils/get_commit_number similarity index 100% rename from src/utils/get_commit_number rename to utils/get_commit_number diff --git a/src/utils/get_sha_1 b/utils/get_sha_1 similarity index 100% rename from src/utils/get_sha_1 rename to utils/get_sha_1