Simon:
I'm trying to modularize my pascal programs into multiple source files.=
I was able to do this using Units but now I'm having trouble defining data types and global variables in a single file that can be included by pascal source files. Is there an interface file or definition= file concept in GNU Pascal? Thanks
-simon
A quick look at the units definition showed that it is going to be compiler specific. I had this trouble many years ago and so wrote a system independent insertion procedure. It's written in pure Pascal and is described at:
http://www.lecb.ncifcrf.gov/~toms/delila/module.html
The definition document is in:
ftp://ftp.ncifcrf.gov/pub/delila/moddef
The idea is that one can keep a library of program parts in modules. They are swapped into whatever program you want, as ascii. The mechanism is to use comment lines to delimit the modules. Thus this would be a module:
(* begin module simple.module.for.demonstration *) Any stuff you want here (* end module simple.module.for.demonstration *)
The module program copies a source input (sin) file to a source output file (sout). If module encounters a module like the one above, it goes to a module library (modlib) and copies the contents from modlib to sout. Then it returns to copying from sin. In this way an old module is replaced by a new one.
I have a number of general modules hanging around, in particular a quicksorter I use for anything that needs sorting. It's in http://www.lecb.ncifcrf.gov/~toms/delila/prgmod.html
Oh yes, the module insertion process is recursive, so one can create packages of modules. I wrote the definition and found that the code worked quite nicely. When tranported to a vax (that tells you how old this is!) it crashed because of one bug, a missing variable intiation. It has not had *any* bugs for the last 10 years. That's good because I'd hate to have my source code chewed up by an unreliable program!
Tom
Dr. Thomas D. Schneider National Cancer Institute Laboratory of Experimental and Computational Biology Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu http://www.lecb.ncifcrf.gov/~toms/