home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJDEV201.ZIP / include / crt0.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-31  |  7.1 KB  |  182 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #ifndef __dj_include_crt0_h_
  3. #define __dj_include_crt0_h_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  10.  
  11. #ifndef __STRICT_ANSI__
  12.  
  13. #ifndef _POSIX_SOURCE
  14.  
  15. /*****************************************************************************\
  16.  * crt0.h - specific to go32 v2.0 applications, controls command line
  17.  * argument creation.
  18. \*****************************************************************************/
  19.  
  20. /*****************************************************************************\
  21.  * If the application wishes to provide a wildcard expansion function,
  22.  * it should define a __crt0_glob_function function.  It should return
  23.  * a list of the expanded values, or 0 if no expansion will occur.
  24.  * The startup code will free the returned pointer if it is nonzero.
  25.  *
  26.  * If no expander function is provided, wildcards will be expanded in
  27.  * the POSIX.1 style.  To disable expansion, provide a __crt0_glob_function
  28.  * that always returns 0.
  29.  *
  30.  * Applications that do not rely on environment variables can provide an
  31.  * alternate version of __crt0_load_environment_file that does nothing.
  32.  *
  33.  * Applications that do not rely on arguments passed to main() can
  34.  * provide an alternate version of __crt0_setup_arguments() that does
  35.  * nothing.
  36. \*****************************************************************************/
  37.  
  38. extern char  *__dos_argv0;
  39. extern int    __crt0_argc;
  40. extern char **__crt0_argv;
  41.  
  42. void   __crt0_load_environment_file(char *_app_name);
  43. void   __crt0_setup_arguments(void);
  44. char **__crt0_glob_function(char *_arg);
  45.  
  46. /*****************************************************************************\
  47.  *
  48.  *  To set any of these startup flags, add the following declaration to
  49.  *  *your* source code:
  50.  *   
  51.  *    int _crt0_startup_flags = _CRT0_FLAG_* | _CRT0_FLAG_*;
  52.  *  
  53.  *  The default is all flags off.
  54.  *
  55. \*****************************************************************************/
  56.  
  57. extern int _crt0_startup_flags;
  58.  
  59. /* If set, argv[0] is left in whatever case it was.  If not set, all
  60. ** characters are mapped to lower case.  Note that if the argv0 field in
  61. ** the stubinfo structure is present, the case of that part of argv0 is not
  62. ** affected. 
  63. */
  64. #define _CRT0_FLAG_PRESERVE_UPPER_CASE        0x0001
  65.  
  66. /* If set, reverse slashes (dos-style) are preserved in argv[0].  If not
  67. ** set, all reverse slashes are replaced with unix-style slashes.
  68. */
  69. #define _CRT0_FLAG_USE_DOS_SLASHES        0x0002
  70.  
  71. /* If set, the .EXE suffix is removed from the file name component of
  72. ** argv[0].  If not set, the suffix remains. 
  73. */
  74. #define _CRT0_FLAG_DROP_EXE_SUFFIX        0x0004
  75.  
  76. /* If set, the drive specifier (ex: `C:') is removed from the beginning of
  77. ** argv[0] (if present).  If not set, the drive specifier remains. 
  78. */
  79. #define _CRT0_FLAG_DROP_DRIVE_SPECIFIER    0x0008
  80.  
  81. /* If set, response files (ex: @gcc.rf) are not expanded.  If not set, the
  82. ** contents of the response files are used to create arguments.  Note that
  83. ** if the file does not exist, that argument remains unexpanded. 
  84. */
  85. #define _CRT0_FLAG_DISALLOW_RESPONSE_FILES    0x0010
  86.  
  87. /* If set, fill sbrk()'d memory with a constant value.  If not, memory
  88. ** gets whatever happens to have been in there, which breaks some
  89. ** applications.
  90. */
  91. #define _CRT0_FLAG_FILL_SBRK_MEMORY        0x0020
  92.  
  93. /* If set, fill memory (above) with 0xdeadbeef, else fill with zero.
  94. ** This is especially useful for debugging uninitialized memory problems.
  95. */
  96. #define _CRT0_FLAG_FILL_DEADBEEF        0x0040
  97.  
  98. /* If set, set DS limit to 4GB which allows use of near pointers to DOS
  99. ** (and other) memory.  WARNING, disables memory protection and bad pointers
  100. ** may crash the machine or wipe out your data.
  101. */
  102. #define _CRT0_FLAG_NEARPTR            0x0080
  103.  
  104. /* If set, disable NULL pointer protection (if it can be controlled at all).
  105. */
  106. #define _CRT0_FLAG_NULLOK            0x0100
  107.  
  108. /* If set, enabled capture of NMI in exception code.  This may cause problems
  109. ** with laptops and "green" boxes which use it to wake up.  Default is to 
  110. ** leave NMIs alone and pass through to real mode code.  You decide.
  111. */
  112. #define _CRT0_FLAG_NMI_SIGNAL            0x0200
  113.  
  114. /* If set, disable usage of long file name functions even on systems
  115. ** (such as Win95) which support them.  This might be needed to work
  116. ** around program assumptions on file name format on programs written
  117. ** specifically for DOS.
  118. */
  119. #define _CRT0_FLAG_NO_LFN            0x0400
  120.  
  121. /* If set, chooses an sbrk() algorithm.  If your code requires one type
  122. ** or the other, set the value (since the default may change).  The non-move
  123. ** sbrk makes sure the base of CS/DS/SS does not change.  Each new sbrk() 
  124. ** allocation is put in a different DPMI memory block.  This works best with
  125. ** DOS programs which would like to use near pointers or hardware interrupts.
  126. ** The unix sbrk resizes a single memory block, so programs making assumptions
  127. ** about unix-like sbrk behavior may run better with this choice.
  128. */
  129. #define _CRT0_FLAG_NONMOVE_SBRK            0x0000        /* Default */
  130. #define _CRT0_FLAG_UNIX_SBRK            0x0800
  131.  
  132. /* If set, locks all memory as it is allocated.  This effectively disables
  133. ** virtual memory, and may be useful if using extensive hardware interrupt
  134. ** codes in a relatively small image size.  The memory is locked after it
  135. ** is sbrk()ed, so the locking may fail.  This bit may be set or cleared
  136. ** during execution.  When sbrk() uses multiple memory zones, it can be
  137. ** difficult to lock all memory since the memory block size and location is
  138. ** impossible to determine.
  139. */
  140.  
  141. #define _CRT0_FLAG_LOCK_MEMORY            0x1000
  142.  
  143. /* If set, disables all filename letter-case conversion in functions that
  144. ** traverse directories (except findfirst/findnext which always return the
  145. ** filenames exactly as found in the directory entry).  When reset, all
  146. ** filenames on 8+3 MSDOS filesystems and DOS-style 8+3 filenames on LFN
  147. ** systems are converted to lower-case by functions such as `readdir',
  148. ** `getcwd', `_fixpath' and `srchpath'.  Note that when this flag is set,
  149. ** ALL filenames on MSDOS systems will appear in upper-case, which is
  150. ** both ugly and will break many Unix-born programs.  Use only if you know
  151. ** exactly what you are doing!
  152. */
  153.  
  154. #define _CRT0_FLAG_PRESERVE_FILENAME_CASE    0x2000
  155.  
  156. /*****************************************************************************\
  157.  *  Access to the memory handles used by the non-move sbrk algorithm.  
  158.  *  The handle is the SI:DI DPMI handle; the address is the offset relative 
  159.  *  to the application's address space.  Address will be zero unused slots > 1.
  160. \*****************************************************************************/
  161.  
  162. typedef struct {
  163.   long handle;
  164.   unsigned address;
  165.   } __djgpp_sbrk_handle;
  166.  
  167. extern __djgpp_sbrk_handle __djgpp_memory_handle_list[256];
  168. __djgpp_sbrk_handle *__djgpp_memory_handle(unsigned address);
  169.  
  170. #endif /* !_POSIX_SOURCE */
  171. #endif /* !__STRICT_ANSI__ */
  172. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  173.  
  174. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  175. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  176.  
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180.  
  181. #endif /* !__dj_include_crt0_h_ */
  182.