]>
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 */
10 #include "print-utils.h"
12 static jmp_buf eval_jbuf
;
18 static long expr(void);
20 static void print_error_pos(void)
22 printf_P(PSTR("Arg: '%s'\n"
24 print_blanks(bp
- start_p
);
25 my_puts_P(PSTR("^syntax error!\n"));
28 static void error (void)
31 longjmp (eval_jbuf
, 1);
34 static void next(void)
41 static long number (void)
47 if (ch
== '$') { /* FIXME: should be '#' */
51 if (!isdigit(ch
) && !(base
== 16 && isxdigit(ch
)))
54 n
= strtoul(bp
- 1, &end_p
, base
);
64 static long factor (void)
78 if (sign
== '+' || sign
== '-') {
88 static long term (void)
112 static long expr(void)
116 while (ch
== '+' || ch
== '-') {
127 long eval_arg(char *arg
, char **end_ptr
)
134 if (setjmp (eval_jbuf
) != 0) {
137 longjmp(cmd_jbuf
, 1);
148 longjmp(cmd_jbuf
, 1);