home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / disk / misc / string11.lha / clop.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-30  |  2.2 KB  |  128 lines

  1. /*
  2.  *  FILE
  3.  *    clop.h
  4.  *
  5.  *  DESCRIPTION
  6.  *    Some support for the clop() function.
  7.  *
  8.  *  AUTHOR
  9.  *    Anders 'ALi' Lindgren
  10.  *    Mälarblick 8
  11.  *    S-161 51 Bromma
  12.  *    Sweden
  13.  *
  14.  *  STATUS
  15.  *    All rights reserved.  
  16.  */
  17.  
  18. extern unsigned char *     __stdargs clop(unsigned char *, struct clop_list *,
  19.                          struct clop_array *);
  20. extern void        __stdargs freeclop(struct clop_array *);
  21.  
  22.  
  23. /*
  24.  *  STRUCTURE
  25.  *    clop_list
  26.  *
  27.  *  DESCRIPTION
  28.  *    This array contains returned error information.
  29.  *
  30.  *  DISCUSSION
  31.  *    Rename it altogeteher? Or simply replace it with something better?
  32.  */
  33.  
  34. struct clop_list {
  35.     long error;            /* CLOPE_* (See below)    */
  36.     unsigned char failing_opt;    /* Name of failing option */
  37. };
  38.  
  39.  
  40. /*
  41.  *  STRUCTURE
  42.  *    clop_array
  43.  *
  44.  *  DESCRIPTION
  45.  *    This array conatins all the information needed for the
  46.  *    clop() function.
  47.  *
  48.  *    This array can be sent several times through the clop()
  49.  *    function, so that preset, env: and command line options
  50.  *    can easily be used.
  51.  */
  52.     
  53. struct clop_array {
  54.     unsigned char  option;        /* Which option        */
  55.     unsigned char  type;         /* CLOPT_* (see below)    */
  56.     unsigned char  inflags;        /* CLOPIF_*    "    */
  57.     unsigned char  outflags;        /* CLOPOF_*    "    */
  58.                     /*
  59.                  * The following union contains returned
  60.                  * values, or preset values.
  61.                  */
  62.     union {
  63.     signed   long    number;        /* unsigned number    */
  64.     unsigned long    unumber;    /* signed number    */
  65.     unsigned char * string;        /* String pointer    */
  66.     long        bool;        /* 1 or 0        */
  67.     } value;
  68. };
  69.  
  70.  
  71. /*
  72.  *  DEFINITIONS
  73.  *    CLOPIF_*    - CLOP In Flags
  74.  *
  75.  *    None, so far.
  76.  */
  77.  
  78. #define CLOPIF_SINGLE    0x01
  79.  
  80.  
  81. /*
  82.  *  DEFINITIONS
  83.  *    CLOPOF_*    - CLOP Out Flags
  84.  *
  85.  *    CLOPOF_PRESENT    - Set if option present
  86.  */
  87.  
  88. #define    CLOPOF_PRESENT        0x01
  89. #define CLOPOF_ALLOCATED    0x02    /* NYI */
  90.  
  91.  
  92. /*
  93.  *  DEFINITIONS
  94.  *    CLOPT_*
  95.  *
  96.  *  DESCRIPTION
  97.  *    Type field.
  98.  */
  99.  
  100. #define CLOPT_END    0
  101. #define    CLOPT_NUMBER    1
  102. #define CLOPT_UNUMBER    2
  103. #define CLOPT_STRING    3
  104. #define CLOPT_BOOL    4
  105. #define CLOPT_FLOAT    5    /* NYI */
  106.  
  107.  
  108. /*
  109.  *  DEFINITIONS
  110.  *    CLOPE_*
  111.  *
  112.  *  DESCRIPTION
  113.  *    Errorcodes.
  114.  */
  115.  
  116. #define CLOPE_OK        0
  117. #define CLOPE_NYI        1
  118. #define CLOPE_UNKNOWN_OPTION    2
  119. #define CLOPE_UNKNOWN_TYPE    3
  120. #define CLOPE_ILLEGAL_NUMBER    4
  121. #define CLOPE_ILLEGAL_BOOL    5
  122. #define CLOPE_ILLEGAL_STRING    6
  123. #define CLOPE_MULTIPLE_SINGLE    7
  124.  
  125. #ifndef NULL
  126. #define NULL 0L
  127. #endif
  128.