Merge branch 'master' into sru_2_0
[yaz-moved-to-github.git] / include / yaz / tokenizer.h
index 02cd195..2f790a3 100644 (file)
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 1995-2007, Index Data
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2013 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:
@@ -24,7 +24,6 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/* $Id: tokenizer.h,v 1.1 2007-04-26 21:45:16 adam Exp $ */
 
 /** \file tokenizer.h
     \brief Header with public definitions about YAZ' tokenizer
 
 YAZ_BEGIN_CDECL
 
-#define YAZ_TOKENIZER_EOF 0
-#define YAZ_TOKENIZER_ERROR (-1)
-#define YAZ_TOKENIZER_STRING (-2)
-#define YAZ_TOKENIZER_QSTRING (-3)
+#define YAZ_TOK_EOF 0
+#define YAZ_TOK_ERROR (-1)
+#define YAZ_TOK_STRING (-2)
+#define YAZ_TOK_QSTRING (-3)
+
+typedef struct yaz_tok_cfg *yaz_tok_cfg_t;
+typedef struct yaz_tok_parse *yaz_tok_parse_t;
 
-typedef struct yaz_tokenizer *yaz_tokenizer_t;
+typedef int (*yaz_tok_get_byte_t)(void **vp);
+
+YAZ_EXPORT
+yaz_tok_cfg_t yaz_tok_cfg_create(void);
 
 YAZ_EXPORT
-yaz_tokenizer_t yaz_tokenizer_create(void);
+void yaz_tok_cfg_destroy(yaz_tok_cfg_t t);
 
 YAZ_EXPORT
-void yaz_tokenizer_destroy(yaz_tokenizer_t t);
+void yaz_tok_cfg_single_tokens(yaz_tok_cfg_t t, const char *simple);
 
 YAZ_EXPORT
-void yaz_tokenizer_read_buf(yaz_tokenizer_t t, const char *buf);
+yaz_tok_parse_t yaz_tok_parse_buf(yaz_tok_cfg_t t, const char *buf);
 
 YAZ_EXPORT
-int yaz_tokenizer_move(yaz_tokenizer_t t);
+yaz_tok_parse_t yaz_tok_parse_create(yaz_tok_cfg_t t, yaz_tok_get_byte_t h,
+                                     void *vp);
 
 YAZ_EXPORT
-const char *yaz_tokenizer_string(yaz_tokenizer_t t);
+void yaz_tok_parse_destroy(yaz_tok_parse_t tp);
 
 YAZ_EXPORT
-void yaz_tokenizer_single_tokens(yaz_tokenizer_t t, const char *simple);
+int yaz_tok_move(yaz_tok_parse_t tp);
+
+YAZ_EXPORT
+const char *yaz_tok_parse_string(yaz_tok_parse_t tp);
 
 YAZ_END_CDECL
 
 #endif
-/* CQL_H_INCLUDED */
+
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab