nabaztag_hack_kit 0.1.0.beta3 → 0.1.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -2
- data/.gitmodules +3 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +17 -2
- data/LICENSE +21 -0
- data/README.md +115 -44
- data/Rakefile +2 -6
- data/bytecode/{Commands.md → _docs/commands.md} +0 -0
- data/bytecode/{Docs.md → _docs/grammar.md} +0 -0
- data/bytecode/_docs/grammar.pdf +0 -0
- data/bytecode/{src → _original}/README.md +0 -0
- data/bytecode/{src → _original}/lib/arp.mtl +0 -0
- data/bytecode/{src → _original}/lib/cfg.mtl +0 -0
- data/bytecode/{src → _original}/lib/choreos.mtl +0 -0
- data/bytecode/{src → _original}/lib/dhcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/dns.mtl +0 -0
- data/bytecode/{src → _original}/lib/http.mtl +0 -0
- data/bytecode/{src → _original}/lib/tcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/udp.mtl +0 -0
- data/bytecode/{src → _original}/lib/util.mtl +0 -0
- data/bytecode/{src → _original}/lib/var.mtl +0 -0
- data/bytecode/{src → _original}/lib/wav.mtl +0 -0
- data/bytecode/{src → _original}/lib/wifi.mtl +0 -0
- data/bytecode/{src → _original}/nominal-ping.mtl +0 -0
- data/bytecode/main.mtl +11 -11
- data/bytecode/test/test.mtl +8 -8
- data/examples/basic/Gemfile +1 -3
- data/examples/basic/config.ru +14 -4
- data/examples/record/Gemfile +0 -5
- data/examples/record/{config.ru.example → config.ru} +2 -2
- data/examples/record/server.rb +0 -2
- data/ext/Makefile +10 -0
- data/ext/bin/mtl_comp +29 -0
- data/{bytecode → ext}/bin/mtl_merge +0 -0
- data/ext/bin/mtl_simu +29 -0
- data/{bytecode/src/mtl → ext}/extconf.rb +0 -0
- data/ext/mtl_linux/.gitignore +7 -0
- data/ext/mtl_linux/LICENSE +21 -0
- data/ext/mtl_linux/Makefile +116 -0
- data/ext/mtl_linux/MetalC.project +196 -0
- data/ext/mtl_linux/conf.bin +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/conf.bin.sans_password +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/config.txt +0 -0
- data/ext/mtl_linux/inc/log.h +21 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/properties.h +0 -0
- data/{bytecode/src/mtl/linux_simuaudio.h → ext/mtl_linux/inc/simu/linux/simuaudio.h} +0 -0
- data/{bytecode/src/mtl/linux_simunet.h → ext/mtl_linux/inc/simu/linux/simunet.h} +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simuaudio.h +18 -18
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simunet.h +0 -0
- data/ext/mtl_linux/inc/vcomp/compiler.h +200 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/file.h +11 -11
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/filesystem.h +0 -0
- data/ext/mtl_linux/inc/vcomp/interpreter.h +121 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/memory.h +120 -92
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/param.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/parser.h +27 -27
- data/ext/mtl_linux/inc/vcomp/prodbuffer.h +42 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/resource.h +1 -1
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/terminal.h +8 -8
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/util.h +7 -7
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vaudio.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vbc.h +1 -1
- data/ext/mtl_linux/inc/vm/vbc_str.h +167 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vinterp.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vloader.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vlog.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vmem.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vnet.h +0 -0
- data/ext/mtl_linux/nominal.mtl +3959 -0
- data/ext/mtl_linux/src/comp/main.cpp +123 -0
- data/ext/mtl_linux/src/simu/dumpbc.c +2566 -0
- data/ext/mtl_linux/src/simu/linux/main.cpp +288 -0
- data/ext/mtl_linux/src/simu/linux/simu.c +309 -0
- data/ext/mtl_linux/src/simu/linux/simuaudio.c +44 -0
- data/ext/mtl_linux/src/simu/linux/simunet.c +707 -0
- data/ext/mtl_linux/src/simu/log.c +340 -0
- data/ext/mtl_linux/src/simu/properties.c +368 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/GTKANAL.H +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/LAYER3.C +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/TABINIT.C +0 -0
- data/ext/mtl_linux/src/simu/win/mp3/common.c +302 -0
- data/ext/mtl_linux/src/simu/win/mp3/dct64_i386.c +316 -0
- data/ext/mtl_linux/src/simu/win/mp3/decode_i386.c +160 -0
- data/ext/mtl_linux/src/simu/win/mp3/huffman.h +332 -0
- data/ext/mtl_linux/src/simu/win/mp3/interface.c +276 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/mpg123.h +34 -30
- data/ext/mtl_linux/src/simu/win/mp3/mpglib.h +47 -0
- data/ext/mtl_linux/src/simu/win/simu.c +819 -0
- data/ext/mtl_linux/src/simu/win/simuaudio.c +787 -0
- data/ext/mtl_linux/src/simu/win/simunet.c +489 -0
- data/ext/mtl_linux/src/vcomp/bootstrap.cpp +95 -0
- data/ext/mtl_linux/src/vcomp/compiler.cpp +587 -0
- data/ext/mtl_linux/src/vcomp/compiler_file.cpp +1253 -0
- data/ext/mtl_linux/src/vcomp/compiler_prog.cpp +437 -0
- data/ext/mtl_linux/src/vcomp/compiler_term.cpp +1500 -0
- data/ext/mtl_linux/src/vcomp/compiler_type.cpp +1238 -0
- data/ext/mtl_linux/src/vcomp/compiler_var.cpp +502 -0
- data/ext/mtl_linux/src/vcomp/file.cpp +100 -0
- data/ext/mtl_linux/src/vcomp/interpreter.cpp +93 -0
- data/ext/mtl_linux/src/vcomp/memory.cpp +313 -0
- data/ext/mtl_linux/src/vcomp/parser.cpp +584 -0
- data/ext/mtl_linux/src/vcomp/parser_xml.cpp +137 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/prodbuffer.cpp +57 -36
- data/ext/mtl_linux/src/vcomp/stdlib_core.cpp +130 -0
- data/ext/mtl_linux/src/vcomp/terminal.cpp +80 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/util.cpp +18 -11
- data/ext/mtl_linux/src/vm/vaudio.c +830 -0
- data/ext/mtl_linux/src/vm/vinterp.c +1780 -0
- data/ext/mtl_linux/src/vm/vloader.c +139 -0
- data/ext/mtl_linux/src/vm/vlog.c +782 -0
- data/ext/mtl_linux/src/vm/vmem.c +461 -0
- data/ext/mtl_linux/src/vm/vnet.c +298 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/utils/correct_const.sh +0 -0
- data/lib/nabaztag_hack_kit/server.rb +4 -7
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- data/lib/nabaztag_hack_kit.rb +2 -2
- data/nabaztag_hack_kit.gemspec +10 -11
- data/spec/integration/server_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/message_spec.rb +12 -18
- data/spec/unit/server_spec.rb +13 -10
- metadata +145 -137
- data/bytecode/bin/mtl_comp +0 -50
- data/bytecode/bin/mtl_simu +0 -49
- data/bytecode/src/mtl/Makefile +0 -42
- data/bytecode/src/mtl/README.md +0 -13
- data/bytecode/src/mtl/bc.cpp +0 -1891
- data/bytecode/src/mtl/dumpbc.c +0 -2566
- data/bytecode/src/mtl/linux_simu.c +0 -271
- data/bytecode/src/mtl/linux_simuaudio.c +0 -16
- data/bytecode/src/mtl/linux_simunet.c +0 -620
- data/bytecode/src/mtl/log.c +0 -297
- data/bytecode/src/mtl/log.h +0 -20
- data/bytecode/src/mtl/main_compiler.cpp +0 -104
- data/bytecode/src/mtl/main_simu.cpp +0 -221
- data/bytecode/src/mtl/mp3/common.c +0 -265
- data/bytecode/src/mtl/mp3/dct64_i386.c +0 -316
- data/bytecode/src/mtl/mp3/decode_i386.c +0 -155
- data/bytecode/src/mtl/mp3/huffman.h +0 -332
- data/bytecode/src/mtl/mp3/interface.c +0 -258
- data/bytecode/src/mtl/mp3/mpglib.h +0 -44
- data/bytecode/src/mtl/properties.c +0 -293
- data/bytecode/src/mtl/simu.c +0 -750
- data/bytecode/src/mtl/simuaudio.c +0 -662
- data/bytecode/src/mtl/simunet.c +0 -400
- data/bytecode/src/mtl/vaudio.c +0 -677
- data/bytecode/src/mtl/vbc_str.h +0 -166
- data/bytecode/src/mtl/vcomp/Makefile +0 -29
- data/bytecode/src/mtl/vcomp/bootstrap.cpp +0 -89
- data/bytecode/src/mtl/vcomp/compiler.cpp +0 -470
- data/bytecode/src/mtl/vcomp/compiler.h +0 -200
- data/bytecode/src/mtl/vcomp/compiler_file.cpp +0 -929
- data/bytecode/src/mtl/vcomp/compiler_prog.cpp +0 -250
- data/bytecode/src/mtl/vcomp/compiler_term.cpp +0 -1053
- data/bytecode/src/mtl/vcomp/compiler_type.cpp +0 -872
- data/bytecode/src/mtl/vcomp/compiler_var.cpp +0 -289
- data/bytecode/src/mtl/vcomp/file.cpp +0 -79
- data/bytecode/src/mtl/vcomp/interpreter.cpp +0 -85
- data/bytecode/src/mtl/vcomp/interpreter.h +0 -121
- data/bytecode/src/mtl/vcomp/memory.cpp +0 -241
- data/bytecode/src/mtl/vcomp/parser.cpp +0 -427
- data/bytecode/src/mtl/vcomp/parser_xml.cpp +0 -124
- data/bytecode/src/mtl/vcomp/prodbuffer.h +0 -42
- data/bytecode/src/mtl/vcomp/stdlib_core.cpp +0 -122
- data/bytecode/src/mtl/vcomp/terminal.cpp +0 -73
- data/bytecode/src/mtl/vinterp.c +0 -1349
- data/bytecode/src/mtl/vloader.c +0 -127
- data/bytecode/src/mtl/vlog.c +0 -589
- data/bytecode/src/mtl/vmem.c +0 -424
- data/bytecode/src/mtl/vnet.c +0 -255
- data/examples/basic/Procfile +0 -2
- data/examples/basic/server.rb +0 -14
@@ -0,0 +1,116 @@
|
|
1
|
+
# The name of the target file
|
2
|
+
SIMU_TARGET = mtl_simu
|
3
|
+
COMP_TARGET = mtl_compiler
|
4
|
+
VCOMP_TARGET = libvcomp.a
|
5
|
+
|
6
|
+
# OS
|
7
|
+
OS = linux
|
8
|
+
|
9
|
+
# User options
|
10
|
+
OPTIONS = -DVSIMU
|
11
|
+
# C Files to compile (take all)
|
12
|
+
|
13
|
+
|
14
|
+
SIMU_C_FILES = $(wildcard src/vm/*.c)
|
15
|
+
SIMU_C_FILES += $(wildcard src/simu/*.c)
|
16
|
+
SIMU_C_FILES += $(wildcard src/simu/$(OS)/*.c)
|
17
|
+
|
18
|
+
SIMU_CPP_FILES = $(wildcard src/vm/*.cpp)
|
19
|
+
SIMU_CPP_FILES += $(wildcard src/simu/*.cpp)
|
20
|
+
SIMU_CPP_FILES += $(wildcard src/simu/$(OS)/*.cpp)
|
21
|
+
|
22
|
+
COMP_C_FILES = $(wildcard src/comp/*.c)
|
23
|
+
COMP_CPP_FILES = $(wildcard src/comp/*.cpp)
|
24
|
+
|
25
|
+
VCOMP_C_FILES = $(wildcard src/vcomp/*.c)
|
26
|
+
VCOMP_CPP_FILES = $(wildcard src/vcomp/*.cpp)
|
27
|
+
|
28
|
+
# Compiler options
|
29
|
+
CFLAGS += -O0 -m32
|
30
|
+
CFLAGS += -g
|
31
|
+
CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wpointer-arith
|
32
|
+
#CFLAGS += -fdata-sections -ffunction-sections
|
33
|
+
CFLAGS += -fexceptions -fno-delete-null-pointer-checks
|
34
|
+
#CFLAGS += -MMD
|
35
|
+
CFLAGS += $(OPTIONS)
|
36
|
+
CFLAGS += -I./inc/ -I./inc/vm
|
37
|
+
CFLAGS += -I./inc/vcomp
|
38
|
+
CFLAGS += -I./inc/comp
|
39
|
+
CFLAGS += -I./inc/simu/$(OS)
|
40
|
+
|
41
|
+
CPP_FLAGS = $(CFLAGS)
|
42
|
+
|
43
|
+
# Linker options
|
44
|
+
LDFLAGS = -m32
|
45
|
+
# LDFLAGS += -Wl,--gc-sections
|
46
|
+
# LDFLAGS += -Wl,-s
|
47
|
+
|
48
|
+
SIMU_LDFLAGS = $(LDFLAGS)
|
49
|
+
COMP_LDFLAGS = $(LDFLAGS)
|
50
|
+
VCOMP_LDFLAGS = $(LDFLAGS)
|
51
|
+
|
52
|
+
# Additional libraries
|
53
|
+
LIBS = $(VCOMP_TARGET) -lm
|
54
|
+
|
55
|
+
# Compiler toolchain
|
56
|
+
CC = gcc
|
57
|
+
CPP = g++
|
58
|
+
FLEX = flex
|
59
|
+
OBJCOPY = objcopy
|
60
|
+
SIZE = size
|
61
|
+
NM = nm
|
62
|
+
DUMP = objdump
|
63
|
+
DEBUG = gdb
|
64
|
+
|
65
|
+
|
66
|
+
SIMU_OBJS = $(SIMU_CPP_FILES:%.cpp=obj/%.o)
|
67
|
+
SIMU_OBJS += $(SIMU_C_FILES:%.c=obj/%.o)
|
68
|
+
|
69
|
+
COMP_OBJS = $(COMP_CPP_FILES:%.cpp=obj/%.o)
|
70
|
+
COMP_OBJS += $(COMP_C_FILES:%.c=obj/%.o)
|
71
|
+
|
72
|
+
VCOMP_OBJS = $(VCOMP_CPP_FILES:%.cpp=obj/%.o)
|
73
|
+
VCOMP_OBJS += $(VCOMP_C_FILES:%.c=obj/%.o)
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
all: vcomp comp simu
|
79
|
+
|
80
|
+
vcomp: $(VCOMP_TARGET)
|
81
|
+
|
82
|
+
comp: vcomp $(COMP_TARGET)
|
83
|
+
|
84
|
+
simu: vcomp $(SIMU_TARGET)
|
85
|
+
|
86
|
+
|
87
|
+
obj/%.o : %.cpp
|
88
|
+
@test -d $(@D) || mkdir -pm 775 $(@D)
|
89
|
+
$(CPP) -c $(CPP_FLAGS) $< -o $@
|
90
|
+
|
91
|
+
obj/%.o : %.c
|
92
|
+
@test -d $(@D) || mkdir -pm 775 $(@D)
|
93
|
+
$(CC) -c $(CFLAGS) $< -o $@
|
94
|
+
|
95
|
+
$(SIMU_TARGET): $(SIMU_OBJS)
|
96
|
+
$(CPP) -lresolv $(LDFLAGS) -o $@ $^ $(LIBS)
|
97
|
+
|
98
|
+
$(COMP_TARGET): $(COMP_OBJS)
|
99
|
+
$(CPP) $(LDFLAGS) -o $@ $^ $(LIBS)
|
100
|
+
|
101
|
+
$(VCOMP_TARGET): $(VCOMP_OBJS)
|
102
|
+
$(AR) rcs $@ $^
|
103
|
+
# ranlib $@
|
104
|
+
|
105
|
+
|
106
|
+
clean:
|
107
|
+
@rm -f $(VCOMP_TARGET) $(COMP_TARGET) $(SIMU_TARGET)
|
108
|
+
@rm -Rf obj/
|
109
|
+
|
110
|
+
debug: $(TARGET)
|
111
|
+
$(DEBUG) $< < gdb_load
|
112
|
+
|
113
|
+
style:
|
114
|
+
astyle --style=bsd -s4 --indent-preprocessor --add-brackets --recursive *.h *.c*
|
115
|
+
|
116
|
+
.PHONY: clean debug elf style
|
@@ -0,0 +1,196 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<CodeLite_Project Name="MetalC" InternalType="">
|
3
|
+
<VirtualDirectory Name="src">
|
4
|
+
<VirtualDirectory Name="simu">
|
5
|
+
<VirtualDirectory Name="win">
|
6
|
+
<VirtualDirectory Name="mp3">
|
7
|
+
<File Name="src/simu/win/mp3/dct64_i386.c"/>
|
8
|
+
<File Name="src/simu/win/mp3/huffman.h"/>
|
9
|
+
<File Name="src/simu/win/mp3/GTKANAL.H"/>
|
10
|
+
<File Name="src/simu/win/mp3/TABINIT.C"/>
|
11
|
+
<File Name="src/simu/win/mp3/LAYER3.C"/>
|
12
|
+
<File Name="src/simu/win/mp3/decode_i386.c"/>
|
13
|
+
<File Name="src/simu/win/mp3/common.c"/>
|
14
|
+
<File Name="src/simu/win/mp3/mpglib.h"/>
|
15
|
+
<File Name="src/simu/win/mp3/mpg123.h"/>
|
16
|
+
<File Name="src/simu/win/mp3/interface.c"/>
|
17
|
+
</VirtualDirectory>
|
18
|
+
<File Name="src/simu/win/simuaudio.c"/>
|
19
|
+
<File Name="src/simu/win/simunet.c"/>
|
20
|
+
<File Name="src/simu/win/simu.c"/>
|
21
|
+
</VirtualDirectory>
|
22
|
+
<VirtualDirectory Name="linux">
|
23
|
+
<File Name="src/simu/linux/simuaudio.c"/>
|
24
|
+
<File Name="src/simu/linux/simunet.c"/>
|
25
|
+
<File Name="src/simu/linux/simu.c"/>
|
26
|
+
<File Name="src/simu/linux/main.cpp"/>
|
27
|
+
</VirtualDirectory>
|
28
|
+
<File Name="src/simu/log.c"/>
|
29
|
+
<File Name="src/simu/properties.c"/>
|
30
|
+
<File Name="src/simu/dumpbc.c"/>
|
31
|
+
</VirtualDirectory>
|
32
|
+
<VirtualDirectory Name="vcomp">
|
33
|
+
<File Name="src/vcomp/compiler_prog.cpp"/>
|
34
|
+
<File Name="src/vcomp/compiler.cpp"/>
|
35
|
+
<File Name="src/vcomp/compiler_var.cpp"/>
|
36
|
+
<File Name="src/vcomp/file.cpp"/>
|
37
|
+
<File Name="src/vcomp/parser_xml.cpp"/>
|
38
|
+
<File Name="src/vcomp/stdlib_core.cpp"/>
|
39
|
+
<File Name="src/vcomp/memory.cpp"/>
|
40
|
+
<File Name="src/vcomp/util.cpp"/>
|
41
|
+
<File Name="src/vcomp/terminal.cpp"/>
|
42
|
+
<File Name="src/vcomp/prodbuffer.cpp"/>
|
43
|
+
<File Name="src/vcomp/bootstrap.cpp"/>
|
44
|
+
<File Name="src/vcomp/compiler_file.cpp"/>
|
45
|
+
<File Name="src/vcomp/interpreter.cpp"/>
|
46
|
+
<File Name="src/vcomp/compiler_term.cpp"/>
|
47
|
+
<File Name="src/vcomp/parser.cpp"/>
|
48
|
+
<File Name="src/vcomp/compiler_type.cpp"/>
|
49
|
+
</VirtualDirectory>
|
50
|
+
<VirtualDirectory Name="comp">
|
51
|
+
<File Name="src/comp/main.cpp"/>
|
52
|
+
</VirtualDirectory>
|
53
|
+
<VirtualDirectory Name="vm">
|
54
|
+
<File Name="src/vm/vnet.c"/>
|
55
|
+
<File Name="src/vm/vmem.c"/>
|
56
|
+
<File Name="src/vm/vlog.c"/>
|
57
|
+
<File Name="src/vm/vloader.c"/>
|
58
|
+
<File Name="src/vm/vaudio.c"/>
|
59
|
+
<File Name="src/vm/vinterp.c"/>
|
60
|
+
</VirtualDirectory>
|
61
|
+
</VirtualDirectory>
|
62
|
+
<VirtualDirectory Name="inc">
|
63
|
+
<VirtualDirectory Name="simu">
|
64
|
+
<VirtualDirectory Name="win">
|
65
|
+
<File Name="inc/simu/win/simunet.h"/>
|
66
|
+
<File Name="inc/simu/win/simuaudio.h"/>
|
67
|
+
</VirtualDirectory>
|
68
|
+
<VirtualDirectory Name="linux">
|
69
|
+
<File Name="inc/simu/linux/simunet.h"/>
|
70
|
+
<File Name="inc/simu/linux/simuaudio.h"/>
|
71
|
+
</VirtualDirectory>
|
72
|
+
</VirtualDirectory>
|
73
|
+
<VirtualDirectory Name="vcomp">
|
74
|
+
<File Name="inc/vcomp/param.h"/>
|
75
|
+
<File Name="inc/vcomp/parser.h"/>
|
76
|
+
<File Name="inc/vcomp/util.h"/>
|
77
|
+
<File Name="inc/vcomp/prodbuffer.h"/>
|
78
|
+
<File Name="inc/vcomp/memory.h"/>
|
79
|
+
<File Name="inc/vcomp/resource.h"/>
|
80
|
+
<File Name="inc/vcomp/terminal.h"/>
|
81
|
+
<File Name="inc/vcomp/interpreter.h"/>
|
82
|
+
<File Name="inc/vcomp/compiler.h"/>
|
83
|
+
<File Name="inc/vcomp/file.h"/>
|
84
|
+
<File Name="inc/vcomp/filesystem.h"/>
|
85
|
+
</VirtualDirectory>
|
86
|
+
<VirtualDirectory Name="vm">
|
87
|
+
<File Name="inc/vm/vinterp.h"/>
|
88
|
+
<File Name="inc/vm/vlog.h"/>
|
89
|
+
<File Name="inc/vm/vnet.h"/>
|
90
|
+
<File Name="inc/vm/vbc.h"/>
|
91
|
+
<File Name="inc/vm/vbc_str.h"/>
|
92
|
+
<File Name="inc/vm/vloader.h"/>
|
93
|
+
<File Name="inc/vm/vmem.h"/>
|
94
|
+
<File Name="inc/vm/vaudio.h"/>
|
95
|
+
</VirtualDirectory>
|
96
|
+
<File Name="inc/log.h"/>
|
97
|
+
<File Name="inc/properties.h"/>
|
98
|
+
</VirtualDirectory>
|
99
|
+
<Description/>
|
100
|
+
<Dependencies/>
|
101
|
+
<VirtualDirectory Name="mtl_linux">
|
102
|
+
<File Name="Makefile"/>
|
103
|
+
<File Name="readme"/>
|
104
|
+
</VirtualDirectory>
|
105
|
+
<Settings Type="Dynamic Library">
|
106
|
+
<GlobalSettings>
|
107
|
+
<Compiler Options="" C_Options="" Assembler="">
|
108
|
+
<IncludePath Value="."/>
|
109
|
+
</Compiler>
|
110
|
+
<Linker Options="">
|
111
|
+
<LibraryPath Value="."/>
|
112
|
+
</Linker>
|
113
|
+
<ResourceCompiler Options=""/>
|
114
|
+
</GlobalSettings>
|
115
|
+
<Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
116
|
+
<Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
117
|
+
<IncludePath Value="."/>
|
118
|
+
</Compiler>
|
119
|
+
<Linker Options="" Required="yes"/>
|
120
|
+
<ResourceCompiler Options="" Required="no"/>
|
121
|
+
<General OutputFile="" IntermediateDirectory="./Debug" Command="$(ProjectPath)/mtl_compiler" CommandArguments="boot.0.0.0.13.mtl boot.bin" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
122
|
+
<BuildSystem Name="GNU makefile onestep build"/>
|
123
|
+
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
124
|
+
<![CDATA[]]>
|
125
|
+
</Environment>
|
126
|
+
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
|
127
|
+
<DebuggerSearchPaths/>
|
128
|
+
<PostConnectCommands/>
|
129
|
+
<StartupCommands/>
|
130
|
+
</Debugger>
|
131
|
+
<PreBuild/>
|
132
|
+
<PostBuild/>
|
133
|
+
<CustomBuild Enabled="yes">
|
134
|
+
<RebuildCommand/>
|
135
|
+
<CleanCommand>make clean</CleanCommand>
|
136
|
+
<BuildCommand>make</BuildCommand>
|
137
|
+
<PreprocessFileCommand/>
|
138
|
+
<SingleFileCommand/>
|
139
|
+
<MakefileGenerationCommand/>
|
140
|
+
<ThirdPartyToolName>None</ThirdPartyToolName>
|
141
|
+
<WorkingDirectory>$(ProjectPath)</WorkingDirectory>
|
142
|
+
</CustomBuild>
|
143
|
+
<AdditionalRules>
|
144
|
+
<CustomPostBuild/>
|
145
|
+
<CustomPreBuild/>
|
146
|
+
</AdditionalRules>
|
147
|
+
<Completion EnableCpp11="no" EnableCpp14="no">
|
148
|
+
<ClangCmpFlagsC/>
|
149
|
+
<ClangCmpFlags/>
|
150
|
+
<ClangPP/>
|
151
|
+
<SearchPaths/>
|
152
|
+
</Completion>
|
153
|
+
</Configuration>
|
154
|
+
<Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
155
|
+
<Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
156
|
+
<IncludePath Value="."/>
|
157
|
+
</Compiler>
|
158
|
+
<Linker Options="-O2" Required="yes"/>
|
159
|
+
<ResourceCompiler Options="" Required="no"/>
|
160
|
+
<General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
161
|
+
<BuildSystem Name="GNU makefile onestep build"/>
|
162
|
+
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
163
|
+
<![CDATA[]]>
|
164
|
+
</Environment>
|
165
|
+
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
|
166
|
+
<DebuggerSearchPaths/>
|
167
|
+
<PostConnectCommands/>
|
168
|
+
<StartupCommands/>
|
169
|
+
</Debugger>
|
170
|
+
<PreBuild/>
|
171
|
+
<PostBuild/>
|
172
|
+
<CustomBuild Enabled="yes">
|
173
|
+
<RebuildCommand/>
|
174
|
+
<CleanCommand>make clean</CleanCommand>
|
175
|
+
<BuildCommand>make</BuildCommand>
|
176
|
+
<PreprocessFileCommand/>
|
177
|
+
<SingleFileCommand/>
|
178
|
+
<MakefileGenerationCommand/>
|
179
|
+
<ThirdPartyToolName>None</ThirdPartyToolName>
|
180
|
+
<WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
|
181
|
+
</CustomBuild>
|
182
|
+
<AdditionalRules>
|
183
|
+
<CustomPostBuild/>
|
184
|
+
<CustomPreBuild/>
|
185
|
+
</AdditionalRules>
|
186
|
+
<Completion EnableCpp11="no" EnableCpp14="no">
|
187
|
+
<ClangCmpFlagsC/>
|
188
|
+
<ClangCmpFlags/>
|
189
|
+
<ClangPP/>
|
190
|
+
<SearchPaths/>
|
191
|
+
</Completion>
|
192
|
+
</Configuration>
|
193
|
+
</Settings>
|
194
|
+
<Dependencies Name="Debug"/>
|
195
|
+
<Dependencies Name="Release"/>
|
196
|
+
</CodeLite_Project>
|
Binary file
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#ifndef _LOG_H_
|
2
|
+
# define _LOG_H_
|
3
|
+
|
4
|
+
typedef enum
|
5
|
+
{
|
6
|
+
LOG_INIT = 1, // les messages écrits pendant l'init
|
7
|
+
LOG_VM = 2, // les messages écrits par le lapin
|
8
|
+
LOG_SIMUNET = 4, // les logs de simulation réseau
|
9
|
+
LOG_SIMUAUDIO = 8, // les logs de simulation audio
|
10
|
+
LOG_SIMULEDS = 16, // les logs de simulation des leds
|
11
|
+
LOG_SIMUMOTORS = 32 // les messages écrits pendant l'init
|
12
|
+
} e_logtypes;
|
13
|
+
|
14
|
+
void my_printf(e_logtypes t, const char *fmt, ...);
|
15
|
+
void my_printf_set_options(const char *s);
|
16
|
+
int my_printf_set_logfile(const char *filename);
|
17
|
+
void my_printf_set_max_log_size(int n);
|
18
|
+
void my_printf_set_max_log_time(int n);
|
19
|
+
void my_printf_set_do_log_time(int n);
|
20
|
+
|
21
|
+
#endif // ! _LOG_H_
|
File without changes
|
File without changes
|
File without changes
|
@@ -13,28 +13,28 @@
|
|
13
13
|
// Global variables & type defs
|
14
14
|
typedef struct WaveOutBuffer
|
15
15
|
{
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
WORD Rate;
|
17
|
+
BYTE nChannels;
|
18
|
+
LONG dwDataSize;
|
19
|
+
BYTE Resolution;
|
20
|
+
HWND hwnd;
|
21
|
+
HGLOBAL hWaveHdr;
|
22
|
+
LPWAVEHDR lpWaveHdr;
|
23
|
+
HANDLE hData; // handle of waveform data memory
|
24
|
+
HPSTR lpData; // pointer to waveform data memory
|
25
25
|
} WaveOutBuffer;
|
26
26
|
|
27
27
|
typedef struct WaveInBuffer
|
28
28
|
{
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
WORD Rate;
|
30
|
+
BYTE nChannels;
|
31
|
+
LONG dwDataSize;
|
32
|
+
BYTE Resolution;
|
33
|
+
HWND hwnd;
|
34
|
+
HGLOBAL hWaveHdr;
|
35
|
+
LPWAVEHDR lpWaveHdr;
|
36
|
+
HANDLE hData; // handle of waveform data memory
|
37
|
+
HPSTR lpData; // pointer to waveform data memory
|
38
38
|
} WaveInBuffer;
|
39
39
|
|
40
40
|
// audio
|
File without changes
|
@@ -0,0 +1,200 @@
|
|
1
|
+
//-------------------
|
2
|
+
// MV
|
3
|
+
// version WIN32 et POCKETPC
|
4
|
+
// Sylvain Huet
|
5
|
+
// Premiere version : 07/01/2003
|
6
|
+
// Derniere mise a jour : 07/01/2003
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef _COMPILER_
|
10
|
+
#define _COMPILER_
|
11
|
+
|
12
|
+
#include"interpreter.h"
|
13
|
+
|
14
|
+
class Memory;
|
15
|
+
class Parser;
|
16
|
+
class Prodbuffer;
|
17
|
+
|
18
|
+
class Compiler
|
19
|
+
{
|
20
|
+
private:
|
21
|
+
Memory* m;
|
22
|
+
int systempackage;
|
23
|
+
intptr_t* stdtypes;
|
24
|
+
|
25
|
+
Prodbuffer* bc; // structure de production de bytecode
|
26
|
+
|
27
|
+
Prodbuffer* outputbuf; // structure de production des messages de type
|
28
|
+
|
29
|
+
|
30
|
+
Parser* parser;
|
31
|
+
intptr_t* newpackage;
|
32
|
+
intptr_t* newref;
|
33
|
+
int globals;
|
34
|
+
int locals;
|
35
|
+
int nblocals;
|
36
|
+
|
37
|
+
int ifuns;
|
38
|
+
|
39
|
+
// typage
|
40
|
+
intptr_t createnodetypecore(const char* name);
|
41
|
+
intptr_t createnodetypecore(int name);
|
42
|
+
intptr_t createnodetype(int type);
|
43
|
+
intptr_t createnodetuple(int size);
|
44
|
+
intptr_t createnodetupleval(int size);
|
45
|
+
|
46
|
+
intptr_t* actualtype(intptr_t* p);
|
47
|
+
|
48
|
+
int parsegraph(Parser* p,int env,int mono,int rec,int labels,int newvars,intptr_t* rnode);
|
49
|
+
intptr_t parse_rnode(intptr_t* p);
|
50
|
+
|
51
|
+
intptr_t creategraph(Parser* p,int env,int mono);
|
52
|
+
intptr_t creategraph(Parser* p,int env,int mono,int labels);
|
53
|
+
intptr_t creategraph(const char* src,int env,int mono);
|
54
|
+
|
55
|
+
int recechograph(Prodbuffer *output,intptr_t* p,int rec,int labels);
|
56
|
+
|
57
|
+
intptr_t reccopytype(intptr_t* p);
|
58
|
+
intptr_t recresetcopy(intptr_t* p);
|
59
|
+
|
60
|
+
intptr_t recgoweak(intptr_t* p);
|
61
|
+
|
62
|
+
int restoreactual(intptr_t* t,intptr_t* s,int vt,int vs,int k);
|
63
|
+
intptr_t recunif(intptr_t* x,intptr_t* y);
|
64
|
+
intptr_t unif(intptr_t* x,intptr_t* y);
|
65
|
+
intptr_t unif_argfun();
|
66
|
+
|
67
|
+
intptr_t unifbigger(intptr_t* x,intptr_t* y);
|
68
|
+
|
69
|
+
intptr_t* argsfromfun(intptr_t *f);
|
70
|
+
|
71
|
+
void echonode(int code,intptr_t* p);
|
72
|
+
// packages
|
73
|
+
int hash(const char* name);
|
74
|
+
intptr_t createpackage(const char* name,int loghach);
|
75
|
+
void addreftopackage(intptr_t* ref,intptr_t* package);
|
76
|
+
intptr_t* searchtype(int env,const char* name);
|
77
|
+
intptr_t* searchemptytype(int env,const char* name);
|
78
|
+
|
79
|
+
void dumppackage(int env);
|
80
|
+
|
81
|
+
intptr_t searchbytype(int env,int type);
|
82
|
+
|
83
|
+
// liste de labels
|
84
|
+
intptr_t addlabel(intptr_t base,const char* name,int val,intptr_t ref);
|
85
|
+
int nblabels(intptr_t base);
|
86
|
+
void removenlabels(intptr_t base,int n);
|
87
|
+
int searchlabel_byname(intptr_t base,const char* name,int* val,intptr_t* ref);
|
88
|
+
int searchlabel_byval(intptr_t base,int val, char** name);
|
89
|
+
intptr_t* tuplefromlabels(intptr_t base);
|
90
|
+
|
91
|
+
// compilation
|
92
|
+
int parsefile(int ifdef);
|
93
|
+
int parsevar();
|
94
|
+
int parseconst();
|
95
|
+
int parseproto();
|
96
|
+
int parseifdef(int ifndef);
|
97
|
+
int skipifdef();
|
98
|
+
intptr_t fillproto(int env,intptr_t* fun);
|
99
|
+
intptr_t findproto(int env,intptr_t* fun);
|
100
|
+
int parsetype();
|
101
|
+
int parsestruct();
|
102
|
+
int parsesum();
|
103
|
+
|
104
|
+
int parsefun();
|
105
|
+
int parseprogram();
|
106
|
+
int parseexpression();
|
107
|
+
int parsearithm();
|
108
|
+
int parsea1();
|
109
|
+
int parsea2();
|
110
|
+
int parsea3();
|
111
|
+
int parsea4();
|
112
|
+
int parsea5();
|
113
|
+
int parsea6();
|
114
|
+
int parseterm();
|
115
|
+
int parseref();
|
116
|
+
int parseif();
|
117
|
+
intptr_t parselet();
|
118
|
+
int parseset();
|
119
|
+
int parsewhile();
|
120
|
+
int parsefor();
|
121
|
+
int parsepntfun();
|
122
|
+
int parselink();
|
123
|
+
int parsecall();
|
124
|
+
int parselocals();
|
125
|
+
int parsestring();
|
126
|
+
int parsefields(intptr_t* p);
|
127
|
+
int parsematch();
|
128
|
+
int parsematchcons(intptr_t* end);
|
129
|
+
|
130
|
+
int parsegetpoint();
|
131
|
+
int parsesetpoint(int local,int ind,int* opstore);
|
132
|
+
|
133
|
+
int parseupdate();
|
134
|
+
int parseupdatevals();
|
135
|
+
|
136
|
+
// parsing variables
|
137
|
+
int parseval();
|
138
|
+
int parseval3();
|
139
|
+
int parseval4();
|
140
|
+
int parseval5();
|
141
|
+
int parseval6();
|
142
|
+
int parseval7();
|
143
|
+
|
144
|
+
// production bytecode
|
145
|
+
void bc_byte_or_int(int val,int opbyte,int opint);
|
146
|
+
void bcint_byte_or_int(int val);
|
147
|
+
// autres
|
148
|
+
intptr_t addstdlibcore();
|
149
|
+
int addstdlibstr();
|
150
|
+
int addstdlibbuf();
|
151
|
+
int addstdlibfiles();
|
152
|
+
|
153
|
+
int recglobal(int val,Prodbuffer *b);
|
154
|
+
int recglobals(int vlab,Prodbuffer *b);
|
155
|
+
int recbc(int vref,Prodbuffer *b,Prodbuffer *btab,int offset);
|
156
|
+
|
157
|
+
public:
|
158
|
+
Prodbuffer* brelease;
|
159
|
+
Compiler(Memory* mem);
|
160
|
+
~Compiler();
|
161
|
+
int start();
|
162
|
+
void stop();
|
163
|
+
intptr_t addnative(int nref, const char** nameref, int* valref
|
164
|
+
, int* coderef, const char** typeref,void* arg);
|
165
|
+
|
166
|
+
int gocompile(int type); // [filename/src packages] -> [packages]
|
167
|
+
int getsystempackage();
|
168
|
+
|
169
|
+
intptr_t* searchref(int env,char* name);
|
170
|
+
intptr_t* searchref_nosetused(int env,char* name);
|
171
|
+
|
172
|
+
|
173
|
+
intptr_t echograph(Prodbuffer *output,intptr_t* p);
|
174
|
+
intptr_t copytype(intptr_t* p);
|
175
|
+
intptr_t recunifbigger(intptr_t* x,intptr_t* y);
|
176
|
+
|
177
|
+
};
|
178
|
+
|
179
|
+
#define LABELLIST_LENGTH 4
|
180
|
+
#define LABELLIST_NAME 0
|
181
|
+
#define LABELLIST_VAL 1
|
182
|
+
#define LABELLIST_REF 2
|
183
|
+
#define LABELLIST_NEXT 3
|
184
|
+
|
185
|
+
#define STDTYPE_LENGTH 8
|
186
|
+
#define STDTYPE_I 0
|
187
|
+
#define STDTYPE_F 1
|
188
|
+
#define STDTYPE_S 2
|
189
|
+
#define STDTYPE_Env 3
|
190
|
+
#define STDTYPE_Xml 4
|
191
|
+
#define STDTYPE_fun__u0_list_u0__list_u0 5
|
192
|
+
#define STDTYPE_fun__tab_u0_I__u0 6
|
193
|
+
#define STDTYPE_fun__fun_u0_u1_u0__u1 7
|
194
|
+
|
195
|
+
|
196
|
+
#define COMPILE_FROMFILE 0
|
197
|
+
#define COMPILE_FROMSTRING 1
|
198
|
+
|
199
|
+
|
200
|
+
#endif
|
@@ -19,21 +19,21 @@ class FileSystem;
|
|
19
19
|
class File
|
20
20
|
{
|
21
21
|
private :
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
FileSystem *filesystem;
|
23
|
+
FILE *file;
|
24
|
+
char* internalbuffer;
|
25
|
+
int sizeinternalbuffer;
|
26
26
|
public:
|
27
|
-
|
28
|
-
|
27
|
+
File(FileSystem *fs);
|
28
|
+
~File();
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
int openread(const char* name);
|
31
|
+
char* getcontent(int *size);
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
int openwrite(const char* name);
|
34
|
+
int write(const char* outbuf,int size);
|
35
35
|
|
36
|
-
|
36
|
+
int close();
|
37
37
|
|
38
38
|
};
|
39
39
|
#endif
|
File without changes
|