Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make null "falsey", can't assign null w/SET-WORD!/PATH! #816

Merged
merged 1 commit into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions make/make.r
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@ do %tools/common.r
do %tools/systems.r
file-base: make object! load %tools/file-base.r

; !!! Since %rebmake.r is a module,
; it presents a challenge for the "shim" code
; when it depends on a change.
; This needs to be addressed in a generic way,
; but that requires foundational work on modules.

append lib compose [
file-to-local-hack: (:file-to-local)
local-to-file-hack: (:local-to-file)
did-hack: (:did)
]
rebmake: import %tools/rebmake.r
; See notes on %rebmake.r for why it is not a module at this time, due to the
; need to have it inherit the shim behaviors of IF, CASE, FILE-TO-LOCAL, etc.
;
; rebmake: import %tools/rebmake.r
do %tools/rebmake.r

;;;; GLOBALS

Expand All @@ -38,7 +31,7 @@ user-config: make object! load make-dir/default-config.r
args: parse-args system/options/args
; now args are ordered and separated by bar:
; [NAME VALUE ... '| COMMAND ...]
either commands: find args '| [
either commands: try find args '| [
options: copy/part args commands
commands: next commands
] [options: args]
Expand Down Expand Up @@ -68,7 +61,7 @@ for-each [name value] options [
if not block? user-ext [
fail [
"Selected extensions must be a block, not"
(type-of user-ext)
(type of user-ext)
]
]
user-config/extensions: user-ext
Expand Down Expand Up @@ -341,10 +334,10 @@ targets: [
]
'vs2017
'visual-studio [
rebmake/visual-studio/generate/(all [system-config/os-name = 'Windows-x86 'x86]) %. solution
rebmake/visual-studio/generate/(try all [system-config/os-name = 'Windows-x86 'x86]) %. solution
]
'vs2015 [
rebmake/vs2015/generate/(all [system-config/os-name = 'Windows-x86 'x86]) %. solution
rebmake/vs2015/generate/(try all [system-config/os-name = 'Windows-x86 'x86]) %. solution
]
]
target-names: make block! 16
Expand Down Expand Up @@ -1310,11 +1303,11 @@ process-module: func [
]
true [
dump s
fail [type-of s "can't be a dependency of a module"]
fail [type of s "can't be a dependency of a module"]
]
]
]
libraries: all [
libraries: try all [
mod/libraries
map-each lib mod/libraries [
case [
Expand Down
15 changes: 7 additions & 8 deletions make/tools/common-emitter.r
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ cscape: function [
fail ["Invalid CSCAPE mode:" mode]
]
case [
any-upper and (not any-lower) [uppercase sub]
any-lower and (not any-upper) [lowercase sub]
all [any-upper | not any-lower] [uppercase sub]
all [any-lower | not any-upper] [lowercase sub]
]

; If the substitution started at a certain column, make any line
Expand Down Expand Up @@ -142,7 +142,7 @@ make-emitter: function [

stem: second split-path file

temporary: any [temporary | parse stem ["tmp-" to end]]
temporary: did any [temporary | parse stem ["tmp-" to end]]

is-c: parse stem [[thru ".c" | thru ".h" | thru ".inc"] end]

Expand All @@ -166,7 +166,7 @@ make-emitter: function [
:look [any-value! <...>]
data [text! char! <...>]
][
context: ()
context: _
firstlook: first look
if any [
lit-word? :firstlook
Expand All @@ -177,9 +177,9 @@ make-emitter: function [
]

data: take data
switch type-of data [
switch type of data [
text! [
adjoin buf-emit cscape/with data :context
adjoin buf-emit cscape/with data opt context
]
char! [
adjoin buf-emit data
Expand All @@ -196,7 +196,7 @@ make-emitter: function [
fail "WRITE-EMITTED needs NEWLINE as last character in buffer"
]

if tab-pos: find buf-emit tab [
if tab-pos: try find buf-emit tab [
probe skip tab-pos -100
fail "tab character passed to emit"
]
Expand Down Expand Up @@ -271,6 +271,5 @@ make-emitter: function [
]
e/emit newline
]

return e
]
4 changes: 2 additions & 2 deletions make/tools/common.r
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ to-c-name: function [
if empty? string [
fail [
"empty identifier produced by to-c-name for"
(mold value) "of type" (mold type-of value)
(mold value) "of type" (mold type of value)
]
]

Expand Down Expand Up @@ -326,7 +326,7 @@ parse-args: function [
name: _
value: args/1
case [
idx: find value #"=" [; name=value
idx: try find value #"=" [; name=value
name: to word! copy/part value (index-of idx) - 1
value: copy next idx
]
Expand Down
2 changes: 1 addition & 1 deletion make/tools/make-embedded-header.r
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ remove-macro: proc [
<local> pos-m inc eol
][
if not binary? macro [macro: to binary! macro]
pos-m: find inp macro
pos-m: try find inp macro
if pos-m [
inc: find/reverse pos-m to binary! "#define"
eol: find pos-m to binary! newline
Expand Down
2 changes: 1 addition & 1 deletion make/tools/make-headers.r
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ process-conditional: procedure [
;
if all [
find/match directive "#endif"
position: find/last tail-of emitter/buf-emit "#if"
position: try find/last tail-of emitter/buf-emit "#if"
][
rewrite-if-directives position
]
Expand Down
4 changes: 2 additions & 2 deletions make/tools/make-os-ext.r
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ count: func [s c /local n] [
if find ["()" "(void)"] s [return "()"]
output-buffer: copy "(a"
n: 1
while [s: find/tail s c][
while [s: try find/tail s c][
adjoin output-buffer [#"," #"a" + n]
n: n + 1
]
Expand All @@ -95,7 +95,7 @@ emit-proto: proc [
trim proto
not find proto "static"

pos.id: find proto "OS_"
pos.id: try find proto "OS_"

;-- !!! All functions *should* start with OS_, not just
;-- have OS_ somewhere in it! At time of writing, Atronix
Expand Down
2 changes: 1 addition & 1 deletion make/tools/make-zlib.r
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ disable-user-includes: procedure [
any space {include}
some space include-rule to end
] then [
if inline and (pos: find headers to file! name) [
if inline and (pos: try find headers to file! name) [
change/part line-iter (read/lines join-all [path-zlib name]) 1
take pos
] else [
Expand Down
6 changes: 3 additions & 3 deletions make/tools/parsing-tools.reb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ parsing-at: func [
/end {Drop the default tail check (allows evaluation at the tail).}
] [
use [result position][
block: compose/only [try (to group! block)]
block: compose/only [try (as group! block)]
if not end [
block: compose/deep [all [not tail? (word) (block)]]
block: compose/deep [try all [not tail? (word) (block)]]
]
block: compose/deep [result: either position: (block) [[:position]] [[end skip]]]
use compose [(word)] compose/deep [
[(to set-word! :word) (to group! block) result]
[(as set-word! :word) (as group! block) result]
]
]
]
Loading