My first contribution in a lonnnng while
[1/6] from: jeff:rebol at: 2-Mar-2001 7:35
Howdy, Anton:
> Someone said to watch out when using 'load because it puts
> words in the global context.
>
> I think you can just use 'read where you are using 'load in
> your script below, reading a directory:
>
> ain: read treein
LOAD and READ of a directory work the same way-- Also, LOAD
on a directory does not create any words. Both READ and
LOAD of a directory create a file port and do a COPY which
results in a block. For example:
here: open %.
files: copy here
== [%do.r %p-np.r %goofers.r]
close here
-jeff
[2/6] from: arolls:bigpond:au at: 3-Mar-2001 4:07
Jeff,
Ok, that's good about loading directories.
What about 'load/markup?
I was using it to parse web pages into tags and text strings
for me, then I started to worry that I might run out of words
one day, so I coded my own read-markup function.
Am I right to worry about that?
> > Someone said to watch out when using 'load because it puts
> > words in the global context.
<<quoted lines omitted: 11>>
> == [%do.r %p-np.r %goofers.r]
> close here
Anton.
[3/6] from: jeff:rebol at: 2-Mar-2001 9:28
Howdy, Anton:
> Ok, that's good about loading directories. What about
> 'load/markup? I was using it to parse web pages into tags
> and text strings for me, then I started to worry that I
> might run out of words one day, so I coded my own
> read-markup function. Am I right to worry about that?
LOAD/markup also does not create words. TAGS and STRINGs are
not words. :-)
Brings up an interesting question. If you are writing a
script which inspects a lot of other scripts, what you can
do is use LOAD/next/header instead of just LOAD.
LOAD/next/header %script.r will return a block with the
header object in the first spot and the rest of the script
as a string in the second position. This means only the
words in the header are added to system/words and most of
the time REBOL script headers have the same words so nothing
more is added. You can load/next/header tons of REBOL
scripts and inspect them with reasonable confidence that
words will not grow scarce. (In fact, since all of the
standard words of a header are already in the system object,
you won't likely add any words at all:
foreach word next first system/standard/script [
print [word found? find first system/words word]
]
(This is the present and future behavior of
LOAD/next/header, at least. Early versions, possibly 2.3,
may have returned something slightly different).
-jeff
[4/6] from: dwhiting:europa at: 2-Mar-2001 11:32
Hello Anton
On 01-Mar-01, Anton wrote:
> Someone said to watch out when using 'load
> because it puts words in the global context.
I think it's a habit left from my Rebol v1 days.
> I think you can just use 'read where you are
> using 'load in your script below, reading a
> directory:
> ain: read treein
Yep, works fine.
Have now read Jeff's comments, so will probably leave it as is.
>> Related to this, is it a known problem (or _my_ problem) that info? and
>> size? don't function properly for files on the Amiga using Rebol version
>> 2.4.40.1.1. but does work for directories?
> probe info? %afile
hmmm...looks like a case of user error. Tried size? & probe info? and it
works as expected, so I was probably feeding it wrong filenames yesterday.
I'm out of Rebol practice and frequently forget the first slash for files.
Thanks,
Dick
--
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
*Dick Whiting* <[dwhiting--europa--com]>
_http://www.europa.com/~dwhiting/_
/Satyre/ on Undernet #AmigaCafe#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
[5/6] from: dwhiting::europa::com at: 1-Mar-2001 13:59
Hi,
Attached is a short script that fills a need I had.
Related to this, is it a known problem (or _my_ problem) that info? and
size? don't function properly for files on the Amiga using Rebol version
2.4.40.1.1. but does work for directories?
HopeThisHelps,
Dick
--
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
*Dick Whiting* <[dwhiting--europa--com]>
_http://www.europa.com/~dwhiting/_
/Satyre/ on Undernet #AmigaCafe#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
-- Attached file included as plaintext by Listar --
-- File: bldmirror.r
REBOL [
Title: "Mirror a Directory Tree"
Author: "Dick Whiting"
Date: 01-Mar-2001
Purpose: {
I needed a way of identifying what files I had on my Amiga at home
while transferring data on a zip disk to/from a PC.
The directory tree at home is nearly 1G and the zip is 100M, so ...
Create a mirror directory tree with all files having 0 bytes.
}
Usage: {
set the directory paths for master and mirror (with ending slashes)
set verbose: true to see processing, false for quiet
set test: true to see the processing without actually doing anything
mirror directory will be created if necessary,
but higher levels should already exist.
}
]
verbose: true ; set to true to get print of activity
test: false ; set to true to not actually create mirror
master: %/pics/imagenetion/ ; top level master directory with actual files
mirror: %/t/imagenetion/ ; top level mirror directory for 0 byte files
if not exists? mirror [
if verbose [print ["DIRECTORY..." mirror]]
if not test [make-dir mirror]
]
bldmirror: func [treein [file!] treeout [file!] ] [
either dir? treein [
if not exists? treeout [
if verbose [print ["DIRECTORY..." treeout]]
if not test [make-dir treeout]
]
ain: load treein
foreach entry ain [
bldmirror join treein entry join treeout entry
]
] [
if not exists? treeout [
if verbose [print [" file..." treeout]]
if not test [write/binary treeout ""]
]
]
]
bldmirror master mirror
[6/6] from: arolls:bigpond:au at: 2-Mar-2001 15:17
Dick,
Someone said to watch out when using 'load
because it puts words in the global context.
I think you can just use 'read where you are
using 'load in your script below, reading a
directory:
ain: read treein
> Attached is a short script that fills a need I had.
>
> Related to this, is it a known problem (or _my_ problem) that info? and
> size? don't function properly for files on the Amiga using Rebol version
> 2.4.40.1.1. but does work for directories?
probe info? %afile
does what?
Anton.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted