diff options
Diffstat (limited to 'scm.h')
-rw-r--r-- | scm.h | 80 |
1 files changed, 40 insertions, 40 deletions
@@ -98,7 +98,7 @@ typedef struct { sizet len; sizet alloclen; sizet maxlen; - char *what; + const char *what; char *elts;} scm_gra; #ifdef USE_ANSI_PROTOTYPES @@ -167,10 +167,12 @@ typedef struct {SCM type;float num;} flo; typedef struct {SCM type;double *real;} dbl; #endif -#define IMP(x) (6 & (int)(x)) + /* Conditionals should always expect immediates */ + /* GCC __builtin_expect() is stubbed in scmfig.h */ +#define IMP(x) SCM_EXPECT_TRUE(6 & (int)(x)) #define NIMP(x) (!IMP(x)) -#define INUMP(x) (2 & (int)(x)) +#define INUMP(x) SCM_EXPECT_TRUE(2 & (int)(x)) #define NINUMP(x) (!INUMP(x)) #define INUM0 ((SCM) 2) #define ICHRP(x) ((0xff & (int)(x))==0xf4) @@ -405,7 +407,7 @@ SCM_EXPORT long tc16_env, tc16_ident; /* ((&REAL(x))[1]) */ # ifdef SINGLES # define REALP(x) ((~REAL_PART & CAR(x))==tc_flo) -# define SINGP(x) (CAR(x)==tc_flo) +# define SINGP(x) SCM_EXPECT_TRUE(CAR(x)==tc_flo) # define FLO(x) (((flo *)(SCM2PTR(x)))->num) # define REALPART(x) (SINGP(x)?0.0+FLO(x):REAL(x)) # else /* SINGLES */ @@ -702,10 +704,10 @@ SCM_EXPORT void (*init_user_scm) P((void)); SCM_EXPORT void (* deferred_proc) P((void)); SCM_EXPORT void process_signals P((void)); SCM_EXPORT int handle_it P((int i)); -SCM_EXPORT SCM must_malloc_cell P((long len, SCM c, char *what)); -SCM_EXPORT void must_realloc_cell P((SCM z, long olen, long len, char *what)); -SCM_EXPORT char *must_malloc P((long len, char *what)); -SCM_EXPORT char *must_realloc P((char *where, long olen, long len, char *what)); +SCM_EXPORT SCM must_malloc_cell P((long len, SCM c, const char *what)); +SCM_EXPORT void must_realloc_cell P((SCM z, long olen, long len, const char *what)); +SCM_EXPORT char *must_malloc P((long len, const char *what)); +SCM_EXPORT char *must_realloc P((char *where, long olen, long len, const char *what)); SCM_EXPORT void must_free P((char *obj, sizet len)); SCM_EXPORT void scm_protect_temp P((SCM *ptr)); SCM_EXPORT long ilength P((SCM sx)); @@ -719,7 +721,7 @@ 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 scm_init_gra P((scm_gra *gra, sizet eltsize, sizet len, - sizet maxlen, char *what)); + sizet maxlen, const char *what)); SCM_EXPORT int scm_grow_gra P((scm_gra *gra, char *elt)); SCM_EXPORT void scm_trim_gra P((scm_gra *gra)); SCM_EXPORT void scm_free_gra P((scm_gra *gra)); @@ -731,7 +733,7 @@ SCM_EXPORT void prinport P((SCM exp, SCM port, char *type)); SCM_EXPORT SCM repl P((void)); SCM_EXPORT void repl_report P((void)); SCM_EXPORT void growth_mon P((char *obj, long size, char *units, int grewp)); -SCM_EXPORT void gc_start P((char *what)); +SCM_EXPORT void gc_start P((const char *what)); SCM_EXPORT void gc_end P((void)); SCM_EXPORT void gc_mark P((SCM p)); SCM_EXPORT void scm_gc_hook P((void)); @@ -753,7 +755,7 @@ 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 SCM scm_env_lookup P((SCM var, SCM stenv)); -SCM_EXPORT SCM scm_env_rlookup P((SCM addr, SCM stenv, char *what)); +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)); SCM_EXPORT SCM scm_env_addprop P((SCM prop, SCM val, SCM env)); SCM_EXPORT long num_frames P((SCM estk, int i)); @@ -763,7 +765,7 @@ SCM_EXPORT SCM stacktrace1 P((SCM estk, int i)); SCM_EXPORT void scm_princode P((SCM code, SCM env, SCM port, int writing)); SCM_EXPORT void scm_princlosure P((SCM proc, SCM port, int writing)); SCM_EXPORT void lputc P((int c, SCM port)); -SCM_EXPORT void lputs P((char *s, SCM port)); +SCM_EXPORT void lputs P((const char *s, SCM port)); SCM_EXPORT sizet lfwrite P((char *ptr, sizet size, sizet nitems, SCM port)); SCM_EXPORT int lgetc P((SCM port)); SCM_EXPORT void lungetc P((int c, SCM port)); @@ -777,14 +779,14 @@ SCM_EXPORT void init_iprocs P((iproc *subra, int type)); SCM_EXPORT void final_scm P((int)); SCM_EXPORT void init_sbrk P((void)); SCM_EXPORT int init_buf0 P((FILE *inport)); -SCM_EXPORT void scm_init_from_argv P((int argc, char **argv, char *script_arg, +SCM_EXPORT void scm_init_from_argv P((int argc, const char * const *argv, char *script_arg, int iverbose, int buf0stdin)); SCM_EXPORT void init_signals P((void)); SCM_EXPORT SCM scm_top_level P((char *initpath, SCM (*toplvl_fun)())); SCM_EXPORT void restore_signals P((void)); SCM_EXPORT void free_storage P((void)); SCM_EXPORT char *dld_find_executable P((const char* command)); -SCM_EXPORT char *scm_find_execpath P((int argc, char **argv, char *script_arg)); +SCM_EXPORT char *scm_find_execpath P((int argc, const char * const *argv, const char *script_arg)); SCM_EXPORT void init_scm P((int iverbose, int buf0stdin, long init_heap_size)); SCM_EXPORT void scm_init_INITS P((void)); SCM_EXPORT SCM scm_init_extensions P((void)); @@ -798,9 +800,9 @@ SCM_EXPORT SCM markcdr P((SCM ptr)); SCM_EXPORT SCM equal0 P((SCM ptr1, SCM ptr2)); SCM_EXPORT sizet free0 P((CELLPTR ptr)); SCM_EXPORT void scm_warn P((char *str1, char *str2, SCM obj)); -SCM_EXPORT void everr P((SCM exp, SCM env, SCM arg, char *pos, char *s_subr, int codep)); -SCM_EXPORT void wta P((SCM arg, char *pos, char *s_subr)); -SCM_EXPORT void scm_experr P((SCM arg, char *pos, char *s_subr)); +SCM_EXPORT void everr P((SCM exp, SCM env, SCM arg, const char *pos, const char *s_subr, int codep)); +SCM_EXPORT void wta P((SCM arg, const char *pos, const char *s_subr)); +SCM_EXPORT void scm_experr P((SCM arg, const char *pos, const char *s_subr)); SCM_EXPORT SCM intern P((char *name, sizet len)); SCM_EXPORT SCM sysintern P((const char *name, SCM val)); SCM_EXPORT SCM sym2vcell P((SCM sym)); @@ -870,7 +872,8 @@ SCM_EXPORT SCM difference P((SCM x, SCM y)); SCM_EXPORT SCM product P((SCM x, SCM y)); SCM_EXPORT SCM divide P((SCM x, SCM y)); SCM_EXPORT SCM lquotient P((SCM x, SCM y)); -SCM_EXPORT SCM absval P((SCM x)); +SCM_EXPORT SCM scm_iabs P((SCM x)); +SCM_EXPORT SCM scm_abs P((SCM x)); SCM_EXPORT SCM lremainder P((SCM x, SCM y)); SCM_EXPORT SCM modulo P((SCM x, SCM y)); SCM_EXPORT SCM lgcd P((SCM x, SCM y)); @@ -942,12 +945,12 @@ SCM_EXPORT SCM for_each P((SCM proc, SCM arg1, SCM args)); SCM_EXPORT SCM procedurep P((SCM obj)); SCM_EXPORT SCM apply P((SCM proc, SCM arg1, SCM args)); SCM_EXPORT SCM scm_cvapply P((SCM proc, long n, SCM *argv)); -SCM_EXPORT int scm_arity_check P((SCM proc, long argc, char *what)); +SCM_EXPORT int scm_arity_check P((SCM proc, long argc, const char *what)); SCM_EXPORT SCM map P((SCM proc, SCM arg1, SCM args)); SCM_EXPORT SCM scm_make_cont P((void)); SCM_EXPORT SCM copytree P((SCM obj)); SCM_EXPORT SCM eval P((SCM obj)); -SCM_EXPORT SCM scm_values P((SCM arg1, SCM arg2, SCM rest, char *what)); +SCM_EXPORT SCM scm_values P((SCM arg1, SCM arg2, SCM rest, const char *what)); SCM_EXPORT SCM scm_eval_values P((SCM x, SCM static_env, SCM env)); SCM_EXPORT SCM identp P((SCM obj)); SCM_EXPORT SCM ident2sym P((SCM id)); @@ -970,7 +973,7 @@ 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 eof_objectp P((SCM x)); -SCM_EXPORT int scm_io_error P((SCM port, char *what)); +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)); @@ -978,7 +981,7 @@ SCM_EXPORT 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)); -SCM_EXPORT void scm_err_line P((char *what, SCM file, SCM linum, SCM port)); +SCM_EXPORT void scm_err_line P((const char *what, SCM file, SCM linum, SCM port)); SCM_EXPORT SCM lgetenv P((SCM nam)); SCM_EXPORT SCM prog_args P((void)); SCM_EXPORT SCM makacro P((SCM code)); @@ -1005,7 +1008,7 @@ SCM_EXPORT void add_final P((void (*final)(void))); SCM_EXPORT SCM makcclo P((SCM proc, long len)); SCM_EXPORT SCM make_uve P((long k, SCM prot)); SCM_EXPORT long scm_prot2type P((SCM prot)); -SCM_EXPORT long aind P((SCM ra, SCM args, char *what)); +SCM_EXPORT long aind P((SCM ra, SCM args, const char *what)); SCM_EXPORT SCM scm_eval_string P((SCM str)); SCM_EXPORT SCM scm_load_string P((SCM str)); SCM_EXPORT SCM scm_unexec P((const SCM pathname)); @@ -1033,11 +1036,11 @@ 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((char *src, sizet len)); -SCM_EXPORT SCM makfromstrs P((int argc, char **argv)); -SCM_EXPORT SCM makfrom0str P((char *scr)); -SCM_EXPORT char **makargvfrmstrs P((SCM args, char *s_v)); -SCM_EXPORT void must_free_argv P((char **argv)); +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 SCM scm_evstr P((char *str)); SCM_EXPORT void scm_ldstr P((char *str)); SCM_EXPORT int scm_ldfile P((char *path)); @@ -1050,10 +1053,7 @@ SCM_EXPORT int scm_cell_p P((SCM x)); SCM_EXPORT SCM makdbl P((double x, double y)); SCM_EXPORT SCM dbl2big P((double d)); SCM_EXPORT double big2dbl P((SCM b)); -SCM_EXPORT double lasinh P((double x)); -SCM_EXPORT double lacosh P((double x)); -SCM_EXPORT double latanh P((double x)); -SCM_EXPORT double ltrunc P((double x)); +SCM_EXPORT double scm_truncate P((double x)); SCM_EXPORT double scm_round P((double x)); SCM_EXPORT double floident P((double x)); #endif @@ -1079,9 +1079,9 @@ SCM_EXPORT int scm_bigdblcomp P((SCM b, double d)); SCM_EXPORT char * scm_cat_path P((char *str1, const char *str2, long n)); SCM_EXPORT char * scm_try_path P((char *path)); SCM_EXPORT char * script_find_executable P((const char *command)); -SCM_EXPORT char ** script_process_argv P((int argc, char **argv)); -SCM_EXPORT int script_count_argv P((char **argv)); -SCM_EXPORT char * find_impl_file P((char *exec_path, const char *generic_name, +SCM_EXPORT char ** script_process_argv P((int argc, const char **argv)); +SCM_EXPORT int script_count_argv P((const char **argv)); +SCM_EXPORT char * find_impl_file P((const char *exec_path, const char *generic_name, const char *initname, const char *sep)); /* environment cache functions */ @@ -1111,8 +1111,8 @@ SCM_EXPORT SCM scm_trace, scm_trace_env; # define ASRTER(_cond, _arg, _pos, _subr) ; # define ASRTGO(_cond, _label) ; #else -# define ASRTER(_cond, _arg, _pos, _subr) if(!(_cond))wta(_arg, (char *)(_pos), _subr); -# define ASRTGO(_cond, _label) if(!(_cond)) goto _label; +# define ASRTER(_cond, _arg, _pos, _subr) if (SCM_EXPECT_FALSE(!(_cond))) wta(_arg, (char *)(_pos), _subr); +# define ASRTGO(_cond, _label) if (SCM_EXPECT_FALSE(!(_cond))) goto _label; #endif #define ARGn 1 @@ -1138,12 +1138,12 @@ SCM_EXPORT SCM scm_trace, scm_trace_env; #define PROF_SIGNAL 20 #define EVAL(x, env, venv) (IMP(x)?(x):ceval((x), (SCM)(env), (SCM)(venv))) -#define SIDEVAL(x, env, venv) if NIMP(x) ceval((x), (SCM)(env), (SCM)(venv)) +#define SIDEVAL(x, env, venv) if (NIMP(x)) ceval((x), (SCM)(env), (SCM)(venv)) -#define NEWCELL(_into) {if IMP(freelist) _into = gc_for_newcell();\ +#define NEWCELL(_into) {if (IMP(freelist)) _into = gc_for_newcell();\ else {_into = freelist;freelist = CDR(freelist);++cells_allocated;}} /* -#define NEWCELL(_into) {DEFER_INTS;if IMP(freelist) _into = gc_for_newcell();\ +#define NEWCELL(_into) {DEFER_INTS;if (IMP(freelist)) _into = gc_for_newcell();\ else {_into = freelist;freelist = CDR(freelist);++cells_allocated;}\ ALLOW_INTS;} */ |