* ports.h (scm_port_table): remove file_name member for now, it seems
authorGary Houston <ghouston@arglist.com>
Mon, 16 Sep 1996 03:32:26 +0000 (03:32 +0000)
committerGary Houston <ghouston@arglist.com>
Mon, 16 Sep 1996 03:32:26 +0000 (03:32 +0000)
undesirable.
* fports.c (scm_open_file): don't set file_name in PTAB.
(prinfport): don't use file_name in PTAB.
* ioext.c (scm_sys_duplicate_port): don't set file_name in PTAB.
* ports.c (scm_add_to_port_table): don't intialize file_name.
(scm_port_file_name): remove for now.
* gc.c (scm_gc_mark): don't mark PTAB file_name.

* fports.h (scm_mkfile): prototype deleted.
* fports.c (scm_mkfile): merged into scm_open_file to simplify.

libguile/ChangeLog
libguile/fports.c
libguile/fports.h
libguile/gc.c
libguile/ioext.c
libguile/ports.c
libguile/ports.h

index 3b704b0..74f5e1d 100644 (file)
@@ -1,5 +1,17 @@
 Sun Sep 15 03:58:29 1996  Gary Houston  <ghouston@actrix.gen.nz>
 
+       * ports.h (scm_port_table): remove file_name member for now, it seems
+       undesirable.
+       * fports.c (scm_open_file): don't set file_name in PTAB.
+       (prinfport): don't use file_name in PTAB.
+       * ioext.c (scm_sys_duplicate_port): don't set file_name in PTAB.
+       * ports.c (scm_add_to_port_table): don't intialize file_name.
+       (scm_port_file_name): remove for now.
+       * gc.c (scm_gc_mark): don't mark PTAB file_name.
+
+       * fports.h (scm_mkfile): prototype deleted.
+       * fports.c (scm_mkfile): merged into scm_open_file to simplify.
+
        * debug.c, unif.c: use scm_out_of_range instead of
        wta for range errors (ASSERT still needs work).
 
index 91ca9c2..9494a87 100644 (file)
@@ -140,69 +140,54 @@ scm_mode_bits (modes)
  *
  * Return the new port.
  */
-
+SCM_PROC(s_open_file, "open-file", 2, 0, 0, scm_open_file);
 #ifdef __STDC__
 SCM
-scm_mkfile (char * name, char * modes)
+scm_open_file (SCM filename, SCM modes)
 #else
 SCM
-scm_mkfile (name, modes)
-     char * name;
-     char * modes;
+scm_open_file (filename, modes)
+     SCM filename;
+     SCM modes;
 #endif
 {
-  register SCM port;
+  SCM port;
   FILE *f;
+  char *file;
+  char *mode;
+
+  SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename, SCM_ARG1, s_open_file);
+  SCM_ASSERT (SCM_NIMP (modes) && SCM_ROSTRINGP (modes), modes, SCM_ARG2, s_open_file);
+  if (SCM_SUBSTRP (filename))
+    filename = scm_makfromstr (SCM_ROCHARS (filename), SCM_ROLENGTH (filename), 0);
+  if (SCM_SUBSTRP (modes))
+    modes = scm_makfromstr (SCM_ROCHARS (modes), SCM_ROLENGTH (modes), 0);
+
+  file = SCM_ROCHARS (filename);
+  mode = SCM_ROCHARS (modes);
+
   SCM_NEWCELL (port);
   SCM_DEFER_INTS;
-  SCM_SYSCALL (f = fopen (name, modes));
+  SCM_SYSCALL (f = fopen (file, mode));
   if (!f)
     {
-      SCM_ALLOW_INTS;
-      port = SCM_BOOL_F;
+      scm_syserror_msg (s_open_file, "%S: %S",
+                       scm_listify (scm_makfrom0str (strerror (errno)),
+                                    filename,
+                                    SCM_UNDEFINED));
     }
   else
     {
       struct scm_port_table * pt;
+
       pt = scm_add_to_port_table (port);
       SCM_SETPTAB_ENTRY (port, pt);
-      if (SCM_BUF0 & (SCM_CAR (port) = scm_tc16_fport | scm_mode_bits (modes)))
+      if (SCM_BUF0 & (SCM_CAR (port) = scm_tc16_fport | scm_mode_bits (mode)))
        scm_setbuf0 (port);
       SCM_SETSTREAM (port, (SCM)f);
-      SCM_PTAB_ENTRY (port)->file_name = scm_makfrom0str (name);
-      SCM_ALLOW_INTS;
+      /* SCM_PTAB_ENTRY (port)->file_name = scm_makfrom0str (filename); */
     }
-  return port;
-}
-
-SCM_PROC(s_open_file, "open-file", 2, 0, 0, scm_open_file);
-#ifdef __STDC__
-SCM
-scm_open_file (SCM filename, SCM modes)
-#else
-SCM
-scm_open_file (filename, modes)
-     SCM filename;
-     SCM modes;
-#endif
-{
-  SCM port;
-  SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename, SCM_ARG1, s_open_file);
-  SCM_ASSERT (SCM_NIMP (modes) && SCM_ROSTRINGP (modes), modes, SCM_ARG2, s_open_file);
-  if (SCM_SUBSTRP (filename))
-    filename = scm_makfromstr (SCM_ROCHARS (filename), SCM_ROLENGTH (filename), 0);
-  if (SCM_SUBSTRP (modes))
-    modes = scm_makfromstr (SCM_ROCHARS (modes), SCM_ROLENGTH (modes), 0);
-  port = scm_mkfile (SCM_ROCHARS (filename), SCM_ROCHARS (modes));
-
-  if (port == SCM_BOOL_F) {
-    scm_syserror_msg (s_open_file, "%S: %S",
-                     scm_listify (scm_makfrom0str (strerror (errno)),
-                                  filename,
-                                  SCM_UNDEFINED));
-    /* Force the compiler to keep filename and modes alive.  */
-    scm_cons (filename, modes);
-  }
+  SCM_ALLOW_INTS;
   return port;
 }
 
@@ -249,6 +234,7 @@ prinfport (exp, port, writing)
      int writing;
 #endif
 {
+  /*
   SCM name;
   char * c;
   if (SCM_CLOSEDP (exp))
@@ -263,8 +249,10 @@ prinfport (exp, port, writing)
       else
        c = "file";
     }
-
+    
   scm_prinport (exp, port, c);
+  */
+  scm_prinport (exp, port, "file");
   return !0;
 }
 
index 270e846..15ce0b5 100644 (file)
@@ -57,7 +57,6 @@ extern scm_ptobfuns scm_pipob;
 #ifdef __STDC__
 extern SCM scm_setbuf0 (SCM port);
 extern long scm_mode_bits (char *modes);
-extern SCM scm_mkfile (char * name, char * modes);
 extern SCM scm_open_file (SCM filename, SCM modes);
 extern SCM scm_port_mode (SCM port);
 extern void scm_init_fports (void);
index a9125e9..a9022bd 100644 (file)
@@ -677,8 +677,10 @@ gc_mark_nimp:
        goto def;
       if (SCM_GC8MARKP (ptr))
        break;
-      if (SCM_PTAB_ENTRY(ptr))
-       scm_gc_mark (SCM_PTAB_ENTRY(ptr)->file_name);
+      /*
+       if (SCM_PTAB_ENTRY(ptr))
+          scm_gc_mark (SCM_PTAB_ENTRY(ptr)->file_name);
+          */
       ptr = (scm_ptobs[i].mark) (ptr);
       goto gc_mark_loop;
       break;
index 9f1959c..bc309ee 100644 (file)
@@ -182,7 +182,7 @@ scm_sys_duplicate_port (oldpt, modes)
     if (SCM_BUF0 & (SCM_CAR (newpt) = scm_tc16_fport | scm_mode_bits (SCM_CHARS (modes))))
       scm_setbuf0 (newpt);
     SCM_SETSTREAM (newpt, (SCM)f);
-    SCM_PTAB_ENTRY (newpt)->file_name = SCM_PTAB_ENTRY (oldpt)->file_name;
+    /* SCM_PTAB_ENTRY (newpt)->file_name = SCM_PTAB_ENTRY (oldpt)->file_name;*/
   }
   SCM_ALLOW_INTS;
   return newpt;
index 3407b4c..f2e5954 100644 (file)
@@ -380,7 +380,7 @@ scm_add_to_port_table (port)
   scm_port_table[scm_port_table_size]->port = port;
   scm_port_table[scm_port_table_size]->revealed = 0;
   scm_port_table[scm_port_table_size]->stream = 0;
-  scm_port_table[scm_port_table_size]->file_name = SCM_BOOL_F;
+  /* scm_port_table[scm_port_table_size]->file_name = SCM_BOOL_F;*/
   scm_port_table[scm_port_table_size]->line_number = 1;
   scm_port_table[scm_port_table_size]->column_number = 0;
   scm_port_table[scm_port_table_size]->representation = scm_regular_port;
@@ -747,6 +747,7 @@ scm_column_number  (port)
 }
 
 /* !!! dubious feature */
+#if 0
 SCM_PROC (s_port_file_name, "port-file-name", 0, 1, 0, scm_port_file_name);
 #ifdef __STDC__
 SCM 
@@ -766,6 +767,7 @@ scm_port_file_name (port)
   else
     return SCM_PTAB_ENTRY (p)->file_name;
 }
+#endif
 
 #ifndef ttyname
 extern char * ttyname();
index f38b8c0..d5e1b34 100644 (file)
@@ -71,7 +71,7 @@ struct scm_port_table
                                 */
 
   SCM stream;
-  SCM file_name;
+  /*  SCM file_name; */
   int unchr;                   /* pushed back character, if any */
 
   int line_number;
@@ -188,7 +188,7 @@ extern SCM scm_peek_char (SCM port);
 extern SCM scm_unread_char (SCM cobj, SCM port);
 extern SCM scm_line_number (SCM port);
 extern SCM scm_column_number (SCM port);
-extern SCM scm_port_file_name (SCM port);
+/* extern SCM scm_port_file_name (SCM port); */
 extern void scm_prinport (SCM exp, SCM port, char *type);
 extern void scm_ports_prehistory (void);
 extern SCM scm_void_port (char * mode_str);
@@ -225,7 +225,7 @@ extern SCM scm_peek_char ();
 extern SCM scm_unread_char ();
 extern SCM scm_line_number ();
 extern SCM scm_column_number ();
-extern SCM scm_port_file_name ();
+/* extern SCM scm_port_file_name ();*/
 extern void scm_prinport ();
 extern void scm_ports_prehistory ();
 extern SCM scm_void_port ();