home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / gnu / djgpp / contrib / libgrx / include / grxfile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-06  |  3.6 KB  |  125 lines

  1. /**
  2.  ** GRXFILE.H
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #ifndef _GRXFILE_H_
  25. #define _GRXFILE_H_
  26.  
  27. #if defined(__GNUC__) && !defined(near)
  28. # define near
  29. # define far
  30. # define huge
  31. #endif
  32.  
  33. #define  FONT_MAGIC    0x19590214L
  34. #define  FONTDIR_MAGIC  0x19270104L
  35. #define  CURSOR_MAGIC    0x18480315L
  36. #define  BITMAP_MAGIC    0x19390901L
  37. #define  PIXMAP_MAGIC    0x19700302L
  38. #define  ICON_MAGIC    0x19840728L
  39. #define  RGBDIR_MAGIC    0x19561023L
  40.  
  41. /*
  42.  * font file structure:
  43.  *    +-----------------------+
  44.  *    |     MAGIC NUMBER    |
  45.  *    +-----------------------+
  46.  *    |     BITMAP SIZE    |
  47.  *    +-----------------------+
  48.  *    |     FONT HEADER    |
  49.  *    +-----------------------+
  50.  *    |     PROPORTIONAL    |
  51.  *    |     WIDTH TABLE    |
  52.  *    |     (16 bit ints)    |
  53.  *    |     (optional)    |
  54.  *    +-----------------------+
  55.  *    |     BITMAP        |
  56.  *    +-----------------------+
  57.  */
  58.  
  59. typedef struct {
  60.     long    magic;            /* magic number */
  61.     long    bitmapsize;            /* size of the bitmap */
  62.     GrFont  h;                /* font header */
  63. } FntFileHdr;
  64.  
  65. /*
  66.  * font directory file structure:
  67.  *    +-----------------------+
  68.  *    |   MAGIC NUMBER    |
  69.  *    +-----------------------+
  70.  *    |   # OF ENTRIES    |
  71.  *    +-----------------------+
  72.  *    |   1st FONT HEADER    |
  73.  *    +-----------------------+
  74.  *    |   2nd FONT HEADER    |
  75.  *    +-----------------------+
  76.  *    |        :        |
  77.  *    |        :        |
  78.  *    +-----------------------+
  79.  *    |   last FONT HEADER    |
  80.  *    +-----------------------+
  81.  */
  82.  
  83. typedef struct {
  84.     long    magic;            /* magic number */
  85.     long    numentries;            /* # of GrFont structures in file */
  86. } FntDirHdr;
  87.  
  88. #define FNTENV  "GRXFONT"        /* font path environment variable */
  89. #define FNTEXT  ".fnt"            /* font file extension */
  90. #define DIREXT  ".dir"            /* font directory file extension */
  91. extern  char    _GrFontPath[];        /* user specified font path */
  92.  
  93. /*
  94.  * loaded resource list management
  95.  */
  96. typedef struct _reslist {        /* list of loaded resources */
  97.     struct _reslist *next;        /* next item */
  98.     void   *data;            /* the resource */
  99.     char   name[1];            /* full path name to the resource */
  100. } ResList;
  101.  
  102. extern void  _GrAddToResList(void *data,char *name,ResList **list);
  103. extern void  _GrRemoveFromResList(void *data,ResList **list);
  104. extern void *_GrLookupInResList(char *name,ResList *list);
  105.  
  106.  
  107. /*
  108.  * file utilities
  109.  */
  110. extern void  _GrSetPath(char *name,char *pathbuffer);
  111. extern char *_GrGetFname(char *name,char *path,char *env,char *ext,char *where);
  112. extern int   _GrFileOpen(char *name);
  113. extern void  _GrFileClose(int handle);
  114.  
  115. #ifdef __GNUC__
  116. # define _GrFarRead(file,buff,size)    read(file,buff,(int)size)
  117. #endif
  118.  
  119. #ifdef __TURBOC__
  120.   extern long _GrFarRead(int file,void far *buff,long size);
  121. #endif
  122.  
  123. #endif /* whole file */
  124.  
  125.