home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / c / help.arc / MASDOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-11  |  4.1 KB  |  162 lines

  1. #ifndef MASDOS_INCLUDED
  2. #define MASDOS_INCLUDED
  3.  
  4. /*
  5. *
  6. * D_ debuging
  7. * A_ attributes for files
  8. * P_ print characteristics
  9. * Q_ characters
  10. * B_ BDOS interupt parameters
  11. *
  12. */
  13.  
  14. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  15. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  16. #define abs(a)        (((a) < 0) ? -(a) : (a))
  17.  
  18. #define EOS(s)        while(*s) s++
  19.  
  20. #define ISQUOTE(c)    ((c)=='\"' || (c)=='\'')
  21. #define ISSQUOTE(c)    ((c)=='\'')
  22. #define ISDQUOTE(c)    ((c)=='\"')
  23.  
  24. #define ISWILD(c)    ((c)=='*' || (c)=='?' )
  25.  
  26. #define ISVSBRACE(c)    ((c)=='{' || (c)=='(' )
  27. #define ISVEBRACE(c)    ((c)=='}' || (c)==')' )
  28.  
  29. #define SKIPWHITE(p)    while( isspace(*p) ) p++
  30.  
  31. #define ROUND(n,u)    ( !((n) % (u)) ? (n) : (((n) / (u)) + 1) * (u))
  32.  
  33. #define E(x)        fprintf( stderr, x )
  34. #define E2(x,y)        fprintf( stderr, x, y )
  35.  
  36. #if (!defined(M_I86CM) && !defined(M_I86LM))
  37. #define    NullS        (char *)0
  38. #else
  39. #define    NullS        (char *)0L
  40. #endif
  41.  
  42.  
  43. #ifdef DEBUGGING
  44. #ifdef THIS_IS_MAIN
  45. int    Lev = -1;
  46. #else
  47. extern int Lev;
  48. #endif
  49. #define TRACE(p)        fprintf( stderr, "%*s{ entering %s\n" , ++Lev * 2, "", p )
  50. #define END_TRACE(p)    fprintf( stderr, "%*s} exiting  %s\n" , Lev-- * 2, "", p )
  51. #define P_TRACE(p,q)    fprintf( stderr, "%*s| %s=%s\n", Lev * 2, "", p, q )
  52. #define DIAG(f,a)        fprintf( stderr, "%*s| ", Lev * 2, "" );\
  53.                         fprintf( stderr, f, a )
  54. #else
  55. #define TRACE(p)
  56. #define END_TRACE(p)
  57. #define    P_TRACE(p)
  58. #define DIAG(f,a)
  59. #endif
  60.  
  61. #ifdef DEBUGGING
  62.  
  63. #define D_IN(p) fprintf(stderr,"(%s) In\n",p)
  64. #define D_OUT(p) fprintf(stderr,"(%s) Out\n",p)
  65. #define D_PRT(p,q) fprintf(stderr,"(%s) %s\n",p,q)
  66.  
  67. #define D_S(p,q,r) fprintf(stderr,"(%s) %s %s\n",p,q,r)
  68. #define D_I(p,q,r) fprintf(stderr,"(%s) %s %d\n",p,q,r)
  69.  
  70. #else
  71.  
  72. #define D_IN(p)
  73. #define D_OUT(p)
  74. #define D_PRT(p,q)
  75.  
  76. #define D_S(p,q,r)
  77. #define D_I(p,q,r)
  78.  
  79. #endif
  80.  
  81. #define NNULL 1
  82.  
  83. struct FILEINFO
  84. {
  85.         unsigned char    fi_resv[21];                /* Reserved by DOS */
  86.         unsigned char    fi_attrib;                  /* File Attributes */
  87.         unsigned int     fi_time;                    /* Create/Update time */
  88.         unsigned int     fi_date;                    /* Create/Update date */
  89.         unsigned long    fi_fsize;                   /* File Size (bytes) */
  90.         char             fi_name[13];                /* File Name & Extension */
  91. };
  92.  
  93. #define A_READONLY      0x01
  94. #define A_HIDDEN        0x02
  95. #define A_SYSTEM        0x04
  96. #define A_LABEL         0x08
  97. #define A_SUBDIR        0x10
  98. #define A_DIRTY         0x20
  99.  
  100. #define A_ALL           0xff
  101. #define A_ALL_FILES     (A_HIDDEN&A_SYSTEM)
  102. #define A_NORM_FILES    0x00
  103.  
  104. #define IS_READONLY(p)  ((p) & A_READONLY)
  105. #define IS_HIDDEN(p)    ((p) & A_HIDDEN)
  106. #define IS_SYSTEM(p)    ((p) & A_SYSTEM)
  107. #define IS_LABEL(p)     ((p) & A_LABEL)
  108. #define IS_SUBDIR(p)    ((p) & A_SUBDIR)
  109. #define IS_DIRTY(p)     ((p) & A_DIRTY)
  110.  
  111. #define C_HOUR(p)       (((p) >> 11) & 0x1f)
  112. #define C_MIN(p)        (((p) >> 5) & 0x3f)
  113. #define C_SEC(p)        (((p) << 1) & 0x3e)
  114. #define C_YEAR(p)       ((((p) >> 9) & 0x7f) + 1980)
  115. #define C_MONTH(p)      (((p) >> 5) & 0x0f)
  116. #define C_DAY(p)        (((p)) & 0x1f)
  117.  
  118. #define Q_ESC           0x1b
  119.  
  120. #define P_ALL_OFF       "\033[0m"
  121. #define P_BOLDFACE      "\033[1m"
  122. #define P_UNDERLINE     "\033[4m"
  123. #define P_BLINKING      "\033[5m"
  124. #define P_REVERSE       "\033[7m"
  125.  
  126. #define B_PRGTRM        0x0000
  127. #define B_KBDINP        0x0100
  128. #define B_DSPOUT        0x0200
  129. #define B_AUXINP        0x0300
  130. #define B_AUXOUT        0x0400
  131. #define B_PRNOUT        0x0500
  132. #define B_CONIO         0x0600
  133. #define B_CONDIN        0x0700
  134. #define B_CONINN        0x0800
  135. #define B_PRTSTR        0x0900
  136. #define B_KBDBIN        0x0a00
  137.  
  138. #define B_SEL_DISK      0x0e00
  139.  
  140. #define B_SETDTA        0x1a00
  141.  
  142. #define B_GETDTA        0x2f00
  143.  
  144. #define B_IOCTL            0x4400
  145.  
  146. #define B_FINDFIRST     0x4e00
  147. #define B_FINDNEXT      0x4f00
  148.  
  149. #define IO_CTRL  0x4000
  150. #define IO_ISDEV 0x0080
  151. #define IO_EOF   0x0040
  152. #define IO_RAW   0x0020
  153. #define IO_ISCLK 0x0008
  154. #define IO_ISNUL 0x0004
  155. #define IO_ISCOT 0x0002
  156. #define IO_ISCIN 0x0001
  157.  
  158. #define    CARRY     0x01
  159.  
  160. #endif /* MASDOS_INCLUDED */
  161.  
  162.