-## $Id: Makefile.am,v 1.78 2007-01-22 12:14:09 adam Exp $
+## $Id: Makefile.am,v 1.79 2007-05-07 13:18:32 adam Exp $
docdir=$(datadir)/doc/@PACKAGE@
indexdata.xml \
asn.xml tools.xml odr.xml comstack.xml frontend.xml license.xml \
future.xml client.xml ziffy.xml zoom.xml credits.xml gfs-options.xml \
- yaz.xml yaz-client-commands.xml soap.xml gfs-virtual.xml gfs-synopsis.xml
+ yaz.xml yaz-client-commands.xml soap.xml gfs-virtual.xml gfs-synopsis.xml \
+ std-oid-table.xml
HTMLFILES = index.html
EXTRA_DIST = $(XMLFILES) $(SUPPORTFILES) $(man_MANS) $(REFFILES) \
$(doc_DATA)
+std-oid-table.xml: $(srcdir)/../src/oid.csv
+ $(TCLSH) $(srcdir)/../src/oidtoc.tcl $(srcdir) $(srcdir)/../src/oid.csv std-oid-table.xml
+
yaz-client.1: $(srcdir)/yaz-client-man.xml $(srcdir)/yaz-client-commands.xml
$(MAN_COMPILE) $(srcdir)/yaz-client-man.xml
-<!-- $Id: tools.xml,v 1.60 2007-05-04 12:36:56 adam Exp $ -->
+<!-- $Id: tools.xml,v 1.61 2007-05-07 13:18:32 adam Exp $ -->
<chapter id="tools"><title>Supporting Tools</title>
<para>
string (here Bib-1) is supplied by a user or configuration.
</para>
</example>
+
+ </sect2>
+ <sect2 id="tools.oid.std"><title>Standard OIDs</title>
<para>
All the object identifers in the standard OID database as returned
by <function>yaz_oid_std</function> can referenced directly in a
- program. Each constant OID is prefixed with <literal>yaz_oid_</literal> -
+ program as a constant OID.
+ Each constant OID is prefixed with <literal>yaz_oid_</literal> -
followed by OID class (lowercase) - then by OID name (normalized and
lowercase).
</para>
<para>
+ See <xref linkend="list-oids"/> for list of all object identifiers
+ built into YAZ.
These are declared in <filename>yaz/oid_std.h</filename> but are
included by <filename>yaz/oid_db.h</filename> as well.
</para>
## This file is part of the YAZ toolkit.
## Copyright (C) 1995-2007, Index Data, All rights reserved.
-## $Id: Makefile.am,v 1.67 2007-05-01 12:22:11 adam Exp $
+## $Id: Makefile.am,v 1.68 2007-05-07 13:18:32 adam Exp $
YAZ_VERSION_INFO=3:0:0
# Generate OID database from CSV
oid_std.c $(top_srcdir)/include/yaz/oid_std.h: oidtoc.tcl oid.csv
- $(TCLSH) $(srcdir)/oidtoc.tcl $(srcdir) oid.csv oid_std.c oid_std.h
+ $(TCLSH) $(srcdir)/oidtoc.tcl $(srcdir) $(srcdir)/oid.csv oid_std.c oid_std.h
# Generate diagnostics from CSVs
diagbib1.c $(top_srcdir)/include/yaz/diagbib1.h: csvtobib1.tcl bib1.csv
# Copyright (c) Index Data 2006-2007
# See the file LICENSE for details.
#
-# $Id: oidtoc.tcl,v 1.5 2007-05-06 20:18:29 adam Exp $
+# $Id: oidtoc.tcl,v 1.6 2007-05-07 13:18:32 adam Exp $
#
# Converts a CSV file with Object identifiers to C
return $oids
}
+proc constant_var {oid} {
+ set lname [string tolower [lindex $oid 2]]
+ set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
+ set prefix [string tolower [lindex $oid 0]]
+
+ return yaz_oid_${prefix}_${lname}
+}
+
+proc oid_to_xml {srcdir input xname} {
+ set oids [readoids "${input}"]
+ set xfile [open "${xname}" w]
+
+ puts $xfile "<!-- Generated by oidtoc.tcl from $input -->"
+ puts $xfile {<table id="standard-oids">}
+ puts $xfile {<title>Standard Object Identifiers</title>}
+ puts $xfile {<tgroup cols="4">}
+ puts $xfile {<colspec colwidth="3*" colname="name"></colspec>}
+ puts $xfile {<colspec colwidth="2*" colname="class"></colspec>}
+ puts $xfile {<colspec colwidth="4*" colspec="constant"></colspec>}
+ puts $xfile {<colspec colwidth="5*" colname="oid"></colspec>}
+ puts $xfile {<thead>}
+ puts $xfile {<row>}
+ puts $xfile {<entry>Name</entry>}
+ puts $xfile {<entry>Class</entry>}
+ puts $xfile {<entry>Constant</entry>}
+ puts $xfile {<entry>OID</entry>}
+ puts $xfile {</row>}
+ puts $xfile {</thead>}
+ puts $xfile {<tbody>}
+
+ foreach oid $oids {
+ puts $xfile {<row>}
+
+ puts $xfile {<entry>}
+ puts $xfile [lindex $oid 2]
+ puts $xfile {</entry>}
+
+
+ puts $xfile {<entry>}
+ puts $xfile [lindex $oid 0]
+ puts $xfile {</entry>}
+
+ puts $xfile {<entry><literal>}
+ set v [constant_var $oid]
+ puts $xfile $v
+ puts $xfile {</literal></entry>}
+
+ puts $xfile {<entry>}
+ puts $xfile [lindex $oid 1]
+ puts $xfile {</entry>}
+
+ puts $xfile {</row>}
+ }
+
+ puts $xfile {</tbody>}
+ puts $xfile {</tgroup>}
+
+ puts $xfile {</table>}
+ close $xfile
+}
+
proc oid_to_c {srcdir input cname hname} {
- set oids [readoids "${srcdir}/${input}"]
+ set oids [readoids "${input}"]
set cfile [open "${srcdir}/${cname}" w]
set hfile [open "${srcdir}/../include/yaz/${hname}" w]
puts $hfile "YAZ_BEGIN_CDECL"
foreach oid $oids {
- set lname [string tolower [lindex $oid 2]]
- set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
- set prefix [string tolower [lindex $oid 0]]
+
+ set v [constant_var $oid]
- puts -nonewline $cfile "YAZ_EXPORT extern const int yaz_oid_${prefix}_${lname}\[\] = \{"
+ puts -nonewline $cfile "YAZ_EXPORT const int $v\[\] = \{"
puts -nonewline $cfile [string map {. ,} [lindex $oid 1]]
puts $cfile ",-1\};"
- puts $hfile "OID_EXPORT extern const int yaz_oid_${prefix}_${lname}\[\];"
+ puts $hfile "OID_EXPORT extern const int $v\[\];"
}
puts $cfile "YAZ_EXPORT struct yaz_oid_entry yaz_oid_standard_entries\[\] ="
puts $cfile "\{"
foreach oid $oids {
- set lname [string tolower [lindex $oid 2]]
- set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
- set prefix [string tolower [lindex $oid 0]]
+ set v [constant_var $oid]
puts -nonewline $cfile "\t\{CLASS_[lindex $oid 0], "
- puts -nonewline $cfile "yaz_oid_${prefix}_${lname}, "
+ puts -nonewline $cfile "$v, "
puts -nonewline $cfile \"[lindex $oid 2]\"
puts $cfile "\},"
}
close $hfile
}
-if {[llength $argv] != 4} {
+if {[llength $argv] == 4} {
+ oid_to_c [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3]
+} elseif {[llength $argv] == 3} {
+ oid_to_xml [lindex $argv 0] [lindex $argv 1] [lindex $argv 2]
+} else {
puts "oidtoc.tcl srcdir csv cfile hfile"
exit 1
}
-oid_to_c [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3]