replace "scm_*_t" with "scm_t_*".
[bpt/guile.git] / libguile / ports.c
index b8d6fd2..56c0b37 100644 (file)
@@ -86,7 +86,7 @@
  * Indexes into this table are used when generating type
  * tags for smobjects (if you know a tag you can get an index and conversely).
  */
-scm_ptob_descriptor_t *scm_ptobs;
+scm_t_ptob_descriptor *scm_ptobs;
 long scm_numptob;
 
 /* GC marker for a port with stream of SCM type.  */
@@ -117,7 +117,7 @@ end_input_default (SCM port SCM_UNUSED, int offset SCM_UNUSED)
 {
 }
 
-scm_bits_t
+scm_t_bits
 scm_make_port_type (char *name,
                    int (*fill_input) (SCM port),
                    void (*write) (SCM port, const void *data, size_t size))
@@ -128,10 +128,10 @@ scm_make_port_type (char *name,
   SCM_DEFER_INTS;
   SCM_SYSCALL (tmp = (char *) realloc ((char *) scm_ptobs,
                                       (1 + scm_numptob)
-                                      * sizeof (scm_ptob_descriptor_t)));
+                                      * sizeof (scm_t_ptob_descriptor)));
   if (tmp)
     {
-      scm_ptobs = (scm_ptob_descriptor_t *) tmp;
+      scm_ptobs = (scm_t_ptob_descriptor *) tmp;
 
       scm_ptobs[scm_numptob].name = name;
       scm_ptobs[scm_numptob].mark = 0;
@@ -246,7 +246,7 @@ SCM_DEFINE (scm_char_ready_p, "char-ready?", 0, 1, 0,
            "interactive port that has no ready characters.}")
 #define FUNC_NAME s_scm_char_ready_p
 {
-  scm_port_t *pt;
+  scm_t_port *pt;
 
   if (SCM_UNBNDP (port))
     port = scm_cur_inp;
@@ -264,7 +264,7 @@ SCM_DEFINE (scm_char_ready_p, "char-ready?", 0, 1, 0,
     return SCM_BOOL_T;
   else
     {
-      scm_ptob_descriptor_t *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
+      scm_t_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
       
       if (ptob->input_waiting)
        return SCM_BOOL(ptob->input_waiting (port));
@@ -278,7 +278,7 @@ SCM_DEFINE (scm_char_ready_p, "char-ready?", 0, 1, 0,
    into memory starting at dest.  returns the number of chars moved.  */
 size_t scm_take_from_input_buffers (SCM port, char *dest, size_t read_len)
 {
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
   size_t chars_read = 0;
   size_t from_buf = min (pt->read_end - pt->read_pos, read_len);
 
@@ -313,7 +313,7 @@ SCM_DEFINE (scm_drain_input, "drain-input", 1, 0, 0,
 #define FUNC_NAME s_scm_drain_input
 {
   SCM result;
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
   long count;
 
   SCM_VALIDATE_OPINPORT (1,port);
@@ -422,35 +422,35 @@ SCM_DEFINE (scm_set_current_error_port, "set-current-error-port", 1, 0, 0,
 \f
 /* The port table --- an array of pointers to ports.  */
 
-scm_port_t **scm_port_table;
+scm_t_port **scm_t_portable;
 
-long scm_port_table_size = 0;  /* Number of ports in scm_port_table.  */
-long scm_port_table_room = 20; /* Size of the array.  */
+long scm_t_portable_size = 0;  /* Number of ports in scm_t_portable.  */
+long scm_t_portable_room = 20; /* Size of the array.  */
 
 /* Add a port to the table.  */
 
-scm_port_t *
+scm_t_port *
 scm_add_to_port_table (SCM port)
 #define FUNC_NAME "scm_add_to_port_table"
 {
-  scm_port_t *entry;
+  scm_t_port *entry;
 
-  if (scm_port_table_size == scm_port_table_room)
+  if (scm_t_portable_size == scm_t_portable_room)
     {
       /* initial malloc is in gc.c.  this doesn't use scm_must_malloc etc.,
         since it can never be freed during gc.  */
-      void *newt = realloc ((char *) scm_port_table,
-                           (size_t) (sizeof (scm_port_t *)
-                                        * scm_port_table_room * 2));
+      void *newt = realloc ((char *) scm_t_portable,
+                           (size_t) (sizeof (scm_t_port *)
+                                        * scm_t_portable_room * 2));
       if (newt == NULL)
        scm_memory_error ("scm_add_to_port_table");
-      scm_port_table = (scm_port_t **) newt;
-      scm_port_table_room *= 2;
+      scm_t_portable = (scm_t_port **) newt;
+      scm_t_portable_room *= 2;
     }
-  entry = (scm_port_t *) scm_must_malloc (sizeof (scm_port_t), FUNC_NAME);
+  entry = (scm_t_port *) scm_must_malloc (sizeof (scm_t_port), FUNC_NAME);
 
   entry->port = port;
-  entry->entry = scm_port_table_size;
+  entry->entry = scm_t_portable_size;
   entry->revealed = 0;
   entry->stream = 0;
   entry->file_name = SCM_BOOL_F;
@@ -461,8 +461,8 @@ scm_add_to_port_table (SCM port)
   entry->rw_active = SCM_PORT_NEITHER;
   entry->rw_random = 0;
 
-  scm_port_table[scm_port_table_size] = entry;
-  scm_port_table_size++;
+  scm_t_portable[scm_t_portable_size] = entry;
+  scm_t_portable_size++;
 
   return entry;
 }
@@ -474,23 +474,23 @@ void
 scm_remove_from_port_table (SCM port)
 #define FUNC_NAME "scm_remove_from_port_table"
 {
-  scm_port_t *p = SCM_PTAB_ENTRY (port);
+  scm_t_port *p = SCM_PTAB_ENTRY (port);
   long i = p->entry;
 
-  if (i >= scm_port_table_size)
+  if (i >= scm_t_portable_size)
     SCM_MISC_ERROR ("Port not in table: ~S", SCM_LIST1 (port));
   if (p->putback_buf)
     scm_must_free (p->putback_buf);
   scm_must_free (p);
   /* Since we have just freed slot i we can shrink the table by moving
      the last entry to that slot... */
-  if (i < scm_port_table_size - 1)
+  if (i < scm_t_portable_size - 1)
     {
-      scm_port_table[i] = scm_port_table[scm_port_table_size - 1];
-      scm_port_table[i]->entry = i;
+      scm_t_portable[i] = scm_t_portable[scm_t_portable_size - 1];
+      scm_t_portable[i]->entry = i;
     }
   SCM_SETPTAB_ENTRY (port, 0);
-  scm_port_table_size--;
+  scm_t_portable_size--;
 }
 #undef FUNC_NAME
 
@@ -504,7 +504,7 @@ SCM_DEFINE (scm_pt_size, "pt-size", 0, 0, 0,
            "is only included in @code{--enable-guile-debug} builds.")
 #define FUNC_NAME s_scm_pt_size
 {
-  return SCM_MAKINUM (scm_port_table_size);
+  return SCM_MAKINUM (scm_t_portable_size);
 }
 #undef FUNC_NAME
 
@@ -517,16 +517,16 @@ SCM_DEFINE (scm_pt_member, "pt-member", 1, 0, 0,
 {
   long i;
   SCM_VALIDATE_INUM_COPY (1,index,i);
-  if (i < 0 || i >= scm_port_table_size)
+  if (i < 0 || i >= scm_t_portable_size)
     return SCM_BOOL_F;
   else
-    return scm_port_table[i]->port;
+    return scm_t_portable[i]->port;
 }
 #undef FUNC_NAME
 #endif
 
 void
-scm_port_non_buffer (scm_port_t *pt)
+scm_port_non_buffer (scm_t_port *pt)
 {
   pt->read_pos = pt->read_buf = pt->read_end = &pt->shortbuf;
   pt->write_buf = pt->write_pos = &pt->shortbuf;
@@ -725,8 +725,8 @@ SCM_DEFINE (scm_port_for_each, "port-for-each", 1, 0, 0,
   SCM_DEFER_INTS;
   scm_block_gc++;
   ports = SCM_EOL;
-  for (i = 0; i < scm_port_table_size; i++)
-    ports = scm_cons (scm_port_table[i]->port, ports);
+  for (i = 0; i < scm_t_portable_size; i++)
+    ports = scm_cons (scm_t_portable[i]->port, ports);
   scm_block_gc--;
   SCM_ALLOW_INTS;
 
@@ -754,9 +754,9 @@ SCM_DEFINE (scm_close_all_ports_except, "close-all-ports-except", 0, 0, 1,
 {
   long i = 0;
   SCM_VALIDATE_REST_ARGUMENT (ports);
-  while (i < scm_port_table_size)
+  while (i < scm_t_portable_size)
     {
-      SCM thisport = scm_port_table[i]->port;
+      SCM thisport = scm_t_portable[i]->port;
       int found = 0;
       SCM ports_ptr = ports;
 
@@ -874,10 +874,10 @@ SCM_DEFINE (scm_flush_all_ports, "flush-all-ports", 0, 0, 0,
 {
   size_t i;
 
-  for (i = 0; i < scm_port_table_size; i++)
+  for (i = 0; i < scm_t_portable_size; i++)
     {
-      if (SCM_OPOUTPORTP (scm_port_table[i]->port))
-       scm_flush (scm_port_table[i]->port);
+      if (SCM_OPOUTPORTP (scm_t_portable[i]->port))
+       scm_flush (scm_t_portable[i]->port);
     }
   return SCM_UNSPECIFIED;
 }
@@ -907,7 +907,7 @@ SCM_DEFINE (scm_read_char, "read-char", 0, 1, 0,
 int
 scm_fill_input (SCM port)
 {
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
 
   if (pt->read_buf == pt->putback_buf)
     {
@@ -926,7 +926,7 @@ int
 scm_getc (SCM port)
 {
   int c;
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
 
   if (pt->rw_active == SCM_PORT_WRITE)
     {
@@ -981,8 +981,8 @@ scm_puts (const char *s, SCM port)
 void 
 scm_lfwrite (const char *ptr, size_t size, SCM port)
 {
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
-  scm_ptob_descriptor_t *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
+  scm_t_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
 
   if (pt->rw_active == SCM_PORT_READ)
     scm_end_input (port);
@@ -1016,7 +1016,7 @@ scm_lfwrite (const char *ptr, size_t size, SCM port)
 size_t
 scm_c_read (SCM port, void *buffer, size_t size)
 {
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
   size_t n_read = 0, n_available;
 
   if (pt->rw_active == SCM_PORT_WRITE)
@@ -1069,8 +1069,8 @@ scm_c_read (SCM port, void *buffer, size_t size)
 void 
 scm_c_write (SCM port, const void *ptr, size_t size)
 {
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
-  scm_ptob_descriptor_t *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
+  scm_t_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
 
   if (pt->rw_active == SCM_PORT_READ)
     scm_end_input (port);
@@ -1092,7 +1092,7 @@ void
 scm_end_input (SCM port)
 {
   long offset;
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
 
   if (pt->read_buf == pt->putback_buf)
     {
@@ -1115,7 +1115,7 @@ void
 scm_ungetc (int c, SCM port)
 #define FUNC_NAME "scm_ungetc"
 {
-  scm_port_t *pt = SCM_PTAB_ENTRY (port);
+  scm_t_port *pt = SCM_PTAB_ENTRY (port);
 
   if (pt->read_buf == pt->putback_buf)
     /* already using the put-back buffer.  */
@@ -1311,7 +1311,7 @@ SCM_DEFINE (scm_seek, "seek", 3, 0, 0,
     SCM_OUT_OF_RANGE (3, whence);
   if (SCM_OPPORTP (fd_port))
     {
-      scm_ptob_descriptor_t *ptob = scm_ptobs + SCM_PTOBNUM (fd_port);
+      scm_t_ptob_descriptor *ptob = scm_ptobs + SCM_PTOBNUM (fd_port);
 
       if (!ptob->seek)
        SCM_MISC_ERROR ("port is not seekable", 
@@ -1364,8 +1364,8 @@ SCM_DEFINE (scm_truncate_file, "truncate-file", 1, 1, 0,
     }
   else if (SCM_OPOUTPORTP (object))
     {
-      scm_port_t *pt = SCM_PTAB_ENTRY (object);
-      scm_ptob_descriptor_t *ptob = scm_ptobs + SCM_PTOBNUM (object);
+      scm_t_port *pt = SCM_PTAB_ENTRY (object);
+      scm_t_ptob_descriptor *ptob = scm_ptobs + SCM_PTOBNUM (object);
       
       if (!ptob->truncate)
        SCM_MISC_ERROR ("port is not truncatable", SCM_EOL);
@@ -1514,14 +1514,14 @@ void
 scm_ports_prehistory ()
 {
   scm_numptob = 0;
-  scm_ptobs = (scm_ptob_descriptor_t *) malloc (sizeof (scm_ptob_descriptor_t));
+  scm_ptobs = (scm_t_ptob_descriptor *) malloc (sizeof (scm_t_ptob_descriptor));
 }
 
 \f
 
 /* Void ports.   */
 
-scm_bits_t scm_tc16_void_port = 0;
+scm_t_bits scm_tc16_void_port = 0;
 
 static int fill_input_void_port (SCM port SCM_UNUSED)
 {
@@ -1540,7 +1540,7 @@ scm_void_port (char *mode_str)
 {
   int mode_bits;
   SCM answer;
-  scm_port_t * pt;
+  scm_t_port * pt;
 
   SCM_NEWCELL (answer);
   SCM_DEFER_INTS;