forked from dyoo/whalesong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-runtime.rkt
107 lines (78 loc) · 2.77 KB
/
get-runtime.rkt
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#lang racket/base
;; Function to get the runtime library.
;;
;; The resulting Javascript will produce a file that loads:
;;
;;
;; jquery at the the toplevel
;; HashTable at the toplevel
;; jsnums at the toplevel
;;
;; followed by the base library
;;
(require racket/contract
racket/runtime-path
racket/port)
(provide/contract [get-runtime (-> string?)])
(define-runtime-path base-path "runtime-src")
;; The order matters here. link needs to come near the top, because
;; the other modules below have some circular dependencies that are resolved
;; by link.
(define files '(
top.js
;; jquery is special: we need to make sure it's resilient against
;; multiple invokation and inclusion.
jquery-protect-header.js
jquery.js
jquery-protect-footer.js
js-numbers.js
base64.js
baselib.js
baselib-frames.js
baselib-unionfind.js
baselib-equality.js
baselib-format.js
baselib-constants.js
baselib-numbers.js
baselib-lists.js
baselib-vectors.js
baselib-chars.js
baselib-symbols.js
baselib-strings.js
baselib-bytes.js
hashes-header.js
jshashtable-2.1_src.js
llrbtree.js
baselib-hashes.js
hashes-footer.js
baselib-regexps.js
baselib-paths.js
baselib-boxes.js
baselib-placeholders.js
baselib-keywords.js
baselib-structs.js
baselib-srclocs.js
baselib-ports.js
baselib-functions.js
baselib-modules.js
baselib-contmarks.js
baselib-arity.js
baselib-inspectors.js
baselib-exceptions.js
baselib-readergraph.js
;; baselib-check has to come after the definitions of types,
;; since it uses the type predicates immediately on init time.
baselib-check.js
baselib-primitives.js
runtime.js))
(define (path->string p)
(call-with-input-file p
(lambda (ip)
(port->string ip))))
(define text (apply string-append
(map (lambda (n)
(path->string
(build-path base-path (symbol->string n))))
files)))
(define (get-runtime)
text)