Imported Upstream version 15.8a
[platform/upstream/cscope.git] / src / scanner.h
1 /*===========================================================================
2  Copyright (c) 2001, The Santa Cruz Operation 
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 are met:
7
8  *Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10
11  *Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14
15  *Neither name of The Santa Cruz Operation nor the names of its contributors
16  may be used to endorse or promote products derived from this software
17  without specific prior written permission. 
18
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
20  IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
23  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  INTERRUPTION)
27  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30  DAMAGE. 
31  =========================================================================*/
32
33 /* $Id: scanner.h,v 1.5 2009/08/28 14:28:27 nhorman Exp $ */
34
35
36 #ifndef CSCOPE_SCANNER_H
37 #define CSCOPE_SCANNER_H
38
39 #include <stdio.h>
40
41 #undef  YYLMAX          
42 #define YYLMAX  STMTMAX + PATLEN + 1    /* scanner line buffer size */
43
44 /* cross-reference database mark characters (when new ones are added, 
45  * update the cscope.out format description in cscope.1)
46  */
47 #define CLASSDEF        'c'
48 #define DEFINE          '#'
49 #define DEFINEEND       ')'
50 #define ENUMDEF         'e'
51 #define FCNCALL         '`'
52 #define FCNDEF          '$'
53 #define FCNEND          '}'
54 #define GLOBALDEF       'g'
55 #define INCLUDE         '~'
56 #define MEMBERDEF       'm'
57 #define NEWFILE         '@'
58 #define STRUCTDEF       's'
59 #define TYPEDEF         't'
60 #define UNIONDEF        'u'
61
62 /* other scanner token types */
63 #define LEXEOF  0
64 #define LEXERR  1
65 #define IDENT   2       
66 #define NEWLINE 3       
67
68 /* scanner.l global data */
69 extern  int     first;          /* buffer index for first char of symbol */
70 extern  int     last;           /* buffer index for last char of symbol */
71 extern  int     lineno;         /* symbol line number */
72 extern  FILE    *yyin;          /* input file descriptor */
73 extern  FILE    *yyout;         /* output file */
74 extern  int     myylineno;      /* input line number */
75
76 #ifdef USING_LEX
77 /* HBB 20010430: if lex is used instead of flex, have to simulate the
78  * private copies of yytext and yytext for the world outside scanner.l: */
79 /* FIXME: there should be a feature test for this! */
80 #if defined(__OSF1__) || defined(__sun) || defined(_AIX)
81 extern  char    yytext[];
82 #else
83 extern  unsigned char   yytext[];
84 #endif
85 extern  int     yyleng;
86 # define my_yytext yytext
87 # define my_yyleng yyleng
88 #else
89 extern  char    *my_yytext;     /* private copy of input line */
90 extern  size_t  my_yyleng;      /* ... and current length of it */
91 #endif
92
93 /* The master function exported by scanner.l */
94 int     yylex(void);
95 void    initscanner(char *srcfile);
96
97 #endif /* CSCOPE_SCANNER_H ends */