home *** CD-ROM | disk | FTP | other *** search
/ GRIPS 2: Government Rast…rocessing Software & Data / GRIPS_2.cdr / dos / pcshow / src / msc5_1 / show.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-06  |  6.6 KB  |  152 lines

  1. /* header file for pcshow include files and variables */
  2.  
  3. /* include statements */
  4.  
  5. #include <stdio.h>        /* standard i/o routines */
  6. #include <fcntl.h>        /* other standard routines */
  7. #include <stdlib.h>        /* more lattice c standard i/o routines */
  8. /*#include <tardev.h>        /* targa header files */
  9. #include <math.h>        /* some math functions needed */
  10. /*#include <time.h>        /* some time functions needed */
  11. #include "df.h"            /* header file with defines for HDF */
  12.  
  13. #define NOMOUSE
  14. /* remove comments before compiling for mouse operation */
  15.  
  16. /* define statements */
  17. #define TRUE 1
  18. #define FALSE 0
  19. #define HI 2
  20. #define LO 3
  21. #define    SCRLLEFT        203
  22. #define    SCRLUP            200
  23. #define    SCRLDOWN        208
  24. #define    SCRLRIGHT        205
  25. #define    PAGEUP            201
  26. #define    PAGEDOWN        209
  27. #define    HOME            199
  28. #define    END                207
  29. #define ALTSCRLUP        152
  30. #define ALTSCRLDOWN        160
  31. #define ALTSCRLLEFT        155
  32. #define ALTSCRLRIGHT    157    
  33. #define ALTPAGEUP        153
  34. #define ALTPAGEDOWN        161
  35. #define ALTHOME            151
  36. #define ALTEND            159
  37. #define HDF            'h'
  38. #define RASTER        'b'
  39. #define NO9            '9'
  40. #define    VGA            'v'
  41. #define    EGA            'e'
  42. #define    TARGA        't'
  43. #define RAWSIZE 32000    /* maximum size of the block to be read in from disk */
  44. #define LINEEGA    egaline(xwhere,ywhere+i,store[i+yoff],xoff,max(min(xdim-xoff,maxx-xwhere),0))    /*,trans)*/
  45.     /* call to print a line on the ega screen */
  46. #define LINEVGA       vgaline1(xwhere,ywhere+i,store[i+yoff],xoff,max(min(maxx-xwhere,xdim-xoff),0))
  47.     /* call to print a line on the vga screen */
  48. #define LINENO9       no9line(xwhere,ywhere+i,store[i+yoff],xoff,max(min(maxx-xwhere,xdim-xoff),0))
  49.     /* call to print a line on the no. 9 screen */
  50. /*#define LINET16       t16line(xwhere,ywhere+i,store[i+yoff],xoff,max(min(maxx-xwhere,xdim-xoff),0))*/
  51.     /* call to print a line on the Targa16 screen */
  52.  
  53. #ifdef LATTICE
  54. /* define a bigger stack */
  55. int _STACK = 8192;
  56. #endif
  57.  
  58. /* regular variables defined */
  59.  
  60. int        i,j,k,l,c,        /* temporary global counters and such */
  61.     xdim,ydim,            /* x & y dimensions for the image to be displayed */
  62.     file,                /* the file pointer for binary files */
  63.     xoff=0,yoff=0,        /* the offset into the picture to be displayed */
  64.     palnum=0,            /* the palette number which is currently displayed */
  65.     show=0,                /* a binary variable telling whether the palette is displayed on the screen */
  66.     palmax=-1,            /* the number of palettes in memory */
  67.     maxx,maxy,            /* the x & y dimensions of the screen */
  68.     palspeed=0,            /* how fast the palette rotates */
  69.     lastref,            /* the last reference number used in palette searching */
  70.     lasttag,            /* the last tag number used in searching for palettes */
  71.     newref,                /* reference number for a new palette */
  72.     imref,                /* the current image's reference number */
  73.     imtag,                /* the current image's tag number */
  74.     slope,                /* slope of line in fiddle mode */
  75.     offset,                /* offset for center of palette for fiddle mode */
  76.     animate=0,            /* the animation toggle */
  77.     one_file=0,            /* the one file animation toggle */
  78.     first_hdf=1,        /* boolean to flag the first time through an hdf animation */
  79.     cycled=0,            /* boolean variable to tell whether a sequence has been animated */
  80.     oneimage=0,            /* boolean variable to indicate whether there are multiple binary images to be displayed */
  81.     xshow,                /* the width of the image */
  82.     m1,m2,m3,m4,        /* mouse variables */
  83.     leftbutton,            /* boolean variables for buttons on the mouse */
  84.     rightbutton,
  85.     mouse=0,            /* boolean variable to determine if the mouse is active */
  86.     mx,my,                /* last position where the mouse was at */
  87.     pal_xoff=0,            /* location of the upper left hand corner of the color bar */
  88.     pal_yoff,
  89.     screen=1,            /* boolean variable for screen on or off */
  90.     before=0,            /* boolean variable for mouse activated previously */
  91.     anispeed=0,            /* speed for animation */
  92.     doneinit=0,            /* boolean variable to keep track of whether the palette has been initialized for ega mode */
  93.     getout=0,            /* boolean variable to exit program */
  94.     pal_height,            /* height in bytes of the color bar on the screen */
  95.     expandit=1,            /* preference boolean variable to expand(1) or interpolate(0) */ 
  96.     center=0,            /* boolean variable to specify a centered image */
  97.     file_err,            /* the error returned from file operations */
  98.     file_attr,            /* the file attribute to look for */
  99.     old_drive,            /* the name of the original drive */
  100.     new_drive,            /* the name of the new drive */
  101.     xwhere=0,ywhere=0;  /* where the upper left hand of the image is */
  102.  
  103. #ifdef QAK
  104. long    waitcount;        /* counter for timing out */
  105. #endif
  106.  
  107. unsigned short int l16[512];    /* array for the targa line */
  108.  
  109. char *store[1024],         /* one per line of image */
  110.     *p,                    /* temporary character storage */
  111.     mode,                /* the display mode we are in = EGA,VGA,NO9,TARGA */
  112.     filetype='h';          /* the type of file to be read = 'h,'b' */
  113.  
  114. unsigned char rmap[256],gmap[256],bmap[256],    /* the red, green, and blue bytes for 24 bit palettes */
  115.               pal[768],                            /* the full 24 bit palette, interleaved as red, green, blue, red, green ... */
  116.             *rpal[16],*gpal[16],*bpal[16],        /* arrays of pointers to different palettes */
  117.             *egapals[16],                        /* array of pointers to different ega palettes */
  118.             raw[RAWSIZE],                        /* for file buffering */
  119.             filename[128],                        /* name of binary image file */
  120.             old_path[128],                        /* the name of the original path to restore when execution stops */
  121.             drive[3],                            /* array to hold the name of the drive */
  122.             path[64],                            /* array to hold the name of the path */
  123.             node[9],                            /* array to hold the name of a node (drive:path\node.ext) */
  124.             ext[4],                                /* array to hold the name of a file extension */
  125.             palfile[128] = {0,0},                /* starts out = NULL */
  126.             palstore[8][512],                    /* large array to store the portion of the screen the palette overlays */
  127.             bigstore[4096];                        /* array to expand four lines of imcomp compressed image into */
  128.  
  129. unsigned char trans[256],            /* translation table for palette in ega mode */
  130.                     trans1[256]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, /* temporary translation table */
  131.                     count[64],        /* the colors to choose from in ega mode */
  132.                     regrs[16];        /* the actual palette for ega mode */
  133.  
  134. static unsigned char *mem_error="\nNot enough memory for image to be stored";
  135. extern unsigned char *DTAPTR;        /* pointer to a DTA containing filenames to be found (located in dosio.asm) */
  136.  
  137. FILE *fp,        /* file pointer for binary image files */
  138.         *pfp;    /* file pointer for binary palette files */
  139.  
  140. /* number nine variables */
  141. char *NO9ram;
  142. int *NO9bank; /* bank control registers */
  143.  
  144. struct {
  145.         int xdim,
  146.             ydim;
  147.         } dims;        /* dimension structure for HDF dimension reads */
  148.  
  149. /* HDF stuff */
  150. DF *dff;                    /* HDF file descriptor */
  151. DFdesc ddstr;                /* HDF structure for the tag & ref of something */
  152.