Remove obselete time config defines.

Removes `USE_FTIME`, `USE_PALMTIME`, `USE_MACTIME`, `TIME_SYNTAX`.
This commit is contained in:
Sam Tobin-Hochstadt 2015-09-10 16:36:57 -04:00
parent 0d3b5b61f0
commit 17d69338a9
5 changed files with 36 additions and 124 deletions

View File

@ -37,7 +37,6 @@
# define UNIX_FILE_SYSTEM
# define NO_UNIX_USERS
# define TIME_SYNTAX
# define DIR_FUNCTION
# define DIRENT_NO_NAMLEN
# define GETENV_FUNCTION
@ -648,7 +647,6 @@
# define MKDIR_NO_MODE_FLAG
# endif
# define TIME_SYNTAX
# define USE_WIN32_TIME
# define WINDOWS_GET_PROCESS_TIMES
# define GETENV_FUNCTION
@ -1043,18 +1041,12 @@
/* Language Features */
/*********************/
/* TIME_SYNTAX adds the (time ...) syntax; this may need to be
turned off for compilation on some systems.
CLOCKS_PER_SEC relates the values returned by clock() to
/* CLOCKS_PER_SEC relates the values returned by clock() to
real seconds. (The difference between two clock() calls is
divided by this number.) Usually, this is defined in <time.h>;
it defaults to 1000000 */
/* USE_FTIME uses ftime instead of gettimeofday; only for TIME_SYNTAX */
/* USE_PLAIN_TIME uses time; only for TIME_SYNTAX */
/* USE_MACTIME uses the Mac toolbox to implement time functions. */
/* USE_PLAIN_TIME uses time. */
/* USE_WIN32_TIME uses the Win32 API to implement time functions. */

View File

@ -35,41 +35,33 @@
/* The implementations of the time primitives, such as
`current-seconds', vary a lot from platform to platform. */
#ifdef TIME_SYNTAX
# ifdef USE_WIN32_TIME
# include <Windows.h>
# else
# ifndef USE_PALMTIME
# if defined(OSKIT) && !defined(OSKIT_TEST)
/* Get FreeBSD version, not oskit/time.h version */
# include <freebsd/time.h>
# endif
# include <time.h>
# ifdef USE_FTIME
# include <sys/timeb.h>
# else
# include <sys/time.h>
# endif /* USE_FTIME */
# ifdef USE_GETRUSAGE
# include <sys/types.h>
# include <sys/time.h>
# include <sys/resource.h>
# include <errno.h>
# endif /* USE_GETRUSAGE */
# ifdef USE_SYSCALL_GETRUSAGE
# include <sys/syscall.h>
# define getrusage(a, b) syscall(SYS_GETRUSAGE, a, b)
# define USE_GETRUSAGE
# endif /* USE_SYSCALL_GETRUSAGE */
# ifdef WINDOWS_GET_PROCESS_TIMES
# include <Windows.h>
# endif
# if !defined(USE_GETRUSAGE) && !defined(WINDOWS_GET_PROCESS_TIMES) && !defined(USER_TIME_IS_CLOCK)
# include <sys/times.h>
# endif
# endif /* USE_PALMTIME */
# endif /* USE_MACTIME */
#endif /* TIME_SYNTAX */
#ifdef USE_WIN32_TIME
# include <Windows.h>
#else
# if defined(OSKIT) && !defined(OSKIT_TEST)
/* Get FreeBSD version, not oskit/time.h version */
# include <freebsd/time.h>
# endif
# include <time.h>
# include <sys/time.h>
# ifdef USE_GETRUSAGE
# include <sys/types.h>
# include <sys/time.h>
# include <sys/resource.h>
# include <errno.h>
# endif /* USE_GETRUSAGE */
# ifdef USE_SYSCALL_GETRUSAGE
# include <sys/syscall.h>
# define getrusage(a, b) syscall(SYS_GETRUSAGE, a, b)
# define USE_GETRUSAGE
# endif /* USE_SYSCALL_GETRUSAGE */
# ifdef WINDOWS_GET_PROCESS_TIMES
# include <Windows.h>
# endif
# if !defined(USE_GETRUSAGE) && !defined(WINDOWS_GET_PROCESS_TIMES) && !defined(USER_TIME_IS_CLOCK)
# include <sys/times.h>
# endif
#endif /* USE_WIN32_TIME */
static void ASSERT_SUSPEND_BREAK_ZERO() {
#if 0
@ -172,7 +164,6 @@ static Scheme_Object *call_with_immediate_cc_mark (int argc, Scheme_Object *argv
static Scheme_Object *void_func (int argc, Scheme_Object *argv[]);
static Scheme_Object *void_p (int argc, Scheme_Object *argv[]);
static Scheme_Object *dynamic_wind (int argc, Scheme_Object *argv[]);
#ifdef TIME_SYNTAX
static Scheme_Object *time_apply(int argc, Scheme_Object *argv[]);
static Scheme_Object *current_milliseconds(int argc, Scheme_Object **argv);
static Scheme_Object *current_inexact_milliseconds(int argc, Scheme_Object **argv);
@ -180,7 +171,6 @@ static Scheme_Object *current_process_milliseconds(int argc, Scheme_Object **arg
static Scheme_Object *current_gc_milliseconds(int argc, Scheme_Object **argv);
static Scheme_Object *current_seconds(int argc, Scheme_Object **argv);
static Scheme_Object *seconds_to_date(int argc, Scheme_Object **argv);
#endif
static Scheme_Object *object_name(int argc, Scheme_Object *argv[]);
static Scheme_Object *procedure_arity(int argc, Scheme_Object *argv[]);
static Scheme_Object *procedure_arity_p(int argc, Scheme_Object *argv[]);
@ -515,7 +505,6 @@ scheme_init_fun (Scheme_Env *env)
| SCHEME_PRIM_IS_OMITABLE);
scheme_add_global_constant("void?", scheme_void_p_proc, env);
#ifdef TIME_SYNTAX
scheme_add_global_constant("time-apply",
scheme_make_prim_w_arity2(time_apply,
"time-apply",
@ -552,7 +541,6 @@ scheme_init_fun (Scheme_Env *env)
"seconds->date",
1, 2),
env);
#endif
scheme_add_global_constant("dynamic-wind",
scheme_make_prim_w_arity(dynamic_wind,
@ -9417,8 +9405,6 @@ static Scheme_Object *jump_to_alt_continuation()
/* time */
/*========================================================================*/
#ifdef TIME_SYNTAX
#ifndef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 1000000
#endif
@ -9442,22 +9428,12 @@ intptr_t scheme_get_milliseconds(void)
XFORM_SKIP_PROC
/* this function can be called from any OS thread */
{
#ifdef USE_MACTIME
return scheme_get_process_milliseconds();
#else
# ifdef USE_FTIME
struct MSC_IZE(timeb) now;
MSC_IZE(ftime)(&now);
return (intptr_t)(now.time * 1000 + now.millitm);
# else
# ifdef USE_WIN32_TIME
#ifdef USE_WIN32_TIME
return (intptr_t)(get_hectonanoseconds_as_longlong() / (mzlonglong)10000);
# else
#else
struct timeval now;
gettimeofday(&now, NULL);
return now.tv_sec * 1000 + now.tv_usec / 1000;
# endif
# endif
#endif
}
@ -9465,32 +9441,15 @@ double scheme_get_inexact_milliseconds(void)
XFORM_SKIP_PROC
/* this function can be called from any OS thread */
{
#ifdef USE_MACTIME
{
/* This is wrong, since it's not since January 1, 1970 */
UnsignedWide time;
Microseconds(&time);
return (((double)(time.lo >> 10)
+ ((double)(time.hi >> 10) * 4294967296.0))
* 1.024);
}
#else
# ifdef USE_FTIME
struct MSC_IZE(timeb) now;
MSC_IZE(ftime)(&now);
return (double)now.time * 1000.0 + (double)now.millitm;
# else
# ifdef USE_WIN32_TIME
#ifdef USE_WIN32_TIME
FILETIME ft;
mzlonglong v;
v = get_hectonanoseconds_as_longlong();
return (double)(v / 10000) + (((double)(v % 10000)) / 10000.0);
# else
#else
struct timeval now;
gettimeofday(&now, NULL);
return (double)now.tv_sec * 1000.0 + (double)now.tv_usec / 1000;
# endif
# endif
#endif
}
@ -9514,14 +9473,7 @@ intptr_t scheme_get_process_milliseconds(void)
return s * 1000 + u / 1000;
# else
# ifdef USE_MACTIME
{
UnsignedWide time;
Microseconds(&time);
return ((uintptr_t)time.lo) / 1000;
}
# else
# ifdef WINDOWS_GET_PROCESS_TIMES
# ifdef WINDOWS_GET_PROCESS_TIMES
{
FILETIME cr, ex, kr, us;
if (GetProcessTimes(GetCurrentProcess(), &cr, &ex, &kr, &us)) {
@ -9532,9 +9484,8 @@ intptr_t scheme_get_process_milliseconds(void)
} else
return 0; /* anything better to do? */
}
# else
# else
return clock() * 1000 / CLOCKS_PER_SEC;
# endif
# endif
# endif
@ -9591,14 +9542,6 @@ intptr_t scheme_get_seconds(void)
#ifdef USE_WIN32_TIME
return (intptr_t)(get_hectonanoseconds_as_longlong() / (mzlonglong)10000000);
#else
# ifdef USE_PALMTIME
return TimGetSeconds();
# else
# ifdef USE_FTIME
struct MSC_IZE(timeb) now;
MSC_IZE(ftime)(&now);
return (intptr_t)now.time;
# else
# ifdef USE_PLAIN_TIME
time_t now;
now = time(NULL);
@ -9607,8 +9550,6 @@ intptr_t scheme_get_seconds(void)
struct timeval now;
gettimeofday(&now, NULL);
return now.tv_sec;
# endif
# endif
# endif
#endif
}
@ -9737,13 +9678,8 @@ static Scheme_Object *seconds_to_date(int argc, Scheme_Object **argv)
# define CHECK_TIME_T uintptr_t
SYSTEMTIME localTime;
#else
# ifdef USE_PALMTIME
# define CHECK_TIME_T UInt32
DateTimeType localTime;
# else
# define CHECK_TIME_T time_t
# define CHECK_TIME_T time_t
struct tm *localTime;
# endif
#endif
CHECK_TIME_T now;
char *tzn;
@ -9799,15 +9735,11 @@ static Scheme_Object *seconds_to_date(int argc, Scheme_Object **argv)
}
}
#else
# ifdef USE_PALMTIME
TimSecondsToDateTime(lnow, &localTime) ;
# else
if (get_gmt)
localTime = gmtime(&now);
else
localTime = localtime(&now);
success = !!localTime;
# endif
#endif
if (success) {
@ -10046,8 +9978,6 @@ static Scheme_Object *current_seconds(int argc, Scheme_Object **argv)
return scheme_make_integer_value_from_time(secs);
}
#endif
/*========================================================================*/
/* read-eval-print */

View File

@ -508,9 +508,7 @@ extern Scheme_Object *scheme_write_proc, *scheme_display_proc, *scheme_print_pro
extern Scheme_Object *scheme_raise_arity_error_proc;
#ifdef TIME_SYNTAX
extern Scheme_Object *scheme_date;
#endif
extern Scheme_Object *scheme_liberal_def_ctx_type;

View File

@ -249,11 +249,9 @@ scheme_init_struct (Scheme_Env *env)
Scheme_Object **as_names;
Scheme_Object **as_values;
int as_count;
#ifdef TIME_SYNTAX
Scheme_Object **ts_names;
Scheme_Object **ts_values;
int ts_count;
#endif
Scheme_Object **loc_names;
Scheme_Object **loc_values;
int loc_count;
@ -261,12 +259,10 @@ scheme_init_struct (Scheme_Env *env)
Scheme_Object *guard;
READ_ONLY static const char *arity_fields[1] = { "value" };
#ifdef TIME_SYNTAX
READ_ONLY static const char *date_fields[10] = { "second", "minute", "hour",
"day", "month", "year",
"week-day", "year-day", "dst?", "time-zone-offset" };
READ_ONLY static const char *date_star_fields[2] = { "nanosecond", "time-zone-name" };
#endif
READ_ONLY static const char *location_fields[10] = { "source", "line", "column", "position", "span" };
#ifdef MZ_PRECISE_GC
@ -290,7 +286,6 @@ scheme_init_struct (Scheme_Env *env)
env);
}
#ifdef TIME_SYNTAX
/* Add date structure: */
REGISTER_SO(scheme_date);
scheme_date = scheme_make_struct_type_from_string("date", NULL, 10, NULL,
@ -323,8 +318,6 @@ scheme_init_struct (Scheme_Env *env)
}
#endif
/* Add location structure: */
REGISTER_SO(location_struct);
location_struct = scheme_make_struct_type_from_string("srcloc", NULL, 5, NULL,

View File

@ -5,7 +5,6 @@
#define SYSTEM_TYPE_NAME "unix"
#define UNIX_FILE_SYSTEM
#define TIME_SYNTAX
#define PROCESS_FUNCTION
#define DIR_FUNCTION
#define GETENV_FUNCTION