diff options
Diffstat (limited to 'scm.h')
-rw-r--r-- | scm.h | 86 |
1 files changed, 46 insertions, 40 deletions
@@ -1,4 +1,4 @@ -/* Copyright (C) 1990-1999 Free Software Foundation, Inc. +/* Copyright (C) 1990-2006 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -169,30 +169,30 @@ typedef struct {SCM type;double *real;} dbl; /* Conditionals should always expect immediates */ /* GCC __builtin_expect() is stubbed in scmfig.h */ -#define IMP(x) SCM_EXPECT_TRUE(6 & (int)(x)) +#define IMP(x) SCM_EXPECT_TRUE(6 & PTR2INT(x)) #define NIMP(x) (!IMP(x)) -#define INUMP(x) SCM_EXPECT_TRUE(2 & (int)(x)) +#define INUMP(x) SCM_EXPECT_TRUE(2 & PTR2INT(x)) #define NINUMP(x) (!INUMP(x)) #define INUM0 ((SCM) 2) -#define ICHRP(x) ((0xff & (int)(x))==0xf4) +#define ICHRP(x) ((0xff & PTR2INT(x))==0xf4) #define ICHR(x) ((unsigned char)((x)>>8)) #define MAKICHR(x) (((x)<<8)+0xf4L) #define ILOC00 (0x000000fcL) -#define ILOCP(n) ((0xff & (int)(n))==(int)ILOC00) +#define ILOCP(n) ((0xff & PTR2INT(n))==PTR2INT(ILOC00)) #define MAKILOC(if, id) (ILOC00 + (((long)id)<<8) + (((long)if)<<16)) -#define IDIST(n) (((int)(n)>>8) & 0x7f) -#define IFRAME(n) (((int)(n)>>16)) +#define IDIST(n) ((PTR2INT(n)>>8) & 0x7f) +#define IFRAME(n) ((PTR2INT(n)>>16)) #define ICDRP(n) (ICDR & (n)) #define ICDR (1L<<15) /* ISYMP tests for ISPCSYM and ISYM */ -#define ISYMP(n) ((0x187 & (int)(n))==4) +#define ISYMP(n) ((0x187 & PTR2INT(n))==4) /* IFLAGP tests for ISPCSYM, ISYM and IFLAG */ -#define IFLAGP(n) ((0x87 & (int)(n))==4) -#define ISYMNUM(n) (((int)((n)>>9)) & 0x7f) -#define ISYMVAL(n) ((int)((n)>>16)) +#define IFLAGP(n) ((0x87 & PTR2INT(n))==4) +#define ISYMNUM(n) ((PTR2INT((n)>>9)) & 0x7f) +#define ISYMVAL(n) (PTR2INT((n)>>16)) #define MAKISYMVAL(isym, val) ((isym) | ((long)(val) <<16)) #define ISYMCHARS(n) (isymnames[ISYMNUM(n)]) #define MAKSPCSYM(n) (((n)<<9)+((n)<<3)+4L) @@ -299,26 +299,26 @@ SCM_EXPORT SCM i_dot, i_quote, i_quasiquote, i_unquote, i_uq_splicing; #define NNULLP(x) (EOL != (x)) #define UNBNDP(x) (UNDEFINED==(x)) #define CELLP(x) (!NCELLP(x)) -#define NCELLP(x) ((sizeof(cell)-1) & (int)(x)) +#define NCELLP(x) ((sizeof(cell)-1) & PTR2INT(x)) -#define GCMARKP(x) (1 & (int)CDR(x)) -#define GC8MARKP(x) (0x80 & (int)CAR(x)) +#define GCMARKP(x) (1 & PTR2INT(CDR(x))) +#define GC8MARKP(x) (0x80 & PTR2INT(CAR(x))) #define SETGCMARK(x) CDR(x) |= 1; #define CLRGCMARK(x) CDR(x) &= ~1L; #define SETGC8MARK(x) CAR(x) |= 0x80; #define CLRGC8MARK(x) CAR(x) &= ~0x80L; -#define TYP3(x) (7 & (int)CAR(x)) -#define TYP7(x) (0x7f & (int)CAR(x)) -#define TYP7S(x) (0x7d & (int)CAR(x)) -#define TYP16(x) (0xffff & (int)CAR(x)) -#define TYP16S(x) (0xfeff & (int)CAR(x)) -#define GCTYP16(x) (0xff7f & (int)CAR(x)) - -#define NCONSP(x) (1 & (int)CAR(x)) +#define TYP3(x) (7 & PTR2INT(CAR(x))) +#define TYP7(x) (0x7f & PTR2INT(CAR(x))) +#define TYP7S(x) (0x7d & PTR2INT(CAR(x))) +#define TYP16(x) (0xffff & PTR2INT(CAR(x))) +#define TYP16S(x) (0xfeff & PTR2INT(CAR(x))) +#define GCTYP16(x) (0xff7f & PTR2INT(CAR(x))) + +#define NCONSP(x) (1 & PTR2INT(CAR(x))) #define CONSP(x) (!NCONSP(x)) #define ECONSP(x) (CONSP(x) || (1==TYP3(x))) #define NECONSP(x) (NCONSP(x) && (1 != TYP3(x))) -#define SCM_GLOCP(x) (tc3_cons_gloc==(7 & (int)(x))) +#define SCM_GLOCP(x) (tc3_cons_gloc==(7 & PTR2INT(x))) #define CAR(x) (((cell *)(SCM2PTR(x)))->car) #define CDR(x) (((cell *)(SCM2PTR(x)))->cdr) @@ -425,9 +425,9 @@ SCM_EXPORT long tc16_env, tc16_ident; # define NUMBERP INUMP # endif #endif -#define NUMP(x) ((0xfcff & (int)CAR(x))==tc7_smob) +#define NUMP(x) ((0xfcff & PTR2INT(CAR(x)))==tc7_smob) #define BIGP(x) (TYP16S(x)==tc16_bigpos) -#define BIGSIGN(x) (0x0100 & (int)CAR(x)) +#define BIGSIGN(x) (0x0100 & PTR2INT(CAR(x))) #define BDIGITS(x) ((BIGDIG *)(CDR(x))) #define NUMDIGS(x) ((sizet)(((unsigned long)CAR(x))>>16)) #define MAKE_NUMDIGS(v, t) ((((v)+0L)<<16)+(t)) @@ -462,7 +462,7 @@ SCM_EXPORT long tc16_array; /*#define ARRAY_NDIM(x) NUMDIGS(x)*/ #define ARRAY_NDIM(x) ((sizet)(CAR(x)>>17)) #define ARRAY_CONTIGUOUS 0x10000 -#define ARRAY_CONTP(x) (ARRAY_CONTIGUOUS & (int)CAR(x)) +#define ARRAY_CONTP(x) (ARRAY_CONTIGUOUS & PTR2INT(CAR(x))) #define ARRAY_BASE(a) (((array *)CDR(a))->base) #define ARRAY_DIMS(a) ((array_dim *)(CHARS(a)+sizeof(array))) @@ -728,7 +728,8 @@ SCM_EXPORT SCM obunhash P((SCM obj)); SCM_EXPORT unsigned long strhash P((unsigned char *str, sizet len, unsigned long n)); SCM_EXPORT unsigned long hasher P((SCM obj, unsigned long n, sizet d)); SCM_EXPORT SCM lroom P((SCM args)); -SCM_EXPORT SCM lflush P((SCM port)); +SCM_EXPORT void lfflush P((SCM port)); +SCM_EXPORT SCM scm_force_output P((SCM port)); SCM_EXPORT void scm_init_gra P((scm_gra *gra, sizet eltsize, sizet len, sizet maxlen, const char *what)); SCM_EXPORT int scm_grow_gra P((scm_gra *gra, char *elt)); @@ -760,9 +761,9 @@ SCM_EXPORT SCM scm_scope_trace P((SCM env)); SCM_EXPORT SCM scm_frame_trace P((SCM contin, SCM nf)); SCM_EXPORT SCM scm_frame2env P((SCM contin, SCM nf)); SCM_EXPORT SCM scm_frame_eval P((SCM contin, SCM nf, SCM expr)); -SCM_EXPORT void iprin1 P((SCM exp, SCM port, int writing)); -SCM_EXPORT void intprint P((long n, int radix, SCM port)); -SCM_EXPORT void iprlist P((char *hdr, SCM exp, int tlr, SCM port, int writing)); +SCM_EXPORT void scm_iprin1 P((SCM exp, SCM port, int writing)); +SCM_EXPORT void scm_intprint P((long n, int radix, SCM port)); +SCM_EXPORT void scm_iprlist P((char *hdr, SCM exp, int tlr, SCM port, int writing)); SCM_EXPORT SCM scm_env_lookup P((SCM var, SCM stenv)); SCM_EXPORT SCM scm_env_rlookup P((SCM addr, SCM stenv, const char *what)); SCM_EXPORT SCM scm_env_getprop P((SCM prop, SCM env)); @@ -861,6 +862,7 @@ SCM_EXPORT SCM assoc P((SCM x, SCM alist)); SCM_EXPORT SCM symbolp P((SCM x)); SCM_EXPORT SCM symbol2string P((SCM s)); SCM_EXPORT SCM string2symbol P((SCM s)); +SCM_EXPORT SCM string_copy P((SCM s)); SCM_EXPORT SCM numberp P((SCM x)); SCM_EXPORT SCM exactp P((SCM x)); SCM_EXPORT SCM inexactp P((SCM x)); @@ -916,7 +918,7 @@ SCM_EXPORT int bigprint P((SCM exp, SCM port, int writing)); SCM_EXPORT int floprint P((SCM sexp, SCM port, int writing)); SCM_EXPORT SCM istr2int P((char *str, long len, long radix)); SCM_EXPORT SCM istr2bve P((char *str, long len)); -SCM_EXPORT void ipruk P((char *hdr, SCM ptr, SCM port)); +SCM_EXPORT void scm_ipruk P((char *hdr, SCM ptr, SCM port)); SCM_EXPORT SCM charp P((SCM x)); SCM_EXPORT SCM char_lessp P((SCM x, SCM y)); SCM_EXPORT SCM chci_eq P((SCM x, SCM y)); @@ -978,15 +980,18 @@ SCM_EXPORT SCM try_open_file P((SCM filename, SCM modes)); SCM_EXPORT SCM open_file P((SCM filename, SCM modes)); SCM_EXPORT SCM open_pipe P((SCM pipestr, SCM modes)); SCM_EXPORT SCM close_port P((SCM port)); +SCM_EXPORT SCM scm_file_position P((SCM port, SCM pos)); +#define file_position(port) scm_file_position(port, BOOL_F) +#define file_set_position scm_file_position SCM_EXPORT SCM scm_read P((SCM port)); SCM_EXPORT SCM scm_read_char P((SCM port)); -SCM_EXPORT SCM peek_char P((SCM port)); +SCM_EXPORT SCM scm_peek_char P((SCM port)); SCM_EXPORT SCM eof_objectp P((SCM x)); SCM_EXPORT int scm_io_error P((SCM port, const char *what)); -SCM_EXPORT SCM lwrite P((SCM obj, SCM port)); -SCM_EXPORT SCM display P((SCM obj, SCM port)); -SCM_EXPORT SCM newline P((SCM port)); -SCM_EXPORT SCM write_char P((SCM chr, SCM port)); +SCM_EXPORT SCM scm_write P((SCM obj, SCM port)); +SCM_EXPORT SCM scm_display P((SCM obj, SCM port)); +SCM_EXPORT SCM scm_newline P((SCM port)); +SCM_EXPORT SCM scm_write_char P((SCM chr, SCM port)); SCM_EXPORT SCM scm_port_line P((SCM port)); SCM_EXPORT SCM scm_port_col P((SCM port)); SCM_EXPORT void scm_line_msg P((SCM file, SCM linum, SCM port)); @@ -1040,22 +1045,23 @@ SCM_EXPORT SCM scm_copybitfield P((SCM to, SCM start, SCM rest)); SCM_EXPORT SCM long2num P((long n)); SCM_EXPORT SCM ulong2num P((unsigned long n)); SCM_EXPORT unsigned char num2uchar P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT signed char num2char P((SCM num, char *pos, char *s_caller)); SCM_EXPORT unsigned short num2ushort P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT short num2short P((SCM num, char *pos, char *s_caller)); SCM_EXPORT unsigned long num2ulong P((SCM num, char *pos, char *s_caller)); SCM_EXPORT long num2long P((SCM num, char *pos, char *s_caller)); -SCM_EXPORT short num2short P((SCM num, char *pos, char *s_caller)); SCM_EXPORT double num2dbl P((SCM num, char *pos, char *s_caller)); SCM_EXPORT SCM makfromstr P((const char *src, sizet len)); SCM_EXPORT SCM makfromstrs P((int argc, const char * const *argv)); SCM_EXPORT SCM makfrom0str P((const char *scr)); SCM_EXPORT char **makargvfrmstrs P((SCM args, const char *s_v)); -SCM_EXPORT void must_free_argv P((const char * const *argv)); +SCM_EXPORT void must_free_argv P((char **argv)); SCM_EXPORT SCM scm_evstr P((char *str)); SCM_EXPORT void scm_ldstr P((char *str)); SCM_EXPORT int scm_ldfile P((char *path)); SCM_EXPORT int scm_ldprog P((char *path)); -SCM_EXPORT unsigned long scm_addr P((SCM args, char *name)); -SCM_EXPORT unsigned long scm_base_addr P((SCM v, char *name)); +SCM_EXPORT unsigned long scm_addr P((SCM args, const char *name)); +SCM_EXPORT unsigned long scm_base_addr P((SCM v, const char *name)); SCM_EXPORT int scm_cell_p P((SCM x)); #ifdef FLOATS |