Norman:

> When loading or reading a file I would like to know ALL
>  the functions, blocks, etc..that where actived while loading the
>  file. There is no such command like "source loaded-script"
>  (Im now always using [ loaded: read %example.r ]) but thats a too
>  workaround..

I'm no guru here, but here's a solution that works if your functions are 
_not_ defined inside objects. The idea is:

1. capture current System/words
2. Load the script(s)
3. Examine new words added to system/words. Those of type Function! are what 
you are after.

Sample code, including showing the object/function shortcoming:


;; Capture existing words

existing-words: copy first system/words

;; ---- run a script that does the following:

myfunc: func [] [print 1]
myobj: make object! [myobjfunc: func [] [print 2]]

;; Spot the new words

new-words: sort difference existing-words first system/words

foreach new-word new-words [
    print [new-word type? get to-word new-word]
    ]


I don't know an easy way to tell if a word has changed -- but if you are 
running an untrusted script, 'protect has got to be basic insurance.....I 
suppose you could make a block of all words which are functions, and their 
molded checksum. After loading the script, check again to see if they are 
still functions with the same checksum.

But protect _that_ block (or make it local) and all the words you need to 
check the checksums. Otherwise your checking could be subverted (My code 
above naively assumes that 'sort, 'difference, etc retain their expected 
meaning after running your script).

Sunanda.
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to