Re: Need Help to make Orac Linux-compatible

new topic     » goto parent     » topic index » view thread      » older message » newer message

Mike wrote:
> 
> Is there a Linux guru willing to make Orac Linux-compatible? I've never used
> Linux before so I don't think I'd be able to do a good job on my own ..
> 
> The 2 main areas are how to treat path characters and reading/writing lines
> of text.
> 
> Any help is appreciated.

These two areas are pretty straightforward.  For path characters, you have
two options:

 1.  Always use '/' since both Windows and Linux support them
 2.  Use '/' on Linux and '\\' on Windows.  Most programs define a constant
     or variable named slash or SLASH and assigned based upon the results
     of platform().

To deal with line endings, always assume that you may have both "\r\n" at
the end of a line.  I often define a function such as:
global function chomp( sequence line )
    while length( line ) and find( line[$], "\n\r" ) do
        line = line[1..$-1]
    end while
    return line
end function

procedure read_a_file( sequence file_name )
    integer fn
    object in
    fn = open( file_name, "r" )
    in = gets( file_name )
    while sequence( in ) do
        in = chomp( in )
        -- ... do stuff with the line
        in = gets( fn )
    end while
end procedure


Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu