Waldek Hebisch wrote:
Adriaan van Os wrote:
Peter Schorn wrote:
The following program crashes the compiler (gpc345u2 on Mac OS 10.4.4):
program rs;
{ compile with gpc rs.pas }
var a: integer;
begin readstring(a); { internal compiler error: Bus error } end.
Hmm, I think I caused this error, by adding ReadString to predef.def
[snip]
Is it just a single routine ("ReadString") or does Mac Pascal have also "WriteString"?
Mac Pascal has function that is basicly a functional form of "WriteString". The function's name is "StringOf" and it returns a string-type. So the difference between the two is the method used to pass back to the caller the written to string. "WriteString" uses a required string-variable first parameter; whereas, doesn't use a required string-variable first parameter. Using ISO 10206 syntax notation, a syntax comparison would be:
ISO 10206: writestr(s, p1, ... , pn) versus Mac Pascal: s := stringof(p1, ... , pn)
I'll note that Mac Pascal's have a few extensions in the types of parameters allowed for Read and ReadString and THINK Pascal allows more types for Write and StringOf. All three traditional Mac Pascal compilers allow boolean type parameters for Read and ReadString which ISO doesn't allow. THINK Pascal extends allowed types to include any enumerated type for reading as well as writting. But to make that work reasonably well, THINK Pascal doesn't do field width truncation on the strings written out for boolean or enumerated types and thus avoids having to handle reading write truncated strings for those types.
Gale Paeper gpaeper@empirenet.com