Chris Karow wrote:
I am trying to use the compiler on an 32 bit SGI, v6.5 operating system. I downloaded the binaries for both the gcc (fw_gcc-2_8_1-sgipl2.tardist) and gpc (gpc-19990118.mips-sgi-irix6.2.tar.gz). I installed both, gcc in /usr/freeware and gpc in /usr/local. I've run gcc and tested it and it works fine. When I test gpc, I get a long message starting with
This looks like the compiler is working, and complains about some problems in the code begin compiled.
Apparently, the code was written for another Pascal compiler (SGI Pascal???) which predefines some non-standard identifiers. I can give you a few tips how to define them in GPC. Some of the errors are probably consequences of the missing identifiers.
"tabutil.pas:25: warning: missing program header
According to the standard, a program requires a `program' line at the beginning. If it's missing, GPC will warn, but still compile the program.
tabutil.pas:30: type name expected, identifier `String80' given tabutil.pas:31: type name expected, identifier `String20' given tabutil.pas: In function `Readint': tabutil.pas:60: type name expected, identifier `String255' given
type String80 = String (80); String20 = String (20); String255 = String (255);
tabutil.pas:68: undeclared identifier `Depend_err' (first use this function)
I don't know what this is (haven't seen this anywhere before). Perhaps it's define in some module which is supposed to be compiled with the given source (via `imports' or as an include file, ...). Otherwise, you'd have to figure out what this procedure(?) is supposed to do...
tabutil.pas:69: undeclared identifier `Str2int' (first use this function) tabutil.pas:86: undeclared identifier `Str2real' (first use this function)
GPC supports:
ReadStr ( <source string>, <integer, real, string, char>... )
and
Val ( <source string>, <integer or real>, <result> )
(result will be 0 if successful, >0 if not)
Based on this, you can write Str2Int and Str2Real as needed by your code. Since this depends on whether they are supposed to be procedures or functions and on their parameter lists, I can't give you drop-in routines, but perhaps something like the following:
function Str2Int (const s: String) = Res: Integer; begin ReadStr (s, Res) end;
(However, it looks like your code has a `ReadStr' routine itself, so either do the above before the (re-)declaration of `ReadStr' or use `Val'.)
tabutil.pas:102: undeclared identifier `Strg' (first use this function)
I don't know what this means. On German keyboards, `Strg' is the `Ctrl' key, but I doubt that's meant here. ;-) It could be Str(ing)G(reater) or anything else, but I really don't know without seeing some context (or documentation of the original compiler).
tabutil.pas:128: undeclared identifier `Fopen' (first use this function)
Looks like the name of a C funcion (fopen()). If that's really what's meant here, you can probably use the normal file routines (`Reset', `Rewrite', `Extend')...
tabutil.pas:136: undeclared identifier `Indx' (first use this function)
GPC supports `Index' (find a substring in a string), in case that's what `Indx' is supposed to be...
If these things are really built-in declarations of some Pascal compiler (and not part of some other modules), we could try to add them to GPC. We have done this for other dialects or other compilers' definitions (in particular, Borland Pascal), so it wouldn't be completely new to us. However, we'd need some reasonable documentation on this compiler's declarations (or better yet, free code to implement them :-).
Frank