1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Linux compilation of nsgmls (Matthew Howkins)

This commit is contained in:
Peter Howkins 2012-04-11 18:03:23 +01:00
parent cc1d109aa9
commit e60d58be07
17 changed files with 102 additions and 10 deletions

View file

@ -58,8 +58,14 @@
#include "ConsoleOutput.h" #include "ConsoleOutput.h"
#if defined(linux)
#include <iostream>
#include <fstream>
using namespace std;
#else
#include <iostream.h> #include <iostream.h>
#include <fstream.h> #include <fstream.h>
#endif
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -285,8 +291,12 @@ Boolean CmdLineApp::openFilebufWrite(filebuf &file,
if (fd < 0) if (fd < 0)
return 0; return 0;
return file.attach(fd) != 0; return file.attach(fd) != 0;
#else
#if defined(linux)
return file.open(filename, ios::out|ios::trunc) != 0;
#else #else
return file.open(filename, ios::out|ios::trunc|IOS_BINARY) != 0; return file.open(filename, ios::out|ios::trunc|IOS_BINARY) != 0;
#endif
#endif #endif
} }

View file

@ -43,7 +43,12 @@
#include <stddef.h> #include <stddef.h>
#endif #endif
#if defined(linux)
#include <fstream>
using namespace std;
#else
class filebuf; class filebuf;
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -33,8 +33,12 @@
#ifdef SP_SHORT_HEADERS #ifdef SP_SHORT_HEADERS
#include <strstrea.h> #include <strstrea.h>
#else #else
#if defined(linux)
#include <strstream>
#else
#include <strstream.h> #include <strstream.h>
#endif #endif
#endif
#include <string.h> #include <string.h>
#include <sys/param.h> #include <sys/param.h>
@ -78,7 +82,11 @@ String<char> OutputCodingSystem::convertOut(const StringC &str) const
encoder->output(copy.data(), copy.size(), &stream); encoder->output(copy.data(), copy.size(), &stream);
delete encoder; delete encoder;
char *s = stream.str(); char *s = stream.str();
#if defined(linux)
String<char> result(s, stream.pcount());
#else
String<char> result(s, stream.out_waiting()); String<char> result(s, stream.out_waiting());
#endif
result += '\0'; result += '\0';
stream.freeze(0); stream.freeze(0);
#ifdef __lucid #ifdef __lucid

View file

@ -41,7 +41,12 @@
#include <stddef.h> #include <stddef.h>
#if defined(linux)
#include <streambuf>
using namespace std;
#else
class streambuf; class streambuf;
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -29,7 +29,11 @@
#ifdef SP_MULTI_BYTE #ifdef SP_MULTI_BYTE
#include "EUCJPCodingSystem.h" #include "EUCJPCodingSystem.h"
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -34,7 +34,11 @@
#include "Fixed2CodingSystem.h" #include "Fixed2CodingSystem.h"
#include "macros.h" #include "macros.h"
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -26,7 +26,11 @@
#include "splib.h" #include "splib.h"
#include "IdentityCodingSystem.h" #include "IdentityCodingSystem.h"
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#include <limits.h> #include <limits.h>
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE

View file

@ -91,9 +91,12 @@ CXXOPTIONS = \
/* /*
* Flags passed into compile step when doing manual template instantiation. * Flags passed into compile step when doing manual template instantiation.
*/ */
CXXTEMPLATEFLAGS = -ptf CXXTEMPLATEFLAGS =
M4 = /usr/bin/m4 M4 = /usr/bin/m4
CXXEXTRA_DEFINES = -fpermissive
#endif #endif
#if defined(RsArchitecture) #if defined(RsArchitecture)

View file

@ -28,7 +28,11 @@
#include "OutputCharStream.h" #include "OutputCharStream.h"
#include "CodingSystem.h" #include "CodingSystem.h"
#include "macros.h" #include "macros.h"
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#include <stdio.h> #include <stdio.h>
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
@ -144,7 +148,11 @@ void IosOutputCharStream::flush()
encoder_->output(buf_, ptr_ - buf_, byteStream_); encoder_->output(buf_, ptr_ - buf_, byteStream_);
ptr_ = buf_; ptr_ = buf_;
} }
#if defined(linux)
byteStream_->pubsync();
#else
byteStream_->sync(); byteStream_->sync();
#endif
} }
void IosOutputCharStream::flushBuf(Char c) void IosOutputCharStream::flushBuf(Char c)

View file

@ -33,7 +33,12 @@
#include "Owner.h" #include "Owner.h"
#include "CodingSystem.h" #include "CodingSystem.h"
#if defined(linux)
#include <streambuf>
using namespace std;
#else
class streambuf; class streambuf;
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -34,15 +34,15 @@ namespace SP_NAMESPACE {
template<class T, class K, class HF, class KF> template<class T, class K, class HF, class KF>
OwnerTable<T, K, HF, KF>::~OwnerTable() OwnerTable<T, K, HF, KF>::~OwnerTable()
{ {
for (size_t i = 0; i < vec_.size(); i++) for (size_t i = 0; i < this->vec_.size(); i++)
delete vec_[i]; delete this->vec_[i];
} }
template<class T, class K, class HF, class KF> template<class T, class K, class HF, class KF>
void OwnerTable<T, K, HF, KF>::clear() void OwnerTable<T, K, HF, KF>::clear()
{ {
for (size_t i = 0; i < vec_.size(); i++) for (size_t i = 0; i < this->vec_.size(); i++)
delete vec_[i]; delete this->vec_[i];
PointerTable<T *, K, HF, KF>::clear(); PointerTable<T *, K, HF, KF>::clear();
} }
@ -50,12 +50,12 @@ template<class T, class K, class HF, class KF>
void void
CopyOwnerTable<T, K, HF, KF>::operator=(const CopyOwnerTable<T, K, HF, KF> &t) CopyOwnerTable<T, K, HF, KF>::operator=(const CopyOwnerTable<T, K, HF, KF> &t)
{ {
clear(); this->clear();
//PointerTable<T *, K, HF, KF>::operator=(t); //PointerTable<T *, K, HF, KF>::operator=(t);
// FIXME This isn't exception safe. // FIXME This isn't exception safe.
for (size_t i = 0; i < vec_.size(); i++) for (size_t i = 0; i < this->vec_.size(); i++)
if (vec_[i]) if (this->vec_[i])
vec_[i] = vec_[i]->copy(); this->vec_[i] = this->vec_[i]->copy();
} }
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE

View file

@ -29,7 +29,12 @@
#ifdef SP_MULTI_BYTE #ifdef SP_MULTI_BYTE
#include "SJISCodingSystem.h" #include "SJISCodingSystem.h"
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -30,7 +30,11 @@
#include "UTF8CodingSystem.h" #include "UTF8CodingSystem.h"
#include "constant.h" #include "constant.h"
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -39,7 +39,11 @@ extern "C" {
void *memmove(void *, const void *, size_t); void *memmove(void *, const void *, size_t);
} }
#endif #endif
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#ifdef SP_NAMESPACE #ifdef SP_NAMESPACE
namespace SP_NAMESPACE { namespace SP_NAMESPACE {

View file

@ -32,9 +32,11 @@
#ifdef __GNUG__ #ifdef __GNUG__
// It's not missing, but it pulls in libg++ // It's not missing, but it pulls in libg++
#if !defined(linux)
#define SP_NEW_H_MISSING #define SP_NEW_H_MISSING
// set_new_handler() has to be declared extern "C" // set_new_handler() has to be declared extern "C"
#define SP_SET_NEW_HANDLER_EXTERN_C #define SP_SET_NEW_HANDLER_EXTERN_C
#endif
#ifndef SP_MANUAL_INST #ifndef SP_MANUAL_INST
#define SP_MANUAL_INST #define SP_MANUAL_INST
#endif #endif

View file

@ -38,8 +38,13 @@
#include "sptchar.h" #include "sptchar.h"
#include "macros.h" #include "macros.h"
#if defined(linux)
#include <iostream>
#include <fstream>
#else
#include <iostream.h> #include <iostream.h>
#include <fstream.h> #include <fstream.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -79,13 +84,21 @@ public:
const AppChar *filename, const AppChar *filename,
const StringC &filenameStr, const StringC &filenameStr,
const OutputCodingSystem *, const OutputCodingSystem *,
#if defined(linux)
::Messenger *messenger);
#else
Messenger *messenger); Messenger *messenger);
#endif
~XRastEventHandler(); ~XRastEventHandler();
void message(MessageEvent *); void message(MessageEvent *);
void truncateOutput(); void truncateOutput();
void allLinkTypesActivated(); void allLinkTypesActivated();
private: private:
#if defined(linux)
::Messenger *messenger_;
#else
Messenger *messenger_; Messenger *messenger_;
#endif
// file_ must come before os_ so it gets inited first // file_ must come before os_ so it gets inited first
filebuf file_; filebuf file_;
IosOutputCharStream os_; IosOutputCharStream os_;
@ -235,7 +248,11 @@ XRastEventHandler::XRastEventHandler(SgmlParser *parser,
const AppChar *filename, const AppChar *filename,
const StringC &filenameStr, const StringC &filenameStr,
const OutputCodingSystem *codingSystem, const OutputCodingSystem *codingSystem,
Messenger *messenger) #if defined(linux)
::Messenger *messenger)
#else
::Messenger *messenger)
#endif
: RastEventHandler(parser, messenger), : RastEventHandler(parser, messenger),
messenger_(messenger), messenger_(messenger),
filename_(filename), filename_(filename),

View file

@ -39,7 +39,11 @@ void set_new_handler(VFP);
#else /* not SP_NEW_H_MISSING */ #else /* not SP_NEW_H_MISSING */
#if defined(linux)
#include <new>
#else
#include <new.h> #include <new.h>
#endif
#endif /* not SP_NEW_H_MISSING */ #endif /* not SP_NEW_H_MISSING */