00001 /* This file is part of the YAZ toolkit. 00002 * Copyright (C) 1995-2008 Index Data 00003 * See the file LICENSE for details. 00004 */ 00010 #if HAVE_CONFIG_H 00011 #include <config.h> 00012 #endif 00013 00014 #include <yaz/proto.h> 00015 00016 const char *yaz_get_esn(Z_RecordComposition *comp) 00017 { 00018 if (comp && comp->which == Z_RecordComp_complex) 00019 { 00020 if (comp->u.complex->generic 00021 && comp->u.complex->generic->elementSpec 00022 && (comp->u.complex->generic->elementSpec->which == 00023 Z_ElementSpec_elementSetName)) 00024 return comp->u.complex->generic->elementSpec->u.elementSetName; 00025 } 00026 else if (comp && comp->which == Z_RecordComp_simple && 00027 comp->u.simple->which == Z_ElementSetNames_generic) 00028 return comp->u.simple->u.generic; 00029 return 0; 00030 } 00031 00032 void yaz_set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem) 00033 { 00034 Z_RecordComposition *comp = (Z_RecordComposition *) 00035 nmem_malloc(nmem, sizeof(*comp)); 00036 00037 comp->which = Z_RecordComp_simple; 00038 comp->u.simple = (Z_ElementSetNames *) 00039 nmem_malloc(nmem, sizeof(*comp->u.simple)); 00040 comp->u.simple->which = Z_ElementSetNames_generic; 00041 comp->u.simple->u.generic = nmem_strdup(nmem, esn); 00042 *comp_p = comp; 00043 } 00044 00045 00046 00047 /* 00048 * Local variables: 00049 * c-basic-offset: 4 00050 * indent-tabs-mode: nil 00051 * End: 00052 * vim: shiftwidth=4 tabstop=8 expandtab 00053 */ 00054
1.5.6