Added charmap facility to delete leading articles
[idzebra-moved-to-github.git] / include / data1.h
index 98cf8cb..94ce8a4 100644 (file)
@@ -1,44 +1,43 @@
-/*
- * Copyright (c) 1995-2002, Index Data.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation, in whole or in part, for any purpose, is hereby granted,
- * provided that:
- *
- * 1. This copyright and permission notice appear in all copies of the
- * software and its documentation. Notices of copyright or attribution
- * which appear at the beginning of any file must remain unchanged.
- *
- * 2. The names of Index Data or the individual authors may not be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
- * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- *
- * $Id: data1.h,v 1.1 2002-10-22 12:51:08 adam Exp $
- */
+/* $Id: data1.h,v 1.11 2004-08-25 09:23:35 adam Exp $
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
+   Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
 
 #ifndef DATA1_H
 #define DATA1_H
 
+#define ENHANCED_XELM 1
+
 #include <stdio.h>
 
 #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 <dfa.h>         /* pop */
+#include <zebra_xpath.h> /* pop */
 
 #define d1_isspace(c) strchr(" \r\n\t\f", c)
 #define d1_isdigit(c) ((c) <= '9' && (c) >= '0')
@@ -91,6 +90,7 @@ typedef struct data1_marctab
 
     int  force_indicator_length;
     int  force_identifier_length;
+    char leader[24]; /* Fixme! Need linear access to LEADER of MARC record */  
     struct data1_marctab *next;
 } data1_marctab;
 
@@ -193,6 +193,19 @@ typedef struct data1_sub_elements {
     data1_element *elements;
 } data1_sub_elements;
 
+/* pop */
+typedef struct data1_xpelement
+{
+    char *xpath_expr;
+#ifdef ENHANCED_XELM 
+    struct xpath_location_step xpath[XPATH_STEP_COUNT];
+    int xpath_len;
+#endif
+    struct DFA *dfa;  
+    data1_termlist *termlists;
+    struct data1_xpelement *next;
+} data1_xpelement;
+
 typedef struct data1_xattr {
     char *name;
     char *value;
@@ -200,6 +213,9 @@ typedef struct data1_xattr {
     unsigned short what;  /* DATA1I_text, .. see data1_node.u.data */
 } data1_xattr;
 
+#if 0
+typedef struct data1_absyn data1_absyn;
+#else
 typedef struct data1_absyn
 {
     char *name;
@@ -212,10 +228,12 @@ typedef struct data1_absyn
     data1_marctab *marc;
     data1_sub_elements *sub_elements;
     data1_element *main_elements;
+    data1_xpelement *xp_elements; /* pop */
+    struct data1_systag *systags;
     char *encoding;
     int  enable_xpath_indexing;
 } data1_absyn;
-
+#endif
 /*
  * record data node (tag/data/variant)
  */
@@ -390,11 +408,25 @@ YAZ_EXPORT data1_node *data1_mk_preprocess (data1_handle dh, NMEM nmem,
                                             const char **attr,
                                             data1_node *at);
 
+YAZ_EXPORT data1_node *data1_insert_preprocess_n (data1_handle dh, NMEM nmem,
+                                                 const char *target,
+                                                 size_t len,
+                                                 const char **attr,
+                                                 data1_node *at);
+
+YAZ_EXPORT data1_node *data1_insert_preprocess (data1_handle dh, NMEM nmem,
+                                               const char *target,
+                                               const char **attr,
+                                               data1_node *at);
+
 YAZ_EXPORT data1_node *data1_mk_root (data1_handle dh, NMEM nmem,
                                       const char *name);
 YAZ_EXPORT void data1_set_root(data1_handle dh, data1_node *res,
                                NMEM nmem, const char *name);
 
+YAZ_EXPORT data1_node *data1_mk_tag_data_zint (data1_handle dh, data1_node *at,
+                                              const char *tag, zint num,
+                                              NMEM nmem);
 YAZ_EXPORT data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at,
                                               const char *tag, int num,
                                               NMEM nmem);
@@ -492,6 +524,13 @@ YAZ_EXPORT const char *data1_get_encoding (data1_handle dh, data1_node *n);
 
 YAZ_EXPORT int data1_is_xmlmode(data1_handle dh);
 
+YAZ_EXPORT const char *data1_systag_lookup(data1_absyn *absyn, const char *tag,
+                                           const char *default_value);
+
+YAZ_EXPORT void data1_concat_text(data1_handle dh, NMEM m, data1_node *n);
+
+YAZ_EXPORT void data1_absyn_destroy(data1_handle dh);
+
 YAZ_END_CDECL
 
 #endif