-
Notifications
You must be signed in to change notification settings - Fork 6
/
tsp.tcl
62 lines (47 loc) · 2.41 KB
/
tsp.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package provide tsp 0.1
package require parser
namespace eval ::tsp {
# types allowed for variables and procs
variable VAR_TYPES [list boolean int double string array var]
variable NATIVE_TYPES [list boolean int double string]
variable RETURN_TYPES [list void boolean int double string var]
# compiler log for all procs, keys are "filename,procname" errors|warnings, entries are list of: errors/warnings
# most recent compilation has key of _
variable COMPILER_LOG [dict create]
# dict of compiled procs, entries are list of: returns argTypes compiledReference
variable COMPILED_PROCS [dict create]
# directory name of debug output, if any
variable DEBUG_DIR ""
# output of traces, default stderr
# when ::tsp::debug is called, a file is created in that directory
variable TRACE_FD stderr
# the last traced proc that returned a value (or void), so the we can check their return types
variable TRACE_PROC ""
# inline - whether to inline code or use utility methods/functions where applicable
variable INLINE 0
# home_dir - tsp installation dir, so we can find native files
variable HOME_DIR
# other ::tsp namespace variables are set in language specific files,
# e.g., tsp-java.tcl, tsp-clang.tcl
}
set ::tsp::HOME_DIR [file normalize [file dirname [info script]]]
source [file join [file dirname [info script]] tsp-logging.tcl]
source [file join [file dirname [info script]] tsp-compile.tcl]
source [file join [file dirname [info script]] tsp-trace.tcl]
source [file join [file dirname [info script]] tsp-expr.tcl]
source [file join [file dirname [info script]] tsp-parse.tcl]
source [file join [file dirname [info script]] tsp-types.tcl]
source [file join [file dirname [info script]] tsp-generate.tcl]
source [file join [file dirname [info script]] tsp-generate-set.tcl]
source [file join [file dirname [info script]] tsp-generate-math.tcl]
source [file join [file dirname [info script]] tsp-generate-control.tcl]
source [file join [file dirname [info script]] tsp-generate-var.tcl]
source [file join [file dirname [info script]] tsp-generate-list.tcl]
source [file join [file dirname [info script]] tsp-generate-string.tcl]
# source the language specific module
if {$::tcl_platform(platform) eq "java"} {
source [file join [file dirname [info script]] tsp-java.tcl]
} else {
source [file join [file dirname [info script]] tsp-clang.tcl]
}
format ""