Linux compilation of nsgmls (Matthew Howkins)
authorPeter Howkins <flibble@users.sourceforge.net>
Wed, 11 Apr 2012 17:03:23 +0000 (18:03 +0100)
committerPeter Howkins <flibble@users.sourceforge.net>
Wed, 11 Apr 2012 17:03:23 +0000 (18:03 +0100)
17 files changed:
cde/programs/nsgmls/CmdLineApp.C
cde/programs/nsgmls/CmdLineApp.h
cde/programs/nsgmls/CodingSystem.C
cde/programs/nsgmls/CodingSystem.h
cde/programs/nsgmls/EUCJPCodingSystem.C
cde/programs/nsgmls/Fixed2CodingSystem.C
cde/programs/nsgmls/IdentityCodingSystem.C
cde/programs/nsgmls/Imakefile
cde/programs/nsgmls/OutputCharStream.C
cde/programs/nsgmls/OutputCharStream.h
cde/programs/nsgmls/OwnerTable.C
cde/programs/nsgmls/SJISCodingSystem.C
cde/programs/nsgmls/UTF8CodingSystem.C
cde/programs/nsgmls/UnicodeCodingSystem.C
cde/programs/nsgmls/config.h
cde/programs/nsgmls/nsgmls.C
cde/programs/nsgmls/xnew.h

index 99c8b1dc1f93c45d854ec09905ee64b1af4f729b..b2f74684f249294355850f5f44ce43536549e75e 100644 (file)
 
 #include "ConsoleOutput.h"
 
+#if defined(linux)
+#include <iostream>
+#include <fstream>
+using namespace std;
+#else
 #include <iostream.h>
 #include <fstream.h>
+#endif
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
@@ -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
 }
 
index ce53dd3961d2b0c47d31955fbfe20c6b3d0c9fd0..98f57736de08984895b8a37a5023c3fbf8cca5a5 100644 (file)
 #include <stddef.h>
 #endif
 
+#if defined(linux)
+#include <fstream>
+using namespace std;
+#else
 class filebuf;
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 6d230a6860289a8e9c4fece447ede2ce9d046a10..ad7935a76b149d736cb3020faf0092c5348cae4d 100644 (file)
 #ifdef SP_SHORT_HEADERS
 #include <strstrea.h>
 #else
+#if defined(linux)
+#include <strstream>
+#else
 #include <strstream.h>
 #endif
+#endif
 #include <string.h>
 #include <sys/param.h>
 
@@ -78,7 +82,11 @@ String<char> OutputCodingSystem::convertOut(const StringC &str) const
   encoder->output(copy.data(), copy.size(), &stream);
   delete encoder;
   char *s = stream.str();
+#if defined(linux)
+  String<char> result(s, stream.pcount());
+#else
   String<char> result(s, stream.out_waiting());
+#endif
   result += '\0';
   stream.freeze(0);
 #ifdef __lucid
index c3b1fc37d9c0fca5f75d95ead0c721114ca2eae5..e073ae5cf765d0d089b3cee15c9ff093009e96ce 100644 (file)
 
 #include <stddef.h>
 
+#if defined(linux)
+#include <streambuf>
+using namespace std;
+#else
 class streambuf;
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 4b9d1541daf7f0821e9882c72c643406f0bf89da..f2fb30ef2ef5149094c456a81f67441b7f6d8713 100644 (file)
 #ifdef SP_MULTI_BYTE
 
 #include "EUCJPCodingSystem.h"
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 2bd5d9582bc5f93353d83deb0e4aade969cc08a5..8114f7e9cefdbb12cfaa1d2ac0969e77c69c7686 100644 (file)
 #include "Fixed2CodingSystem.h"
 #include "macros.h"
 
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 4322e3fedd66668c243c7250f6e97638068fd12b..6f0e472baffac215fe254f4ab5992b252ef4aa46 100644 (file)
 
 #include "splib.h"
 #include "IdentityCodingSystem.h"
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 #include <limits.h>
 
 #ifdef SP_NAMESPACE
index 1ab9e484e196e94279aacc2bcc67385812d5c79f..166bb666e27187d7484813b5dc3291cf6e62fc24 100644 (file)
@@ -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)
index 58ed0223b7cbdf5660bee69d79465d5549c2350e..fd1f7584674e4df1bc8c6e0b6503bde00cb2cefc 100644 (file)
 #include "OutputCharStream.h"
 #include "CodingSystem.h"
 #include "macros.h"
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 #include <stdio.h>
 
 #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)
index e823eda02e82acd1d06e6c37fb7cb677e24b658b..15088bb4854767d5275ea1f43a039a6f5f9dbb55 100644 (file)
 #include "Owner.h"
 #include "CodingSystem.h"
 
+#if defined(linux)
+#include <streambuf>
+using namespace std;
+#else
 class streambuf;
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 6607632e720cb62b2643057a4607da51546b646e..8b6572455ed48a1fc177bb3689c946267da35037 100644 (file)
@@ -34,15 +34,15 @@ namespace SP_NAMESPACE {
 template<class T, class K, class HF, class KF>
 OwnerTable<T, K, HF, KF>::~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<class T, class K, class HF, class KF>
 void OwnerTable<T, K, HF, KF>::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<T *, K, HF, KF>::clear();
 }
 
@@ -50,12 +50,12 @@ template<class T, class K, class HF, class KF>
 void
 CopyOwnerTable<T, K, HF, KF>::operator=(const CopyOwnerTable<T, K, HF, KF> &t)
 {
-  clear();
+  this->clear();
   //PointerTable<T *, K, HF, KF>::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
index bb1ce6015b02724050eb6453fad7967e2ed1c3eb..aaa1a0c162220aa2ad76c4307ecb04fbc1716e46 100644 (file)
 #ifdef SP_MULTI_BYTE
 
 #include "SJISCodingSystem.h"
+
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 6512e15dde87f0901df838d7c2b5f581676c48c1..343ead0159d966c616f8b2d715db70aee778eda6 100644 (file)
 
 #include "UTF8CodingSystem.h"
 #include "constant.h"
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index d67150eee0ea4cf50ab011b84e0af4c7d1af8709..0b3a143c726e49dd10d5dff774e6b5df860824d4 100644 (file)
@@ -39,7 +39,11 @@ extern "C" {
   void *memmove(void *, const void *, size_t);
 }
 #endif
+#if defined(linux)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 
 #ifdef SP_NAMESPACE
 namespace SP_NAMESPACE {
index 43f24729ac4ae071c52ba959265df28e2a76bccf..7859a9c42a78835bccd660e6dd126d7d67199a04 100644 (file)
 
 #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
index 122e9d860ceb4554aedfee953bd1eb3ea5a12619..c1ec860850751d8a56d9e6d819c31dae167e4dbf 100644 (file)
 #include "sptchar.h"
 #include "macros.h"
 
+#if defined(linux)
+#include <iostream>
+#include <fstream>
+#else
 #include <iostream.h>
 #include <fstream.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
@@ -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),
index 39669271d8f97cfcdc0ac896087cd4de3cf24970..caffae69da3bf47a7d10a41eb3511f5be31c1a84 100644 (file)
@@ -39,7 +39,11 @@ void set_new_handler(VFP);
 
 #else /* not SP_NEW_H_MISSING */
 
+#if defined(linux)
+#include <new>
+#else
 #include <new.h>
+#endif
 
 #endif /* not SP_NEW_H_MISSING */