ICNM2@EBCCUAB1.BITNET ("Centre Nacional de Microelectronica ", Barcelona) (01/17/90)
Hi Forthers ! I'm using L&P F83 to write a simple application that allows me to translate from one graphical format to another (CIF to DXF as a matter of fact), this exercise also allows me to *learn* some forth. But I'm having some difficulties to read a non-blocked file, I see some solutions : 1) convert my sequential file to a blocked one before processing ( I really hate this) 2) patch f83 FILE-READ word so it can read less than 8 128-byte records ( I think this is not a good idea looking at the virtual memory system in f83 ) 3) handle the "interrupt vector" ?ERROR, so when BLOCK attempts to read the last block (the one with the EOF within), don't ABORT's and I my program can process the data that's already in the buffer. ( seems nice but's uneasy, some guidelines ?) 4) Write my own I/O subsytem to handle sequential files. I know this has been done (in F-PC, etc), but I like the KISS approach. 5) ??? Somebody have any ideas ? Thanks from a beginner Carles
wmb@SUN.COM (01/17/90)
> I'm using L&P F83 to write a simple application ... > But I'm having some difficulties to read a non-blocked file My portable file system interface code reads and writes sequential files. It has been ported to F83. The code is in the public domain. I sell the F83 version on a PC disk for $10, which is basically "at cost". Mitch Bradley Bradley Forthware P.O. Box 4444 Mountain View, CA 94040
ir230@sdcc6.ucsd.edu (john wavrik) (01/18/90)
In response to request concerning reading of reading textfiles in F83: Create a file BLANKS.BLK which contains only 1024 blanks and use this to pad the end of your file: COPY /B <yourfile>+BLANKS.BLK Padding the file will insure that everything gets read. Using the /B switch will preserve the end of file marker in your file. Your file can now be treated as a file of characters. : FilePos ( n -- addr ) 1024 /MOD BLOCK + ; will give the "address" of the n-th character in the file. What happens next depends on the type of file and what you plan to do with it. It is easy to define: GetChar which reads characters sequentially (skipping CR/LF terminators and setting variables EOLN, and EOF in the customary way) Readln which reads a line at a time to a buffer You can also read structured files of any sort, write files, and any combination (the variable FILE holds the address of the FCB of the file which to which BLOCK currently refers -- see also IN-FILE, IN-BLOCK). Writing routines must include UPDATE (and should use FLUSH at the end). John J Wavrik jjwavrik@ucsd.edu Dept of Math C-012 Univ of Calif - San Diego La Jolla, CA 92093