Hi everyone - got a question about GPC

Frank Heckenbach ih8mj at fjf.gnu.de
Thu Feb 18 07:48:00 CET 2010

Rugxulo wrote:

> On Tue, Feb 16, 2010 at 11:45 AM, Maurice Lombardi
> <Maurice.Lombardi at ujf-grenoble.fr> wrote:
> >
> > In fact for that reason, in my personal works I always use the option -o
> > blah.exe.

Well, GPC actually appends TARGET_EXECUTABLE_SUFFIX which can be set
by the backend target specification. I assume it's not set in the
DJGPP backend, but I don't know why. Historically it was because
there was reason for the COFF file; if that's no more the case, it
could have been set by default, AFAICS. (That would be a matter for
the GCC developers, in particular for the DJGPP backend.)

If you want to hack it yourself, you can probably just insert
something like

#ifdef __DJGPP__

near the start of p/module.c and rebuild GPC (untested).

> > This causes no extra typing because I work in an editor able to
> > launch a compiler with a single click through a script like
> >
> > #! /bin/sh
> > echo $MSYSTEM
> > gp $(basename "$1" | tr [A-Z] [a-z]) \
> >        -o $(basename "$1" | sed -e 's/\(.*\)\.[^.]*$/\1\.exe/') \
> >        $2 -march=prescott \
> >        --unit-path=. --unit-path=c:/lombardi/$MSYSTEM/gpc/pascal_u \
> >        --unit-path=c:/$MSYSTEM/units \
> >        --unit-destination-path=c:/lombardi/$MSYSTEM/o \
> >        `head -n 1 "$1" | sed -e '/^[^"]*$/d;s/^[^"]*"//;s/"[^"]*$//'` \
> >        2>&1 | sed ':1;s,/[^/.][^/]*/\.\./,/,;t 1'
> >
> Whew! Perl, where are you when we need you?  :-)    Anyways, you could
> probably also use sed instead of tr and head; that would be cleaner,
> IMHO. But I'm not very *nix savvy, so who cares.   ;-)

Unix says, the right tool for the job.

Why use perl when awk will do, or awk when sed will do, or sed when
tr or grep will do (at least that's my principle) ...

> For the record, I was unable to figure out compilation from within
> PENG. Besides, it (DOS version) whines upon startup in NT (Vista),
> something about printer or something silly like that.

Since PENG is slightly OT here, I'll keep my answer short. For more
discussion, please PM (f.heckenbach at fh-soft.de) or the PENG mailing
list (see http://fjf.gnu.de/peng/ under "Contact").

PENG should support GPC compilation, ideally simply by pressing F9.
Options can be set under "Options/Pascal". "Options/Pascal/Show
sample GPC command line" will show what it will actually use. If you
don't get along with this, you can also enter a command under
"Options/Try a tool" (using the current file name as "$EDNAME",
appyling file name functions etc., see the online help), and if it
works for you, you can permanently define it as a tool under

About the printer, do you get: "file 'prn' cannot be opened for
writing"? (And yes, I agree that accessing the printer via a device
file is silly, but that's the way it is/was under Dos.) After
pressing Esc, will it work normally? (If that's all, I could
probabably get rid of this somehow.)


Frank Heckenbach, f.heckenbach at fh-soft.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE  D101 CD02 4C9D 0FE0 E5E8

More information about the Gpc mailing list