216 |
= scm_make_struct (scm_print_state_vtable, SCM_INUM0, SCM_EOL); |
= scm_make_struct (scm_print_state_vtable, SCM_INUM0, SCM_EOL); |
217 |
scm_print_state *pstate = SCM_PRINT_STATE (print_state); |
scm_print_state *pstate = SCM_PRINT_STATE (print_state); |
218 |
pstate->ref_vect = scm_c_make_vector (PSTATE_SIZE, SCM_UNDEFINED); |
pstate->ref_vect = scm_c_make_vector (PSTATE_SIZE, SCM_UNDEFINED); |
219 |
pstate->ref_stack = SCM_VELTS (pstate->ref_vect); |
pstate->ref_stack = SCM_WRITABLE_VELTS (pstate->ref_vect); |
220 |
pstate->ceiling = SCM_VECTOR_LENGTH (pstate->ref_vect); |
pstate->ceiling = SCM_VECTOR_LENGTH (pstate->ref_vect); |
221 |
return print_state; |
return print_state; |
222 |
} |
} |
260 |
grow_ref_stack (scm_print_state *pstate) |
grow_ref_stack (scm_print_state *pstate) |
261 |
{ |
{ |
262 |
unsigned long int old_size = SCM_VECTOR_LENGTH (pstate->ref_vect); |
unsigned long int old_size = SCM_VECTOR_LENGTH (pstate->ref_vect); |
263 |
SCM *old_elts = SCM_VELTS (pstate->ref_vect); |
SCM const *old_elts = SCM_VELTS (pstate->ref_vect); |
264 |
unsigned long int new_size = 2 * pstate->ceiling; |
unsigned long int new_size = 2 * pstate->ceiling; |
265 |
SCM new_vect = scm_c_make_vector (new_size, SCM_UNDEFINED); |
SCM new_vect = scm_c_make_vector (new_size, SCM_UNDEFINED); |
|
SCM *new_elts = SCM_VELTS (new_vect); |
|
266 |
unsigned long int i; |
unsigned long int i; |
267 |
|
|
268 |
for (i = 0; i != old_size; ++i) |
for (i = 0; i != old_size; ++i) |
269 |
new_elts [i] = old_elts [i]; |
SCM_VECTOR_SET (new_vect, i, old_elts [i]); |
270 |
|
|
271 |
pstate->ref_vect = new_vect; |
pstate->ref_vect = new_vect; |
272 |
pstate->ref_stack = new_elts; |
pstate->ref_stack = SCM_WRITABLE_VELTS(new_vect); |
273 |
pstate->ceiling = new_size; |
pstate->ceiling = new_size; |
274 |
} |
} |
275 |
|
|
276 |
|
|
277 |
static void |
static void |
278 |
print_circref (SCM port,scm_print_state *pstate,SCM ref) |
print_circref (SCM port, scm_print_state *pstate, SCM ref) |
279 |
{ |
{ |
280 |
register long i; |
register long i; |
281 |
long self = pstate->top - 1; |
long self = pstate->top - 1; |
756 |
/* Print a list. |
/* Print a list. |
757 |
*/ |
*/ |
758 |
void |
void |
759 |
scm_iprlist (char *hdr,SCM exp,int tlr,SCM port,scm_print_state *pstate) |
scm_iprlist (char *hdr, SCM exp, int tlr, SCM port, scm_print_state *pstate) |
760 |
{ |
{ |
761 |
register SCM hare, tortoise; |
register SCM hare, tortoise; |
762 |
long floor = pstate->top - 2; |
long floor = pstate->top - 2; |
1011 |
if (SCM_UNBNDP (port)) |
if (SCM_UNBNDP (port)) |
1012 |
port = scm_cur_outp; |
port = scm_cur_outp; |
1013 |
|
|
1014 |
SCM_VALIDATE_OPORT_VALUE (1,port); |
SCM_VALIDATE_OPORT_VALUE (1, port); |
1015 |
|
|
1016 |
scm_putc ('\n', SCM_COERCE_OUTPORT (port)); |
scm_putc ('\n', SCM_COERCE_OUTPORT (port)); |
1017 |
return SCM_UNSPECIFIED; |
return SCM_UNSPECIFIED; |
1026 |
if (SCM_UNBNDP (port)) |
if (SCM_UNBNDP (port)) |
1027 |
port = scm_cur_outp; |
port = scm_cur_outp; |
1028 |
|
|
1029 |
SCM_VALIDATE_CHAR (1,chr); |
SCM_VALIDATE_CHAR (1, chr); |
1030 |
SCM_VALIDATE_OPORT_VALUE (2,port); |
SCM_VALIDATE_OPORT_VALUE (2, port); |
1031 |
|
|
1032 |
scm_putc ((int) SCM_CHAR (chr), SCM_COERCE_OUTPORT (port)); |
scm_putc ((int) SCM_CHAR (chr), SCM_COERCE_OUTPORT (port)); |
1033 |
#ifdef HAVE_PIPE |
#ifdef HAVE_PIPE |
1078 |
#define FUNC_NAME s_scm_port_with_print_state |
#define FUNC_NAME s_scm_port_with_print_state |
1079 |
{ |
{ |
1080 |
SCM pwps; |
SCM pwps; |
1081 |
SCM_VALIDATE_OPORT_VALUE (1,port); |
SCM_VALIDATE_OPORT_VALUE (1, port); |
1082 |
SCM_VALIDATE_PRINTSTATE (2,pstate); |
SCM_VALIDATE_PRINTSTATE (2, pstate); |
1083 |
port = SCM_COERCE_OUTPORT (port); |
port = SCM_COERCE_OUTPORT (port); |
1084 |
SCM_NEWSMOB (pwps, scm_tc16_port_with_ps, SCM_UNPACK (scm_cons (port, pstate))); |
SCM_NEWSMOB (pwps, scm_tc16_port_with_ps, SCM_UNPACK (scm_cons (port, pstate))); |
1085 |
return pwps; |
return pwps; |