improved native run-resource
parent
5b24e99fc9
commit
87331addba
|
@ -1,7 +1,6 @@
|
||||||
- input style after clicking link
|
- input style after clicking link
|
||||||
- fedit broken with listener
|
- fedit broken with listener
|
||||||
- maple-like: press enter at old commands to evaluate there
|
- maple-like: press enter at old commands to evaluate there
|
||||||
- fix up native file/line info
|
|
||||||
- standalone listener input style
|
- standalone listener input style
|
||||||
- add a socket timeout
|
- add a socket timeout
|
||||||
- drop test in http server
|
- drop test in http server
|
||||||
|
@ -45,6 +44,7 @@
|
||||||
|
|
||||||
+ native:
|
+ native:
|
||||||
|
|
||||||
|
- accept multi-line input in listener
|
||||||
- gc call in the middle of some ops might affect callstack
|
- gc call in the middle of some ops might affect callstack
|
||||||
- multitasking
|
- multitasking
|
||||||
- better error reporting
|
- better error reporting
|
||||||
|
|
|
@ -68,10 +68,10 @@ USE: words
|
||||||
|
|
||||||
: jedit ( word -- )
|
: jedit ( word -- )
|
||||||
intern dup [
|
intern dup [
|
||||||
word-line/file 2dup and [
|
word-line/file dup [
|
||||||
jedit-line/file
|
jedit-line/file
|
||||||
] [
|
] [
|
||||||
"Unknown source" print
|
3drop "Unknown source" print
|
||||||
] ifte
|
] ifte
|
||||||
] [
|
] [
|
||||||
"Not defined" print
|
"Not defined" print
|
||||||
|
|
|
@ -66,32 +66,49 @@ USE: strings
|
||||||
"file-in" get "in" set
|
"file-in" get "in" set
|
||||||
"file-use" get "use" set ;
|
"file-use" get "use" set ;
|
||||||
|
|
||||||
: parse-stream ( name stream -- code )
|
: (parse-stream) ( name stream -- quot )
|
||||||
#! Uses the current namespace for temporary variables.
|
#! Uses the current namespace for temporary variables.
|
||||||
>r "file" set f r>
|
>r "file" set f r>
|
||||||
[ (parse) ] read-lines nreverse
|
[ (parse) ] read-lines nreverse
|
||||||
"file" off
|
"file" off
|
||||||
"line-number" off ;
|
"line-number" off ;
|
||||||
|
|
||||||
: parse-file ( file -- code )
|
: parse-stream ( name stream -- quot )
|
||||||
dup <filecr> parse-stream ;
|
[
|
||||||
|
10 "base" set
|
||||||
|
file-vocabs
|
||||||
|
(parse-stream)
|
||||||
|
] with-scope ;
|
||||||
|
|
||||||
: (run-file) ( file -- )
|
: parse-file ( file -- quot )
|
||||||
#! Run a file. The file is read with the same IN:/USE: as
|
dup <filecr> parse-stream ;
|
||||||
#! the current interactive interpreter.
|
|
||||||
parse-file call ;
|
|
||||||
|
|
||||||
: run-file ( file -- )
|
: run-file ( file -- )
|
||||||
#! Run a file. The file is read with the default IN:/USE:
|
#! Run a file. The file is read with the default IN:/USE:
|
||||||
#! for files.
|
#! for files.
|
||||||
[
|
parse-file call ;
|
||||||
10 "base" set
|
|
||||||
file-vocabs
|
: (parse-file) ( file -- quot )
|
||||||
parse-file
|
dup <filecr> (parse-stream) ;
|
||||||
] with-scope call ;
|
|
||||||
|
: (run-file) ( file -- )
|
||||||
|
#! Run a file. The file is read with the same IN:/USE: as
|
||||||
|
#! the current interactive interpreter.
|
||||||
|
(parse-file) call ;
|
||||||
|
|
||||||
: resource-path ( -- path )
|
: resource-path ( -- path )
|
||||||
"resource-path" get [ "." ] unless* ;
|
"resource-path" get [ "." ] unless* ;
|
||||||
|
|
||||||
|
: parse-resource ( path -- quot )
|
||||||
|
#! Resources are loaded from the resource-path variable, or
|
||||||
|
#! the current directory if it is not set. Words defined in
|
||||||
|
#! resources have a definition source path starting with
|
||||||
|
#! resource:. This allows words that operate on source
|
||||||
|
#! files, like "jedit", to use a different resource path
|
||||||
|
#! at run time than was used at parse time.
|
||||||
|
"resource:" over cat2
|
||||||
|
swap resource-path swap cat2 <filecr>
|
||||||
|
parse-stream ;
|
||||||
|
|
||||||
: run-resource ( file -- )
|
: run-resource ( file -- )
|
||||||
resource-path swap cat2 run-file ;
|
parse-resource call ;
|
||||||
|
|
Loading…
Reference in New Issue