Source restructure. yaz-marcdump part of installation
[yaz-moved-to-github.git] / doc / yaz-asncomp-man.xml
diff --git a/doc/yaz-asncomp-man.xml b/doc/yaz-asncomp-man.xml
new file mode 100644 (file)
index 0000000..f39207f
--- /dev/null
@@ -0,0 +1,254 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+]>
+<refentry id="yaz-asncomp">
+ <refmeta>
+  <refentrytitle>yaz-asncomp</refentrytitle>
+  <manvolnum>1</manvolnum>
+ </refmeta>
+ <refnamediv>
+  <refname>yaz-asncomp</refname>
+  <refpurpose>YAZ ASN.1 compiler</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+  <cmdsynopsis>
+   <command>yaz-asncomp</command>
+   <arg choice="opt"><option>-v</option></arg>
+   <arg choice="opt"><option>-c <replaceable>cfile</replaceable></option></arg>
+   <arg choice="opt"><option>-h <replaceable>hfile</replaceable></option></arg>
+   <arg choice="opt"><option>-p <replaceable>pfile</replaceable></option></arg>
+   <arg choice="opt"><option>-d <replaceable>config</replaceable></option></arg>
+   <arg choice="opt"><option>-I <replaceable>includeout</replaceable></option></arg>
+   <arg choice="opt"><option>-i <replaceable>includedir</replaceable></option></arg>
+   <arg choice="opt"><option>-m <replaceable>module</replaceable></option></arg>
+   <arg choice="opt">filename</arg>
+  </cmdsynopsis>
+  
+ </refsynopsisdiv>
+  <refsect1><title>DESCRIPTION</title>
+  <para>
+   <command>yaz-asncomp</command> is an ASN.1 compiler that
+   reads an ASN.1 specification in <replaceable>filename</replaceable>
+   and produces C/C++ definitions and BER encoders/decoders for it.
+  </para>
+  <para>
+   The produced C/C++ code and header files uses the ODR module of YAZ
+   which is a library that encodes/decodes/prints BER packages.
+   <command>yaz-asncomp</command> allows you to specify name of
+   resulting source via options. Alternatively, you can specify
+   a DEFINISIONS file, which provides customized output to
+   many output files - if the ASN.1 specification file consists
+   of many modules.
+  </para>
+  <para>
+   This utility is written in Tcl. Any version of Tcl should work.
+  </para>
+  </refsect1>
+    <refsect1>
+  <title>OPTIONS</title>
+  <variablelist>
+   <varlistentry><term><literal>-v </literal>
+ </term>
+    <listitem>
+     <para>
+      Makes the ASN.1 compiler print more verbose about the
+      various stages of operations. 
+     </para>
+    </listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-c </literal>
+     <replaceable>cfile</replaceable></term>
+    <listitem><para>
+      Specifies the name of the C/C++ file with encoders/decoders.
+     </para></listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-h </literal>
+     <replaceable>hfile</replaceable></term>
+    <listitem><para>
+      Specifies the name of header file with definitions.
+     </para></listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-p </literal>
+     <replaceable>pfile</replaceable></term>
+    <listitem><para>
+      Specifies the name of the a private header file with
+      definitions. By default all definitions are put
+      in header file (option -h).
+     </para></listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-d </literal>
+     <replaceable>dfile</replaceable></term>
+    <listitem><para>
+      Specifies the name of a definitions file.
+     </para></listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-I </literal>
+     <replaceable>iout</replaceable></term>
+    <listitem><para>
+      Specifies first part of directory in which header files
+      are written.
+     </para></listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-i </literal>
+     <replaceable>idir</replaceable></term>
+    <listitem><para>
+      Specifies second part of directory in which header files
+      are written.
+     </para></listitem>
+   </varlistentry>
+   
+   <varlistentry><term><literal>-m </literal>
+     <replaceable>module</replaceable></term>
+    <listitem><para>
+      Specifies that ASN.1 compiler should only process the
+      module given. If this option is not specified,
+      all modules in the ASN.1 file are processed.
+     </para></listitem>
+   </varlistentry>
+   
+  </variablelist>
+ </refsect1>
+ <refsect1><title>DEFINITIONS FILE</title>
+  <para>
+   The definitions file is really a Tcl script but follows
+   traditional rules for Shell like configuration files.
+   That is # denotes the beginning of a comment. Definitions
+   are line oriented. The definitions files usually consists of
+   a series of variable assignments of the form:
+  </para>
+  <para>
+   <literal>set</literal> <replaceable>name</replaceable> <replaceable>value</replaceable>
+  </para>
+  <para>
+   Available variables are:
+   <variablelist>
+    
+    <varlistentry><term><literal>default-prefix</literal></term>
+     <listitem><para>
+       Sets prefix for names in the produced output.
+       The value consists of three tokens: C function prefix,
+       C typedef prefix and preprocessor prefix respectively.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>prefix(</literal><replaceable>module</replaceable><literal>)</literal></term>
+     <listitem><para>
+       This value sets prefix values for module
+       <replaceable>module</replaceable>.
+       The value has same form as <literal>default-prefix</literal>.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>filename(</literal><replaceable>module</replaceable><literal>)</literal></term>
+     <listitem><para>
+       Specifies filename for C/header file for module
+       <replaceable>module</replaceable>.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>init(</literal><replaceable>module</replaceable><literal>,h)</literal></term>
+     <listitem><para>
+       Code fragment to be put in first part of public header for module 
+    <replaceable>module</replaceable>.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>body(</literal><replaceable>module</replaceable><literal>,h)</literal></term>
+     <listitem><para>
+       Code fragment to be put in last part of public header for module 
+    <replaceable>module</replaceable> (trailer).
+      </para></listitem>
+    </varlistentry>
+
+    <varlistentry><term><literal>init(</literal><replaceable>module</replaceable><literal>,c)</literal></term>
+     <listitem><para>
+       Code fragment to be put in first part of C based encoder/decoder for
+       module <replaceable>module</replaceable>.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>body(</literal><replaceable>module</replaceable><literal>,c)</literal></term>
+     <listitem><para>
+       Code fragment to be put in last part of C based encoder/decoder for
+       module <replaceable>module</replaceable> (trailer).
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>map(</literal><replaceable>module</replaceable><literal>,</literal><replaceable>name</replaceable><literal>)</literal></term>
+     <listitem><para>
+       Maps ASN.1 type in module <replaceable>module</replaceable> 
+       of <replaceable>name</replaceable> to value.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>membermap(</literal><replaceable>module</replaceable><literal>,</literal><replaceable>name</replaceable><literal>,</literal><replaceable>member</replaceable><literal>)</literal></term>
+     <listitem><para>
+       Maps member <replaceable>member</replaceable> in SEQUENCE/CHOICE of
+       <replaceable>name</replaceable> in module
+       <replaceable>module</replaceable> to value.
+       The value consists of one or two tokens.
+       First token is name of C preprocessor part. Second token
+       is resulting C member name. If second token is omitted
+       the value (one token) is both preprocessor part and
+       C <literal>struct</literal>,<literal>union</literal>.
+      </para></listitem>
+    </varlistentry>
+    
+    <varlistentry><term><literal>unionmap(</literal><replaceable>module</replaceable><literal>,</literal><replaceable>name</replaceable><literal>,</literal><replaceable>member</replaceable><literal>)</literal></term>
+     <listitem><para>
+       Maps member <replaceable>member</replaceable> in CHOICE of
+       <replaceable>name</replaceable> in module
+       <replaceable>module</replaceable> to value.
+       Value consists of to or three tokens. The first token
+       is name of the integer in the <literal>union</literal> that
+       is used as selector for the <literal>union</literal> itself.
+       The second token is name of the <literal>union</literal>.
+       The third token overrides the name of the CHOICE member;
+       if omitted the member name is used.
+      </para></listitem>
+    </varlistentry>
+   </variablelist>
+  </para>
+ </refsect1>
+ <refsect1><title>FILES</title>
+  <para>
+   <filename>/usr/share/yaz/z39.50/z.tcl</filename>
+  </para>
+  <para>
+   <filename>/usr/share/yaz/z39.50/*.asn</filename>
+  </para>
+ </refsect1>
+ <refsect1><title>SEE ALSO</title>
+  <para>
+   <citerefentry>
+    <refentrytitle>yaz</refentrytitle>
+    <manvolnum>7</manvolnum></citerefentry>
+  </para>
+  <para>
+   Section "The ODR Module" in the YAZ manual.
+  </para>
+ </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-local-catalogs: nil
+sgml-namecase-general:t
+End:
+-->