3
/* ========================================================================== **
6
* Copyright (C) 1998 by Christopher R. Hertel
8
* Email: crh@ubiqx.mn.org
10
* -------------------------------------------------------------------------- **
11
* This module is a very simple parser for Samba debug log files.
12
* -------------------------------------------------------------------------- **
14
* This library is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU Library General Public
16
* License as published by the Free Software Foundation; either
17
* version 2 of the License, or (at your option) any later version.
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
* Library General Public License for more details.
24
* You should have received a copy of the GNU Library General Public
25
* License along with this library; if not, write to the Free
26
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
* -------------------------------------------------------------------------- **
29
* The important function in this module is dbg_char2token(). The rest is
30
* basically fluff. (Potentially useful fluff, but still fluff.)
31
* ========================================================================== **
36
/* This module compiles quite nicely outside of the Samba environment.
37
* You'll need the following headers:
43
/* -------------------------------------------------------------------------- **
44
* These are the tokens returned by dbg_char2token().
61
/* -------------------------------------------------------------------------- **
62
* Function prototypes...
65
const char *dbg_token2string( dbg_Token tok );
66
/* ------------------------------------------------------------------------ **
67
* Given a token, return a string describing the token.
69
* Input: tok - One of the set of dbg_Tokens defined in debugparse.h.
71
* Output: A string identifying the token. This is useful for debugging,
74
* Note: If the token is not known, this function will return the
77
* ------------------------------------------------------------------------ **
80
dbg_Token dbg_char2token( dbg_Token *state, int c );
81
/* ------------------------------------------------------------------------ **
82
* Parse input one character at a time.
84
* Input: state - A pointer to a token variable. This is used to
85
* maintain the parser state between calls. For
86
* each input stream, you should set up a separate
87
* state variable and initialize it to dbg_null.
88
* Pass a pointer to it into this function with each
89
* character in the input stream. See dbg_test()
91
* c - The "current" character in the input stream.
94
* The token value will change when delimiters are found,
95
* which indicate a transition between syntactical objects.
96
* Possible return values are:
98
* dbg_null - The input character was an end-of-line.
99
* This resets the parser to its initial state
100
* in preparation for parsing the next line.
101
* dbg_eof - Same as dbg_null, except that the character
102
* was an end-of-file.
103
* dbg_ignore - Returned for whitespace and delimiters.
104
* These lexical tokens are only of interest
106
* dbg_header - Indicates the start of a header line. The
107
* input character was '[' and was the first on
109
* dbg_timestamp - Indicates that the input character was part
110
* of a header timestamp.
111
* dbg_level - Indicates that the input character was part
112
* of the debug-level value in the header.
113
* dbg_sourcefile - Indicates that the input character was part
114
* of the sourcefile name in the header.
115
* dbg_function - Indicates that the input character was part
116
* of the function name in the header.
117
* dbg_lineno - Indicates that the input character was part
118
* of the DEBUG call line number in the header.
119
* dbg_message - Indicates that the input character was part
120
* of the DEBUG message text.
122
* ------------------------------------------------------------------------ **
126
/* -------------------------------------------------------------------------- */
127
#endif /* DEBUGPARSE_H */