Skip to content

Commit 44ad701

Browse files
committed
FIX: providing DUMP-OBJ function again as it is used not just in the help's context
1 parent 9daa545 commit 44ad701

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/mezz/mezz-help.r

+12-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import module [
1515
Title: "Help related functions"
1616
Name: Help
1717
Version: 3.0.0
18-
Exports: [? help about usage what license source]
18+
Exports: [? help about usage what license source dump-obj]
1919
][
2020
buffer: none
2121
max-desc-width: 45
@@ -119,15 +119,15 @@ import module [
119119
val
120120
]
121121

122-
out-form-obj: func [
123-
"Returns a block of information about an object or port"
122+
dump-obj: func [
123+
"Returns a string with information about an object value"
124124
obj [any-object!]
125125
/weak "Provides sorting and does not displays unset values"
126126
/match "Include only those that match a string or datatype"
127127
pattern
128-
/local start wild type str
128+
/local start wild type str result
129129
][
130-
start: buffer
130+
result: make string! 250
131131
; Search for matching strings:
132132
wild: all [string? pattern find pattern "*"]
133133
foreach [word val] obj [
@@ -156,14 +156,13 @@ import module [
156156
str: join "^[[1;32m" form-pad word 15
157157
append str "^[[m "
158158
append str form-pad type 11 - min 0 ((length? str) - 15)
159-
output [" " str "^[[32m" form-val :val "^[[m^/"]
159+
append result ajoin [" " str "^[[32m" form-val :val "^[[m^/"]
160160
]
161161
]
162162
]
163-
if all [pattern buffer = start] [
164-
buffer: insert buffer reduce ["No information on: ^[[32m" pattern "^[[m^/"]
165-
]
166-
buffer
163+
either all [pattern empty? result] [
164+
ajoin ["No information on: ^[[32m" pattern "^[[m^/"]
165+
][ result ]
167166
]
168167

169168
out-description: func [des [block!]][
@@ -198,12 +197,12 @@ import module [
198197
][ word: mold :word ] ;or use it as a string input
199198
]
200199
string? :word [
201-
out-form-obj/weak/match system/contexts/lib :word
200+
output dump-obj/weak/match system/contexts/lib :word
202201
throw true
203202
]
204203
datatype? :value [
205204
output ajoin ["^[[1;32m" uppercase mold :word "^[[m is a datatype of value: ^[[32m" mold :value "^[[m^/"]
206-
out-form-obj/match system/contexts/lib :word
205+
output dump-obj/match system/contexts/lib :word
207206
throw true
208207
]
209208
not any [word? :word path? :word] [
@@ -298,7 +297,7 @@ import module [
298297
]
299298
'else [
300299
output ajoin ["^[[1;32m" uppercase mold word "^[[m is " form-type :value " of value: ^[[32m"]
301-
either any [any-object? value] [output lf out-form-obj :value] [output mold :value]
300+
output either any [any-object? value] [dump-obj :value][mold :value]
302301
output "^[[m"
303302
]
304303
]

0 commit comments

Comments
 (0)