home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d570
/
view.lha
/
View
/
ASCII.DOC
next >
Wrap
Text File
|
1991-11-21
|
12KB
|
451 lines
TABLE OF CONTENTS
ascii.s/BOpen
ascii.s/BClose
ascii.s/BIoErr
ascii.s/BGetC
ascii.s/BPutC
ascii.s/AllocAscii
ascii.s/FreeAscii
ascii.s/BGetS
ascii.s/BPutS
ascii.s/FirstOccurrence
ascii.s/NextOccurrence
ascii.s/PreviousOccurrence
ascii.s/FindFrom
ascii.s/BOpen ascii.s/BOpen
NAME
BOpen -- open a file for bufferd IO.
SYNOPSYS
file = BOpen( name, accesmode )
struct BuffIO *file;
char *name;
ULONG accessmode;
FUNCTION
To setup a "BuffIO" file handle and to open the file for you.
INPUTS
name - A pointer to a null terminated string which should be the
full AmigaDOS name of the file you want to open.
accessmode - The acces-mode of the file you want to open. Currently only
"MODE_OLDFILE" and "MODE_NEWFILE" are supported.
RESULT
file will be a pointer to the "BuffIO" file handle or null if something
went wrong.
BUGS
None known.
SEE ALSO
dos.library/Open()
ascii.s/BClose ascii.s/BClose
NAME
BClose -- close a "BuffIO" file handle.
SYNOPSYS
error = BClose( file )
LONG error;
struct BuffIO *file;
FUNCTION
To flush it's internal buffer and close the file. Then deallocate the
"BuffIO" file handle.
INPUTS
file - A pointer to the "BuffIO" file handle which you want to close.
RESULT
The return code needs only to be checked when the handle was used to
write to (MODE_NEWFILE). This is because this routines writes all data
left in the buffer to the file before it's closed.
BUGS
None known.
SEE ALSO
dos.library/Close()
ascii.s/BIoErr ascii.s/BIoErr
NAME
BIoErr -- determine the last error of the file.
SYNOPSYS
error = BIoErr( file )
LONG error;
struct BuffIO *file;
FUNCTION
To take the last error from the "BuffIO" file handle and return it to
you.
INPUTS
file - A pointer to the "BuffIO" file handle of which you want to know
it's error status.
RESULT
error will be one of the following values :
ASE_OK - everything OK
ASE_EOF - everything OK but at end-of-file.
ASE_NOMEM - out of memory
ASE_READ - read error
ASE_WRITE - write error
ASE_NOFILE - obsolete (will never happen!)
ASE_FILETYPE - tryed to write to MODE_OLDFILE or viceversa
BUGS
None known.
ascii.s/BGetC ascii.s/BGetC
NAME
BGetC -- get one byte from a "BuffIO" file handle.
SYNOPSYS
byte = BGetC( file )
LONG byte;
struct BuffIO *file;
FUNCTION
To get one byte from the "BuffIO" file handle. If there arn't any bytes
left in the buffer it will try to fill the buffer with data first.
INPUTS
file - A pointer to the "BuffIO" handle you want to get one byte from.
RESULT
byte should be the byte from the "BuffIO" handle (0-255). If the routine
returned ASE_EOF you should make a call to "BIoErr()" to check wether or
not there was an error.
BUGS
None known.
SEE ALSO
ascii.s/BIoErr()
ascii.s/BPutC ascii.s/BPutC
NAME
BPutC -- write one byte to a "BuffIO" file handle.
SYNOPSYS
error = BPutC( file, byte )
LONG error;
struct BuffIO *file;
ULONG byte;
FUNCTION
To put a byte in the "BuffIO" handle it's buffer. If the buffer was full
it first writes the data in the buffer to the file and then puts the
byte in the buffer.
INPUTS
file - A pointer to the "BuffIO" file handle to which you want to write
a byte.
byte - The byte (0-255) you want to write.
RESULT
Although most of the times "error" will read ASE_OK you should check the
return code once in a while to see if the writing of the buffer to the
file went OK.
BUGS
None known.
ascii.s/AllocAscii ascii.s/AllocAscii
NAME
AllocAscii -- allocate a "AsciiText" structure.
SYNOPSYS
ascii = AllocAscii( tabsize, maxchars, flags )
struct AsciiText *ascii;
ULONG tabsize;
ULONG maxchars;
ULONG flags;
FUNCTION
To allocate an "AsciiText" structure and to initialize it with your
preferred settings.
INPUTS
tabsize - The size of one tabstop.
maxchars - The maximum amount of characters allowed in one line. A
minimum of 5 and a maximum of 256 are allowed here.
flags - Flag bits. These two are allowed here :
ATF_SkipEsc - This tells "BGetS" not to count escape
sequences as printable characters.
ATF_TabConvert - This tells "BGetS" to convert TABS into
blanks.
RESULT
ascii will be a pointer to an AsciiText structure or null if there the
structure could not be allocated.
BUGS
None known.
ascii.s/FreeAscii ascii.s/FreeAscii
NAME
FreeAscii -- deallocate an AsciiText structure.
SYNOPSYS
FreeAscii( ascii )
struct AsciiText *ascii;
FUNCTION
To deallocate the memory of the text in the AsciiText structure and the
memory of the AsciiText structure itself.
INPUTS
ascii - A pointer to the AsciiText structure you want to deallocate.
BUGS
None known.
ascii.s/BGetS ascii.s/BGetS
NAME
BGetS -- get one line of text from the "BuffIO" handle.
SYNOPSYS
line = BGetS( file, ascii );
struct Line *line;
struct BuffIO *file;
struct AsciiText *ascii;
FUNCTION
To allocate a line structure and read a complete text line. If the line
contains more bytes than specified by you with "AllocAscii()" the line
will be truncated with a NEWLINE and the LNF_Split flag will be set in
the line. This means that such a line contains "line->Size - 1" bytes of
actual data and one inserted NEWLINE.
INPUTS
file - A pointer to the BuffIO file handle in from which the line will
be read.
ascii - A pointer to the AsciiText structure in which the memory for the
line will be allocated.
RESULT
line will be a pointer to the Line structure or null if the routine
failed. NOTE: The line will not be added to the text itself. You must
"AddTail(ascii,line)" it to do so. Do NOT add a line allocated in one
AsciiText structure to another AsciiText structure!
BUGS
The routine chokes when the "ATF_SkipEsc" flag is set and the line has
more than "MAXLINE" characters + escape sequences in it. If this is the
case it will overflow it's internal buffer.
SEE ALSO
ascii.s/AllocAscii()
ascii.s/BPutS ascii.s/BPutS
NAME
BPutS -- write one line of text to a "BuffIO" handle.
SYNOPSYS
error = BPutS( file, line )
LONG error;
struct BuffIO *file;
struct Line *line;
FUNCTION
Write out the specified line to the "BuffIO" file handle. The routine
writes "line->Size" bytes of data from normal lines and "line->Size - 1"
bytes of data from lines with the LNF_Split flag set.
INPUTS
file - A pointer to the "BuffIO" file handle to which the line is
written.
line - A pointer to the "Line" structure which must be written.
RESULT
error is ASE_OK if everything went OK or something else if an error has
occurred.
BUGS
None known.
SEE ALSO
ascii.s/BIoErr()
ascii.s/FirstOccurrence ascii.s/FirstOccurrence
NAME
FirstOccurrence -- find the first occurrence of a string in a text.
SYNOPSYS
found = FirstOccurrence( ascii, string, strscn, case )
LONG found;
struct AsciiText *ascii;
UBYTE *string;
struct StringScan *strscn;
LONG case;
FUNCTION
To find the first occurrence of a specific string in a text. The routine
starts to look from the first line in the text. This also set's up the
the StringScan structure for further usage by Next/PreviousOccurrence().
This routine must be called BEFORE Next/PreviousOccurence() are called.
INPUTS
ascii - A pointer to the AsciiText structure in which the routine must
look for the string.
string - A pointer to the null terminated string the routine must look
for.
strscn - A pointer to a StringScan structure in which the routine keeps
track of the search.
case - This should be TRUE if you want a case sensitive search and
FALSE if not.
RESULT
found reads TRUE if the routine has found the string looked for and
FALSE if not. If the routine returns TRUE the StringScan structure
contains the specific position where it has found the string.
BUGS
None known.
SEE ALSO
ascii.s/NextOccurrence(), ascii.s/PreviousOccurrence()
ascii.s/FindFrom()
ascii.s/NextOccurrence ascii.s/NextOccurence
NAME
NextOccurrence -- find the next occurence of a string in a text.
SYNOPSYS
found = NextOccurrence( strscn, case )
LONG found;
struct StringScan *strscn;
LONG case;
FUNCTION
To find the next occurence of a string in a text. The routine starts to
look from the last position it has found the string.
INPUTS
strscn - A pointer to the StringScan structure which was used to
find the first occurrence of the string.
case - See ascii.s/FirstOccurrence()
RESULT
See ascii.c/FirstOccurrence()
BUGS
None known.
SEE ALSO
ascii.s/FirstOccurrence(), ascii.s/FindFrom()
ascii.s/PreviousOccurrence ascii.s/PreviousOccurence
NAME
PreviousOccurrence -- find the previous occurence of a string in a text.
SYNOPSYS
found = PreviousOccurrence( strscn, case )
LONG found;
struct StringScan *strscn;
LONG case;
FUNCTION
To find the previous occurence of a string in a text. The routine starts
to look from the last position it has found the string.
INPUTS
strscn - A pointer to the StringScan structure which was used to
find the first occurrence of the string.
case - See ascii.s/FirstOccurrence()
RESULT
See ascii.c/FirstOccurrence()
BUGS
None known.
SEE ALSO
ascii.s/FirstOccurrence(), ascii.s/FindFrom()
ascii.s/FindFrom ascii.s/FindFrom
NAME
FindFrom -- find the first occurrence of a string in a text.
SYNOPSYS
found = FindFrom( ascii, string, strscn, line, case )
LONG found;
struct AsciiText *ascii;
UBYTE *string;
struct StringScan *strscn;
struct Line *line;
LONG case;
FUNCTION
This routine does the same thing as FirstOccurrence exept that you can
specify the line where it must start the search.
INPUTS
ascii - See FirstOccurence.
string - See FirstOccurence.
strscn - See FirstOccurence.
line - A pointer to the "Line" structure from which the routine must
start the search.
case - See FirstOccurence.
RESULT
found reads TRUE if the routine has found the string looked for and
FALSE if not. If the routine returns TRUE the StringScan structure
contains the specific position where it has found the string.
BUGS
None known.
SEE ALSO
ascii.s/NextOccurrence(), ascii.s/PreviousOccurrence()
ascii.s/FirstOccurence()