Login
7 branches 0 tags
Ben (Win10) Fixed log* functions by making them fold in the compiler 5e1d073 3 years ago 670 Commits
nujel / bootstrap / binlib.no
#{
05v "Nujel Standalone"
0Es test-context
0D
23s help
05v [off]
05v #@[documentation: "Describe 10 functions at OFFset" source: ["Describe 10 functions at OFFset" [when-not [int? off] [set! off [int off]]] [for-each [map [symbol-table off 10] string] [fn [l] [def desc [describe l]] [pfmtln "{l} {desc}"]]] [def sc [/ [symbol-count] 10]] [pfmtln "Help page {off} of {sc}"]]]
05v #{
05v int?
10s off
04i 1
0Bo 7
24
09o 17
05v int
10s off
04i 1
0Fs off
0D
05v for-each
05v map
05v symbol-table
10s off
02i 10
04i 2
10s string
04i 2
23s anonymous
05v [l]
05v #@[source: [[def desc [describe l]] [pfmtln "{l} {desc}"]]]
05v #{
05v describe
10s l
04i 1
0Es desc
0D
05v println
05v cat
10s l
05v " "
10s desc
04i 3
04i 1
01
}
17
04i 2
0D
05v /
05v symbol-count
04i 0
02i 10
04i 2
0Es sc
0D
05v println
05v cat
05v "Help page "
10s off
05v " of "
10s sc
04i 4
04i 1
01
}
17
0Es help
0D
23s file/eval
05v [path environment]
05v #@[documentation: "Evaluate a Nujel source file in the current context" source: ["Evaluate a Nujel source file in the current context" [when-not environment [set! environment root-closure]] [for-in [form [read [file/read path]]] [eval-in environment form]]]]
05v #{
10s environment
0Bo 7
24
09o 11
10s root-closure
0Fs environment
0D
15
05v read
05v file/read
10s path
04i 1
04i 1
0Es ΓεnΣym-3
0D
10s ΓεnΣym-3
0Bo 55
02i 0
1B
1C
10s ΓεnΣym-3
0Bo 41
0D
10s ΓεnΣym-3
11
0Es form
0D
05v eval-in
10s environment
10s form
04i 2
0D
10s ΓεnΣym-3
12
0Fs ΓεnΣym-3
09o -43
09o 4
24
16
01
}
17
0Es file/eval
0D
23s load
05v [filename]
05v #@[source: [[try [fn [err] [display/error err] #f] [file/eval filename] [pfmtln "Loaded {filename}"] #t]]]
05v #{
23s anonymous
05v [err]
05v #@[source: [[display/error err] #f]]
05v #{
05v display/error
10s err
04i 1
0D
05v #f
01
}
17
19o 40
05v file/eval
10s filename
04i 1
0D
05v println
05v cat
05v "Loaded "
10s filename
04i 2
04i 1
0D
05v #t
16
01
}
17
0Es load
0D
23s file/file?
05v [filename]
05v #@[source: [[ref [file/stat filename] :regular-file?]]]
05v #{
05v ref
05v file/stat
10s filename
04i 1
05v :regular-file?
04i 2
01
}
17
0Es file/file?
0D
23s file/dir?
05v [filename]
05v #@[source: [[ref [file/stat filename] :directory?]]]
05v #{
05v ref
05v file/stat
10s filename
04i 1
05v :directory?
04i 2
01
}
17
0Es file/dir?
0D
23s directory/read-relative
05v [path]
05v #@[source: [[map [directory/read path] [fn [a] [cat path "/" a]]]]]
05v #{
05v map
05v directory/read
10s path
04i 1
23s anonymous
05v [a]
05v #@[source: [[cat path "/" a]]]
05v #{
05v cat
10s path
05v "/"
10s a
04i 3
01
}
17
04i 2
01
}
17
0Es directory/read-relative
0D
23s directory/read-recursive
05v [path]
05v #@[source: [[flatten [map [directory/read-relative path] [fn [A] [if [file/dir? A] [directory/read-recursive A] A]]]]]]
05v #{
05v flatten
05v map
05v directory/read-relative
10s path
04i 1
23s anonymous
05v [A]
05v #@[source: [[if [file/dir? A] [directory/read-recursive A] A]]]
05v #{
05v file/dir?
10s A
04i 1
0Bo 16
05v directory/read-recursive
10s A
04i 1
09o 7
10s A
01
}
17
04i 2
04i 1
01
}
17
0Es directory/read-recursive
0D
23s popen/trim
05v [cmd]
05v #@[documentation: "Run CMD using popen and return the trimmed stdout" source: ["Run CMD using popen and return the trimmed stdout" [trim [cdr [popen cmd]]]]]
05v #{
05v trim
05v popen
10s cmd
04i 1
12
04i 1
01
}
17
0Es popen/trim
01
}#{
05v "nujel"
0Es repl/executable-name
0D
05v #f
0Es repl/parse-args/eval-next
0D
05v #t
0Es repl/parse-args/run-repl
0D
05v tree/new
24
04i 1
0Es repl/options
0D
05v tree/new
24
04i 1
0Es repl/option-map
0D
23s repl/exception-handler
05v [error]
05v #@[source: [[display/error error]]]
05v #{
05v display/error
10s error
04i 1
01
}
17
0Es repl/exception-handler
0D
24
0Es repl/history
0D
23s repl/prompt
05v []
05v #@[documentation: ">" source: ["> "]]
05v #{
05v "> "
01
}
17
0Es repl/prompt
0D
23s repl/wasm
05v [line]
05v #@[documentation: "Evaluate LINE in the wasm context" source: ["Evaluate LINE in the wasm context" [try repl/exception-handler [eval-in root-closure [cons do [read line]]]]]]
05v #{
10s repl/exception-handler
19o 29
05v eval-in
10s root-closure
10s do
05v read
10s line
04i 1
14
04i 2
16
01
}
17
0Es repl/wasm
0D
23s repl/cmd/raw
05v [ctx line]
05v #@[source: [[try [fn [err] [if [== [car err] :unmatched-opening-bracket] [repl/cmd/raw ctx [cat line [readline "... "]]] [throw err]]] [def expr [read line]] [when [equal? '[] expr] [print "\r"] [return]] [def result [eval-in ctx [cons do expr]]] [set! repl/history [cons line repl/history]] [println [if [nil? result] "" [str/write result]]]]]]
05v #{
23s anonymous
05v [err]
05v #@[source: [[if [== [car err] :unmatched-opening-bracket] [repl/cmd/raw ctx [cat line [readline "... "]]] [throw err]]]]
05v #{
10s err
11
05v :unmatched-opening-bracket
20
0Bo 36
05v repl/cmd/raw
10s ctx
05v cat
10s line
05v readline
05v "... "
04i 1
04i 2
04i 2
09o 13
05v throw
10s err
04i 1
01
}
17
19o 128
05v read
10s line
04i 1
0Es expr
0D
05v equal?
05v []
10s expr
04i 2
0Bo 19
05v print
05v "\r"
04i 1
0D
24
01
09o 4
24
0D
05v eval-in
10s ctx
10s do
10s expr
14
04i 2
0Es result
0D
10s line
10s repl/history
14
0Fs repl/history
0D
05v println
05v nil?
10s result
04i 1
0Bo 10
05v ""
09o 13
05v str/write
10s result
04i 1
04i 1
16
01
}
17
0Es repl/cmd/raw
0D
23s repl/cmd
05v [ctx]
05v #@[source: [[def buf ""] [def line ""] [while [!= line "[/cmd]\n"] [set! buf [cat buf line]] [set! line [readline]]] [def expr [cons do [read buf]]] [set! repl/history [cons buf repl/history]] [def result [eval-in ctx expr]] [println [if [nil? result] "" [str/write result]]]]]
05v #{
05v ""
0Es buf
0D
05v ""
0Es line
0D
02i 0
1B
1C
05v !=
10s line
05v "[/cmd]\n"
04i 2
0Bo 36
0D
05v cat
10s buf
10s line
04i 2
0Fs buf
0D
05v readline
04i 0
0Fs line
09o -48
0D
10s do
05v read
10s buf
04i 1
14
0Es expr
0D
10s buf
10s repl/history
14
0Fs repl/history
0D
05v eval-in
10s ctx
10s expr
04i 2
0Es result
0D
05v println
05v nil?
10s result
04i 1
0Bo 10
05v ""
09o 13
05v str/write
10s result
04i 1
04i 1
01
}
17
0Es repl/cmd
0D
23s repl/readline
05v [ctx]
05v #@[source: [[def line [readline [repl/prompt]]] [when [nil? line] [display "See you space cowboy...\r\n"] [exit 0]] [if [== line "[cmd]\n"] [repl/cmd ctx] [repl/cmd/raw ctx line]]]]
05v #{
05v readline
05v repl/prompt
04i 0
04i 1
0Es line
0D
05v nil?
10s line
04i 1
0Bo 25
05v print
05v "See you space cowboy...\r\n"
04i 1
0D
05v exit
02i 0
04i 1
09o 4
24
0D
10s line
05v "[cmd]\n"
20
0Bo 16
05v repl/cmd
10s ctx
04i 1
09o 17
05v repl/cmd/raw
10s ctx
10s line
04i 2
01
}
17
0Es repl/readline
0D
23s repl
05v []
05v #@[source: [[while #t [try repl/exception-handler [repl/readline root-closure]]]]]
05v #{
02i 0
1B
1C
05v #t
0Bo 25
0D
10s repl/exception-handler
19o 14
05v repl/readline
10s root-closure
04i 1
16
09o -27
01
}
17
0Es repl
0D
23s repl/print-help
05v []
05v #@[source: [[println [cat [ansi-rainbow "Nujel"] " - A Lisp dialect for games.\n"]] [println [cat [ansi-green "Usage:"] " nujel [options] [command_string | file]"]] [println [cat "\nLow-level options - for work on the runtime itself"]] [println [cat "  " [ansi-yellow "v"] " - be verbose"]] [println [cat "\nHigh-level options - for working with/on Nujel code"]] [println [cat "  " [ansi-blue "x"] " - Run the expression following this argument directly"]] [println [cat "  " [ansi-blue "h"] " - Print this help screen"]] [println [cat "\nLong options - for working with/on Nujel code"]] [println [cat "  " [ansi-blue "no-color"] " - Disable ANSI color"]] [println [cat "  " [ansi-blue "color   "] " - Enable ANSI color"]]]]
05v #{
05v println
05v cat
05v ansi-rainbow
05v "Nujel"
04i 1
05v " - A Lisp dialect for games.\n"
04i 2
04i 1
0D
05v println
05v cat
05v ansi-green
05v "Usage:"
04i 1
05v " nujel [options] [command_string | file]"
04i 2
04i 1
0D
05v println
05v cat
05v "\nLow-level options - for work on the runtime itself"
04i 1
04i 1
0D
05v println
05v cat
05v "  "
05v ansi-yellow
05v "v"
04i 1
05v " - be verbose"
04i 3
04i 1
0D
05v println
05v cat
05v "\nHigh-level options - for working with/on Nujel code"
04i 1
04i 1
0D
05v println
05v cat
05v "  "
05v ansi-blue
05v "x"
04i 1
05v " - Run the expression following this argument directly"
04i 3
04i 1
0D
05v println
05v cat
05v "  "
05v ansi-blue
05v "h"
04i 1
05v " - Print this help screen"
04i 3
04i 1
0D
05v println
05v cat
05v "\nLong options - for working with/on Nujel code"
04i 1
04i 1
0D
05v println
05v cat
05v "  "
05v ansi-blue
05v "no-color"
04i 1
05v " - Disable ANSI color"
04i 3
04i 1
0D
05v println
05v cat
05v "  "
05v ansi-blue
05v "color   "
04i 1
05v " - Enable ANSI color"
04i 3
04i 1
01
}
17
0Es repl/print-help
0D
05v tree/set!
10s repl/option-map
23s h
23s anonymous
05v [option]
05v #@[source: [[repl/print-help] [set! repl/parse-args/run-repl #f]]]
05v #{
05v repl/print-help
04i 0
0D
05v #f
0Fs repl/parse-args/run-repl
01
}
17
04i 3
0D
05v tree/set!
10s repl/option-map
23s no-color
23s anonymous
05v [option]
05v #@[source: [[set! ansi/disabled ""]]]
05v #{
05v ""
0Fs ansi/disabled
01
}
17
04i 3
0D
05v tree/set!
10s repl/option-map
23s color
23s anonymous
05v [option]
05v #@[source: [[set! ansi/disabled #f]]]
05v #{
05v #f
0Fs ansi/disabled
01
}
17
04i 3
0D
05v tree/set!
10s repl/option-map
23s x
23s anonymous
05v [option]
05v #@[source: [[set! repl/parse-args/eval-next #t] [set! repl/parse-args/run-repl #f]]]
05v #{
05v #t
0Fs repl/parse-args/eval-next
0D
05v #f
0Fs repl/parse-args/run-repl
01
}
17
04i 3
0D
05v tree/set!
10s repl/option-map
05v :default
23s anonymous
05v [option]
05v #@[source: [[tree/set! repl/options option #t]]]
05v #{
05v tree/set!
10s repl/options
10s option
05v #t
04i 3
01
}
17
04i 3
0D
23s repl/parse-option
05v [option]
05v #@[source: [[[or [ref repl/option-map option] [ref repl/option-map :default]] option]]]
05v #{
05v ref
10s repl/option-map
10s option
04i 2
0C
0Ao 27
0D
05v ref
10s repl/option-map
05v :default
04i 2
0C
0Ao 8
0D
05v #f
10s option
04i 1
01
}
17
0Es repl/parse-option
0D
23s repl/parse-options
05v [options]
05v #@[source: [[if [== [char-at options 0] 45] [repl/parse-option [string->keyword [cut options 1]]] [for-each [map [split options ""] str->sym] repl/parse-option]]]]
05v #{
05v char-at
10s options
02i 0
04i 2
02i 45
20
0Bo 36
05v repl/parse-option
05v symbol->keyword
05v str->sym
05v cut
10s options
02i 1
04i 2
04i 1
04i 1
04i 1
09o 37
05v for-each
05v map
05v split
10s options
05v ""
04i 2
10s str->sym
04i 2
10s repl/parse-option
04i 2
01
}
17
0Es repl/parse-options
0D
23s repl/parse-arg
05v [arg]
05v #@[source: [[cond [repl/parse-args/eval-next [try display/error [eval-in root-closure [cons do [read arg]]] [set! repl/parse-args/eval-next #f]]] [[== [char-at arg 0] 45] [repl/parse-options [string/cut arg 1]]] [#t [try display/error [file/eval arg]] [set! repl/parse-args/run-repl #f]]]]]
05v #{
10s repl/parse-args/eval-next
0Bo 48
10s display/error
19o 38
05v eval-in
10s root-closure
10s do
05v read
10s arg
04i 1
14
04i 2
0D
05v #f
0Fs repl/parse-args/eval-next
16
09o 80
05v char-at
10s arg
02i 0
04i 2
02i 45
20
0Bo 24
05v repl/parse-options
05v string/cut
10s arg
02i 1
04i 2
04i 1
09o 41
05v #t
0Bo 33
10s display/error
19o 14
05v file/eval
10s arg
04i 1
16
0D
05v #f
0Fs repl/parse-args/run-repl
09o 4
24
01
}
17
0Es repl/parse-arg
0D
23s repl/parse-args
05v [args]
05v #@[source: [[if args [do [repl/parse-arg [car args]] [repl/parse-args [cdr args]]] repl/parse-args/run-repl]]]
05v #{
10s args
0Bo 29
05v repl/parse-arg
10s args
11
04i 1
0D
05v repl/parse-args
10s args
12
04i 1
09o 7
10s repl/parse-args/run-repl
01
}
17
0Es repl/parse-args
0D
23s repl/init/wasm
05v [args]
05v #@[source: [[println [cat [ansi-rainbow "Nujel"] " heißt euch willkommen!"]]]]
05v #{
05v println
05v cat
05v ansi-rainbow
05v "Nujel"
04i 1
05v " heißt euch willkommen!"
04i 2
04i 1
01
}
17
0Es repl/init/wasm
0D
23s repl/init/bin
05v [args]
05v #@[source: [[try repl/exception-handler [set! repl/executable-name [car args]] [when [repl/parse-args [cdr args]] [repl]]]]]
05v #{
10s repl/exception-handler
19o 38
10s args
11
0Fs repl/executable-name
0D
05v repl/parse-args
10s args
12
04i 1
0Bo 12
05v repl
04i 0
09o 4
24
16
01
}
17
0Es repl/init/bin
0D
23s repl/init
23s args
05v #@[source: [[if [== System/Architecture 'wasm] [repl/init/wasm args] [repl/init/bin args]]]]
05v #{
10s System/Architecture
23s wasm
20
0Bo 16
05v repl/init/wasm
10s args
04i 1
09o 13
05v repl/init/bin
10s args
04i 1
01
}
17
0Es repl/init
01
}