4 * Copyright (C) 2004-2007 Sami Pietila
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30 struct parser_state parser_state
;
34 cp(int s
[MP_SIZE
], int t
[MP_SIZE
])
36 memcpy(t
, s
, sizeof(int)*MP_SIZE
);
41 ret(int s
[MP_SIZE
]) /* Copy result value. */
43 memcpy(parser_state
.ret
, s
, sizeof(int)*MP_SIZE
);
44 parser_state
.flags
|= ANS
;
48 check_numbase(char *num
)
52 for (i
= 0; num
[i
]; i
++) {
63 if ((l
< '0') || (l
> '1')) {
64 parser_state
.error
= -PARSER_ERR_INVALID_BASE
;
69 if ((l
< '0') || (l
> '7')) {
70 parser_state
.error
= -PARSER_ERR_INVALID_BASE
;
76 parser_state
.error
= -PARSER_ERR_INVALID_BASE
;
83 parser_state
.error
= -PARSER_ERR_INVALID_BASE
;
88 assert(0); /* unknown base. */