Does anyone know how to get the Graph unit to compile?
Thank you,
HF =========================================== Prof. Harley Flanders 3533 Windemere Court Ann Arbor, MI 48105-2867 Home: 734 668 1546 harley@umich.edu
Visiting Professor University of Michigan Dept. of Mathematics, East Hall Ann Arbor, MI 48109 734 764 6451 Secretary: 734 764 6485 FAX: 734 763 0937 ===========================================
On 2 Apr 2004 at 11:05, Prof. Harley Flanders wrote:
Does anyone know how to get the Graph unit to compile?
Presumably you are referring to compiling under Windows (Mingw). If so, I have just ascertaind that the one that comes with grx-2.46 compiles out of the box. grx itself requires a lot of fiddling with the makefile.w32 to get it to compile under Mingw, but I have got it done now.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof. Harley Flanders wrote:
Does anyone know how to get the Graph unit to compile?
Download GRX from the library page on the GPC website or from http://grx.gnu.de and follow the installation instructions.
Frank
On 3 Apr 2004 at 0:05, Frank Heckenbach wrote:
Prof. Harley Flanders wrote:
Does anyone know how to get the Graph unit to compile?
Download GRX from the library page on the GPC website or from http://grx.gnu.de and follow the installation instructions.
Actually, that won't help him very much. He would first need to build GRX for Mingw. The makefile.w32 in the GRX package does not work (for one thing, all the "if exist ..." lines fail miserably, both under command.com and any other shell). The file requires a substantial amount of editing before it can be used. Eventually, I ended up creating a "makefile.msys" which uses the MSYS tools for building the package (works for building for Mingw (i.e., native Windows) and MSYS targets, and also for Cygwin). Perhaps I should call it makefile.gnuwin32 ...
I am not sure who on the GRX team to send this file to. It is certainly needed for anyone who wishes to build GRX on Windows, using gcc.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) wrote:
Actually, that won't help him very much. He would first need to build GRX for Mingw. The makefile.w32 in the GRX package does not work (for one thing, all the "if exist ..." lines fail miserably, both under command.com and any other shell). The file requires a substantial amount of editing before it can be used. Eventually, I ended up creating a "makefile.msys" which uses the MSYS tools for building the package (works for building for Mingw (i.e., native Windows) and MSYS targets, and also for Cygwin). Perhaps I should call it makefile.gnuwin32 ...
I am not sure who on the GRX team to send this file to. It is certainly needed for anyone who wishes to build GRX on Windows, using gcc.
I suggest to send it to the GRX list grx@gnu.de. (They regularly send patches etc. on the list.) If you don't feel like subscribing to that list, I suppose you can send it to the maintainer, Mariano Alvarez Fernandez <malfer(at)telefonica.net> or to Dimitar Zhekov <jimmy(at)is-vn.bg>, currently the most active contributor, also for Windows stuff.
Frank
On 3 Apr 2004 at 13:49, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
[...]
I am not sure who on the GRX team to send this file to. It is certainly needed for anyone who wishes to build GRX on Windows, using gcc.
I suggest to send it to the GRX list grx@gnu.de. (They regularly send patches etc. on the list.) If you don't feel like subscribing to that list, I suppose you can send it to the maintainer, Mariano Alvarez Fernandez <malfer(at)telefonica.net> or to Dimitar Zhekov <jimmy(at)is-vn.bg>, currently the most active contributor, also for Windows stuff.
Ok, thanks. I have sent it to them both. There is another problem as well. GRX cannot be used with the Crt unit (using PDCurses) - there are multiple definitions of getmaxx and getmaxy in libpdcurses.a and libgrx20.a.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) wrote:
On 3 Apr 2004 at 13:49, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
[...]
I am not sure who on the GRX team to send this file to. It is certainly needed for anyone who wishes to build GRX on Windows, using gcc.
I suggest to send it to the GRX list grx@gnu.de. (They regularly send patches etc. on the list.) If you don't feel like subscribing to that list, I suppose you can send it to the maintainer, Mariano Alvarez Fernandez <malfer(at)telefonica.net> or to Dimitar Zhekov <jimmy(at)is-vn.bg>, currently the most active contributor, also for Windows stuff.
Ok, thanks. I have sent it to them both. There is another problem as well. GRX cannot be used with the Crt unit (using PDCurses) - there are multiple definitions of getmaxx and getmaxy in libpdcurses.a and libgrx20.a.
That's an old problem (I talked about it with Mark Hessling, the PDCurses author, 5 years ago). Apparently these symbols are both part of the curses standard and used by Borland C's graph library.
In C, both have to be global functions. (There are also macros, but AFAIK the functions are provided for cases like taking the address of them.)
I suggested to Mark to put a conditional around the global functions, and I think he agreed, but apparently this hasn't been done.
So unless one can convince him, or the GRX authors, to do this, you might have to patch one the libraries yourself. The patched versions might fail in some strange situations in C, so they should be labeled. In Pascal it won't be a problem if you adjust the external names (and calls to them from within the library -- there seem to be a few in both cases).
Frank
On 3 Apr 2004 at 15:54, Frank Heckenbach wrote:
[...]
Ok, thanks. I have sent it to them both. There is another problem as well. GRX cannot be used with the Crt unit (using PDCurses) - there are multiple definitions of getmaxx and getmaxy in libpdcurses.a and libgrx20.a.
That's an old problem (I talked about it with Mark Hessling, the PDCurses author, 5 years ago). Apparently these symbols are both part of the curses standard and used by Borland C's graph library.
In C, both have to be global functions. (There are also macros, but AFAIK the functions are provided for cases like taking the address of them.)
I suggested to Mark to put a conditional around the global functions, and I think he agreed, but apparently this hasn't been done.
So unless one can convince him, or the GRX authors, to do this, you might have to patch one the libraries yourself. The patched versions might fail in some strange situations in C, so they should be labeled. In Pascal it won't be a problem if you adjust the external names (and calls to them from within the library -- there seem to be a few in both cases).
It I have written a small "graphcrt" unit that can be used instead - just to get programs to compile (see below - perhaps there is a portable way to implement "Sound" and "NoSound" without using Crt?):
unit graphcrt;
interface procedure nosound; procedure clrscr; procedure sound (freq : integer); procedure textcolor (col : integer); procedure delay (interval : integer); external name 'GrSleep';
implementation uses Graph;
procedure clrscr; begin ClearDevice; end;
procedure textcolor; begin SetColor (x); end;
procedure sound; begin end; procedure nosound; begin end;
end.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) wrote:
It I have written a small "graphcrt" unit that can be used instead -
Just for clarification: I don't recommend using CRT just for auxiliary routines such as Sound and Delay anyway. The only case to use GRX and CRT together IMHO is for programs that really do graphics and windowish text I/O (alternatively or concurrently).
Instead of Delay you can use Sleep and SleepMicroSeconds (unit GPC).
just to get programs to compile (see below - perhaps there is a portable way to implement "Sound" and "NoSound" without using Crt?):
Since even with CRT there's no portable way, the answer is surely no. Currently it's only implemented for DJGPP and Linux. The Linux code only runs in a terminal (i.e., not under X11 where you usually run GRX programs). I don't know if there are X11 commands for such "beeps" (if someone know, we could probably support them, and this would be for all Unix compatible systems under X11). The DJGPP code might also run in graphics mode.
procedure clrscr; begin ClearDevice; end;
I also don't recommend this because it clears the graphics screen/window which may or may not be the same as the text screen/window.
What kind of programs are these? If they use CRT routines to work in a graphics context, this isn't portable anyway, and I suggest to change the programs to use the appropriate Graph calls directly. (As I said, unless they really do graphics *and* text I/O.)
Frank
On 3 Apr 2004 at 18:53, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
It I have written a small "graphcrt" unit that can be used instead -
Just for clarification: I don't recommend using CRT just for auxiliary routines such as Sound and Delay anyway. The only case to use GRX and CRT together IMHO is for programs that really do graphics and windowish text I/O (alternatively or concurrently).
[...]
I don't really use Graph myself - but I have tried to port some BP programs (a chess game for example) and they all seemed to use both Graph and Crt. The routines that I put in graphcrt are the ones that are mainly used in these programs.
Instead of Delay you can use Sleep and SleepMicroSeconds (unit GPC).
just to get programs to compile (see below - perhaps there is a portable way to implement "Sound" and "NoSound" without using Crt?):
Since even with CRT there's no portable way, the answer is surely no. Currently it's only implemented for DJGPP and Linux. The Linux code only runs in a terminal (i.e., not under X11 where you usually run GRX programs). I don't know if there are X11 commands for such "beeps" (if someone know, we could probably support them, and this would be for all Unix compatible systems under X11). The DJGPP code might also run in graphics mode.
procedure clrscr; begin ClearDevice; end;
I also don't recommend this because it clears the graphics screen/window which may or may not be the same as the text screen/window.
What kind of programs are these?
Games, demos, etc.
If they use CRT routines to work in a graphics context, this isn't portable anyway, and I suggest to change the programs to use the appropriate Graph calls directly. (As I said, unless they really do graphics *and* text I/O.)
Many of them use Readkey and/or Keypressed, ClrScr, Delay, and Sound/NoSound. Readkey and Keypressed are conditionally implemented in the Graph unit. Delay can be implemented using Grx. What I tried to do was to avoid using the real Crt unit by using things that are available in Grx.
As I said, I just needed to get these programs to compile (under Mingw) - and it is easier to create the graphcrt unit than to change all the source files. Indeed, I can still compile the code under BP, because graphcrt is only used when the compiler is GPC.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) wrote:
What kind of programs are these?
Games, demos, etc.
Well, in this case be happy if you get them to compile with non-BP at all. (Am I too pessimistic? ;-)
If they use CRT routines to work in a graphics context, this isn't portable anyway, and I suggest to change the programs to use the appropriate Graph calls directly. (As I said, unless they really do graphics *and* text I/O.)
Many of them use Readkey and/or Keypressed, ClrScr, Delay, and Sound/NoSound. Readkey and Keypressed are conditionally implemented in the Graph unit. Delay can be implemented using Grx. What I tried to do was to avoid using the real Crt unit by using things that are available in Grx.
As I said, I just needed to get these programs to compile (under Mingw) - and it is easier to create the graphcrt unit than to change all the source files. Indeed, I can still compile the code under BP, because graphcrt is only used when the compiler is GPC.
Perhaps such compatibility wrappers (i.e., for BP programs that `uses' CRT, but don't really *use* CRT ;-) for `ClrScr' and `Delay' (and perhaps dummies for `Sound' and `NoSound') can be added conditionally to the Graph unit as well. You might want to suggest this code to the GRX maintainers. (Of course, programs that really use both GRX and CRT need to turn off the conditional, just like they do now with `KeyPressed' etc.)
Frank
On 3 Apr 2004 at 19:39, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
What kind of programs are these?
Games, demos, etc.
Well, in this case be happy if you get them to compile with non-BP at all. (Am I too pessimistic? ;-)
Yes ;). Actually, the chess program compiled eventually, and it even runs somewhat (emphasis on the word "somewhat" - there are problems ...). It was written by a college student in 1990 or therebout (for a school project) and it took only about 30 minutes to get it to compile with GPC. I guess it would run better if built under djgpp.
[...]
Perhaps such compatibility wrappers (i.e., for BP programs that `uses' CRT, but don't really *use* CRT ;-) for `ClrScr' and `Delay' (and perhaps dummies for `Sound' and `NoSound') can be added conditionally to the Graph unit as well. You might want to suggest this code to the GRX maintainers. (Of course, programs that really use both GRX and CRT need to turn off the conditional, just like they do now with `KeyPressed' etc.)
I will see if the GRX maintainers will talk to me ...
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) a écrit:
On 3 Apr 2004 at 0:05, Frank Heckenbach wrote:
Prof. Harley Flanders wrote:
Does anyone know how to get the Graph unit to compile?
Download GRX from the library page on the GPC website or from http://grx.gnu.de and follow the installation instructions.
Actually, that won't help him very much. He would first need to build GRX for Mingw. The makefile.w32 in the GRX package does not work (for one thing, all the "if exist ..." lines fail miserably, both under command.com and any other shell).
in fact it works under command.com, but you need to use mingw32-make instead of make, and set your DOS box parameters so that it sees only mingw and not msys. But you are right, it would be much more natural to have makefiles for msys.
The file requires a substantial
amount of editing before it can be used. Eventually, I ended up creating a "makefile.msys" which uses the MSYS tools for building the package (works for building for Mingw (i.e., native Windows) and MSYS targets, and also for Cygwin). Perhaps I should call it makefile.gnuwin32 ...
I am not sure who on the GRX team to send this file to. It is certainly needed for anyone who wishes to build GRX on Windows, using gcc.
Best regards, The Chief
Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
On 3 Apr 2004 at 16:42, Maurice Lombardi wrote:
[...]
Actually, that won't help him very much. He would first need to build GRX for Mingw. The makefile.w32 in the GRX package does not work (for one thing, all the "if exist ..." lines fail miserably, both under command.com and any other shell).
in fact it works under command.com, but you need to use mingw32-make instead of make, and set your DOS box parameters so that it sees only mingw and not msys.
Tried all that. Didn't work here - either under Win95 or XP.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) a écrit:
On 3 Apr 2004 at 16:42, Maurice Lombardi wrote:
[...]
Actually, that won't help him very much. He would first need to build GRX for Mingw. The makefile.w32 in the GRX package does not work (for one thing, all the "if exist ..." lines fail miserably, both under command.com and any other shell).
in fact it works under command.com, but you need to use mingw32-make instead of make, and set your DOS box parameters so that it sees only mingw and not msys.
Tried all that. Didn't work here - either under Win95 or XP.
Just retried to be sure (W98 dos box) mingw is set up with the following batch file:
REM ***** sample batch file to set up Mingw ***** rem without msys but with local rem where are the graphical libraries libpng.a etc, rem taken from https://sourceforge.net/projects/mingwrep/ rem and which do not depend on msys.dll (bad choice of location !!!) rem set prompt=MinGW: $p$g set PATH=c:\msys\1.0\local\bin;c:\MinGW\bin;c:\windows;c:\windows\command set LIBRARY_PATH=c:\msys\1.0\local\lib set C_INCLUDE_PATH=c:\msys\1.0\local\include set HOME=c:\lombardi\mingw32
grx246s was extracted in a temp directory (below my home), outside of mingw and msys trees
manual editing of makefile.grx, grx.pas, graph.pas.
then type
mingw32-make -f makefile.w32
The only correction was to eliminate --gpc-main=GRXMain in the two makefile.w32 under the pascal directory.
Anyway the msys solution is better. It would enable to run configure instead of manually editing the files. But configure has not yet the mingw target included.
Maurice
On 3 Apr 2004 at 21:48, Maurice Lombardi wrote:
Prof A Olowofoyeku (The African Chief) a écrit:
On 3 Apr 2004 at 16:42, Maurice Lombardi wrote:
[...]
Actually, that won't help him very much. He would first need to build GRX for Mingw. The makefile.w32 in the GRX package does not work (for one thing, all the "if exist ..." lines fail miserably, both under command.com and any other shell).
in fact it works under command.com, but you need to use mingw32-make instead of make, and set your DOS box parameters so that it sees only mingw and not msys.
Tried all that. Didn't work here - either under Win95 or XP.
Just retried to be sure (W98 dos box) mingw is set up with the following batch file:
REM ***** sample batch file to set up Mingw ***** rem without msys but with local rem where are the graphical libraries libpng.a etc, rem taken from https://sourceforge.net/projects/mingwrep/ rem and which do not depend on msys.dll (bad choice of location !!!) rem set prompt=MinGW: $p$g set PATH=c:\msys\1.0\local\bin;c:\MinGW\bin;c:\windows;c:\windows\command set LIBRARY_PATH=c:\msys\1.0\local\lib set C_INCLUDE_PATH=c:\msys\1.0\local\include set HOME=c:\lombardi\mingw32
grx246s was extracted in a temp directory (below my home), outside of mingw and msys trees
manual editing of makefile.grx, grx.pas, graph.pas.
then type
mingw32-make -f makefile.w32
Tried all that. Still no show (XP dos box).
"Mingw:D:\src\grx246\src>mingw32-make -f makefile.w32 if exist ..\lib\win32\libgrx20.a del ..\lib\win32\libgrx20.a exist: -c: line 2: syntax error: unexpected end of file mingw32-make: *** [../lib/win32/libgrx20.a] Error 258"
(and changing back slashes to front slashes doesn't help).
Here's stuff from my environment:
C_INCLUDE_PATH=d:\mingw\include GPC_UNIT_PATH=d:\gpc\obj;d:\gpc\sys;d:\gpc\winapi;d:\gpc\win32 LIBRARY_PATH=d:\mingw\lib;d:\usr\lib OS=Windows_NT Path=d:\mingw\bin;d:\msys\1.0\bin [.....]
And it doesn't work in a Win95 dos box either.
The only correction was to eliminate --gpc-main=GRXMain in the two makefile.w32 under the pascal directory.
Anyway the msys solution is better. It would enable to run configure instead of manually editing the files. But configure has not yet the mingw target included.
Yes, I am not using configure - just a tweaked makefile (which I have now sent to the GRX maintainers). Configure is not really needed here. If one has MSYS or Cygwin installed, the new makefile will work.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/