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

Add a (hidden) --2c-4c-socks to lutin option that uses sockets

instead of lucky.a to launch the lutin interpreter.

I've added a test in the example/lutin/C/ directory.
parent bad5aa41
CC = gcc -g
LINKER= gcc -g
LINKER= $(CC)
EXE=
DEBUG=-D_DEBUG
DEBUG=
CFLAGS = \
-L../../../lib \
-I../../../include
-I../../../include $(DEBUG)
LIBS = -lluc4c_nc -llucky_nc -lgmp -lm -ldl -lstdc++
LUC2C=../../../$(HOSTTYPE)/bin/lutin --2c-4c
LUC2CSOCK=../../../$(HOSTTYPE)/bin/lutin --2c-4c-socks -seed 42
ifeq ($(HOSTTYPE),mac)
LINKER=g++ -g
LIBS = -lluc4c_nc -llucky_nc -lgmp -lm -ldl
endif
ifeq ($(HOSTTYPE),win32)
ifneq (,$(findstring win32,$(HOSTTYPE)))
EXE=.exe
LINKER=$(CC)
CFLAGS = \
-L../../../lib \
-I../../../include \
-I../../../include -D_WIN32 -D_WINSOCK $(DEBUG) \
-Winline -Wimplicit-function-declaration
LIBS = -lluc4c_nc -llucky_nc -lgmp -lws2_32 -lm -lstdc++ -mno-cygwin -lole32
LUC2C=../../../$(HOSTTYPE)/bin/luc2c$(EXE)
LIBS = -lluc4c_nc -llucky_nc -lgmp -lws2_32 -lm -lstdc++ -lole32
LIBSSOCK = -lws2_32 -lole32
LUC2C=../../../$(HOSTTYPE)/bin/lutin.exe --2c-4c
LUC2CSOCK=../../../$(HOSTTYPE)/bin/lutin.exe --2c-4c-socks
endif
ifeq ($(HOSTTYPE),cygwin)
EXE=.exe
......@@ -41,9 +47,6 @@ endif
foo.c: foo.lut
$(LUC2C) foo.lut
foo-sock.c: foo.lut
$(LUC2C) foo.lut
foo.o : foo.c
$(CC) -c $(CFLAGS) foo.c
......@@ -53,26 +56,48 @@ call_foo.o: call_foo.c
foo$(EXE): foo.o call_foo.o
$(LINKER) $(CFLAGS) -o $@ $^ $(LIBS)
################################################################
# Calling lucky from C via sockets
call_foo_sock.o: call_foo_sock.c
$(CC) -c $(CFLAGS) call_foo_sock.c
sock:
$(LUC2CSOCK) foo.lut
make foo.o
foo-sock$(EXE): foo-sock.o call_foo.o
$(LINKER) $(CFLAGS) -o $@ $^ $(LIBS)
foo-sock$(EXE): sock foo.o call_foo_sock.o
$(LINKER) $(CFLAGS) -o $@ foo.o call_foo_sock.o $(LIBSSOCK)
################################################################
clean:
rm -f run *.o *~ foo foo.h foo.c *.gp *.plot *.rif
rm -f run *.o *~ foo foo-sock foo*.h foo*.c foo-sock.c *.gp *.plot *.rif *.log
test : clean foo$(EXE)
test1 : clean foo$(EXE)
ifeq ($(HOSTTYPE),win32)
foo$(EXE)
else
./foo > test.rif
rm -f test.res && diff -B -u -i test.rif.exp test.rif > test.res
[ ! -s test.res ] && make clean
./foo > test1.rif
rm -f test1.res && diff -B -u -i test1.rif.exp test1.rif > test1.res
[ ! -s test1.res ] && make clean
endif
utest:
cp test.rif test.rif.exp
utest1:
cp test1.rif test1.rif.exp
test2: clean foo-sock$(EXE)
./foo-sock$(EXE) > test2.rif
rm -f test2.res && diff -B -u -i test2.rif.exp test2.rif > test2.res
[ ! -s test2.res ] && make clean
utest2:
cp test2.rif test2.rif.exp
test: test1 test2
......@@ -5,29 +5,29 @@
#outs 40 T 0.33
#step 1
42 t 3.14
#outs 41 T 6.83
#outs 46 T 1.84
#step 2
42 t 3.14
#outs 44 T 2.18
#outs 41 T 7.17
#step 3
42 t 3.14
#outs 43 T 2.11
#outs 41 T 7.11
#step 4
42 t 3.14
#outs 44 T 2.95
#outs 41 T 7.95
#step 5
42 t 3.14
#outs 46 T 4.13
#step 6
42 t 3.14
#outs 38 T 5.73
#outs 44 T 0.74
#step 7
42 t 3.14
#outs 45 T -0.71
#outs 41 T 4.28
#step 8
42 t 3.14
#outs 41 T -0.83
#step 9
42 t 3.14
#outs 39 T 6.96
#outs 45 T 1.96
#step 10
\ No newline at end of file
#inputs
#outputs "a":int "b":int "c":int "d":int "e":int
#step 1
#outs 3684 505 -5344 -3651 640
#step 2
#outs 7650 -4464 7322 1929 -389
#step 3
#outs 4084 -4581 8533 1697 -843
#step 4
# Simulation ended normally.
#inputs
#outputs "a":bool
#step 1
#outs T
#step 2
#outs T
#step 3
#outs T
#step 4
#outs T
#step 5
#outs T
#step 6
#outs T
#step 7
#outs T
#step 8
#outs T
#step 9
#outs T
#step 10
#outs T
#step 11
#outs T
#step 12
#outs F
#step 13
#outs F
#step 14
#outs F
#step 15
#outs F
#step 16
#outs F
#step 17
#outs F
#step 18
#outs F
#step 19
#outs F
#step 20
#outs F
#step 21
#outs F
#step 22
#outs F
#step 23
#outs F
#step 24
#outs F
#step 25
#outs F
#step 26
#outs F
#step 27
#outs F
#step 28
#outs F
#step 29
#outs F
#step 30
#outs F
#step 31
#outs F
#step 32
#outs F
#step 33
#outs F
#step 34
#outs F
#step 35
#outs F
#step 36
#outs F
#step 37
#outs F
#step 38
#outs F
#step 39
#outs F
#step 40
#outs F
#step 41
#outs F
#step 42
#outs F
#step 43
#outs F
#step 44
#outs F
#step 45
#outs F
#step 46
#outs F
#step 47
#outs F
#step 48
#outs F
#step 49
#outs F
#step 50
#outs F
#step 51
#outs F
#step 52
#outs F
#step 53
#outs F
#step 54
#outs F
#step 55
#outs F
#step 56
#outs F
#step 57
#outs F
#step 58
#outs F
#step 59
#outs F
#step 60
#outs F
#step 61
#outs F
#step 62
#outs F
#step 63
#outs F
#step 64
#outs F
#step 65
#outs F
#step 66
#outs F
#step 67
#outs F
#step 68
#outs F
#step 69
#outs F
#step 70
#outs F
#step 71
#outs F
#step 72
#outs F
#step 73
#outs F
#step 74
#outs F
#step 75
#outs F
#step 76
#outs F
#step 77
#outs F
#step 78
#outs F
#step 79
#outs F
#step 80
#outs F
#step 81
#outs F
#step 82
#outs F
#step 83
#outs F
#step 84
#outs F
#step 85
#outs F
#step 86
#outs F
#step 87
#outs F
#step 88
#outs F
#step 89
#outs F
#step 90
#outs F
#step 91
#outs F
#step 92
#outs F
#step 93
#outs F
#step 94
#outs F
#step 95
#outs F
#step 96
#outs F
#step 97
#outs F
#step 98
#outs F
#step 99
#outs F
#step 100
#outs F
#end
#inputs
#outputs "a":bool "b":bool "c":bool "d":bool "e":bool
#step 1
#outs T T F F F
#step 2
#outs T F T T F
#step 3
#outs T F T F T
#step 4
# Simulation ended normally.
#inputs
#outputs "a":bool "b":bool "c":bool "d":bool "e":bool
#step 1
#outs T F T T T
#step 2
#outs T T F T T
#step 3
#outs T F F T T
#step 4
# Simulation ended normally.
#inputs
#outputs "a":bool "b":bool "c":bool "d":bool "e":bool "f":bool
#step 1
#outs T T T T F T
#step 2
#outs T T T T T F
#step 3
#outs T T T F F T
#step 4
# Simulation ended normally.
#inputs
#outputs "x":bool "y":bool "z":bool "t":bool
#step 1
#outs T T T T
#step 2
#outs F T T T
#step 3
#outs T T F T
#step 4
# Simulation ended normally.
#inputs
#outputs "x":bool "y":bool "z":bool "t":bool
#step 1
#outs T T T T
#step 2
#outs T T T T
#step 3
#outs T F F T
#step 4
#outs T T F T
#step 5
#outs T F T F
#step 6
#outs T F F F
#step 7
#outs T F F T
#step 8
#outs T F F T
#step 9
#outs T F F F
#step 10
#outs T F F T
#step 11
#outs T F F T
#step 12
#outs T T F T
#step 13
#outs T T F T
#step 14
#outs T F T F
#step 15
#outs T F F F
#step 16
#outs T T F T
#step 17
#outs T T T T
#step 18
#outs T T F T
#step 19
#outs T F F F
#step 20
#outs T F F F
#step 21
#outs T T F T
#step 22
#outs T T T T
#step 23
#outs T T T T
#step 24
#outs T T T F
#step 25
#outs T T T F
#step 26
#outs T T T F
#step 27
#outs T F T T
#step 28
#outs T T F T
#step 29
#outs T T F F
#step 30
#outs T F T T
#step 31
#outs T F F F
#step 32
#outs T T T T
#step 33
#outs T F T T
#step 34
#outs T F F F
#step 35
#outs T F F T
#step 36
#outs T F T T
#step 37
#outs T F T F
#step 38
#outs T F T T
#step 39