RFC: require-files block in the Rebol header
[1/6] from: oliva::david::seznam::cz at: 4-Aug-2002 16:14
Hello rebol-list,
as I made first version of reb-reb-bot here comes one thing that
would be nice:
there is so many scripts (allmost all my scripts), that need other files (that are not
in the
indexes) so the BOT don't know, that he needs to download these
files as well (to be able run these scripts offline) so we need to
tell what files are required as well...
So I don't know like you, but in my future scripts I will add
'require-files with block of required files in the Rebol header so
for example:
Rebol [
title: "Script with image"
require-files: [
%some-image.gif ;or http://some.domain/img/some-image.gif
]
]
view layout [image %some-iamge.gif]
Any comments? Someone know better way?
[2/6] from: atruter:hih:au at: 5-Aug-2002 15:10
> Rebol [
> title: "Script with image"
> require-files: [
> %some-image.gif ;or http://some.domain/img/some-image.gif
> ]
> ]
In theory, a sound idea. In practice I often use files depending upon
certain user preferences / locale. eg. english.dic, vic-pcodes.dat. No
point obtaining 100 files if user choices will only lead to several being
used (some of my data files get quite large). Reminds me of the old static
vs dynamic linking debate (only get the resource when we need it . . . but
what happens when it isn't there, etc).
Having said all that, I think most of these issues are data related, for
code (ie. .r files) I think it is a workable scheme.
Regards,
Ashley
[3/6] from: petr:krenzelok:trz:cz at: 5-Aug-2002 7:31
[atruter--hih--com--au] wrote:
>> Rebol [
>> title: "Script with image"
<<quoted lines omitted: 12>>
>Having said all that, I think most of these issues are data related, for
>code (ie. .r files) I think it is a workable scheme.
IIRC, RT tried to do something in that way already. The field is called
'Needs - maybe you will find some hilights about it in former docs or in
ml archive?
-pekr-
[4/6] from: al:bri:xtra at: 5-Aug-2002 18:04
RebOldes wrote:
> there is so many scripts (allmost all my scripts), that need other files
(that are not in the indexes) so the BOT don't know, that he needs to
download these files as well (to be able run these scripts offline) so we
need to tell what files are required as well...
I use this format for my Rebol/Values scripts:
Rebol [
Name: 'eText
Title: "eText"
File: %eText.r
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Web: http://valley.150m.com
Date: 17/July/2002
Version: 1.1.1
Purpose: {Processes plain text to HTML.}
Category: [util file text 5]
Needs: [
%"Common Parse Values.r"
%ML.r
]
]
Basically, just implementing the 'Needs header as was mentioned by Car,
IIRC, some time ago.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[5/6] from: al:bri:xtra at: 5-Aug-2002 18:07
pekr wrote:
> IIRC, RT tried to do something in that way already. The field is called
'Needs - maybe you will find some hilights about it in former docs or in ml
archive?
I remember the same. And I implemented it. Here's my %Values.r script which
loads all scripts in my %Values/ directory, and observes the 'Needs field's
requirements.
Values: make object! [
Problem: none
Files: make block! 100
use [Do-File Patches] [
Do-File: function [File [file!]] [Loaded Needs] [
File: clean-path File
if not found? find Files File [
Loaded: load/header File
Needs: Loaded/1/Needs
if all [
found? Needs
block? Needs
] [
foreach Need Needs [
if file? Need [
Do-File Need
]
]
]
Problem: File
do File ; Deliberately done to get Rebol to print
Script:
etc from 'do.
append Files File
Problem: none
]
]
append Files clean-path Rebol/Script/Header/File
Patches: %Patches.r
if exists? Patches [
Do-File Patches
]
foreach File read %. [
if find/last File %.r [
Do-File File
]
]
]
]
protect-system
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[6/6] from: brett:codeconscious at: 5-Aug-2002 17:38
Hi Andrew,
> I use this format for my Rebol/Values scripts:
...
> Needs: [
> %"Common Parse Values.r"
<<quoted lines omitted: 3>>
> Basically, just implementing the 'Needs header as was mentioned by Car,
> IIRC, some time ago.
REBOL checks the Needs header but I don't know what all the allowable
formats are. I do know you can get it to check the product and version at
least, but it does not seem to check files.
For example, try using Core to DO a file that contains this:
REBOL [ Needs: [view] ]
print "hello"
This
Needs: [core 2.5.3]
and this
Needs: 2.5.3
also work.
They seem to be minimum requirements, but I reckon it could be useful to be
able to specify a maximum version too.
Regards,
Brett.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted