- Handle address relocation to allow the NT version of Scheme to run
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Sat, 21 Aug 1993 03:21:47 +0000 (03:21 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Sat, 21 Aug 1993 03:21:47 +0000 (03:21 +0000)
  under Windows 3.1.
- Cleanup of the NT sources.  Remove DOS fossils.

v7/src/microcode/ntenv.c
v7/src/microcode/ntfs.c

index 077871d3b459690b0f27381c11cb42b0771ef37d..337153eabf59b2dd5c3d581315f4923a476d767d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: ntenv.c,v 1.5 1993/07/27 21:27:42 gjr Exp $
+$Id: ntenv.c,v 1.6 1993/08/21 03:21:19 gjr Exp $
 
 Copyright (c) 1992-1993 Massachusetts Institute of Technology
 
@@ -44,7 +44,7 @@ time_t
 DEFUN_VOID (OS_encoded_time)
 {
   time_t t;
-  STD_UINT_SYSTEM_CALL (syscall_time, t, (DOS_time (0)));
+  STD_UINT_SYSTEM_CALL (syscall_time, t, (NT_time (0)));
   return (t);
 }
 
@@ -52,7 +52,7 @@ void
 DEFUN (OS_decode_time, (t, buffer), time_t t AND struct time_structure * buffer)
 {
   struct tm * ts;
-  STD_PTR_SYSTEM_CALL (syscall_localtime, ts, (DOS_localtime (&t)));
+  STD_PTR_SYSTEM_CALL (syscall_localtime, ts, (NT_localtime (&t)));
   (buffer -> year) = ((ts -> tm_year) + 1900);
   (buffer -> month) = ((ts -> tm_mon) + 1);
   (buffer -> day) = (ts -> tm_mday);
@@ -83,7 +83,7 @@ DEFUN (OS_encode_time ,(buffer), struct time_structure * buffer)
     int wday = (buffer -> day_of_week);
     (ts -> tm_wday) = ((wday == 6) ? 0 : (wday + 1));
   }
-  STD_UINT_SYSTEM_CALL (syscall_mktime, t, (DOS_mktime (ts)));
+  STD_UINT_SYSTEM_CALL (syscall_mktime, t, (NT_mktime (ts)));
   return (t);
 }
 
@@ -101,31 +101,10 @@ DEFUN_VOID (OS_real_time_clock)
   return ((((double) (clock ())) * 1000.0) / ((double) CLOCKS_PER_SEC));
 }
 \f
-/* Timer adjustments */
-#define PC_TIMER_TICKS_PER_SECOND      (18.2)
-/* This should work out to about 55 */
-#define PC_MILLISECONDS_PER_TIMER_TICK  \
-  ((long) ((1000.0/PC_TIMER_TICKS_PER_SECOND)+0.5))
-
-static unsigned long
-DEFUN (ms_to_ticks, (clocks), clock_t clocks)
-{ ldiv_t ticks;
-  unsigned long result;
-
-  ticks = ldiv((long) clocks, PC_MILLISECONDS_PER_TIMER_TICK);
-
-  result = ((ticks.rem >= (PC_MILLISECONDS_PER_TIMER_TICK/2)) ?
-           (ticks.quot + 1) : (ticks.quot));
-  return (result == 0) ? 1 : result;
-}
-
 void
 DEFUN (OS_process_timer_set, (first, interval),
-       clock_t first AND
-       clock_t interval)
+       clock_t first AND clock_t interval)
 {
-  /* Convert granularity to 1/18.2 seconds */
-
   return;
 }
 
@@ -137,10 +116,10 @@ DEFUN_VOID (OS_process_timer_clear)
 
 void
 DEFUN (OS_real_timer_set, (first, interval),
-       clock_t first AND
-       clock_t interval)
+       clock_t first AND clock_t interval)
 {
   OS_process_timer_set (first, interval);
+  return;
 }
 
 void
@@ -149,12 +128,6 @@ DEFUN_VOID (OS_real_timer_clear)
   OS_process_timer_clear();
   return;
 }
-
-void
-DEFUN_VOID (DOS_initialize_environment)
-{
-  return;
-}
 \f
 static size_t current_dir_path_size = 0;
 static char * current_dir_path = 0;
@@ -167,14 +140,14 @@ DEFUN_VOID (OS_working_dir_pathname)
   }
   if (current_dir_path_size == 0)
     {
-      current_dir_path = (DOS_malloc (1024));
+      current_dir_path = (NT_malloc (1024));
       if (current_dir_path == 0)
        error_system_call (ENOMEM, syscall_malloc);
       current_dir_path_size = 1024;
     }
   while (1)
     {
-      if ((DOS_getcwd (current_dir_path, current_dir_path_size)) != 0)
+      if ((NT_getcwd (current_dir_path, current_dir_path_size)) != 0)
       { strlwr(current_dir_path);
        return (current_dir_path);
       }
@@ -185,7 +158,7 @@ DEFUN_VOID (OS_working_dir_pathname)
       current_dir_path_size *= 2;
       {
        char * new_current_dir_path =
-         (DOS_realloc (current_dir_path, current_dir_path_size));
+         (NT_realloc (current_dir_path, current_dir_path_size));
        if (new_current_dir_path == 0)
          /* ANSI C requires `path' to be unchanged -- we may have to
             discard it for systems that don't behave thus. */
@@ -198,21 +171,22 @@ DEFUN_VOID (OS_working_dir_pathname)
 void
 DEFUN (OS_set_working_dir_pathname, (name), char * name)
 {
-  /*SRA*/
-  size_t name_size = strlen(name);
-  char *filename = name;
+  size_t name_size = (strlen (name));
+  char * filename = name;
 
   STD_BOOL_SYSTEM_CALL (syscall_chdir, (SetCurrentDirectory (filename)));
 
-  while (1) {
-    if (name_size < current_dir_path_size) {
+  while (1)
+  {
+    if (name_size < current_dir_path_size)
+    {
       strcpy(current_dir_path, name);
       return;
     }
     current_dir_path_size *= 2;
     {
       char * new_current_dir_path =
-       (DOS_realloc (current_dir_path, current_dir_path_size));
+       (NT_realloc (current_dir_path, current_dir_path_size));
       if (new_current_dir_path == 0)
        error_system_call (ENOMEM, syscall_realloc);
       current_dir_path = new_current_dir_path;
index 26c0892777198e0e133eabba57f2f7b581783faf..9cfb72c93efb37d8d9049cbd46c702533c87c012 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: ntfs.c,v 1.5 1993/07/30 06:23:56 gjr Exp $
+$Id: ntfs.c,v 1.6 1993/08/21 03:21:47 gjr Exp $
 
 Copyright (c) 1992-1993 Massachusetts Institute of Technology
 
@@ -38,12 +38,12 @@ MIT in each case. */
 #include "outf.h"
 \f
 int
-DEFUN (DOS_read_file_status, (name, s),
+DEFUN (NT_read_file_status, (name, s),
        CONST char * name AND
        struct stat * s)
 { char filename[128];
 
-  dos_pathname_as_filename(name, filename);
+  nt_pathname_as_filename (name, filename);
 
   while ((stat (filename, s)) < 0)
     {
@@ -62,10 +62,10 @@ DEFUN (OS_file_existence_test, (name), char * name)
   struct stat s;
   char filename[128];
 
-  dos_pathname_as_filename(name, filename);
+  nt_pathname_as_filename(name, filename);
 
   return
-    (((DOS_stat (filename, (&s))) < 0)
+    (((NT_stat (filename, (&s))) < 0)
      ? file_doesnt_exist : file_does_exist);
 }
 
@@ -74,8 +74,8 @@ DEFUN (OS_file_access, (name, mode), CONST char * name AND unsigned int mode)
 {
   char filename[128];
 
-  dos_pathname_as_filename(name, filename);
-  return ((DOS_access (filename, mode)) == 0);
+  nt_pathname_as_filename (name, filename);
+  return ((NT_access (filename, mode)) == 0);
 }
 
 int
@@ -84,8 +84,8 @@ DEFUN (OS_file_directory_p, (name), char * name)
   struct stat s;
   char filename[128];
 
-  dos_pathname_as_filename(name, filename);
-  return (((DOS_stat (filename, (&s))) == 0) &&
+  nt_pathname_as_filename(name, filename);
+  return (((NT_stat (filename, (&s))) == 0) &&
          (((s . st_mode) & S_IFMT) == S_IFDIR));
 }
 
@@ -98,16 +98,16 @@ DEFUN (OS_file_soft_link_p, (name), CONST char * name)
 void
 DEFUN (OS_file_remove, (name), CONST char * name)
 {
-  STD_VOID_SYSTEM_CALL (syscall_unlink, (DOS_unlink (name)));
+  STD_VOID_SYSTEM_CALL (syscall_unlink, (NT_unlink (name)));
 }
 
 void
 DEFUN (OS_file_remove_link, (name), CONST char * name)
 {
   struct stat s;
-  if ( (DOS_stat (name, (&s)) == 0) &&
+  if ( (NT_stat (name, (&s)) == 0) &&
        (((s . st_mode) & S_IFMT) == S_IFREG) )
-   DOS_unlink (name);
+   NT_unlink (name);
   return;
 }
 
@@ -132,20 +132,20 @@ DEFUN (OS_file_rename, (from_name, to_name),
        CONST char * from_name AND
        CONST char * to_name)
 {
-  if ((rename (from_name, to_name)) != 0)
+  if ((NT_rename (from_name, to_name)) != 0)
     error_system_call (errno, syscall_rename);
 }
 
 void
 DEFUN (OS_directory_make, (name), CONST char * name)
 {
-  STD_VOID_SYSTEM_CALL (syscall_mkdir, (DOS_mkdir (name)));
+  STD_VOID_SYSTEM_CALL (syscall_mkdir, (NT_mkdir (name)));
 }
 
 void
 DEFUN (OS_directory_delete, (name), CONST char * name)
 {
-  STD_VOID_SYSTEM_CALL (syscall_rmdir, (RemoveDirectory (name)));
+  STD_VOID_SYSTEM_CALL (syscall_rmdir, (NT_rmdir (name)));
 }
 \f
 #define DIR_UNALLOCATED (-1L)
@@ -170,7 +170,7 @@ static DIR ** directory_pointers;
 static unsigned int n_directory_pointers;
 
 void
-DEFUN_VOID (DOS_initialize_directory_reader)
+DEFUN_VOID (NT_initialize_directory_reader)
 {
   directory_pointers = 0;
   n_directory_pointers = 0;
@@ -182,7 +182,7 @@ DEFUN (allocate_directory_pointer, (pointer), DIR * pointer)
 {
   if (n_directory_pointers == 0)
     {
-      DIR ** pointers = ((DIR **) (DOS_malloc ((sizeof (DIR *)) * 4)));
+      DIR ** pointers = ((DIR **) (NT_malloc ((sizeof (DIR *)) * 4)));
       if (pointers == 0)
        error_system_call (ENOMEM, syscall_malloc);
       directory_pointers = pointers;
@@ -211,7 +211,7 @@ DEFUN (allocate_directory_pointer, (pointer), DIR * pointer)
     unsigned int n_pointers = (2 * n_directory_pointers);
     DIR ** pointers =
       ((DIR **)
-       (DOS_realloc (((PTR) directory_pointers),
+       (NT_realloc (((PTR) directory_pointers),
                    ((sizeof (DIR *)) * n_pointers))));
     if (pointers == 0)
       error_system_call (ENOMEM, syscall_realloc);
@@ -249,7 +249,7 @@ DEFUN (OS_directory_open, (name), CONST char * name)
   if (dir == 0)
     error_system_call (ENOMEM, syscall_malloc);
 
-  if (dos_pathname_as_filename (name, filename))
+  if (nt_pathname_as_filename (name, filename))
     sprintf (searchname, "%s*.*", filename);
   else
     sprintf (searchname, "%s\\*.*", filename);