Node:Top,
Next:News - General Changes And Possible Incompatibilies with Previous Versions
There's a number of new or changed features which are listed in the following sections. Features without further description refer to new routines or options.
Information about GPC as well as GPC itself for download can be found on the GPC home page.
This list is part of GNU Pascal. Copyright (C) 1997-2002 Free Software Foundation, Inc.
This release of GPC has been cleaned up substantially. Consequently,
a few old and obsolete features have been dropped or replaced by
cleaner, more flexible or otherwise more useful ones. This might
lead to minor problems with old programs, but we suppose they're
very rare (many programmers might not even know about the old
features) and easy to overcome. The most important ones are listed
here, the rest of them is contained in the following sections and
marked with (@).
bpc, pc and epc as well
as the dialect specific behaviour if GPC is invoked by those names
have been dropped. What they did was equivalent to
gpc --borland-pascal, gpc --classic-pascal or
gpc --extended-pascal, respectively, and you can use these
forms now. If you need them often, you can put them in scripts or
aliases called bpc etc., of course.
asmname in variable and constant declarations must now
come after the type
(e.g. var foo: Integer = 42; asmname 'bar';). Furthermore,
asmname doesn't imply external anymore for variables.
FILE * pointers to integer file handles, to make it more
efficient and to get rid of some problems. Accordingly, the
CFile field in BindingType was replaced by a
Handle field, the AssignCFile procedure by an
AssignHandle procedure, and the GetFile function was
removed (a substitute is the function FileHandle which has
already existed in previous releases).
--no-nested-comments (to allow comments like
{ *) as the standard requires) has been renamed to
--mixed-comments (note the inverted value). Accordingly, the
compiler directives {$N+} and {$N-} have been
renamed to {$no-mixed-comments} and
{$mixed-comments}. The default, when no dialect options are
given, is still --no-mixed-comments (i.e., what used to be
--nested-comments).
--nested-comments to allow real nested
comments like { { } } (also available as a compiler
switch, like almost all command-line options). Note the new meaning
of this switch, so if you used it before, you'll probably have to
change it to --no-mixed-comments (see above). If nested
comments are enabled, comments are also allowed within compiler
directives and macros - however, compiler directives within other
compiler directives are still not allowed, and compiler directives
within comments are, of course, still ignored.
\n, \007 etc.) are
now the default for strings enclosed in double quotes, while single
quoted strings do not allow them (according to the standard).
Accordingly, a verbatim " in a double quoted string is now
obtained with \" rather than "" (but a verbatim
' in a single quoted string still with '', of course).
Therefore, the option --[no-]char-escapes and the compiler
directives {$E+}/{$E-} have been dropped. If you
used these features, please change to the appropriate kind of
quotes.
--borland-pascal and
--delphi modes. Expanding them causes a few problems with
strange sources written for BP which use the same name for a
conditional define and an identifier. Macros can be turned on/off,
independently of the dialect, with the new switches
--[no-]macros. (B)
{$define} are
now case-insensitive. (B) Macros and conditionals defined with
--define on the command line are still case-sensitive for
compatibility to other GNU compilers. In addition, GPC provides
{$csdefine} or --csdefine and {$cidefine}
or --cidefine to define case sensitive or insensitive macros
or conditionals, respectively. If you have defined macros or
conditionals with {$define} and rely on them being
case-sensitive, change it to {$csdefine} now.
gpcpp (it was
gpc-cpp before). If you have installed an older GPC version,
please remove gpc-cpp now. If you have any scripts that refer to
gpc-cpp directly, change the reference to gpcpp. If you use DJGPP,
and you added the GPC specific sections to djgpp.env as described in
the FAQ, please change [gpc-cpp] to [gpcpp].
--borland-pascal mode, GPC now ignores everything
after end.. (This also takes care of "^Z" characters at the
end of Dos text files). In particular, multiple units or modules in
one file don't work anymore in --borland-pascal mode. (B)
attribute, class and published. (D, partly)
-x Pascal/--language=Pascal works now; new
option
-x Preprocessed-Pascal/--language=Preprocessed-Pascal
to compile without preprocessing
{$ifopt} works now, with short directives like in BP
({$ifopt X+}) (B) and also with long directives
({$ifopt extended-syntax})
{$local} and {$endlocal}.
// comments in default and
--delphi modes, and a switch --[no-]delphi-comments to
turn them on/off explicitly. (D)
-W[no-]implicit-abstract (warn if an object type not
declared abstract contains an abstract method)
-W[no-]inherited-abstract (warn if an abstract object
type inherits from a non-abstract one)
-W[no-]typed-const (warn about BP style misuse of typed
constants)
-W[no-]near-far (warn about use of the obsolete BP
compatible near and far directives)
-W[no-]underscore (warn about double/leading/trailing
underscores in identifiers)
-W[no-]mixed-comments (warn about use of mixed
comments)
-W[no-]nested-comments (warn about use of nested
comments)
-W[no-]semicolon (warn about a semicolon after
then, else or do)
-W[no-]field-name-problem (don't warn about a problem
with field names)
-W[no-]object-directives (don't warn about
unimplemented private, protected and public
directives)
-W[no-]warnings (enable/disable warnings)
-Wfoo warning options also work as
{$W foo} compiler directives. In contrast to the last alpha
release, there must now be a space after the W. (@)
--no-default-paths (disable standard unit etc. paths)
--no-unit-path, --no-object-path (disable any
unit/object paths given so far)
--[no-]read-base-specifier (in read statements, allow
non-decimal input with n#)
--[no-]read-hex (in read statements, allow hexadecimal
input with $)
--[no-]read-white-space (in read statements, require
whitespace after numbers)
--[no-]io-checking (same as {$I+},
{$I-})
--[no-]double-quoted-strings
--[no-]stack-checking, also as compiler directives
{$[no-]stack-checking} or {$S+}/{$S-} (B)
--[no-]typed-address, also as compiler directives
{$[no-]typed-address} or {$T+}/{$T-} (B)
--[no-]transparent-file-names (derive the external file
names from the file variable names
--[no-]progress-messages, --[no-]progress-bar
(output information to give progress messages or display a progress
bar while compiling, using suitable utilities)
--init-modules=foo:bar (initialize the named modules in
addition to those imported regularly; kind of a kludge)
{$[no-]debug-statement[=foo]} (call a procedure
automatically before each statement for debugging)
--big-endian, --little-endian,
--print-needed-options for targets whose endianness can vary
--[no-]c-numbers switch has been removed. If you
really used C style octal or hex numbers (0400,
0xf00), you can easily convert them to the Extended Pascal
notation (8#400, 16#f00) or (hex only) to the Borland
Pascal notation ($foo). (@)
{$gnu-pascal} is now completely equivalent to
--gnu-pascal; {$gnu-pascal} has been added to all
units shipped with GPC, so they can also be compiled when
--borland-pascal or other dialect options are given on the
command line.
{$if} directives now understand Pascal operators like
and, or, not (C operators are also still
understood).
{$P+}/{$P-} was replaced by
{$[no-]pedantic} (or --[no-]pedantic on the command
line)
{$F+}, {$O...}, or {$M} with only numbers
following) are ignored in --borland-pascal mode and warned
about otherwise. (B) Note: {$W+}/{$W-} is now also
ignored in --borland-pascal mode (it is the only
single-letter directive left that has a different meaning in BP and
in GPC, and besides, the BP meaning can be safely ignored in GPC).
To enable/disable warnings in --borland-pascal mode, you can
use {$W [no-]warnings} now. (@)
--version (print RTS version and
exit), --abort-on-error (abort with SIGABRT on runtime
error), --error-file, --error-fd (dump runtime error
messages and strack trace to given file name or FD).
--gpc-rts instead of -Grts. Also, a single option can
be given with --gpc-rts=option. This is allowed
multiple times. (@)
--field-widths are now delimited by `:'
rather than `,' so they can be distinguished from the `,' used to
delimit several compiler options. (@)
.pp or .dpr extension are recognized
as Pascal sources. (D)
--classic-pascal and
--classic-pascal-level-1 (equivalent to
--standard-pascal and --standard-pascal-level-1, and
meaning to supersede the latter in the future)
__GPC_VERSION__
is and as for objects
shl and shr can also be used as procedures now.
mod with negative right operand now works like in BP.
(B)
-2 * +3 are now allowed without
parentheses. (B)
& was removed.
(@ is still there.) (@)
register directive
asmname and uses ... in now allow
concatenated strings
asmname for programs, units and module interfaces
__asmname__,
__inline__ have been dropped. The same directives without
underscores have been available for a long time. Furthermore, GPC
now supports ^const to create a pointer to a constant (which
could be done in a C like fashion with the __const__
directive before). (@)
Size, NegatedSize,
Parent and Name, returned by TypeOf and
required by SetType
__byte__ or __unsigned__
have been dropped. GPC has been supporting "real" type names like
Byte or ByteWord for a long time, and it's easy to
change to them. Similar for __cstring__ and __void__
where CString and Void are available. (@)
nil is accepted as a value of any procedural/functional
type (B)
Some of the following declarations are built into the compiler,
others are declared in the GPC module.
ElementSize to ReverseBytes,
ConvertFromLittleEndian, ConvertFromBigEndian,
ConvertToLittleEndian, ConvertToBigEndian, BlockReadLittleEndian,
BlockReadBigEndian, BlockWriteLittleEndian, BlockWriteBigEndian (@)
StatFS is now a function rather than a procedure. (@)
InOutResStr was renamed to InOutResString, is
now a PString rather than a CString, and is now in the
GPC module rather than built into the compiler. (@)
ErrNoFlag to IOError,
IOErrorInteger, IOErrorCString and IOErrorFile (@)
Quoted to RelativePath (@)
Prefix to ConfigFileName (@)
AccessTime to SetFileName (@)
~user
Dir, Name and Ext
to FSplit may now be Null.
User, Group, Mode,
Device, INode, Links, SymLink,
TextBinary and Special, CloseFlag in
BindingType
TextFilesBinary has been dropped. Instead,
you can now use the procedure AssignBinary or the field
TextBinary in BindingType. (@)
Integer (e.g. 64 bit
files on 32 bit machines) if supported by the OS via lseek64() or
llseek() (e.g. Linux, Solaris, IRIX).
fmfoo to
fm_foo. (@)
GetIOErrorMessage now returns a string rather than a
CString. (@)
GlobBuffer, the fields Count and
Result (pointer to an array of CStrings, 0 baser) were
replaced by Result, a pointer to an array of pointers to
strings, 1 based). (@)
CString prefix, moved the BP compatibility identifiers for
the same routines into the Strings unit (B) (@)
SetLength does not require extended syntax anymore.
environ). Access via GetEnv etc. works
unchanged.
Environment variable is now a schema which contains
the environment variables as CStrings. (@)
MonthLength was replaced by a function of
the same name that handles leap years. (@)
TimeZone, DST, TZName1, TZName2 to UnixTimeToTime (@)
TimeZone, DST, TZName1, TZName2 in TimeStamp
uses and import may now occur multiple times in
a program, unit/module interface or unit/module implementation, even
between declarations.
gpc-main settings are now possible in units
public and private directives for interfaces
Null.
RESIZETERM (which defaults to resize,
SVGATextMode and setfont). The variables
crt_setfont_command_80_25, crt_setfont_command_80_50,
crt_setfont_command_40_25 and
crt_setfont_command_40_50 (Linux only) were removed. (@)
\u7 or \l7.
RegExType, the field Error is now of type
PString rather than CString. (@)
__BP_INTEGERS__ conditional to
__BP_TYPE_SIZES__. (@)
__BP_PARAMSTR_0__
_Borland_16_Bit_ conditional to
__BP_TYPE_SIZES__. (@)
__BP_UNPORTABLE_ROUTINES__ is defined. (B)
__BP_UNPORTABLE_ROUTINES__ is defined (emulated on
non-DJGPP). (B)
Process to Pipe (@)
Pipe unit. The PExecute
unit does not exist anymore. (@)
GetOptErrorFlag is now True by default. (@)
uses GetOpt
directive anymore. (@)
Command Line Option Parsing). (@)
GetOptLong can now optionally derive the short options
from the LongOptions array.
New unit (identical to CRT) (B)
New unit for (simple) heap checking.
New unit for runtime error trapping.
New unit for computing MD5 message digests.
New unit with some file and directory utilities.
New unit with some string utilities.
New unit for internationalization.
A GPC unit for BP to provide some GPC compatibility to BP
programs and make it easier to gradually convert them to GPC. (G)
A few of the units (in particular: CRT, GMP and RegEx) require libraries. The sources of the libraries, with small patches where necessary, as well as binaries for i586-pc-linux-gnu, i586-pc-linux-gnulibc1, m68k-linux, sparc-sun-solaris2, i386-pc-go32, i386-pc-cygwin32 and i386-pc-mingw32 are available from
http://www.gnu-pascal.de/libs/
Programming and
Reference chapters.
Invoking GPC chapter does not contain all options inherited
from GCC anymore (these can be found in the GCC manual, anyway), but
rather more extensive descriptions of the most commonly used GPC
options, with examples.
GPC module which describes the
interface to the Run Time System, is formatted more nicely,
especially in the printed version of the manual.
Support chapter was updated, now including
information about GPC's Test Suite and how to report bugs most
effectively, as well as up-to-date contact information.
<prefix>/doc/gpc/demos/.
<prefix>/doc/gpc/docdemos/.
binobj utility
The Test Suite is used to verify that all features of GPC work as expected and to reproduce bugs reported. Test programs for bugs found by users and for new features are constantly added. The test suite is part of source, not binary, GPC distributions, and it is available separately for download.
WARN to check for warnings.
On the other hand, WRONG tests are now run with warnings
switched off to detect only real errors.
make pascal.check (or make check-pascal)
now runs the current Test Suite (as make check2-gpc did
before) rather than the (now removed) dejagnu tests. This must be done
in the build directory (not the p subdirectory) or in the
test subdirectory of the source directory. (@)
make pascal.check-long (or check-pascal-long) now. (@)
test/README file in
source distributions (or BUGS in binary distributions) tells
you how to run the Test Suite and describes all features of the
testing environment, to make it easier for users to construct even
exotic new tests, and contains some generic instructions on
how to report bugs.
(@): | minor backward-incompatibility
|
(B): | BP compatibility
|
(D): | Delphi compatibility
|
(G): | GPC compatibility :-)
|
Have fun,
The GNU Pascal Development Team