mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
Utterly needless cleanups to hopelessly messy code.
* ports.c: Doc fixes. (scm_fflush): Moved to ... * genio.c (scm_fflush): ... here, amongst all the other port method invocation functions. * genio.h, ports.h: The prototype moves too.
This commit is contained in:
parent
71f2053493
commit
d68fee4833
4 changed files with 33 additions and 22 deletions
|
@ -90,6 +90,14 @@ scm_lfwrite (ptr, size, port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
scm_fflush (port)
|
||||||
|
SCM port;
|
||||||
|
{
|
||||||
|
scm_sizet i = SCM_PTOBNUM (port);
|
||||||
|
(scm_ptobs[i].fflush) (SCM_STREAM (port));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
extern void scm_putc SCM_P ((int c, SCM port));
|
extern void scm_putc SCM_P ((int c, SCM port));
|
||||||
extern void scm_puts SCM_P ((char *str_data, SCM port));
|
extern void scm_puts SCM_P ((char *str_data, SCM port));
|
||||||
extern void scm_lfwrite SCM_P ((char *ptr, scm_sizet size, SCM port));
|
extern void scm_lfwrite SCM_P ((char *ptr, scm_sizet size, SCM port));
|
||||||
|
extern void scm_fflush SCM_P ((SCM port));
|
||||||
extern int scm_getc SCM_P ((SCM port));
|
extern int scm_getc SCM_P ((SCM port));
|
||||||
extern void scm_ungetc SCM_P ((int c, SCM port));
|
extern void scm_ungetc SCM_P ((int c, SCM port));
|
||||||
/* FIXME: this is a terrible name. */
|
/* FIXME: this is a terrible name. */
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
* whether to permit this exception to apply to your modifications.
|
* whether to permit this exception to apply to your modifications.
|
||||||
* If you do not wish that, delete this exception notice. */
|
* If you do not wish that, delete this exception notice. */
|
||||||
|
|
||||||
|
/* Headers. */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "_scm.h"
|
#include "_scm.h"
|
||||||
#include "genio.h"
|
#include "genio.h"
|
||||||
|
@ -64,7 +66,9 @@
|
||||||
#ifdef HAVE_SYS_IOCTL_H
|
#ifdef HAVE_SYS_IOCTL_H
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* The port kind table --- a dynamically resized array of port types. */
|
||||||
|
|
||||||
|
|
||||||
/* scm_ptobs scm_numptob
|
/* scm_ptobs scm_numptob
|
||||||
|
@ -121,17 +125,6 @@ scm_newptob (ptob)
|
||||||
return scm_tc7_port + (scm_numptob - 1) * 256;
|
return scm_tc7_port + (scm_numptob - 1) * 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* internal SCM call */
|
|
||||||
|
|
||||||
void
|
|
||||||
scm_fflush (port)
|
|
||||||
SCM port;
|
|
||||||
{
|
|
||||||
scm_sizet i = SCM_PTOBNUM (port);
|
|
||||||
(scm_ptobs[i].fflush) (SCM_STREAM (port));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SCM_PROC(s_char_ready_p, "char-ready?", 0, 1, 0, scm_char_ready_p);
|
SCM_PROC(s_char_ready_p, "char-ready?", 0, 1, 0, scm_char_ready_p);
|
||||||
|
@ -143,7 +136,9 @@ scm_char_ready_p (port)
|
||||||
if (SCM_UNBNDP (port))
|
if (SCM_UNBNDP (port))
|
||||||
port = scm_cur_inp;
|
port = scm_cur_inp;
|
||||||
else
|
else
|
||||||
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1, s_char_ready_p);
|
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1,
|
||||||
|
s_char_ready_p);
|
||||||
|
|
||||||
if (SCM_CRDYP (port) || !SCM_FPORTP (port))
|
if (SCM_CRDYP (port) || !SCM_FPORTP (port))
|
||||||
return SCM_BOOL_T;
|
return SCM_BOOL_T;
|
||||||
return (scm_input_waiting_p ((FILE *) SCM_STREAM (port), s_char_ready_p)
|
return (scm_input_waiting_p ((FILE *) SCM_STREAM (port), s_char_ready_p)
|
||||||
|
@ -153,10 +148,8 @@ scm_char_ready_p (port)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Standard ports --- current input, output, error, and more(!). */
|
||||||
|
|
||||||
|
|
||||||
/* {Standard Ports}
|
|
||||||
*/
|
|
||||||
SCM_PROC(s_current_input_port, "current-input-port", 0, 0, 0, scm_current_input_port);
|
SCM_PROC(s_current_input_port, "current-input-port", 0, 0, 0, scm_current_input_port);
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
|
@ -230,10 +223,7 @@ scm_set_current_error_port (port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* The port table --- a table of all the open ports. */
|
||||||
/* {Ports - in general}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Array of open ports, required for reliable MOVE->FDES etc. */
|
/* Array of open ports, required for reliable MOVE->FDES etc. */
|
||||||
struct scm_port_table **scm_port_table;
|
struct scm_port_table **scm_port_table;
|
||||||
|
@ -317,6 +307,9 @@ scm_pt_member (member)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Revealed counts --- an oddity inherited from SCSH. */
|
||||||
|
|
||||||
/* Find a port in the table and return its revealed count.
|
/* Find a port in the table and return its revealed count.
|
||||||
Also used by the garbage collector.
|
Also used by the garbage collector.
|
||||||
*/
|
*/
|
||||||
|
@ -360,6 +353,10 @@ scm_set_port_revealed_x (port, rcount)
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Retrieving a port's mode. */
|
||||||
|
|
||||||
/* Return the flags that characterize a port based on the mode
|
/* Return the flags that characterize a port based on the mode
|
||||||
* string used to open a file for that port.
|
* string used to open a file for that port.
|
||||||
*
|
*
|
||||||
|
@ -408,6 +405,9 @@ scm_port_mode (port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Closing ports. */
|
||||||
|
|
||||||
/* scm_close_port
|
/* scm_close_port
|
||||||
* Call the close operation on a port object.
|
* Call the close operation on a port object.
|
||||||
* see also scm_close.
|
* see also scm_close.
|
||||||
|
@ -478,6 +478,10 @@ scm_close_all_ports_except (ports)
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Utter miscellany. Gosh, we should clean this up some time. */
|
||||||
|
|
||||||
SCM_PROC(s_input_port_p, "input-port?", 1, 0, 0, scm_input_port_p);
|
SCM_PROC(s_input_port_p, "input-port?", 1, 0, 0, scm_input_port_p);
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
|
@ -823,8 +827,7 @@ scm_ports_prehistory ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* {Void Ports}
|
/* Void ports. */
|
||||||
*/
|
|
||||||
|
|
||||||
int scm_tc16_void_port = 0;
|
int scm_tc16_void_port = 0;
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,6 @@ extern int scm_port_table_room;
|
||||||
|
|
||||||
extern SCM scm_markstream SCM_P ((SCM ptr));
|
extern SCM scm_markstream SCM_P ((SCM ptr));
|
||||||
extern long scm_newptob SCM_P ((scm_ptobfuns *ptob));
|
extern long scm_newptob SCM_P ((scm_ptobfuns *ptob));
|
||||||
extern void scm_fflush SCM_P ((SCM port));
|
|
||||||
extern SCM scm_char_ready_p SCM_P ((SCM port));
|
extern SCM scm_char_ready_p SCM_P ((SCM port));
|
||||||
extern SCM scm_current_input_port SCM_P ((void));
|
extern SCM scm_current_input_port SCM_P ((void));
|
||||||
extern SCM scm_current_output_port SCM_P ((void));
|
extern SCM scm_current_output_port SCM_P ((void));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue