\f
/* The port table --- an array of pointers to ports. */
-scm_t_port **scm_t_portable;
+scm_t_port **scm_port_table;
-long scm_t_portable_size = 0; /* Number of ports in scm_t_portable. */
-long scm_t_portable_room = 20; /* Size of the array. */
+long scm_port_table_size = 0; /* Number of ports in scm_port_table. */
+long scm_port_table_room = 20; /* Size of the array. */
/* Add a port to the table. */
{
scm_t_port *entry;
- if (scm_t_portable_size == scm_t_portable_room)
+ if (scm_port_table_size == scm_port_table_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_t_portable,
+ void *newt = realloc ((char *) scm_port_table,
(size_t) (sizeof (scm_t_port *)
- * scm_t_portable_room * 2));
+ * scm_port_table_room * 2));
if (newt == NULL)
scm_memory_error ("scm_add_to_port_table");
- scm_t_portable = (scm_t_port **) newt;
- scm_t_portable_room *= 2;
+ scm_port_table = (scm_t_port **) newt;
+ scm_port_table_room *= 2;
}
entry = (scm_t_port *) scm_must_malloc (sizeof (scm_t_port), FUNC_NAME);
entry->port = port;
- entry->entry = scm_t_portable_size;
+ entry->entry = scm_port_table_size;
entry->revealed = 0;
entry->stream = 0;
entry->file_name = SCM_BOOL_F;
entry->rw_active = SCM_PORT_NEITHER;
entry->rw_random = 0;
- scm_t_portable[scm_t_portable_size] = entry;
- scm_t_portable_size++;
+ scm_port_table[scm_port_table_size] = entry;
+ scm_port_table_size++;
return entry;
}
scm_t_port *p = SCM_PTAB_ENTRY (port);
long i = p->entry;
- if (i >= scm_t_portable_size)
+ if (i >= scm_port_table_size)
SCM_MISC_ERROR ("Port not in table: ~S", scm_list_1 (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_t_portable_size - 1)
+ if (i < scm_port_table_size - 1)
{
- scm_t_portable[i] = scm_t_portable[scm_t_portable_size - 1];
- scm_t_portable[i]->entry = i;
+ scm_port_table[i] = scm_port_table[scm_port_table_size - 1];
+ scm_port_table[i]->entry = i;
}
SCM_SETPTAB_ENTRY (port, 0);
- scm_t_portable_size--;
+ scm_port_table_size--;
}
#undef FUNC_NAME
"is only included in @code{--enable-guile-debug} builds.")
#define FUNC_NAME s_scm_pt_size
{
- return SCM_MAKINUM (scm_t_portable_size);
+ return SCM_MAKINUM (scm_port_table_size);
}
#undef FUNC_NAME
{
long i;
SCM_VALIDATE_INUM_COPY (1,index,i);
- if (i < 0 || i >= scm_t_portable_size)
+ if (i < 0 || i >= scm_port_table_size)
return SCM_BOOL_F;
else
- return scm_t_portable[i]->port;
+ return scm_port_table[i]->port;
}
#undef FUNC_NAME
#endif
SCM_DEFER_INTS;
scm_block_gc++;
ports = SCM_EOL;
- for (i = 0; i < scm_t_portable_size; i++)
- ports = scm_cons (scm_t_portable[i]->port, ports);
+ for (i = 0; i < scm_port_table_size; i++)
+ ports = scm_cons (scm_port_table[i]->port, ports);
scm_block_gc--;
SCM_ALLOW_INTS;
{
long i = 0;
SCM_VALIDATE_REST_ARGUMENT (ports);
- while (i < scm_t_portable_size)
+ while (i < scm_port_table_size)
{
- SCM thisport = scm_t_portable[i]->port;
+ SCM thisport = scm_port_table[i]->port;
int found = 0;
SCM ports_ptr = ports;
{
size_t i;
- for (i = 0; i < scm_t_portable_size; i++)
+ for (i = 0; i < scm_port_table_size; i++)
{
- if (SCM_OPOUTPORTP (scm_t_portable[i]->port))
- scm_flush (scm_t_portable[i]->port);
+ if (SCM_OPOUTPORTP (scm_port_table[i]->port))
+ scm_flush (scm_port_table[i]->port);
}
return SCM_UNSPECIFIED;
}