home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / Software / universal_plane_file_format / llvs_plane.h < prev    next >
C/C++ Source or Header  |  1992-01-29  |  4KB  |  103 lines

  1. /* -*-c-mode-*- */
  2. /*------------------------------------------------------
  3.  *  LLVS_PLANE.H - Header file for "universal" plane file I/O functions
  4.  *  Robert Heller Created on Mon Jul 10 08:39:12 1989
  5.  *  Last mod - 
  6.  *--------------------------------------------------------
  7.  *  Contents:
  8.  *--------------------------------------------------------
  9.  * (c) Copyright 1989 by The University of Massachusetts
  10.  *------------------------------------------------------*/
  11.  
  12. /* some basic types: */
  13.  
  14. typedef unsigned char llvs_ubyte;    /* unsigned bytes (8-bits) */
  15. typedef long int llvs_integer;    /* long integer (32-bits (4-bytes), 2's complement) */
  16. typedef float llvs_single_float;    /* 32-bit floating point (native format) */
  17. typedef short int llvs_half_integer;    /* short integer (16-bits (2-bytes), 2's complement) */
  18.  
  19. /* primary header record:  LLVS Plane files start with these 32 bytes */
  20.  
  21. typedef struct {
  22.     llvs_ubyte ptype;        /* datatype of plane */
  23. #define LLVS_PLF_BIT   0    /* bit type */
  24. #define LLVS_PLF_BYTE  1    /* unsigned byte type */
  25. #define LLVS_PLF_SHORT 2    /* signed 16 bit type */
  26. #define LLVS_PLF_INT   3    /* integer type */
  27. #define LLVS_PLF_FLOAT 4    /* float type */
  28.     llvs_ubyte bsex;        /* byte sex (byte order) */
  29. #define LLVS_LOW_BYTE_FIRST 0    /* low byte first (VAX, 80x86, etc.) */
  30. #define LLVS_HIGH_BYTE_FIRST 1    /* high byte first (680x0, Spark, etc.) */
  31.     llvs_ubyte floatfmt;    /* floating point format */
  32. #define LLVS_DEC_SINGLE_FLOAT 0    /* DEC 32-bit floating point format (PDP-11, VAX) */
  33. #define LLVS_IEEE_SINGLE_FLOAT 1 /* IEEE 32-bit floating point format (Sun, Sequent, 
  34.                    Spark, TI LISPM, etc.) */
  35.     llvs_ubyte reserved;    /* reserved byte - must be ZERO at present */
  36. /* the remaining fields are in the format indicated above */
  37.     llvs_integer pl_level;    /* plane level */
  38.     llvs_integer row_location;    /* row offset of plane */
  39.     llvs_integer col_location;    /* column offset of plane */
  40.     union {
  41.     llvs_integer iback;        /* integer background value */
  42.     llvs_single_float fback;    /* floating point background value */
  43.     } background;    /* plane background value */
  44.     llvs_integer alist_length;    /* length of alist record */
  45.     llvs_integer data_length;    /* length of data + size header */
  46.     llvs_integer multi_plane_flag; /* Multi-plane flag - if 0 this is the last/only plane
  47.                       otherwise, additional planes are stored after this
  48.                       one. */
  49.     } LLVS_PLANE_FILE_HEADER;
  50.  
  51. /* this next record is the AList.  It is text (printed rep. of a Common LISP ALIST) and
  52.    variable length */
  53.  
  54. /* next is the size record record */
  55.  
  56. typedef struct {
  57.    llvs_integer datatype_again;    /* plane data type (redundant) */
  58.    llvs_integer row_dimension;    /* plane row dimension */
  59.    llvs_integer col_dimension;    /* plane col dimension */
  60.    } LLVS_PLANE_SIZE_HEADER;
  61.  
  62. /* The data comes next */
  63.  
  64. #define BLOCKSIZE 512        /* I/O Buffer size */
  65.  
  66. /*------- system dependent stuff ----------*/
  67.  
  68. /* VAX implies VAX/VMS and VAX/Ultrix (same hardware for both) */
  69. #ifdef VAX
  70. #define LLVS_NATIVE_BYTE_SEX LLVS_LOW_BYTE_FIRST
  71. #define LLVS_NATIVE_FLOATFMT LLVS_DEC_SINGLE_FLOAT
  72. #endif
  73.  
  74. /* SUN implies both Sun 3 (68020/68881(2)) and Sun 4 (SPARK) */
  75. #ifdef SUN
  76. #define LLVS_NATIVE_BYTE_SEX LLVS_HIGH_BYTE_FIRST
  77. #define LLVS_NATIVE_FLOATFMT LLVS_IEEE_SINGLE_FLOAT
  78. #endif
  79.  
  80. /* SEQUENT is a 80386/80387 UNIX system */
  81. #ifdef SEQUENT
  82. #define LLVS_NATIVE_BYTE_SEX LLVS_LOW_BYTE_FIRST
  83. #define LLVS_NATIVE_FLOATFMT LLVS_IEEE_SINGLE_FLOAT
  84. #endif
  85.  
  86. /* This is for documentation only - C won't be used on the Explorer */
  87. #ifdef EXPLORER
  88. #define LLVS_NATIVE_BYTE_SEX LLVS_LOW_BYTE_FIRST
  89. #define LLVS_NATIVE_FLOATFMT LLVS_IEEE_SINGLE_FLOAT
  90. #endif
  91.  
  92. /* MIPS implies other MIPS-based systems */
  93. #ifdef MIPS
  94. #define LLVS_NATIVE_BYTE_SEX LLVS_HIGH_BYTE_FIRST 
  95. #define LLVS_NATIVE_FLOATFMT LLVS_IEEE_SINGLE_FLOAT
  96. #endif
  97.  
  98. #ifdef DECSTATION
  99. #define LLVS_NATIVE_BYTE_SEX LLVS_LOW_BYTE_FIRST
  100. #define LLVS_NATIVE_FLOATFMT LLVS_IEEE_SINGLE_FLOAT
  101. #endif
  102.  
  103.