blob: be74c6ba7ff28355d63df5227ce3accd387ace97 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001WHAT TO READ?
2=============
3
Lev Walkin33cded12004-09-19 19:40:52 +00004If you haven't installed the asn1c yet, read the INSTALL file for
5a short installation guide.
Lev Walkinf15320b2004-06-03 03:38:44 +00006
Lev Walkin07b51922004-09-06 08:08:32 +00007For the list of asn1c command line options, see `asn1c -h` or `man asn1c`.
8
Lev Walkinf15320b2004-06-03 03:38:44 +00009For more complete documentation on this compiler and on using the
Lev Walkin33cded12004-09-19 19:40:52 +000010results of compilation phase, please look into asn1c-usage.{pdf,html}.
11If you are building the compiler from the sources, these documents reside
12in the ./doc directory, otherwise they lie nearby the README file you're
13reading right now.
Lev Walkinf15320b2004-06-03 03:38:44 +000014
Lev Walkinf16d60b2004-09-05 10:41:23 +000015Please also read the FAQ file.
16
Lev Walkinf15320b2004-06-03 03:38:44 +000017An excellent book on ASN.1 is written by Olivier Dubuisson:
18"ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0.
19
Lev Walkinf15320b2004-06-03 03:38:44 +000020QUICK START
21===========
22
23After building [and installing] the compiler (see INSTALL), you may use
24the asn1c command to compile the ASN.1 specification:
25
Lev Walkin33cded12004-09-19 19:40:52 +000026 asn1c <module.asn1> # Compile module
Lev Walkinf15320b2004-06-03 03:38:44 +000027
28If several specifications contain interdependencies, all of them must be
29specified:
30
Lev Walkin33cded12004-09-19 19:40:52 +000031 asn1c <module1.asn1> <module2.asn1> ... # Compile interdependent modules
Lev Walkinf15320b2004-06-03 03:38:44 +000032
Lev Walkin33cded12004-09-19 19:40:52 +000033If you are building the asn1c from the sources, the ./examples directory
34contains several ASN.1 modules and a script to extract the ASN.1 modules
35from RFC documents. Refer to the README file in that directory.
36To compile the X.509 PKI module:
Lev Walkinf15320b2004-06-03 03:38:44 +000037
Lev Walkin33cded12004-09-19 19:40:52 +000038 ./asn1c/asn1c -P ./examples/rfc3280-*.asn1 # Compile-n-print
Lev Walkinf15320b2004-06-03 03:38:44 +000039
40In this example, -P option is used to instruct the compiler to print the
41compiled text on the standard output instead of creating multiple .c
Lev Walkinf16d60b2004-09-05 10:41:23 +000042and .h files for every ASN.1 type found inside the specified ASN.1 modules.
43This is useful for debugging and test automation.
Lev Walkinf15320b2004-06-03 03:38:44 +000044
45The compiler -E and -EF options are used for testing the parser and
46the semantic fixer, respectively. These options will instruct the compiler
47to dump out the parsed (and fixed) ASN.1 specification as it was
48"understood" by the compiler. It might be useful for checking
49whether a particular syntactic construction is properly supported
50by the compiler.
51
Lev Walkin33cded12004-09-19 19:40:52 +000052 asn1c -EF <module-to-test.asn1> # Check semantic validity
Lev Walkinf15320b2004-06-03 03:38:44 +000053
54
55MODEL OF OPERATION
56==================
57
58The asn1c compiler works by processing the ASN.1 module specification
59in several stages:
601. In the first stage, the ASN.1 file is parsed.
Lev Walkinf16d60b2004-09-05 10:41:23 +000061 (Parsing produces an ASN.1 syntax tree for the subsequent levels)
Lev Walkinf15320b2004-06-03 03:38:44 +0000622. In the second stage, the syntax tree is "fixed".
Lev Walkinf16d60b2004-09-05 10:41:23 +000063 (Fixing is a process of checking the tree for semantic errors,
64 accompanied by the tree transformation into the canonical form)
Lev Walkinf15320b2004-06-03 03:38:44 +0000653. In the third stage, the syntax tree is compiled into the target language.
66
67There are several command-line options reserved for printing the results
68after each stage of operation:
69
70 <parser> => print (-E)
71 <parser> => <fixer> => print (-E -F)
72 <parser> => <fixer> => <compiler> => print (-P)
73 <parser> => <fixer> => <compiler> => save-compiled [default]
74
75
76--
77Lev Walkin
78vlm@lionet.info