Hi.
(I'm not subscribed to this list, so please CC any replies to me.)
I just tried grx-2.4.3, and found a number of little things to fix
and improve:
When building it, there are a few warnings because of some missing
external declarations in some test programs and some unused
variables in colors.pas. (diff0)
GRX_DEFAULT_FONT_PATH must be quoted (string in a C source file),
and quoted again in the Makefile (which is eaten by the shell). (see
diff1 -- this diff is only for the X11 target, and should probably
be made similarly for the other ones). Alternatively, one could use
preprocessor stringification in loadfont.c.
I suggest there to be an `install-fonts' target in the top level
Makefile, so one doesn't have to chdir and call make in a
subdirectory. (diff2 -- also only for X11)
The rest of this mail is referring to the Pascal interface. Since
I'm one of the GPC maintainers, I'm mostly interested in that.
For the libraries linked, I suggest to add a case for the Linux
console (though the default under Linux should be X11) and optional
cases for libpng etc. (diff3).
I suggest to rename the Pascal `bgi2grx' unit to `Graph' (diff 4,
then mv pascal/bgi/bgi2grx.pas pascal/bgi/graph.pas -- the further
diffs assume this renaming), so it will be BP compatible and more
natural to Pascal programmers.
demo.pas, allmodes.pas: GPC supports Str like BP, so the special
case in MyStr is not necessary. sh_funcs.pas: Pi, PChar and Random
have been built into GPC for a long time, so the declarations there
are not necessary anymore. Furthermore, I suggest to move the
remaining two declarations (KeyPressed, ReadKey) into graph.pas
(perhaps conditionalized) because they'll be needed by many programs
that use that unit (which would use CRT in BP), and they're external
declarations of GRX routines, anyway. Then sh_funcs.pas can be
removed entirely. (diff5)
In grx.pas (type GrColor) it says "MUST be 32bit". So I suggest to
declare it accordingly. (diff6)
The handling of Pascal strings in C code is not recommendable
because the internal format is likely to change in some future GPC
version. It's also completely unnecessary since GPC supports (also
for a long time) automatic conversion from Pascal to C strings, so
simple external declarations of the C routines will work just fine
(like it's already done for some newer routines, like TIFF and JPEG
routines in this unit). This removes __gr_p_initgraph,
__gr_p_textheight, __gr_p_textwidth, __gr_p_outtext,
__gr_p_outtextxy, __gr_p_installuserfont, __gr_p_GPCstr and the
files gpc_init.c, gpc_text.c. Also, instead of StrPas, the built-in
and more efficient CString2String function can be used. (diff7)
The Pascal units should be installed from the Makefiles. (diff8)
Some argument type declarations (GrBuildPixmap, GrImageBuild,
GrImageBuildUsedAsPattern, GrBuildCursor) in Pascal are, though
correct, somewhat unfortunate (since pointers and arrays are not the
same in Pascal). Also, grx.pas seems to be incomplete. I'm adding
some of the missing routines (including PNM and PNG routines), but
didn't check what more is missing. (diff9)
doc/readme.bgi says: "libbcc.h won't include GRX and pascal stuff
any more; there's no Pascal support any longer, sorry". Are there
any known serious problems with this Pascal interface currently, or
is it just that no-one is willing to update it to future changes in
GRX?
Frank
--
Frank Heckenbach, frank(a)g-n-u.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan