home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mdepsrc.zip / def.h < prev    next >
C/C++ Source or Header  |  1996-12-10  |  4KB  |  150 lines

  1. /* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
  2. /*
  3.  
  4. Copyright (c) 1993, 1994  X Consortium
  5.  
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of the X Consortium shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from the X Consortium.
  26.  
  27. */
  28.  
  29. #include <stdio.h>
  30. #include "Xosdefs.h"
  31. #ifdef WIN32
  32. #include "Xw32defs.h"
  33. #endif
  34. #ifdef __OS2__
  35. #define __STDC__ 1
  36. #include "Xos2defs.h"
  37. #endif
  38. #include "Xfuncproto.h"
  39. #include <ctype.h>
  40. #ifndef X_NOT_POSIX
  41. #ifndef _POSIX_SOURCE
  42. #define _POSIX_SOURCE
  43. #endif
  44. #endif
  45. #include <sys/types.h>
  46. #include <fcntl.h>
  47. #include <sys/stat.h>
  48.  
  49. #define MAXDEFINES    512
  50. #define MAXFILES    512
  51. #define MAXDIRS        64
  52. #define SYMTABINC    10    /* must be > 1 for define() to work right */
  53. #define    TRUE        1
  54. #define    FALSE        0
  55.  
  56. /* the following must match the directives table in main.c */
  57. #define    IF        0
  58. #define    IFDEF        1
  59. #define    IFNDEF        2
  60. #define    ELSE        3
  61. #define    ENDIF        4
  62. #define    DEFINE        5
  63. #define    UNDEF        6
  64. #define    INCLUDE        7
  65. #define    LINE        8
  66. #define    PRAGMA        9
  67. #define ERROR           10
  68. #define IDENT           11
  69. #define SCCS            12
  70. #define ELIF            13
  71. #define EJECT           14
  72. #define IFFALSE         15     /* pseudo value --- never matched */
  73. #define ELIFFALSE       16     /* pseudo value --- never matched */
  74. #define INCLUDEDOT      17     /* pseudo value --- never matched */
  75. #define IFGUESSFALSE    18     /* pseudo value --- never matched */
  76. #define ELIFGUESSFALSE  19     /* pseudo value --- never matched */
  77.  
  78. #ifdef DEBUG
  79. extern int    _debugmask;
  80. /*
  81.  * debug levels are:
  82.  * 
  83.  *     0    show ifn*(def)*,endif
  84.  *     1    trace defined/!defined
  85.  *     2    show #include
  86.  *     3    show #include SYMBOL
  87.  *     4-6    unused
  88.  */
  89. #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
  90. #else
  91. #define    debug(level,arg) /**/
  92. #endif /* DEBUG */
  93.  
  94. typedef    unsigned char boolean;
  95.  
  96. struct symtab {
  97.     char    *s_name;
  98.     char    *s_value;
  99. };
  100.  
  101. struct    inclist {
  102.     char        *i_incstring;    /* string from #include line */
  103.     char        *i_file;    /* path name of the include file */
  104.     struct inclist    **i_list;    /* list of files it itself includes */
  105.     int        i_listlen;    /* length of i_list */
  106.     struct symtab    *i_defs;    /* symbol table for this file */
  107.     int        i_ndefs;    /* current # defines */
  108.     int        i_deflen;    /* amount of space in table */
  109.     boolean        i_defchecked;    /* whether defines have been checked */
  110.     boolean        i_notified;    /* whether we have revealed includes */
  111.     boolean        i_marked;    /* whether it's in the makefile */
  112.     boolean        i_searched;    /* whether we have read this */
  113.     boolean         i_included_sym; /* whether #include SYMBOL was found */
  114.                     /* Can't use i_list if TRUE */
  115. };
  116.  
  117. struct filepointer {
  118.     char    *f_p;
  119.     char    *f_base;
  120.     char    *f_end;
  121.     long    f_len;
  122.     long    f_line;
  123. };
  124.  
  125. #ifndef X_NOT_STDC_ENV
  126. #include <stdlib.h>
  127. #if defined(macII) && !defined(__STDC__)  /* stdlib.h fails to define these */
  128. char *malloc(), *realloc();
  129. #endif /* macII */
  130. #else
  131. char            *malloc();
  132. char            *realloc();
  133. #endif
  134.  
  135. char            *copy();
  136. char            *base_name();
  137. char            *getline();
  138. struct symtab        *slookup();
  139. struct symtab        *isdefined();
  140. struct symtab        *fdefined();
  141. struct filepointer    *getfile();
  142. struct inclist        *newinclude();
  143. struct inclist        *inc_path();
  144.  
  145. #if NeedVarargsPrototypes
  146. extern fatalerr(char *, ...);
  147. extern warning(char *, ...);
  148. extern warning1(char *, ...);
  149. #endif
  150.