From 38ce2c71a8aa497a5c445dd36d12d0d535dea79a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 7 May 2007 13:18:32 +0000 Subject: [PATCH] List of built-in OIDs in documentation. --- doc/Makefile.am | 8 +++-- doc/entities.ent | 3 +- doc/tools.xml | 10 +++++-- doc/yaz.xml | 10 ++++++- src/Makefile.am | 4 +-- src/oidtoc.tcl | 87 ++++++++++++++++++++++++++++++++++++++++++++++-------- 6 files changed, 101 insertions(+), 21 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 8cf283a..5bc421a 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,4 @@ -## $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@ @@ -8,7 +8,8 @@ XMLFILES=bookinfo.xml introduction.xml installation.xml \ 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 @@ -27,6 +28,9 @@ man_MANS = $(MANFILES) 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 diff --git a/doc/entities.ent b/doc/entities.ent index 3ebacfe..b0df6a3 100644 --- a/doc/entities.ent +++ b/doc/entities.ent @@ -1,4 +1,4 @@ - + @@ -13,6 +13,7 @@ + diff --git a/doc/tools.xml b/doc/tools.xml index 2abc984..b8ff153 100644 --- a/doc/tools.xml +++ b/doc/tools.xml @@ -1,4 +1,4 @@ - + Supporting Tools @@ -1679,15 +1679,21 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); string (here Bib-1) is supplied by a user or configuration. + + + Standard OIDs All the object identifers in the standard OID database as returned by yaz_oid_std can referenced directly in a - program. Each constant OID is prefixed with yaz_oid_ - + program as a constant OID. + Each constant OID is prefixed with yaz_oid_ - followed by OID class (lowercase) - then by OID name (normalized and lowercase). + See for list of all object identifiers + built into YAZ. These are declared in yaz/oid_std.h but are included by yaz/oid_db.h as well. diff --git a/doc/yaz.xml b/doc/yaz.xml index 0585fcd..12657cb 100644 --- a/doc/yaz.xml +++ b/doc/yaz.xml @@ -1,5 +1,5 @@ - + List of Object Identifiers + + These is a list of object identifiers that are built into YAZ. + + &std-oid-table; + + &app-license; &app-indexdata; &app-credits; diff --git a/src/Makefile.am b/src/Makefile.am index 576559a..b4f6cf8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ ## 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 @@ -42,7 +42,7 @@ marc8r.c: charconv.tcl codetables.xml # 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 diff --git a/src/oidtoc.tcl b/src/oidtoc.tcl index 2b2d5fa..c57a56e 100644 --- a/src/oidtoc.tcl +++ b/src/oidtoc.tcl @@ -2,7 +2,7 @@ # 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 @@ -34,8 +34,69 @@ proc readoids {input} { 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 "" + puts $xfile {} + puts $xfile {Standard Object Identifiers} + puts $xfile {} + puts $xfile {} + puts $xfile {} + puts $xfile {} + puts $xfile {} + puts $xfile {} + puts $xfile {} + puts $xfile {Name} + puts $xfile {Class} + puts $xfile {Constant} + puts $xfile {OID} + puts $xfile {} + puts $xfile {} + puts $xfile {} + + foreach oid $oids { + puts $xfile {} + + puts $xfile {} + puts $xfile [lindex $oid 2] + puts $xfile {} + + + puts $xfile {} + puts $xfile [lindex $oid 0] + puts $xfile {} + + puts $xfile {} + set v [constant_var $oid] + puts $xfile $v + puts $xfile {} + + puts $xfile {} + puts $xfile [lindex $oid 1] + puts $xfile {} + + puts $xfile {} + } + + puts $xfile {} + puts $xfile {} + + puts $xfile {
} + 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] @@ -59,26 +120,23 @@ proc oid_to_c {srcdir input cname hname} { 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 "\}," } @@ -93,8 +151,11 @@ proc oid_to_c {srcdir input cname hname} { 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] -- 1.7.10.4