Add line/column numbers to port type

This commit is contained in:
Justin Ethier 2017-08-11 10:13:39 +00:00
parent 28952d1056
commit a9e0d86fea
3 changed files with 9 additions and 3 deletions

2
gc.c
View file

@ -486,6 +486,8 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd)
hp->fp = ((port_type *) obj)->fp;
hp->mode = ((port_type *) obj)->mode;
hp->flags = ((port_type *) obj)->flags;
hp->line_num = ((port_type *) obj)->line_num;
hp->col_num = ((port_type *) obj)->col_num;
hp->mem_buf = ((port_type *)obj)->mem_buf;
hp->mem_buf_len = ((port_type *)obj)->mem_buf_len;
return (char *)hp;

View file

@ -779,8 +779,8 @@ typedef struct {
FILE *fp;
int mode;
unsigned char flags;
// TODO: int line_num;
// TODO: int char_num;
unsigned int line_num;
unsigned int col_num;
char *mem_buf;
size_t mem_buf_len;
} port_type;
@ -796,6 +796,8 @@ typedef struct {
p.fp = f; \
p.mode = m; \
p.flags = 0; \
p.line_num = 0; \
p.col_num = 0; \
p.mem_buf = NULL; \
p.mem_buf_len = 0;
@ -807,6 +809,8 @@ typedef struct {
p.fp = f; \
p.mode = m; \
p.flags = 1; \
p.line_num = 0; \
p.col_num = 0; \
p.mem_buf = malloc(IO_BUF_LEN); \
p.mem_buf_len = 0;

View file

@ -5678,6 +5678,6 @@ void Cyc_import_shared_object(void *data, object cont, object filename, object e
void Cyc_read(void *data, object cont, object port)
{
//Cyc_check_port(data, port);
port_type *p = (port_type *)port;
//port_type *p = (port_type *)port;
}