[comp.lang.icon] FileManager class

talmage@luvthang.aquin.ori-cal.COM (David W. Talmage) (06/19/91)

I've been thinking about that max open files problem I asked the
Icon-Group about.  One way to fix my problem is to recompile icont and
iconx with a larger number of available file handles.  I don't like
that solution because it might involve a lot of compiler-specific work.

Maybe there's a better way using Idol.  Suppose there is a File class,
a FileManager class, and at most one FileManager object per program.
The FileManager guarantees there are no more than MaxOpenFiles
(whatever that is) open at one time.  Each File object registers
itself with the FileManager, who keeps a table of files and their
state (opened or closed).  Before any File method can actually touch
the file, that method must inform the FileManager object who ensures
the file is opened by closing some other open file if necessary.
Similarly, the FileManager object reopens temporarily closed files and
positions their pointers to where ever they were when last closed. 

I like this solution because I can do it entirely in Idol and Icon.  I
dislike it because I'm now doing stuff the operating system should
handle for me.

-----------------------------------------------------------------------------
David W. Talmage (talmage@luvthang.aquin.ori-cal.com)
"I need fifty dollars to make you hollar.  I get paid to run this luvthang."