blob: d9a958599b650efcee2cd26f3d5cb02df6139e08 [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
30extract ASN.1 modules from RFC documents. To compile X.509 PKI module:
31
32 ./asn1c/asn1c -P ./examples/*PKIX*93*.asn1
33
34In this example, -P option is used to instruct the compiler to print the
35compiled text on the standard output instead of creating multiple .c
Lev Walkinf16d60b2004-09-05 10:41:23 +000036and .h files for every ASN.1 type found inside the specified ASN.1 modules.
37This is useful for debugging and test automation.
Lev Walkinf15320b2004-06-03 03:38:44 +000038
39The compiler -E and -EF options are used for testing the parser and
40the semantic fixer, respectively. These options will instruct the compiler
41to dump out the parsed (and fixed) ASN.1 specification as it was
42"understood" by the compiler. It might be useful for checking
43whether a particular syntactic construction is properly supported
44by the compiler.
45
Lev Walkinf16d60b2004-09-05 10:41:23 +000046 asn1c -EF <module-to-test.asn1>
Lev Walkinf15320b2004-06-03 03:38:44 +000047
48
49MODEL OF OPERATION
50==================
51
52The asn1c compiler works by processing the ASN.1 module specification
53in several stages:
541. In the first stage, the ASN.1 file is parsed.
Lev Walkinf16d60b2004-09-05 10:41:23 +000055 (Parsing produces an ASN.1 syntax tree for the subsequent levels)
Lev Walkinf15320b2004-06-03 03:38:44 +0000562. In the second stage, the syntax tree is "fixed".
Lev Walkinf16d60b2004-09-05 10:41:23 +000057 (Fixing is a process of checking the tree for semantic errors,
58 accompanied by the tree transformation into the canonical form)
Lev Walkinf15320b2004-06-03 03:38:44 +0000593. In the third stage, the syntax tree is compiled into the target language.
60
61There are several command-line options reserved for printing the results
62after each stage of operation:
63
64 <parser> => print (-E)
65 <parser> => <fixer> => print (-E -F)
66 <parser> => <fixer> => <compiler> => print (-P)
67 <parser> => <fixer> => <compiler> => save-compiled [default]
68
69
70--
71Lev Walkin
72vlm@lionet.info