remove pic->xSTDXX

This commit is contained in:
Yuichi Nishiwaki 2015-06-18 22:59:22 +09:00
parent 0fe4df3c15
commit 61ff69b968
4 changed files with 8 additions and 28 deletions

View File

@ -617,17 +617,6 @@ gc_mark_phase(pic_state *pic)
/* library table */
gc_mark(pic, pic->libs);
/* standard I/O ports */
if (pic->xSTDIN) {
gc_mark_object(pic, (struct pic_object *)pic->xSTDIN);
}
if (pic->xSTDOUT) {
gc_mark_object(pic, (struct pic_object *)pic->xSTDOUT);
}
if (pic->xSTDERR) {
gc_mark_object(pic, (struct pic_object *)pic->xSTDERR);
}
/* parameter table */
gc_mark(pic, pic->ptable);

View File

@ -143,12 +143,9 @@ typedef struct {
size_t arena_size, arena_idx;
struct pic_reg *regs;
struct pic_port *xSTDIN, *xSTDOUT, *xSTDERR;
pic_value err;
pic_code *iseq; /* for pic_apply_trampoline */
char *native_stack_start;
} pic_state;
@ -257,7 +254,7 @@ pic_value pic_display(pic_state *, pic_value);
pic_value pic_fdisplay(pic_state *, pic_value, xFILE *);
#if DEBUG
# define pic_debug(pic,obj) pic_fwrite(pic,obj,pic->xSTDERR->file)
# define pic_debug(pic,obj) pic_fwrite(pic,obj,xstderr)
# define pic_fdebug(pic,obj,file) pic_fwrite(pic,obj,file)
#endif

View File

@ -773,9 +773,13 @@ pic_port_flush(pic_state *pic)
void
pic_init_port(pic_state *pic)
{
pic_defvar(pic, "current-input-port", pic_obj_value(pic->xSTDIN), NULL);
pic_defvar(pic, "current-output-port", pic_obj_value(pic->xSTDOUT), NULL);
pic_defvar(pic, "current-error-port", pic_obj_value(pic->xSTDERR), NULL);
struct pic_port *xSTDIN = pic_make_standard_port(pic, xstdin, PIC_PORT_IN);
struct pic_port *xSTDOUT = pic_make_standard_port(pic, xstdout, PIC_PORT_OUT);
struct pic_port *xSTDERR = pic_make_standard_port(pic, xstderr, PIC_PORT_OUT);
pic_defvar(pic, "current-input-port", pic_obj_value(xSTDIN), NULL);
pic_defvar(pic, "current-output-port", pic_obj_value(xSTDOUT), NULL);
pic_defvar(pic, "current-error-port", pic_obj_value(xSTDERR), NULL);
pic_defun(pic, "call-with-port", pic_port_call_with_port);

View File

@ -254,11 +254,6 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
/* raised error object */
pic->err = pic_invalid_value();
/* standard ports */
pic->xSTDIN = NULL;
pic->xSTDOUT = NULL;
pic->xSTDERR = NULL;
/* parameter table */
pic->ptable = pic_nil_value();
@ -372,11 +367,6 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
/* reader */
pic->reader = pic_reader_open(pic);
/* standard I/O */
pic->xSTDIN = pic_make_standard_port(pic, xstdin, PIC_PORT_IN);
pic->xSTDOUT = pic_make_standard_port(pic, xstdout, PIC_PORT_OUT);
pic->xSTDERR = pic_make_standard_port(pic, xstderr, PIC_PORT_OUT);
/* parameter table */
pic->ptable = pic_cons(pic, pic_obj_value(pic_make_dict(pic)), pic->ptable);