home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / x / xvisrc.zoo / msdos.h < prev    next >
C/C++ Source or Header  |  1992-07-28  |  3KB  |  143 lines

  1. /* Copyright (c) 1990,1991,1992 Chris and John Downey */
  2. /***
  3. * @(#)msdos.h    2.1 (Chris & John Downey) 7/29/92
  4.  
  5. * program name:
  6.     xvi
  7. * function:
  8.     PD version of UNIX "vi" editor, with extensions.
  9. * module name:
  10.     msdos.h
  11. * module function:
  12.     Definitions for MS-DOS system interface.
  13. * history:
  14.     STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  15.     Originally by Tim Thompson (twitch!tjt)
  16.     Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  17.     Heavily modified by Chris & John Downey
  18.  
  19. ***/
  20.  
  21. #include <dos.h>
  22. #include <fcntl.h>
  23. #include <io.h>
  24. #include <process.h>
  25. #include <stdlib.h>
  26. #include <time.h>
  27.  
  28. /*
  29.  * This is a workaround for a particularly nasty bug which appeared
  30.  * in one compiler recently.
  31.  */
  32. #ifdef NULL
  33. #   undef NULL
  34. #endif
  35. #define NULL    ((void *) 0)
  36.  
  37. /*
  38.  * Get definitions for terminal interface.
  39.  */
  40. #ifdef DOS386
  41. #   include "pc386.h"
  42. #else
  43. #   include "ibmpc.h"
  44. #endif
  45.  
  46. #ifndef HELPFILE
  47. #   define HELPFILE    "c:\\xvi\\help"
  48. #endif
  49.  
  50. /*
  51.  * System-dependent constants.
  52.  */
  53. #define    MAXPATHLEN    143    /* maximum length of full path name */
  54. #define    MAXNAMLEN    12    /* maximum length of file name */
  55. #define    DIRSEPS        "\\/"    /*
  56.                  * directory separators within
  57.                  * pathnames
  58.                  */
  59. /*
  60.  * Under MS-DOS, characters with the top bit set are perfectly valid
  61.  * (although not necessarily always what you want to see).
  62.  */
  63. #define DEF_CCHARS    TRUE
  64. #define DEF_MCHARS    TRUE
  65.  
  66. #define DEF_TFF        fmt_MSDOS
  67.  
  68. /*
  69.  * Macros to open files in binary mode,
  70.  * and to expand filenames.
  71.  */
  72. #define fopenrb(f)    fopen((f),"rb")
  73. #define fopenwb(f)    fopen((f),"wb")
  74. #define fexpand(f)    (f)
  75.  
  76. /*
  77.  * Execute a command in a subshell.
  78.  */
  79. #define call_system(s)    system(s)
  80.  
  81. /*
  82.  * Execute a shell.
  83.  */
  84. #define call_shell(s)    spawnlp(0, (s), (s), (char *) NULL)
  85.  
  86. /*
  87.  * Size of buffer for file i/o routines.
  88.  * The SETVBUF_AVAIL forces the file i/o routines to
  89.  * use a large buffer for reading and writing, and
  90.  * this results in a large performance improvement.
  91.  */
  92. #define SETVBUF_AVAIL
  93. #define WRTBUFSIZ    0x7000
  94. #define READBUFSIZ    0x1000
  95.  
  96. #ifdef    __ZTC__
  97. #   define exists(f)    (findfirst((f),FA_HIDDEN|FA_SYSTEM|FA_DIREC)\
  98.                                 != NULL)
  99. #else /* not Zortech */
  100. #   include <malloc.h>
  101. #   define  exists(f)    (access(f, 0) == 0)
  102. #endif /* not Zortech */
  103.  
  104. /*
  105.  * Definitions needed for dstat() system call.
  106.  */
  107. struct dstat
  108. {
  109.     char        d_bytealigned[43];
  110. };
  111.  
  112. #define    dst_mode    d_bytealigned[21]
  113. #define dst_BASENAME(i)    (&(i).d_bytealigned[30])
  114.             /* file's basename */
  115. #define dst_LAST(i)    (&(i).d_bytealigned[42])
  116.             /* pointer to terminating '\0' of basename */
  117.  
  118. /*
  119.  * Mode bits.
  120.  */
  121. #define    dst_READONLY    1
  122. #define    dst_HIDDEN    2
  123. #define    dst_SYSTEM    4
  124. #define    dst_VLABEL    010
  125. #define    dst_DIR        020
  126. #define    dst_ARCHIVE    040
  127.  
  128. /*
  129.  * Declarations for system interface routines in msdos_c.c &
  130.  * msdos_a.asm (or pc386.c):
  131.  */
  132. extern    bool_t        can_write P((char *));
  133. extern    void        catchints P((void));
  134. extern    void        delay P((void));
  135. extern    int        statfirst P((char *, struct dstat *, int));
  136. extern    int        statnext P((struct dstat *));
  137. extern    void        sys_init P((void));
  138. extern    void        sys_startv P((void));
  139. extern    void        sys_endv P((void));
  140. extern    void        sys_exit P((int));
  141. extern    bool_t        sys_pipe P((char *, int (*)(FILE *), long (*)(FILE *)));
  142. extern    char        *tempfname P((char *));
  143.