On 11/08/2020 13:06, Graham Inggs wrote:

I've also looked at mricron [2][3], and changing '(**)' to '*)' in
both places fixes the compilation, but I have no idea what the '(**)'
means.  Can anyone tell me?

(* and *) are comment delimeters

Borland style pascal traditionally handled comments in a fairly dumb manner
that did not support nesting comments with the same delimeter but *did*
support nesting comments with different delimeters. This is why for
commenting out large blocks of code people sometimes use (* and *) rather
than the more common { and }.

So (**) would close an (* comment if it was open, but do nothing if no
comment was open (or a different type of comment was open). This would
allow one to comment or uncomment a code block by only editing the code
in a single place.

Freepascal also supports fully-nested comments. When running with fully
nested comments enabled (**) does nothing regardless of current comment
state. So the comment remains open till the end of the file and you get
an "unexpected end of file" error.

In "delphi" mode freepascal uses the borland style comment handling,
but in "objfpc" mode freepascal uses the fully nested comment handling.

Modes can be specified both on the command line with the -M parameter
and within a unit with the {$mode } compiler directive.

Strangely it seems the mricron package builds the main "mricron" binary
with -MDelphi on the command line but builds the "npm" binary with
-MObjFpc on the command line.

Some units in the mricron source also set the mode explicitly to either
objfpc or delphi mode.

That still leaves the question though of why did the build break when
going from 3.0 to 3.2, everything I have said above applies equally to
both versions. My guess would be some change on how mode selections
was handled in programs where some but not all units specify the mode
in the source code.

Anyway I see three possible fixes.

1. Change the npm.lpi file to set the default syntax mode to delphi
2. Add a {$mode delphi} to the source files
3. Edit the code to change (**) to *) and hence make it valid in both modes.

Reply via email to