blob: 9face07759c502722b6cea348486db3b6fc3812f [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001WHAT TO READ?
2=============
3
4For quick installation tips read INSTALL.
5
Lev Walkin07b51922004-09-06 08:08:32 +00006For the list of asn1c command line options, see `asn1c -h` or `man asn1c`.
7
Lev Walkinf15320b2004-06-03 03:38:44 +00008For more complete documentation on this compiler and on using the
9results of compilation please look into ./doc directory.
10
Lev Walkinf16d60b2004-09-05 10:41:23 +000011Please also read the FAQ file.
12
Lev Walkinf15320b2004-06-03 03:38:44 +000013An excellent book on ASN.1 is written by Olivier Dubuisson:
14"ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0.
15
Lev Walkinf15320b2004-06-03 03:38:44 +000016QUICK START
17===========
18
19After building [and installing] the compiler (see INSTALL), you may use
20the asn1c command to compile the ASN.1 specification:
21
Lev Walkinf16d60b2004-09-05 10:41:23 +000022 asn1c <module.asn1>
Lev Walkinf15320b2004-06-03 03:38:44 +000023
24If several specifications contain interdependencies, all of them must be
25specified:
26
Lev Walkinf16d60b2004-09-05 10:41:23 +000027 asn1c <module1.asn1> <module2.asn1> ...
Lev Walkinf15320b2004-06-03 03:38:44 +000028
29The ./examples directory contains several ASN.1 modules and a script to
Lev Walkinb67596b2004-09-07 06:39:12 +000030extract ASN.1 modules from RFC documents. Refer to the README file in that
31directory. To compile X.509 PKI module:
Lev Walkinf15320b2004-06-03 03:38:44 +000032
Lev Walkinb67596b2004-09-07 06:39:12 +000033 ./asn1c/asn1c -P ./examples/rfc3280-*.asn1
Lev Walkinf15320b2004-06-03 03:38:44 +000034
35In this example, -P option is used to instruct the compiler to print the
36compiled text on the standard output instead of creating multiple .c
Lev Walkinf16d60b2004-09-05 10:41:23 +000037and .h files for every ASN.1 type found inside the specified ASN.1 modules.
38This is useful for debugging and test automation.
Lev Walkinf15320b2004-06-03 03:38:44 +000039
40The compiler -E and -EF options are used for testing the parser and
41the semantic fixer, respectively. These options will instruct the compiler
42to dump out the parsed (and fixed) ASN.1 specification as it was
43"understood" by the compiler. It might be useful for checking
44whether a particular syntactic construction is properly supported
45by the compiler.
46
Lev Walkinf16d60b2004-09-05 10:41:23 +000047 asn1c -EF <module-to-test.asn1>
Lev Walkinf15320b2004-06-03 03:38:44 +000048
49
50MODEL OF OPERATION
51==================
52
53The asn1c compiler works by processing the ASN.1 module specification
54in several stages:
551. In the first stage, the ASN.1 file is parsed.
Lev Walkinf16d60b2004-09-05 10:41:23 +000056 (Parsing produces an ASN.1 syntax tree for the subsequent levels)
Lev Walkinf15320b2004-06-03 03:38:44 +0000572. In the second stage, the syntax tree is "fixed".
Lev Walkinf16d60b2004-09-05 10:41:23 +000058 (Fixing is a process of checking the tree for semantic errors,
59 accompanied by the tree transformation into the canonical form)
Lev Walkinf15320b2004-06-03 03:38:44 +0000603. In the third stage, the syntax tree is compiled into the target language.
61
62There are several command-line options reserved for printing the results
63after each stage of operation:
64
65 <parser> => print (-E)
66 <parser> => <fixer> => print (-E -F)
67 <parser> => <fixer> => <compiler> => print (-P)
68 <parser> => <fixer> => <compiler> => save-compiled [default]
69
70
71--
72Lev Walkin
73vlm@lionet.info