darrylo@HPSRDMO.HP.COM (Darryl Okahata) (11/09/89)
[ Doug & Mike: This time, the curses problems are *fixed*. ] Here are some patches for libg++ V1.36.1 that help it to compile under HP-UX; not all problems are fixed, but these patches take care of a number of them. Notes & problems fixed: 1. "DEFAULT_filebuf" should NOT be defined for HP-UX (this is mentioned in the top-level Makefile). This seems to cause more problems that it is worth. 2. The curses routines now work (both input and output). The problem is that the return values for the HP-UX curses routines are the *OPPOSITE* of what the libg++ library is expecting; for example, where the library expects a "1" to be returned for "no error", HP-UX returns "0" (similarly, instead of "0", HP-UX returns "-1"). I don't know if this is a BSD vs. SYSV problem (I don't know anything about curses on BSD), or if it's something else. The included patches fix this problem in a (hopefully) portable fashion. 3. In ctype.h, for USG systems, "_ctype_" is #defined to be "ctype". The replacement text is missing a leading underscore. 4. The "tFix" test generates differences from "expected.out". I feel that these differences are caused by differences in output buffer size. With the system used to generate "expected.out", the cout buffer is large enough to hold all of the output from tFix; as a result, the cout buffer is flushed at the end of the program, not during the program's execution, as it is done when running under HP-UX. Perhaps the test programs should occasionally flush the cout buffers, just so the "make runtests" will not return any differences. Kudos to Doug Lea for an excellent job! -- Darryl Okahata UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo Internet: darrylo%hpnmd@hpcea.HP.COM DISCLAIMER: this message is the author's personal opinion and does not constitute the support, opinion or policy of Hewlett-Packard or of the little green men that have been following him all day. =============================================================================== *** src/Curses.cc.~1~ Wed Nov 8 19:33:37 1989 --- src/Curses.cc Wed Nov 8 22:21:09 1989 *************** *** 45,50 char buf[BUFSIZ]; FILE b; b._flag = _IOREAD|_IOSTRG; b._ptr = buf; b._cnt = BUFSIZ; int result = wgetstr(w, buf); --- 45,51 ----- char buf[BUFSIZ]; FILE b; b._flag = _IOREAD|_IOSTRG; + b._base = buf; b._ptr = buf; b._cnt = BUFSIZ; int result = wgetstr(w, buf); *************** *** 48,54 b._ptr = buf; b._cnt = BUFSIZ; int result = wgetstr(w, buf); ! if (result != 0) result = _doscan(&b, fmt, args); va_end(args); return result; --- 49,55 ----- b._ptr = buf; b._cnt = BUFSIZ; int result = wgetstr(w, buf); ! if (result == OK) result = _doscan(&b, fmt, args); va_end(args); return result; *************** *** 61,66 char buf[BUFSIZ]; FILE b; b._flag = _IOREAD|_IOSTRG; b._ptr = buf; b._cnt = BUFSIZ; int result = wmove(w, y, x); --- 62,68 ----- char buf[BUFSIZ]; FILE b; b._flag = _IOREAD|_IOSTRG; + b._base = buf; b._ptr = buf; b._cnt = BUFSIZ; int result = wmove(w, y, x); *************** *** 64,70 b._ptr = buf; b._cnt = BUFSIZ; int result = wmove(w, y, x); ! if (result != 0) { result = wgetstr(w, buf); if (result != 0) --- 66,72 ----- b._ptr = buf; b._cnt = BUFSIZ; int result = wmove(w, y, x); ! if (result == OK) { result = wgetstr(w, buf); if (result == OK) *************** *** 67,73 if (result != 0) { result = wgetstr(w, buf); ! if (result != 0) result = _doscan(&b, fmt, args); } va_end(args); --- 69,75 ----- if (result == OK) { result = wgetstr(w, buf); ! if (result == OK) result = _doscan(&b, fmt, args); } va_end(args); *************** *** 100,106 va_start(args, fmt); char buf[BUFSIZ]; int result = wmove(w, y, x); ! if (result != 0) { #ifndef HAVE_VPRINTF FILE b; --- 102,108 ----- va_start(args, fmt); char buf[BUFSIZ]; int result = wmove(w, y, x); ! if (result == OK) { #ifndef HAVE_VPRINTF FILE b; *** g++-include/curses.h.~1~ Wed Nov 8 19:29:39 1989 --- g++-include/curses.h Wed Nov 8 19:30:15 1989 *************** *** 54,60 typedef char cbool; // curses explicitly declares bools as chars ! enum CursesStatus { ERR = 0, OK = 1 }; // curses lib uses define's /* * BSD'ish. Warning!! --- 54,64 ----- typedef char cbool; // curses explicitly declares bools as chars ! #if defined(hpux) ! enum CursesStatus { ERR = -1, OK = 0 }; // curses lib uses define's ! #else ! enum CursesStatus { ERR = 0, OK = 1 }; // curses lib uses define's ! #endif /* * BSD'ish. Warning!! *** g++-include/ctype.h.~1~ Wed Nov 8 18:00:34 1989 --- g++-include/ctype.h Wed Nov 8 18:30:50 1989 *************** *** 33,39 #endif #if defined(USG) || defined(hpux) ! #define _ctype_ ctype #endif extern CTYPE_TYPE _ctype_[]; --- 33,39 ----- #endif #if defined(USG) || defined(hpux) ! #define _ctype_ _ctype #endif extern "C" { *************** *** 36,41 #define _ctype_ ctype #endif extern CTYPE_TYPE _ctype_[]; inline int isalpha(char c) { return ((_ctype_+1)[c]&(_U|_L)); } --- 36,42 ----- #define _ctype_ _ctype #endif + extern "C" { extern CTYPE_TYPE _ctype_[]; } *************** *** 37,42 #endif extern CTYPE_TYPE _ctype_[]; inline int isalpha(char c) { return ((_ctype_+1)[c]&(_U|_L)); } inline int isupper(char c) { return ((_ctype_+1)[c]&_U); } --- 38,44 ----- extern "C" { extern CTYPE_TYPE _ctype_[]; + } inline int isalpha(char c) { return ((_ctype_+1)[c]&(_U|_L)); } inline int isupper(char c) { return ((_ctype_+1)[c]&_U); }