X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fnt.h;h=60e6efd243ed76bc32516689739547bc92f354d2;hb=f0e0a4c7571df85198f5dab18d97dcb71f2971a5;hp=89798e3c20317cb8a1a9b93f06291f5b3ee44e8e;hpb=976b002b16336930724ae22476014583ad022e7d;p=chise%2Fxemacs-chise.git.1 diff --git a/src/nt.h b/src/nt.h index 89798e3..60e6efd 100644 --- a/src/nt.h +++ b/src/nt.h @@ -1,6 +1,3 @@ -#ifndef _NT_H_ -#define _NT_H_ - /* Support routines for the NT version of XEmacs. Copyright (C) 1994 Free Software Foundation, Inc. @@ -26,55 +23,18 @@ Boston, MA 02111-1307, USA. */ /* #define FULL_DEBUG */ +#ifndef INCLUDED_nt_h_ +#define INCLUDED_nt_h_ + +#include "syswindows.h" +#include "systime.h" /* because of struct utimbuf below */ + #ifdef DEBUG_XEMACS #define DebPrint(stuff) _DebPrint stuff #else #define DebPrint(stuff) #endif -#define R_OK 4 -#define W_OK 2 -#ifdef X_OK -#undef X_OK -#endif -#define X_OK 1 -#define F_OK 0 - -/* File descriptor set emulation. */ - -#if 0 /* These are defined in winsock.h. - FD_SETSIZE is defined 64. Let's not full the runtime. */ - -/* The MSVC multithreaded statically-linked runtime library has limit - of 256 descriptors by default (the single-threaded static library - has a limit of 64 descriptors, and the DLL versions both have a - limit of 512). Beware. Should this be set to 512? */ -#define FD_SETSIZE 256 -typedef struct { - unsigned int bits[FD_SETSIZE / 32]; -} fd_set; - -/* standard access macros */ -#define FD_SET(n, p) \ - do { \ - if ((n) < FD_SETSIZE) { \ - (p)->bits[(n)/32] |= (1 << (n)%32); \ - } \ - } while (0) -#define FD_CLR(n, p) \ - do { \ - if ((n) < FD_SETSIZE) { \ - (p)->bits[(n)/32] &= ~(1 << (n)%32); \ - } \ - } while (0) -#define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0) -#define FD_ZERO(p) memset((p), 0, sizeof(fd_set)) - -#define SELECT_TYPE fd_set -#define MAXDESC FD_SETSIZE - -#endif /* 0 */ - /* ------------------------------------------------------------------------- */ /* child_process.status values */ @@ -113,7 +73,7 @@ typedef struct child_process * cp; } filedesc; -extern filedesc fd_info [ MAXDESC ]; +extern filedesc fd_info []; /* fd_info flag definitions */ #define FILE_READ 0x0001 @@ -146,8 +106,47 @@ extern LPBYTE nt_get_resource (char * key, LPDWORD type); void set_process_dir (const char * dir); time_t convert_time (FILETIME ft); +int mswindows_utime (Lisp_Object path, struct utimbuf *times); + +extern void init_ntproc (void); +extern void term_ntproc (int unused); + +/* ----------------------------------------------------------------- */ +/* Useful routines for manipulating memory-mapped files. */ + +typedef struct file_data +{ + const char *name; + unsigned long size; + HANDLE file; + HANDLE file_mapping; + char *file_base; +} file_data; + +#define OFFSET_TO_RVA(var,section) \ + (section->VirtualAddress + ((DWORD)(var) - section->PointerToRawData)) + +#define RVA_TO_OFFSET(var,section) \ + (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress)) + +#define RVA_TO_PTR(var,section,filedata) \ + ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base)) + +int open_input_file (file_data *p_file, const char *name); +int open_output_file (file_data *p_file, const char *name, unsigned long size); +void close_file_data (file_data *p_file); +void mswindows_executable_type (const char * filename, int * is_dos_app, + int * is_cygnus_app); + +/* In process-nt.c */ +extern int compare_env (const void *strp1, const void *strp2); + +void mswindows_set_errno (unsigned long win32_error); +void mswindows_set_last_errno (void); + +void wait_for_termination (HANDLE pid); -extern void init_ntproc (); -extern void term_ntproc (); +int mswindows_fstat (int handle, struct stat *buffer); +int mswindows_stat (const char * path, struct stat * buf); -#endif /* _NT_H_ */ +#endif /* INCLUDED_nt_h_ */