home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
spoc88
/
proasm
/
dump.pro
< prev
next >
Wrap
Text File
|
1988-06-09
|
2KB
|
87 lines
/*
NOTE: This program links in two external object
files: open.obj and read.obj. Assemble these
files using Turbo Assembler. Be sure to compile
this program as
a project.
If compiling as a project, create a project file
called "dump.prj" with the following text:
simple
open
read
To compile, choose "Project" from the "Compile"
pulldown Menu, and selct the appropriate project file.
*/
PROJECT "SIMPLE"
global DOMAINS
file = infile
STRINGLIST = STRING*
INTEGERLIST = INTEGER*
GLOBAL PREDICATES
open(STRING,INTEGER) - (i,o) language asm
read(INTEGER,INTEGER,INTEGER) - (i,o,o) language asm
PREDICATES
run
readfile(STRING)
repeat
processBYTE(INTEGER,INTEGER)
GOAL
run.
CLAUSES
/****************************** run *******************************/
run if
makewindow(1,7,7,"Test of OPEN and READ routines ",0,0,25,80),
cursor (5,10),
write("Enter filename: "),
readln(Filename),
clearwindow,nl,nl,
readFILE(FileNAME).
/***************************** readfile ***************************/
readFILE(FileNAME) if
open(FileNAME,FileHANDLE),
FileHANDLE <> 255, /* Check for error in opening file */
repeat, /* we backtrack to here if not EOF */
read(FileHANDLE,NumberBYTESread,ReadBUF),
processBYTE(NumberBYTESread,ReadBUF),
NumberBYTESread = 0,!. /* Check for end of file. */
readFILE(FileNAME) if !,
removewindow,
write("Sorry, unable to open ",FileNAME,"."),nl,
exit.
/****************************** repeat ****************************/
repeat.
repeat if
repeat.
/**************************** processBYTE *************************/
processBYTE(NumberBYTESread,ReadBUF) if
NumberBYTESread <> 0,
write(ReadBUF," "), !.
processBYTE(0,_) if !,
nl,
write("End of file."),
nl.
/*********************** END OF DUMP.PRO **************************/