98 lines
3.6 KiB
Plaintext
98 lines
3.6 KiB
Plaintext
obj
|
|
isxfs: "isxfs"
|
|
|
|
var
|
|
long filestuff[isxfs#SIZEOFFILESTUFF / 4]
|
|
|
|
pub Open( pFilename, mode )
|
|
return isxfs.Open( @filestuff, pFilename, mode )
|
|
|
|
pub Close
|
|
isxfs.Close( @filestuff )
|
|
|
|
pub Read( ptr, n )
|
|
return isxfs.Read( @filestuff, ptr, n )
|
|
|
|
pub Write( ptr, n )
|
|
return isxfs.Write( @filestuff, ptr, n )
|
|
|
|
pub Length
|
|
{{
|
|
Only valid for files opened for reading.
|
|
}}
|
|
return long[@filestuff]
|
|
|
|
pub Execute( mode )
|
|
isxfs.Execute( @filestuff, mode )
|
|
isxfs.Close( @filestuff ) ' we only get here if Execute fails for some reason.
|
|
|
|
pub ReadString( p, MAXLENGTH ) | ch
|
|
repeat MAXLENGTH + 1
|
|
ch := ReadByte
|
|
ifnot byte[p++] := ch
|
|
return
|
|
abort string("ReadString: string too long")
|
|
|
|
pub ReadStringUpperCase( p, MAXLENGTH ) | ch
|
|
repeat MAXLENGTH + 1
|
|
ch := ReadByte
|
|
if "a" =< ch and ch =< "z"
|
|
ch -= constant("a" - "A")
|
|
ifnot byte[p++] := ch
|
|
return
|
|
abort string("ReadStringUpperCase: string too long")
|
|
|
|
pub WriteString( p )
|
|
Write( p, strsize(p) + 1 )
|
|
|
|
pub ReadNumber | ch
|
|
repeat
|
|
ifnot ch := ReadByte
|
|
return
|
|
if ch < "0" or ch > "9"
|
|
abort string("ReadNumber: non-numeric character")
|
|
result := result * 10 + ch - "0"
|
|
|
|
pub ReadByte : ch
|
|
Read( @ch, 1 )
|
|
|
|
pub WriteByte( b )
|
|
Write( @b, 1 )
|
|
|
|
pub ReadWord
|
|
return ReadByte + (ReadByte << 8)
|
|
|
|
pub WriteWord( w )
|
|
Write( @w, 2 )
|
|
|
|
pub ReadLong
|
|
return ReadByte + (ReadByte << 8) + (ReadByte << 16) + (ReadByte << 24)
|
|
|
|
pub WriteLong( l )
|
|
Write( @l, 4 )
|
|
|
|
pub SkipBytes( n )
|
|
repeat while n => 32768
|
|
Read( $8000, 32768 )
|
|
n -= 32768
|
|
Read( $8000, n )
|
|
|
|
{{
|
|
Copyright (c) 2009 Michael Park
|
|
+------------------------------------------------------------------------------------------------------------------------------+
|
|
| TERMS OF USE: MIT License |
|
|
+------------------------------------------------------------------------------------------------------------------------------+
|
|
|Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation |
|
|
|files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, |
|
|
|modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software|
|
|
|is furnished to do so, subject to the following conditions: |
|
|
| |
|
|
|The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.|
|
|
| |
|
|
|THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
|
|
|WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
|
|COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
|
|
|ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
|
+------------------------------------------------------------------------------------------------------------------------------+
|
|
}}
|
|
|