Xref: news2.mv.net comp.os.msdos.djgpp:1395 From: "Markus F.X.J. Oberhumer" Newsgroups: comp.os.msdos.djgpp Subject: djgpp v2 patches, bug reports, questions, suggestions (long) Date: Sat, 24 Feb 1996 18:03:51 -0800 Organization: Johannes Kepler University Linz Lines: 241 Message-ID: <312FC387.7266@jk.uni-linz.ac.at> NNTP-Posting-Host: pc29.edu.uni-linz.ac.at Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp =============================================================================== Markus F.X.J. Oberhumer Subject: djgpp v2 patches, bug reports, questions, suggestions (long) =============================================================================== Hello, many thanks to DJ, Charles and all of you out there. You really did a great job in creating djgpp v2 ! I've been using emx+gcc for DOS for the last three years, mostly because go32 was not very stable and the libraries were somewhat incomplete. But now I'm switching over to djgpp. Hopefully we can make it as reliable as the emx package. This posting contains a variety of things I noticed since I've downloaded the offical v2 version. Hope you find it useful. Best regards, Markus /***********************************************************************// Meta questions: ************************************************************************/ I've downloaded the FAQ (Feb 21) but some points are still not clear to me: - where exactly should I send (longer) library patches - where exactly should I send (longer) patches regarding djgpp specific problems of the GNU utilities or gcc - where can I get an archived version of the mailing list (for doing a grep if I'm searching some information) Maybe you could setup separate mail accounts for each of these. I don't want to send (possibly annoying) personal mail for every trivial patch/bug I've found, but I DO want to send it if I think it should be fixed or noticed. /***********************************************************************// patch1 - ************************************************************************/ *** assert.org Mon Mar 20 09:15:12 1995 --- assert.h Sat Feb 17 19:25:08 1996 *************** *** 5,11 **** #if defined(NDEBUG) ! #define assert(test) (void)0 #else ! #define assert(test) ((test)?0:__dj_assert(#test,__FILE__,__LINE__)) #endif --- 5,11 ---- #if defined(NDEBUG) ! #define assert(test) ((void)0) #else ! #define assert(test) ((test)?(void)0:__dj_assert(#test,__FILE__,__LINE__)) #endif Rationale: the second line produces warnings, the first line is cleaner /***********************************************************************// patch2 - ************************************************************************/ *** conio.org Wed Sep 06 06:33:46 1995 --- conio.h Sat Feb 17 19:41:10 1996 *************** *** 76,79 **** --- 76,80 ---- void highvideo(void); void insline(void); + int kbhit(void); void lowvideo(void); int movetext(int _left, int _top, int _right, int _bottom, int _destleft, int _desttop); Rationale: #include #include #undef kbhit /* want to be able to call kbhit from pc.h */ --> now you have no prototype for kbhit() /***********************************************************************// bug 1: errno should be set to EINVAL // bug 2: sigaction() does not fail // bug 3: signal() / sigaction() mismatch ************************************************************************/ #include #include #include #include static void my_signal_handler(int signum) { exit(255); } #if !defined(NSIG) && defined(SIGMAX) # define NSIG (SIGMAX + 1) #endif int main(int argc, char *argv[]) { struct sigaction sa; errno = 0; if (signal(0,SIG_IGN) == SIG_ERR) { /* bug 1: errno is 0 but should be EINVAL */ fprintf(stderr,"signal() 1 error %d",errno); perror(""); } errno = 0; if (signal(NSIG,SIG_IGN) == SIG_ERR) { /* bug 1: errno is 0 but should be EINVAL */ fprintf(stderr,"signal() 2 error %d",errno); perror(""); } if (sigaction(NSIG,NULL,&sa) == 0) { /* bug 2: the sigaction() above does not fail */ fprintf(stderr,"sigaction() 1 succeeded.\n"); } if (sigaction(0,NULL,&sa) == 0) { /* bug 2 ?? : the sigaction() above does not fail */ fprintf(stderr,"sigaction() 2 succeeded.\n"); } if (sigaction(SIGINT,NULL,&sa) != 0) { perror("sigaction SIGINT"); exit(1); } if (signal(SIGINT,SIG_IGN) != sa.sa_handler) fprintf(stderr,"signal() / sigaction() mismatch 1\n"); if (signal(SIGINT,my_signal_handler) == SIG_ERR) { perror("signal SIGINT"); exit(1); } if (sigaction(SIGINT,NULL,&sa) != 0) { perror("sigaction SIGINT"); exit(1); } if (signal(SIGINT,SIG_IGN) != sa.sa_handler) /* bug 3: signal() / sigaction() mismatch */ fprintf(stderr,"signal() / sigaction() mismatch 2\n"); return 0; } /***********************************************************************// non ANSI/POSIX extensions to make porting more easy ? ************************************************************************/ make a forwarder for define NSIG and/or _NSIG in /***********************************************************************// questions to you DPMI gurus ************************************************************************/ I'm the author of libkb, an advanced and portable low-level keyboard library for Linux and MSDOS. libkb is already running fine with djgpp v1 for a longer time (also in a Windows DOS box) and now I've ported it to djgpp v2. libkb basically locks interrupt memory and installs a protected mode interrupt handler for int 9. Everything works ok with CWSDPMI and QEMM+QDPMI, but there are serious troubles in a Windows 3.1 DOS box when I run my VGA demo program. The graphics keeps moving, but the keyboard doesn't respond any more - even the Windows hot keys are dead - and I have to do a cold boot. This can occur the first time when I start it, but mostly around the 5th or 6th time and I've never been able to start it more than 15 times (of course I'm using just one DOS box). In short: I'm in a full screen box, the demo program terminates, I start it again - the keyboard is dead I've tried the following things: - lock ALL memory by hand (I have 20MB, there is no swapping activity) - use _CRT0_FLAG_LOCK_MEMORY and other CRT0 flags - install an additional real-mode handler but that doesn't help. What else can I do ? One more question: I'm also using Watcom C/32 v10.5, and I've never experienced any problems of this sort (using DOS4/GW and PMODE/W). I don't need to (better: I cannot) lock any memory, I just call _dos_setvect as I would do in a 16 bit program - that's it, and everthing works fine. libkb + VGA graphics + the nice MikMod sound library run without any problems in a Windows DOS box (even playing MOD-files while running in the background) ! Why do we have that much troubles with djgpp, MikMod and sb_lib also don't work in a DOS box ? Hint for the FAQ maintainer: - MikMod: a portable soundsystem for playing music & soundfx on various systems & compilers written by Jean-Paul Mikkers I downloaded MikMod from http://www.sedona.net/~mud/mikm209bd.zip. Hopefully we will see it in v2tk or contrib soon. /***********************************************************************// a little wishlist ************************************************************************/ next release of gcc: include Richard W.M. Jones's bounds checking patches include the Pentium optimization contributed by Intel next release of libc: include the new rx 1.0 GNU regexp library a port of Perl 5 (5.002) would be really nice what about a port of the Unix shells bash/zsh/tcsh ? Ok, that's it (for now :-). Keep on the good work, Markus Markus F.X.J. Oberhumer Visit my homepage http://www.infosys.tuwien.ac.at/Staff/lux/marco