[REBOL] Re: Building scripts
From: zokie:libero:it at: 21-Jan-2002 13:38
Hello Brett
On 20-Gen-02, Brett Handley wrote:
> I have done something similar too. Though I use the word "use-script"
> instead of "do". This way I can redefine use-script
> according to the context the script is running in.
Yes! I start with idea to write a command "smat-include", which is a complex
form of DO: to check, when online, if the script was changed then download
newest release.
> That's an interesting idea. I could already use "use-script" as my marker
> for script replacement.
Yes, we can define all marker we need :)
> Another interesting idea is that in the same replacement fashion,
> use-script could create a function definition that makes a Rugby call.
I'm sorry, but the only thing that I know about Rugby is that exists :)
> Where does your function definition live? [ in a block, in a script,
> in rugby ]
You must consider that I'm a newbie to Rebol's programming, my works are too
candind, so function definitions are alive in work session.
I attach a stripped script of mine:
REBOL [Title: "internet-Tools.r"]
do %string-Tools.r
net-db: [
[id "windows" job "gateway"]
[id "a1200t" job "connected"]
]
gateway?: func [machine]
[...]
get-ip: does
[...]
online?: does [...]
cgi-decoder: func [args [any-string!] "Starts at first argument word" /local
list equate value name val plus-to-space]
[...]
get-next-email-name: func [gnen-path [file!]]
[...]
prepare-simple-email: func [pse-recipients [block! email!] pse-subject
[string!] pse-body [string!] pse-path [file!]]
[...]
submit-emails: func [se-path [file!] se-org [string!] se-reply [string!
email!]]
[...]
check-mailbox: func [user [string!] pass [string!] server [url! string!]]
[...]
catch-emails: func [user [string!] pass [string!] server [url! string!]
ce-path [file!]]
[...]
old-catch-emails: func [user [string!] pass [string!] server [url! string!]
ce-path [file!]]
[...]
get-return-path: func [grp-data [string! block!]]
[...]
get-net: does [...]
> How do you find it? [Using a naming service, a consistent directory
> structure, etc.]
Pheraps, the best way should be scan files and collect everything before:
func, does, function, ...; re-scan full assembled script and mark all
un-used functions and then strip off them.
Regards
--
"Where did you get all those facts!?!"