From: kunst AT prl DOT philips DOT nl Subject: Re: help with libgr or libgrx To: combee AT scrsu1 DOT SINet DOT SLB DOT COM (Leendert Combee) Date: Tue, 7 Dec 1993 14:06:35 +0100 (MET) Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP users list) Leendert Combee writes: > o Anyone using curses (part of contrib to djgpp) ? I'm having some > problem with proper response of getch(). The curses libraray on > the SUN station I use comes with cbreak() to handle keystrokes > properly, but I couldn't find the equivalent anywhere in curses > or the djgpp libs. I have used the curses in the DJGPP contrib too (thanks to Alan E.) but I switched over to a IMHO much better package, called 'pdcurses'. (See below.) I think it is a pity that 'pdcurses' is not yet part of the DJGPP contrib section. Perhaps Mark Hessling could give it a try... I can mail the DJGPP compiled lib + include files to anyone interested. The latest version also works nicely in a Windows DOS box (i.e. DPMI). You can obtain the full sources (and do the compile yourself) from: site: ftp.gu.edu.au 132.234.1.1 files: /src/PDCurses/pdcurs21.zip To compile the whole library with any C compiler, you'll need a copy of DMAKE as well, which can be obtained from: site: plg.uwaterloo.ca (129.97.140.10) file: pub/dmake/dmake38-msdos-exe.zip .^^^^^^^^ _____________________________________ | | / Pieter Kunst (P.J.) \ | _ _| / Philips Research Laboratories, \ .--(o)(o) / Building WY3, Prof. Holstlaan 4, \ |@ _) / 5656 AA Eindhoven, The Netherlands. | | ,___| / e-mail: kunst AT prl DOT philips DOT nl / | / \_______________________________________________/ /____\ ------------------------------------------------------------------------------ PDCURSES README files follow: ------------------------------------------------------------------------------ PDCurses 2.0 (Public Domain Curses for DOS and OS/2) INTRODUCTION: Well, here it finally is; PDCurses v2.0. PDCurses v2.0 is an almost total rewrite of PCCurses 1.4 done by John 'Frotz' Fa'atuai, the previous maintainer. This version has been tested with Microsoft C v6.0, QuickC v2.0 and Borland C++ 2.0 under DOS and Microsoft C v6.0 and TopSpeed c v3.02 under OS/2 2.0. Also the library has been compiled successfully with emx 0.8e, C Set/2 and Watcom 9. Most testing was done with the large memory model where applicable. The large memory model is probably the best model to use. The amount of testing has not been as extensive as I would have liked, but demands on releasing a product have outweighed the product's quality. Nothing new with that !! Hopefully with wider circulation, more bugs will be fixed more quickly. I have included just 1 makefile which is suitable for dmake 3.8 for both DOS and OS/2. The makefile does not rely on customisation of the dmake.ini file. If you discover bugs, and especially if you have fixes, please let me know ASAP. The source to the library is distributed as a zip file made with zip 1.9. You will need Info-ZIP unzip 5.0 to unzip. Follow the directions below to compile the library. DIRECTIONS: 1.Create a new directory in which to unzip pdcurs20.zip. This will create a curses directory and a number of subdirectories containing source code for the library and utilities and the documentation. 2.Make changes to the makefile where necessary: Change the MODEL or model macro to the appropriate value (if it applies to your compiler). Use model for Borland compilers. Change any paths in the defined macros to be suitable for your compiler. 3.Invoke DMAKE [-e environment_options] [target] where environment_options are: OS (host operating system) COMP (compiler) OPT (optimised version or debug version) - optional. default Y TOS (target operating system) - optional. default OS see the makefile for valid combinations targets: all, demos, lcursesd.lib, manual... NB. dmake is case sensitive with targets, so those environments that use an upper case model value (eg MSC) MUST specify the library target as for eg. Lcursesd.lib The makefile is by default set up for Borland C++. The use of -e environment_options override these defaults. Of you prefer you can just change the defaults in the makefile and invoke it without the -e switch. OTHER NOTES: The documentation for the library is built into each source file, a couple of specific doc files and the header files. A program is supplied (manext) to build the manual. This program gets compiled when you build the documentation. To generate the library response file correctly, I had to write a quick and dirty program (buildlrf) to achive this. Originally the makefiles just had statements like: "echo -+$(OBJ)\$* & >> $(LRF)" which appended a suitable line to the response file. Unfortunately under some combinations of makefiles and command processors (eg. nmake and 4DOS) the & would get treated as stderr and the echo command would fail. The original source for PDCurses that I received from the previous maintainer contained support for the FLEXOS operating system. Not having access to it, I could not test the changes I made so its support has fallen by the wayside. If you really need to have PDCurses running under FLEXOS, contact me and I will see what can be arranged. Under DOS, by default, screen writes to a CGA monitor are done via the video BIOS rather than by direct video memory writes. This is due to the CGA "snow" problem. If you have a CGA monitor and do not suffer from snow, you can compile private\_queryad.c with CGA_DIRECT defined. This will then use cause PDCurses to write directly to the CGA video memory. COMPILER-SPECIFIC NOTES: Microsoft C ----------- It is possible with MSC 6.0 to build the OS/2 libraries and demo programs from within DOS. This is the only case where it is possible to specifiy the value of TOS on the command line to be OS2 and the value of OS be DOS. C Set/2 ------- I have only tested the library using the migration libraries. I doubt that the demo programs will work without them. emx --- Testing has been done with 0.8e of emx together with the 16_to_32 libraries. The emx\lib directory should include the vio32.lib and kbd32.lib libraries from the 16_to_32 package. BUGS and UNFINISHED BUSINESS: PDC_set_ctrl_break() function does not work under OS/2. win_print() and PDC_print() do not work under OS/2. The file todo.man in the doc directory also lists those functions of System V 3.2 curses not yet implemented. Any volunteers ? ACKNOWLEGEMENTS: John 'Frotz' Fa'atuai, the previous maintainer for providing an excellent base for further development. John Burnell (johnb AT kea DOT am DOT dsir DOT govt DOT nz), for the OS/2 port. John Steele, Jason (finally NOT a John) Shumate.... for various fixes and suggestions. Eberhardt Mattes (author of emx) for allowing code based on his C library to be included with PDCurses. Several others for their support, moral and actual. Good luck, Mark ------------------------------------------------------------------------ Mark Hessling email: M DOT Hessling AT itc DOT gu DOT edu DOT au DBA, ITS phone: + 61 7 875 7691 Griffith University fax: + 61 7 875 7787 Nathan 4111 Qld Australia *** PDCurses maintainer *** ------------------------------------------------------------------------ PDCurses 2.1 (beta) (Public Domain Curses for DOS, OS/2 and UNIX) INTRODUCTION: The first thing that obviously needs mentioning is the title above. The current code contains bug fixes for the DOS and OS/2 releases and also includes an alpha release for Unix. The Unix release uses another public domain package (mytinfo) to handle the low-level screen writes. mytinfo was posted to comp.sources.unix (or misc) in December 1992 or January 1993. Unless you are a glutton for punishment I would recommend you avoid the Unix port at this stage. The other major addition to PDCurses is the support for DJGPP (the DOS port of GNU C++). Thanks to David Nugent (davidn AT csource DOT oz DOT au). Other additions are copywin() function, function debugging support and getting the small and medium memory models to work. The testcurs.c demo program has also been changed significantly and a new demo program, tuidemo, has been added. Some people have suggested including information on where to get dmake from. ???(yet to fill this in)???? OTHER NOTES: Under DOS, by default, screen writes to a CGA monitor are done via the video BIOS rather than by direct video memory writes. This is due to the CGA "snow" problem. If you have a CGA monitor and do not suffer from snow, you can compile private\_queryad.c with CGA_DIRECT defined. This will then use cause PDCurses to write directly to the CGA video memory. Function debugging: Firstly to get function debugging, you have to compile the library with OPT=N in the makefile. This also turns on compiler debugging. You can control when you want PDCurses to write to the debug file (called trace in the current directory) by using the functions traceon() and traceoff() in your program. Microsoft C 6.00 Users note: ---------------------------- With the addition of several new functions, using dmake to compile PDCurses now causes the compiler to run "out of heap space in pass 2". Using the 6.00AX version (DOS-Extended) to compile PDCurses fixes this problem; hence the -EM switch. Functional changes ------------------ A few curses functions have been fixed to exhibit their correct behaviour and make them more functionally portable with System V curses. The functions that have changed are overlay(), overwrite() and typeahead. overlay() and overwrite() Both of theses functions in PDCurses 2.0 allowed for one window to be effectively placed on top of another, and the characters in the first window were overlayed or overwritten starting at 0,0 in both windows. This behaviour of these functions was not correct. These functions only operate on windows that physically overlap with respect to the displayed screen. To achieve the same functionality as before, use the new function copywin(). See the manual page for further details. typeahead() This function in PDCurses 2.0 effectively checked to see if there were any characters remaining in the keyboard buffer. This is not the behaviour exhibited by System V curses. This function is intended purely to set a flag so that curses can check while updating the physical screen if any keyboard input is pending. To achieve the same effect with typeahead() under PDCurses 2.1 the following code should be used. In place of... while(!typeahead(stdin)) { /* do something until any key is pressed... */ } use... nodelay(stdscr,TRUE); /* getch() to return ERR if no key pending */ while(getch() == (ERR)) { /* do something until any key is pressed... */ } ACKNOWLEGEMENTS: (in no particlar order) Jason Shumate,Pieter Kunst,David Nugent,Andreas Otte, Pasi Hamalainen,James McLennan,Duane Paulson,Ib Hojme Apologies to anyone I may have left out. Cheers, Mark ------------------------------------------------------------------------ Mark Hessling email: M DOT Hessling AT gu DOT edu DOT au DBA, ITS phone: + 61 7 875 7691 Griffith University fax: + 61 7 875 7787 Nathan 4111 Qld Australia *** PDCurses maintainer *** ------------------------------------------------------------------------