~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/my_xml.h

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  */
 
15
 
 
16
 
 
17
#ifndef _my_xml_h
 
18
#define _my_xml_h
 
19
 
 
20
#ifdef  __cplusplus
 
21
extern "C" {
 
22
#endif
 
23
 
 
24
 
 
25
#define MY_XML_OK       0
 
26
#define MY_XML_ERROR    1
 
27
 
 
28
/* 
 
29
  A flag whether to use absolute tag names in call-back functions,
 
30
  like "a", "a.b" and "a.b.c" (used in character set file parser),
 
31
  or relative names like "a", "b" and "c".
 
32
*/
 
33
#define MY_XML_FLAG_RELATIVE_NAMES 1
 
34
 
 
35
/*
 
36
  A flag whether to skip normilization of text values before calling
 
37
  call-back functions: i.e. skip leading/trailing spaces,
 
38
  \r, \n, \t characters.
 
39
*/
 
40
#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2
 
41
 
 
42
enum my_xml_node_type
 
43
{
 
44
  MY_XML_NODE_TAG,   /* can have TAG, ATTR and TEXT children */
 
45
  MY_XML_NODE_ATTR,  /* can have TEXT children               */
 
46
  MY_XML_NODE_TEXT   /* cannot have children                 */
 
47
};
 
48
 
 
49
typedef struct xml_stack_st
 
50
{
 
51
  int flags;
 
52
  enum my_xml_node_type current_node_type;
 
53
  char errstr[128];
 
54
  char attr[128];
 
55
  char *attrend;
 
56
  const char *beg;
 
57
  const char *cur;
 
58
  const char *end;
 
59
  void *user_data;
 
60
  int  (*enter)(struct xml_stack_st *st,const char *val, size_t len);
 
61
  int  (*value)(struct xml_stack_st *st,const char *val, size_t len);
 
62
  int  (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len);
 
63
} MY_XML_PARSER;
 
64
 
 
65
void my_xml_parser_create(MY_XML_PARSER *st);
 
66
void my_xml_parser_free(MY_XML_PARSER *st);
 
67
int  my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len);
 
68
 
 
69
void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
 
70
                                                         const char *,
 
71
                                                         size_t len));
 
72
void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
 
73
                                                         const char *,
 
74
                                                         size_t len));
 
75
void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
 
76
                                                         const char *,
 
77
                                                         size_t len));
 
78
void my_xml_set_user_data(MY_XML_PARSER *st, void *);
 
79
 
 
80
size_t my_xml_error_pos(MY_XML_PARSER *st);
 
81
uint my_xml_error_lineno(MY_XML_PARSER *st);
 
82
 
 
83
const char *my_xml_error_string(MY_XML_PARSER *st);
 
84
 
 
85
#ifdef  __cplusplus
 
86
}
 
87
#endif
 
88
 
 
89
#endif /* _my_xml_h */