Rev 5499 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5473 | punk_joker | 1 | dword XML = #aXML_lib; |
2 | char aXML_lib[] = "/sys/lib/xml.obj"; |
||
3 | |||
4 | dword XML_lib_init = #aXMLlib_init; |
||
5 | |||
6 | dword initializeParser = #aInitializeParser; |
||
7 | dword releaseParser = #aReleaseParser; |
||
8 | dword parse = #aParse; |
||
9 | dword initializeClassParser = #aInitializeClassParser; |
||
10 | dword releaseCkassParser = #aReleaseClassParser; |
||
11 | dword classFromElement = #aClassFromElement; |
||
12 | dword classFromString = #aClassFromString; |
||
13 | |||
14 | $DD 2 dup 0 |
||
15 | |||
16 | char aXMLlib_init [] = "lib_init"; |
||
17 | char aInitializeParser[] = "ax_initializeParser"; |
||
18 | char aReleaseParser[] = "ax_releaseParser"; |
||
19 | char aParse[] = "ax_parse"; |
||
20 | char aInitializeClassParser[] = "ax_initializeClassParser"; |
||
21 | char aReleaseClassParser[] = "ax_releaseClassParser"; |
||
22 | char aClassFromElement[] = "ax_classFromElement"; |
||
23 | char aClassFromString[] = "ax_classFromString"; |
||
24 | |||
25 | //----------------------------------------------------------------------------- |
||
26 | // Error Codes |
||
27 | //----------------------------------------------------------------------------- |
||
28 | #define RC_OK 0 // everything is ok |
||
29 | #define RC_MEMORY 1 // out of memory |
||
30 | |||
31 | #define RC_EMPTY_NAME 10 // name empty or not defined |
||
32 | #define RC_ATTR_DEFINED 11 // attribute already defined |
||
33 | #define RC_ELEM_DEFINED 12 // element already defined |
||
34 | #define RC_SCHEMA_EMPTY 13 // schema does not contains a document |
||
35 | #define RC_DOCUMENT_DEFINED 14 // schema contains more than one document |
||
36 | #define RC_UNDEFINED_CLASS 15 // can't find collection in reference |
||
37 | #define RC_UNDEFINED_GROUP 16 // can't find a group in include |
||
38 | #define RC_INVALID_ID 17 // id is not a valid number |
||
39 | #define RC_INVALID_IGNORE 18 // ignore is not 'yes' or 'no' |
||
40 | |||
41 | #define RC_INVALID_ENTITY_REFERENCE 20 // must be amp, quot, lt, gt, or apos |
||
42 | #define RC_UNEXPECTED_END 21 // found last char too early |
||
43 | #define RC_INVALID_CHAR 22 // wrong char |
||
44 | #define RC_OVERFLOW 23 // number to big in char reference |
||
45 | #define RC_NO_START_TAG 24 // xml does not start with a tag |
||
46 | #define RC_TAG_MISMATCH 25 // invalid close tag |
||
47 | #define RC_INVALID_TAG 26 // invalid root element |
||
48 | #define RC_INVALID_ATTRIBUTE 27 // unknown attribute |
||
49 | #define RC_INVALID_PI 28 // invalid processing instruction ( |
||
50 | #define RC_INVALID_DOCTYPE 29 // duplicate doctype or after main element |
||
51 | #define RC_VERSION_EXPECTED 30 // version is missing in xml declaration |
||
52 | |||
53 | //----------------------------------------------------------------------------- |
||
54 | // Structures |
||
55 | //----------------------------------------------------------------------------- |
||
56 | |||
57 | struct AXElementClass |
||
58 | { |
||
59 | dword offset; // (int) Offset of the element in attribute list |
||
60 | dword name; // (char*) Name of the element (not zero terminated) |
||
61 | dword nameLimit; // (char*) End of the name of the element |
||
62 | dword size; // (unsigned int) size in bytes of an element of this class |
||
63 | dword id; // (unsigned int) container, text or mixed |
||
64 | dword type; // (unsigned int) container, text or mixed |
||
65 | dword propertyCount; // (unsigned int) number of attributes and text elements |
||
66 | dword childCount; // (unsigned int) number of child classes |
||
67 | dword attributes; // (int*) (internal) attribute map |
||
68 | dword elements; // (int*) (internal) element map |
||
69 | dword children; // (AXElementClass*) The list of child classes. |
||
70 | // The order is the one defined in the class |
||
71 | // definition file. |
||
72 | dword reserved; // (int) |
||
73 | dword reserved2; // (void*) |
||
74 | }; |
||
75 | |||
76 | struct AXClassContext |
||
77 | { |
||
78 | dword base; // (void*) |
||
79 | dword limit; // (void*) |
||
80 | dword chunks; // (void*) |
||
81 | dword chunkSize; // (int) |
||
82 | dword errorCode; // (int) |
||
83 | dword line; // (int) |
||
84 | dword column; // (int) |
||
85 | dword classes; // (AXElementClass**) all global classes |
||
86 | dword rootClass; // (AXElementClass*) the root class |
||
87 | dword rootElement; // (AXElement*) |
||
88 | }; |
||
89 | |||
90 | struct AXAttribute |
||
91 | { |
||
92 | dword begin; // (const char*) the value (not zero terminated) |
||
93 | // This slot can also contain an element if |
||
94 | // a |
||
95 | // use ax_getElement() to retrieve it. |
||
96 | dword limit; // (const char*) the end of the value |
||
97 | }; |
||
98 | |||
99 | struct AXElement |
||
100 | { |
||
101 | dword id; // (int) the class of the element |
||
102 | dword nextSibling; // (AXElement*) the next sibling element |
||
103 | dword firstChild; // (AXElement*) the first child element |
||
104 | dword lastChild; // (AXElement*) the last child element |
||
105 | AXAttribute reserved; // (AXAttribute) do not use |
||
106 | AXAttribute attributes; // (AXAttribute[]) the array of attributes |
||
107 | }; |
||
108 | |||
109 | struct AXParseContext |
||
110 | { |
||
111 | dword base; // (void*) |
||
112 | dword limit; // (void*) |
||
113 | dword chunks; // (void*) |
||
114 | dword chunkSize; // (int) |
||
115 | dword errorCode; // (int) |
||
116 | dword source; // (const char*) |
||
117 | dword current; // (const char*) |
||
118 | dword line; // (int) |
||
119 | dword column; // (int) |
||
120 | dword root; // (AXElement*) |
||
121 | AXAttribute version; // (AXAttribute) |
||
122 | AXAttribute encoding; // (AXAttribute) |
||
123 | dword strict; // (int) |
||
124 | dword reserved1; // (int) |
||
125 | AXElement reserved2; // (AXElement) |
||
126 | };?xml) |