[REBOL] Command Line Args Re:(5)

2000-03-13 Thread giesse

[EMAIL PROTECTED] wrote:

 Yes please.  In the case of 'simple things should be simple
 to do':
 
 probe system/options/args
  gets args
 
 probe system/options
  shows the options object
 
 probe system
  crashes rebol and requires me to use browse-system.r script???

This is not as strange as it seems. The system object contains
loops (such as system/words/system) and thus leads MOLD to an
infinite loop. Hopefully one day MOLD will detect such conditions
and avoid the crash...

HTH,
   Gabriele.



[REBOL] Command Line Args Re:(2)

2000-03-12 Thread bpaddock

system/script/args is only for arguments passed with DO/ARGS.
system/options/args is for arguments passed from the command
line.

I was going by what was in section 
http://www.rebol.com/users/operunning.html of Core User Guide
2.2.0.

system/options/ does not appear any place in that document
that I saw.

Doing a 'probe system' to see what might be in the system
object causes my Rebol, under Windoze95, to lock up.
Not a good thing.



[REBOL] Command Line Args Re:(3)

2000-03-12 Thread bpaddock

In article 02f401bf8a53$e4b74d40$7ac036d2@pavilion, you wrote:
It may help to write a little test program, like this:

Here is what I want to do:
From a DOS batch file that looks like this
rebol -sqw trim.r %1 %2

I want to run my script that trims the white space and
detabs the input file.  The input file would be %1 the
output file will be %2.

I did get the command line thing to work now, not sure how or
why tho.  Maybe some thing else was wrong in Windoze95 that
day?

Is there a simpler way to read/load/write from a file name
that is in a variable that what I'm doing here?:

---
REBOL [
Title: "trim and detab file"
Date: "Fri Mar 10 13:50:06 2000:"
]

; Manual says to use system/script/args
; [EMAIL PROTECTED] says to use system/options/args
; seems to work the same under Windoze95 either way:

;args: parse system/script/args none
args: parse system/options/args none
file_name_in:   first  args
file_name_out:  second args

read_file:join "read ^(25)"file_name_in
print read_file ; for debugging

write_file: rejoin ["write ^(25)"file_name_out" data"]
print write_file ; for debugging

data: do read_file
detab data
trim data
do write_file
---

It does what I want but only as long is every thing is the
same directory.

I want to be able to run my trim.bat file from any place and
have it located in N:\UTL\ which is in my DOS Path.

If I put rebol.exe and trim.r in N:\UTL\, while I'm trying
to run from N:\C\ and my batch file reads, which is also
located in N:\UTL\:

N:\UTL\rebol -sqw N:\UTL\trim.r %1 %2

If I do "trim 00410/textfile.in 00410/textfile.out", while
located in C:\N\ (00410 is below me, ie. N:\C\00410).

I get "Access Error: cannot open /N/UTL/00410/textfile.in".  Of
course it can't because that file is not there.  Whats with
this behavior and how do I fix it?

Printing out the strings read_file and write_file show me
what I expect to see "read %00410/file.in" and
"write %00410/file.out data".



[REBOL] Command Line Args Re:(3)

2000-03-12 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

 system/script/args is only for arguments passed with DO/ARGS.
 system/options/args is for arguments passed from the command
 line.

 I was going by what was in section
 http://www.rebol.com/users/operunning.html of Core User Guide
 2.2.0.

 system/options/ does not appear any place in that document
 that I saw.

 Doing a 'probe system' to see what might be in the system
 object causes my Rebol, under Windoze95, to lock up.
 Not a good thing.

I just returned back, so I don't know exactly what is the discussion all
about, but if you are looking for command line options, try:

- usage

If you want to see the structure of system object, use Bo's
%browse-system.r script  If you don't have it, I can send you a copy
...

-pekr-



[REBOL] Command Line Args Re:(4)

2000-03-12 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

 In article 02f401bf8a53$e4b74d40$7ac036d2@pavilion, you wrote:
 It may help to write a little test program, like this:

 Here is what I want to do:
 From a DOS batch file that looks like this
 rebol -sqw trim.r %1 %2

As for .bat files, - they are synchronous while you don't attempt to run
windows app. I use following aproach:

money.bat content:

start /w rebol -qws money.r
another-win-app.exe


This way you will achieve another-win-app.exe will not be run untill
Rebol session is finished. Just a tip for the case you would be
interested ...

btw: %1 and %2 are substituted with real filenames at the command line,
right?

 I want to run my script that trims the white space and
 detabs the input file.  The input file would be %1 the
 output file will be %2.

 I did get the command line thing to work now, not sure how or
 why tho.  Maybe some thing else was wrong in Windoze95 that
 day?

 Is there a simpler way to read/load/write from a file name
 that is in a variable that what I'm doing here?:

 ---
 REBOL [
 Title: "trim and detab file"
 Date: "Fri Mar 10 13:50:06 2000:"
 ]

 ; Manual says to use system/script/args
 ; [EMAIL PROTECTED] says to use system/options/args
 ; seems to work the same under Windoze95 either way:

 ;args: parse system/script/args none
 args: parse system/options/args none
 file_name_in:   first  args
 file_name_out:  second args

 read_file:join "read ^(25)"file_name_in
 print read_file ; for debugging


uf, what's that? :-)

 write_file: rejoin ["write ^(25)"file_name_out" data"]
 print write_file ; for debugging

 data: do read_file

data: read to-file first args

; above one line should be enough.
; "first args" returns string containing file name
; "to-file" converts that string to file! datatype
; "read" just reads the file :-)
; "data" should contain what you wanted it to contain
; remember - with REBOL - simple things are often simple to do :-)

 detab data
 trim data
 do write_file

write to-file second args data


 ---

 It does what I want but only as long is every thing is the
 same directory.


yeah, the directory change stuff :-)

 I want to be able to run my trim.bat file from any place and
 have it located in N:\UTL\ which is in my DOS Path.


aha, now %1 and %2 makes more sense - you want to send params to .bat
file?

 If I put rebol.exe and trim.r in N:\UTL\, while I'm trying
 to run from N:\C\ and my batch file reads, which is also
 located in N:\UTL\:

 N:\UTL\rebol -sqw N:\UTL\trim.r %1 %2

 If I do "trim 00410/textfile.in 00410/textfile.out", while
 located in C:\N\ (00410 is below me, ie. N:\C\00410).

 I get "Access Error: cannot open /N/UTL/00410/textfile.in".  Of
 course it can't because that file is not there.  Whats with
 this behavior and how do I fix it?


hmm, you have two options. You can change directory inside your .bat
file, or not? Typical DOS stuff: CD mydir
or you can change directory in REBOL script:

change-dir mydir

If you want to see where is REBOL operating by default at the time when
your script is run, place what-dir in the beginning of your script. Of
course run your REBOL session without -w parameter to see the output :-)

Hope this helps,

-pekr-

 Printing out the strings read_file and write_file show me
 what I expect to see "read %00410/file.in" and
 "write %00410/file.out data".



[REBOL] Command Line Args Re:(4)

2000-03-12 Thread bpaddock


I just returned back, so I don't know exactly what is the discussion all
about, but if you are looking for command line options, try:

You just missed the fact that the rebol.exe has never read
the rebol.doc file, specifically
http://www.rebol.com/users/operunning.html , where it says
use 'system/script/args/', when what it should really be is
'system/options/args'.  I'll send in a official feedback.r
bug report so hopefully it will get fixed.


If you want to see the structure of system object, use Bo's
%browse-system.r script  If you don't have it, I can send you a copy
...

Yes please.  In the case of 'simple things should be simple
to do':

probe system/options/args
 gets args

probe system/options
 shows the options object

probe system
 crashes rebol and requires me to use browse-system.r script???



[REBOL] Command Line Args Re:(5)

2000-03-12 Thread bpaddock


btw: %1 and %2 are substituted with real filenames at the command line,
right?

Right.

 data: do read_file

data: read to-file first args

; above one line should be enough.

It would have been if I'd seen 'to-file' in the manual, I missed
it in there.  http://www.rebol.com/users/valfile.html  Time
to read it again I guess.

hmm, you have two options. You can change directory inside your .bat
file, or not? Typical DOS stuff: CD mydir

That assumes I know what directory I'm in, and know how to
return to it when I leave it.  I wonder if some thing like
SET HERE=CD would work?  Probably not.

or you can change directory in REBOL script:
change-dir mydir

Probably the better thing to do, if I can figure out where
the trim.bat was run from.

your script is run, place what-dir in the beginning of your script. Of
course run your REBOL session without -w parameter to see the output :-)
Hope this helps,

Yes, thank you.  Time for some more manual reading...



[REBOL] Command Line Args Re:(5)

2000-03-12 Thread Petr . Krenzelok


[EMAIL PROTECTED] wrote:

 If you want to see the structure of system object, use Bo's
 %browse-system.r script  If you don't have it, I can send you a copy
 ...

 Yes please.  In the case of 'simple things should be simple
 to do':

 probe system/options/args
  gets args

 probe system/options
  shows the options object

 probe system
  crashes rebol and requires me to use browse-system.r script???

IIRC, it has something to do with REBOL objects structure? In REBOL, even
functions consists of just two blocks:

probe first :append
probe second :append

while with objects:

obj: make object! [bla: "a"]

- probe first :obj
[self bla]
== [self bla]
- probe second :obj
[
make object! [
bla: "a"
] "a"]
== [
make object! [
bla: "a"
] "a"]
-

can you see 'self while probing first :obj? IIRC, REBOL object structure
changed during alpha-to-REBOL1.x days, as during the alpha REBOL stage,
reference to 'self was obtained by applying 'third to appropriate object.

I don't know why they changed it, but let's believe RT had reasons to do so,
while producing not so logical code, e.g.:

foreach word next first obj [print word]
foreach value next second obj [print word]

you have to skip one item, because of reference to 'self 

PS: sending browse-system.r in private email 

-pekr-




[REBOL] Command Line Args Re:(6)

2000-03-12 Thread bpaddock


I don't know why they changed it, but let's believe RT had reasons to do so,
while producing not so logical code, e.g.:

I assume that they did have good reason to change.  But
nothing that can be typed at the system console should crash
the system.  Doing 'probe system' or any thing similar,
should at least elicit at "you can't do that" with a
pointer to some documentation saying why it can't be done.

Looks like it locks up in some type of recursive loop...



[REBOL] Command Line Args Re:(5)

2000-03-12 Thread VoToNi

In einer eMail vom 12.03.00 15:33:15 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

 Yes please.  In the case of 'simple things should be simple
  to do':
  
  probe system/options/args
   gets args
  
  probe system/options
   shows the options object
  
  probe system
   crashes rebol and requires me to use browse-system.r script???
  
  
_never_ probe system/words ! never mold anything with circular lists !
mold cannot detect it and runs and runs..

%browse-system.r (@ rebol.org too) forbids the access fully.
with  [probe first system/words] you get a list of all used words in the 
system
(even undefined, 'abcdef will stay there nothing too).
[source what] says more.

Volker



[REBOL] Command Line Args Re:

2000-03-09 Thread cplp

Can some one please send me a example of how to deal with
command lind arguments please?

And can someone tell me how I do command line arguments with the Macintosh
version?

Bruce.





[REBOL] Command Line Args Re:

2000-03-09 Thread icimjs


I tested it on my machine (running Win95) and it worked as advertised, i.e.
the arguments were available under system/script/args as a string.

What did you expect would happen? Perhaps the problem is with trim.r?

At 09:04 PM 3/9/00 -0500, you wrote:
Can some one please send me a example of how to deal with
command lind arguments please?

I want to do some thing like this from the command line:

rebol -swq trim.r file.in file.out

Manual says I should see "file.in and file.out" at
system/script/args but I don't.

What am I doing wrong?




;- Elan  [: - )]



[REBOL] Command Line Args Re:(2)

2000-03-09 Thread icimjs

Hi Bo,

system/script/args is only for arguments passed with DO/ARGS.
system/options/args is for arguments passed from the command
line.

Interesting enough, under Win95 system/script/args did contain the command
line args!
Actually, they both worked!



;- Elan  [: - )]



[REBOL] Command Line Args Re:(2)

2000-03-09 Thread icimjs

Hi Bo,

system/script/args is only for arguments passed with DO/ARGS.
system/options/args is for arguments passed from the command
line.

Interesting enough, under Win95 system/script/args did contain the command
line args!
Actually, they both worked! They both contained the same arguments.



;- Elan  [: - )]



[REBOL] Command Line Args Re:(3)

2000-03-09 Thread Al . Bri

Bo wrote:
 system/script/args is only for arguments passed with DO/ARGS.
 system/options/args is for arguments passed from the command line.

Elan wrote:
 Interesting enough, under Win95 system/script/args did contain the command
line args!
 Actually, they both worked!

Bug in Windows version?
Or problem in documentation?

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



[REBOL] Command Line Args Re:(2)

2000-03-09 Thread Al . Bri

It may help to write a little test program, like this:

 write %trim.r {
{[
{rebol []
{write %text.txt mold system/script/args
{]
{}

and view the contents of %test.txt. Given the example of:
rebol -swq trim.r file1.in file2.out
I get:
"file1.in file2.out"
in %test.txt. Try it out for your self and see. Then your problem should
be obvious. If not, let's know about it.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 10 March 2000 6:26 PM
Subject: [REBOL] Command Line Args Re:



 I tested it on my machine (running Win95) and it worked as advertised,
i.e.
 the arguments were available under system/script/args as a string.

 What did you expect would happen? Perhaps the problem is with trim.r?

 At 09:04 PM 3/9/00 -0500, you wrote:
 Can some one please send me a example of how to deal with
 command lind arguments please?
 
 I want to do some thing like this from the command line:
 
 rebol -swq trim.r file.in file.out
 
 Manual says I should see "file.in and file.out" at
 system/script/args but I don't.
 
 What am I doing wrong?
 
 
 

 ;- Elan  [: - )]