Hello everybody!
Here again is a new version of GNU Pascal: gpc-970624. Since we
are aiming gpc-2.1 now, this is considered a *beta* version. :-)
GPC integrated into GCC
=======================
We succeeded to integrate the GPC source tree into that of GCC.
Now GPC is compiled and installed just like other GNU compilers.
Advantages of this distribution to the users of GPC are:
* Easier configuration: GPC is configured automatically when you
configure GCC. To build it, simply type "make LANGUAGES=pascal" in
the GCC directory. No more VPATH problems with some (read: Solaris)
versions of `make'.
* Building GCC, G++, ObjC, GPC and G77 (GNU Fortran) from a single
source tree is now possible.
Benefits for GPC developers:
* Easier adaption to different GCC versions.
* Better functional separation of GPC sources from the GNU back-end
(code shared with GCC) and the GPC specific code.
* A first step of further integration of GPC into the main GCC
distribution?
Other changes since gpc-970510
==============================
General news:
* The version number is now again produced manually, so it does reflect
the date of release, not of compilation.
* The GCC_MINOR version number now yields the expected result of `7'.
Bug fixes:
* Concatenation of more than two String constants now results in
a constant again, as it should be.
* Chars passed to formal String parameters work now.
* The warning "return type of `main' is not `int'" which occured with
Pentium optimization is gone.
* Enumerated types now can be exported by Units or Modules and are
type-checked more strictly.
* Pointers to single-character identifiers like `^A' now work as type
specifications in variable declarations. (They no more crash with
`^A' character constants.)
* GPC no more crashes on errorneous constant definitions.
* GPC no more crashes on errorneous initializers of structured variables.
* AutoMake with (*$L foo.c *) sometimes appeared to chose the compiler to
run at random, and it threw the dice to decide whether to recompile the
file or not. This feature is replaced now by a more traditional method:
(i) Derive the compiler to run from the extension of the file, and (ii)
decide whether to recompile or not from the date of the last change.
* Fixed some obvious bugs in the lexical analyzer which never showed up.
(The situation was too exotic to appear in praxis.)
* Extended Pascal's `ReadStr' (for BP users: this is EP's equivalent
to `Val') now accepts numeric values in non-zero-terminated strings.
(GPC's strings are not zero-terminated.)
* Initialized strings no longer get a trailing `chr ( 0 )'. (Initialized
`CString's (aka `pChar's) do; see below.)
* Initialization of structured variables containing other structured
variables works now.
* OOP: Nested subfunctions of methods work now.
* Pointer arithmetics now also works on the DEC Alpha, where
`SizeOf ( Pointer)' is different from `SizeOf ( Integer )'.
* Objects now also work on the DEC Alpha, where the type for sizes of
objects is not `Integer' (32 bits) but `LongInt' (64 bits).
* Packed arrays now also work on the DEC Alpha which does not like to
access misaligned 64-bit words.
* Schemata now also work on the DEC Alpha.
* Functions returning `Char' values now also work on the DEC Alpha.
* Module (Unit) constructors and destructors now also work on the
DEC Alpha. (You see: The DEC Alpha is a good platform to test GPC!)
UCSD (and Borland) Pascal:
* `Exit' handles function return values correctly now.
* Functions returning `String' now default to return `String ( 255 )'.
Without the `--borland-pascal' switch, a warning is given.
(According to EP, `String' is a Schema type in GPC and not limited
to 255 characters.)
Borland Pascal:
* Control character constants like `^A' are now restricted to `^A..^Z'
because `^^' happened to crash with double pointer dereferences, etc.
(BP has a bug here and does even accept `^;' and `^ ' (with a blank).
They might consider it a feature ...)
* `Abstract' can be redeclared now. (BP has no built-in `Abstract', but
Turbo Vision defines one.)
* Assigning contant values to `pChar' (aka `CString') variables works now.
* The `write' and `writeln' procedures now work for `pChar's, too.
* Calls to procedural parameters now work in expressions, too.
* Type casts now work like in BP, no more like in C.
Delphi:
* GPC now implements the function return `Result' variable. (According
to EP it was always possible to implement it manually by declaring
"Function foo ( bar: Integer ) = Result: Integer". (And it still is.:))
Extended Pascal:
* Subarray access `a [ i..j ]' for non-Strings is now warned about in
`--extended-pascal' mode.
* Pointers to pointers to undiscriminated Schemata (e.g. Strings without
specified length) work now.
* Schemata are (read: should be;) initialized properly now
in all situations.
GNU extensions:
* A new option `--executable-file-name' or (*$executable-file-name="foo"*)
now provides an alternative mechanism (apart from `-o foo') to specify
the executable output file. While `-o' can only be specified at the
command line, this switch can be written in the source as a compiler
directive. If the name is not explicitly given, it is derived from the
source file name which contains the `Program' declaration.
* A new option `--ignore-function-results' or (*$ignore-function-results *)
now allows to ignore values returned by functions without (*$X+*). Since
this is not as dangerous as, say, pointer arithmetics, it has got a
separate switch. It has a counterpart `--no-ignore-function-results'.
* `--extended-syntax' now has a counterpart `--no-extended-syntax'.
* `TypeOf ( MyObj )' is not accepted as an lvalue any more; instead, you
can use `AssignType ( MyObj, MyVmtLink )'.
* Assignment of the return value of a function through `asm' statements
is now recognized, so you won't get a superfluous "warning: return value
not assigned" any more.
* Pointer arithmetics: `inc ( p, n )' now increases the address pointed
to by `n * SizeOf ( p^ )' rather than just `n'.
* GPC has new integer types now. Below is a table with their sizes in
bits and their equivalents in (GNU) C.
The size is the same for all platforms I have access to, but I am not
sure whether this will always and everywhere be the case. However,
compatibility to GNU C is guaranteed to work to the extend of the
GNU GPL. ;-) The `*Int' types are signed (integer), the `*Card' types
unsigned (cardinal numbers). The `*Word' types are unsigned, too, but
should be thought of having undefined sign; they are intended to be used
where signedness does not matter.
Bits Signed Unsigned undefined (GNU) C equivalent
8 ByteInt ByteCard Byte [signed|unsigned] char
16 ShortInt ShortCard ShortWord short [unsigned] int
32 Integer Cardinal Word [unsigned] int
32 MedInt MedCard MedWord long [unsigned] int
64 LongInt LongCard LongWord long long [unsigned] int
64 LongestInt LongestCard LongestWord long long [unsigned] int
In addition, you can define the number of bits for `Integer', `Cardinal',
and `Word' types by putting it in parentheses,
Type
Int16 = Integer ( 16 ); (* 16 bits *)
Unsigned17 = Cardinal ( 17 ); (* 17 bits; stored in 32 bits *)
(* except when in packed arrays *)
(* and records (or on machines *)
(* with 17-bit registers:-). *)
Answer = Word ( 42 ); (* Stored in 64 bits *)
The size is rounded up to the next unit the machine can access, usually a
power of 2 with 8 bits being the smallest possible size.
* Subrange types can be packed now:
Type
Foo: -12..127; (* Takes 4 bytes (fast access) *)
Bar: packed -12..127; (* Takes 1 byte (saves memory) *)
Where to get it
===============
The source is being uploaded to
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/
together with binaries for DOS (DJGPP), DOS and OS/2 (EMX), Linux (ELF),
and FreeBSD.
Acknowledgement
===============
We thank everybody who took part in the discussion about integer types
and other extensions for good ideas.
We thank Larry Carter, Frank Heckenbach, Abimbola A. Olowofoyeku,
Markus Gerwinski, Berend de Schouwer, Maurice Lombardi, Phil Robertson,
Bernhard Tschirren, and Dario Anzani for finding the bugs.
We thank the IFF (Institut fuer Festkoerperforschung) of the FZ Juelich,
Germany, for the opportunity to test this new version of GPC on a
DEC Alpha computer.
Greetings,
Peter Gerwinski Jan-Jaap van der Heijden
<peter.gerwinski(a)uni-essen.de> <j.j.vanderheijden(a)student.utwente.nl>