Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | WHAT TO READ? |
| 2 | ============= |
| 3 | |
| 4 | For quick installation tips read INSTALL. |
| 5 | |
| 6 | For more complete documentation on this compiler and on using the |
| 7 | results of compilation please look into ./doc directory. |
| 8 | |
| 9 | An excellent book on ASN.1 is written by Olivier Dubuisson: |
| 10 | "ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0. |
| 11 | |
| 12 | |
| 13 | QUICK START |
| 14 | =========== |
| 15 | |
| 16 | After building [and installing] the compiler (see INSTALL), you may use |
| 17 | the asn1c command to compile the ASN.1 specification: |
| 18 | |
| 19 | asn1c <spec.asn1> |
| 20 | |
| 21 | If several specifications contain interdependencies, all of them must be |
| 22 | specified: |
| 23 | |
| 24 | asn1c <spec1.asn1> <spec2.asn1> ... |
| 25 | |
| 26 | The ./examples directory contains several ASN.1 modules and a script to |
| 27 | extract ASN.1 modules from RFC documents. To compile X.509 PKI module: |
| 28 | |
| 29 | ./asn1c/asn1c -P ./examples/*PKIX*93*.asn1 |
| 30 | |
| 31 | In this example, -P option is used to instruct the compiler to print the |
| 32 | compiled text on the standard output instead of creating multiple .c |
| 33 | and .h files for every ASN.1 type found inside the specified files. |
| 34 | This is useful for debugging and tests automation. |
| 35 | |
| 36 | The compiler -E and -EF options are used for testing the parser and |
| 37 | the semantic fixer, respectively. These options will instruct the compiler |
| 38 | to dump out the parsed (and fixed) ASN.1 specification as it was |
| 39 | "understood" by the compiler. It might be useful for checking |
| 40 | whether a particular syntactic construction is properly supported |
| 41 | by the compiler. |
| 42 | |
| 43 | asn1c -EF <spec-to-test.asn1> |
| 44 | |
| 45 | |
| 46 | MODEL OF OPERATION |
| 47 | ================== |
| 48 | |
| 49 | The asn1c compiler works by processing the ASN.1 module specification |
| 50 | in several stages: |
| 51 | 1. In the first stage, the ASN.1 file is parsed. |
| 52 | (Parsing produces an ASN.1 syntax tree for the subsequent levels.) |
| 53 | 2. In the second stage, the syntax tree is "fixed". |
| 54 | (Fixing is done by checking the tree for semantic errors |
| 55 | and by transforming the tree into the canonical representation.) |
| 56 | 3. In the third stage, the syntax tree is compiled into the target language. |
| 57 | |
| 58 | There are several command-line options reserved for printing the results |
| 59 | after each stage of operation: |
| 60 | |
| 61 | <parser> => print (-E) |
| 62 | <parser> => <fixer> => print (-E -F) |
| 63 | <parser> => <fixer> => <compiler> => print (-P) |
| 64 | <parser> => <fixer> => <compiler> => save-compiled [default] |
| 65 | |
| 66 | |
| 67 | -- |
| 68 | Lev Walkin |
| 69 | vlm@lionet.info |