guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile ChangeLog tags.h fpor...


From: Dirk Herrmann
Subject: guile/guile-core/libguile ChangeLog tags.h fpor...
Date: Thu, 25 Jan 2001 09:18:41 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Dirk Herrmann <address@hidden>  01/01/25 09:18:41

Modified files:
        guile-core/libguile: ChangeLog tags.h fports.c fports.h 
                             strports.c vports.c init.c ports.c ports.h 
                             posix.c 

Log message:
        * Made the port implementations less tightly coupled within guile.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1247&r2=1.1248
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/tags.h.diff?r1=1.72&r2=1.73
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/fports.c.diff?r1=1.88&r2=1.89
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/fports.h.diff?r1=1.25&r2=1.26
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/strports.c.diff?r1=1.66&r2=1.67
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/vports.c.diff?r1=1.40&r2=1.41
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/init.c.diff?r1=1.111&r2=1.112
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ports.c.diff?r1=1.126&r2=1.127
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ports.h.diff?r1=1.70&r2=1.71
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/posix.c.diff?r1=1.79&r2=1.80

Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1247 
guile/guile-core/libguile/ChangeLog:1.1248
--- guile/guile-core/libguile/ChangeLog:1.1247  Thu Jan 25 03:09:21 2001
+++ guile/guile-core/libguile/ChangeLog Thu Jan 25 09:18:40 2001
@@ -1,5 +1,35 @@
 2001-01-25  Dirk Herrmann  <address@hidden>
 
+       * tags.h (scm_tc16_fport, scm_tc16_strport, scm_tc16_sfport):
+       These are now defined in fports.c, strports.c and vports.c.
+
+       * fports.[ch] (scm_tc16_fport), strports.c (scm_tc16_strport),
+       vports.c (scm_tc16_sfport): Made variables (were macros defined in
+       tags.h).
+
+       fports.c (scm_make_fptob), strports.c (scm_make_stptob), vports.c
+       (scm_make_sfptob):  Made static.  These return a type code now.
+
+       fports.c (scm_init_fports), strports.c (scm_init_strports),
+       vports.c (scm_init_vports):  Create the corresponding port types.
+
+       * fports.h (SCM_FPORTP, SCM_OPFPORTP, SCM_OPINFPORTP,
+       SCM_OPOUTFPORTP):  Redefined in terms of scm_tc16_fport.
+
+       * init.c (scm_init_guile_1):  Make sure strports are initialized
+       before gdbint.
+
+       * ports.[ch] (scm_make_port_type):  Changed the return type to
+       scm_bits_t.
+
+       * ports.c (scm_ports_prehistory):  Don't create any port types
+       here.
+
+       * posix.c (scm_ttyname):  Use SCM_FPORTP instead of comparing
+       against scm_tc16_fport directly.
+
+2001-01-25  Dirk Herrmann  <address@hidden>
+
        * srcprop.c (scm_set_source_property_x):  Fix to handle
        (set-source-property! <obj> 'copy <datum>) correctly.
 
Index: guile/guile-core/libguile/fports.c
diff -u guile/guile-core/libguile/fports.c:1.88 
guile/guile-core/libguile/fports.c:1.89
--- guile/guile-core/libguile/fports.c:1.88     Sat Jan  6 14:03:07 2001
+++ guile/guile-core/libguile/fports.c  Thu Jan 25 09:18:41 2001
@@ -69,6 +69,10 @@
 
 #include "libguile/iselect.h"
 
+
+scm_bits_t scm_tc16_fport;
+
+
 /* default buffer size, used if the O/S won't supply a value.  */
 static const int default_buffer_size = 1024;
 
@@ -766,13 +770,12 @@
   fport_close (port);
   return 0;
 }
-
-void scm_make_fptob (void); /* Called from ports.c */
 
-void
+static scm_bits_t
 scm_make_fptob ()
 {
-  long tc = scm_make_port_type ("file", fport_fill_input, fport_write);
+  scm_bits_t tc = scm_make_port_type ("file", fport_fill_input, fport_write);
+
   scm_set_port_free            (tc, fport_free);
   scm_set_port_print           (tc, fport_print);
   scm_set_port_flush           (tc, fport_flush);
@@ -781,17 +784,22 @@
   scm_set_port_seek            (tc, fport_seek);
   scm_set_port_truncate        (tc, fport_truncate);
   scm_set_port_input_waiting   (tc, fport_input_waiting);
+
+  return tc;
 }
 
 void
 scm_init_fports ()
 {
-#ifndef SCM_MAGIC_SNARFER
-#include "libguile/fports.x"
-#endif
+  scm_tc16_fport = scm_make_fptob ();
+
   scm_sysintern ("_IOFBF", SCM_MAKINUM (_IOFBF));
   scm_sysintern ("_IOLBF", SCM_MAKINUM (_IOLBF));
   scm_sysintern ("_IONBF", SCM_MAKINUM (_IONBF));
+
+#ifndef SCM_MAGIC_SNARFER
+#include "libguile/fports.x"
+#endif
 }
 
 /*
Index: guile/guile-core/libguile/fports.h
diff -u guile/guile-core/libguile/fports.h:1.25 
guile/guile-core/libguile/fports.h:1.26
--- guile/guile-core/libguile/fports.h:1.25     Wed Jan 24 13:47:23 2001
+++ guile/guile-core/libguile/fports.h  Thu Jan 25 09:18:41 2001
@@ -58,13 +58,15 @@
   int fdes;                    /* file descriptor.  */
 };
 
+extern scm_bits_t scm_tc16_fport;
+
 #define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x))
 #define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes)
 
-#define SCM_FPORTP(x) (!SCM_IMP (x) && (SCM_TYP16S (x) == scm_tc7_port))
-#define SCM_OPFPORTP(x) (!SCM_IMP (x) && (((0xfeff | SCM_OPN) & 
SCM_CELL_WORD_0 (x)) == (scm_tc7_port | SCM_OPN)))
-#define SCM_OPINFPORTP(x) (!SCM_IMP (x) && (((0xfeff | SCM_OPN | SCM_RDNG) & 
SCM_CELL_WORD_0 (x)) == (scm_tc7_port | SCM_OPN | SCM_RDNG)))
-#define SCM_OPOUTFPORTP(x) (!SCM_IMP(x) && (((0xfeff | SCM_OPN | SCM_WRTNG) & 
SCM_CELL_WORD_0 (x)) == (scm_tc7_port | SCM_OPN | SCM_WRTNG)))
+#define SCM_FPORTP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_fport))
+#define SCM_OPFPORTP(x) (SCM_FPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_OPN))
+#define SCM_OPINFPORTP(x) (SCM_OPFPORTP (x) && (SCM_CELL_WORD_0 (x) & 
SCM_RDNG))
+#define SCM_OPOUTFPORTP(x) (SCM_OPFPORTP (x) && (SCM_CELL_WORD_0 (x) & 
SCM_WRTNG))
 
 /* test whether fdes supports random access.  */
 #define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1)
Index: guile/guile-core/libguile/init.c
diff -u guile/guile-core/libguile/init.c:1.111 
guile/guile-core/libguile/init.c:1.112
--- guile/guile-core/libguile/init.c:1.111      Wed Jan 24 13:47:23 2001
+++ guile/guile-core/libguile/init.c    Thu Jan 25 09:18:41 2001
@@ -499,7 +499,8 @@
   scm_init_fluids ();
   scm_init_backtrace ();       /* Requires fluids */
   scm_init_fports ();
-  scm_init_gdbint ();
+  scm_init_strports ();
+  scm_init_gdbint ();           /* Requires strports */
   scm_init_hash ();
   scm_init_hashtab ();
   scm_init_objprop ();
@@ -539,7 +540,6 @@
   scm_init_stackchk ();
   scm_init_struct ();
   scm_init_stacks ();   /* Requires struct */
-  scm_init_strports ();
   scm_init_symbols ();
   scm_init_tag ();
   scm_init_values ();   /* Requires struct */
@@ -570,7 +570,7 @@
 #endif
   scm_init_simpos ();
   scm_init_load_path ();
-  scm_init_standard_ports ();
+  scm_init_standard_ports ();  /* Requires fports */
   scm_init_dynamic_linking ();
   scm_init_lang ();
   scm_init_script ();
Index: guile/guile-core/libguile/ports.c
diff -u guile/guile-core/libguile/ports.c:1.126 
guile/guile-core/libguile/ports.c:1.127
--- guile/guile-core/libguile/ports.c:1.126     Sat Jan  6 14:03:07 2001
+++ guile/guile-core/libguile/ports.c   Thu Jan 25 09:18:41 2001
@@ -115,7 +115,7 @@
 {
 }
 
-long 
+scm_bits_t
 scm_make_port_type (char *name,
                    int (*fill_input) (SCM port),
                    void (*write) (SCM port, const void *data, size_t size))
@@ -1382,23 +1382,11 @@
   return 1;
 }
 
-extern void scm_make_fptob ();
-extern void scm_make_stptob ();
-extern void scm_make_sfptob ();
-
 void
 scm_ports_prehistory ()
 {
   scm_numptob = 0;
   scm_ptobs = (scm_ptob_descriptor *) malloc (sizeof (scm_ptob_descriptor));
-  
-  /* WARNING: These scm_newptob calls must be done in this order.
-   * They must agree with the port declarations in tags.h.
-   */
-  /* scm_tc16_fport = */ scm_make_fptob ();
-  /* scm_tc16_pipe was here */ scm_make_fptob (); /* dummy.  */
-  /* scm_tc16_strport = */ scm_make_stptob ();
-  /* scm_tc16_sfport = */ scm_make_sfptob ();
 }
 
 
Index: guile/guile-core/libguile/ports.h
diff -u guile/guile-core/libguile/ports.h:1.70 
guile/guile-core/libguile/ports.h:1.71
--- guile/guile-core/libguile/ports.h:1.70      Sat Jan  6 14:03:07 2001
+++ guile/guile-core/libguile/ports.h   Thu Jan 25 09:18:41 2001
@@ -217,10 +217,11 @@
 
 
 extern SCM scm_markstream (SCM ptr);
-extern long scm_make_port_type (char *name,
-                               int (*fill_input) (SCM port),
-                               void (*write) (SCM port, const void *data,
-                                              size_t size));
+extern scm_bits_t scm_make_port_type (char *name,
+                                     int (*fill_input) (SCM port),
+                                     void (*write) (SCM port, 
+                                                    const void *data,
+                                                    size_t size));
 extern void scm_set_port_mark (long tc, SCM (*mark) (SCM));
 extern void scm_set_port_free (long tc, scm_sizet (*free) (SCM));
 extern void scm_set_port_print (long tc,
Index: guile/guile-core/libguile/posix.c
diff -u guile/guile-core/libguile/posix.c:1.79 
guile/guile-core/libguile/posix.c:1.80
--- guile/guile-core/libguile/posix.c:1.79      Wed Jan 24 13:45:09 2001
+++ guile/guile-core/libguile/posix.c   Thu Jan 25 09:18:41 2001
@@ -716,7 +716,7 @@
 
   port = SCM_COERCE_OUTPORT (port);
   SCM_VALIDATE_OPPORT (1,port);
-  if (scm_tc16_fport != SCM_TYP16 (port))
+  if (!SCM_FPORTP (port))
     return SCM_BOOL_F;
   fd = SCM_FPORT_FDES (port);
   SCM_SYSCALL (ans = ttyname (fd));
Index: guile/guile-core/libguile/strports.c
diff -u guile/guile-core/libguile/strports.c:1.66 
guile/guile-core/libguile/strports.c:1.67
--- guile/guile-core/libguile/strports.c:1.66   Wed Nov 22 03:20:03 2000
+++ guile/guile-core/libguile/strports.c        Thu Jan 25 09:18:41 2001
@@ -79,6 +79,10 @@
    when rw_active is SCM_PORT_NEITHER.
 */
 
+
+static scm_bits_t scm_tc16_strport;
+
+
 static int
 stfill_buffer (SCM port)
 {
@@ -415,23 +419,26 @@
   return ans;
 }
 #undef FUNC_NAME
-
-void scm_make_stptob (void); /* Called from ports.c */
 
-void
+static scm_bits_t
 scm_make_stptob ()
 {
-  long tc = scm_make_port_type ("string", stfill_buffer, st_write);
+  scm_bits_t tc = scm_make_port_type ("string", stfill_buffer, st_write);
+
   scm_set_port_mark        (tc, scm_markstream);
   scm_set_port_end_input   (tc, st_end_input);
   scm_set_port_flush       (tc, st_flush);
   scm_set_port_seek        (tc, st_seek);
   scm_set_port_truncate    (tc, st_truncate);
+
+  return tc;
 }
 
 void
 scm_init_strports ()
 {
+  scm_tc16_strport = scm_make_stptob ();
+
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/strports.x"
 #endif
Index: guile/guile-core/libguile/tags.h
diff -u guile/guile-core/libguile/tags.h:1.72 
guile/guile-core/libguile/tags.h:1.73
--- guile/guile-core/libguile/tags.h:1.72       Fri Dec  8 09:32:56 2000
+++ guile/guile-core/libguile/tags.h    Thu Jan 25 09:18:41 2001
@@ -372,15 +372,9 @@
 #define scm_tc7_lsubr          119
 
 
-/* There are 256 port subtypes.  Here are the first few.
- * These must agree with the init function in ports.c
+/* There are 256 port subtypes.
  */
 #define scm_tc7_port           125
-
-#define scm_tc16_fport                 (scm_tc7_port + 0 * 256L)
-/* scm_tc16_pipe was here.  */
-#define scm_tc16_strport       (scm_tc7_port + 2 * 256L)
-#define scm_tc16_sfport        (scm_tc7_port + 3 * 256L)
 
 
 /* There are 256 smob subtypes.  Here are the first four.
Index: guile/guile-core/libguile/vports.c
diff -u guile/guile-core/libguile/vports.c:1.40 
guile/guile-core/libguile/vports.c:1.41
--- guile/guile-core/libguile/vports.c:1.40     Fri Nov 17 08:25:05 2000
+++ guile/guile-core/libguile/vports.c  Thu Jan 25 09:18:41 2001
@@ -67,6 +67,9 @@
  */
 
 
+static scm_bits_t scm_tc16_sfport;
+
+
 static void
 sf_flush (SCM port)
 {
@@ -197,20 +200,23 @@
 #undef FUNC_NAME
 
 
-void scm_make_sfptob (void); /* Called from ports.c */
-
-void
+static scm_bits_t
 scm_make_sfptob ()
 {
-  long tc = scm_make_port_type ("soft", sf_fill_input, sf_write);
+  scm_bits_t tc = scm_make_port_type ("soft", sf_fill_input, sf_write);
+
   scm_set_port_mark (tc, scm_markstream);
   scm_set_port_flush (tc, sf_flush);
   scm_set_port_close (tc, sf_close);
+
+  return tc;
 }
 
 void
 scm_init_vports ()
 {
+  scm_tc16_sfport = scm_make_sfptob ();
+
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/vports.x"
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]