]>
cloudbase.mooo.com Git - z180-stamp.git/blob - avr/eval_arg.c
2 * (C) Copyright 2016 Leo C. <erbl259-lmu@yahoo.de>
4 * SPDX-License-Identifier: GPL-2.0
8 #include "command.h" /* jump_buf */
11 #include "print-utils.h"
13 static jmp_buf eval_jbuf
;
19 static long expr(void);
21 static void print_error_pos(void)
23 printf_P(PSTR("Arg: '%s'\n"
25 print_blanks(bp
- start_p
);
26 my_puts_P(PSTR("^syntax error!\n"));
29 static void error (void)
32 longjmp (eval_jbuf
, 1);
35 static void next(void)
42 static long number (void)
48 if (ch
== '$') { /* FIXME: should be '#' */
52 if (!isdigit(ch
) && !(base
== 16 && isxdigit(ch
)))
55 n
= strtoul(bp
- 1, &end_p
, base
);
65 static long factor (void)
79 if (sign
== '+' || sign
== '-') {
89 static long term (void)
113 static long expr(void)
117 while (ch
== '+' || ch
== '-') {
128 long eval_arg(char *arg
, char **end_ptr
)
135 if (setjmp (eval_jbuf
) != 0) {
138 longjmp(cmd_jbuf
, 1);
149 longjmp(cmd_jbuf
, 1);