-jeff

REBOL [
    Title:    "DOS-REBOL File Name Conversion Routines"
    File:     %dosbol.r
    Author:   "Terrence Brannon"
    Email:    [EMAIL PROTECTED]
    Purpose:  "Ease working with dos filename in REBOL programs"
    Category: 'file
]

dosbol: make object! [
    out:  make string! 100
    path-char: complement charset ":\/"

    rules: [ 
        copy char path-char ":" (out: rejoin [ "/" char ]) |
        "\" (append out "/")                               |
        copy char some path-char (append out char)
    ]
    d2r: func [
        dos-fn [string!] "takes a dos filename and converts to rebol format"
    ][
        parse dos-fn [ some rules ]
        out
    ]
]

dosbol/d2r "c:\temp\file"


== "/c/temp/file"

> Could someone please fix this? It hung my interpreter:
> 
> REBOL [
>      Title: "DOS-REBOL File  Name Conversion Routines" File:
>      %dosbol.r
>          Author:        "Terrence       Brannon"      Email:
>          [EMAIL PROTECTED] Purpose: "Ease working    with
>          dos filename in REBOL programs"
>      Category: 'file
> ]
> 
> dosbol: make object! [
>      char: make string! 0 out: make string! 0
>          drive-letter: charset [ #"A" - #"F" ]
> 
>      rules: [ copy char drive-letter  ":" (out: rejoin [ "/"
>      dl ]) |
>           "\" (append out "/") | copy char (append out char)
>          ]
>      d2r: func [
>       dos-fn [string!] "takes a dos filename and converts to
>       rebol format"] [
>        parse/all dos-fn [ any rules ]
>            out ]
> ]
> 
> >> dosbol/d2r "c:\temp\file"
> 
> terrence-brannon:      [[EMAIL PROTECTED]   perl-refugee
> myth-gamer]     free-email:      http://www.MailAndNews.com
> free-usenet: http://www.mailAndNews.com ;  all the above is
> real REBOL code, believe it or not.
> 
> 

Reply via email to