X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fmarcdisp.h;h=fb0bab8a35413949ccc9c80a348db79cfd005019;hp=752de41ebc920c2a144b5e4c6d50046cb2123991;hb=30af0a1ebbea75c3e757eb03d3f988c61fce8511;hpb=4c1a14ddb2c650b935bc8dff4dc3f8a98ff7531c diff --git a/include/yaz/marcdisp.h b/include/yaz/marcdisp.h index 752de41..fb0bab8 100644 --- a/include/yaz/marcdisp.h +++ b/include/yaz/marcdisp.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data. + * Copyright (C) Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -76,6 +76,8 @@ YAZ_EXPORT void yaz_marc_xml(yaz_marc_t mt, int xmlmode); #define YAZ_MARC_CHECK 6 /** \brief Output format: Turbo MARC Index Data format (XML based) */ #define YAZ_MARC_TURBOMARC 7 +/** \brief Output format: JSON */ +#define YAZ_MARC_JSON 8 /** \brief set iconv handle for character set conversion */ YAZ_EXPORT void yaz_marc_iconv(yaz_marc_t mt, yaz_iconv_t cd); @@ -260,6 +262,15 @@ int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr, const char *type); #endif +/** \brief writes MARC record in JSON represenation + \param mt handle + \param w WRBUF for output + \retval 0 Creation successful + \retval -1 ERROR +*/ +YAZ_EXPORT +int yaz_marc_write_json(yaz_marc_t mt, WRBUF w); + /** \brief sets leader spec (for modifying bytes in 24 byte leader) \param mt handle \param leader_spec @@ -440,19 +451,20 @@ YAZ_EXPORT void yaz_opac_decode_wrbuf2(yaz_marc_t mt, Z_OPACRecord *r, #if YAZ_HAVE_XML2 /** \brief Converts XML to OPAC - \param mt marc handle + \param mt marc handle \param buf_in XML buffer \param size_in size of XML buffer \param dst Z39.50 OPAC result - allocated by NMEM on marc handle \param cd iconv handle for the OPAC content (not ISO2709 part) \param nmem memory for OPACRecord (if NULL, mt NMEM memory is used) + \param syntax OID for embedded MARC (if NULL, USMARC is used) \retval 1 conversion OK \retval 0 conversion NOT OK \*/ YAZ_EXPORT int yaz_xml_to_opac(yaz_marc_t mt, const char *buf_in, size_t size_in, Z_OPACRecord **dst, yaz_iconv_t cd, - NMEM nmem); + NMEM nmem, const Odr_oid *syntax); #endif /** \brief flushes records @@ -468,6 +480,24 @@ YAZ_EXPORT int yaz_marc_write_trailer(yaz_marc_t mt, WRBUF wr); */ YAZ_EXPORT void yaz_marc_enable_collection(yaz_marc_t mt); +struct json_node; + +YAZ_EXPORT int yaz_marc_read_json_node(yaz_marc_t mt, struct json_node *n); + +/** \brief check if MARC21 is UTF-8 encoded + \param charset that is given by user + \param marc_buf ISO2709 buf + \param sz ISO2709 size + \retval 1 is probably UTF-8 + \retval 0 is not UTF-8 +*/ +YAZ_EXPORT +int yaz_marc_check_marc21_coding(const char *charset, + const char *marc_buf, int sz); + +YAZ_EXPORT +int yaz_opac_check_marc21_coding(const char *charset, Z_OPACRecord *r); + YAZ_END_CDECL #endif