home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / hdf3_2r2.lha / HDF3.2r2 / util / he.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-28  |  5.2 KB  |  221 lines

  1. /***************************************************************************
  2. *
  3. *
  4. *                         NCSA HDF version 3.2r2
  5. *                            October 30, 1992
  6. *
  7. * NCSA HDF Version 3.2 source code and documentation are in the public
  8. * domain.  Specifically, we give to the public domain all rights for future
  9. * licensing of the source code, all resale rights, and all publishing rights.
  10. *
  11. * We ask, but do not require, that the following message be included in all
  12. * derived works:
  13. *
  14. * Portions developed at the National Center for Supercomputing Applications at
  15. * the University of Illinois at Urbana-Champaign, in collaboration with the
  16. * Information Technology Institute of Singapore.
  17. *
  18. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  19. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  20. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  21. *
  22. ****************************************************************************
  23. */
  24.  
  25. /*
  26. $Header: /hdf/hdf/v3.2r2/util/RCS/he.h,v 1.6 1992/10/12 18:33:28 koziol beta koziol $
  27.  
  28. $Log: he.h,v $
  29.  * Revision 1.6  1992/10/12  18:33:28  koziol
  30.  * changed HE_DESCSZ to 8192
  31.  *
  32.  * Revision 1.1  1992/09/18  14:56:22  koziol
  33.  * Initial revision
  34.  *
  35.  * Revision 1.7  1992/09/11  18:32:51  chouck
  36.  * Assorted MAC mungings
  37.  *
  38.  * Revision 1.5  1992/08/18  19:49:33  chouck
  39.  * Include string.h
  40.  *
  41.  * Revision 1.4  1992/07/31  21:10:24  chouck
  42.  * Use in-house print routines rather than fork() a call to od
  43.  *
  44.  * Revision 1.3  1992/07/15  21:48:48  sxu
  45.  * No change.
  46.  *
  47.  * Revision 1.2  1992/07/14  16:29:20  mlivin
  48.  * fixed include of he_proto.h (for name change to _ not -)
  49.  *
  50.  * Revision 1.1  1992/07/06  22:54:16  mlivin
  51.  * Initial revision
  52.  *
  53. */
  54. /* he.h -- header file for HDFedit */
  55. #include "hdf.h"
  56. #include <ctype.h>
  57. #include <stdio.h>
  58. /* #include <sys/wait.h> */
  59.  
  60. #include <string.h>
  61.  
  62. /* 
  63.  * the following may not exist on all systems it should define stuff
  64.  * like fork(), and other system calls
  65.  */
  66. #if defined (IBM6000) || defined (SUN)
  67. #include <unistd.h>
  68. #endif /* Unix std libs */
  69.  
  70. #ifdef DEBUG
  71. #define ASSERT(e) {if(!(e)){fprintf(stderr,"Assertion failed: file %s, line %d\n",__FILE__,__LINE__);exit(1);}}
  72. #define NOT_REACHED() {fprintf(stderr,"Should not reach: file %s, line %d\n",__FILE__,__LINE__);exit(1);}
  73. #else
  74. #define ASSERT(e)        /* empty assertion */
  75. #define NOT_REACHED()        /* empty */
  76. #endif /* DEBUG */
  77.  
  78. #define HE_ARG_SZ 30
  79. #define HE_DESC_SZ 8192
  80.  
  81. #define HE_COLOR_SZ 256
  82. #define HE_PALETTE_SZ 768
  83. #define HE_BUF_SZ 1024
  84.  
  85. /* return status */
  86. #define HE_OK 0
  87. #define HE_FAIL -1
  88. #define YES 1
  89. #define NO 0
  90.  
  91. /* options */
  92. #define HE_AMBIG -2
  93. #define HE_NOTFOUND -1
  94. #define HE_ALL 1
  95. #define HE_BACKUP 2
  96. #define HE_HELP 3
  97. #define HE_LONGOUT 4
  98. #define HE_NOBACKUP 5
  99. #define HE_REMOTE 6
  100. #define HE_VERBOSE 7
  101. #define HE_FILE 8
  102. #define HE_KEEP 9
  103. #define HE_POSITION 10
  104. #define HE_EXPANSION 11
  105. #define HE_LARGE 12
  106. #define HE_RDONLY 13
  107. #define HE_BATCH 14
  108. #define HE_OFFSET 15
  109. #define HE_ASCII 16
  110. #define HE_OCTAL 17
  111. #define HE_HEX 18
  112. #define HE_DECIMAL 19
  113. #define HE_FLOAT 20
  114. #define HE_DIMS 21
  115. #define HE_IMAGE 22
  116. #define HE_PALETTE 23
  117. #define HE_RASTER 24
  118. #define HE_RLE 25
  119. #define HE_IMCOMP 26
  120. #define HE_DOGROUP 27
  121. #define HE_LENGTH 28
  122. #define HE_ATTACHTO 29
  123. #define HE_LABEL 30
  124. #define HE_DESCRIPTOR 31
  125. #define HE_EDITOR 32
  126.  
  127. #define HE_BYTE    33
  128. #define HE_SHORT   34
  129. #define HE_DOUBLE  35
  130. #define HE_RAW     36
  131.  
  132. /* label bits for predicate keys */
  133. #define HE_PREDICATE 0x8000
  134. #define HE_COMPARATOR 0x4000
  135.  
  136. /* predicate keys */
  137. #define HEK_NULL 0
  138. #define HEK_TAG 1
  139. #define HEK_REF 2
  140. #define HEK_EQUAL 3
  141. #define HEK_NEQUAL 4
  142. #define HEK_GRT 5
  143. #define HEK_GEQUAL 6
  144. #define HEK_LESST 7
  145. #define HEK_LEQUAL 8
  146. #define HEK_ALL 9
  147. #define HEK_SUCCEED 10
  148. #define HEK_FAIL 11
  149. #define HEK_GROUP 12
  150.  
  151. /* argument type */
  152. #define HE_NUMBER 1
  153. #define HE_STRING 2
  154.  
  155. typedef int (*HE_FUNC)
  156.      PROTO((void *));
  157.  
  158. typedef struct he_cmd {
  159.     int argc;
  160.     char *argv[HE_ARG_SZ];
  161.     HE_FUNC func;
  162.     struct he_cmd *sub, *next;
  163. } HE_CMD;
  164.  
  165. typedef struct he_pred {
  166.     int key, Comp, argType;
  167.     union {
  168.     int i;
  169.     char *str;
  170.     } arg;
  171. } HE_PRED;
  172.  
  173. typedef struct DFdesc_str {
  174.   uint16 tag, ref;
  175.   int32  length, offset;
  176. } DFdesc, *DFdesc_ptr;
  177.  
  178. typedef struct tag_ref_struct {
  179.   uint16 tag;
  180.   uint16 ref;
  181. } tag_ref, *tag_ref_ptr;
  182.  
  183. typedef struct he_group {
  184.   int         desc;
  185.   int         size;
  186.   tag_ref_ptr ddList;
  187. } HE_GROUP;
  188.  
  189. extern int he_status;
  190. extern int he_numDesc;
  191. extern int he_currDesc;
  192. extern int he_numGrp;
  193. extern int he_remote;
  194. extern char *he_file;
  195. extern DFdesc he_desc[];
  196. extern HE_GROUP he_grp[];
  197.  
  198. /*
  199.  *  ----------------- Convenient Macros ---------------------
  200.  */
  201.  
  202. #define unkOpt(st)     fprintf(stderr,"Unknown option: %s.\n",st)
  203. #define unkArg(st)     fprintf(stderr,"Unknown argument: %s.\n",st)
  204. #define ambigOpt(st)   fprintf(stderr,"Ambigupus option: %s.\n",st)
  205. #define irrOpt(st)     fprintf(stderr,"Irrelevant option: %s.\n",st)
  206. #define noFile()      fprintf(stderr,"No file is opened.\n")
  207.  
  208. #define isAnnot(t)    (t == DFTAG_DIL || t == DFTAG_DIA)
  209. #define isRig(t)      (t == DFTAG_RIG)
  210. #define currTag()     (he_desc[he_currDesc].tag)
  211. #define currGrpNo()   (desc2Grp(he_currDesc))
  212. #define currDesc()    ((DFdesc*) he_desc + he_currDesc)
  213.  
  214. #include "he_proto.h"
  215.  
  216. /* end of he.h */
  217.  
  218.  
  219.  
  220.  
  221.