@@ -47,6 +47,10 @@ import module [
47
47
? function!
48
48
? datatype!
49
49
^[ [m
50
+ ^[ [4;1;36mTo see all available codecs^[ [m:
51
+ ^[ [1;32m
52
+ ? codecs
53
+ ^[ [m
50
54
^[ [4;1;36mOther debug functions^[ [m:
51
55
52
56
^[ [1;32m??^[ [m - display a variable and its value
@@ -197,6 +201,16 @@ import module [
197
201
word? :word [
198
202
either value? :word [
199
203
value: get :word ;lookup for word's value if any
204
+ if :word = 'codecs [
205
+ list-codecs :word
206
+ if same? :value system/codecs [throw true]
207
+ output lf
208
+ if any-function? :value [
209
+ ; don't display help in case that user redefined `codecs` with a function
210
+ output ajoin ["^[ [1;32m" uppercase mold word "^[ [m is " form-type :value ".^[ [m" ]
211
+ throw true
212
+ ]
213
+ ]
200
214
][ word: mold :word ] ;or use it as a string input
201
215
]
202
216
string? :word [
@@ -364,6 +378,48 @@ import module [
364
378
either into [buffer][print head buffer]
365
379
]
366
380
381
+ list-codecs : function [] [
382
+ names: sort keys-of codecs: system/codecs
383
+ foreach type common-types: [
384
+ time
385
+ text
386
+ cryptography
387
+ compression
388
+ sound
389
+ image
390
+ other
391
+ ][
392
+ tmp: clear []
393
+ foreach name names [
394
+ codec: codecs/: name
395
+ if any [
396
+ type = codec/type
397
+ all [type = 'other not find common-types codec/type ]
398
+ ][
399
+ append tmp codec
400
+ ]
401
+ ]
402
+ if empty? tmp [continue]
403
+
404
+ output ajoin [{^[ [4;1;36m} uppercase form type { CODECS^[ [m:} ]
405
+ foreach codec tmp [
406
+ output ajoin ["^/ ^[ [4;1;33m" uppercase form codec/name "^[ [m^/ ^[ [1;32m" codec/title ]
407
+ if all [tmp: select codec 'suffixes not empty? tmp] [
408
+ output ajoin ["^[ [m^/ Suffixes: ^[ [31m" codec/suffixes ]
409
+ ]
410
+ tmp: exclude keys-of codec [name type title entry suffixes]
411
+ unless empty? tmp [
412
+ output ajoin ["^[ [m^/ Includes: ^[ [35m" tmp]
413
+ ]
414
+ output lf
415
+ ]
416
+ output "^[ [m^/^/ "
417
+ ]
418
+ output ajoin [
419
+ "^[ [1mTIP:^[ [m use for example ^[ [1;32mhelp system/codecs/" codec/name "^[ [m to see more info.^/ "
420
+ ]
421
+ ]
422
+
367
423
about : func [
368
424
"Information about REBOL"
369
425
] [
0 commit comments