Hi :-)
it should get to the list as an attachement. Enjoy :-)
-pekr-
[EMAIL PROTECTED] wrote:
> Hello!
>
> Sorry to bother you with this question again but a few
> weeks ago someone explained how to list all system
> variables in Rebol.
>
> I recall there was a script doing this but I don't
> remember the name. Is it explained elsewhere?
>
> Best regards,
> Peter Carlsson
>
> ----------------------------------------------------------------
> Peter Carlsson Tel: +46 31 735 45 26
> Saab Ericsson Space AB Fax: +46 31 735 40 00
> S-405 15 G�teborg Email: [EMAIL PROTECTED]
> SWEDEN URL: http://www.space.se
> ----------------------------------------------------------------
REBOL [
Title: "System Object Browser"
Date: 3-Jun-1999
Author: "Bohdan Lechnowsky"
Purpose: {
To make browsing the system object safe and easy.
Also allows changes to be made.
}
]
align: function [
"Forms data into a specified number of columns with optional alignment"
data length /left /right /center] [len] [
if right [
return head copy/part
tail insert/dup head form data " " length
(length * -1)
]
if center [
data: head insert/dup head form data " " len: (length / 2)
data: head insert/dup tail data " " len
return copy/part at data ((length? data) / 2 - len + 1) length
]
return copy/part head insert/dup tail form data " " length length
]
parent-item: func [path] [
either find path "/" [
path: tail path
while [not find/part path "/" 1] [
path: back path
]
return head clear path
][
print "^/ERROR: You are already at the top of the system object"
return path
]
]
protocol-menu: func [path] [
if not object? path [
display path
return none
]
if current-path = "system/words" [
print "^/ERROR: Accessing system/words will lead to an endless recursive loop"
return none
]
protocols: remove copy first path
print [newline "===" current-path "==="]
if current-path <> "system" [print " 0 > PARENT"]
for index 1 (length? protocols) 1 [
prin [(align/right index 3) ">" (align pick protocols index 20)]
if not all [(current-path = "system") ((pick protocols index) = 'words)] [
if (not find value: mold pick (second path) (index + 1) "^/") [
prin align value 50
if (length? value) > 50 [prin " ..."]
]
]
prin newline
]
print " 99 > EXIT"
prin newline
while [error? try [choice: to-integer ask "->"]] [
print "ERROR: Please enter a number from the list above"
]
either error? try [field: pick protocols choice] [
current-path: parent-item current-path
return none
][
if choice = 99 [halt]
return field
]
]
display: func [path] [
print ["The value of" current-path "is" mold path newline]
choice: ask "Do you want to change this (y/n)? "
if choice = "y" [
value: load ask "What is the new value: "
do command: rejoin [current-path ": " mold value]
print [
newline "To make this change permanent, add the following"
"line to your %user.r file:" newline newline command newline
]
choice: ask "Do you want me to add this to your %user.r file (y/n)? "
if choice = "y" [
either exists? user: join system/options/home %user.r [
write/append user append command newline
print [newline "Made addition to" user]
][
either exists? %user.r [
write/append %user.r append command newline
print [newline "Made addition to" join what-dir %user.r]
][
print [newline "ERROR: Could not find %user.r or %../user.r"]
]
]
]
]
]
start: func [] [
current-path: "system"
while [true] [
if error? try [selection: protocol-menu do current-path][
print [newline "ERROR: Cannot view this item"]
selection: none
]
either found? selection [
current-path: rejoin [current-path "/" selection]
][
current-path: parent-item current-path
]
]
]
start