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