summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/ChangeLog12
-rw-r--r--libguile/fports.c76
-rw-r--r--libguile/fports.h1
-rw-r--r--libguile/gc.c6
-rw-r--r--libguile/ioext.c2
-rw-r--r--libguile/ports.c4
-rw-r--r--libguile/ports.h6
7 files changed, 55 insertions, 52 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 3b704b02b..74f5e1d01 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -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).
diff --git a/libguile/fports.c b/libguile/fports.c
index 91ca9c231..9494a87e8 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -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;
}
diff --git a/libguile/fports.h b/libguile/fports.h
index 270e846b3..15ce0b588 100644
--- a/libguile/fports.h
+++ b/libguile/fports.h
@@ -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);
diff --git a/libguile/gc.c b/libguile/gc.c
index a9125e96c..a9022bd84 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -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;
diff --git a/libguile/ioext.c b/libguile/ioext.c
index 9f1959c39..bc309ee5f 100644
--- a/libguile/ioext.c
+++ b/libguile/ioext.c
@@ -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;
diff --git a/libguile/ports.c b/libguile/ports.c
index 3407b4ca3..f2e595417 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -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();
diff --git a/libguile/ports.h b/libguile/ports.h
index f38b8c050..d5e1b3459 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -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 ();