[gnu.g++.lib.bug] System V support for libg++ 1.35.0

ronald@UCDAVIS.EDU (05/29/89)

Here are some patches to make libg++ 1.35.0 compile on under System V.

libg++ was compiled by g++ 1.35.0, configured as 'i386v' with my
COFF patches.

All tests compiled! (with a little filename munging along the way,
this is a *lot* better than the 1.34.0 release)

These tests fail under i386:
	tBitString		tComplex
	tFile			tFix
	tFix16			tFix24
	tRandom			tRational
	tgwrapper		twrapper
	tCurses

More details on the failures in another message.
--
Ronald Cole               | uucp:     cvms!ronald       voice: +1 916 895 8321
Senior Software Engineer  | internet: csusac!cvms!ronald@ucdavis.edu
CVM Systems               +----------------------------------------------------
	"No sex, please, we're software engineers." - Michael Swaine

---------------------------- starts here -------------------------------
diff -rc2 libg++-1.35.0/g++-include/BitSet.h libg++/g++-include/BitSet.h
*** libg++-1.35.0/g++-include/BitSet.h	Sun May  7 08:08:54 1989
--- libg++/g++-include/BitSet.h	Sun May 28 13:33:31 1989
***************
*** 366,370 ****
  inline void BitSet::clear()
  {
!   if (rep->len > 0) bzero(rep->s, rep->sz * sizeof(short));
    rep->len = rep->virt = 0;
  }
--- 366,375 ----
  inline void BitSet::clear()
  {
!   if (rep->len > 0)
! #if defined(i386)
!     memset(rep->s, 0, rep->sz * sizeof(short));
! #else
!     bzero(rep->s, rep->sz * sizeof(short));
! #endif
    rep->len = rep->virt = 0;
  }
diff -rc2 libg++-1.35.0/g++-include/MPlex.ccP libg++/g++-include/MPlex.ccP
*** libg++-1.35.0/g++-include/MPlex.ccP	Sat May 13 03:01:39 1989
--- libg++/g++-include/MPlex.ccP	Sun May 28 13:35:25 1989
***************
*** 38,42 ****
--- 38,46 ----
    unsigned msize = (top - base)/_MAP_BITS + 1;
    map = (unsigned long *) (new long[msize]);
+ #if defined(i386)
+   memset((void*)map, 0, msize * sizeof(long));
+ #else
    bzero((void*)map, msize * sizeof(long));
+ #endif
  }
  
***************
*** 69,73 ****
--- 73,81 ----
    top = base + s;
    unused = 0;
+ #if defined(i386)
+   memset((void*)map, 0, ((top - base)/_MAP_BITS + 1) * sizeof(long));
+ #else
    bzero((void*)map, ((top - base)/_MAP_BITS + 1) * sizeof(long));
+ #endif
  }
  
diff -rc2 libg++-1.35.0/g++-include/Obstack.h libg++/g++-include/Obstack.h
*** libg++-1.35.0/g++-include/Obstack.h	Sun May  7 08:09:51 1989
--- libg++/g++-include/Obstack.h	Sun May 28 13:37:08 1989
***************
*** 127,131 ****
--- 127,135 ----
    if (nextfree+size > chunklimit) 
      newchunk(size);
+ #if defined(i386)
+   memcpy(nextfree, data, size);
+ #else
    bcopy(data, nextfree, size);
+ #endif
    nextfree += size; 
  }
***************
*** 135,139 ****
--- 139,147 ----
    if (nextfree+size+1 > chunklimit) 
      newchunk(size+1);
+ #if defined(i386)
+   memcpy(nextfree, data, size);
+ #else
    bcopy(data, nextfree, size);
+ #endif
    nextfree += size; 
    *(nextfree)++ = terminator; 
diff -rc2 libg++-1.35.0/g++-include/RPlex.ccP libg++/g++-include/RPlex.ccP
*** libg++-1.35.0/g++-include/RPlex.ccP	Sun May  7 08:21:33 1989
--- libg++/g++-include/RPlex.ccP	Sun May 28 13:38:55 1989
***************
*** 269,273 ****
--- 269,277 ----
        maxch *= 2;
        <T>IChunk** newch = new _<T>IChunk_ptr [maxch];
+ #if defined(i386)
+       memcpy(newch, chunks, fch * sizeof(_<T>IChunk_ptr));
+ #else
        bcopy(chunks, newch, fch * sizeof(_<T>IChunk_ptr));
+ #endif
        delete chunks;
        chunks = newch;
***************
*** 311,315 ****
--- 315,323 ----
        maxch *= 2;
        <T>IChunk** newch = new _<T>IChunk_ptr [maxch];
+ #if defined(i386)
+       memcpy(&(newch[lch]), chunks, lch * sizeof(_<T>IChunk_ptr));
+ #else
        bcopy(chunks, &(newch[lch]), lch * sizeof(_<T>IChunk_ptr));
+ #endif
        delete chunks;
        chunks = newch;
diff -rc2 libg++-1.35.0/g++-include/ctype.h libg++/g++-include/ctype.h
*** libg++-1.35.0/g++-include/ctype.h	Sun May  7 08:10:34 1989
--- libg++/g++-include/ctype.h	Sun May 28 13:41:01 1989
***************
*** 14,37 ****
  static const int _P = 020;
  static const int _C = 040;
  static const int _X = 0100;
  static const int _B = 0200;
     
! extern	char	_ctype_[];
     
! inline int isalpha(char c)  { return ((_ctype_+1)[c]&(_U|_L)); }
! inline int isupper(char c)  { return ((_ctype_+1)[c]&_U); }
! inline int islower(char c)  { return ((_ctype_+1)[c]&_L); }
! inline int isdigit(char c)  { return ((_ctype_+1)[c]&_N); }
! inline int isxdigit(char c) { return ((_ctype_+1)[c]&_X); }
! inline int isspace(char c)  { return ((_ctype_+1)[c]&_S); }
! inline int ispunct(char c)  { return ((_ctype_+1)[c]&_P); }
! inline int isalnum(char c)  { return ((_ctype_+1)[c]&(_U|_L|_N)); }
! inline int isprint(char c)  { return ((_ctype_+1)[c]&(_P|_U|_L|_N|_B)); }
! inline int isgraph(char c)  { return ((_ctype_+1)[c]&(_P|_U|_L|_N)); }
! inline int iscntrl(char c)  { return ((_ctype_+1)[c]&_C); }
  inline int isascii(char c)  { return ((unsigned)(c)<=0177); }
  inline int toupper(char c)  { return ((c)-'a'+'A'); }
  inline int tolower(char c)  { return ((c)-'A'+'a'); }
! inline int toascii(char c)  { return ((c)&0177); }
  
  #endif _ctype_h
--- 14,60 ----
  static const int _P = 020;
  static const int _C = 040;
+ #if defined(i386)
+ static const int _B = 0100;
+ static const int _X = 0200;
+ #else
  static const int _X = 0100;
  static const int _B = 0200;
+ #endif
+    
+ #if defined(i386)
+ #define CTYPE _ctype
+ #else
+ #define CTYPE _ctype_
+ #endif
     
! extern	char	CTYPE[];
     
! inline int isalpha(char c)  { return ((CTYPE+1)[c]&(_U|_L)); }
! inline int isupper(char c)  { return ((CTYPE+1)[c]&_U); }
! inline int islower(char c)  { return ((CTYPE+1)[c]&_L); }
! inline int isdigit(char c)  { return ((CTYPE+1)[c]&_N); }
! inline int isxdigit(char c) { return ((CTYPE+1)[c]&_X); }
! inline int isspace(char c)  { return ((CTYPE+1)[c]&_S); }
! inline int ispunct(char c)  { return ((CTYPE+1)[c]&_P); }
! inline int isalnum(char c)  { return ((CTYPE+1)[c]&(_U|_L|_N)); }
! inline int isprint(char c)  { return ((CTYPE+1)[c]&(_P|_U|_L|_N|_B)); }
! inline int isgraph(char c)  { return ((CTYPE+1)[c]&(_P|_U|_L|_N)); }
! inline int iscntrl(char c)  { return ((CTYPE+1)[c]&_C); }
  inline int isascii(char c)  { return ((unsigned)(c)<=0177); }
+ inline int toascii(char c)  { return ((c)&0177); }
+ #if defined(i386)
+ inline int _toupper(char c) { return ((CTYPE+258)[c]); }
+ inline int _tolower(char c) { return ((CTYPE+258)[c]); }
+ 
+ extern "C" {
+ 
+ int toupper(int);
+ int tolower(int);
+ 
+ }
+ #else
  inline int toupper(char c)  { return ((c)-'a'+'A'); }
  inline int tolower(char c)  { return ((c)-'A'+'a'); }
! #endif
  
  #endif _ctype_h
diff -rc2 libg++-1.35.0/g++-include/stdio.h libg++/g++-include/stdio.h
*** libg++-1.35.0/g++-include/stdio.h	Sun May  7 05:30:07 1989
--- libg++/g++-include/stdio.h	Sun May 28 13:47:20 1989
***************
*** 55,59 ****
  /* check and possibly comment out the following */
  
! #ifndef USG
  #define HAVE_BUFSIZ 
  #endif
--- 55,61 ----
  /* check and possibly comment out the following */
  
! #if defined(i386)
! #define DOES_8TH_BIT
! #else
  #define HAVE_BUFSIZ 
  #endif
***************
*** 66,71 ****
--- 68,78 ----
  extern  struct  _iobuf {
      int      _cnt;
+ #   ifdef DOES_8TH_BIT
+     unsigned char* _ptr;
+     unsigned char* _base;
+ #   else
      char*    _ptr;
      char*    _base;
+ #   endif
  #   ifdef HAVE_BUFSIZ
      int     _bufsiz;
***************
*** 86,92 ****
--- 93,105 ----
  #define _IOEOF    00020
  #define _IOERR    00040
+ #if defined(i386)
+ #define	_IOLBF    00100
+ #define	_IORW     00200
+ #define _IOSTRG   00400
+ #else
  #define _IOSTRG   00100
  #define _IOLBF    00200
  #define _IORW     00400
+ #endif
  #define _IOAPPEND 01000
  
***************
*** 101,108 ****
  #define stderr    (&_iob[2])
  
  #define getc(p) (--(p)->_cnt>=0?(int)(*(unsigned char*)(p)->_ptr++):_filbuf(p))
  #define putc(x,p) (--(p)->_cnt>=0? ((int)((unsigned char)((*(p)->_ptr++=(unsigned)(x))))):_flsbuf((unsigned)(x),p))
- 
  #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF))
  #define getchar()   getc(stdin)
  #define putchar(x)  putc(x,stdout)
--- 114,127 ----
  #define stderr    (&_iob[2])
  
+ #ifdef DOES_8TH_BIT
+ #define	getc(p) (--(p)->_cnt>=0?(int)*(p)->_ptr++:_filbuf(p))
+ #define putc(x,p) (--(p)->_cnt>=0? (int)(*(p)->_ptr++=(unsigned char)(x)):_flsbuf((unsigned char)(x),(p)))
+ #define clearerr(p) ((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
+ #else
  #define getc(p) (--(p)->_cnt>=0?(int)(*(unsigned char*)(p)->_ptr++):_filbuf(p))
  #define putc(x,p) (--(p)->_cnt>=0? ((int)((unsigned char)((*(p)->_ptr++=(unsigned)(x))))):_flsbuf((unsigned)(x),p))
  #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF))
+ #endif
+ 
  #define getchar()   getc(stdin)
  #define putchar(x)  putc(x,stdout)
diff -rc2 libg++-1.35.0/libconfig.h libg++/libconfig.h
*** libg++-1.35.0/libconfig.h	Sun May  7 04:52:16 1989
--- libg++/libconfig.h	Sun May 28 13:30:51 1989
***************
*** 80,84 ****
  #ifdef USG
  #define bzero(src, len)       memset((src), 0, (len))
! #define bcopy(src, dest, len) memcopy((dest), (src), (len))
  #define bcmp(s1,s2,n)         memcmp((s1),(s2),(n))
  #endif
--- 80,84 ----
  #ifdef USG
  #define bzero(src, len)       memset((src), 0, (len))
! #define bcopy(src, dest, len) memcpy((dest), (src), (len))
  #define bcmp(s1,s2,n)         memcmp((s1),(s2),(n))
  #endif
diff -rc2 libg++-1.35.0/src/File.cc libg++/src/File.cc
*** libg++-1.35.0/src/File.cc	Sun May  7 05:32:18 1989
--- libg++/src/File.cc	Sun May 28 13:30:54 1989
***************
*** 27,31 ****
--- 27,33 ----
  
  extern "C" {
+ #ifndef USG
  #include <sys/file.h>           // needed to determine values of O_RDONLY...
+ #endif
  
  #ifndef sun
diff -rc2 libg++-1.35.0/src/Makefile libg++/src/Makefile
*** libg++-1.35.0/src/Makefile	Sat May 13 10:35:23 1989
--- libg++/src/Makefile	Sun May 28 13:30:55 1989
***************
*** 1,3 ****
! # Makefile for g++ library version 1.34.0
  
  # Copyright (C) 1988 Free Software Foundation
--- 1,3 ----
! # Makefile for g++ library version 1.35.0
  
  # Copyright (C) 1988 Free Software Foundation
***************
*** 42,45 ****
--- 42,46 ----
  # gcc flags for c files
  CFLAGS= -g -O -I$I
+ #CFLAGS= -g -O -I$I -DUSG
  
  # g++ files should have extension .cc
***************
*** 116,117 ****
--- 117,119 ----
  Fix24.cc: $I/Fix24.h $I/File.h 
  CursesWindow.o: $I/curses.h $I/CursesWindow.h
+ 	$(GXX) $(GFLAGS) -c  $<
diff -rc2 libg++-1.35.0/src/Obstack.cc libg++/src/Obstack.cc
*** libg++-1.35.0/src/Obstack.cc	Thu Mar 30 02:59:52 1989
--- libg++/src/Obstack.cc	Sun May 28 13:30:57 1989
***************
*** 24,27 ****
--- 24,28 ----
  #include <builtin.h>
  #include <Obstack.h>
+ #include "libconfig.h"
  
  Obstack::Obstack(int size = 4092, int alignment = 4)
---------------------------- ends here -------------------------------