~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to components/aggpas/expat-pas/xmlrole.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//----------------------------------------------------------------------------
2
 
// Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
3
 
//                                and Clark Cooper
4
 
// Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
5
 
//
6
 
// Expat - Version 2.0.0 Release Milano 0.83 (PasExpat 2.0.0 RM0.83)
7
 
// Pascal Port By: Milan Marusinec alias Milano
8
 
//                 milan@marusinec.sk
9
 
//                 http://www.pasports.org/pasexpat
10
 
// Copyright (c) 2006
11
 
//
12
 
// Permission is hereby granted, free of charge, to any person obtaining
13
 
// a copy of this software and associated documentation files (the
14
 
// "Software"), to deal in the Software without restriction, including
15
 
// without limitation the rights to use, copy, modify, merge, publish,
16
 
// distribute, sublicense, and/or sell copies of the Software, and to
17
 
// permit persons to whom the Software is furnished to do so, subject to
18
 
// the following conditions:
19
 
//
20
 
// The above copyright notice and this permission notice shall be included
21
 
// in all copies or substantial portions of the Software.
22
 
//
23
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
 
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
 
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
 
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
27
 
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28
 
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29
 
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
 
//
31
 
// [Pascal Port History] -----------------------------------------------------
32
 
//
33
 
// 10.05.2006-Milano: Unit port establishment
34
 
// 08.06.2006-Milano: porting
35
 
//
36
 
{ xmlrole.pas }
37
 
unit
38
 
 xmlrole ;
39
 
 
40
 
INTERFACE
41
 
 
42
 
uses
43
 
 expat_basics ,
44
 
 expat_external ,
45
 
 xmltok ;
46
 
 
47
 
{$I expat_mode.inc }
48
 
 
49
 
{ TYPES DEFINITION }
50
 
const
51
 
 XML_ROLE_ERROR                    = -1;
52
 
 XML_ROLE_NONE                     = 0;
53
 
 XML_ROLE_XML_DECL                 = XML_ROLE_NONE + 1;
54
 
 XML_ROLE_INSTANCE_START           = XML_ROLE_XML_DECL + 1;
55
 
 XML_ROLE_DOCTYPE_NONE             = XML_ROLE_INSTANCE_START + 1;
56
 
 XML_ROLE_DOCTYPE_NAME             = XML_ROLE_DOCTYPE_NONE + 1;
57
 
 XML_ROLE_DOCTYPE_SYSTEM_ID        = XML_ROLE_DOCTYPE_NAME + 1;
58
 
 XML_ROLE_DOCTYPE_PUBLIC_ID        = XML_ROLE_DOCTYPE_SYSTEM_ID + 1;
59
 
 XML_ROLE_DOCTYPE_INTERNAL_SUBSET  = XML_ROLE_DOCTYPE_PUBLIC_ID + 1;
60
 
 XML_ROLE_DOCTYPE_CLOSE            = XML_ROLE_DOCTYPE_INTERNAL_SUBSET + 1;
61
 
 XML_ROLE_GENERAL_ENTITY_NAME      = XML_ROLE_DOCTYPE_CLOSE + 1;
62
 
 XML_ROLE_PARAM_ENTITY_NAME        = XML_ROLE_GENERAL_ENTITY_NAME + 1;
63
 
 XML_ROLE_ENTITY_NONE              = XML_ROLE_PARAM_ENTITY_NAME + 1;
64
 
 XML_ROLE_ENTITY_VALUE             = XML_ROLE_ENTITY_NONE + 1;
65
 
 XML_ROLE_ENTITY_SYSTEM_ID         = XML_ROLE_ENTITY_VALUE + 1;
66
 
 XML_ROLE_ENTITY_PUBLIC_ID         = XML_ROLE_ENTITY_SYSTEM_ID + 1;
67
 
 XML_ROLE_ENTITY_COMPLETE          = XML_ROLE_ENTITY_PUBLIC_ID + 1;
68
 
 XML_ROLE_ENTITY_NOTATION_NAME     = XML_ROLE_ENTITY_COMPLETE + 1;
69
 
 XML_ROLE_NOTATION_NONE            = XML_ROLE_ENTITY_NOTATION_NAME + 1;
70
 
 XML_ROLE_NOTATION_NAME            = XML_ROLE_NOTATION_NONE + 1;
71
 
 XML_ROLE_NOTATION_SYSTEM_ID       = XML_ROLE_NOTATION_NAME + 1;
72
 
 XML_ROLE_NOTATION_NO_SYSTEM_ID    = XML_ROLE_NOTATION_SYSTEM_ID + 1;
73
 
 XML_ROLE_NOTATION_PUBLIC_ID       = XML_ROLE_NOTATION_NO_SYSTEM_ID + 1;
74
 
 XML_ROLE_ATTRIBUTE_NAME           = XML_ROLE_NOTATION_PUBLIC_ID + 1;
75
 
 XML_ROLE_ATTRIBUTE_TYPE_CDATA     = XML_ROLE_ATTRIBUTE_NAME + 1;
76
 
 XML_ROLE_ATTRIBUTE_TYPE_ID        = XML_ROLE_ATTRIBUTE_TYPE_CDATA + 1;
77
 
 XML_ROLE_ATTRIBUTE_TYPE_IDREF     = XML_ROLE_ATTRIBUTE_TYPE_ID + 1;
78
 
 XML_ROLE_ATTRIBUTE_TYPE_IDREFS    = XML_ROLE_ATTRIBUTE_TYPE_IDREF + 1;
79
 
 XML_ROLE_ATTRIBUTE_TYPE_ENTITY    = XML_ROLE_ATTRIBUTE_TYPE_IDREFS + 1;
80
 
 XML_ROLE_ATTRIBUTE_TYPE_ENTITIES  = XML_ROLE_ATTRIBUTE_TYPE_ENTITY + 1;
81
 
 XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN   = XML_ROLE_ATTRIBUTE_TYPE_ENTITIES + 1;
82
 
 XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS  = XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN + 1;
83
 
 XML_ROLE_ATTRIBUTE_ENUM_VALUE     = XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS + 1;
84
 
 XML_ROLE_ATTRIBUTE_NOTATION_VALUE = XML_ROLE_ATTRIBUTE_ENUM_VALUE + 1;
85
 
 XML_ROLE_ATTLIST_NONE             = XML_ROLE_ATTRIBUTE_NOTATION_VALUE + 1;
86
 
 XML_ROLE_ATTLIST_ELEMENT_NAME     = XML_ROLE_ATTLIST_NONE + 1;
87
 
 XML_ROLE_IMPLIED_ATTRIBUTE_VALUE  = XML_ROLE_ATTLIST_ELEMENT_NAME + 1;
88
 
 XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = XML_ROLE_IMPLIED_ATTRIBUTE_VALUE + 1;
89
 
 XML_ROLE_DEFAULT_ATTRIBUTE_VALUE  = XML_ROLE_REQUIRED_ATTRIBUTE_VALUE + 1;
90
 
 XML_ROLE_FIXED_ATTRIBUTE_VALUE    = XML_ROLE_DEFAULT_ATTRIBUTE_VALUE + 1;
91
 
 XML_ROLE_ELEMENT_NONE             = XML_ROLE_FIXED_ATTRIBUTE_VALUE + 1;
92
 
 XML_ROLE_ELEMENT_NAME             = XML_ROLE_ELEMENT_NONE + 1;
93
 
 XML_ROLE_CONTENT_ANY              = XML_ROLE_ELEMENT_NAME + 1;
94
 
 XML_ROLE_CONTENT_EMPTY            = XML_ROLE_CONTENT_ANY + 1;
95
 
 XML_ROLE_CONTENT_PCDATA           = XML_ROLE_CONTENT_EMPTY + 1;
96
 
 XML_ROLE_GROUP_OPEN               = XML_ROLE_CONTENT_PCDATA + 1;
97
 
 XML_ROLE_GROUP_CLOSE              = XML_ROLE_GROUP_OPEN + 1;
98
 
 XML_ROLE_GROUP_CLOSE_REP          = XML_ROLE_GROUP_CLOSE + 1;
99
 
 XML_ROLE_GROUP_CLOSE_OPT          = XML_ROLE_GROUP_CLOSE_REP + 1;
100
 
 XML_ROLE_GROUP_CLOSE_PLUS         = XML_ROLE_GROUP_CLOSE_OPT + 1;
101
 
 XML_ROLE_GROUP_CHOICE             = XML_ROLE_GROUP_CLOSE_PLUS + 1;
102
 
 XML_ROLE_GROUP_SEQUENCE           = XML_ROLE_GROUP_CHOICE + 1;
103
 
 XML_ROLE_CONTENT_ELEMENT          = XML_ROLE_GROUP_SEQUENCE + 1;
104
 
 XML_ROLE_CONTENT_ELEMENT_REP      = XML_ROLE_CONTENT_ELEMENT + 1;
105
 
 XML_ROLE_CONTENT_ELEMENT_OPT      = XML_ROLE_CONTENT_ELEMENT_REP + 1;
106
 
 XML_ROLE_CONTENT_ELEMENT_PLUS     = XML_ROLE_CONTENT_ELEMENT_OPT + 1;
107
 
 XML_ROLE_PI                       = XML_ROLE_CONTENT_ELEMENT_PLUS + 1;
108
 
 XML_ROLE_COMMENT                  = XML_ROLE_PI + 1;
109
 
 
110
 
{$IFDEF XML_DTD }
111
 
 XML_ROLE_TEXT_DECL                = XML_ROLE_COMMENT + 1;
112
 
 XML_ROLE_IGNORE_SECT              = XML_ROLE_TEXT_DECL + 1;
113
 
 XML_ROLE_INNER_PARAM_ENTITY_REF   = XML_ROLE_IGNORE_SECT + 1;
114
 
 XML_ROLE_PARAM_ENTITY_REF         = XML_ROLE_INNER_PARAM_ENTITY_REF + 1;
115
 
 
116
 
{$ELSE }
117
 
 XML_ROLE_PARAM_ENTITY_REF         = XML_ROLE_COMMENT + 1;
118
 
 
119
 
{$ENDIF }
120
 
 
121
 
type
122
 
 PROLOG_STATE_ptr = ^PROLOG_STATE;
123
 
 PROLOG_STATE = record
124
 
   handler : function(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
125
 
 
126
 
   level     : unsigned;
127
 
   role_none : int;
128
 
 
129
 
  {$IFDEF XML_DTD }
130
 
   includeLevel   : unsigned;
131
 
   documentEntity ,
132
 
   inEntityValue  : int;
133
 
 
134
 
  {$ENDIF }
135
 
 
136
 
  end;
137
 
 
138
 
{ GLOBAL PROCEDURES }
139
 
 procedure XmlPrologStateInit(state : PROLOG_STATE_ptr );
140
 
 function  XmlTokenRole      (state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
141
 
 
142
 
 
143
 
IMPLEMENTATION
144
 
{ LOCAL VARIABLES & CONSTANTS }
145
 
const
146
 
{$I ascii.inc }
147
 
 
148
 
{ Doesn't check:
149
 
 
150
 
  that ,| are not mixed in a model group
151
 
  content of literals }
152
 
 
153
 
 KW_ANY : array[0..3 ] of char = (
154
 
  ASCII_A ,ASCII_N ,ASCII_Y ,#0 );
155
 
 
156
 
 KW_ATTLIST : array[0..7 ] of char = (
157
 
  ASCII_A ,ASCII_T ,ASCII_T ,ASCII_L ,ASCII_I ,ASCII_S ,ASCII_T ,#0 );
158
 
 
159
 
 KW_CDATA : array[0..5 ] of char = (
160
 
  ASCII_C ,ASCII_D ,ASCII_A ,ASCII_T ,ASCII_A ,#0 );
161
 
 
162
 
 KW_DOCTYPE : array[0..7 ] of char = (
163
 
  ASCII_D ,ASCII_O ,ASCII_C ,ASCII_T ,ASCII_Y ,ASCII_P ,ASCII_E ,#0 );
164
 
 
165
 
 KW_ELEMENT : array[0..7 ] of char = (
166
 
  ASCII_E ,ASCII_L ,ASCII_E ,ASCII_M ,ASCII_E ,ASCII_N ,ASCII_T ,#0 );
167
 
 
168
 
 KW_EMPTY : array[0..5 ] of char = (
169
 
  ASCII_E ,ASCII_M ,ASCII_P ,ASCII_T ,ASCII_Y ,#0 );
170
 
 
171
 
 KW_ENTITIES : array[0..8 ] of char = (
172
 
  ASCII_E ,ASCII_N ,ASCII_T ,ASCII_I ,ASCII_T ,ASCII_I ,ASCII_E ,ASCII_S ,
173
 
  #0 );
174
 
 
175
 
 KW_ENTITY : array[0..6 ] of char = (
176
 
  ASCII_E ,ASCII_N ,ASCII_T ,ASCII_I ,ASCII_T ,ASCII_Y ,#0 );
177
 
 
178
 
 KW_FIXED : array[0..5 ] of char = (
179
 
  ASCII_F ,ASCII_I ,ASCII_X ,ASCII_E ,ASCII_D ,#0 );
180
 
 
181
 
 KW_ID : array[0..2 ] of char = (
182
 
  ASCII_I ,ASCII_D ,#0 );
183
 
 
184
 
 KW_IDREF : array[0..5 ] of char = (
185
 
  ASCII_I ,ASCII_D ,ASCII_R ,ASCII_E ,ASCII_F ,#0 );
186
 
 
187
 
 KW_IDREFS : array[0..6 ] of char = (
188
 
  ASCII_I ,ASCII_D ,ASCII_R ,ASCII_E ,ASCII_F ,ASCII_S ,#0 );
189
 
 
190
 
 KW_IGNORE : array[0..6 ] of char = (
191
 
  ASCII_I ,ASCII_G ,ASCII_N ,ASCII_O ,ASCII_R ,ASCII_E ,#0 );
192
 
 
193
 
 KW_IMPLIED : array[0..7 ] of char = (
194
 
  ASCII_I ,ASCII_M ,ASCII_P ,ASCII_L ,ASCII_I ,ASCII_E ,ASCII_D ,#0 );
195
 
 
196
 
 KW_INCLUDE : array[0..7 ] of char = (
197
 
  ASCII_I ,ASCII_N ,ASCII_C ,ASCII_L ,ASCII_U ,ASCII_D ,ASCII_E ,#0 );
198
 
 
199
 
 KW_NDATA : array[0..5 ] of char = (
200
 
  ASCII_N ,ASCII_D ,ASCII_A ,ASCII_T ,ASCII_A ,#0 );
201
 
 
202
 
 KW_NMTOKEN : array[0..7 ] of char = (
203
 
  ASCII_N ,ASCII_M ,ASCII_T ,ASCII_O ,ASCII_K ,ASCII_E ,ASCII_N ,#0 );
204
 
 
205
 
 KW_NMTOKENS : array[0..8 ] of char = (
206
 
  ASCII_N ,ASCII_M ,ASCII_T ,ASCII_O ,ASCII_K ,ASCII_E ,ASCII_N ,ASCII_S ,
207
 
  #0 );
208
 
 
209
 
 KW_NOTATION : array[0..8 ] of char = (
210
 
  ASCII_N ,ASCII_O ,ASCII_T ,ASCII_A ,ASCII_T ,ASCII_I ,ASCII_O ,ASCII_N ,
211
 
  #0 );
212
 
 
213
 
 KW_PCDATA : array[0..6 ] of char = (
214
 
  ASCII_P ,ASCII_C ,ASCII_D ,ASCII_A ,ASCII_T ,ASCII_A ,#0 );
215
 
 
216
 
 KW_PUBLIC : array[0..6 ] of char = (
217
 
  ASCII_P ,ASCII_U ,ASCII_B ,ASCII_L ,ASCII_I ,ASCII_C ,#0 );
218
 
 
219
 
 KW_REQUIRED : array[0..8 ] of char = (
220
 
  ASCII_R ,ASCII_E ,ASCII_Q ,ASCII_U ,ASCII_I ,ASCII_R ,ASCII_E ,ASCII_D ,
221
 
  #0 );
222
 
 
223
 
 KW_SYSTEM : array[0..6 ] of char = (
224
 
  ASCII_S ,ASCII_Y ,ASCII_S ,ASCII_T ,ASCII_E ,ASCII_M ,#0 );
225
 
 
226
 
 
227
 
{ UNIT IMPLEMENTATION }
228
 
{ MIN_BYTES_PER_CHAR }
229
 
function MIN_BYTES_PER_CHAR(enc : ENCODING_ptr ) : int;
230
 
begin
231
 
 result:=enc.minBytesPerChar;
232
 
 
233
 
end;
234
 
 
235
 
{ error }
236
 
function error(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
237
 
begin
238
 
 result:=XML_ROLE_NONE;
239
 
 
240
 
end;
241
 
 
242
 
{ common {..}
243
 
function common(state : PROLOG_STATE_ptr; tok : int ) : int;
244
 
begin
245
 
end;
246
 
 
247
 
{ internalSubset {..}
248
 
function internalSubset(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
249
 
begin
250
 
end;
251
 
 
252
 
{ prolog2 }
253
 
function prolog2(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
254
 
begin
255
 
 case tok of
256
 
  XML_TOK_PROLOG_S :
257
 
   begin
258
 
    result:=XML_ROLE_NONE;
259
 
 
260
 
    exit;
261
 
 
262
 
   end;
263
 
 
264
 
  XML_TOK_PI :
265
 
   begin
266
 
    result:=XML_ROLE_PI;
267
 
 
268
 
    exit;
269
 
 
270
 
   end;
271
 
 
272
 
  XML_TOK_COMMENT :
273
 
   begin
274
 
    result:=XML_ROLE_COMMENT;
275
 
 
276
 
    exit;
277
 
 
278
 
   end;
279
 
 
280
 
  XML_TOK_INSTANCE_START :
281
 
   begin
282
 
    state.handler:=@error;
283
 
 
284
 
    result:=XML_ROLE_INSTANCE_START;
285
 
 
286
 
    exit;
287
 
 
288
 
   end;
289
 
 
290
 
 end;
291
 
 
292
 
 result:=common(state ,tok );
293
 
 
294
 
end;
295
 
 
296
 
{ doctype4 }
297
 
function doctype4(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
298
 
begin
299
 
 case tok of
300
 
  XML_TOK_PROLOG_S :
301
 
   begin
302
 
    result:=XML_ROLE_DOCTYPE_NONE;
303
 
 
304
 
    exit;
305
 
 
306
 
   end;
307
 
 
308
 
  XML_TOK_OPEN_BRACKET :
309
 
   begin
310
 
    state.handler:=@internalSubset;
311
 
 
312
 
    result:=XML_ROLE_DOCTYPE_INTERNAL_SUBSET;
313
 
 
314
 
    exit;
315
 
 
316
 
   end;
317
 
 
318
 
  XML_TOK_DECL_CLOSE :
319
 
   begin
320
 
    state.handler:=@prolog2;
321
 
 
322
 
    result:=XML_ROLE_DOCTYPE_CLOSE;
323
 
 
324
 
    exit;
325
 
 
326
 
   end;
327
 
 
328
 
 end;
329
 
 
330
 
 result:=common(state ,tok );
331
 
 
332
 
end;
333
 
 
334
 
{ doctype3 }
335
 
function doctype3(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
336
 
begin
337
 
 case tok of
338
 
  XML_TOK_PROLOG_S :
339
 
   begin
340
 
    result:=XML_ROLE_DOCTYPE_NONE;
341
 
 
342
 
    exit;
343
 
 
344
 
   end;
345
 
 
346
 
  XML_TOK_LITERAL :
347
 
   begin
348
 
    state.handler:=@doctype4;
349
 
 
350
 
    result:=XML_ROLE_DOCTYPE_SYSTEM_ID;
351
 
 
352
 
    exit;
353
 
 
354
 
   end;
355
 
 
356
 
 end;
357
 
 
358
 
 result:=common(state ,tok );
359
 
 
360
 
end;
361
 
 
362
 
{ doctype2 }
363
 
function doctype2(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
364
 
begin
365
 
 case tok of
366
 
  XML_TOK_PROLOG_S :
367
 
   begin
368
 
    result:=XML_ROLE_DOCTYPE_NONE;
369
 
 
370
 
    exit;
371
 
 
372
 
   end;
373
 
 
374
 
  XML_TOK_LITERAL :
375
 
   begin
376
 
    state.handler:=@doctype3;
377
 
 
378
 
    result:=XML_ROLE_DOCTYPE_PUBLIC_ID;
379
 
 
380
 
    exit;
381
 
 
382
 
   end;
383
 
 
384
 
 end;
385
 
 
386
 
 result:=common(state ,tok );
387
 
 
388
 
end;
389
 
 
390
 
{ doctype1 }
391
 
function doctype1(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
392
 
begin
393
 
 case tok of
394
 
  XML_TOK_PROLOG_S :
395
 
   begin
396
 
    result:=XML_ROLE_DOCTYPE_NONE;
397
 
 
398
 
    exit;
399
 
 
400
 
   end;
401
 
 
402
 
  XML_TOK_OPEN_BRACKET :
403
 
   begin
404
 
    state.handler:=@internalSubset;
405
 
 
406
 
    result:=XML_ROLE_DOCTYPE_INTERNAL_SUBSET;
407
 
 
408
 
    exit;
409
 
 
410
 
   end;
411
 
 
412
 
  XML_TOK_DECL_CLOSE :
413
 
   begin
414
 
    state.handler:=@prolog2;
415
 
 
416
 
    result:=XML_ROLE_DOCTYPE_CLOSE;
417
 
 
418
 
    exit;
419
 
 
420
 
   end;
421
 
 
422
 
  XML_TOK_NAME :
423
 
   begin
424
 
    if XmlNameMatchesAscii(enc ,ptr ,end_ ,@KW_SYSTEM[0 ] ) <> 0 then
425
 
     begin
426
 
      state.handler:=@doctype3;
427
 
 
428
 
      result:=XML_ROLE_DOCTYPE_NONE;
429
 
 
430
 
      exit;
431
 
 
432
 
     end;
433
 
 
434
 
    if XmlNameMatchesAscii(enc ,ptr ,end_ ,@KW_PUBLIC[0 ] ) <> 0 then
435
 
     begin
436
 
      state.handler:=@doctype2;
437
 
 
438
 
      result:=XML_ROLE_DOCTYPE_NONE;
439
 
 
440
 
      exit;
441
 
 
442
 
     end;
443
 
 
444
 
   end;
445
 
 
446
 
 end;
447
 
 
448
 
 result:=common(state ,tok );
449
 
 
450
 
end;
451
 
 
452
 
{ doctype0 }
453
 
function doctype0(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
454
 
begin
455
 
 case tok of
456
 
  XML_TOK_PROLOG_S :
457
 
   begin
458
 
    result:=XML_ROLE_DOCTYPE_NONE;
459
 
 
460
 
    exit;
461
 
 
462
 
   end;
463
 
 
464
 
  XML_TOK_NAME ,XML_TOK_PREFIXED_NAME :
465
 
   begin
466
 
    state.handler:=@doctype1;
467
 
 
468
 
    result:=XML_ROLE_DOCTYPE_NAME;
469
 
 
470
 
    exit;
471
 
 
472
 
   end;
473
 
 
474
 
 end;
475
 
 
476
 
 result:=common(state ,tok );
477
 
 
478
 
end;
479
 
 
480
 
{ prolog1 }
481
 
function prolog1(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
482
 
begin
483
 
 case tok of
484
 
  XML_TOK_PROLOG_S :
485
 
   begin
486
 
    result:=XML_ROLE_NONE;
487
 
 
488
 
    exit;
489
 
 
490
 
   end;
491
 
 
492
 
  XML_TOK_PI :
493
 
   begin
494
 
    result:=XML_ROLE_PI;
495
 
 
496
 
    exit;
497
 
 
498
 
   end;
499
 
 
500
 
  XML_TOK_COMMENT :
501
 
   begin
502
 
    result:=XML_ROLE_COMMENT;
503
 
 
504
 
    exit;
505
 
 
506
 
   end;
507
 
 
508
 
  XML_TOK_BOM :
509
 
   begin
510
 
    result:=XML_ROLE_NONE;
511
 
 
512
 
    exit;
513
 
 
514
 
   end;
515
 
 
516
 
  XML_TOK_DECL_OPEN :
517
 
   if XmlNameMatchesAscii(
518
 
       enc ,
519
 
       char_ptr(ptrcomp(ptr ) + 2 * MIN_BYTES_PER_CHAR(enc ) ) ,
520
 
       end_ ,
521
 
       @KW_DOCTYPE[0 ] ) = 0 then
522
 
    else
523
 
     begin
524
 
      state.handler:=@doctype0;
525
 
 
526
 
      result:=XML_ROLE_DOCTYPE_NONE;
527
 
 
528
 
      exit;
529
 
 
530
 
     end;
531
 
 
532
 
  XML_TOK_INSTANCE_START :
533
 
   begin
534
 
    state.handler:=@error;
535
 
 
536
 
    result:=XML_ROLE_INSTANCE_START;
537
 
 
538
 
    exit;
539
 
 
540
 
   end;
541
 
 
542
 
 end;
543
 
 
544
 
 result:=common(state ,tok );
545
 
 
546
 
end;
547
 
 
548
 
{ prolog0 }
549
 
function prolog0(state : PROLOG_STATE_ptr; tok : int; ptr ,end_ : char_ptr; enc : ENCODING_ptr ) : int;
550
 
label
551
 
 _break ;
552
 
 
553
 
begin
554
 
 case tok of
555
 
  XML_TOK_PROLOG_S :
556
 
   begin
557
 
    state.handler:=@prolog1;
558
 
 
559
 
    result:=XML_ROLE_NONE;
560
 
 
561
 
    exit;
562
 
 
563
 
   end;
564
 
 
565
 
  XML_TOK_XML_DECL :
566
 
   begin
567
 
    state.handler:=@prolog1;
568
 
 
569
 
    result:=XML_ROLE_XML_DECL;
570
 
 
571
 
    exit;
572
 
 
573
 
   end;
574
 
 
575
 
  XML_TOK_PI :
576
 
   begin
577
 
    state.handler:=@prolog1;
578
 
    
579
 
    result:=XML_ROLE_PI;
580
 
 
581
 
    exit;
582
 
 
583
 
   end;
584
 
 
585
 
  XML_TOK_COMMENT :
586
 
   begin
587
 
    state.handler:=@prolog1;
588
 
 
589
 
    result:=XML_ROLE_COMMENT;
590
 
 
591
 
    exit;
592
 
 
593
 
   end;
594
 
 
595
 
  XML_TOK_BOM :
596
 
   begin
597
 
    result:=XML_ROLE_NONE;
598
 
 
599
 
    exit;
600
 
 
601
 
   end;
602
 
 
603
 
  XML_TOK_DECL_OPEN :
604
 
   begin
605
 
    if XmlNameMatchesAscii(
606
 
        enc ,
607
 
        char_ptr(ptrcomp(ptr ) + 2 * MIN_BYTES_PER_CHAR(enc ) ) ,
608
 
        end_ ,
609
 
        @KW_DOCTYPE[0 ] ) = 0 then
610
 
      goto _break;
611
 
 
612
 
    state.handler:=@doctype0;
613
 
 
614
 
    result:=XML_ROLE_DOCTYPE_NONE;
615
 
 
616
 
    exit;
617
 
 
618
 
   end;
619
 
 
620
 
  XML_TOK_INSTANCE_START :
621
 
   begin
622
 
    state.handler:=@error;
623
 
 
624
 
    result:=XML_ROLE_INSTANCE_START;
625
 
 
626
 
    exit;
627
 
 
628
 
   end;
629
 
 
630
 
 end;
631
 
 
632
 
_break:
633
 
 result:=common(state ,tok );
634
 
 
635
 
end;
636
 
 
637
 
{ XMLPROLOGSTATEINIT }
638
 
procedure XmlPrologStateInit;
639
 
begin
640
 
 state.handler:=@prolog0;
641
 
 
642
 
{$IFDEF XML_DTD }
643
 
 state.documentEntity:=1;
644
 
 state.includeLevel  :=0;
645
 
 state.inEntityValue :=0;
646
 
 
647
 
{$ENDIF }
648
 
 
649
 
end;
650
 
 
651
 
{ XMLTOKENROLE }
652
 
function XmlTokenRole;
653
 
begin
654
 
 result:=state.handler(state ,tok ,ptr ,end_ ,enc );
655
 
 
656
 
end;
657
 
 
658
 
END.
659