From: mrs@CYGNUS.COM (Mike Stump)
Subject: Patches for InterViews 3.1 beta2, wrt g++
Organization: Internet-USENET Gateway at Stanford University
Date: Mon, 7 Sep 1992 19:35:27 GMT

Below are the minimum required patches to InterViews 3.1 beta2 so that
it can be compiled with other implementations of C++, notably g++.

It seems that stdio.h is not required to be included by any of the
typical .h files, so one must explicitly include it.

One cannot use operator delete to delete a const pointer, namely this
that points to a const object, shame on your compiler for not throwing
fits when you tried to do that!  Mine does.  :-)

Make sure getwd is declared...

g++ no longer needs the size hint to delete [].

Make sure read is declared (it can be found in unistd.h in ALL g++
implementations because libg++ has a unistd.h header file).

Realize that #ifdef __GNUC__ won't work in that context, because
/lib/cpp is used, not g++ -E or some such.

Also, the RPC classes won't work out of the box with libg++, yet.

All of these patches should go into the official 3.1 release, with the
exception of the last two.  I provide them to illustrate the
limitation of not being able to ask if the compiler is g++ in the
local.def file and for completeness, if you want to compiler using
g++.

Note, so far I have only done a first pass test as this stuff, I have
yet to run any of the a.out generated to verify proper functionality.
All I know is that all software compiles.


					Happy Hacking,

					  Mike Stump
					  Cygnus Support


I leave on open offer to fix bugs people find in g++ that prevents it
from being able to correctly compile all of InterViews 3.1 beta (or
beta2).  Feel free to send detailed bug reports directly to me.  (Note,
saying ibuild core dumped the second time through is not helpful
enough for me to fix any specific problem.)


*** ./iv/src/bin/doc/Application.c.~1~	Fri Apr 10 22:28:38 1992
--- ./iv/src/bin/doc/Application.c	Mon Sep  7 11:01:23 1992
***************
*** 42,50 ****
  #include <fstream.h>
  #include <strstream.h>
  #include <string.h>
- #ifndef __GNUC__
  #include <stdlib.h>
- #endif
  #include <sys/types.h>
  #include <sys/stat.h>
  
--- 42,48 ----
*** ./iv/src/bin/ibuild/ibvars.c.~1~	Wed Jul 15 15:36:09 1992
--- ./iv/src/bin/ibuild/ibvars.c	Mon Sep  7 11:22:49 1992
***************
*** 41,46 ****
--- 41,47 ----
  
  #include <stream.h>
  #include <string.h>
+ #include <stdio.h>
  #include <stdlib.h>
  
  /*****************************************************************************/
***************
*** 363,369 ****
      if (s->_refcount != 0) {
          s->_refcount -= 1;
          if (s->_refcount == 0) {
!             delete this;
          }
      }
  }
--- 364,370 ----
      if (s->_refcount != 0) {
          s->_refcount -= 1;
          if (s->_refcount == 0) {
!             delete (SharedName *)this;
          }
      }
  }
*** ./iv/src/bin/ibuild/ibpanelctrl.c.~1~	Fri Apr 24 13:14:57 1992
--- ./iv/src/bin/ibuild/ibpanelctrl.c	Mon Sep  7 11:09:43 1992
***************
*** 59,64 ****
--- 59,65 ----
  #include <InterViews/transformer.h>
  
  #include <OS/math.h>
+ #include <stdio.h>
  #include <stream.h>
  #include <string.h>
  
*** ./iv/src/bin/ibuild/ibmenu.c.~1~	Fri Apr 24 13:14:57 1992
--- ./iv/src/bin/ibuild/ibmenu.c	Mon Sep  7 11:10:28 1992
***************
*** 58,63 ****
--- 58,64 ----
  
  #include <OS/memory.h>
  
+ #include <stdio.h>
  #include <stdlib.h>
  #include <stream.h>
  #include <string.h>
*** ./iv/src/bin/ibuild/ibinteractor.c.~1~	Fri Apr 24 13:14:56 1992
--- ./iv/src/bin/ibuild/ibinteractor.c	Mon Sep  7 11:11:22 1992
***************
*** 66,71 ****
--- 66,72 ----
  #include <InterViews/transformer.h>
  
  #include <math.h>
+ #include <stdio.h>
  #include <stdlib.h>
  #include <stream.h>
  #include <string.h>
*** ./iv/src/bin/ibuild/ibcomp.c.~1~	Fri Apr 24 13:14:53 1992
--- ./iv/src/bin/ibuild/ibcomp.c	Mon Sep  7 11:16:04 1992
***************
*** 53,58 ****
--- 53,59 ----
  #include <InterViews/event.h>
  #include <InterViews/transformer.h>
  
+ #include <stdio.h>
  #include <stdlib.h>
  #include <stream.h>
  #include <string.h>
*** ./iv/src/bin/ibuild/ibcommandctrl.c.~1~	Fri Apr 24 13:14:53 1992
--- ./iv/src/bin/ibuild/ibcommandctrl.c	Mon Sep  7 11:13:06 1992
***************
*** 52,57 ****
--- 52,58 ----
  #include <InterViews/transformer.h>
  
  #include <math.h>
+ #include <stdio.h>
  #include <stream.h>
  #include <string.h>
  
*** ./iv/src/bin/ibuild/ibcmds.c.~1~	Mon Jul 13 11:59:59 1992
--- ./iv/src/bin/ibuild/ibcmds.c	Mon Sep  7 11:25:49 1992
***************
*** 118,123 ****
--- 118,129 ----
  }
  #endif
  
+ #ifdef __GNUC__
+ extern "C" {
+   char *getwd(char *);
+ }
+ #endif
+ 
  /*****************************************************************************/
  
  char* GetDirName (const char* fullname) {
*** ./iv/src/bin/ibuild/ibbutton.c.~1~	Fri Apr 24 13:14:52 1992
--- ./iv/src/bin/ibuild/ibbutton.c	Mon Sep  7 11:33:17 1992
***************
*** 49,54 ****
--- 49,55 ----
  #include <InterViews/Bitmaps/radio.bm>
  
  #include <stream.h>
+ #include <stdio.h>
  #include <string.h>
  #include <stdlib.h>
  
*** ./iv/src/bin/ibuild/ibdialog.c.~1~	Fri Apr 24 13:14:54 1992
--- ./iv/src/bin/ibuild/ibdialog.c	Mon Sep  7 11:30:56 1992
***************
*** 36,41 ****
--- 36,42 ----
  #include <Unidraw/viewer.h>
  #include <Unidraw/catalog.h>
  #include <stream.h>
+ #include <stdio.h>
  #include <string.h>
  
  /*****************************************************************************/
*** ./iv/src/bin/ibuild/ibraster.c.~1~	Fri Apr 24 13:14:58 1992
--- ./iv/src/bin/ibuild/ibraster.c	Mon Sep  7 11:38:09 1992
***************
*** 33,38 ****
--- 33,39 ----
  #include <Unidraw/catalog.h>
  #include <Unidraw/Graphic/rasterrect.h>
  #include <stream.h>
+ #include <stdio.h>
  #include <string.h>
  
  /*****************************************************************************/
*** ./iv/src/bin/ibuild/ibcatalog.c.~1~	Mon Jul 13 10:49:42 1992
--- ./iv/src/bin/ibuild/ibcatalog.c	Mon Sep  7 11:35:37 1992
***************
*** 52,57 ****
--- 52,58 ----
  #include <InterViews/transformer.h>
  
  #include <ctype.h>
+ #include <stdio.h>
  #include <stdlib.h>
  #include <stream.h>
  #include <string.h>
*** ./iv/src/bin/ibuild/ibstencil.c.~1~	Fri Apr 24 13:14:59 1992
--- ./iv/src/bin/ibuild/ibstencil.c	Mon Sep  7 11:39:24 1992
***************
*** 33,38 ****
--- 33,39 ----
  #include <Unidraw/catalog.h>
  #include <Unidraw/Graphic/ustencil.h>
  #include <stream.h>
+ #include <stdio.h>
  #include <string.h>
  
  /*****************************************************************************/
*** ./iv/src/bin/idraw/idcatalog.c.~1~	Thu Sep  3 09:50:42 1992
--- ./iv/src/bin/idraw/idcatalog.c	Mon Sep  7 11:48:37 1992
***************
*** 49,54 ****
--- 49,55 ----
  #include <InterViews/transformer.h>
  
  #include <ctype.h>
+ #include <stdio.h>
  #include <stdlib.h>
  #include <stream.h>
  #include <string.h>
*** ./iv/src/config/InterViews/gcc.def.~1~	Thu Jul  2 11:04:33 1992
--- ./iv/src/config/InterViews/gcc.def	Sun Sep  6 17:15:56 1992
***************
*** 16,18 ****
--- 16,21 ----
  #ifndef ExtraCCLdLibs
  #define ExtraCCLdLibs -lg++
  #endif
+ 
+ #undef HasSunOSSharedLibraries
+ #define HasSunOSSharedLibraries NO
*** ./iv/src/lib/IV-X11/xwindow.c.~1~	Thu Sep  3 16:41:44 1992
--- ./iv/src/lib/IV-X11/xwindow.c	Sun Sep  6 18:13:04 1992
***************
*** 1315,1325 ****
  WindowVisual::~WindowVisual() {
      delete ctable_;
      delete rgbtable_;
- #ifdef __GNUC__
-     delete [localmapsize_] localmap_;
- #else
      delete [] localmap_;
- #endif
  }
  
  WindowVisual* WindowVisual::find_visual(Display* d, Style* s) {
--- 1315,1321 ----
*** ./iv/src/lib/OS/file.c.~1~	Mon Jul 13 11:58:38 1992
--- ./iv/src/lib/OS/file.c	Mon Sep  7 11:57:43 1992
***************
*** 45,50 ****
--- 45,54 ----
  #endif
  }
  
+ #ifdef __GNUC__
+ #include <unistd.h>
+ #endif
+ 
  class FileInfo {
  public:
      CopyString* name_;
*** ./iv/src/config/InterViews/local.def.~1~	Thu Sep  3 15:02:52 1992
--- ./iv/src/config/InterViews/local.def	Mon Sep  7 10:50:20 1992
***************
*** 8,16 ****
  /*
   * Get definitions from gcc.def if compiling with g++/gcc.
   */
! #ifdef __GNUC__
  #include <InterViews/gcc.def>
! #endif
  
  /*
   * Default customization of kits.
--- 8,16 ----
  /*
   * Get definitions from gcc.def if compiling with g++/gcc.
   */
! /* #ifdef __GNUC__ */
  #include <InterViews/gcc.def>
! /* #endif */
  
  /*
   * Default customization of kits.
***************
*** 27,36 ****
--- 27,38 ----
  -Ddefault_kit=SMFKit
  #endif
  
+ #if 0
  #if defined(SGIArchitecture) || defined(SunArchitecture)
  #undef BuildRPCClasses
  #define BuildRPCClasses YES
  #endif
+ #endif
  
  /*
   * Delete this definition if your /tmp space is less than five megabytes.