home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / jove-4.16-src.tgz / tar.out / bsd / jove / argcount.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  49 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  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 proto((void));
  21.  
  22. /* Commands: */
  23.  
  24. extern void
  25.     Digit proto((void)),
  26.     DigitMinus proto((void)),
  27.     Digit0 proto((void)),
  28.     Digit1 proto((void)),
  29.     Digit2 proto((void)),
  30.     Digit3 proto((void)),
  31.     Digit4 proto((void)),
  32.     Digit5 proto((void)),
  33.     Digit6 proto((void)),
  34.     Digit7 proto((void)),
  35.     Digit8 proto((void)),
  36.     Digit9 proto((void)),
  37.     TimesFour proto((void));
  38.  
  39. /* private to macros */
  40.  
  41. extern int
  42.     arg_state,    /* NO, YES, or YES_NODIGIT */
  43.     arg_count;
  44.  
  45. #define    AS_NONE    0    /* no arg */
  46. #define    AS_NUMERIC    1    /* numeric arg supplied */
  47. #define    AS_NEGSIGN    2    /* only minus sign supplied */
  48. #define    AS_TIMES    3    /* multiplicative request */
  49.