From f2c4ddb44dacaa3540260e2538096ee8c2485d8a Mon Sep 17 00:00:00 2001 From: mainzelm Date: Thu, 1 May 2003 18:11:48 +0000 Subject: [PATCH] Merged contents of time_dep1.c into time1.c. There was nothing OS-specific left. --- Makefile.in | 1 - scsh/aix/time_dep1.c | 39 --------------------------------------- scsh/cygwin32/time_dep1.c | 39 --------------------------------------- scsh/generic/time_dep1.c | 39 --------------------------------------- scsh/hpux/time_dep1.c | 39 --------------------------------------- scsh/irix/time_dep1.c | 39 --------------------------------------- scsh/linux/time_dep1.c | 39 --------------------------------------- scsh/next/time_dep1.c | 39 --------------------------------------- scsh/solaris/time_dep1.c | 39 --------------------------------------- scsh/sunos/time_dep1.c | 39 --------------------------------------- scsh/time1.c | 31 +++++++++++++++++++++++++++++++ scsh/ultrix/time_dep1.c | 39 --------------------------------------- 12 files changed, 31 insertions(+), 391 deletions(-) delete mode 100644 scsh/aix/time_dep1.c delete mode 100644 scsh/cygwin32/time_dep1.c delete mode 100644 scsh/generic/time_dep1.c delete mode 100644 scsh/hpux/time_dep1.c delete mode 100644 scsh/irix/time_dep1.c delete mode 100644 scsh/linux/time_dep1.c delete mode 100644 scsh/next/time_dep1.c delete mode 100644 scsh/solaris/time_dep1.c delete mode 100644 scsh/sunos/time_dep1.c delete mode 100644 scsh/ultrix/time_dep1.c diff --git a/Makefile.in b/Makefile.in index d16cb4f..ae56531 100644 --- a/Makefile.in +++ b/Makefile.in @@ -119,7 +119,6 @@ SCSHOBJS = \ scsh/dirstuff1.o \ scsh/fdports1.o \ scsh/flock1.o \ - scsh/machine/time_dep1.o \ scsh/signals1.o \ scsh/machine/libansi.o \ scsh/network1.o \ diff --git a/scsh/aix/time_dep1.c b/scsh/aix/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/aix/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/cygwin32/time_dep1.c b/scsh/cygwin32/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/cygwin32/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/generic/time_dep1.c b/scsh/generic/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/generic/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/hpux/time_dep1.c b/scsh/hpux/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/hpux/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/irix/time_dep1.c b/scsh/irix/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/irix/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/linux/time_dep1.c b/scsh/linux/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/linux/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/next/time_dep1.c b/scsh/next/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/next/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/solaris/time_dep1.c b/scsh/solaris/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/solaris/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/sunos/time_dep1.c b/scsh/sunos/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/sunos/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -} diff --git a/scsh/time1.c b/scsh/time1.c index d9798fd..c2dbadd 100644 --- a/scsh/time1.c +++ b/scsh/time1.c @@ -38,6 +38,7 @@ */ #include +#include #include #include #include @@ -451,6 +452,36 @@ char *tzname_loser(struct tm *dp) ** localtime() & gmtime() don't error. */ +/* Support for fine-grained timer. +** This used to be OS-dependent but the code below works on all systems +*/ + +s48_value time_plus_ticks() +{ + struct timeval t; + struct timezone tz; + s48_value sch_tv_sec = S48_UNSPECIFIC; + s48_value sch_tv_usec = S48_UNSPECIFIC; + s48_value sch_listval = S48_UNSPECIFIC; + s48_value sch_retval = S48_UNSPECIFIC; + S48_DECLARE_GC_PROTECT(3); + + S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); + + if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); + + + sch_tv_sec = s48_enter_integer(t.tv_sec); + sch_tv_usec = s48_enter_integer(t.tv_usec); + sch_listval = s48_cons (sch_tv_usec, S48_NULL); + sch_retval = s48_cons (sch_tv_sec, sch_listval); + + S48_GC_UNPROTECT(); + + return sch_retval; + +} + void s48_init_time(void) { S48_EXPORT_FUNCTION(time_plus_ticks); diff --git a/scsh/ultrix/time_dep1.c b/scsh/ultrix/time_dep1.c deleted file mode 100644 index 87be152..0000000 --- a/scsh/ultrix/time_dep1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* OS-dependent support for fine-grained timer. -** Copyright (c) 1995 by Olin Shivers. -** -** We return the current time in seconds and sub-second "ticks" where the -** number of ticks/second is OS dependent (and is defined in time_dep.scm). -** This definition works on any BSD Unix with the gettimeofday() -** microsecond-resolution timer. -*/ - -#include -#include -#include "scheme48.h" -#include "../time1.h" - -s48_value time_plus_ticks() -{ - struct timeval t; - struct timezone tz; - s48_value sch_tv_sec = S48_UNSPECIFIC; - s48_value sch_tv_usec = S48_UNSPECIFIC; - s48_value sch_listval = S48_UNSPECIFIC; - s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(3); - - S48_GC_PROTECT_3(sch_tv_sec, sch_tv_usec, sch_listval); - - if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno); - - - sch_tv_sec = s48_enter_integer(t.tv_sec); - sch_tv_usec = s48_enter_integer(t.tv_usec); - sch_listval = s48_cons (sch_tv_usec, S48_NULL); - sch_retval = s48_cons (sch_tv_sec, sch_listval); - - S48_GC_UNPROTECT(); - - return sch_retval; - -}