1 /*
2  * Copyright � 1997, 2003 EPIC Software Labs.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notices, the above paragraph (the one permitting redistribution),
12  *    this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The names of the author(s) may not be used to endorse or promote
15  *    products derived from this software without specific prior written
16  *    permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef __WORDS_H__
32 #define __WORDS_H__
33 
34 #ifdef Char
35 #undef Char
36 #endif
37 #define Char const char
38 
39 /* From words.c */
40 #define SOS 		-32767
41 #define EOS 		 32767
42 
43 /*
44  * These are the "extended" values, and determine whether move_word_rel
45  * and real_move_to_abs_word are to honor "double quoted words" or not.
46  */
47 #define DWORD_NEVER 	0		/* Never honor double quoted words */
48 #define DWORD_YES 	1		/* Support only if /xdebug extractw */
49 #define DWORD_ALWAYS 	2		/* Always honor double quoted words */
50 
51 char *		search_for		(char *, char **, char *, int);
52 ssize_t		move_word_rel		(Char *, Char **, int, int, Char *);
53 const char *	real_move_to_abs_word 	(Char *, Char **, int, int, Char *);
54 #define move_to_abs_word(a, b, c)	real_move_to_abs_word(a, b, c, DWORD_YES, "\"");
55 
56 char *		real_extract 		(char *, int, int, int);
57 char *		real_extract2 		(Char *, int, int, int);
58 #define extract(a, b, c)		real_extract(a, b, c, DWORD_NEVER)
59 #define extract2(a, b, c)		real_extract2(a, b, c, DWORD_NEVER)
60 #define extractw(a, b, c)		real_extract(a, b, c, DWORD_YES)
61 #define extractw2(a, b, c)		real_extract2(a, b, c, DWORD_YES)
62 
63 int		count_words		(Char *str, int extended, Char *quotes);
64 
65 #endif
66