-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.c
172 lines (108 loc) · 4.21 KB
/
common.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
FILE NAME: common.c
Copyright (C) 1997-2016 Vladimir Makarov.
Written by Vladimir Makarov <[email protected]>
This file is part of the tool SHILKA.
This is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
TITLE: Common variables for all Shilka (keywords description
translator)
DESCRIPTION: This file contains declarations of external variables
common for all Shilka (keywords description translator).
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#else /* In this case we are oriented to ANSI C */
#endif /* #ifdef HAVE_CONFIG_H */
#include <ctype.h>
#include "ird.h"
#include "common.h"
/* Output C++ code instead of C code (`-c++'). */
int cpp_flag;
#ifndef NDEBUG
/* Output debugging information during Shilka run (`-debug'). */
int debug_flag;
#endif
/* Generate macro switching on gathering and printing keyword usage
statistics (`-statistics'). */
int statistics_flag;
/* Generate keyword inline for the function (`-inline'). */
int inline_flag;
/* Strip code for gathering and printing statistics (`-strip'). */
int strip_flag;
/* Generation additional interface file (with suffix .h)
(`-enum'). */
int interface_flag;
/* Output enumeration instead of macro definitions for instruction
codes (`-enum'). */
int enum_flag;
/* Usage of strncmp instead of strcmp to compare keywords (`-length').
In other words, terminated '\0' is not necessary in keywords. */
int length_flag;
/* Keywords case is ignored (`-case'). */
int case_flag;
/* Definitions of identifiers of keywords are not generated
(`-no-definitions'). */
int no_definitions_flag;
/* Generation of macros defining identifiers of instructions
(`-export') in the interface file (instead of implementation
file). */
int export_flag;
/* Value of this variable is prefix of names of generated keywords
recognizer objects. This value is defined by argument of option
`-p...' or by standard prefix. */
char *prefix;
/* Flag of output of time statistics (`-v'). */
int time_flag;
/* The following is number after option `-fast'. If number of rest
unchecked characters is less or equal than this number, use these
characters comparison instead strcmp (default value is 3). */
int fast_number;
/* Flag of disabling output of warnings (`-w'). */
int w_flag;
/* Flag of creation of description file which contains description of
result automaton and statistics information (`-v'). */
int v_flag;
/* Value of this variable is name of description. The value is
defined by file name (without suffix) given as operand of the
Shilka command line. */
char *description_name;
/* Interface file of keywords recognizer. The value is NULL if the
file is not created. */
FILE *output_interface_file;
/* Keywords recognizer interface file name. */
char *output_interface_file_name;
/* Implementation file of keywords recognizer. The value is NULL if
the file is not created. */
FILE *output_implementation_file;
/* Keywords recognizer implementation file name. */
char *output_implementation_file_name;
/* Description file of keywords recognizer. The value is NULL if the
file is not created. */
FILE *output_description_file;
/* Keywords recognizer description file name. */
char *output_description_file_name;
/* Value of the following variable is node representing description
being processed. */
IR_node_t description;
/* I remember that tolower on a computer worked only for letters.
This is for the case. */
int
our_tolower (int c)
{
unsigned char ch = c;
if (isalpha (ch))
return tolower (ch);
else
return ch;
}