| 1 |
// Copyright (c) 1996, 1997 James Clark |
| 2 |
// See the file copying.txt for copying permission. |
| 3 |
|
| 4 |
#ifndef DssslApp_INCLUDED |
| 5 |
#define DssslApp_INCLUDED 1 |
| 6 |
|
| 7 |
#include "GroveApp.h" |
| 8 |
#include "FOTBuilder.h" |
| 9 |
#include "GroveManager.h" |
| 10 |
#include "dsssl_ns.h" |
| 11 |
|
| 12 |
#ifdef DSSSL_NAMESPACE |
| 13 |
namespace DSSSL_NAMESPACE { |
| 14 |
#endif |
| 15 |
|
| 16 |
class StyleEngine; |
| 17 |
|
| 18 |
class STYLE_API DssslApp : public GroveApp, public GroveManager { |
| 19 |
public: |
| 20 |
DssslApp(int unitsPerInch); |
| 21 |
virtual FOTBuilder *makeFOTBuilder(const FOTBuilder::Description *&) = 0; |
| 22 |
int processSysid(const StringC &); |
| 23 |
bool load(const StringC &sysid, const Vector<StringC> &active, |
| 24 |
const NodePtr &parent, NodePtr &rootNode, |
| 25 |
const Vector<StringC> &architecture); |
| 26 |
bool readEntity(const StringC &, StringC &); |
| 27 |
void mapSysid(StringC &); |
| 28 |
protected: |
| 29 |
void processOption(AppChar opt, const AppChar *arg); |
| 30 |
int init(int argc, AppChar **argv); |
| 31 |
int unitsPerInch_; |
| 32 |
StringC defaultOutputBasename_; |
| 33 |
private: |
| 34 |
void processGrove(); |
| 35 |
int generateEvents(ErrorCountEventHandler *eceh); |
| 36 |
Boolean getDssslSpecFromProlog(); |
| 37 |
Boolean getDssslSpecFromPi(const Char *s, size_t n, |
| 38 |
const Location &loc); |
| 39 |
static void splitOffId(StringC &, StringC &); |
| 40 |
Boolean handleSimplePi(const Char *, size_t, const Location &); |
| 41 |
Boolean handleAttlistPi(const Char *, size_t, const Location &); |
| 42 |
static void skipS(const Char *&s, size_t &n); |
| 43 |
static Boolean isS(Char c); |
| 44 |
static Boolean matchCi(const StringC &s, const char *key); |
| 45 |
static Boolean matchCi(const Char *s, size_t n, const char *key); |
| 46 |
static Boolean getAttribute(const Char *&s, size_t &n, |
| 47 |
StringC &name, StringC &value); |
| 48 |
Boolean initSpecParser(); |
| 49 |
|
| 50 |
Boolean dssslSpecOption_; |
| 51 |
StringC dssslSpecSysid_; // system ID of doc |
| 52 |
StringC dssslSpecId_; // unique ID in doc |
| 53 |
// Variables to be defined as true |
| 54 |
Vector<StringC> defineVars_; |
| 55 |
SgmlParser specParser_; |
| 56 |
HashTable<StringC,NodePtr> groveTable_; |
| 57 |
StringC rootSystemId_; |
| 58 |
bool debugMode_; |
| 59 |
bool dsssl2_; |
| 60 |
bool strictMode_; |
| 61 |
ParserOptions docOptions_; |
| 62 |
ParserOptions specOptions_; |
| 63 |
|
| 64 |
friend class PrologPiEventHandler; |
| 65 |
const FOTBuilder::Description *fotbDescr_; |
| 66 |
Boolean specTitleOption_; |
| 67 |
StringC specTitle_; |
| 68 |
Vector<StringC> availableSpecTitles_; |
| 69 |
|
| 70 |
FOTBuilder *fotb_; |
| 71 |
StyleEngine *se_; |
| 72 |
}; |
| 73 |
|
| 74 |
#ifdef DSSSL_NAMESPACE |
| 75 |
} |
| 76 |
#endif |
| 77 |
|
| 78 |
#endif /* not DssslApp_INCLUDED */ |