From 78897e25632d8b72aa8ec9b3427675185e24a31a Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 20 Jan 2003 15:52:42 +0000 Subject: [PATCH] build on Irix --- dtool/Config.Irix.pp | 9 +++++---- dtool/Config.Linux.pp | 6 +++++- dtool/Config.Win32.pp | 6 +++++- dtool/LocalSetup.pp | 12 ++++++++---- dtool/src/cppparser/cppBisonDefs.h | 9 +++++++++ dtool/src/dconfig/notify.cxx | 10 +++++----- dtool/src/dconfig/notify.h | 2 +- dtool/src/dtoolbase/dtoolbase_cc.h | 13 +++++++++++++ dtool/src/dtoolutil/executionEnvironment.I | 2 +- dtool/src/dtoolutil/filename.cxx | 8 ++++---- dtool/src/dtoolutil/pfstreamBuf.cxx | 5 ----- 11 files changed, 56 insertions(+), 26 deletions(-) diff --git a/dtool/Config.Irix.pp b/dtool/Config.Irix.pp index 062edf5333..cca673256d 100644 --- a/dtool/Config.Irix.pp +++ b/dtool/Config.Irix.pp @@ -17,9 +17,6 @@ // Does the C++ compiler support namespaces? #define HAVE_NAMESPACE 1 -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY - // How about the typename keyword? #define HAVE_TYPENAME 1 @@ -45,8 +42,12 @@ // Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? #define IOCTL_TERMINAL_WIDTH 1 -// Do the compiler or the system headers define a "streamsize" typedef? +// Do the system headers define a "streamsize" typedef? How about the +// ios::binary enumerated value? And other ios typedef symbols like +// ios::openmode and ios::fmtflags? #define HAVE_STREAMSIZE +#define HAVE_IOS_BINARY +#define HAVE_IOS_TYPEDEFS // Can we safely call getenv() at static init time? #define STATIC_INIT_GETENV 1 diff --git a/dtool/Config.Linux.pp b/dtool/Config.Linux.pp index e8edd7db54..28f50f1539 100644 --- a/dtool/Config.Linux.pp +++ b/dtool/Config.Linux.pp @@ -45,8 +45,12 @@ // Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? #define IOCTL_TERMINAL_WIDTH 1 -// Do the compiler or the system headers define a "streamsize" typedef? +// Do the system headers define a "streamsize" typedef? How about the +// ios::binary enumerated value? And other ios typedef symbols like +// ios::openmode and ios::fmtflags? #define HAVE_STREAMSIZE 1 +#define HAVE_IOS_BINARY 1 +#define HAVE_IOS_TYPEDEFS 1 // Can we safely call getenv() at static init time? #define STATIC_INIT_GETENV diff --git a/dtool/Config.Win32.pp b/dtool/Config.Win32.pp index 105ed950e2..5338eaf92c 100644 --- a/dtool/Config.Win32.pp +++ b/dtool/Config.Win32.pp @@ -45,8 +45,12 @@ // Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? #define IOCTL_TERMINAL_WIDTH -// Do the compiler or the system headers define a "streamsize" typedef? +// Do the system headers define a "streamsize" typedef? How about the +// ios::binary enumerated value? And other ios typedef symbols like +// ios::openmode and ios::fmtflags? #define HAVE_STREAMSIZE 1 +#define HAVE_IOS_BINARY 1 +#define HAVE_IOS_TYPEDEFS 1 // Can we safely call getenv() at static init time? #define STATIC_INIT_GETENV 1 diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index 4bc70c18d8..cfc4833be6 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -134,9 +134,6 @@ $[cdefine WORDS_BIGENDIAN] /* Define if the C++ compiler uses namespaces. */ $[cdefine HAVE_NAMESPACE] -/* Define if the C++ iostream library supports ios::binary. */ -$[cdefine HAVE_IOS_BINARY] - /* Define if fstream::open() accepts a third parameter for umask. */ $[cdefine HAVE_OPEN_MASK] @@ -165,9 +162,16 @@ $[cdefine HAVE_GETOPT_LONG_ONLY] /* Define if you have ioctl(TIOCGWINSZ) to determine terminal width. */ $[cdefine IOCTL_TERMINAL_WIDTH] -/* Do the compiler or the system headers define a "streamsize" typedef? */ +/* Do the system headers define a "streamsize" typedef? */ $[cdefine HAVE_STREAMSIZE] +/* Do the system headers define key ios typedefs like ios::openmode + and ios::fmtflags? */ +$[cdefine HAVE_IOS_TYPEDEFS] + +/* Define if the C++ iostream library defines ios::binary. */ +$[cdefine HAVE_IOS_BINARY] + /* Can we safely call getenv() at static init time? */ $[cdefine STATIC_INIT_GETENV] diff --git a/dtool/src/cppparser/cppBisonDefs.h b/dtool/src/cppparser/cppBisonDefs.h index 7fe0b0a5f6..573aa05e19 100644 --- a/dtool/src/cppparser/cppBisonDefs.h +++ b/dtool/src/cppparser/cppBisonDefs.h @@ -97,10 +97,19 @@ public: // lexer. struct cppyyltype { + // Bison expects these members to be part of this struct. int first_line; int first_column; int last_line; int last_column; + + // Early versions of bison (1.25 and earlier) expected these members + // to be in this struct as well. + int timestamp; + char *text; + + // The remaining members are added for this application and have no + // meaning to bison. CPPFile file; }; #define YYLTYPE cppyyltype diff --git a/dtool/src/dconfig/notify.cxx b/dtool/src/dconfig/notify.cxx index 5b7ed455d8..118956fbc9 100644 --- a/dtool/src/dconfig/notify.cxx +++ b/dtool/src/dconfig/notify.cxx @@ -109,18 +109,18 @@ get_ostream_ptr() const { // case this does nothing. But the flag is available in // case any extended types want to make use of it. //////////////////////////////////////////////////////////////////// -ios::fmtflags Notify:: +ios_fmtflags Notify:: get_literal_flag() { static bool got_flag = false; - static ios::fmtflags flag; + static ios_fmtflags flag; if (!got_flag) { #ifndef HAVE_IOSTREAM flag = ios::bitalloc(); #else - // We lost bitalloc in the new iostream? This feature will just be - // disabled for now. No big deal. - flag = (ios::fmtflags)0; + // We lost bitalloc in the new iostream? Ok, this feature will + // just be disabled for now. No big deal. + flag = (ios_fmtflags)0; #endif got_flag = true; } diff --git a/dtool/src/dconfig/notify.h b/dtool/src/dconfig/notify.h index 91f675d6a4..179db6168b 100644 --- a/dtool/src/dconfig/notify.h +++ b/dtool/src/dconfig/notify.h @@ -75,7 +75,7 @@ PUBLISHED: static Notify *ptr(); public: - static ios::fmtflags get_literal_flag(); + static ios_fmtflags get_literal_flag(); bool assert_failure(const char *expression, int line, const char *source_file); diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index 8dc355f5ea..30ca8f59b6 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -74,6 +74,19 @@ using namespace std; #define TYPENAME #endif +#ifndef HAVE_STREAMSIZE +// Some compilers (notably SGI) don't define this for us +typedef int streamsize; +#endif /* HAVE_STREAMSIZE */ + +#ifndef HAVE_IOS_TYPEDEFS +typedef int ios_openmode; +typedef int ios_fmtflags; +#else +typedef ios::openmode ios_openmode; +typedef ios::fmtflags ios_fmtflags; +#endif + #if defined(WIN32_VC) && defined(FORCE_INLINING) // If FORCE_INLINING is defined, we use the keyword __forceinline, diff --git a/dtool/src/dtoolutil/executionEnvironment.I b/dtool/src/dtoolutil/executionEnvironment.I index cf1ce5f493..c571d0a827 100644 --- a/dtool/src/dtoolutil/executionEnvironment.I +++ b/dtool/src/dtoolutil/executionEnvironment.I @@ -48,7 +48,7 @@ get_environment_variable(const string &var) { //////////////////////////////////////////////////////////////////// INLINE void ExecutionEnvironment:: set_environment_variable(const string &var, const string &value) { - return get_ptr()->ns_set_environment_variable(var, value); + get_ptr()->ns_set_environment_variable(var, value); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index 2b8fdb943d..194507498a 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -1171,7 +1171,7 @@ bool Filename:: open_read(ifstream &stream) const { assert(is_text() || is_binary()); - ios::openmode open_mode = ios::in; + ios_openmode open_mode = ios::in; #ifdef HAVE_IOS_BINARY // For some reason, some systems (like Irix) don't define @@ -1206,7 +1206,7 @@ bool Filename:: open_write(ofstream &stream, bool truncate) const { assert(is_text() || is_binary()); - ios::openmode open_mode = ios::out; + ios_openmode open_mode = ios::out; if (truncate) { open_mode |= ios::trunc; @@ -1256,7 +1256,7 @@ bool Filename:: open_append(ofstream &stream) const { assert(is_text() || is_binary()); - ios::openmode open_mode = ios::app; + ios_openmode open_mode = ios::app; #ifdef HAVE_IOS_BINARY // For some reason, some systems (like Irix) don't define @@ -1292,7 +1292,7 @@ bool Filename:: open_read_write(fstream &stream) const { assert(is_text() || is_binary()); - ios::openmode open_mode = ios::in | ios::out; + ios_openmode open_mode = ios::in | ios::out; #ifdef HAVE_IOS_BINARY // For some reason, some systems (like Irix) don't define diff --git a/dtool/src/dtoolutil/pfstreamBuf.cxx b/dtool/src/dtoolutil/pfstreamBuf.cxx index 42f5434307..3d139a3f56 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.cxx +++ b/dtool/src/dtoolutil/pfstreamBuf.cxx @@ -19,11 +19,6 @@ #include "pfstreamBuf.h" #include -#ifndef HAVE_STREAMSIZE -// Some compilers (notably SGI) don't define this for us -typedef int streamsize; -#endif /* HAVE_STREAMSIZE */ - PipeStreamBuf::PipeStreamBuf(PipeStreamBuf::Direction dir) : _dir(dir) {