[REBOL] String formatting

2000-03-14 Thread bregolin


The following is rather trivial... anyway:
what is the most convenient way of formatting strings in Rebol, let
say for producing suitable output,  la printf/sprintf in
C?
Thanks,
Mauro Bregolin


begin:vcard 
n:Bregolin;Mauro
tel;fax:+39 049 8073066
tel;work:+39 049 8073066
x-mozilla-html:TRUE
adr:;;
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard



[REBOL] Finding current dir? Re:(2)

2000-03-14 Thread bpaddock


If you want to use the directory of the bat file that launched the script
then technically it is the parent of the script.

You will find that path of that in system/script/parent/path

True, but if trim.bat and trim.r are both in the same
directory in the path, say N:\UTL, and I run from the
"current dir" say N:\C\410, don't I still get N:\UTL\ as the
path to the parent batch file, instead of the "current dir",
N:\C\410?



[REBOL] { in strings - workarounds? Re:

2000-03-14 Thread ingo

Hi Volker,

this problem has been found before, when trying to save
history to files, here's a history save function, that 
does it right ...

;
; History save and load by Christoph Mammitzsch
;
save-history: func [
   "Saves system/console/history to file."
   file [ file! ] "the file to save to"
   /local history line subst
][
   history: copy system/console/history
   forall history [
  line: mold first history
  if equal? first line #"{" [
 line: change line #"^""
forall line [
subst: select [
#"^""   "^^^""
#"^/"   "^^/"  
  ;There must be more. I'm sure I forgot something :)
] first line
if not none? subst [
remove line
line: back insert line subst
]
]
change back line #"^""
 line: head line
  ]
  change/only history line
   ]
   history: head history
   write file history
   exit
]

load-history: func [
   "Restores system/console/history from file."
   file [ file! ] "the file to load from"
   /local history
][
   system/console/history: load file
   exit
]


I hope this helps,

Ingo


Those were the words of [EMAIL PROTECTED]:
 my little email-database is crashed.
 Caused by some emails which contained
 unpaired "{".

--  _ ._
ingo@)|_ /|  _| _  We ARE all ONE   www._|_o _   _ ._ _  
www./_|_) |o(_|(/_  We ARE all FREE ingo@| |(_|o(_)| (_| 
http://www.2b1.de/Rebol/ ._|  ._|



[REBOL] Function without argument ... Re:

2000-03-14 Thread ingo

Hi Eric,

you could use this ...

Those were the words of [EMAIL PROTECTED]:
 Hi ! 
 
 Newbie question !!!
 
 Is it possible to test a lack of argument in a function ? 
 I try things like this but... it doesn't work !

unset!: do [type?]; this defines unset!

tst: func [
{help for tst...}
   x [integer! unset!]; allow unset! values
][ 
   if not value? 'x [ ; test if x has got a value, use '
  ; to get x litarally you'd get en error 
  ; with unset values otherwise
help tst 
exit  ; exit the function
   ]
   print x
]

if you want to use tst without args in a script, you have to
use it at the end of a paren! e.g. (tst) because tst will eat
up everything that follows

 tst
help for tst...
Arguments:
x --  (integer unset)
 tst 3
3
 (tst)
help for tst...
Arguments:
x --  (integer unset)
 tst "a"
** Script Error: tst expected x argument of type: integer unset.
** Where: tst "a"


regards,

Ingo

--  _ ._
ingo@)|_ /|  _| _  We ARE all ONE   www._|_o _   _ ._ _  
www./_|_) |o(_|(/_  We ARE all FREE ingo@| |(_|o(_)| (_| 
http://www.2b1.de/Rebol/ ._|  ._|



[REBOL] String formatting Re:

2000-03-14 Thread icimjs

There should be a rather complete solution called format.r located in the
user contribution archive at http://www.rebol.org

At 10:17 AM 3/14/00 +0100, you wrote:
  The following is rather trivial... anyway: 
what is the most convenient way of formatting strings in Rebol, let say for
producing suitable output, agrave; la printf/sprintf in C? Thanks, Mauro
Bregolin 
   Attachment Converted: "c:\eudora\attach\bregolin.vcf" 

;- Elan  [: - )]



[REBOL] Finding current dir? Re:(3)

2000-03-14 Thread VoToNi

system/script/parent/path
seems to be the current directory (maybe a bug ;-)
After this there is a rebol-script in %test/, another bat in %test2/ and
a bat in %test3/, which sets the paths to %test2/ and calls the bat there.
the path is set to %wherever/test3/, which is the current directory.
well, it would be more a problem to get the name of the starting bat in 
windows?
except as passing with %0.

secure ask; quick scripts may have quick bugs :-) this will give you 
trace-dialogs

print "the fundamental results:"
probe system/options/script
probe system/script/parent/path

print "making the test: script in test, bat-dir in test2"
error? try [make-dir %test/]
error? try [make-dir %test2/]
error? try [make-dir %test3/]
save %test/where.r [rebol[] probe system/options probe system/script  
print "script-path, script, start path (resp. of super-script)"
probe system/script/path
probe system/options/script
probe system/script/parent/path
make error! "hack to hold console. better way?"
]
write %test2/where-view.bat form ["echo %0^/" {"C:\Program 
Files\REBOL\View\rebol"} "..\test\where.r"]
write %test2/where-core.bat form [{"C:\rebol031\rebol"} "..\test\where.r"]
write %test3/where-path.bat form ["path ..\test2;%path%^/" "where-core"]
exit


In einer eMail vom 14.03.00 12:22:09 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

 Thema:[REBOL] Finding current dir? Re:(2)
 Datum: 14.03.00 12:22:09 (MEZ) Mitteleuropäische Zeit
 From:  [EMAIL PROTECTED]
 Reply-to:  [EMAIL PROTECTED]
 To:[EMAIL PROTECTED]
 
 
 If you want to use the directory of the bat file that launched the script
 then technically it is the parent of the script.
 
 You will find that path of that in system/script/parent/path
 
 True, but if trim.bat and trim.r are both in the same
 directory in the path, say N:\UTL, and I run from the
 "current dir" say N:\C\410, don't I still get N:\UTL\ as the
 path to the parent batch file, instead of the "current dir",
 N:\C\410?
 
  


Volker



[REBOL] official guide Re:

2000-03-14 Thread larry

Hi Ryan

The release date is listed as April 2000. You can read three chapters here:

http://www.pbg.mcgraw-hill.com/betabooks/feb00/goldman/index.html

HTH

Larry


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 14, 2000 9:12 AM
Subject: [REBOL] official guide


 Has anyone gotten their hands on the REBOL Official Guide yet?

 I ordered it through Barnes  Noble two weeks ago and they are having
 trouble getting a copy.

 I am wondering how it is written (i.e. what level of programming knowledge
is
 the reader expected to have?)

 Also, does the book cover parse pretty well?  And how about CGI?  Are
there
 a lot of useful scripts on the CD-ROM?

 Thanks.

 Ryan Christiansen
 Consultant
 SEI Information Technology




[REBOL] Closing conection in windows

2000-03-14 Thread JavierD

hi there, i have a little problem.

I made a script for downloading files for updating data automatically.

When i execute the script, windows dial automatically to conect
to internet, but how can i close the connection when
the scripts end?

I think i can send an order to the serial port to order the modem
to close the conection, but i don't know the order.. (or how to acces
the serial port..)


Atentamente, Javier Delgado
-- 
Paralax Multimedia S.A.   Mexico D.F.
http://www.paralax.com.mx

Produccisn de Video, Video3d, animacion 3d  kioskos
tel/fax 5373 36 20 , Calzada de las Armas16 Naucalpan
--
Personal  http://www.paralax.com.mx/Javier   
Kalimanhttp://www.kaliman.org.mx
icq :   40740225  JavierD



[REBOL] { in strings - workarounds? Re:(3)

2000-03-14 Thread VoToNi

In einer eMail vom 14.03.00 16:49:23 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

 Thanks for the rescue. will paste it. BTW, one missing thing is "^^"? :)
 
"^^"?? Hahaha, no, Your code is ok :-) 
I changed it a bit for my needs, see below. Thank you, database runs again :)
(Have not really testet the 'save-history yet, should be the right syntax)

Volker

;
; nearly History save and load by Christoph Mammitzsch
;
save-history: func[
   "Saves system/console/history to file."
   file [ file! ] "the file to save to"
][write file mold-string-series system/console/history]

mold-string-series: func [
   history [ series! ] "the series to save"
   /nocopy "trashs input, but saves memory. 2mb mails yet"
   /local line subst
][
   if not nocopy [history: copy history]
   forall history [
  line: mold first history
  if equal? first line #"{" [
 line: change line #"^""
forall line [
subst: select [
#"^""   "^^^""
#"^/"   "^^/"  
  ;There must be more. I'm sure I forgot something :)
] first line
if not none? subst [
remove line
line: back insert line subst
]
]
change back line #"^""
 line: head line
  ]
  change/only history line
   ]
   history: head history  
]

load-history: func [
   "Restores system/console/history from file."
   file [ file! ] "the file to load from"
   /local history
][
   system/console/history: load file
   exit
]


 In einer eMail vom 14.03.00 13:08:23 (MEZ) Mitteleuropäische Zeit schreibt 
 [EMAIL PROTECTED]:
 
  Hi Volker,
  
  this problem has been found before, when trying to save
  history to files, here's a history save function, that 
  does it right ...
  
  


Volker



[REBOL] [REBOL] Function without argument ... it works !

2000-03-14 Thread ebz

On 14 Mar 00, at 10:54, [EMAIL PROTECTED] wrote:

Hi Ingo !!!
Thanks a lot ! It works ;) ...
 
 unset!: do [type?]; this defines unset!
 
 tst: func [
 {help for tst...}
x [integer! unset!]; allow unset! values
 ][ 
if not value? 'x [ ; test if x has got a value, use '
 ; to get x litarally you'd get en error 
   ; with unset values otherwise
   help tst 
   exit  ; exit the function
]
print x
 ]
 
 if you want to use tst without args in a script, you have to
 use it at the end of a paren! e.g. (tst) because tst will eat
 up everything that follows
 
  tst
 help for tst...
 Arguments:
 x --  (integer unset)
  tst 3
 3
  (tst)
 help for tst...
 Arguments:
 x --  (integer unset)
  tst "a"
 ** Script Error: tst expected x argument of type: integer unset.
 ** Where: tst "a"
 
 
 regards,
 
 Ingo
 
 --  _ ._
 ingo@)|_ /|  _| _  We ARE all ONE   www._|_o _   _ ._ _  
 www./_|_) |o(_|(/_  We ARE all FREE ingo@| |(_|o(_)| (_| 
 http://www.2b1.de/Rebol/ ._|  ._|
 




[REBOL] web mail

2000-03-14 Thread tf

hey guys,

does anyone have a script I can *cough* borrow with which I can send
and receive web-based mail like Yahoo's or Xoom's?

The Rebol Offical Guide should be here next month?  I'm chomping at
the bit.  Nothing is like ink on real paper to read...  Think I'll
go order myself a copy tomorrow.


-Tom



[REBOL] Finding current dir? Re:

2000-03-14 Thread krobillard

I had a some difficulty myself with trying to get the current directory and
was convinced there was a bug in REBOL.

system/script/parent/path is the directory where rebol (or an auto-running
script) was invoked from the command line.

system/script/path is the directory what-dir returns and what change-dir
modifies. Note that this is used by clean-path to generate any relative
filenames.  I expected what-dir, change-dir, and clean-path to operate on the
invocation directory (system/script/parent/path).  This was an incorrect
assumption!

The trick seems to be calling 'change-dir system/script/parent/path' near the
start of the script to get 'normal' current directory behavior.
If there are associated scripts that live in the same directory as
the main script then do these before change-dir
(e.g. 'do join system/script/path %shared_data.r') or save system/script/path
for later use.

Below is the script I used to get a handle on what was happening.  I made two
copies, one in the current shell directory named 'local_data.r' and another
someplace else named 'shared_tool' (as if it were a tool living in some bin or
command directory somewhere).  Run 'rebol /path/to/shared_tool local_data.r', or
if you make it auto-executing then place it in your path and simply run
'shared_tool local_data.r'.

It just occured to me that perhaps REBOL is designed to be used primarily
inside of itself (using the interpreter as a shell and do-ing scripts from
inside it) rather than calling scripts from a host OS.


REBOL [
Purpose: {Test for understanding the REBOL path expressions.}
]
 
report-dir: func [] [
print [ "system/script/path:" system/script/path ]
print [ "system/script/parent/path:" system/script/parent/path ]
print [ "system/options/script:" system/options/script ]
print [ "what-dir:" what-dir ]
print [ "clean-path %bogusfile:" clean-path %bogusfile ]
print "^/"
]
 
report-dir
 
;print "change-dir system/script/parent/path^/["
;change-dir system/script/parent/path
;report-dir
;print "]^/"
 
print [ "system/script/args:" system/script/args ]
if string? system/script/args [
args: parse system/script/args none
forall args [
print rejoin [ "arg " index? args/1 ": " args/1 ]
print [ "clean-path" clean-path to-file args/1 "; -- INVALID" ]
 
script: join system/script/parent/path args/1
print [ "Running script" script "^/" ]
do script
]
]
 
quit 
;EOF


-Karl Robillard



[REBOL] Database Access

2000-03-14 Thread evz



Hi,

I've only come accross REBOL two days ago, and looking 
through the documentation I could only find reference to the simple flat file 
database fucntions. Is there any libraries or functions available for REBOL for 
access to RDBMS's like PostgreSQL, Interbase and also MySQL ?

Also, can anyone point me to a beginners tutorial ? I'm a 
C/C++ programmer, and just glancing at the documentation thus far it sort of 
makes sense and then again not :-).

Thanks,
Eugene van Zyl