~ubuntu-branches/ubuntu/trusty/openjade1.3/trusty

« back to all changes in this revision

Viewing changes to lib/Sd.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2002-04-09 00:01:50 UTC
  • Revision ID: james.westby@ubuntu.com-20020409000150-r9rkyalxlhvf9ba3
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 1994 James Clark
 
2
// See the file COPYING for copying permission.
 
3
 
 
4
#ifdef __GNUG__
 
5
#pragma implementation
 
6
#endif
 
7
#include "splib.h"
 
8
#include "Sd.h"
 
9
#include "macros.h"
 
10
 
 
11
#ifdef SP_NAMESPACE
 
12
namespace SP_NAMESPACE {
 
13
#endif
 
14
 
 
15
Sd::Sd(const Ptr<EntityManager> &entityManager)
 
16
: entityManager_(entityManager),
 
17
  internalCharsetIsDocCharset_(entityManager->internalCharsetIsDocCharset()),
 
18
  docCharset_(entityManager->charset()),
 
19
  scopeInstance_(0),
 
20
  www_(0),
 
21
  netEnable_(netEnableNo),
 
22
  entityRef_(entityRefAny),
 
23
  typeValid_(1),
 
24
  integrallyStored_(0)
 
25
{
 
26
  int i;
 
27
  for (i = 0; i < nBooleanFeature; i++)
 
28
    booleanFeature_[i] = 0;
 
29
  for (i = 0; i < nNumberFeature; i++)
 
30
    numberFeature_[i] = 0;
 
31
  for (i = 0; i < nCapacity; i++)
 
32
    capacity_[i] = 35000;
 
33
  if (internalCharsetIsDocCharset_)
 
34
    internalCharsetPtr_ = 0;
 
35
  else
 
36
    internalCharsetPtr_ = &entityManager->charset();
 
37
}
 
38
 
 
39
void Sd::setDocCharsetDesc(const UnivCharsetDesc &desc)
 
40
{
 
41
  docCharset_.set(desc);
 
42
}
 
43
 
 
44
const char *const Sd::reservedName_[] = {
 
45
  "ALL",
 
46
  "ANY",
 
47
  "APPINFO",
 
48
  "ATTLIST",
 
49
  "ATTRIB",
 
50
  "BASESET",
 
51
  "CAPACITY",
 
52
  "CHARSET",
 
53
  "CONCUR",
 
54
  "CONTROLS",
 
55
  "DATATAG",
 
56
  "DEFAULT",
 
57
  "DELIM",
 
58
  "DESCSET",
 
59
  "DOCTYPE",
 
60
  "DOCUMENT",
 
61
  "ELEMENT",
 
62
  "EMPTY",
 
63
  "EMPTYNRM",
 
64
  "ENDTAG",
 
65
  "ENTITIES",
 
66
  "ENTITY",
 
67
  "EXPLICIT",
 
68
  "FEATURES",
 
69
  "FORMAL",
 
70
  "FUNCHAR",
 
71
  "FUNCTION",
 
72
  "GENERAL",
 
73
  "IMMEDNET",
 
74
  "IMPLICIT",
 
75
  "IMPLYDEF",
 
76
  "INSTANCE",
 
77
  "INTEGRAL",
 
78
  "INTERNAL",
 
79
  "KEEPRSRE",
 
80
  "LCNMCHAR",
 
81
  "LCNMSTRT",
 
82
  "LINK",
 
83
  "MINIMIZE",
 
84
  "MSICHAR",
 
85
  "MSOCHAR",
 
86
  "MSSCHAR",
 
87
  "NAMECASE",
 
88
  "NAMECHAR",
 
89
  "NAMES",
 
90
  "NAMESTRT",
 
91
  "NAMING",
 
92
  "NETENABL",
 
93
  "NO",
 
94
  "NOASSERT",
 
95
  "NONE",
 
96
  "NOTATION",
 
97
  "OMITNAME",
 
98
  "OMITTAG",
 
99
  "OTHER",
 
100
  "PUBLIC",
 
101
  "QUANTITY",
 
102
  "RANK",
 
103
  "RE",
 
104
  "REF",
 
105
  "RS",
 
106
  "SCOPE",
 
107
  "SEEALSO",
 
108
  "SEPCHAR",
 
109
  "SGML",
 
110
  "SGMLREF",
 
111
  "SHORTREF",
 
112
  "SHORTTAG",
 
113
  "SHUNCHAR",
 
114
  "SIMPLE",
 
115
  "SPACE",
 
116
  "STARTTAG",
 
117
  "SUBDOC",
 
118
  "SWITCHES",
 
119
  "SYNTAX",
 
120
  "SYSTEM",
 
121
  "TYPE",
 
122
  "UCNMCHAR",
 
123
  "UCNMSTRT",
 
124
  "UNCLOSED",
 
125
  "UNUSED",
 
126
  "URN",
 
127
  "VALIDITY",
 
128
  "VALUE",
 
129
  "YES"
 
130
};
 
131
 
 
132
const char *const Sd::capacityName_[] = {
 
133
  "TOTALCAP",
 
134
  "ENTCAP",
 
135
  "ENTCHCAP",
 
136
  "ELEMCAP",
 
137
  "GRPCAP",
 
138
  "EXGRPCAP",
 
139
  "EXNMCAP",
 
140
  "ATTCAP",
 
141
  "ATTCHCAP",
 
142
  "AVGRPCAP",
 
143
  "NOTCAP",
 
144
  "NOTCHCAP",
 
145
  "IDCAP",
 
146
  "IDREFCAP",
 
147
  "MAPCAP",
 
148
  "LKSETCAP",
 
149
  "LKNMCAP"
 
150
};
 
151
 
 
152
 
 
153
const char *const Sd::quantityName_[] = {
 
154
  "ATTCNT",
 
155
  "ATTSPLEN",
 
156
  "BSEQLEN",
 
157
  "DTAGLEN",
 
158
  "DTEMPLEN",
 
159
  "ENTLVL",
 
160
  "GRPCNT",
 
161
  "GRPGTCNT",
 
162
  "GRPLVL",
 
163
  "LITLEN",
 
164
  "NAMELEN",
 
165
  "NORMSEP",
 
166
  "PILEN",
 
167
  "TAGLEN",
 
168
  "TAGLVL"
 
169
};
 
170
 
 
171
const char *const Sd::generalDelimiterName_[] = {
 
172
  "AND",
 
173
  "COM",
 
174
  "CRO",
 
175
  "DSC",
 
176
  "DSO",
 
177
  "DTGC",
 
178
  "DTGO",
 
179
  "ERO",
 
180
  "ETAGO",
 
181
  "GRPC",
 
182
  "GRPO",
 
183
  "HCRO",
 
184
  "LIT",
 
185
  "LITA",
 
186
  "MDC",
 
187
  "MDO",
 
188
  "MINUS",
 
189
  "MSC",
 
190
  "NET",
 
191
  "NESTC",
 
192
  "OPT",
 
193
  "OR",
 
194
  "PERO",
 
195
  "PIC",
 
196
  "PIO",
 
197
  "PLUS",
 
198
  "REFC",
 
199
  "REP",
 
200
  "RNI",
 
201
  "SEQ",
 
202
  "STAGO",
 
203
  "TAGC",
 
204
  "VI"
 
205
};
 
206
 
 
207
Boolean Sd::lookupQuantityName(const StringC &name, Syntax::Quantity &quantity)
 
208
     const
 
209
{
 
210
  for (size_t i = 0; i < SIZEOF(quantityName_); i++)
 
211
    if (execToInternal(quantityName_[i]) == name) {
 
212
      quantity = Syntax::Quantity(i);
 
213
      return 1;
 
214
    }
 
215
  return 0;
 
216
}
 
217
 
 
218
Boolean Sd::lookupCapacityName(const StringC &name, Sd::Capacity &capacity)
 
219
     const
 
220
{
 
221
  for (size_t i = 0; i < SIZEOF(capacityName_); i++)
 
222
    if (execToInternal(capacityName_[i]) == name) {
 
223
      capacity = Sd::Capacity(i);
 
224
      return 1;
 
225
    }
 
226
  return 0;
 
227
}
 
228
 
 
229
Boolean Sd::lookupGeneralDelimiterName(const StringC &name,
 
230
                                       Syntax::DelimGeneral &delimGeneral)
 
231
     const
 
232
{
 
233
  for (size_t i = 0; i < SIZEOF(generalDelimiterName_); i++)
 
234
    if (execToInternal(generalDelimiterName_[i]) == name) {
 
235
      delimGeneral = Syntax::DelimGeneral(i);
 
236
      return 1;
 
237
    }
 
238
  return 0;
 
239
}
 
240
 
 
241
StringC Sd::quantityName(Syntax::Quantity q) const
 
242
{
 
243
  return execToInternal(quantityName_[q]);
 
244
}
 
245
 
 
246
StringC Sd::generalDelimiterName(Syntax::DelimGeneral d) const
 
247
{
 
248
  return execToInternal(generalDelimiterName_[d]);
 
249
}
 
250
 
 
251
UnivChar Sd::nameToUniv(const StringC &name)
 
252
{
 
253
  const int *p = namedCharTable_.lookup(name);
 
254
  int n;
 
255
  if (p)
 
256
    n = *p;
 
257
  else {
 
258
    n = int(namedCharTable_.count());
 
259
    namedCharTable_.insert(name, n);
 
260
  }
 
261
  return n + 0x60000000;        // 10646 private use group
 
262
}
 
263
 
 
264
void Sd::setShorttag(Boolean b)
 
265
{
 
266
  for (int i = fSHORTTAG_FIRST; i <= fSHORTTAG_LAST; i++)
 
267
    booleanFeature_[i] = b;
 
268
  netEnable_ = netEnableAll;
 
269
}
 
270
 
 
271
#ifdef SP_NAMESPACE
 
272
}
 
273
#endif