diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1999-08-24 02:12:06 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1999-08-24 02:12:06 +0000 |
commit | edf204921245c35e345f88c3594f3e996c442171 (patch) | |
tree | 092a26f26e96aac87817d89e5affa7302dc77579 /libguile/print.h | |
parent | c19bc0882338697785b685e722b32169b4ec8678 (diff) | |
download | guile-edf204921245c35e345f88c3594f3e996c442171.tar.gz |
* print.h (SCM_PORT_WITH_PS_P, SCM_PORT_WITH_PS_PORT,
SCM_PORT_WITH_PS_PS): Represent ports with print states as a smob
instead of a pair of a port and a print state. We'll need to cons
once extra in scm_printer_apply but the type system will be
cleaner, it will mix better with GOOPS, and, it will be even more
transparent to the user.
Diffstat (limited to 'libguile/print.h')
-rw-r--r-- | libguile/print.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libguile/print.h b/libguile/print.h index 149d9767a..2701153be 100644 --- a/libguile/print.h +++ b/libguile/print.h @@ -70,10 +70,12 @@ extern scm_option scm_print_opts[]; #define SCM_WRITINGP(pstate) ((pstate)->writingp) #define SCM_SET_WRITINGP(pstate, x) { (pstate)->writingp = (x); } -#define SCM_COERCE_OUTPORT(p) ((SCM_NIMP (p) \ - && SCM_CONSP (p) \ - && SCM_PRINT_STATE_P (SCM_CDR (p))) \ - ? SCM_CAR (p) \ +#define SCM_PORT_WITH_PS_P(p) (SCM_TYP16 (p) == scm_tc16_port_with_ps) +#define SCM_PORT_WITH_PS_PORT(p) SCM_CADR (p) +#define SCM_PORT_WITH_PS_PS(p) SCM_CDDR (p) + +#define SCM_COERCE_OUTPORT(p) (SCM_NIMP (p) && SCM_PORT_WITH_PS_P (p) \ + ? SCM_PORT_WITH_PS_PORT (p) \ : p) #define SCM_PRINT_STATE_LAYOUT "sruwuwuwuwuwpwuwuwuruopr" @@ -95,6 +97,8 @@ typedef struct scm_print_state { extern SCM scm_print_state_vtable; +extern SCM scm_tc16_port_with_ps; + extern SCM scm_print_options SCM_P ((SCM setting)); SCM scm_make_print_state SCM_P ((void)); void scm_free_print_state SCM_P ((SCM print_state)); @@ -109,6 +113,8 @@ extern SCM scm_newline SCM_P ((SCM port)); extern SCM scm_write_char SCM_P ((SCM chr, SCM port)); extern SCM scm_printer_apply SCM_P ((SCM proc, SCM exp, SCM port, scm_print_state *)); +extern SCM scm_port_with_print_state (SCM port, SCM pstate); +extern SCM scm_get_print_state (SCM port); extern int scm_valid_oport_value_p SCM_P ((SCM val)); extern void scm_init_print SCM_P ((void)); |