FORM
4.3
sources
comtool.h
Go to the documentation of this file.
1
5
/* #[ License : */
6
/*
7
* Copyright (C) 1984-2022 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
50
static
inline
void
SkipSpaces(UBYTE **s)
51
{
52
const
char
*p = (
const
char
*)*s;
53
while
( *p ==
' '
|| *p ==
','
|| *p ==
'\t'
) p++;
54
*s = (UBYTE *)p;
55
}
56
66
static
inline
int
ConsumeOption(UBYTE **s,
const
char
*opt)
67
{
68
const
char
*p = (
const
char
*)*s;
69
while
( *p && *opt && tolower(*p) == tolower(*opt) ) {
70
p++;
71
opt++;
72
}
73
/* Check if `opt` ended. */
74
if
( !*opt ) {
75
/* Check if `*p` is a word boundary. */
76
if
( !*p || !(FG.cTable[(
unsigned
char
)*p] == 0 ||
77
FG.cTable[(
unsigned
char
)*p] == 1 || *p ==
'_'
||
78
*p ==
'$'
) ) {
79
/* Consume the option. Skip the trailing spaces. */
80
*s = (UBYTE *)p;
81
SkipSpaces(s);
82
return
(1);
83
}
84
}
85
return
(0);
86
}
87
88
/*
89
#] Inline functions :
90
*/
91
#endif
/* FORM_COMTOOL_H_ */
form3.h
Generated by
1.12.0