[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.5,1.6 dir.c,1.7,1.8
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.5,1.6 dir.c,1.7,1.8 filemap.c,1.3,1.4 regexp.c,1.3,1.4 socket.c,1.6,1.7 spawn.c,1.4,1.5 test_float.c,1.4,1.5 time.c,1.5,1.6 |
Date: |
Fri, 13 Dec 2002 06:24:51 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv9148/support
Modified Files:
cmdline.c dir.c filemap.c regexp.c socket.c spawn.c
test_float.c time.c
Log Message:
Apply changes to compile in non-cygwin modes under Win32.
Index: cmdline.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/cmdline.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** cmdline.c 13 Dec 2002 05:04:25 -0000 1.5
--- cmdline.c 13 Dec 2002 11:24:47 -0000 1.6
***************
*** 344,348 ****
}
! #ifndef IL_NATIVE_WIN32
/*
--- 344,348 ----
}
! #ifndef IL_WIN32_NATIVE
/*
***************
*** 474,478 ****
}
! #else /* IL_NATIVE_WIN32 */
void ILCmdLineExpand(int *argc, char ***argv)
--- 474,478 ----
}
! #else /* IL_WIN32_NATIVE */
void ILCmdLineExpand(int *argc, char ***argv)
***************
*** 486,489 ****
--- 486,491 ----
*/
+ #if !defined(__MINGW32__)
+
void __cdecl _setargv(void)
{
***************
*** 492,496 ****
}
! #endif
#ifdef __cplusplus
--- 494,500 ----
}
! #endif /* !__MINGW32__ */
!
! #endif /* IL_WIN32_NATIVE */
#ifdef __cplusplus
Index: dir.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/dir.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** dir.c 1 Dec 2002 09:56:03 -0000 1.7
--- dir.c 13 Dec 2002 11:24:47 -0000 1.8
***************
*** 39,43 ****
#include <dirent.h>
#endif
! #ifdef _WIN32
#include <windows.h>
#include <io.h>
--- 39,43 ----
#include <dirent.h>
#endif
! #ifdef IL_WIN32_NATIVE
#include <windows.h>
#include <io.h>
***************
*** 48,52 ****
extern "C" {
#endif
!
ILInt32 ILDeleteDir(const char *path)
{
--- 48,56 ----
extern "C" {
#endif
!
! #ifdef IL_WIN32_NATIVE
! #define USE_WIN32_FIND 1
! #endif
!
ILInt32 ILDeleteDir(const char *path)
{
***************
*** 79,82 ****
--- 83,88 ----
}
+ #ifndef USE_WIN32_FIND
+
#ifdef HAVE_DIRENT_H
***************
*** 115,119 ****
--- 121,129 ----
strcat(fullName, "/");
strcat(fullName, entry->dptr->d_name);
+ #ifdef HAVE_LSTAT
if(lstat(fullName, &st) >= 0)
+ #else
+ if(stat(fullName, &st) >= 0)
+ #endif
{
#ifdef S_ISFIFO
***************
*** 284,287 ****
--- 294,388 ----
#endif
}
+
+ #else /* USE_WIN32_FIND */
+
+ /*
+ * Define the ILDir type.
+ */
+ struct _tagILDir
+ {
+ long handle;
+ struct _finddata_t fileinfo;
+ int havefirst;
+ };
+
+ /*
+ * Define the ILDirEnt type.
+ */
+ struct _tagILDirEnt
+ {
+ unsigned attrib;
+ char name[1];
+ };
+
+ ILDir *ILOpenDir(char *path)
+ {
+ ILDir *dir = (ILDir *)ILMalloc(sizeof(ILDir));
+ if(!dir)
+ {
+ return 0;
+ }
+ dir->handle = _findfirst(path, &(dir->fileinfo));
+ dir->havefirst = 1;
+ if(dir->handle < 0)
+ {
+ int error = errno;
+ ILFree(dir);
+ errno = error;
+ return 0;
+ }
+ return dir;
+ }
+
+ ILDirEnt *ILReadDir(ILDir *dir)
+ {
+ ILDirEnt *entry;
+ if(!(dir->havefirst))
+ {
+ if(_findnext(dir->handle, &(dir->fileinfo)) < 0)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ dir->havefirst = 0;
+ }
+ entry = (ILDirEnt *)ILMalloc(sizeof(ILDirEnt) +
strlen(dir->fileinfo.name));
+ if(!entry)
+ {
+ return 0;
+ }
+ entry->attrib = dir->fileinfo.attrib;
+ strcpy(entry->name, dir->fileinfo.name);
+ return entry;
+ }
+
+ int ILCloseDir(ILDir *dir)
+ {
+ _findclose(dir->handle);
+ ILFree(dir);
+ return 0;
+ }
+
+ const char *ILDirEntName(ILDirEnt *entry)
+ {
+ return entry->name;
+ }
+
+
+ int ILDirEntType(ILDirEnt *entry)
+ {
+ if((entry->attrib & _A_SUBDIR) != 0)
+ {
+ return ILFileType_DIR;
+ }
+ else
+ {
+ return ILFileType_REG;
+ }
+ }
+
+ #endif /* USE_WIN32_FIND */
#ifdef __cplusplus
Index: filemap.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/filemap.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** filemap.c 12 Jun 2002 07:27:08 -0000 1.3
--- filemap.c 13 Dec 2002 11:24:47 -0000 1.4
***************
*** 76,80 ****
--- 76,84 ----
/* Get the underlying OS handle for the fd */
+ #ifdef IL_WIN32_CYGWIN
osHandle = (HANDLE)get_osfhandle(fd);
+ #else
+ osHandle = (HANDLE)_get_osfhandle(fd);
+ #endif
if(osHandle == (HANDLE)INVALID_HANDLE_VALUE)
{
Index: regexp.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/regexp.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** regexp.c 13 Dec 2002 04:43:42 -0000 1.3
--- regexp.c 13 Dec 2002 11:24:47 -0000 1.4
***************
*** 110,114 ****
--- 110,116 ----
regfree((regex_t*)(handle));
#else
+ #ifdef HAVE_REGEX_H
ILFree((regex_t*)(handle)); /* attempt a normal free */
+ #endif
#endif
}
Index: socket.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/socket.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** socket.c 1 Jul 2002 13:43:24 -0000 1.6
--- socket.c 13 Dec 2002 11:24:47 -0000 1.7
***************
*** 46,49 ****
--- 46,52 ----
#endif
#include <errno.h>
+ #ifdef IL_WIN32_NATIVE
+ #include <winsock.h>
+ #endif
#ifdef __cplusplus
***************
*** 175,180 ****
int highest = -1;
int fd, result;
! struct timeval currtime;
! struct timeval endtime;
struct timeval difftime;
ILInt32 index;
--- 178,183 ----
int highest = -1;
int fd, result;
! ILCurrTime currtime;
! ILCurrTime endtime;
struct timeval difftime;
ILInt32 index;
***************
*** 253,263 ****
{
/* Get the current time of day and determine the end time */
! gettimeofday(&currtime, 0);
! endtime.tv_sec = currtime.tv_sec + (long)(timeout /
(ILInt64)1000000);
! endtime.tv_usec = currtime.tv_usec + (long)(timeout %
(ILInt64)1000000);
! if(endtime.tv_usec >= 1000000L)
{
! ++(endtime.tv_sec);
! endtime.tv_usec -= 1000000L;
}
--- 256,267 ----
{
/* Get the current time of day and determine the end time */
! ILGetCurrTime(&currtime);
! endtime.secs = currtime.secs + (long)(timeout /
(ILInt64)1000000);
! endtime.nsecs = currtime.nsecs +
! (long)((timeout % (ILInt64)1000000) * (ILInt64)1000);
! if(endtime.nsecs >= 1000000000L)
{
! ++(endtime.secs);
! endtime.nsecs -= 1000000000L;
}
***************
*** 266,278 ****
{
/* How long until the timeout? */
! difftime.tv_sec = endtime.tv_sec - currtime.tv_sec;
! if(endtime.tv_usec >= currtime.tv_usec)
{
! difftime.tv_usec = endtime.tv_usec -
currtime.tv_usec;
}
else
{
! difftime.tv_usec = endtime.tv_usec + 1000000L -
!
currtime.tv_usec;
difftime.tv_sec -= 1;
}
--- 270,283 ----
{
/* How long until the timeout? */
! difftime.tv_sec = (time_t)(endtime.secs -
currtime.secs);
! if(endtime.nsecs >= currtime.nsecs)
{
! difftime.tv_usec =
! (long)((endtime.nsecs - currtime.nsecs)
/ 1000);
}
else
{
! difftime.tv_usec =
! (endtime.nsecs + 1000000000L -
currtime.nsecs) / 1000;
difftime.tv_sec -= 1;
}
***************
*** 290,299 ****
the 5th paramter of "select" to reflect how much time
is left to go */
! gettimeofday(&currtime, 0);
/* Are we past the end time? */
! if(currtime.tv_sec > endtime.tv_sec ||
! (currtime.tv_sec == endtime.tv_sec &&
! currtime.tv_usec >= endtime.tv_usec))
{
/* We are, so simulate timeout */
--- 295,304 ----
the 5th paramter of "select" to reflect how much time
is left to go */
! ILGetCurrTime(&currtime);
/* Are we past the end time? */
! if(currtime.secs > endtime.secs ||
! (currtime.secs == endtime.secs &&
! currtime.nsecs >= endtime.nsecs))
{
/* We are, so simulate timeout */
Index: spawn.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/spawn.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** spawn.c 20 Nov 2002 22:19:59 -0000 1.4
--- spawn.c 13 Dec 2002 11:24:47 -0000 1.5
***************
*** 168,172 ****
/* Spawn the child process and wait for it to exit */
! status = spawnvp(_P_WAIT, argv[0], (const char * const *)argv);
/* Delete the temporary option file */
--- 168,172 ----
/* Spawn the child process and wait for it to exit */
! status = spawnvp(_P_WAIT, argv[0], (char * const *)argv);
/* Delete the temporary option file */
Index: test_float.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/test_float.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_float.c 9 Dec 2002 08:59:01 -0000 1.4
--- test_float.c 13 Dec 2002 11:24:47 -0000 1.5
***************
*** 26,32 ****
#include <ieeefp.h>
#endif
! #ifdef IL_NATIVE_WIN32
#include <float.h>
#define isnan(value) _isnan((value))
#define HAVE_ISNAN 1
#endif
--- 26,34 ----
#include <ieeefp.h>
#endif
! #ifdef IL_WIN32_NATIVE
#include <float.h>
+ #if !defined(isnan)
#define isnan(value) _isnan((value))
+ #endif
#define HAVE_ISNAN 1
#endif
***************
*** 47,51 ****
int ILNativeFloatIsFinite(ILNativeFloat value)
{
! #ifdef hpux
return isfinite(value);
#else /* !hpux */
--- 49,53 ----
int ILNativeFloatIsFinite(ILNativeFloat value)
{
! #if defined(hpux) || defined(IL_WIN32_NATIVE)
return isfinite(value);
#else /* !hpux */
Index: time.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/time.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** time.c 6 Nov 2002 03:17:41 -0000 1.5
--- time.c 13 Dec 2002 11:24:47 -0000 1.6
***************
*** 33,36 ****
--- 33,39 ----
#include <sys/types.h>
#endif
+ #ifdef IL_WIN32_PLATFORM
+ #include <windows.h>
+ #endif
#ifdef __cplusplus
***************
*** 42,46 ****
* Jan 1, 1970 into a value which is relative to Jan 1, 0001.
*/
! #ifdef IL_NATIVE_WIN32
#define EPOCH_ADJUST ((ILInt64)62135596800LL)
#else
--- 45,49 ----
* Jan 1, 1970 into a value which is relative to Jan 1, 0001.
*/
! #ifdef IL_WIN32_NATIVE
#define EPOCH_ADJUST ((ILInt64)62135596800LL)
#else
***************
*** 48,51 ****
--- 51,64 ----
#endif
+ /*
+ * Magic number that converts a time which is relative to
+ * Jan 1, 1601 into a value which is relative to Jan 1, 0001.
+ */
+ #ifdef IL_WIN32_NATIVE
+ #define WIN32_EPOCH_ADJUST ((ILInt64)50491123200LL)
+ #else
+ #define WIN32_EPOCH_ADJUST ((ILInt64)50491123200L)
+ #endif
+
void ILGetCurrTime(ILCurrTime *timeValue)
{
***************
*** 57,63 ****
--- 70,87 ----
timeValue->nsecs = (ILUInt32)(tv.tv_usec * 1000);
#else
+ #ifdef IL_WIN32_PLATFORM
+ /* Get the time using a Win32-specific API */
+ FILETIME filetime;
+ ILInt64 value;
+ GetSystemTimeAsFileTime(&filetime);
+ value = (((ILInt64)(filetime.dwHighDateTime)) << 32) +
+ ((ILInt64)(filetime.dwLowDateTime));
+ timeValue->secs = (value / (ILInt64)10000000) + WIN32_EPOCH_ADJUST;
+ timeValue->nsecs = (ILUInt32)((value % (ILInt64)10000000) *
(ILInt64)100);
+ #else
/* Use the ANSI routine to get the time in seconds */
timeValue->secs = (ILInt64)(time(0)) + EPOCH_ADJUST;
timeValue->nsecs = 0;
+ #endif
#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.5,1.6 dir.c,1.7,1.8 filemap.c,1.3,1.4 regexp.c,1.3,1.4 socket.c,1.6,1.7 spawn.c,1.4,1.5 test_float.c,1.4,1.5 time.c,1.5,1.6,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/engine Makefile.am,1.51,1.52 lib_charinfo.c,1.1,1.2 lib_math.c,1.5,1.6 lib_socket.c,1.8,1.9
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet/include il_values.h,1.14,1.15
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/engine Makefile.am,1.51,1.52 lib_charinfo.c,1.1,1.2 lib_math.c,1.5,1.6 lib_socket.c,1.8,1.9
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet/include il_values.h,1.14,1.15
- Index(es):