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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
/*
* ChkTeX, operating system specific code for ChkTeX.
* Copyright (C) 1995-96 Jens T. Berger Thielemann
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Contact the author at:
* Jens Berger
* Spektrumvn. 4
* N-0666 Oslo
* Norway
* E-mail: <jensthi@ifi.uio.no>
*
*
*/
#ifndef OPSYS_H
#define OPSYS_H
#include "ChkTeX.h"
#include "Utility.h"
/********************************************************************/
/**************** START OF USER SETTABLE PREFERENCES ****************/
/*
* Note: This file contains most defines you'll wish to change if you
* wish to adopt ChkTeX to a new system. It is, as you might notice,
* heavily documented. If you wish to get into the internals of ChkTeX,
* the interesting stuff is at the bottom of this file, and in the .c
* files. However, you should also take a look at the "config.h.in" file
* in this directory if you haven't got a shell able to run the "configure"
* script.
*
* This program relies heavily on that the system which
* automagically free()'s all malloc()'ed memory, works. The program
* itself does not call free() very much. This is because we're doing
* lots of tiny allocations, and a properly designed pooling system will
* hopefully do a quicker job than we'll be able to do. So there.
*
* To keep things simple, we trust that the fclose()'ing of fopen()'ed
* also happens automagically.
*
* Please use the getopt included, as we will modify optarg during
* command processing.
*
* You may wish to modify the SetupVars() (OpSys.c) to better suit your
* preferences. In any case, it should put the filename (and full path)
* of the `.chktexrc' file into the ConfigFile array. The array is sized
* BUFSIZ bytes.
*
* The program does also assume that __unix__ is defined if the source is
* compiled on a UNIX machine.
*
*/
/* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */
/*
* Here you should define what codes which should be returned to the
* shell upon success/failure.
*
*/
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
/* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */
/*
* SLASH should be defined to the character your computer uses to
* separate files/directories. Most systems use '/', messydos uses
* '\'.
*
* DIRCHARS should be defined to the characters a directory entry
* may end on. On Amigas, this is ":/" (either "FOO:BAR/" or "FOO:"),
* Unix uses only "/", while messydos uses ":\\".
*
* This data will be used to automatically concatenate a directory
* path and a filename.
*
* Adjust both to suit your needs.
*/
#if defined(__unix__)
# define SLASH '/'
#elif defined(__MSDOS__)
# define SLASH '\\'
#endif
#if defined(__unix__)
# define DIRCHARS "/"
#elif defined(__MSDOS__)
# define DIRCHARS ":\\"
#endif
/* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */
/*
* Here, define what key-combination which is used to abort stdin
* keyboard input. It should be a string, as we we'll type it out as
* information to the user.
*/
#if defined(__unix__)
# define STDIN_BREAK "Ctrl-D"
#elif defined(__MSDOS__)
# define STDIN_BREAK "Ctrl-Z + Enter"
#else
# define STDIN_BREAK "stdin break combination"
#endif
/* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */
/*
* For fancy printing of commands, we'll use these strings to turn
* on/off the error indication. The codes listed here are ANSI
* compatible; if you don't have that type of terminal, you may wish
* to adjust this. Use "chktex -v2 Test.tex" to check the effects of
* these macros. Note: These strings will be printf()'ed, so watch your
* %'s.
*
* Under UNIX, we'll ignore these values and use termcap instead, where
* that is installed.
*
* If these strings can't be specified statically, you'll have to add
* code in the SetupTerm() function.
*
* PRE_ERROR_STR is of course printed in front of each location we
* wish to show as an error, and POST_ERROR_STR after each location.
*
* The codes #defined here, will switch back- and foreground colours.
* We're using '\033[' as escape character, some terminals may like
* '\233' better.
*
*/
# define PRE_ERROR_STR "\033[7m"
# define POST_ERROR_STR "\033[0m"
/* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */
/*
* This macro should contain the appendix for backup files, which
* will be appended onto the original filename. It should contain
* a leading dot.
*/
#ifdef __MSDOS__
# define BAKAPPENDIX ".$cl"
#else
# define BAKAPPENDIX ".bak"
#endif
/***************** END OF USER SETTABLE PREFERENCES *****************/
/********************************************************************/
#ifndef WORDLIST_DEFINED
struct WordList;
#endif
/* Sorry; there are now cyclic dependencies in the
* source tree. :-/
*/
extern const char *ReverseOn;
extern const char *ReverseOff;
extern char ConfigFile[BUFSIZ];
char *MatchFileName(char *String);
int SetupVars(void);
void SetupTerm(void);
void AddAppendix(char *Name, const char *App);
void tackon(char *, const char *);
int LocateFile(const char *Filename, char *Dest, const char *App,
struct WordList *wl);
#endif /* OPSYS_H */
|