[6] | 1 | Developer Notes: |
---|
| 2 | |
---|
| 3 | The parser is built on several levels: |
---|
| 4 | |
---|
| 5 | 1. The closest to the user. |
---|
| 6 | |
---|
| 7 | Modules: m_xml_parser: The main module |
---|
| 8 | m_error : Basic error handling |
---|
| 9 | |
---|
| 10 | 2. An intermediate layer. |
---|
| 11 | |
---|
| 12 | Modules: m_fsm (A finite-state machine to parse the input) |
---|
| 13 | |
---|
| 14 | 3. A layer defining basic data structures and file interfaces: |
---|
| 15 | |
---|
| 16 | Modules: m_reader: File interface and character handling as per XML specs. |
---|
| 17 | m_buffer: Basic homemade "variable length string", with some |
---|
| 18 | limitations (size, of course), but avoiding the |
---|
| 19 | use of dynamic structures for now. |
---|
| 20 | m_dictionary: Simple, not dynamic. |
---|
| 21 | m_charset: A simple hashing method for sets of characters. |
---|
| 22 | m_elstack: Simple stack to check well-formedness. |
---|
| 23 | m_entities: Entity replacement utilities. |
---|
| 24 | |
---|
| 25 | 4. Something which does not really belong in the parser but which |
---|
| 26 | is useful to massage the data extracted from the file: |
---|
| 27 | |
---|
| 28 | m_converters: Routines to turn pcdata chunks into numerical arrays |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | There are obviously a number of hardwired limitations, which should be |
---|
| 32 | removed in a later version: |
---|
| 33 | |
---|
| 34 | * Buffer size in buffer_t definition. This is not as serious as it |
---|
| 35 | looks. Only long unbroken pcdata sections and overly long attribute |
---|
| 36 | names or values will be affected. Long SGML declarations and comments |
---|
| 37 | might be truncated, but they are not relevant anyway. |
---|
| 38 | |
---|
| 39 | * Maximum number of attributes in an element tag (set in m_dictionary) |
---|
| 40 | |
---|
| 41 | While the parser does not use any variable-length strings (to keep it |
---|
| 42 | compatible with existing Fortran90 compilers) or dynamical data |
---|
| 43 | structures for attribute dictionaries, etc, such improvements could be |
---|
| 44 | incorporated almost as drop-in replacements for existing sub-modules. |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | The coding style is that of the F subset of Fortran90. I strongly |
---|
| 48 | believe that it makes for better coding and fewer errors. |
---|
| 49 | Go to http://www.fortran.com/imagine1/ and get a feel for it. You can |
---|
| 50 | download free implementations for Linux and Windows, or get an |
---|
| 51 | inexpensive CD+Book combination to help support the project. Of course, |
---|
| 52 | F *is* Fortran, so you can always compile it with a Fortran compiler. |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | |
---|