v056ped5@ubvmsd.cc.buffalo.edu (Brian M McNamara) (12/12/90)
Does anyone have source code for random files and reading and writing records for use with the FST compiler. This seems like one of the most necessary utilities for a language so powerful in data storage, yet it does not exist. I have gone to numerous books and magazine articles, but they all just show you what the definition module for such a utility should look like. I need the implementation. Brian
jmh@coyote.uucp (John Hughes) (12/13/90)
In article <50687@eerie.acsu.Buffalo.EDU> v056ped5@ubvmsd.cc.buffalo.edu writes: >Does anyone have source code for random files and reading and writing records >for use with the FST compiler. This seems like one of the most necessary >utilities for a language so powerful in data storage, yet it does not >exist. I have gone to numerous books and magazine articles, but they all >just show you what the definition module for such a utility should look >like. I need the implementation. > >Brian Here is something I obtained from the FST bulletin board (which I haven't been able to connect to for quite a while... Roger Carvalho, are you still alive out there?). I have a much larger version that I created for myself, but it's way to big to put into a follow-up. As a quick look-see at the code will show, it's really not too hard to implement. -----CUT HERE----CUT HERE----CUT HERE--------------------------------------- DEFINITION MODULE RandomIO; (* Routines for reading and writing files with fixed-length records, allowing direct access to a specific record in the file by record number. The first file in the record is record #0. This module uses procedures from and works in co-operation with module FileSystem. A random file is opened with FileSystem.Lookup and closed with FileSystem.Close, and any other procedure from FileSystem may be used to manipulate the file. Copyright (C) 1988 Jeff Zeitlin. All rights reserved. *) FROM FileSystem IMPORT File; FROM SYSTEM IMPORT BYTE; PROCEDURE ReadRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); PROCEDURE WriteRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); END RandomIO. ----CUT HERE----CUT HERE----CUT HERE----------------------------------------- IMPLEMENTATION MODULE RandomIO; (* Routines for reading and writing files with fixed-length records, allowing direct access to a specific record in the file by record number. The first file in the record is record #0. This module uses procedures from and works in co-operation with module FileSystem. A random file is opened with FileSystem.Lookup and closed with FileSystem.Close, and any other procedure from FileSystem may be used to manipulate the file. Copyright (C) 1988 Jeff Zeitlin. All rights reserved. *) FROM FileSystem IMPORT File, SetLPos, ReadNBytes, WriteNBytes; FROM SYSTEM IMPORT BYTE, WORD, ADDRESS, ADR; PROCEDURE ReadRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); VAR NumBytes : CARDINAL; NumRead : CARDINAL; FilePos : LONGCARD; BEGIN NumBytes := HIGH(record) + 1; FilePos := LONG(recnum) * LONG(NumBytes); SetLPos(F,FilePos); ReadNBytes(F,ADR(record),NumBytes,NumRead); END ReadRecord; PROCEDURE WriteRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); VAR NumBytes : CARDINAL; NumWritten : CARDINAL; FilePos : LONGCARD; BEGIN NumBytes := HIGH(record) + 1; FilePos := LONG(recnum) * LONG(NumBytes); SetLPos(F,FilePos); WriteNBytes(F,ADR(record),NumBytes,NumWritten); END WriteRecord; END RandomIO. ----END----END----END------------------------------------------------------ Have fun. -- | John M. Hughes | "...unfolding in consciousness at the | | noao!jmh%moondog@coyote | deliberate speed of pondering." - Daniel Dennet | | jmh%coyote@noao.edu |--------------------------------------------------| | noao!coyote!jmh | P.O. Box 43305 Tucson, AZ 85733 |
Patrick.Verkaik@p11.f39.n512.z2.fidonet.org (Patrick Verkaik) (12/18/90)
> From: v056ped5@ubvmsd.cc.buffalo.edu (Brian M McNamara) > Date: 11 Dec 90 23:23:24 GMT > Organization: University at Buffalo > Message-ID: <50687@eerie.acsu.Buffalo.EDU> > Newsgroups: comp.lang.modula2 > > Does anyone have source code for random files and reading > and writing records > for use with the FST compiler. This seems like one of the I think you'll get the source code if you register... Patrick -- uucp: uunet!m2xenix!puddle!2!512!39.11!Patrick.Verkaik Internet: Patrick.Verkaik@p11.f39.n512.z2.fidonet.org
v056ped5@ubvmsd.cc.buffalo.edu (Brian M McNamara) (12/24/90)
In article <413.277230D0@puddle.fidonet.org>, Patrick.Verkaik@p11.f39.n512.z2.fidonet.org (Patrick Verkaik) writes... > >I think you'll get the source code if you register... > >Patrick > No, it is simply not included. Why is that whenever anyone asks a question in almost any newsgroup, someone needs to give the "Time-Life read the book" answer?
jmh@coyote.uucp (John Hughes) (12/25/90)
In article <52912@eerie.acsu.Buffalo.EDU> v056ped5@ubvmsd.cc.buffalo.edu writes: >In article <413.277230D0@puddle.fidonet.org>, Patrick.Verkaik@p11.f39.n512.z2.fidonet.org (Patrick Verkaik) writes... >> >>I think you'll get the source code if you register... >> >>Patrick >> > >No, it is simply not included. Why is that whenever anyone >asks a question in almost any newsgroup, someone needs to >give the "Time-Life read the book" answer? I don't know... I find that somewhat annoying as well. I did send (or attempt to send) some code related to random record handling for FST, but for the benefit of any other who are interested in seeing how this is done, here is a simplle set of modules from the FST BBS. -------snip----snip-----snip---chop----tear----cut----shred----------- DEFINITION MODULE RandomIO; (* Routines for reading and writing files with fixed-length records, allowing direct access to a specific record in the file by record number. The first file in the record is record #0. This module uses procedures from and works in co-operation with module FileSystem. A random file is opened with FileSystem.Lookup and closed with FileSystem.Close, and any other procedure from FileSystem may be used to manipulate the file. Copyright (C) 1988 Jeff Zeitlin. All rights reserved. *) FROM FileSystem IMPORT File; FROM SYSTEM IMPORT BYTE; PROCEDURE ReadRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); PROCEDURE WriteRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); END RandomIO. -------cut here----cut here-----cut here----cut here------------------ IMPLEMENTATION MODULE RandomIO; (* Routines for reading and writing files with fixed-length records, allowing direct access to a specific record in the file by record number. The first file in the record is record #0. This module uses procedures from and works in co-operation with module FileSystem. A random file is opened with FileSystem.Lookup and closed with FileSystem.Close, and any other procedure from FileSystem may be used to manipulate the file. Copyright (C) 1988 Jeff Zeitlin. All rights reserved. *) FROM FileSystem IMPORT File, SetLPos, ReadNBytes, WriteNBytes; FROM SYSTEM IMPORT BYTE, WORD, ADDRESS, ADR; PROCEDURE ReadRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); VAR NumBytes : CARDINAL; NumRead : CARDINAL; FilePos : LONGCARD; BEGIN NumBytes := HIGH(record) + 1; FilePos := LONG(recnum) * LONG(NumBytes); SetLPos(F,FilePos); ReadNBytes(F,ADR(record),NumBytes,NumRead); END ReadRecord; PROCEDURE WriteRecord(VAR F : File; recnum : CARDINAL; VAR record : ARRAY OF BYTE); VAR NumBytes : CARDINAL; NumWritten : CARDINAL; FilePos : LONGCARD; BEGIN NumBytes := HIGH(record) + 1; FilePos := LONG(recnum) * LONG(NumBytes); SetLPos(F,FilePos); WriteNBytes(F,ADR(record),NumBytes,NumWritten); END WriteRecord; END RandomIO. ================END====END====END====END====END======================= The tabs came out a little wierd, but it looks OK otherwise. Give it a try. -- | John M. Hughes | "...unfolding in consciousness at the | | noao!jmh%moondog@coyote | deliberate speed of pondering." - Daniel Dennet | | jmh%coyote@noao.edu |--------------------------------------------------| | noao!coyote!jmh | P.O. Box 43305 Tucson, AZ 85733 |
draper@buster.cps.msu.edu (Patrick J Draper) (12/28/90)
In article <413.277230D0@puddle.fidonet.org> Patrick.Verkaik@p11.f39.n512.z2.fidonet.org (Patrick Verkaik) writes: > > >I think you'll get the source code if you register... > >Patrick > > >-- >uucp: uunet!m2xenix!puddle!2!512!39.11!Patrick.Verkaik >Internet: Patrick.Verkaik@p11.f39.n512.z2.fidonet.org And Speaking of Registration........ Where are you Roger!!!!!! I registered this past summer, and you still haven't cashed the check, and I still haven't gotten my copy of the source code!! Plllleeeeaaaasssseee cash the check and send my registered copy. Thank you, ------------------------------------------------------------------------ Patrick Draper In times like these it is helpful to buster.cps.msu.edu remember that there have always been times like these. ------------------------------------------------------------------------
jmh@coyote.uucp (John Hughes) (12/28/90)
In article <1990Dec27.231016.27137@msuinfo.cl.msu.edu> draper@buster.cps.msu.edu (Patrick J Draper) writes: >In article <413.277230D0@puddle.fidonet.org> Patrick.Verkaik@p11.f39.n512.z2.fidonet.org (Patrick Verkaik) writes: >> >> >>I think you'll get the source code if you register... >> >>Patrick >> >> >>-- >>uucp: uunet!m2xenix!puddle!2!512!39.11!Patrick.Verkaik >>Internet: Patrick.Verkaik@p11.f39.n512.z2.fidonet.org > > >And Speaking of Registration........ > > >Where are you Roger!!!!!! I registered this past summer, and you still >haven't cashed the check, and I still haven't gotten my copy of the >source code!! > >Plllleeeeaaaasssseee cash the check and send my registered copy. > [sig deleted] Has anyone heard from FST or Roger Carvalho lately? Is the BIX conference still active? I know Roger has an internet address (I've got it around here somewhere, but it's a goofy connection and mail bounces), so perhaps someone could let him know that the curiousity level is rising. The last time I contacted Roger was through the FST BBS, around about a year ago (Jan-Feb of 1990). -- | John M. Hughes | "...unfolding in consciousness at the | | noao!jmh%moondog@coyote | deliberate speed of pondering." - Daniel Dennet | | jmh%coyote@noao.edu |--------------------------------------------------| | noao!coyote!jmh | P.O. Box 43305 Tucson, AZ 85733 |