X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=doc%2Ftools.xml;h=3e711d0ee27a81e62588b2300012c7e4b8d4e88d;hp=b8ff153b5358c63ad17260b823533bc8f9bf4d13;hb=7a98e9bfbb9d5fe7d44822a9838e3becbdce9363;hpb=38ce2c71a8aa497a5c445dd36d12d0d535dea79a diff --git a/doc/tools.xml b/doc/tools.xml index b8ff153..3e711d0 100644 --- a/doc/tools.xml +++ b/doc/tools.xml @@ -1,4 +1,4 @@ - + Supporting Tools @@ -1541,27 +1541,30 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); The basic YAZ representation of an OID is an array of integers, - terminated with the value -1. There is a typedef - of this integer to Odr_oid but this is not consistenly - used everywhere. + terminated with the value -1. This integer is of type + Odr_oid. - An OID can either be declared as a automatic variable or we can - allocated using the ODR/NMEM memory utilities. It's + Fundamental OID operations and the type Odr_oid + are defined in yaz/oid_util.h. + + + An OID can either be declared as a automatic variable or it can + allocated using the memory utilities or ODR/NMEM. It's guaranteed that an OID can fit in OID_SIZE integers. Create OID on stack We can create an OID for the Bib-1 attribute set with: - int bib1[OID_SIZE]; - myoid[0] = 1; - myoid[1] = 2; - myoid[2] = 840; - myoid[3] = 10003; - myoid[4] = 3; - myoid[5] = 1; - myoid[6] = -1; + Odr_oid bib1[OID_SIZE]; + bib1[0] = 1; + bib1[1] = 2; + bib1[2] = 840; + bib1[3] = 10003; + bib1[4] = 3; + bib1[5] = 1; + bib1[6] = -1; @@ -1569,14 +1572,15 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); And OID may also be filled from a string-based representation using dots (.). This is achieved by function - int oid_dotstring_to_oid(const char *name, int *oid); + int oid_dotstring_to_oid(const char *name, Odr_oid *oid); + This functions returns 0 if name could be converted; -1 otherwise. Using oid_oiddotstring_to_oid - We can create the Bib-1 attribute set OID easier with: + We can fill the Bib-1 attribute set OID easier with: - int bib1[OID_SIZE]; + Odr_oid bib1[OID_SIZE]; oid_oiddotstring_to_oid("1.2.840.10003.3.1", bib1); @@ -1604,7 +1608,7 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); The function - char *oid_oid_to_dotstring(const int *oid, char *oidbuf) + char *oid_oid_to_dotstring(const Odr_oid *oid, char *oidbuf) does the reverse of oid_oiddotstring_to_oid. It converts an OID to the string-based representation using dots. @@ -1630,7 +1634,7 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); From YAZ version 3 and later, the oident system has been replaced by an OID database. OID database is a misnomer .. the old odient - was a database system too. + system was also a database. The OID database is really just a map between named Object Identifiers