From: Peter Howkins Date: Wed, 11 Apr 2012 17:03:23 +0000 (+0100) Subject: Linux compilation of nsgmls (Matthew Howkins) X-Git-Tag: 2.2.0a~26^2~48 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e60d58be07c4f408f5988c855aec122c2c10786b;p=oweals%2Fcde.git Linux compilation of nsgmls (Matthew Howkins) --- diff --git a/cde/programs/nsgmls/CmdLineApp.C b/cde/programs/nsgmls/CmdLineApp.C index 99c8b1dc..b2f74684 100644 --- a/cde/programs/nsgmls/CmdLineApp.C +++ b/cde/programs/nsgmls/CmdLineApp.C @@ -58,8 +58,14 @@ #include "ConsoleOutput.h" +#if defined(linux) +#include +#include +using namespace std; +#else #include #include +#endif #include #include #include @@ -285,8 +291,12 @@ Boolean CmdLineApp::openFilebufWrite(filebuf &file, if (fd < 0) return 0; return file.attach(fd) != 0; +#else +#if defined(linux) + return file.open(filename, ios::out|ios::trunc) != 0; #else return file.open(filename, ios::out|ios::trunc|IOS_BINARY) != 0; + #endif #endif } diff --git a/cde/programs/nsgmls/CmdLineApp.h b/cde/programs/nsgmls/CmdLineApp.h index ce53dd39..98f57736 100644 --- a/cde/programs/nsgmls/CmdLineApp.h +++ b/cde/programs/nsgmls/CmdLineApp.h @@ -43,7 +43,12 @@ #include #endif +#if defined(linux) +#include +using namespace std; +#else class filebuf; +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/CodingSystem.C b/cde/programs/nsgmls/CodingSystem.C index 6d230a68..ad7935a7 100644 --- a/cde/programs/nsgmls/CodingSystem.C +++ b/cde/programs/nsgmls/CodingSystem.C @@ -33,8 +33,12 @@ #ifdef SP_SHORT_HEADERS #include #else +#if defined(linux) +#include +#else #include #endif +#endif #include #include @@ -78,7 +82,11 @@ String OutputCodingSystem::convertOut(const StringC &str) const encoder->output(copy.data(), copy.size(), &stream); delete encoder; char *s = stream.str(); +#if defined(linux) + String result(s, stream.pcount()); +#else String result(s, stream.out_waiting()); +#endif result += '\0'; stream.freeze(0); #ifdef __lucid diff --git a/cde/programs/nsgmls/CodingSystem.h b/cde/programs/nsgmls/CodingSystem.h index c3b1fc37..e073ae5c 100644 --- a/cde/programs/nsgmls/CodingSystem.h +++ b/cde/programs/nsgmls/CodingSystem.h @@ -41,7 +41,12 @@ #include +#if defined(linux) +#include +using namespace std; +#else class streambuf; +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/EUCJPCodingSystem.C b/cde/programs/nsgmls/EUCJPCodingSystem.C index 4b9d1541..f2fb30ef 100644 --- a/cde/programs/nsgmls/EUCJPCodingSystem.C +++ b/cde/programs/nsgmls/EUCJPCodingSystem.C @@ -29,7 +29,11 @@ #ifdef SP_MULTI_BYTE #include "EUCJPCodingSystem.h" +#if defined(linux) +#include +#else #include +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/Fixed2CodingSystem.C b/cde/programs/nsgmls/Fixed2CodingSystem.C index 2bd5d958..8114f7e9 100644 --- a/cde/programs/nsgmls/Fixed2CodingSystem.C +++ b/cde/programs/nsgmls/Fixed2CodingSystem.C @@ -34,7 +34,11 @@ #include "Fixed2CodingSystem.h" #include "macros.h" +#if defined(linux) +#include +#else #include +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/IdentityCodingSystem.C b/cde/programs/nsgmls/IdentityCodingSystem.C index 4322e3fe..6f0e472b 100644 --- a/cde/programs/nsgmls/IdentityCodingSystem.C +++ b/cde/programs/nsgmls/IdentityCodingSystem.C @@ -26,7 +26,11 @@ #include "splib.h" #include "IdentityCodingSystem.h" +#if defined(linux) +#include +#else #include +#endif #include #ifdef SP_NAMESPACE diff --git a/cde/programs/nsgmls/Imakefile b/cde/programs/nsgmls/Imakefile index 1ab9e484..166bb666 100644 --- a/cde/programs/nsgmls/Imakefile +++ b/cde/programs/nsgmls/Imakefile @@ -91,9 +91,12 @@ CXXOPTIONS = \ /* * Flags passed into compile step when doing manual template instantiation. */ -CXXTEMPLATEFLAGS = -ptf +CXXTEMPLATEFLAGS = M4 = /usr/bin/m4 + +CXXEXTRA_DEFINES = -fpermissive + #endif #if defined(RsArchitecture) diff --git a/cde/programs/nsgmls/OutputCharStream.C b/cde/programs/nsgmls/OutputCharStream.C index 58ed0223..fd1f7584 100644 --- a/cde/programs/nsgmls/OutputCharStream.C +++ b/cde/programs/nsgmls/OutputCharStream.C @@ -28,7 +28,11 @@ #include "OutputCharStream.h" #include "CodingSystem.h" #include "macros.h" +#if defined(linux) +#include +#else #include +#endif #include #ifdef SP_NAMESPACE @@ -144,7 +148,11 @@ void IosOutputCharStream::flush() encoder_->output(buf_, ptr_ - buf_, byteStream_); ptr_ = buf_; } +#if defined(linux) + byteStream_->pubsync(); +#else byteStream_->sync(); +#endif } void IosOutputCharStream::flushBuf(Char c) diff --git a/cde/programs/nsgmls/OutputCharStream.h b/cde/programs/nsgmls/OutputCharStream.h index e823eda0..15088bb4 100644 --- a/cde/programs/nsgmls/OutputCharStream.h +++ b/cde/programs/nsgmls/OutputCharStream.h @@ -33,7 +33,12 @@ #include "Owner.h" #include "CodingSystem.h" +#if defined(linux) +#include +using namespace std; +#else class streambuf; +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/OwnerTable.C b/cde/programs/nsgmls/OwnerTable.C index 6607632e..8b657245 100644 --- a/cde/programs/nsgmls/OwnerTable.C +++ b/cde/programs/nsgmls/OwnerTable.C @@ -34,15 +34,15 @@ namespace SP_NAMESPACE { template OwnerTable::~OwnerTable() { - for (size_t i = 0; i < vec_.size(); i++) - delete vec_[i]; + for (size_t i = 0; i < this->vec_.size(); i++) + delete this->vec_[i]; } template void OwnerTable::clear() { - for (size_t i = 0; i < vec_.size(); i++) - delete vec_[i]; + for (size_t i = 0; i < this->vec_.size(); i++) + delete this->vec_[i]; PointerTable::clear(); } @@ -50,12 +50,12 @@ template void CopyOwnerTable::operator=(const CopyOwnerTable &t) { - clear(); + this->clear(); //PointerTable::operator=(t); // FIXME This isn't exception safe. - for (size_t i = 0; i < vec_.size(); i++) - if (vec_[i]) - vec_[i] = vec_[i]->copy(); + for (size_t i = 0; i < this->vec_.size(); i++) + if (this->vec_[i]) + this->vec_[i] = this->vec_[i]->copy(); } #ifdef SP_NAMESPACE diff --git a/cde/programs/nsgmls/SJISCodingSystem.C b/cde/programs/nsgmls/SJISCodingSystem.C index bb1ce601..aaa1a0c1 100644 --- a/cde/programs/nsgmls/SJISCodingSystem.C +++ b/cde/programs/nsgmls/SJISCodingSystem.C @@ -29,7 +29,12 @@ #ifdef SP_MULTI_BYTE #include "SJISCodingSystem.h" + +#if defined(linux) +#include +#else #include +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/UTF8CodingSystem.C b/cde/programs/nsgmls/UTF8CodingSystem.C index 6512e15d..343ead01 100644 --- a/cde/programs/nsgmls/UTF8CodingSystem.C +++ b/cde/programs/nsgmls/UTF8CodingSystem.C @@ -30,7 +30,11 @@ #include "UTF8CodingSystem.h" #include "constant.h" +#if defined(linux) +#include +#else #include +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/UnicodeCodingSystem.C b/cde/programs/nsgmls/UnicodeCodingSystem.C index d67150ee..0b3a143c 100644 --- a/cde/programs/nsgmls/UnicodeCodingSystem.C +++ b/cde/programs/nsgmls/UnicodeCodingSystem.C @@ -39,7 +39,11 @@ extern "C" { void *memmove(void *, const void *, size_t); } #endif +#if defined(linux) +#include +#else #include +#endif #ifdef SP_NAMESPACE namespace SP_NAMESPACE { diff --git a/cde/programs/nsgmls/config.h b/cde/programs/nsgmls/config.h index 43f24729..7859a9c4 100644 --- a/cde/programs/nsgmls/config.h +++ b/cde/programs/nsgmls/config.h @@ -32,9 +32,11 @@ #ifdef __GNUG__ // It's not missing, but it pulls in libg++ +#if !defined(linux) #define SP_NEW_H_MISSING // set_new_handler() has to be declared extern "C" #define SP_SET_NEW_HANDLER_EXTERN_C +#endif #ifndef SP_MANUAL_INST #define SP_MANUAL_INST #endif diff --git a/cde/programs/nsgmls/nsgmls.C b/cde/programs/nsgmls/nsgmls.C index 122e9d86..c1ec8608 100644 --- a/cde/programs/nsgmls/nsgmls.C +++ b/cde/programs/nsgmls/nsgmls.C @@ -38,8 +38,13 @@ #include "sptchar.h" #include "macros.h" +#if defined(linux) +#include +#include +#else #include #include +#endif #include #include #include @@ -79,13 +84,21 @@ public: const AppChar *filename, const StringC &filenameStr, const OutputCodingSystem *, +#if defined(linux) + ::Messenger *messenger); +#else Messenger *messenger); +#endif ~XRastEventHandler(); void message(MessageEvent *); void truncateOutput(); void allLinkTypesActivated(); private: +#if defined(linux) + ::Messenger *messenger_; +#else Messenger *messenger_; +#endif // file_ must come before os_ so it gets inited first filebuf file_; IosOutputCharStream os_; @@ -235,7 +248,11 @@ XRastEventHandler::XRastEventHandler(SgmlParser *parser, const AppChar *filename, const StringC &filenameStr, const OutputCodingSystem *codingSystem, - Messenger *messenger) +#if defined(linux) + ::Messenger *messenger) +#else + ::Messenger *messenger) +#endif : RastEventHandler(parser, messenger), messenger_(messenger), filename_(filename), diff --git a/cde/programs/nsgmls/xnew.h b/cde/programs/nsgmls/xnew.h index 39669271..caffae69 100644 --- a/cde/programs/nsgmls/xnew.h +++ b/cde/programs/nsgmls/xnew.h @@ -39,7 +39,11 @@ void set_new_handler(VFP); #else /* not SP_NEW_H_MISSING */ +#if defined(linux) +#include +#else #include +#endif #endif /* not SP_NEW_H_MISSING */