Initial commit
[profile/ivi/openjade.git] / style / DssslApp.h
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 STYLE_API DssslApp : public GroveApp, public GroveManager {
17 public:
18   DssslApp(int unitsPerInch);
19   virtual FOTBuilder *makeFOTBuilder(const FOTBuilder::Extension *&) = 0;
20   int processSysid(const StringC &);
21   bool load(const StringC &sysid, const Vector<StringC> &active,
22             const NodePtr &parent, NodePtr &rootNode,
23             const Vector<StringC> &architecture);
24   bool readEntity(const StringC &, StringC &);
25   void mapSysid(StringC &);
26 protected:
27   void processOption(AppChar opt, const AppChar *arg);
28   int init(int argc, AppChar **argv);
29   int unitsPerInch_;
30   StringC defaultOutputBasename_;
31 private:
32   void processGrove();
33   int generateEvents(ErrorCountEventHandler *eceh);
34   Boolean getDssslSpecFromGrove();
35   Boolean getDssslSpecFromPi(const Char *s, size_t n,
36                              const Location &loc);
37   static void splitOffId(StringC &, StringC &);
38   Boolean handleSimplePi(const Char *, size_t, const Location &);
39   Boolean handleAttlistPi(const Char *, size_t, const Location &);
40   static void skipS(const Char *&s, size_t &n);
41   static Boolean isS(Char c);
42   static Boolean matchCi(const StringC &s, const char *key);
43   static Boolean matchCi(const Char *s, size_t n, const char *key);
44   static Boolean getAttribute(const Char *&s, size_t &n,
45                               StringC &name, StringC &value);
46   Boolean initSpecParser();
47
48   Boolean dssslSpecOption_;
49   StringC dssslSpecSysid_; // system ID of doc
50   StringC dssslSpecId_; // unique ID in doc
51   // Variables to be defined as true
52   Vector<StringC> defineVars_;
53   SgmlParser specParser_;
54   HashTable<StringC,NodePtr> groveTable_;
55   StringC rootSystemId_;
56   bool debugMode_;
57   bool dsssl2_;
58   bool strictMode_;
59 };
60
61 #ifdef DSSSL_NAMESPACE
62 }
63 #endif
64
65 #endif /* not DssslApp_INCLUDED */