home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 036 / less232.zip / OPTION.H < prev    next >
C/C++ Source or Header  |  1994-07-26  |  2KB  |  66 lines

  1. /*
  2.  * Copyright (c) 1984,1985,1989,1994  Mark Nudelman
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice in the documentation and/or other materials provided with 
  12.  *    the distribution.
  13.  *
  14.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
  15.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  17.  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
  18.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
  19.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
  20.  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
  21.  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  22.  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
  23.  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 
  24.  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25.  */
  26.  
  27.  
  28. #define    END_OPTION_STRING    ('$')
  29.  
  30. /*
  31.  * Types of options.
  32.  */
  33. #define    BOOL        01    /* Boolean option: 0 or 1 */
  34. #define    TRIPLE        02    /* Triple-valued option: 0, 1 or 2 */
  35. #define    NUMBER        04    /* Numeric option */
  36. #define    STRING        010    /* String-valued option */
  37. #define    NOVAR        020    /* No associated variable */
  38. #define    REPAINT        040    /* Repaint screen after toggling option */
  39. #define    NO_TOGGLE    0100    /* Option cannot be toggled with "-" cmd */
  40.  
  41. #define    OTYPE        (BOOL|TRIPLE|NUMBER|STRING|NOVAR)
  42.  
  43. /*
  44.  * Argument to a handling function tells what type of activity:
  45.  */
  46. #define    INIT    0    /* Initialization (from command line) */
  47. #define    QUERY    1    /* Query (from _ or - command) */
  48. #define    TOGGLE    2    /* Change value (from - command) */
  49.  
  50. /* Flag to toggle_option to specify how to "toggle" */
  51. #define    OPT_NO_TOGGLE    0
  52. #define    OPT_TOGGLE    1
  53. #define    OPT_UNSET    2
  54. #define    OPT_SET        3
  55.  
  56. struct option
  57. {
  58.     char oletter;        /* The controlling letter (a-z) */
  59.     char otype;        /* Type of the option */
  60.     int odefault;        /* Default value */
  61.     int *ovar;        /* Pointer to the associated variable */
  62.     void (*ofunc)();    /* Pointer to special handling function */
  63.     char *odesc[3];        /* Description of each value */
  64. };
  65.  
  66.