FORM
v5.0.0-35-g6318119
sources
comtool.h
Go to the documentation of this file.
1
5
/* #[ License : */
6
/*
7
* Copyright (C) 1984-2026 J.A.M. Vermaseren
8
* When using this file you are requested to refer to the publication
9
* J.A.M.Vermaseren "New features of FORM" math-ph/0010025
10
* This is considered a matter of courtesy as the development was paid
11
* for by FOM the Dutch physics granting agency and we would like to
12
* be able to track its scientific use to convince FOM of its value
13
* for the community.
14
*
15
* This file is part of FORM.
16
*
17
* FORM is free software: you can redistribute it and/or modify it under the
18
* terms of the GNU General Public License as published by the Free Software
19
* Foundation, either version 3 of the License, or (at your option) any later
20
* version.
21
*
22
* FORM is distributed in the hope that it will be useful, but WITHOUT ANY
23
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
24
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
25
* details.
26
*
27
* You should have received a copy of the GNU General Public License along
28
* with FORM. If not, see <http://www.gnu.org/licenses/>.
29
*/
30
/* #] License : */
31
#ifndef FORM_COMTOOL_H_
32
#define FORM_COMTOOL_H_
33
/*
34
#[ Includes :
35
*/
36
37
#include "
form3.h
"
38
39
/*
40
#] Includes :
41
#[ Inline functions :
42
*/
43
55
static
inline
void
SkipSpaces(UBYTE **s)
56
{
57
const
char
*p = (
const
char
*)*s;
58
while
( *p ==
' '
|| *p ==
','
|| *p ==
'\t'
) p++;
59
*s = (UBYTE *)p;
60
}
61
73
static
inline
int
ConsumeOption(UBYTE **s,
const
char
*opt)
74
{
75
const
char
*p = (
const
char
*)*s;
76
while
( *p && *opt && tolower(*p) == tolower(*opt) ) {
77
p++;
78
opt++;
79
}
80
/* Check if `opt` ended. */
81
if
( !*opt ) {
82
/* Check if `*p` is a word boundary. */
83
UINT c = FG.cTable[(
unsigned
char)*p];
84
if
( c != 0 && c != 1 && *p !=
'_'
&& *p !=
'$'
) {
85
/* Consume the option. Skip the trailing whitespace. */
86
*s = (UBYTE *)p;
87
SkipSpaces(s);
88
return
(1);
89
}
90
}
91
return
(0);
92
}
93
94
/*
95
#] Inline functions :
96
*/
97
#endif
/* FORM_COMTOOL_H_ */
form3.h
Generated by
1.9.8