home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / PROCESS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  9.8 KB  |  328 lines

  1. #if !defined(__TOPLEVEL_NEXT_COMMON_INCLUDE__)
  2. #define __TOPLEVEL_NEXT_COMMON_INCLUDE__
  3. #define __TOPLEVEL_PROCESS_H_ 
  4. #include <next_common_defines.h>
  5. #endif /* __TOPLEVEL_NEXT_COMMON_INCLUDE__ */
  6.  
  7. /***
  8. *process.h - definition and declarations for process control functions
  9. *
  10. *    Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved.
  11. *
  12. *Purpose:
  13. *    This file defines the modeflag values for spawnxx calls.
  14. *    Also contains the function argument declarations for all
  15. *    process control related routines.
  16. *
  17. *       [Public]
  18. *
  19. ****/
  20.  
  21. #if _MSC_VER > 1000
  22. #pragma once
  23. #endif
  24.  
  25. #ifndef _INC_PROCESS
  26. #define _INC_PROCESS
  27.  
  28. #if !defined(_WIN32) && !defined(_MAC)
  29. #error ERROR: Only Mac or Win32 targets supported!
  30. #endif
  31.  
  32.  
  33. #ifndef _POSIX_
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39.  
  40. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  41.  
  42. #ifndef _CRTAPI1
  43. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  44. #define _CRTAPI1 __cdecl
  45. #else
  46. #define _CRTAPI1
  47. #endif
  48. #endif
  49.  
  50.  
  51. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  52.  
  53. #ifndef _CRTAPI2
  54. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  55. #define _CRTAPI2 __cdecl
  56. #else
  57. #define _CRTAPI2
  58. #endif
  59. #endif
  60.  
  61.  
  62. /* Define _CRTIMP */
  63.  
  64. #ifndef _CRTIMP
  65. #ifdef    _NTSDK
  66. /* definition compatible with NT SDK */
  67. #define _CRTIMP
  68. #else    /* ndef _NTSDK */
  69. /* current definition */
  70. #ifdef    _DLL
  71. #define _CRTIMP __declspec(dllimport)
  72. #else    /* ndef _DLL */
  73. #define _CRTIMP
  74. #endif    /* _DLL */
  75. #endif    /* _NTSDK */
  76. #endif    /* _CRTIMP */
  77.  
  78.  
  79. /* Define __cdecl for non-Microsoft compilers */
  80.  
  81. #if    ( !defined(_MSC_VER) && !defined(__cdecl) )
  82. #define __cdecl
  83. #endif
  84.  
  85.  
  86. #ifndef _MAC
  87. #ifndef _WCHAR_T_DEFINED
  88. typedef unsigned short wchar_t;
  89. #define _WCHAR_T_DEFINED
  90. #endif
  91. #endif /* ndef _MAC */
  92.  
  93.  
  94. /* modeflag values for _spawnxx routines */
  95.  
  96. #ifndef _MAC
  97.  
  98. #define _P_WAIT     0
  99. #define _P_NOWAIT    1
  100. #define _OLD_P_OVERLAY    2
  101. #define _P_NOWAITO    3
  102. #define _P_DETACH    4
  103.  
  104. #ifdef _MT
  105. #define _P_OVERLAY    2
  106. #else
  107. extern int _p_overlay;
  108. #define _P_OVERLAY    _p_overlay
  109. #endif    /* _MT */
  110.  
  111. /* Action codes for _cwait(). The action code argument to _cwait is ignored
  112.    on Win32 though it is accepted for compatibilty with old MS CRT libs */
  113. #define _WAIT_CHILD     0
  114. #define _WAIT_GRANDCHILD 1
  115.  
  116. #else /* ndef _MAC */
  117.  
  118. #define _P_NOWAIT    1
  119. #define _P_OVERLAY    2
  120.  
  121. #endif /* ndef _MAC */
  122.  
  123.  
  124. /* function prototypes */
  125.  
  126. #ifdef    _MT
  127. _CRTIMP unsigned long  __cdecl _beginthread (void (__cdecl *) (void *),
  128.     unsigned, void *);
  129. _CRTIMP void __cdecl _endthread(void);
  130. #ifdef __GNUC__
  131. _CRTIMP unsigned long __cdecl _beginthreadex(void *, unsigned,
  132.     unsigned (*) (void *), void *, unsigned, unsigned *);
  133. #else
  134. _CRTIMP unsigned long __cdecl _beginthreadex(void *, unsigned,
  135.     unsigned (__stdcall *) (void *), void *, unsigned, unsigned *);
  136. #endif
  137. _CRTIMP void __cdecl _endthreadex(unsigned);
  138. #endif
  139.  
  140. _CRTIMP void __cdecl abort(void);
  141. _CRTIMP void __cdecl _cexit(void);
  142. _CRTIMP void __cdecl _c_exit(void);
  143. _CRTIMP void __cdecl exit(int);
  144. _CRTIMP void __cdecl _exit(int);
  145. _CRTIMP int __cdecl _getpid(void);
  146.  
  147. #ifndef _MAC
  148.  
  149. _CRTIMP int __cdecl _cwait(int *, int, int);
  150. _CRTIMP int __cdecl _execl(const char *, const char *, ...);
  151. _CRTIMP int __cdecl _execle(const char *, const char *, ...);
  152. _CRTIMP int __cdecl _execlp(const char *, const char *, ...);
  153. _CRTIMP int __cdecl _execlpe(const char *, const char *, ...);
  154. _CRTIMP int __cdecl _execv(const char *, const char * const *);
  155. _CRTIMP int __cdecl _execve(const char *, const char * const *, const char * const *);
  156. _CRTIMP int __cdecl _execvp(const char *, const char * const *);
  157. _CRTIMP int __cdecl _execvpe(const char *, const char * const *, const char * const *);
  158. _CRTIMP int __cdecl _spawnl(int, const char *, const char *, ...);
  159. _CRTIMP int __cdecl _spawnle(int, const char *, const char *, ...);
  160. _CRTIMP int __cdecl _spawnlp(int, const char *, const char *, ...);
  161. _CRTIMP int __cdecl _spawnlpe(int, const char *, const char *, ...);
  162. _CRTIMP int __cdecl _spawnv(int, const char *, const char * const *);
  163. _CRTIMP int __cdecl _spawnve(int, const char *, const char * const *,
  164.     const char * const *);
  165. _CRTIMP int __cdecl _spawnvp(int, const char *, const char * const *);
  166. _CRTIMP int __cdecl _spawnvpe(int, const char *, const char * const *,
  167.     const char * const *);
  168. _CRTIMP int __cdecl system(const char *);
  169.  
  170. #else /* ndef _MAC */
  171.  
  172. _CRTIMP int __cdecl _spawn(int, const char *);
  173.  
  174. #endif /* ndef _MAC */
  175.  
  176. #ifndef _MAC
  177. #ifndef _WPROCESS_DEFINED
  178. /* wide function prototypes, also declared in wchar.h  */
  179. _CRTIMP int __cdecl _wexecl(const wchar_t *, const wchar_t *, ...);
  180. _CRTIMP int __cdecl _wexecle(const wchar_t *, const wchar_t *, ...);
  181. _CRTIMP int __cdecl _wexeclp(const wchar_t *, const wchar_t *, ...);
  182. _CRTIMP int __cdecl _wexeclpe(const wchar_t *, const wchar_t *, ...);
  183. _CRTIMP int __cdecl _wexecv(const wchar_t *, const wchar_t * const *);
  184. _CRTIMP int __cdecl _wexecve(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
  185. _CRTIMP int __cdecl _wexecvp(const wchar_t *, const wchar_t * const *);
  186. _CRTIMP int __cdecl _wexecvpe(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
  187. _CRTIMP int __cdecl _wspawnl(int, const wchar_t *, const wchar_t *, ...);
  188. _CRTIMP int __cdecl _wspawnle(int, const wchar_t *, const wchar_t *, ...);
  189. _CRTIMP int __cdecl _wspawnlp(int, const wchar_t *, const wchar_t *, ...);
  190. _CRTIMP int __cdecl _wspawnlpe(int, const wchar_t *, const wchar_t *, ...);
  191. _CRTIMP int __cdecl _wspawnv(int, const wchar_t *, const wchar_t * const *);
  192. _CRTIMP int __cdecl _wspawnve(int, const wchar_t *, const wchar_t * const *,
  193.     const wchar_t * const *);
  194. _CRTIMP int __cdecl _wspawnvp(int, const wchar_t *, const wchar_t * const *);
  195. _CRTIMP int __cdecl _wspawnvpe(int, const wchar_t *, const wchar_t * const *,
  196.     const wchar_t * const *);
  197. _CRTIMP int __cdecl _wsystem(const wchar_t *);
  198.  
  199. #define _WPROCESS_DEFINED
  200. #endif
  201.  
  202. /* --------- The following functions are OBSOLETE --------- */
  203. /*
  204.  * The Win32 API LoadLibrary, FreeLibrary and GetProcAddress should be used
  205.  * instead.
  206.  */
  207. int __cdecl _loaddll(char *);
  208. int __cdecl _unloaddll(int);
  209. int (__cdecl * __cdecl _getdllprocaddr(int, char *, int))();
  210. /* --------- The preceding functions are OBSOLETE --------- */
  211.  
  212.  
  213. #ifdef    _DECL_DLLMAIN
  214. /*
  215.  * Declare DLL notification (initialization/termination) routines
  216.  *    The preferred method is for the user to provide DllMain() which will
  217.  *    be called automatically by the DLL entry point defined by the C run-
  218.  *    time library code.  If the user wants to define the DLL entry point
  219.  *    routine, the user's entry point must call _CRT_INIT on all types of
  220.  *    notifications, as the very first thing on attach notifications and
  221.  *    as the very last thing on detach notifications.
  222.  */
  223. #ifdef    _WINDOWS_    /* Use types from WINDOWS.H */
  224. BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
  225. BOOL WINAPI _CRT_INIT(HANDLE, DWORD, LPVOID);
  226. BOOL WINAPI _wCRT_INIT(HANDLE, DWORD, LPVOID);
  227. extern BOOL (WINAPI *_pRawDllMain)(HANDLE, DWORD, LPVOID);
  228. #else
  229. int __stdcall DllMain(void *, unsigned, void *);
  230. int __stdcall _CRT_INIT(void *, unsigned, void *);
  231. int __stdcall _wCRT_INIT(void *, unsigned, void *);
  232. extern int (__stdcall *_pRawDllMain)(void *, unsigned, void *);
  233. #endif    /* _WINDOWS_ */
  234. #endif
  235. #endif /* ndef _MAC */
  236.  
  237. #if    !__STDC__
  238.  
  239. /* Non-ANSI names for compatibility */
  240.  
  241.  
  242. #ifndef _MAC
  243.  
  244. #define P_WAIT        _P_WAIT
  245. #define P_NOWAIT    _P_NOWAIT
  246. #define P_OVERLAY    _P_OVERLAY
  247. #define OLD_P_OVERLAY    _OLD_P_OVERLAY
  248. #define P_NOWAITO    _P_NOWAITO
  249. #define P_DETACH    _P_DETACH
  250. #define WAIT_CHILD    _WAIT_CHILD
  251. #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
  252.  
  253. #else /* ndef _MAC */
  254.  
  255. #define P_NOWAIT    _P_NOWAIT
  256. #define P_OVERLAY    _P_OVERLAY
  257.  
  258. #endif /* ndef _MAC */
  259.  
  260. #ifdef    _NTSDK
  261.  
  262. /* definitions compatible with NT SDK */
  263. #define cwait     _cwait
  264. #define execl     _execl
  265. #define execle     _execle
  266. #define execlp     _execlp
  267. #define execlpe  _execlpe
  268. #define execv     _execv
  269. #define execve     _execve
  270. #define execvp     _execvp
  271. #define execvpe  _execvpe
  272. #define getpid     _getpid
  273. #define spawnl     _spawnl
  274. #define spawnle  _spawnle
  275. #define spawnlp  _spawnlp
  276. #define spawnlpe _spawnlpe
  277. #define spawnv     _spawnv
  278. #define spawnve  _spawnve
  279. #define spawnvp  _spawnvp
  280. #define spawnvpe _spawnvpe
  281.  
  282. #else    /* ndef _NTSDK */
  283.  
  284. #ifndef _MAC
  285.  
  286. /* current declarations */
  287. _CRTIMP int __cdecl cwait(int *, int, int);
  288. _CRTIMP int __cdecl execl(const char *, const char *, ...);
  289. _CRTIMP int __cdecl execle(const char *, const char *, ...);
  290. _CRTIMP int __cdecl execlp(const char *, const char *, ...);
  291. _CRTIMP int __cdecl execlpe(const char *, const char *, ...);
  292. _CRTIMP int __cdecl execv(const char *, const char * const *);
  293. _CRTIMP int __cdecl execve(const char *, const char * const *, const char * const *);
  294. _CRTIMP int __cdecl execvp(const char *, const char * const *);
  295. _CRTIMP int __cdecl execvpe(const char *, const char * const *, const char * const *);
  296. _CRTIMP int __cdecl spawnl(int, const char *, const char *, ...);
  297. _CRTIMP int __cdecl spawnle(int, const char *, const char *, ...);
  298. _CRTIMP int __cdecl spawnlp(int, const char *, const char *, ...);
  299. _CRTIMP int __cdecl spawnlpe(int, const char *, const char *, ...);
  300. _CRTIMP int __cdecl spawnv(int, const char *, const char * const *);
  301. _CRTIMP int __cdecl spawnve(int, const char *, const char * const *,
  302.     const char * const *);
  303. _CRTIMP int __cdecl spawnvp(int, const char *, const char * const *);
  304. _CRTIMP int __cdecl spawnvpe(int, const char *, const char * const *,
  305.     const char * const *);
  306.  
  307. #endif /* ndef _MAC */
  308.  
  309. _CRTIMP int __cdecl getpid(void);
  310.  
  311. #endif    /* _NTSDK */
  312.  
  313. #endif    /* __STDC__ */
  314.  
  315. #ifdef __cplusplus
  316. }
  317. #endif
  318.  
  319. #endif    /* _POSIX_ */
  320.  
  321. #endif    /* _INC_PROCESS */
  322.  
  323. #if defined(__TOPLEVEL_PROCESS_H_)
  324. #undef __TOPLEVEL_NEXT_COMMON_INCLUDE__
  325. #undef __TOPLEVEL_PROCESS_H_
  326. #include <next_common_undefines.h>
  327. #endif /* __TOPLEVEL_PROCESS_H_ */
  328.