Remove local attribute handling and other dead code.
[idzebra-moved-to-github.git] / include / idzebra / data1.h
index 81c579a..58ac8ca 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: data1.h,v 1.1 2004-09-28 10:15:03 adam Exp $
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
-   Index Data Aps
+/* $Id: data1.h,v 1.14 2006-05-19 23:45:29 adam Exp $
+   Copyright (C) 1995-2006
+   Index Data ApS
 
 This file is part of the Zebra server.
 
@@ -28,12 +28,9 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <yaz/nmem.h>
 #include <yaz/oid.h>
 #include <yaz/proto.h>
-
-#include <idzebra/version.h>
-#include <d1_attset.h>
-#include <d1_map.h>
 #include <yaz/yaz-util.h>
-#include <yaz/wrbuf.h>
+
+#include <idzebra/util.h>
 
 #define d1_isspace(c) strchr(" \r\n\t\f", c)
 #define d1_isdigit(c) ((c) <= '9' && (c) >= '0')
@@ -44,6 +41,83 @@ YAZ_BEGIN_CDECL
 
 #define DATA1_MAX_SYMBOL 31
 
+/*
+ * This structure describes a attset, perhaps made up by inclusion
+ * (supersetting) of other attribute sets. When indexing and searching,
+ * we perform a normalisation, where we associate a given tag with
+ * the set that originally defined it, rather than the superset. This
+ * allows the most flexible access. Eg, the tags common to GILS and BIB-1
+ * should be searchable by both names.
+ */
+
+struct data1_attset;
+
+typedef struct data1_attset data1_attset;    
+typedef struct data1_att data1_att;
+typedef struct data1_attset_child data1_attset_child;
+
+struct data1_att
+{
+    data1_attset *parent;          /* attribute set */
+    char *name;                    /* symbolic name of this attribute */
+    int value;                     /* attribute value */
+    data1_att *next;
+};
+
+struct data1_attset_child {
+    data1_attset *child;
+    data1_attset_child *next;
+};
+
+struct data1_attset
+{
+    char *name;          /* symbolic name */
+    oid_value reference;   /* external ID of attset */
+    data1_att *atts;          /* attributes */
+    data1_attset_child *children;  /* included attset */
+    data1_attset *next;       /* next in cache */
+};
+
+typedef struct data1_handle_info *data1_handle;
+
+YAZ_EXPORT data1_att *data1_getattbyname(data1_handle dh, data1_attset *s,
+                                        const char *name);
+YAZ_EXPORT data1_attset *data1_read_attset(data1_handle dh, const char *file);
+
+YAZ_EXPORT data1_attset *data1_empty_attset(data1_handle dh);
+
+typedef struct data1_maptag
+{
+    int new_field;
+    int type;
+#define D1_MAPTAG_numeric 1
+#define D1_MAPTAG_string 2
+    int which;
+    union
+    {
+       int numeric;
+       char *string;
+    } value;
+    struct data1_maptag *next;
+} data1_maptag;
+
+typedef struct data1_mapunit
+{
+    int no_data;
+    char *source_element_name;
+    data1_maptag *target_path;
+    struct data1_mapunit *next;
+} data1_mapunit;
+
+typedef struct data1_maptab
+{
+    char *name;
+    oid_value target_absyn_ref;
+    char *target_absyn_name;
+    data1_mapunit *map;
+    struct data1_maptab *next;
+} data1_maptab;
+
 typedef struct data1_name
 {
     char *name;
@@ -164,7 +238,7 @@ struct data1_tagset
 
 typedef struct data1_termlist
 {
-    data1_att *att;
+    char *index_name;
     char *structure;
     char *source;
     struct data1_termlist *next;
@@ -182,6 +256,7 @@ typedef struct data1_element
     char *sub_name;
     struct data1_element *children;
     struct data1_element *next;
+    struct data1_hash_table *hash;
 } data1_element;
 
 typedef struct data1_sub_elements {
@@ -281,8 +356,6 @@ typedef struct data1_node
 
 YAZ_EXPORT data1_handle data1_create (void);
 
-#define DATA1_FLAG_XML  1
-YAZ_EXPORT data1_handle data1_createx (int flags);
 
 YAZ_EXPORT void data1_destroy(data1_handle dh);
 YAZ_EXPORT data1_node *get_parent_tag(data1_handle dh, data1_node *n);
@@ -324,7 +397,8 @@ YAZ_EXPORT data1_datatype data1_maptype(data1_handle dh, char *t);
 YAZ_EXPORT data1_varset *data1_read_varset(data1_handle dh, const char *file);
 YAZ_EXPORT data1_vartype *data1_getvartypebyct(data1_handle dh,
                                               data1_varset *set,
-                                              char *zclass, char *type);
+                                              const char *zclass,
+                                              const char *type);
 YAZ_EXPORT data1_vartype *data1_getvartypeby_absyn(data1_handle dh,
                                                   data1_absyn *absyn,
                                                   char *zclass, char *type);
@@ -505,3 +579,11 @@ YAZ_EXPORT void data1_absyn_destroy(data1_handle dh);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+