nsgmls.cxx revision 7c478bd95313f5f23a4c958a745db2134aa03244
// Copyright (c) 1994, 1995 James Clark
// See the file COPYING for copying permission.
#pragma ident "%Z%%M% %I% %E% SMI"
#include "config.h"
#include "Event.h"
#include "MessageEventHandler.h"
#include "SgmlsEventHandler.h"
#include "RastEventHandler.h"
#include "OutputCharStream.h"
#include "Boolean.h"
#include "NsgmlsMessages.h"
#include "MessageArg.h"
#include "ErrnoMessageArg.h"
#include "ParserApp.h"
#include "sptchar.h"
#include "macros.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#ifdef SP_NAMESPACE
using namespace SP_NAMESPACE;
#endif
public:
NsgmlsApp();
void allLinkTypesActivated();
private:
unsigned outputFlags_;
const AppChar *rastOption_;
};
class PrologMessageEventHandler : public MessageEventHandler {
public:
void endProlog(EndPrologEvent *);
};
class XRastEventHandler : public RastEventHandler {
public:
const StringC &filenameStr,
const OutputCodingSystem *,
CmdLineApp *,
void message(MessageEvent *);
void truncateOutput();
void allLinkTypesActivated();
private:
// file_ must come before os_ so it gets inited first
const StringC filenameStr_;
};
: suppressOutput_(0),
batchMode_(0),
prologOnly_(0),
outputFlags_(0),
rastOption_(0)
{
registerOption('B');
registerOption('d');
registerOption('l');
registerOption('p');
registerOption('r');
registerOption('s');
registerOption('u');
}
{
switch (opt) {
case 'B':
batchMode_ = 1;
break;
case 'd':
// warn about duplicate entity declarations
break;
case 'l':
// output L commands
break;
case 'm':
break;
case 'o':
{
static struct {
// Qualifier works around CodeWarrior bug
unsigned flag;
} outputOptions[] = {
};
found = 1;
break;
}
if (!found)
}
break;
case 'p':
prologOnly_ = 1;
break;
case 'r':
// warn about defaulted entity reference
break;
case 's':
suppressOutput_ = 1;
break;
case 't':
rastOption_ = arg;
break;
case 'u':
// warn about undefined elements
break;
default:
break;
}
}
{
if (batchMode_) {
int ret = 0;
for (int i = 0; i < argc; i++) {
if (rastOption_) {
}
}
return ret;
}
else
}
void NsgmlsApp::allLinkTypesActivated()
{
if (!rastOption_)
}
{
if (prologOnly_)
return new PrologMessageEventHandler(this);
else if (rastOption_) {
outputCodingSystem_, this, this);
}
else if (suppressOutput_)
return new MessageEventHandler(this, &parser_);
else
return new SgmlsEventHandler(&parser_,
makeStdOut(),
this,
}
{
}
{
cancel();
delete event;
}
const StringC &filenameStr,
const OutputCodingSystem *codingSystem,
{
errno = 0;
exit(1);
}
}
{
end();
}
void XRastEventHandler::truncateOutput()
{
errno = 0;
errno = 0;
exit(1);
}
}
{
}