| 1 |
/************************************************************************** |
| 2 |
* This program is Copyright (C) 1986-2002 by Jonathan Payne. JOVE is * |
| 3 |
* provided by Jonathan and Jovehacks without charge and without * |
| 4 |
* warranty. You may copy, modify, and/or distribute JOVE, provided that * |
| 5 |
* this notice is included in all the source files and documentation. * |
| 6 |
**************************************************************************/ |
| 7 |
|
| 8 |
/* macros for getting at and setting the current argument count */ |
| 9 |
|
| 10 |
#define arg_value() arg_count |
| 11 |
#define arg_or_default(x) (is_an_arg()? arg_count : (x)) |
| 12 |
#define set_arg_value(n) { arg_state = AS_NUMERIC; arg_count = (n); } |
| 13 |
#define clr_arg_value() { arg_state = AS_NONE; arg_count = 1; } |
| 14 |
#define is_an_arg() (arg_state != AS_NONE) |
| 15 |
#define is_non_minus_arg() (arg_state != AS_NONE && arg_state != AS_NEGSIGN) |
| 16 |
|
| 17 |
#define save_arg(as,ac) { (ac) = arg_count; (as) = arg_state; } |
| 18 |
#define restore_arg(as,ac) { arg_count = (ac); arg_state = (as); } |
| 19 |
|
| 20 |
extern void negate_arg(void); |
| 21 |
|
| 22 |
/* Commands: */ |
| 23 |
|
| 24 |
extern void |
| 25 |
Digit(void), |
| 26 |
DigitMinus(void), |
| 27 |
Digit0(void), |
| 28 |
Digit1(void), |
| 29 |
Digit2(void), |
| 30 |
Digit3(void), |
| 31 |
Digit4(void), |
| 32 |
Digit5(void), |
| 33 |
Digit6(void), |
| 34 |
Digit7(void), |
| 35 |
Digit8(void), |
| 36 |
Digit9(void), |
| 37 |
TimesFour(void); |
| 38 |
|
| 39 |
/* private to macros */ |
| 40 |
|
| 41 |
extern int |
| 42 |
arg_state; /* NO, YES, or YES_NODIGIT */ |
| 43 |
extern long |
| 44 |
arg_count; |
| 45 |
|
| 46 |
#define AS_NONE 0 /* no arg */ |
| 47 |
#define AS_NUMERIC 1 /* numeric arg supplied */ |
| 48 |
#define AS_NEGSIGN 2 /* only minus sign supplied */ |
| 49 |
#define AS_TIMES 3 /* multiplicative request */ |