1. Need Help to make Orac Linux-compatible
- Posted by Mike <vulcan at ?in.co?nz> Nov 05, 2007
- 698 views
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. Mike
2. Re: Need Help to make Orac Linux-compatible
- Posted by Matt Lewis <matthewwalkerlewis at gm?il.?om> Nov 05, 2007
- 686 views
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
3. Re: Need Help to make Orac Linux-compatible
- Posted by Mike <vulcan at win.c??nz> Nov 06, 2007
- 696 views
Matt Lewis wrote: > > 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: > }}} <eucode> > 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 > </eucode> {{{ > > Matt Thanks for the info. I feel better about maybe trying to do this myself. Mike