From c014a02eec7b99c54d8a156ce491ae8d1e341f97 Mon Sep 17 00:00:00 2001 From: Michael Livshin Date: Sat, 26 May 2001 20:51:22 +0000 Subject: [PATCH] revert the ill-considered part of the 2001-05-24 changes --- libguile/ChangeLog | 4 + libguile/__scm.h | 2 - libguile/continuations.c | 2 +- libguile/continuations.h | 4 +- libguile/debug.h | 2 +- libguile/deprecation.c | 2 +- libguile/dynwind.c | 2 +- libguile/dynwind.h | 2 +- libguile/environments.c | 18 +-- libguile/eval.c | 52 +++---- libguile/eval.h | 6 +- libguile/fluids.c | 16 +- libguile/fports.c | 16 +- libguile/gc.c | 182 +++++++++++------------ libguile/gc.h | 26 ++-- libguile/gh.h | 26 ++-- libguile/gh_data.c | 46 +++--- libguile/gh_list.c | 2 +- libguile/goops.c | 72 ++++----- libguile/goops.h | 4 +- libguile/gsubr.c | 4 +- libguile/gsubr.h | 6 +- libguile/hash.c | 34 ++--- libguile/hash.h | 10 +- libguile/hashtab.c | 46 +++--- libguile/hashtab.h | 12 +- libguile/ioext.c | 2 +- libguile/list.c | 18 +-- libguile/list.h | 2 +- libguile/load.c | 2 +- libguile/modules.c | 2 +- libguile/numbers.c | 16 -- libguile/numbers.h | 14 +- libguile/objects.c | 14 +- libguile/objects.h | 4 +- libguile/options.h | 2 +- libguile/ports.c | 20 +-- libguile/ports.h | 8 +- libguile/print.c | 16 +- libguile/procs.c | 20 +-- libguile/procs.h | 12 +- libguile/ramap.c | 221 ++++++++++++++-------------- libguile/root.c | 2 +- libguile/rw.c | 8 +- libguile/smob.c | 12 +- libguile/smob.h | 2 +- libguile/sort.c | 42 +++--- libguile/stacks.c | 28 ++-- libguile/stacks.h | 4 +- libguile/strings.c | 16 +- libguile/strop.c | 28 ++-- libguile/strports.c | 6 +- libguile/struct.c | 4 +- libguile/struct.h | 2 +- libguile/symbols.h | 6 +- libguile/tags.h | 3 +- libguile/unif.c | 311 +++++++++++++++++---------------------- libguile/unif.h | 24 +-- libguile/validate.h | 12 +- libguile/values.c | 2 +- libguile/vectors.c | 34 ++--- libguile/vectors.h | 10 +- libguile/weaks.c | 9 +- 63 files changed, 723 insertions(+), 813 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 38bd63680..0e432309d 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,7 @@ +2001-05-26 Michael Livshin + + revert the controversial part of the 2001-05-24 changes. + 2001-05-25 Marius Vollmer * modules.c (scm_env_module): Exported to Scheme. diff --git a/libguile/__scm.h b/libguile/__scm.h index 753684edc..5e7637f0d 100644 --- a/libguile/__scm.h +++ b/libguile/__scm.h @@ -255,8 +255,6 @@ typedef unsigned long long ulong_long; # define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char)) #endif -#define SCM_BITS_LENGTH (SCM_CHAR_BIT * SCM_SIZEOF_BITS_T) - #ifdef UCHAR_MAX # define SCM_CHAR_CODE_LIMIT (UCHAR_MAX + 1L) #else diff --git a/libguile/continuations.c b/libguile/continuations.c index 81bbe65bd..7b33d7248 100644 --- a/libguile/continuations.c +++ b/libguile/continuations.c @@ -116,7 +116,7 @@ scm_make_continuation (int *first) volatile SCM cont; scm_contregs_t *continuation; scm_contregs_t *rootcont = SCM_CONTREGS (scm_rootcont); - scm_bits_t stack_size; + long stack_size; SCM_STACKITEM * src; SCM_ENTER_A_SECTION; diff --git a/libguile/continuations.h b/libguile/continuations.h index 0d31225c9..400eee326 100644 --- a/libguile/continuations.h +++ b/libguile/continuations.h @@ -63,8 +63,8 @@ typedef struct jmp_buf jmpbuf; SCM dynenv; SCM_STACKITEM *base; /* base of the live stack, before it was saved. */ - scm_bits_t num_stack_items; /* size of the saved stack. */ - scm_ubits_t seq; /* dynamic root identifier. */ + size_t num_stack_items; /* size of the saved stack. */ + unsigned long seq; /* dynamic root identifier. */ #ifdef DEBUG_EXTENSIONS /* the most recently created debug frame on the live stack, before diff --git a/libguile/debug.h b/libguile/debug.h index d0f78a55e..742726fae 100644 --- a/libguile/debug.h +++ b/libguile/debug.h @@ -116,7 +116,7 @@ typedef union scm_debug_info_t SCM id; } scm_debug_info_t; -extern scm_bits_t scm_debug_eframe_size; +extern long scm_debug_eframe_size; typedef struct scm_debug_frame_t { diff --git a/libguile/deprecation.c b/libguile/deprecation.c index aad7bc09c..1f6d1ffb0 100644 --- a/libguile/deprecation.c +++ b/libguile/deprecation.c @@ -52,7 +52,7 @@ -#if SCM_DEBUG_DEPRECATED == 0 +#if (SCM_DEBUG_DEPRECATED == 0) /* This is either a boolean (when a summary should be printed) or a hashtab (when detailed warnings shouold be printed). diff --git a/libguile/dynwind.c b/libguile/dynwind.c index ef0a144ce..bc4c72575 100644 --- a/libguile/dynwind.c +++ b/libguile/dynwind.c @@ -201,7 +201,7 @@ scm_swap_bindings (SCM glocs, SCM vals) } void -scm_dowinds (SCM to, scm_bits_t delta) +scm_dowinds (SCM to, long delta) { tail: if (SCM_EQ_P (to, scm_dynwinds)); diff --git a/libguile/dynwind.h b/libguile/dynwind.h index 49823762c..a8e888b23 100644 --- a/libguile/dynwind.h +++ b/libguile/dynwind.h @@ -56,7 +56,7 @@ extern SCM scm_internal_dynamic_wind (scm_guard_t before, scm_guard_t after, void *inner_data, void *guard_data); -extern void scm_dowinds (SCM to, scm_bits_t delta); +extern void scm_dowinds (SCM to, long delta); extern void scm_init_dynwind (void); #ifdef GUILE_DEBUG diff --git a/libguile/environments.c b/libguile/environments.c index 6455cd9b1..aad811d32 100644 --- a/libguile/environments.c +++ b/libguile/environments.c @@ -508,7 +508,7 @@ observer_mark (SCM observer) static int observer_print (SCM type, SCM port, scm_print_state *pstate) { - SCM address = scm_ubits2num (SCM_UNPACK (type)); + SCM address = scm_ulong2num (SCM_UNPACK (type)); SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16)); scm_puts ("#local; SCM imported = EVAL_ENVIRONMENT (env)->imported; - SCM proc_as_nr = scm_ubits2num ((scm_ubits_t) proc); + SCM proc_as_nr = scm_ulong2num ((unsigned long int) proc); SCM extended_data = scm_cons2 (local, proc_as_nr, data); SCM tmp_result = scm_c_environment_fold (imported, eval_environment_folder, extended_data, init); @@ -1365,7 +1365,7 @@ eval_environment_free (SCM env) static int eval_environment_print (SCM type, SCM port, scm_print_state *pstate) { - SCM address = scm_ubits2num (SCM_UNPACK (type)); + SCM address = scm_ulong2num (SCM_UNPACK (type)); SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16)); scm_puts ("#= 2 && len <= 3, scm_s_expression, "if"); return scm_cons (SCM_IM_IF, SCM_CDR (xorig)); } @@ -563,7 +563,7 @@ SCM_GLOBAL_SYMBOL(scm_sym_and, s_and); SCM scm_m_and (SCM xorig, SCM env) { - scm_bits_t len = scm_ilength (SCM_CDR (xorig)); + long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 0, scm_s_test, s_and); if (len >= 1) return scm_cons (SCM_IM_AND, SCM_CDR (xorig)); @@ -577,7 +577,7 @@ SCM_GLOBAL_SYMBOL(scm_sym_or,s_or); SCM scm_m_or (SCM xorig, SCM env) { - scm_bits_t len = scm_ilength (SCM_CDR (xorig)); + long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 0, scm_s_test, s_or); if (len >= 1) return scm_cons (SCM_IM_OR, SCM_CDR (xorig)); @@ -615,7 +615,7 @@ SCM scm_m_cond (SCM xorig, SCM env) { SCM arg1, cdrx = scm_list_copy (SCM_CDR (xorig)), x = cdrx; - scm_bits_t len = scm_ilength (x); + long len = scm_ilength (x); SCM_ASSYNT (len >= 1, scm_s_clauses, s_cond); while (SCM_NIMP (x)) { @@ -705,7 +705,7 @@ SCM scm_m_letstar (SCM xorig, SCM env) { SCM x = SCM_CDR (xorig), arg1, proc, vars = SCM_EOL, *varloc = &vars; - scm_bits_t len = scm_ilength (x); + long len = scm_ilength (x); SCM_ASSYNT (len >= 2, scm_s_body, s_letstar); proc = SCM_CAR (x); SCM_ASSYNT (scm_ilength (proc) >= 0, scm_s_bindings, s_letstar); @@ -747,7 +747,7 @@ scm_m_do (SCM xorig, SCM env) SCM x = SCM_CDR (xorig), arg1, proc; SCM vars = SCM_EOL, inits = SCM_EOL, steps = SCM_EOL; SCM *initloc = &inits, *steploc = &steps; - scm_bits_t len = scm_ilength (x); + long len = scm_ilength (x); SCM_ASSYNT (len >= 2, scm_s_test, "do"); proc = SCM_CAR (x); SCM_ASSYNT (scm_ilength (proc) >= 0, scm_s_bindings, "do"); @@ -780,7 +780,7 @@ scm_m_do (SCM xorig, SCM env) #define evalcar scm_eval_car -static SCM iqq (SCM form, SCM env, scm_bits_t depth); +static SCM iqq (SCM form, SCM env, long depth); SCM_SYNTAX(s_quasiquote, "quasiquote", scm_makacro, scm_m_quasiquote); SCM_GLOBAL_SYMBOL(scm_sym_quasiquote, s_quasiquote); @@ -795,15 +795,15 @@ scm_m_quasiquote (SCM xorig, SCM env) static SCM -iqq (SCM form, SCM env, scm_bits_t depth) +iqq (SCM form, SCM env, long depth) { SCM tmp; - scm_bits_t edepth = depth; + long edepth = depth; if (SCM_IMP (form)) return form; if (SCM_VECTORP (form)) { - scm_bits_t i = SCM_VECTOR_LENGTH (form); + long i = SCM_VECTOR_LENGTH (form); SCM *data = SCM_VELTS (form); tmp = SCM_EOL; for (; --i >= 0;) @@ -1043,7 +1043,7 @@ SCM_SYNTAX (s_nil_cond, "nil-cond", scm_makmmacro, scm_m_nil_cond); SCM scm_m_nil_cond (SCM xorig, SCM env) { - scm_bits_t len = scm_ilength (SCM_CDR (xorig)); + long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 1 && (len & 1) == 1, scm_s_expression, "nil-cond"); return scm_cons (SCM_IM_NIL_COND, SCM_CDR (xorig)); } @@ -1071,7 +1071,7 @@ SCM_SYNTAX (s_0_cond, "0-cond", scm_makmmacro, scm_m_0_cond); SCM scm_m_0_cond (SCM xorig, SCM env) { - scm_bits_t len = scm_ilength (SCM_CDR (xorig)); + long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 1 && (len & 1) == 1, scm_s_expression, "0-cond"); return scm_cons (SCM_IM_0_COND, SCM_CDR (xorig)); } @@ -1658,11 +1658,11 @@ scm_debug_frame_t *scm_last_debug_frame; * stack frames at each real stack frame. */ -scm_bits_t scm_debug_eframe_size; +long scm_debug_eframe_size; int scm_debug_mode, scm_check_entry_p, scm_check_apply_p, scm_check_exit_p; -scm_bits_t scm_eval_stack; +long scm_eval_stack; scm_option_t scm_eval_opts[] = { { SCM_OPTION_INTEGER, "stack", 22000, "Size of thread stacks (in machine words)." } @@ -2304,7 +2304,7 @@ dispatch: * cuts down execution time for type dispatch to 50%. */ { - scm_bits_t i, n, end, mask; + long i, n, end, mask; SCM z = SCM_CDDR (x); n = SCM_INUM (SCM_CAR (z)); /* maximum number of specializers */ proc = SCM_CADR (z); @@ -2319,8 +2319,8 @@ dispatch: else { /* Compute a hash value */ - scm_bits_t hashset = SCM_INUM (proc); - scm_bits_t j = n; + long hashset = SCM_INUM (proc); + long j = n; mask = SCM_INUM (SCM_CAR (z = SCM_CDDR (z))); proc = SCM_CADR (z); i = 0; @@ -2340,7 +2340,7 @@ dispatch: /* Search for match */ do { - scm_bits_t j = n; + long j = n; z = SCM_VELTS (proc)[i]; t.arg1 = arg2; /* list of arguments */ if (SCM_NIMP (t.arg1)) @@ -3632,18 +3632,18 @@ ret: and claim that the i'th element of ARGV is WHO's i+2'th argument. */ static inline void check_map_args (SCM argv, - scm_bits_t len, + long len, SCM gf, SCM proc, SCM args, const char *who) { SCM *ve = SCM_VELTS (argv); - scm_bits_t i; + long i; for (i = SCM_VECTOR_LENGTH (argv) - 1; i >= 1; i--) { - scm_bits_t elt_len = scm_ilength (ve[i]); + long elt_len = scm_ilength (ve[i]); if (elt_len < 0) { @@ -3674,7 +3674,7 @@ SCM scm_map (SCM proc, SCM arg1, SCM args) #define FUNC_NAME s_map { - scm_bits_t i, len; + long i, len; SCM res = SCM_EOL; SCM *pres = &res; SCM *ve = &args; /* Keep args from being optimized away. */ @@ -3723,7 +3723,7 @@ scm_for_each (SCM proc, SCM arg1, SCM args) #define FUNC_NAME s_for_each { SCM *ve = &args; /* Keep args from being optimized away. */ - scm_bits_t i, len; + long i, len; len = scm_ilength (arg1); SCM_GASSERTn (len >= 0, g_for_each, scm_cons2 (proc, arg1, args), SCM_ARG2, s_for_each); @@ -3862,7 +3862,7 @@ SCM_DEFINE (scm_copy_tree, "copy-tree", 1, 0, 0, return obj; if (SCM_VECTORP (obj)) { - size_t i = SCM_VECTOR_LENGTH (obj); + unsigned long i = SCM_VECTOR_LENGTH (obj); ans = scm_c_make_vector (i, SCM_UNSPECIFIED); while (i--) SCM_VELTS (ans)[i] = scm_copy_tree (SCM_VELTS (obj)[i]); diff --git a/libguile/eval.h b/libguile/eval.h index d34c723da..06ad86969 100644 --- a/libguile/eval.h +++ b/libguile/eval.h @@ -58,7 +58,7 @@ extern scm_option_t scm_eval_opts[]; #define SCM_EVAL_STACK scm_eval_opts[0].val #define SCM_N_EVAL_OPTIONS 1 -extern scm_bits_t scm_eval_stack; +extern long scm_eval_stack; extern scm_option_t scm_evaluator_trap_table[]; @@ -83,8 +83,8 @@ extern SCM scm_eval_options_interface (SCM setting); #define SCM_ICDR (0x00080000L) #define SCM_IFRINC (0x00000100L) #define SCM_IDSTMSK (-SCM_IDINC) -#define SCM_IFRAME(n) ((scm_bits_t)((SCM_ICDR-SCM_IFRINC)>>8) \ - & (SCM_UNPACK (n)) >> 8) +#define SCM_IFRAME(n) ((long)((SCM_ICDR-SCM_IFRINC)>>8) \ + & (SCM_UNPACK (n) >> 8)) #define SCM_IDIST(n) (SCM_UNPACK (n) >> 20) #define SCM_ICDRP(n) (SCM_ICDR & SCM_UNPACK (n)) diff --git a/libguile/fluids.c b/libguile/fluids.c index aedb27ed8..718dc5f3f 100644 --- a/libguile/fluids.c +++ b/libguile/fluids.c @@ -56,7 +56,7 @@ #define INITIAL_FLUIDS 10 #include "libguile/validate.h" -static volatile scm_bits_t n_fluids; +static volatile long n_fluids; scm_bits_t scm_tc16_fluid; SCM @@ -69,7 +69,7 @@ static void grow_fluids (scm_root_state *root_state, int new_length) { SCM old_fluids, new_fluids; - scm_bits_t old_length, i; + long old_length, i; old_fluids = root_state->fluids; old_length = SCM_VECTOR_LENGTH (old_fluids); @@ -104,10 +104,10 @@ fluid_print (SCM exp, SCM port, scm_print_state *pstate) return 1; } -static scm_bits_t +static long next_fluid_num () { - scm_bits_t n; + long n; SCM_CRITICAL_SECTION_START; n = n_fluids++; SCM_CRITICAL_SECTION_END; @@ -125,7 +125,7 @@ SCM_DEFINE (scm_make_fluid, "make-fluid", 0, 0, 0, "in its own dynamic root, you can use fluids for thread local storage.") #define FUNC_NAME s_scm_make_fluid { - scm_bits_t n; + long n; n = next_fluid_num (); SCM_RETURN_NEWSMOB (scm_tc16_fluid, n); @@ -149,7 +149,7 @@ SCM_DEFINE (scm_fluid_ref, "fluid-ref", 1, 0, 0, "@code{#f}.") #define FUNC_NAME s_scm_fluid_ref { - scm_bits_t n; + long n; SCM_VALIDATE_FLUID (1, fluid); @@ -166,7 +166,7 @@ SCM_DEFINE (scm_fluid_set_x, "fluid-set!", 2, 0, 0, "Set the value associated with @var{fluid} in the current dynamic root.") #define FUNC_NAME s_scm_fluid_set_x { - scm_bits_t n; + long n; SCM_VALIDATE_FLUID (1, fluid); n = SCM_FLUID_NUM (fluid); @@ -234,7 +234,7 @@ scm_c_with_fluids (SCM fluids, SCM values, SCM (*cproc) (), void *cdata) #define FUNC_NAME "scm_c_with_fluids" { SCM ans; - scm_bits_t flen, vlen; + long flen, vlen; SCM_VALIDATE_LIST_COPYLEN (1, fluids, flen); SCM_VALIDATE_LIST_COPYLEN (2, values, vlen); diff --git a/libguile/fports.c b/libguile/fports.c index 68fba2b13..c8586a38b 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -79,7 +79,7 @@ static const size_t default_buffer_size = 1024; /* create FPORT buffer with specified sizes (or -1 to use default size or 0 for no buffer. */ static void -scm_fport_buffer_add (SCM port, scm_bits_t read_size, scm_bits_t write_size) +scm_fport_buffer_add (SCM port, long read_size, int write_size) #define FUNC_NAME "scm_fport_buffer_add" { scm_fport_t *fp = SCM_FSTREAM (port); @@ -149,7 +149,7 @@ SCM_DEFINE (scm_setvbuf, "setvbuf", 2, 1, 0, #define FUNC_NAME s_scm_setvbuf { int cmode; - scm_bits_t csize; + long csize; scm_port_t *pt; port = SCM_COERCE_OUTPORT (port); @@ -203,7 +203,7 @@ SCM_DEFINE (scm_setvbuf, "setvbuf", 2, 1, 0, void scm_evict_ports (int fd) { - scm_bits_t i; + long i; for (i = 0; i < scm_port_table_size; i++) { @@ -505,7 +505,7 @@ static void fport_flush (SCM port); static int fport_fill_input (SCM port) { - scm_bits_t count; + long count; scm_port_t *pt = SCM_PTAB_ENTRY (port); scm_fport_t *fp = SCM_FSTREAM (port); @@ -675,19 +675,19 @@ fport_flush (SCM port) scm_port_t *pt = SCM_PTAB_ENTRY (port); scm_fport_t *fp = SCM_FSTREAM (port); unsigned char *ptr = pt->write_buf; - scm_bits_t init_size = pt->write_pos - pt->write_buf; - scm_bits_t remaining = init_size; + long init_size = pt->write_pos - pt->write_buf; + long remaining = init_size; while (remaining > 0) { - scm_bits_t count; + long count; SCM_SYSCALL (count = write (fp->fdes, ptr, remaining)); if (count < 0) { /* error. assume nothing was written this call, but fix up the buffer for any previous successful writes. */ - scm_bits_t done = init_size - remaining; + long done = init_size - remaining; if (done > 0) { diff --git a/libguile/gc.c b/libguile/gc.c index 3aaab5c0e..2069a1628 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -257,11 +257,11 @@ size_t scm_default_max_segment_size = 2097000L;/* a little less (adm) than 2 Mb # define CELL_DN(p, span) MK_FP(FP_SEG(p), ~(8*(span)-1)&FP_OFF(p)) #else # ifdef _UNICOS -# define CELL_UP(p, span) (SCM_CELLPTR)(~(span) & ((scm_ubits_t)(p)+(span))) -# define CELL_DN(p, span) (SCM_CELLPTR)(~(span) & (scm_ubits_t)(p)) +# define CELL_UP(p, span) (SCM_CELLPTR)(~(span) & ((long)(p)+(span))) +# define CELL_DN(p, span) (SCM_CELLPTR)(~(span) & (long)(p)) # else -# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & ((scm_ubits_t)(p)+sizeof(scm_cell)*(span)-1L)) -# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & (scm_ubits_t)(p)) +# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & ((long)(p)+sizeof(scm_cell)*(span)-1L)) +# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & (long)(p)) # endif /* UNICOS */ #endif /* PROT386 */ @@ -301,13 +301,13 @@ typedef struct scm_freelist_t { /* number of cells per object on this list */ int span; /* number of collected cells during last GC */ - scm_ubits_t collected; + unsigned long collected; /* number of collected cells during penultimate GC */ - scm_ubits_t collected_1; + unsigned long collected_1; /* total number of cells in heap segments * belonging to this list. */ - scm_ubits_t heap_size; + unsigned long heap_size; } scm_freelist_t; SCM scm_freelist = SCM_EOL; @@ -322,7 +322,7 @@ scm_freelist_t scm_master_freelist2 = { /* scm_mtrigger * is the number of bytes of must_malloc allocation needed to trigger gc. */ -scm_ubits_t scm_mtrigger; +unsigned long scm_mtrigger; /* scm_gc_heap_lock * If set, don't expand the heap. Set only during gc, during which no allocation @@ -347,20 +347,20 @@ SCM scm_structs_to_free; /* GC Statistics Keeping */ -scm_ubits_t scm_cells_allocated = 0; -scm_ubits_t scm_mallocated = 0; -scm_ubits_t scm_gc_cells_collected; -scm_ubits_t scm_gc_yield; -static scm_ubits_t scm_gc_yield_1 = 0; /* previous GC yield */ -scm_ubits_t scm_gc_malloc_collected; -scm_ubits_t scm_gc_ports_collected; +unsigned long scm_cells_allocated = 0; +unsigned long scm_mallocated = 0; +unsigned long scm_gc_cells_collected; +unsigned long scm_gc_yield; +static unsigned long scm_gc_yield_1 = 0; /* previous GC yield */ +unsigned long scm_gc_malloc_collected; +unsigned long scm_gc_ports_collected; unsigned long scm_gc_time_taken = 0; -static scm_ubits_t t_before_gc; -static scm_ubits_t t_before_sweep; +static unsigned long t_before_gc; +static unsigned long t_before_sweep; unsigned long scm_gc_mark_time_taken = 0; unsigned long scm_gc_sweep_time_taken = 0; -scm_ubits_t scm_gc_times = 0; -scm_ubits_t scm_gc_cells_swept = 0; +unsigned long scm_gc_times = 0; +unsigned long scm_gc_cells_swept = 0; double scm_gc_cells_marked_acc = 0.; double scm_gc_cells_swept_acc = 0.; @@ -482,10 +482,10 @@ clear_mark_space () #if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST) /* Return the number of the heap segment containing CELL. */ -static scm_bits_t +static long which_seg (SCM cell) { - scm_bits_t i; + long i; for (i = 0; i < scm_n_heap_segs; i++) if (SCM_PTR_LE (scm_heap_table[i].bounds[0], SCM2PTR (cell)) @@ -500,12 +500,12 @@ which_seg (SCM cell) static void map_free_list (scm_freelist_t *master, SCM freelist) { - scm_bits_t last_seg = -1, count = 0; + long last_seg = -1, count = 0; SCM f; for (f = freelist; !SCM_NULLP (f); f = SCM_FREE_CELL_CDR (f)) { - scm_bits_t this_seg = which_seg (f); + long this_seg = which_seg (f); if (this_seg != last_seg) { @@ -529,7 +529,7 @@ SCM_DEFINE (scm_map_free_list, "map-free-list", 0, 0, 0, "@code{--enable-guile-debug} builds of Guile.") #define FUNC_NAME s_scm_map_free_list { - scm_bits_t i; + long i; fprintf (stderr, "%ld segments total (%d:%ld", (long) scm_n_heap_segs, scm_heap_table[0].span, @@ -547,14 +547,14 @@ SCM_DEFINE (scm_map_free_list, "map-free-list", 0, 0, 0, } #undef FUNC_NAME -static scm_bits_t last_cluster; -static scm_bits_t last_size; +static long last_cluster; +static long last_size; -static scm_bits_t -free_list_length (char *title, scm_bits_t i, SCM freelist) +static long +free_list_length (char *title, long i, SCM freelist) { SCM ls; - scm_bits_t n = 0; + long n = 0; for (ls = freelist; !SCM_NULLP (ls); ls = SCM_FREE_CELL_CDR (ls)) if (SCM_FREE_CELL_P (ls)) ++n; @@ -586,7 +586,7 @@ static void free_list_lengths (char *title, scm_freelist_t *master, SCM freelist) { SCM clusters; - scm_bits_t i = 0, len, n = 0; + long i = 0, len, n = 0; fprintf (stderr, "%s\n\n", title); n += free_list_length ("free list", -1, freelist); for (clusters = master->clusters; @@ -625,8 +625,8 @@ SCM_DEFINE (scm_free_list_length, "free-list-length", 0, 0, 0, static int scm_debug_check_freelist = 0; /* Number of calls to SCM_NEWCELL since startup. */ -static scm_ubits_t scm_newcell_count; -static scm_ubits_t scm_newcell2_count; +static unsigned long scm_newcell_count; +static unsigned long scm_newcell2_count; /* Search freelist for anything that isn't marked as a free cell. Abort if we find something. */ @@ -634,7 +634,7 @@ static void scm_check_freelist (SCM freelist) { SCM f; - scm_bits_t i = 0; + long i = 0; for (f = freelist; !SCM_NULLP (f); f = SCM_FREE_CELL_CDR (f), i++) if (!SCM_FREE_CELL_P (f)) @@ -722,26 +722,26 @@ scm_debug_newcell2 (void) -static scm_ubits_t +static unsigned long master_cells_allocated (scm_freelist_t *master) { /* the '- 1' below is to ignore the cluster spine cells. */ - scm_bits_t objects = master->clusters_allocated * (master->cluster_size - 1); + long objects = master->clusters_allocated * (master->cluster_size - 1); if (SCM_NULLP (master->clusters)) objects -= master->left_to_collect; return master->span * objects; } -static scm_ubits_t +static unsigned long freelist_length (SCM freelist) { - scm_bits_t n; + long n; for (n = 0; !SCM_NULLP (freelist); freelist = SCM_FREE_CELL_CDR (freelist)) ++n; return n; } -static scm_ubits_t +static unsigned long compute_cells_allocated () { return (scm_cells_allocated @@ -760,17 +760,17 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0, "use of storage.") #define FUNC_NAME s_scm_gc_stats { - scm_bits_t i; - scm_bits_t n; + long i; + long n; SCM heap_segs; - scm_ubits_t local_scm_mtrigger; - scm_ubits_t local_scm_mallocated; - scm_ubits_t local_scm_heap_size; - scm_ubits_t local_scm_cells_allocated; - unsigned long local_scm_gc_time_taken; - scm_ubits_t local_scm_gc_times; - unsigned long local_scm_gc_mark_time_taken; - unsigned long local_scm_gc_sweep_time_taken; + unsigned long int local_scm_mtrigger; + unsigned long int local_scm_mallocated; + unsigned long int local_scm_heap_size; + unsigned long int local_scm_cells_allocated; + unsigned long int local_scm_gc_time_taken; + unsigned long int local_scm_gc_times; + unsigned long int local_scm_gc_mark_time_taken; + unsigned long int local_scm_gc_sweep_time_taken; double local_scm_gc_cells_swept; double local_scm_gc_cells_marked; SCM answer; @@ -783,8 +783,8 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0, heap_segs = SCM_EOL; n = scm_n_heap_segs; for (i = scm_n_heap_segs; i--; ) - heap_segs = scm_cons (scm_cons (scm_ubits2num ((scm_ubits_t)scm_heap_table[i].bounds[1]), - scm_ubits2num ((scm_ubits_t)scm_heap_table[i].bounds[0])), + heap_segs = scm_cons (scm_cons (scm_ulong2num ((unsigned long)scm_heap_table[i].bounds[1]), + scm_ulong2num ((unsigned long)scm_heap_table[i].bounds[0])), heap_segs); if (scm_n_heap_segs != n) goto retry; @@ -806,11 +806,11 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0, local_scm_gc_cells_marked = scm_gc_cells_marked_acc; answer = scm_listify (scm_cons (sym_gc_time_taken, scm_ulong2num (local_scm_gc_time_taken)), - scm_cons (sym_cells_allocated, scm_ubits2num (local_scm_cells_allocated)), - scm_cons (sym_heap_size, scm_ubits2num (local_scm_heap_size)), - scm_cons (sym_mallocated, scm_ubits2num (local_scm_mallocated)), - scm_cons (sym_mtrigger, scm_ubits2num (local_scm_mtrigger)), - scm_cons (sym_times, scm_ubits2num (local_scm_gc_times)), + scm_cons (sym_cells_allocated, scm_ulong2num (local_scm_cells_allocated)), + scm_cons (sym_heap_size, scm_ulong2num (local_scm_heap_size)), + scm_cons (sym_mallocated, scm_ulong2num (local_scm_mallocated)), + scm_cons (sym_mtrigger, scm_ulong2num (local_scm_mtrigger)), + scm_cons (sym_times, scm_ulong2num (local_scm_gc_times)), scm_cons (sym_gc_mark_time_taken, scm_ulong2num (local_scm_gc_mark_time_taken)), scm_cons (sym_gc_sweep_time_taken, scm_ulong2num (local_scm_gc_sweep_time_taken)), scm_cons (sym_cells_marked, scm_i_dbl2big (local_scm_gc_cells_marked)), @@ -857,7 +857,7 @@ SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0, "returned by this function for @var{obj}") #define FUNC_NAME s_scm_object_address { - return scm_ubits2num (SCM_UNPACK (obj)); + return scm_ulong2num ((unsigned long) SCM_UNPACK (obj)); } #undef FUNC_NAME @@ -945,7 +945,7 @@ scm_gc_for_newcell (scm_freelist_t *master, SCM *freelist) fprintf (stderr, "allocated = %lu, ", (long) (scm_cells_allocated + master_cells_allocated (&scm_master_freelist) - + master_cells_allocated (&scm_master_freelist2))); + + master_cells_allocated (&scm_master_freelist2))); #endif scm_igc ("cells"); adjust_min_yield (master); @@ -1002,7 +1002,7 @@ scm_c_hook_t scm_after_gc_c_hook; void scm_igc (const char *what) { - scm_bits_t j; + long j; ++scm_gc_running_p; scm_c_hook_run (&scm_before_gc_c_hook, 0); @@ -1034,8 +1034,8 @@ scm_igc (const char *what) /* flush dead entries from the continuation stack */ { - scm_bits_t x; - scm_bits_t bound; + long x; + long bound; SCM * elts; elts = SCM_VELTS (scm_continuation_stack); bound = SCM_VECTOR_LENGTH (scm_continuation_stack); @@ -1124,7 +1124,7 @@ void MARK (SCM p) #define FUNC_NAME FNAME { - register scm_bits_t i; + register long i; register SCM ptr; scm_bits_t cell_type; @@ -1233,7 +1233,7 @@ gc_mark_loop_first_time: { /* ptr is a struct */ SCM layout = SCM_PACK (vtable_data [scm_vtable_index_layout]); - scm_bits_t len = SCM_SYMBOL_LENGTH (layout); + long len = SCM_SYMBOL_LENGTH (layout); char * fields_desc = SCM_SYMBOL_CHARS (layout); scm_bits_t * struct_data = (scm_bits_t *) SCM_STRUCT_DATA (ptr); @@ -1244,7 +1244,7 @@ gc_mark_loop_first_time: } if (len) { - scm_bits_t x; + long x; for (x = 0; x < len - 2; x += 2, ++struct_data) if (fields_desc[x] == 'p') @@ -1322,8 +1322,8 @@ gc_mark_loop_first_time: scm_weak_vectors = ptr; if (SCM_IS_WHVEC_ANY (ptr)) { - scm_bits_t x; - scm_bits_t len; + long x; + long len; int weak_keys; int weak_values; @@ -1449,9 +1449,9 @@ gc_mark_loop_first_time: */ void -scm_mark_locations (SCM_STACKITEM x[], scm_ubits_t n) +scm_mark_locations (SCM_STACKITEM x[], unsigned long n) { - scm_ubits_t m; + unsigned long m; for (m = 0; m < n; ++m) { @@ -1459,14 +1459,14 @@ scm_mark_locations (SCM_STACKITEM x[], scm_ubits_t n) if (SCM_CELLP (obj)) { SCM_CELLPTR ptr = SCM2PTR (obj); - scm_bits_t i = 0; - scm_bits_t j = scm_n_heap_segs - 1; + long i = 0; + long j = scm_n_heap_segs - 1; if (SCM_PTR_LE (scm_heap_table[i].bounds[0], ptr) && SCM_PTR_GT (scm_heap_table[j].bounds[1], ptr)) { while (i <= j) { - scm_bits_t seg_id; + long seg_id; seg_id = -1; if ((i == j) || SCM_PTR_GT (scm_heap_table[i].bounds[1], ptr)) @@ -1475,7 +1475,7 @@ scm_mark_locations (SCM_STACKITEM x[], scm_ubits_t n) seg_id = j; else { - scm_bits_t k; + long k; k = (i + j) / 2; if (k == i) break; @@ -1523,14 +1523,14 @@ scm_cellp (SCM value) { if (SCM_CELLP (value)) { scm_cell * ptr = SCM2PTR (value); - scm_bits_t i = 0; - scm_bits_t j = scm_n_heap_segs - 1; + unsigned long i = 0; + unsigned long j = scm_n_heap_segs - 1; if (SCM_GC_IN_CARD_HEADERP (ptr)) return 0; while (i < j) { - scm_bits_t k = (i + j) / 2; + long k = (i + j) / 2; if (SCM_PTR_GT (scm_heap_table[k].bounds[1], ptr)) { j = k; } else if (SCM_PTR_LE (scm_heap_table[k].bounds[0], ptr)) { @@ -1566,7 +1566,7 @@ gc_sweep_freelist_start (scm_freelist_t *freelist) static void gc_sweep_freelist_finish (scm_freelist_t *freelist) { - scm_bits_t collected; + long collected; *freelist->clustertail = freelist->cells; if (!SCM_NULLP (freelist->cells)) { @@ -1604,9 +1604,9 @@ scm_gc_sweep () register SCM_CELLPTR ptr; register SCM nfreelist; register scm_freelist_t *freelist; - register scm_ubits_t m; + register unsigned long m; register int span; - scm_bits_t i; + long i; size_t seg_size; m = 0; @@ -1616,7 +1616,7 @@ scm_gc_sweep () for (i = 0; i < scm_n_heap_segs; i++) { - register scm_bits_t left_to_collect; + register long left_to_collect; register size_t j; /* Unmarked cells go onto the front of the freelist this heap @@ -1695,7 +1695,7 @@ scm_gc_sweep () break; case scm_tc7_vector: { - scm_ubits_t length = SCM_VECTOR_LENGTH (scmptr); + unsigned long int length = SCM_VECTOR_LENGTH (scmptr); if (length > 0) { m += length * sizeof (scm_bits_t); @@ -1712,10 +1712,10 @@ scm_gc_sweep () #ifdef HAVE_ARRAYS case scm_tc7_bvect: { - size_t length = SCM_BITVECTOR_LENGTH (scmptr); + unsigned long int length = SCM_BITVECTOR_LENGTH (scmptr); if (length > 0) { - m += sizeof (long) * ((length + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH); + m += sizeof (long) * ((length + SCM_LONG_BIT - 1) / SCM_LONG_BIT); scm_must_free (SCM_BITVECTOR_BASE (scmptr)); } } @@ -1827,7 +1827,7 @@ scm_gc_sweep () #ifdef GC_FREE_SEGMENTS if (n == seg_size) { - register scm_bits_t j; + register long j; freelist->heap_size -= seg_size; free ((char *) scm_heap_table[i].bounds[0]); @@ -1903,7 +1903,7 @@ void * scm_must_malloc (size_t size, const char *what) { void *ptr; - scm_ubits_t nm = scm_mallocated + size; + unsigned long nm = scm_mallocated + size; if (nm < size) /* The byte count of allocated objects has overflowed. This is @@ -1965,7 +1965,7 @@ scm_must_realloc (void *where, const char *what) { void *ptr; - scm_ubits_t nm; + unsigned long nm; if (size <= old_size) return where; @@ -2065,7 +2065,7 @@ scm_must_free (void *obj) * eh? Or even better, call scm_done_free. */ void -scm_done_malloc (scm_bits_t size) +scm_done_malloc (long size) { if (size < 0) { if (scm_mallocated < size) @@ -2076,7 +2076,7 @@ scm_done_malloc (scm_bits_t size) scm_mallocated, which underflowed. */ abort (); } else { - scm_ubits_t nm = scm_mallocated + size; + unsigned long nm = scm_mallocated + size; if (nm < size) /* The byte count of allocated objects has overflowed. This is probably because you forgot to report the correct size of freed @@ -2100,7 +2100,7 @@ scm_done_malloc (scm_bits_t size) } void -scm_done_free (scm_bits_t size) +scm_done_free (long size) { if (size >= 0) { if (scm_mallocated < size) @@ -2111,7 +2111,7 @@ scm_done_free (scm_bits_t size) scm_mallocated, which underflowed. */ abort (); } else { - scm_ubits_t nm = scm_mallocated + size; + unsigned long nm = scm_mallocated + size; if (nm < size) /* The byte count of allocated objects has overflowed. This is probably because you forgot to report the correct size of freed @@ -2174,7 +2174,7 @@ init_heap_seg (SCM_CELLPTR seg_org, size_t size, scm_freelist_t *freelist) { register SCM_CELLPTR ptr; SCM_CELLPTR seg_end; - scm_bits_t new_seg_index; + long new_seg_index; ptrdiff_t n_new_cells; int span = freelist->span; @@ -2359,7 +2359,7 @@ alloc_some_heap (scm_freelist_t *freelist, policy_on_error error_policy) * This gives dh > (f * h - y) / (1 - f) */ int f = freelist->min_yield_fraction; - scm_ubits_t h = SCM_HEAP_SIZE; + unsigned long h = SCM_HEAP_SIZE; size_t min_cells = (f * h - 100 * (long) scm_gc_yield) / (99 - f); len = SCM_EXPHEAP (freelist->heap_size); #ifdef DEBUGINFO @@ -2613,7 +2613,7 @@ make_initial_segment (size_t init_heap_size, scm_freelist_t *freelist) static void init_freelist (scm_freelist_t *freelist, int span, - scm_bits_t cluster_size, + long cluster_size, int min_yield) { freelist->clusters = SCM_EOL; diff --git a/libguile/gc.h b/libguile/gc.h index 464d4df08..a7631c3f7 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -97,7 +97,7 @@ typedef scm_cell * SCM_CELLPTR; #define SCM_GC_SET_CARD_BVEC(card, bvec) \ ((card)->word_0 = (scm_bits_t) (bvec)) -#define SCM_GC_GET_CARD_FLAGS(card) ((scm_ubits_t) ((card)->word_1)) +#define SCM_GC_GET_CARD_FLAGS(card) ((long) ((card)->word_1)) #define SCM_GC_SET_CARD_FLAGS(card, flags) \ ((card)->word_1 = (scm_bits_t) (flags)) #define SCM_GC_CLR_CARD_FLAGS(card) (SCM_GC_SET_CARD_FLAGS (card, 0L)) @@ -119,9 +119,9 @@ typedef scm_cell * SCM_CELLPTR; #define SCM_GC_CARD_SIZE_MASK (SCM_GC_CARD_SIZE - 1) #define SCM_GC_CARD_ADDR_MASK (~SCM_GC_CARD_SIZE_MASK) -#define SCM_GC_CELL_CARD(x) ((SCM_CELLPTR) ((scm_bits_t) (x) & SCM_GC_CARD_ADDR_MASK)) +#define SCM_GC_CELL_CARD(x) ((SCM_CELLPTR) ((long) (x) & SCM_GC_CARD_ADDR_MASK)) #define SCM_GC_CELL_SPAN(x) ((SCM_GC_CARD_DOUBLECELLP (SCM_GC_CELL_CARD (x))) ? 2 : 1) -#define SCM_GC_CELL_OFFSET(x) (((scm_bits_t) (x) & SCM_GC_CARD_SIZE_MASK) >> SCM_CELL_SIZE_SHIFT) +#define SCM_GC_CELL_OFFSET(x) (((long) (x) & SCM_GC_CARD_SIZE_MASK) >> SCM_CELL_SIZE_SHIFT) #define SCM_GC_CELL_BVEC(x) SCM_GC_CARD_BVEC (SCM_GC_CELL_CARD (x)) #define SCM_GC_CELL_GET_BIT(x) SCM_C_BVEC_GET (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x)) #define SCM_GC_CELL_SET_BIT(x) SCM_C_BVEC_SET (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x)) @@ -319,13 +319,13 @@ extern SCM scm_freelist; extern struct scm_freelist_t scm_master_freelist; extern SCM scm_freelist2; extern struct scm_freelist_t scm_master_freelist2; -extern scm_ubits_t scm_gc_cells_collected; -extern scm_ubits_t scm_gc_yield; -extern scm_ubits_t scm_gc_malloc_collected; -extern scm_ubits_t scm_gc_ports_collected; -extern scm_ubits_t scm_cells_allocated; -extern scm_ubits_t scm_mallocated; -extern scm_ubits_t scm_mtrigger; +extern unsigned long scm_gc_cells_collected; +extern unsigned long scm_gc_yield; +extern unsigned long scm_gc_malloc_collected; +extern unsigned long scm_gc_ports_collected; +extern unsigned long scm_cells_allocated; +extern unsigned long scm_mallocated; +extern unsigned long scm_mtrigger; extern SCM scm_after_gc_hook; @@ -363,17 +363,17 @@ extern void scm_alloc_cluster (struct scm_freelist_t *master); extern void scm_igc (const char *what); extern void scm_gc_mark (SCM p); extern void scm_gc_mark_dependencies (SCM p); -extern void scm_mark_locations (SCM_STACKITEM x[], scm_ubits_t n); +extern void scm_mark_locations (SCM_STACKITEM x[], unsigned long n); extern int scm_cellp (SCM value); extern void scm_gc_sweep (void); extern void * scm_must_malloc (size_t len, const char *what); extern void * scm_must_realloc (void *where, size_t olen, size_t len, const char *what); -extern void scm_done_malloc (scm_bits_t size); -extern void scm_done_free (scm_bits_t size); extern char *scm_must_strdup (const char *str); extern char *scm_must_strndup (const char *str, size_t n); +extern void scm_done_malloc (long size); +extern void scm_done_free (long size); extern void scm_must_free (void *obj); extern void scm_remember_upto_here_1 (SCM obj); extern void scm_remember_upto_here_2 (SCM obj1, SCM obj2); diff --git a/libguile/gh.h b/libguile/gh.h index ed3f2d386..6921d22e9 100644 --- a/libguile/gh.h +++ b/libguile/gh.h @@ -103,20 +103,20 @@ SCM gh_double2scm(double x); SCM gh_char2scm(char c); SCM gh_str2scm(const char *s, size_t len); SCM gh_str02scm(const char *s); -void gh_set_substr(char *src, SCM dst, scm_bits_t start, size_t len); +void gh_set_substr(char *src, SCM dst, long start, size_t len); SCM gh_symbol2scm(const char *symbol_str); -SCM gh_ints2scm(const int *d, scm_bits_t n); +SCM gh_ints2scm(const int *d, long n); #ifdef HAVE_ARRAYS -SCM gh_chars2byvect(const char *d, scm_bits_t n); -SCM gh_shorts2svect(const short *d, scm_bits_t n); -SCM gh_longs2ivect(const long *d, scm_bits_t n); -SCM gh_ulongs2uvect(const unsigned long *d, scm_bits_t n); -SCM gh_floats2fvect(const float *d, scm_bits_t n); -SCM gh_doubles2dvect(const double *d, scm_bits_t n); +SCM gh_chars2byvect(const char *d, long n); +SCM gh_shorts2svect(const short *d, long n); +SCM gh_longs2ivect(const long *d, long n); +SCM gh_ulongs2uvect(const unsigned long *d, long n); +SCM gh_floats2fvect(const float *d, long n); +SCM gh_doubles2dvect(const double *d, long n); #endif -SCM gh_doubles2scm(const double *d, scm_bits_t n); +SCM gh_doubles2scm(const double *d, long n); /* Scheme to C conversion */ int gh_scm2bool(SCM obj); @@ -126,7 +126,7 @@ long gh_scm2long(SCM obj); char gh_scm2char(SCM obj); double gh_scm2double(SCM obj); char *gh_scm2newstr(SCM str, size_t *lenp); -void gh_get_substr(SCM src, char *dst, scm_bits_t start, size_t len); +void gh_get_substr(SCM src, char *dst, long start, size_t len); char *gh_symbol2newstr(SCM sym, size_t *lenp); char *gh_scm2chars(SCM vector, char *result); short *gh_scm2shorts(SCM vector, short *result); @@ -178,8 +178,8 @@ SCM gh_define(const char *name, SCM val); SCM gh_make_vector(SCM length, SCM val); SCM gh_vector_set_x(SCM vec, SCM pos, SCM val); SCM gh_vector_ref(SCM vec, SCM pos); -scm_bits_t gh_vector_length (SCM v); -scm_ubits_t gh_uniform_vector_length (SCM v); +unsigned long gh_vector_length (SCM v); +unsigned long gh_uniform_vector_length (SCM v); SCM gh_uniform_vector_ref (SCM v, SCM ilist); #define gh_list_to_vector(ls) scm_vector(ls) #define gh_vector_to_list(v) scm_vector_to_list(v) @@ -189,7 +189,7 @@ SCM gh_module_lookup (SCM module, const char *sname); SCM gh_cons(SCM x, SCM y); #define gh_list scm_listify -scm_bits_t gh_length(SCM l); +unsigned long gh_length(SCM l); SCM gh_append(SCM args); SCM gh_append2(SCM l1, SCM l2); SCM gh_append3(SCM l1, SCM l2, SCM l3); diff --git a/libguile/gh_data.c b/libguile/gh_data.c index 5dbf21da9..dc31bae09 100644 --- a/libguile/gh_data.c +++ b/libguile/gh_data.c @@ -95,7 +95,7 @@ gh_str02scm (const char *s) If START + LEN is off the end of DST, signal an out-of-range error. */ void -gh_set_substr (char *src, SCM dst, scm_bits_t start, size_t len) +gh_set_substr (char *src, SCM dst, long start, size_t len) { char *dst_ptr; size_t dst_len; @@ -121,9 +121,9 @@ gh_symbol2scm (const char *symbol_str) } SCM -gh_ints2scm (const int *d, scm_bits_t n) +gh_ints2scm (const int *d, long n) { - scm_bits_t i; + long i; SCM v = scm_c_make_vector (n, SCM_UNSPECIFIED); SCM *velts = SCM_VELTS(v); @@ -134,9 +134,9 @@ gh_ints2scm (const int *d, scm_bits_t n) } SCM -gh_doubles2scm (const double *d, scm_bits_t n) +gh_doubles2scm (const double *d, long n) { - scm_bits_t i; + long i; SCM v = scm_c_make_vector (n, SCM_UNSPECIFIED); SCM *velts = SCM_VELTS(v); @@ -162,7 +162,7 @@ makvect (char *m, size_t len, int type) } SCM -gh_chars2byvect (const char *d, scm_bits_t n) +gh_chars2byvect (const char *d, long n) { char *m = scm_must_malloc (n * sizeof (char), "vector"); memcpy (m, d, n * sizeof (char)); @@ -170,7 +170,7 @@ gh_chars2byvect (const char *d, scm_bits_t n) } SCM -gh_shorts2svect (const short *d, scm_bits_t n) +gh_shorts2svect (const short *d, long n) { char *m = scm_must_malloc (n * sizeof (short), "vector"); memcpy (m, d, n * sizeof (short)); @@ -178,7 +178,7 @@ gh_shorts2svect (const short *d, scm_bits_t n) } SCM -gh_longs2ivect (const long *d, scm_bits_t n) +gh_longs2ivect (const long *d, long n) { char *m = scm_must_malloc (n * sizeof (long), "vector"); memcpy (m, d, n * sizeof (long)); @@ -186,7 +186,7 @@ gh_longs2ivect (const long *d, scm_bits_t n) } SCM -gh_ulongs2uvect (const unsigned long *d, scm_bits_t n) +gh_ulongs2uvect (const unsigned long *d, long n) { char *m = scm_must_malloc (n * sizeof (unsigned long), "vector"); memcpy (m, d, n * sizeof (unsigned long)); @@ -194,7 +194,7 @@ gh_ulongs2uvect (const unsigned long *d, scm_bits_t n) } SCM -gh_floats2fvect (const float *d, scm_bits_t n) +gh_floats2fvect (const float *d, long n) { char *m = scm_must_malloc (n * sizeof (float), "vector"); memcpy (m, d, n * sizeof (float)); @@ -202,7 +202,7 @@ gh_floats2fvect (const float *d, scm_bits_t n) } SCM -gh_doubles2dvect (const double *d, scm_bits_t n) +gh_doubles2dvect (const double *d, long n) { char *m = scm_must_malloc (n * sizeof (double), "vector"); memcpy (m, d, n * sizeof (double)); @@ -251,8 +251,8 @@ gh_scm2char (SCM obj) char * gh_scm2chars (SCM obj, char *m) { - scm_bits_t i, n; - scm_bits_t v; + long i, n; + long v; SCM val; if (SCM_IMP (obj)) scm_wrong_type_arg (0, 0, obj); @@ -311,8 +311,8 @@ gh_scm2chars (SCM obj, char *m) short * gh_scm2shorts (SCM obj, short *m) { - scm_bits_t i, n; - scm_bits_t v; + long i, n; + long v; SCM val; if (SCM_IMP (obj)) scm_wrong_type_arg (0, 0, obj); @@ -362,7 +362,7 @@ gh_scm2shorts (SCM obj, short *m) long * gh_scm2longs (SCM obj, long *m) { - scm_bits_t i, n; + long i, n; SCM val; if (SCM_IMP (obj)) scm_wrong_type_arg (0, 0, obj); @@ -412,7 +412,7 @@ gh_scm2longs (SCM obj, long *m) float * gh_scm2floats (SCM obj, float *m) { - scm_bits_t i, n; + long i, n; SCM val; if (SCM_IMP (obj)) scm_wrong_type_arg (0, 0, obj); @@ -475,7 +475,7 @@ gh_scm2floats (SCM obj, float *m) double * gh_scm2doubles (SCM obj, double *m) { - scm_bits_t i, n; + long i, n; SCM val; if (SCM_IMP (obj)) scm_wrong_type_arg (0, 0, obj); @@ -583,7 +583,7 @@ gh_scm2newstr (SCM str, size_t *lenp) region to fit the string. If truncation occurs, the corresponding area of DST is left unchanged. */ void -gh_get_substr (SCM src, char *dst, scm_bits_t start, size_t len) +gh_get_substr (SCM src, char *dst, long start, size_t len) { size_t src_len, effective_length; SCM_ASSERT (SCM_STRINGP (src), src, SCM_ARG3, "gh_get_substr"); @@ -655,20 +655,20 @@ gh_vector_ref (SCM vec, SCM pos) } /* returns the length of the given vector */ -scm_bits_t +unsigned long gh_vector_length (SCM v) { - return (size_t) SCM_VECTOR_LENGTH (v); + return (unsigned long) SCM_VECTOR_LENGTH (v); } #ifdef HAVE_ARRAYS /* uniform vector support */ /* returns the length as a C unsigned long integer */ -scm_ubits_t +unsigned long gh_uniform_vector_length (SCM v) { - return SCM_UVECTOR_LENGTH (v); + return (unsigned long) SCM_UVECTOR_LENGTH (v); } /* gets the given element from a uniform vector; ilist is a list (or diff --git a/libguile/gh_list.c b/libguile/gh_list.c index c52af4223..71af25ee8 100644 --- a/libguile/gh_list.c +++ b/libguile/gh_list.c @@ -45,7 +45,7 @@ #include "libguile/gh.h" /* returns the length of a list */ -scm_bits_t +unsigned long gh_length (SCM l) { return gh_scm2ulong (scm_length (l)); diff --git a/libguile/goops.c b/libguile/goops.c index dc6d3a8f0..1fe133828 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -314,7 +314,7 @@ compute_getters_n_setters (SCM slots) { SCM res = SCM_EOL; SCM *cdrloc = &res; - scm_bits_t i = 0; + long i = 0; for ( ; SCM_NNULLP(slots); slots = SCM_CDR(slots)) { @@ -345,9 +345,9 @@ compute_getters_n_setters (SCM slots) /*fixme* Manufacture keywords in advance */ SCM -scm_i_get_keyword (SCM key, SCM l, scm_bits_t len, SCM default_value, const char *subr) +scm_i_get_keyword (SCM key, SCM l, long len, SCM default_value, const char *subr) { - scm_bits_t i; + long i; for (i = 0; i != len; i += 2) { @@ -375,7 +375,7 @@ SCM_DEFINE (scm_get_keyword, "get-keyword", 3, 0, 0, "@var{default_value} is returned.") #define FUNC_NAME s_scm_get_keyword { - scm_bits_t len; + long len; SCM_ASSERT (SCM_KEYWORDP (key), key, SCM_ARG1, FUNC_NAME); len = scm_ilength (l); @@ -400,7 +400,7 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0, { SCM tmp, get_n_set, slots; SCM class = SCM_CLASS_OF (obj); - scm_bits_t n_initargs; + long n_initargs; SCM_VALIDATE_INSTANCE (1, obj); n_initargs = scm_ilength (initargs); @@ -420,7 +420,7 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0, if (SCM_NIMP (SCM_CDR (slot_name))) { /* This slot admits (perhaps) to be initialized at creation time */ - scm_bits_t n = scm_ilength (SCM_CDR (slot_name)); + long n = scm_ilength (SCM_CDR (slot_name)); if (n & 1) /* odd or -1 */ SCM_MISC_ERROR ("class contains bogus slot definition: ~S", SCM_LIST1 (slot_name)); @@ -479,7 +479,7 @@ SCM_DEFINE (scm_sys_prep_layout_x, "%prep-layout!", 1, 0, 0, "") #define FUNC_NAME s_scm_sys_prep_layout_x { - scm_bits_t i, n, len; + long i, n, len; char *s, p, a; SCM nfields, slots, type; @@ -543,7 +543,7 @@ SCM_DEFINE (scm_sys_inherit_magic_x, "%inherit-magic!", 2, 0, 0, #define FUNC_NAME s_scm_sys_inherit_magic_x { SCM ls = dsupers; - scm_bits_t flags = 0; + long flags = 0; SCM_VALIDATE_INSTANCE (1, class); while (SCM_NNULLP (ls)) { @@ -560,7 +560,7 @@ SCM_DEFINE (scm_sys_inherit_magic_x, "%inherit-magic!", 2, 0, 0, SCM_SET_CLASS_DESTRUCTOR (class, scm_struct_free_entity); else { - scm_bits_t n = SCM_INUM (SCM_SLOT (class, scm_si_nfields)); + long n = SCM_INUM (SCM_SLOT (class, scm_si_nfields)); #if 0 /* * We could avoid calling scm_must_malloc in the allocation code @@ -998,7 +998,7 @@ SCM_DEFINE (scm_sys_fast_slot_ref, "%fast-slot-ref", 2, 0, 0, "Return the slot value with index @var{index} from @var{obj}.") #define FUNC_NAME s_scm_sys_fast_slot_ref { - register scm_bits_t i; + register long i; SCM_VALIDATE_INSTANCE (1, obj); SCM_VALIDATE_INUM (2, index); @@ -1015,7 +1015,7 @@ SCM_DEFINE (scm_sys_fast_slot_set_x, "%fast-slot-set!", 3, 0, 0, "@var{value}.") #define FUNC_NAME s_scm_sys_fast_slot_set_x { - register scm_bits_t i; + register long i; SCM_VALIDATE_INSTANCE (1, obj); SCM_VALIDATE_INUM (2, index); @@ -1279,10 +1279,10 @@ SCM_DEFINE (scm_slots_exists_p, "slot-exists?", 2, 0, 0, static void clear_method_cache (SCM); static SCM -wrap_init (SCM class, SCM *m, scm_bits_t n) +wrap_init (SCM class, SCM *m, long n) { SCM z; - scm_bits_t i; + long i; /* Set all slots to unbound */ for (i = 0; i < n; i++) @@ -1303,7 +1303,7 @@ SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0, #define FUNC_NAME s_scm_sys_allocate_instance { SCM *m; - scm_bits_t n; + long n; SCM_VALIDATE_CLASS (1, class); @@ -1343,7 +1343,7 @@ SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0, /* Class objects */ if (SCM_CLASS_FLAGS (class) & SCM_CLASSF_METACLASS) { - scm_bits_t i; + long i; /* allocate class object */ SCM z = scm_make_struct (class, SCM_INUM0, SCM_EOL); @@ -1463,16 +1463,16 @@ SCM_DEFINE (scm_sys_invalidate_class, "%invalidate-class", 1, 0, 0, */ static SCM **hell; -static scm_bits_t n_hell = 1; /* one place for the evil one himself */ -static scm_bits_t hell_size = 4; +static long n_hell = 1; /* one place for the evil one himself */ +static long hell_size = 4; #ifdef USE_THREADS static scm_mutex_t hell_mutex; #endif -static scm_bits_t +static long burnin (SCM o) { - scm_bits_t i; + long i; for (i = 1; i < n_hell; ++i) if (SCM_INST (o) == hell[i]) return i; @@ -1488,7 +1488,7 @@ go_to_hell (void *o) #endif if (n_hell == hell_size) { - scm_bits_t new_size = 2 * hell_size; + long new_size = 2 * hell_size; hell = scm_must_realloc (hell, hell_size, new_size, "hell"); hell_size = new_size; } @@ -1668,7 +1668,7 @@ static int more_specificp (SCM m1, SCM m2, SCM *targs) { register SCM s1, s2; - register scm_bits_t i; + register long i; /* * Note: * m1 and m2 can have != length (i.e. one can be one element longer than the @@ -1706,9 +1706,9 @@ more_specificp (SCM m1, SCM m2, SCM *targs) #define BUFFSIZE 32 /* big enough for most uses */ static SCM -scm_i_vector2list (SCM l, scm_bits_t len) +scm_i_vector2list (SCM l, long len) { - size_t j; + long j; SCM z = scm_c_make_vector (len, SCM_UNDEFINED); for (j = 0; j < len; j++, l = SCM_CDR (l)) { @@ -1718,9 +1718,9 @@ scm_i_vector2list (SCM l, scm_bits_t len) } static SCM -sort_applicable_methods (SCM method_list, scm_bits_t size, SCM *targs) +sort_applicable_methods (SCM method_list, long size, SCM *targs) { - scm_bits_t i, j, incr; + long i, j, incr; SCM *v, vector = SCM_EOL; SCM buffer[BUFFSIZE]; SCM save = method_list; @@ -1782,10 +1782,10 @@ sort_applicable_methods (SCM method_list, scm_bits_t size, SCM *targs) } SCM -scm_compute_applicable_methods (SCM gf, SCM args, scm_bits_t len, int find_method_p) +scm_compute_applicable_methods (SCM gf, SCM args, long len, int find_method_p) { - register scm_bits_t i; - scm_bits_t count = 0; + register long i; + long count = 0; SCM l, fl, applicable = SCM_EOL; SCM save = args; SCM buffer[BUFFSIZE], *types, *p; @@ -1853,7 +1853,7 @@ SCM scm_sys_compute_applicable_methods (SCM gf, SCM args) #define FUNC_NAME s_sys_compute_applicable_methods { - scm_bits_t n; + long n; SCM_VALIDATE_GENERIC (1, gf); n = scm_ilength (args); SCM_ASSERT (n >= 0, args, SCM_ARG2, FUNC_NAME); @@ -1991,7 +1991,7 @@ SCM_DEFINE (scm_make, "make", 0, 0, 1, #define FUNC_NAME s_scm_make { SCM class, z; - scm_bits_t len = scm_ilength (args); + long len = scm_ilength (args); if (len <= 0 || (len & 1) == 0) SCM_WRONG_NUM_ARGS (); @@ -2084,7 +2084,7 @@ SCM_DEFINE (scm_find_method, "find-method", 0, 0, 1, #define FUNC_NAME s_scm_find_method { SCM gf; - scm_bits_t len = scm_ilength (l); + long len = scm_ilength (l); if (len == 0) SCM_WRONG_NUM_ARGS (); @@ -2104,7 +2104,7 @@ SCM_DEFINE (scm_sys_method_more_specific_p, "%method-more-specific?", 3, 0, 0, #define FUNC_NAME s_scm_sys_method_more_specific_p { SCM l, v; - scm_bits_t i, len; + long i, len; SCM_VALIDATE_METHOD (1, m1); SCM_VALIDATE_METHOD (2, m2); @@ -2357,7 +2357,7 @@ scm_make_extended_class (char *type_name) static void create_smob_classes (void) { - scm_bits_t i; + long i; scm_smob_class = (SCM *) malloc (255 * sizeof (SCM)); for (i = 0; i < 255; ++i) @@ -2374,7 +2374,7 @@ create_smob_classes (void) } void -scm_make_port_classes (scm_bits_t ptobnum, char *type_name) +scm_make_port_classes (long ptobnum, char *type_name) { SCM c, class = make_class_from_template ("<%s-port>", type_name, @@ -2401,7 +2401,7 @@ scm_make_port_classes (scm_bits_t ptobnum, char *type_name) static void create_port_classes (void) { - scm_bits_t i; + long i; scm_port_class = (SCM *) malloc (3 * 256 * sizeof (SCM)); for (i = 0; i < 3 * 256; ++i) @@ -2551,7 +2551,7 @@ scm_add_slot (SCM class, char *slot_name, SCM slot_class, } } { - scm_bits_t n = SCM_INUM (SCM_SLOT (class, scm_si_nfields)); + long n = SCM_INUM (SCM_SLOT (class, scm_si_nfields)); SCM_SLOT (class, scm_si_nfields) = SCM_MAKINUM (n + 1); diff --git a/libguile/goops.h b/libguile/goops.h index 60b331cbb..481ff0067 100644 --- a/libguile/goops.h +++ b/libguile/goops.h @@ -229,7 +229,7 @@ SCM scm_sys_set_object_setter_x (SCM obj, SCM setter); SCM scm_slot_ref (SCM obj, SCM slot_name); SCM scm_slot_set_x (SCM obj, SCM slot_name, SCM value); -SCM scm_compute_applicable_methods (SCM gf, SCM args, scm_bits_t len, int scm_find_method); +SCM scm_compute_applicable_methods (SCM gf, SCM args, long len, int scm_find_method); SCM scm_sys_compute_applicable_methods (SCM gf, SCM args); SCM scm_m_atslot_ref (SCM xorig, SCM env); SCM scm_m_atslot_set_x (SCM xorig, SCM env); @@ -239,7 +239,7 @@ SCM scm_pure_generic_p (SCM obj); #endif SCM scm_sys_compute_slots (SCM c); -SCM scm_i_get_keyword (SCM key, SCM l, scm_bits_t len, SCM default_value, const char *subr); +SCM scm_i_get_keyword (SCM key, SCM l, long len, SCM default_value, const char *subr); SCM scm_get_keyword (SCM key, SCM l, SCM default_value); SCM scm_sys_initialize_object (SCM obj, SCM initargs); SCM scm_sys_prep_layout_x (SCM c); diff --git a/libguile/gsubr.c b/libguile/gsubr.c index 090b1e928..ebb09f3b1 100644 --- a/libguile/gsubr.c +++ b/libguile/gsubr.c @@ -214,8 +214,8 @@ scm_gsubr_apply (SCM args) SCM self = SCM_CAR (args); SCM (*fcn)() = SCM_SUBRF (SCM_GSUBR_PROC (self)); SCM v[SCM_GSUBR_MAX]; - scm_bits_t typ = SCM_INUM (SCM_GSUBR_TYPE (self)); - scm_bits_t i, n = SCM_GSUBR_REQ (typ) + SCM_GSUBR_OPT (typ) + SCM_GSUBR_REST (typ); + long typ = SCM_INUM (SCM_GSUBR_TYPE (self)); + long i, n = SCM_GSUBR_REQ (typ) + SCM_GSUBR_OPT (typ) + SCM_GSUBR_REST (typ); #if 0 if (n > SCM_GSUBR_MAX) scm_misc_error (FUNC_NAME, diff --git a/libguile/gsubr.h b/libguile/gsubr.h index fbf546203..131854c4f 100644 --- a/libguile/gsubr.h +++ b/libguile/gsubr.h @@ -49,9 +49,9 @@ #define SCM_GSUBR_MAKTYPE(req, opt, rst) ((req)|((opt)<<4)|((rst)<<8)) -#define SCM_GSUBR_REQ(x) ((scm_bits_t)(x)&0xf) -#define SCM_GSUBR_OPT(x) (((scm_bits_t)(x)&0xf0)>>4) -#define SCM_GSUBR_REST(x) ((scm_bits_t)(x)>>8) +#define SCM_GSUBR_REQ(x) ((long)(x)&0xf) +#define SCM_GSUBR_OPT(x) (((long)(x)&0xf0)>>4) +#define SCM_GSUBR_REST(x) ((long)(x)>>8) #define SCM_GSUBR_MAX 10 #define SCM_GSUBR_TYPE(cclo) (SCM_CCLO_REF ((cclo), 1)) diff --git a/libguile/hash.c b/libguile/hash.c index 5a7244569..ae09a3862 100644 --- a/libguile/hash.c +++ b/libguile/hash.c @@ -60,13 +60,13 @@ extern double floor(); #endif -scm_bits_t +unsigned long scm_string_hash (const unsigned char *str, size_t len) { if (len > 5) { size_t i = 5; - scm_bits_t h = 264; + unsigned long h = 264; while (i--) h = (h << 8) + (unsigned) str[h % len]; return h; @@ -74,7 +74,7 @@ scm_string_hash (const unsigned char *str, size_t len) else { size_t i = len; - scm_bits_t h = 0; + unsigned long h = 0; while (i) h = (h << 8) + (unsigned) str[--i]; return h; @@ -86,8 +86,8 @@ scm_string_hash (const unsigned char *str, size_t len) /* Dirk:FIXME:: scm_hasher could be made static. */ -scm_bits_t -scm_hasher (SCM obj, scm_bits_t n, size_t d) +unsigned long +scm_hasher(SCM obj, unsigned long n, size_t d) { switch (SCM_ITAG3 (obj)) { case scm_tc3_int_1: @@ -95,7 +95,7 @@ scm_hasher (SCM obj, scm_bits_t n, size_t d) return SCM_INUM(obj) % n; /* SCM_INUMP(obj) */ case scm_tc3_imm24: if (SCM_CHARP(obj)) - return (scm_ubits_t) (scm_downcase(SCM_CHAR(obj))) % n; + return (unsigned)(scm_downcase(SCM_CHAR(obj))) % n; switch (SCM_UNPACK (obj)) { #ifndef SICP case SCM_EOL: @@ -152,14 +152,14 @@ scm_hasher (SCM obj, scm_bits_t n, size_t d) if (len > 5) { size_t i = d/2; - scm_bits_t h = 1; + unsigned long h = 1; while (i--) h = ((h << 8) + (scm_hasher (data[h % len], n, 2))) % n; return h; } else { size_t i = len; - scm_bits_t h = (n)-1; + unsigned long h = (n)-1; while (i--) h = ((h << 8) + (scm_hasher (data[i], n, d/len))) % n; return h; } @@ -182,8 +182,8 @@ scm_hasher (SCM obj, scm_bits_t n, size_t d) -scm_bits_t -scm_ihashq (SCM obj, scm_bits_t n) +unsigned long +scm_ihashq (SCM obj, unsigned long n) { return (SCM_UNPACK (obj) >> 1) % n; } @@ -212,14 +212,14 @@ SCM_DEFINE (scm_hashq, "hashq", 2, 0, 0, -scm_bits_t -scm_ihashv (SCM obj, scm_bits_t n) +unsigned long +scm_ihashv (SCM obj, unsigned long n) { if (SCM_CHARP(obj)) - return ((scm_ubits_t)(scm_downcase(SCM_CHAR(obj)))) % n; /* downcase!?!! */ + return ((unsigned long) (scm_downcase (SCM_CHAR (obj)))) % n; /* downcase!?!! */ if (SCM_NUMP(obj)) - return (scm_bits_t) scm_hasher(obj, n, 10); + return (unsigned long) scm_hasher(obj, n, 10); else return SCM_UNPACK (obj) % n; } @@ -248,10 +248,10 @@ SCM_DEFINE (scm_hashv, "hashv", 2, 0, 0, -scm_bits_t -scm_ihash (SCM obj, scm_bits_t n) +unsigned long +scm_ihash (SCM obj, unsigned long n) { - return (scm_bits_t) scm_hasher (obj, n, 10); + return (unsigned long) scm_hasher (obj, n, 10); } SCM_DEFINE (scm_hash, "hash", 2, 0, 0, diff --git a/libguile/hash.h b/libguile/hash.h index 95bd8581f..5b2d5bb80 100644 --- a/libguile/hash.h +++ b/libguile/hash.h @@ -48,13 +48,13 @@ -extern scm_bits_t scm_string_hash (const unsigned char *str, size_t len); -extern scm_bits_t scm_hasher (SCM obj, scm_bits_t n, size_t d); -extern scm_bits_t scm_ihashq (SCM obj, scm_bits_t n); +extern unsigned long scm_string_hash (const unsigned char *str, size_t len); +extern unsigned long scm_hasher (SCM obj, unsigned long n, size_t d); +extern unsigned long scm_ihashq (SCM obj, unsigned long n); extern SCM scm_hashq (SCM obj, SCM n); -extern scm_bits_t scm_ihashv (SCM obj, scm_bits_t n); +extern unsigned long scm_ihashv (SCM obj, unsigned long n); extern SCM scm_hashv (SCM obj, SCM n); -extern scm_bits_t scm_ihash (SCM obj, scm_bits_t n); +extern unsigned long scm_ihash (SCM obj, unsigned long n); extern SCM scm_hash (SCM obj, SCM n); extern void scm_init_hash (void); diff --git a/libguile/hashtab.c b/libguile/hashtab.c index ef91c7aca..d9f629240 100644 --- a/libguile/hashtab.c +++ b/libguile/hashtab.c @@ -55,20 +55,17 @@ SCM -scm_c_make_hash_table (scm_bits_t k) +scm_c_make_hash_table (unsigned long k) { return scm_c_make_vector (k, SCM_EOL); } SCM -scm_hash_fn_get_handle (SCM table, SCM obj, - scm_bits_t (*hash_fn) (), - SCM (*assoc_fn) (), - void *closure) +scm_hash_fn_get_handle (SCM table,SCM obj,unsigned long (*hash_fn)(),SCM (*assoc_fn)(),void * closure) #define FUNC_NAME "scm_hash_fn_get_handle" { - scm_bits_t k; + unsigned long k; SCM h; SCM_VALIDATE_VECTOR (1, table); @@ -84,13 +81,11 @@ scm_hash_fn_get_handle (SCM table, SCM obj, SCM -scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, - scm_bits_t (*hash_fn) (), - SCM (*assoc_fn) (), - void *closure) +scm_hash_fn_create_handle_x (SCM table,SCM obj,SCM init,unsigned long (*hash_fn)(), + SCM (*assoc_fn)(),void * closure) #define FUNC_NAME "scm_hash_fn_create_handle_x" { - scm_bits_t k; + unsigned long k; SCM it; SCM_ASSERT (SCM_VECTORP (table), table, SCM_ARG1, "hash_fn_create_handle_x"); @@ -121,10 +116,8 @@ scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, SCM -scm_hash_fn_ref (SCM table, SCM obj, SCM dflt, - scm_bits_t (*hash_fn) (), - SCM (*assoc_fn) (), - void *closure) +scm_hash_fn_ref (SCM table,SCM obj,SCM dflt,unsigned long (*hash_fn)(), + SCM (*assoc_fn)(),void * closure) { SCM it = scm_hash_fn_get_handle (table, obj, hash_fn, assoc_fn, closure); if (SCM_CONSP (it)) @@ -137,10 +130,8 @@ scm_hash_fn_ref (SCM table, SCM obj, SCM dflt, SCM -scm_hash_fn_set_x (SCM table, SCM obj, SCM val, - scm_bits_t (*hash_fn) (), - SCM (*assoc_fn) (), - void * closure) +scm_hash_fn_set_x (SCM table,SCM obj,SCM val,unsigned long (*hash_fn)(), + SCM (*assoc_fn)(),void * closure) { SCM it; @@ -154,13 +145,10 @@ scm_hash_fn_set_x (SCM table, SCM obj, SCM val, SCM -scm_hash_fn_remove_x (SCM table, SCM obj, - scm_bits_t (*hash_fn) (), - SCM (*assoc_fn) (), - SCM (*delete_fn) (), - void *closure) +scm_hash_fn_remove_x (SCM table,SCM obj,unsigned long (*hash_fn)(),SCM (*assoc_fn)(), + SCM (*delete_fn)(),void * closure) { - scm_bits_t k; + unsigned long k; SCM h; SCM_ASSERT (SCM_VECTORP (table), table, SCM_ARG1, "hash_fn_remove_x"); @@ -387,13 +375,13 @@ typedef struct scm_ihashx_closure_t -static scm_bits_t -scm_ihashx (SCM obj, scm_bits_t n, scm_ihashx_closure_t *closure) +static unsigned long +scm_ihashx (SCM obj, unsigned long n, scm_ihashx_closure_t *closure) { SCM answer; SCM_DEFER_INTS; answer = scm_apply (closure->hash, - SCM_LIST2 (obj, scm_bits2num (n)), + SCM_LIST2 (obj, scm_ulong2num ((unsigned long)n)), SCM_EOL); SCM_ALLOW_INTS; return SCM_INUM (answer); @@ -555,7 +543,7 @@ SCM_DEFINE (scm_hash_fold, "hash-fold", 3, 0, 0, SCM scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM init, SCM table) { - scm_bits_t i, n = SCM_VECTOR_LENGTH (table); + long i, n = SCM_VECTOR_LENGTH (table); SCM result = init; for (i = 0; i < n; ++i) { diff --git a/libguile/hashtab.h b/libguile/hashtab.h index 1bd2a1483..64a932c61 100644 --- a/libguile/hashtab.h +++ b/libguile/hashtab.h @@ -53,13 +53,13 @@ typedef SCM scm_assoc_fn_t (SCM key, SCM alist, void *closure); typedef SCM scm_delete_fn_t (SCM elt, SCM list); #endif -extern SCM scm_c_make_hash_table (scm_bits_t k); +extern SCM scm_c_make_hash_table (unsigned long k); -extern SCM scm_hash_fn_get_handle (SCM table, SCM obj, scm_bits_t (*hash_fn) (), SCM (*assoc_fn) (), void * closure); -extern SCM scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, scm_bits_t (*hash_fn) (), SCM (*assoc_fn) (), void * closure); -extern SCM scm_hash_fn_ref (SCM table, SCM obj, SCM dflt, scm_bits_t (*hash_fn) (), SCM (*assoc_fn) (), void * closure); -extern SCM scm_hash_fn_set_x (SCM table, SCM obj, SCM val, scm_bits_t (*hash_fn) (), SCM (*assoc_fn) (), void * closure); -extern SCM scm_hash_fn_remove_x (SCM table, SCM obj, scm_bits_t (*hash_fn) (), SCM (*assoc_fn) (), SCM (*delete_fn) (), void * closure); +extern SCM scm_hash_fn_get_handle (SCM table, SCM obj, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), void * closure); +extern SCM scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), void * closure); +extern SCM scm_hash_fn_ref (SCM table, SCM obj, SCM dflt, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), void * closure); +extern SCM scm_hash_fn_set_x (SCM table, SCM obj, SCM val, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), void * closure); +extern SCM scm_hash_fn_remove_x (SCM table, SCM obj, unsigned long (*hash_fn) (), SCM (*assoc_fn) (), SCM (*delete_fn) (), void * closure); extern SCM scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM init, SCM table); extern SCM scm_hashq_get_handle (SCM table, SCM obj); diff --git a/libguile/ioext.c b/libguile/ioext.c index c142d2981..ca51321d8 100644 --- a/libguile/ioext.c +++ b/libguile/ioext.c @@ -297,7 +297,7 @@ SCM_DEFINE (scm_fdes_to_ports, "fdes->ports", 1, 0, 0, { SCM result = SCM_EOL; int int_fd; - scm_bits_t i; + long i; SCM_VALIDATE_INUM_COPY (1,fd,int_fd); diff --git a/libguile/list.c b/libguile/list.c index 6bc0371be..043444aa3 100644 --- a/libguile/list.c +++ b/libguile/list.c @@ -148,10 +148,10 @@ SCM_DEFINE (scm_list_p, "list?", 1, 0, 0, This uses the "tortoise and hare" algorithm to detect "infinitely long" lists (i.e. lists with cycles in their cdrs), and returns -1 if it does find one. */ -scm_bits_t -scm_ilength (SCM sx) +long +scm_ilength(SCM sx) { - scm_bits_t i = 0; + long i = 0; SCM tortoise = sx; SCM hare = sx; @@ -180,7 +180,7 @@ SCM_DEFINE (scm_length, "length", 1, 0, 0, "Return the number of elements in list @var{lst}.") #define FUNC_NAME s_scm_length { - scm_bits_t i; + long i; SCM_VALIDATE_LIST_COPYLEN (1,lst,i); return SCM_MAKINUM (i); } @@ -360,7 +360,7 @@ SCM_DEFINE (scm_list_ref, "list-ref", 2, 0, 0, #define FUNC_NAME s_scm_list_ref { SCM lst = list; - register scm_bits_t i; + unsigned long int i; SCM_VALIDATE_INUM_MIN_COPY (2,k,0,i); while (SCM_CONSP (lst)) { if (i == 0) @@ -384,7 +384,7 @@ SCM_DEFINE (scm_list_set_x, "list-set!", 3, 0, 0, #define FUNC_NAME s_scm_list_set_x { SCM lst = list; - register scm_bits_t i; + unsigned long int i; SCM_VALIDATE_INUM_MIN_COPY (2,k,0,i); while (SCM_CONSP (lst)) { if (i == 0) { @@ -415,7 +415,7 @@ SCM_DEFINE (scm_list_tail, "list-tail", 2, 0, 0, "or returning the results of cdring @var{k} times down @var{lst}.") #define FUNC_NAME s_scm_list_tail { - register scm_bits_t i; + register long i; SCM_VALIDATE_INUM_MIN_COPY (2,k,0,i); while (i-- > 0) { SCM_VALIDATE_CONS (1,lst); @@ -432,7 +432,7 @@ SCM_DEFINE (scm_list_cdr_set_x, "list-cdr-set!", 3, 0, 0, #define FUNC_NAME s_scm_list_cdr_set_x { SCM lst = list; - scm_bits_t i; + unsigned long int i; SCM_VALIDATE_INUM_MIN_COPY (2,k,0,i); while (SCM_CONSP (lst)) { if (i == 0) { @@ -462,7 +462,7 @@ SCM_DEFINE (scm_list_head, "list-head", 2, 0, 0, { SCM answer; SCM * pos; - register scm_bits_t i; + register long i; SCM_VALIDATE_INUM_MIN_COPY (2,k,0,i); answer = SCM_EOL; diff --git a/libguile/list.h b/libguile/list.h index 70a2eca3a..4493816ee 100644 --- a/libguile/list.h +++ b/libguile/list.h @@ -72,7 +72,7 @@ extern SCM scm_list (SCM objs); extern SCM scm_cons_star (SCM arg, SCM objs); extern SCM scm_null_p (SCM x); extern SCM scm_list_p (SCM x); -extern scm_bits_t scm_ilength (SCM sx); +extern long scm_ilength (SCM sx); extern SCM scm_length (SCM x); extern SCM scm_append (SCM args); extern SCM scm_append_x (SCM args); diff --git a/libguile/load.c b/libguile/load.c index b17224600..73eb2b9ab 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -495,7 +495,7 @@ init_build_info () { static struct { char *name; char *value; } info[] = SCM_BUILD_INFO; SCM *loc = SCM_VARIABLE_LOC (scm_c_define ("%guile-build-info", SCM_EOL)); - scm_bits_t i; + unsigned long i; for (i = 0; i < (sizeof (info) / sizeof (info[0])); i++) *loc = scm_acons (scm_str2symbol (info[i].name), diff --git a/libguile/modules.c b/libguile/modules.c index 439925755..5bf40ac89 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -529,7 +529,7 @@ scm_module_reverse_lookup (SCM module, SCM variable) #define FUNC_NAME "module-reverse-lookup" { SCM obarray; - scm_bits_t i, n; + long i, n; if (module == SCM_BOOL_F) obarray = scm_pre_modules_obarray; diff --git a/libguile/numbers.c b/libguile/numbers.c index 261248b62..8f08a74a3 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -4253,22 +4253,6 @@ scm_i_big2dbl (SCM b) #define MAX_VALUE ULONG_MAX #include "libguile/num2integral.i.c" -#define NUM2INTEGRAL scm_num2bits -#define INTEGRAL2NUM scm_bits2num -#define INTEGRAL2BIG scm_i_bits2big -#define ITYPE scm_bits_t -#define MIN_VALUE ((scm_bits_t) ((scm_ubits_t)1 << (sizeof (scm_bits_t) - 1))) -#define MAX_VALUE (~MIN_VALUE) -#include "libguile/num2integral.i.c" - -#define NUM2INTEGRAL scm_num2ubits -#define INTEGRAL2NUM scm_ubits2num -#define INTEGRAL2BIG scm_i_ubits2big -#define UNSIGNED -#define ITYPE scm_ubits_t -#define MAX_VALUE ((scm_ubits_t) ((scm_bits_t) (-1))) -#include "libguile/num2integral.i.c" - #define NUM2INTEGRAL scm_num2ptrdiff #define INTEGRAL2NUM scm_ptrdiff2num #define INTEGRAL2BIG scm_i_ptrdiff2big diff --git a/libguile/numbers.h b/libguile/numbers.h index 09dc4bdbe..e6ec6e10c 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -62,7 +62,7 @@ * SCM_INUMP (SCM_CAR (x)) can give wrong answers. */ -#define SCM_I_FIXNUM_BIT (SCM_BITS_LENGTH - 2) +#define SCM_I_FIXNUM_BIT (SCM_LONG_BIT - 2) #define SCM_MOST_POSITIVE_FIXNUM ((1L << (SCM_I_FIXNUM_BIT - 1)) - 1) #define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM - 1) @@ -115,7 +115,7 @@ /* SCM_INTBUFLEN is the maximum number of characters neccessary for the * printed or scm_string representation of an exact immediate. */ -#define SCM_INTBUFLEN (5 + SCM_BITS_LENGTH) +#define SCM_INTBUFLEN (5 + SCM_LONG_BIT) @@ -177,7 +177,7 @@ #define SCM_BIGSIGN(x) (SCM_CELL_WORD_0 (x) & SCM_BIGSIGNFLAG) #define SCM_BDIGITS(x) ((SCM_BIGDIG *) (SCM_CELL_WORD_1 (x))) #define SCM_SET_BIGNUM_BASE(n, b) (SCM_SET_CELL_WORD_1 ((n), (b))) -#define SCM_NUMDIGS(x) ((size_t) ((scm_ubits_t) SCM_CELL_WORD_0 (x) >> SCM_BIGSIZEFIELD)) +#define SCM_NUMDIGS(x) ((size_t) (SCM_CELL_WORD_0 (x) >> SCM_BIGSIZEFIELD)) #define SCM_SETNUMDIGS(x, v, sign) \ SCM_SET_CELL_WORD_0 (x, \ scm_tc16_big \ @@ -232,8 +232,6 @@ extern SCM scm_i_int2big (int n); extern SCM scm_i_uint2big (unsigned int n); extern SCM scm_i_long2big (long n); extern SCM scm_i_ulong2big (unsigned long n); -extern SCM scm_i_bits2big (scm_bits_t n); -extern SCM scm_i_ubits2big (scm_ubits_t n); extern SCM scm_i_size2big (size_t n); extern SCM scm_i_ptrdiff2big (ptrdiff_t n); @@ -330,8 +328,6 @@ extern SCM scm_int2num (int n); extern SCM scm_uint2num (unsigned int n); extern SCM scm_long2num (long n); extern SCM scm_ulong2num (unsigned long n); -extern SCM scm_bits2num (scm_bits_t n); -extern SCM scm_ubits2num (scm_ubits_t n); extern SCM scm_size2num (size_t n); extern SCM scm_ptrdiff2num (ptrdiff_t n); extern short scm_num2short (SCM num, unsigned long int pos, @@ -346,10 +342,6 @@ extern long scm_num2long (SCM num, unsigned long int pos, const char *s_caller); extern unsigned long scm_num2ulong (SCM num, unsigned long int pos, const char *s_caller); -extern scm_bits_t scm_num2bits (SCM num, unsigned long int pos, - const char *s_caller); -extern scm_ubits_t scm_num2ubits (SCM num, unsigned long int pos, - const char *s_caller); extern ptrdiff_t scm_num2ptrdiff (SCM num, unsigned long int pos, const char *s_caller); extern size_t scm_num2size (SCM num, unsigned long int pos, diff --git a/libguile/objects.c b/libguile/objects.c index 042549ca6..4cec90ba2 100644 --- a/libguile/objects.c +++ b/libguile/objects.c @@ -158,7 +158,7 @@ SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0, case scm_tc7_smob: { - scm_bits_t type = SCM_TYP16 (x); + long type = SCM_TYP16 (x); if (type != scm_tc16_port_with_ps) return scm_smob_class[SCM_TC2SMOBNUM (type)]; x = SCM_PORT_WITH_PS_PORT (x); @@ -251,7 +251,7 @@ SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0, SCM scm_mcache_lookup_cmethod (SCM cache, SCM args) { - scm_bits_t i, n, end, mask; + long i, n, end, mask; SCM ls, methods, z = SCM_CDDR (cache); n = SCM_INUM (SCM_CAR (z)); /* maximum number of specializers */ methods = SCM_CADR (z); @@ -266,8 +266,8 @@ scm_mcache_lookup_cmethod (SCM cache, SCM args) else { /* Compute a hash value */ - scm_bits_t hashset = SCM_INUM (methods); - scm_bits_t j = n; + long hashset = SCM_INUM (methods); + long j = n; mask = SCM_INUM (SCM_CAR (z = SCM_CDDR (z))); methods = SCM_CADR (z); i = 0; @@ -287,7 +287,7 @@ scm_mcache_lookup_cmethod (SCM cache, SCM args) /* Search for match */ do { - scm_bits_t j = n; + long j = n; z = SCM_VELTS (methods)[i]; ls = args; /* list of arguments */ if (SCM_NIMP (ls)) @@ -449,7 +449,7 @@ SCM_DEFINE (scm_object_procedure, "object-procedure", 1, 0, 0, SCM scm_i_make_class_object (SCM meta, SCM layout_string, - scm_ubits_t flags) + unsigned long flags) { SCM c; SCM layout = scm_make_struct_layout (layout_string); @@ -466,7 +466,7 @@ SCM_DEFINE (scm_make_class_object, "make-class-object", 2, 0, 0, "slot layout specified by @var{layout}.") #define FUNC_NAME s_scm_make_class_object { - scm_ubits_t flags = 0; + unsigned long flags = 0; SCM_VALIDATE_STRUCT (1,metaclass); SCM_VALIDATE_STRING (2,layout); if (SCM_EQ_P (metaclass, scm_metaclass_operator)) diff --git a/libguile/objects.h b/libguile/objects.h index 5e3d27f30..3f9b5e9a8 100644 --- a/libguile/objects.h +++ b/libguile/objects.h @@ -214,7 +214,7 @@ extern SCM scm_no_applicable_method; /* Goops functions. */ extern SCM scm_make_extended_class (char *type_name); -extern void scm_make_port_classes (scm_bits_t ptobnum, char *type_name); +extern void scm_make_port_classes (long ptobnum, char *type_name); extern void scm_change_object_class (SCM, SCM, SCM); extern SCM scm_memoize_method (SCM x, SCM args); @@ -239,7 +239,7 @@ extern SCM scm_make_class_object (SCM metaclass, SCM layout); extern SCM scm_make_subclass_object (SCM c, SCM layout); extern SCM scm_i_make_class_object (SCM metaclass, SCM layout_string, - scm_ubits_t flags); + unsigned long flags); extern void scm_init_objects (void); #endif /* OBJECTSH */ diff --git a/libguile/options.h b/libguile/options.h index 7450b7309..5ff2c4fa3 100644 --- a/libguile/options.h +++ b/libguile/options.h @@ -59,7 +59,7 @@ typedef struct scm_option_t /* schizophrenic use: both SCM and int */ - scm_bits_t val; + unsigned long val; /* SCM val */ char *doc; } scm_option_t; diff --git a/libguile/ports.c b/libguile/ports.c index f49a72dfa..9bc8168bd 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -87,7 +87,7 @@ * tags for smobjects (if you know a tag you can get an index and conversely). */ scm_ptob_descriptor_t *scm_ptobs; -scm_bits_t scm_numptob; +long scm_numptob; /* GC marker for a port with stream of SCM type. */ SCM @@ -314,7 +314,7 @@ SCM_DEFINE (scm_drain_input, "drain-input", 1, 0, 0, { SCM result; scm_port_t *pt = SCM_PTAB_ENTRY (port); - scm_bits_t count; + long count; SCM_VALIDATE_OPINPORT (1,port); @@ -424,8 +424,8 @@ SCM_DEFINE (scm_set_current_error_port, "set-current-error-port", 1, 0, 0, scm_port_t **scm_port_table; -scm_bits_t scm_port_table_size = 0; /* Number of ports in scm_port_table. */ -scm_bits_t scm_port_table_room = 20; /* Size of the array. */ +long scm_port_table_size = 0; /* Number of ports in scm_port_table. */ +long scm_port_table_room = 20; /* Size of the array. */ /* Add a port to the table. */ @@ -475,7 +475,7 @@ scm_remove_from_port_table (SCM port) #define FUNC_NAME "scm_remove_from_port_table" { scm_port_t *p = SCM_PTAB_ENTRY (port); - scm_bits_t i = p->entry; + long i = p->entry; if (i >= scm_port_table_size) SCM_MISC_ERROR ("Port not in table: ~S", SCM_LIST1 (port)); @@ -515,7 +515,7 @@ SCM_DEFINE (scm_pt_member, "pt-member", 1, 0, 0, "@code{--enable-guile-debug} builds.") #define FUNC_NAME s_scm_pt_member { - scm_bits_t i; + long i; SCM_VALIDATE_INUM_COPY (1,index,i); if (i < 0 || i >= scm_port_table_size) return SCM_BOOL_F; @@ -709,7 +709,7 @@ SCM_DEFINE (scm_port_for_each, "port-for-each", 1, 0, 0, "have no effect as far as @var{port-for-each} is concerned.\n") #define FUNC_NAME s_scm_port_for_each { - scm_bits_t i; + long i; SCM ports; SCM_VALIDATE_PROC (1, proc); @@ -752,7 +752,7 @@ SCM_DEFINE (scm_close_all_ports_except, "close-all-ports-except", 0, 0, 1, "Use port-for-each instead.") #define FUNC_NAME s_scm_close_all_ports_except { - scm_bits_t i = 0; + long i = 0; SCM_VALIDATE_REST_ARGUMENT (ports); while (i < scm_port_table_size) { @@ -1075,14 +1075,14 @@ scm_c_write (SCM port, const void *ptr, size_t size) void scm_flush (SCM port) { - scm_bits_t i = SCM_PTOBNUM (port); + long i = SCM_PTOBNUM (port); (scm_ptobs[i].flush) (port); } void scm_end_input (SCM port) { - scm_bits_t offset; + long offset; scm_port_t *pt = SCM_PTAB_ENTRY (port); if (pt->read_buf == pt->putback_buf) diff --git a/libguile/ports.h b/libguile/ports.h index fa9198415..1ebbd7ce7 100644 --- a/libguile/ports.h +++ b/libguile/ports.h @@ -70,7 +70,7 @@ typedef enum scm_port_rw_active_t { typedef struct { SCM port; /* Link back to the port object. */ - scm_bits_t entry; /* Index in port table. */ + long entry; /* Index in port table. */ int revealed; /* 0 not revealed, > 1 revealed. * Revealed ports do not get GC'd. */ @@ -133,7 +133,7 @@ typedef struct } scm_port_t; extern scm_port_t **scm_port_table; -extern scm_bits_t scm_port_table_size; /* Number of ports in scm_port_table. */ +extern long scm_port_table_size; /* Number of ports in scm_port_table. */ #define SCM_READ_BUFFER_EMPTY_P(c_port) (c_port->read_pos >= c_port->read_end) @@ -220,8 +220,8 @@ typedef struct scm_ptob_descriptor_t extern scm_ptob_descriptor_t *scm_ptobs; -extern scm_bits_t scm_numptob; -extern scm_bits_t scm_port_table_room; +extern long scm_numptob; +extern long scm_port_table_room; diff --git a/libguile/print.c b/libguile/print.c index 7e08fe49a..0ca427f29 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -282,8 +282,8 @@ grow_ref_stack (scm_print_state *pstate) static void print_circref (SCM port,scm_print_state *pstate,SCM ref) { - register scm_bits_t i; - scm_bits_t self = pstate->top - 1; + register long i; + long self = pstate->top - 1; i = pstate->top - 1; if (SCM_CONSP (pstate->ref_stack[i])) { @@ -548,8 +548,8 @@ taloop: scm_puts ("#(", port); common_vector_printer: { - register scm_bits_t i; - scm_bits_t last = SCM_VECTOR_LENGTH (exp) - 1; + register long i; + long last = SCM_VECTOR_LENGTH (exp) - 1; int cutp = 0; if (pstate->fancyp && SCM_VECTOR_LENGTH (exp) > pstate->length) { @@ -749,7 +749,7 @@ void scm_iprlist (char *hdr,SCM exp,int tlr,SCM port,scm_print_state *pstate) { register SCM hare, tortoise; - scm_bits_t floor = pstate->top - 2; + long floor = pstate->top - 2; scm_puts (hdr, port); /* CHECK_INTS; */ if (pstate->fancyp) @@ -774,7 +774,7 @@ scm_iprlist (char *hdr,SCM exp,int tlr,SCM port,scm_print_state *pstate) scm_iprin1 (SCM_CAR (exp), port, pstate); for (exp = SCM_CDR (exp); SCM_ECONSP (exp); exp = SCM_CDR (exp)) { - register scm_bits_t i; + register long i; for (i = floor; i >= 0; --i) if (SCM_EQ_P (pstate->ref_stack[i], exp)) @@ -797,13 +797,13 @@ end: fancy_printing: { - scm_bits_t n = pstate->length; + long n = pstate->length; scm_iprin1 (SCM_CAR (exp), port, pstate); exp = SCM_CDR (exp); --n; for (; SCM_ECONSP (exp); exp = SCM_CDR (exp)) { - register scm_ubits_t i; + register unsigned long i; for (i = 0; i < pstate->top; ++i) if (SCM_EQ_P (pstate->ref_stack[i], exp)) diff --git a/libguile/procs.c b/libguile/procs.c index 85e9abd08..74f751e6c 100644 --- a/libguile/procs.c +++ b/libguile/procs.c @@ -67,18 +67,18 @@ scm_subr_entry_t *scm_subr_table; /* Increased to 800 on 2001-05-07 -- Guile now has 779 primitives on startup, 786 with guile-readline. 'martin */ -scm_bits_t scm_subr_table_size = 0; -scm_bits_t scm_subr_table_room = 800; +long scm_subr_table_size = 0; +long scm_subr_table_room = 800; SCM -scm_c_make_subr (const char *name, scm_bits_t type, SCM (*fcn) ()) +scm_c_make_subr (const char *name, long type, SCM (*fcn) ()) { register SCM z; - scm_bits_t entry; + long entry; if (scm_subr_table_size == scm_subr_table_room) { - scm_bits_t new_size = scm_subr_table_room * 3 / 2; + long new_size = scm_subr_table_room * 3 / 2; void *new_table = scm_must_realloc ((char *) scm_subr_table, sizeof (scm_subr_entry_t) * scm_subr_table_room, @@ -104,7 +104,7 @@ scm_c_make_subr (const char *name, scm_bits_t type, SCM (*fcn) ()) } SCM -scm_c_define_subr (const char *name, scm_bits_t type, SCM (*fcn) ()) +scm_c_define_subr (const char *name, long type, SCM (*fcn) ()) { SCM subr = scm_c_make_subr (name, type, fcn); scm_define (SCM_SUBR_ENTRY(subr).name, subr); @@ -116,7 +116,7 @@ scm_c_define_subr (const char *name, scm_bits_t type, SCM (*fcn) ()) void scm_free_subr_entry (SCM subr) { - scm_bits_t entry = SCM_SUBRNUM (subr); + long entry = SCM_SUBRNUM (subr); /* Move last entry in table to the free position */ scm_subr_table[entry] = scm_subr_table[scm_subr_table_size - 1]; SCM_SET_SUBRNUM (scm_subr_table[entry].handle, entry); @@ -125,7 +125,7 @@ scm_free_subr_entry (SCM subr) SCM scm_c_make_subr_with_generic (const char *name, - scm_bits_t type, SCM (*fcn) (), SCM *gf) + long type, SCM (*fcn) (), SCM *gf) { SCM subr = scm_c_make_subr (name, type, fcn); SCM_SUBR_ENTRY(subr).generic = gf; @@ -134,7 +134,7 @@ scm_c_make_subr_with_generic (const char *name, SCM scm_c_define_subr_with_generic (const char *name, - scm_bits_t type, SCM (*fcn) (), SCM *gf) + long type, SCM (*fcn) (), SCM *gf) { SCM subr = scm_c_make_subr_with_generic (name, type, fcn, gf); scm_define (SCM_SUBR_ENTRY(subr).name, subr); @@ -144,7 +144,7 @@ scm_c_define_subr_with_generic (const char *name, void scm_mark_subr_table () { - scm_bits_t i; + long i; for (i = 0; i < scm_subr_table_size; ++i) { SCM_SETGCMARK (scm_subr_table[i].name); diff --git a/libguile/procs.h b/libguile/procs.h index acb2bc94f..0f07bb08f 100644 --- a/libguile/procs.h +++ b/libguile/procs.h @@ -158,18 +158,18 @@ typedef struct #define SCM_SETTER(obj) SCM_CELL_OBJECT_2 (obj) extern scm_subr_entry_t *scm_subr_table; -extern scm_bits_t scm_subr_table_size; -extern scm_bits_t scm_subr_table_room; +extern long scm_subr_table_size; +extern long scm_subr_table_room; extern void scm_mark_subr_table (void); extern void scm_free_subr_entry (SCM subr); -extern SCM scm_c_make_subr (const char *name, scm_bits_t type, SCM (*fcn)()); -extern SCM scm_c_make_subr_with_generic (const char *name, scm_bits_t type, +extern SCM scm_c_make_subr (const char *name, long type, SCM (*fcn)()); +extern SCM scm_c_make_subr_with_generic (const char *name, long type, SCM (*fcn)(), SCM *gf); -extern SCM scm_c_define_subr (const char *name, scm_bits_t type, SCM (*fcn)()); -extern SCM scm_c_define_subr_with_generic (const char *name, scm_bits_t type, +extern SCM scm_c_define_subr (const char *name, long type, SCM (*fcn)()); +extern SCM scm_c_define_subr_with_generic (const char *name, long type, SCM (*fcn)(), SCM *gf); extern SCM scm_makcclo (SCM proc, size_t len); extern SCM scm_procedure_p (SCM obj); diff --git a/libguile/ramap.c b/libguile/ramap.c index 3970f6191..a1e290c7a 100644 --- a/libguile/ramap.c +++ b/libguile/ramap.c @@ -166,12 +166,12 @@ do { type (*v0)[2] = (type (*)[2]) SCM_VELTS (ra0);\ break;\ } while (0) -static scm_bits_t +static unsigned long cind (SCM ra, SCM inds) { - scm_bits_t i; + unsigned long i; int k; - scm_bits_t *ve = (scm_bits_t *) SCM_VELTS (inds); + long *ve = (long*) SCM_VELTS (inds); if (!SCM_ARRAYP (ra)) return *ve; i = SCM_ARRAY_BASE (ra); @@ -196,7 +196,7 @@ scm_ra_matchp (SCM ra0, SCM ras) scm_array_dim_t dims; scm_array_dim_t *s0 = &dims; scm_array_dim_t *s1; - scm_bits_t bas0 = 0; + unsigned long bas0 = 0; int i, ndim = 1; int exact = 2 /* 4 */ ; /* Don't care about values >2 (yet?) */ if (SCM_IMP (ra0)) return 0; @@ -255,7 +255,7 @@ scm_ra_matchp (SCM ra0, SCM ras) case scm_tc7_dvect: case scm_tc7_cvect: { - scm_bits_t length; + unsigned long int length; if (1 != ndim) return 0; @@ -322,7 +322,7 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what) SCM inds, z; SCM vra0, ra1, vra1; SCM lvra, *plvra; - scm_bits_t *vinds; + long *vinds; int k, kmax; switch (scm_ra_matchp (ra0, lra)) { @@ -339,7 +339,7 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what) if (SCM_IMP (vra0)) goto gencase; if (!SCM_ARRAYP (vra0)) { - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (vra0)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (vra0)); vra1 = scm_make_ra (1); SCM_ARRAY_BASE (vra1) = 0; SCM_ARRAY_DIMS (vra1)->lbnd = 0; @@ -397,7 +397,7 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what) } else { - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (ra0)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (ra0)); kmax = 0; SCM_ARRAY_DIMS (vra0)->lbnd = 0; SCM_ARRAY_DIMS (vra0)->ubnd = length - 1; @@ -429,7 +429,7 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what) plvra = SCM_CDRLOC (*plvra); } inds = scm_make_uve (SCM_ARRAY_NDIM (ra0), SCM_MAKINUM (-1L)); - vinds = (scm_bits_t *) SCM_VELTS (inds); + vinds = (long *) SCM_VELTS (inds); for (k = 0; k <= kmax; k++) vinds[k] = SCM_ARRAY_DIMS (ra0)[k].lbnd; k = kmax; @@ -478,10 +478,10 @@ int scm_array_fill_int (SCM ra, SCM fill, SCM ignore) #define FUNC_NAME s_scm_array_fill_x { - scm_bits_t i; - scm_bits_t n = SCM_ARRAY_DIMS (ra)->ubnd - SCM_ARRAY_DIMS (ra)->lbnd + 1; - scm_bits_t inc = SCM_ARRAY_DIMS (ra)->inc; - scm_bits_t base = SCM_ARRAY_BASE (ra); + unsigned long i; + unsigned long n = SCM_ARRAY_DIMS (ra)->ubnd - SCM_ARRAY_DIMS (ra)->lbnd + 1; + long inc = SCM_ARRAY_DIMS (ra)->inc; + unsigned long base = SCM_ARRAY_BASE (ra); ra = SCM_ARRAY_V (ra); switch SCM_TYP7 (ra) @@ -511,27 +511,27 @@ scm_array_fill_int (SCM ra, SCM fill, SCM ignore) break; case scm_tc7_bvect: { /* scope */ - scm_bits_t *ve = (scm_bits_t *) SCM_VELTS (ra); - if (1 == inc && (n >= SCM_BITS_LENGTH || n == SCM_BITVECTOR_LENGTH (ra))) + long *ve = (long *) SCM_VELTS (ra); + if (1 == inc && (n >= SCM_LONG_BIT || n == SCM_BITVECTOR_LENGTH (ra))) { - i = base / SCM_BITS_LENGTH; + i = base / SCM_LONG_BIT; if (SCM_FALSEP (fill)) { - if (base % SCM_BITS_LENGTH) /* leading partial word */ - ve[i++] &= ~(~0L << (base % SCM_BITS_LENGTH)); - for (; i < (base + n) / SCM_BITS_LENGTH; i++) + if (base % SCM_LONG_BIT) /* leading partial word */ + ve[i++] &= ~(~0L << (base % SCM_LONG_BIT)); + for (; i < (base + n) / SCM_LONG_BIT; i++) ve[i] = 0L; - if ((base + n) % SCM_BITS_LENGTH) /* trailing partial word */ - ve[i] &= (~0L << ((base + n) % SCM_BITS_LENGTH)); + if ((base + n) % SCM_LONG_BIT) /* trailing partial word */ + ve[i] &= (~0L << ((base + n) % SCM_LONG_BIT)); } else if (SCM_EQ_P (fill, SCM_BOOL_T)) { - if (base % SCM_BITS_LENGTH) - ve[i++] |= ~0L << (base % SCM_BITS_LENGTH); - for (; i < (base + n) / SCM_BITS_LENGTH; i++) + if (base % SCM_LONG_BIT) + ve[i++] |= ~0L << (base % SCM_LONG_BIT); + for (; i < (base + n) / SCM_LONG_BIT; i++) ve[i] = ~0L; - if ((base + n) % SCM_BITS_LENGTH) - ve[i] |= ~(~0L << ((base + n) % SCM_BITS_LENGTH)); + if ((base + n) % SCM_LONG_BIT) + ve[i] |= ~(~0L << ((base + n) % SCM_LONG_BIT)); } else badarg2:SCM_WRONG_TYPE_ARG (2, fill); @@ -540,10 +540,10 @@ scm_array_fill_int (SCM ra, SCM fill, SCM ignore) { if (SCM_FALSEP (fill)) for (i = base; n--; i += inc) - ve[i / SCM_BITS_LENGTH] &= ~(1L << (i % SCM_BITS_LENGTH)); + ve[i / SCM_LONG_BIT] &= ~(1L << (i % SCM_LONG_BIT)); else if (SCM_EQ_P (fill, SCM_BOOL_T)) for (i = base; n--; i += inc) - ve[i / SCM_BITS_LENGTH] |= (1L << (i % SCM_BITS_LENGTH)); + ve[i / SCM_LONG_BIT] |= (1L << (i % SCM_LONG_BIT)); else goto badarg2; } @@ -637,9 +637,9 @@ scm_array_fill_int (SCM ra, SCM fill, SCM ignore) static int racp (SCM src, SCM dst) { - scm_bits_t n = (SCM_ARRAY_DIMS (src)->ubnd - SCM_ARRAY_DIMS (src)->lbnd + 1); - scm_bits_t inc_d, inc_s = SCM_ARRAY_DIMS (src)->inc; - scm_bits_t i_d, i_s = SCM_ARRAY_BASE (src); + long n = (SCM_ARRAY_DIMS (src)->ubnd - SCM_ARRAY_DIMS (src)->lbnd + 1); + long inc_d, inc_s = SCM_ARRAY_DIMS (src)->inc; + unsigned long i_d, i_s = SCM_ARRAY_BASE (src); dst = SCM_CAR (dst); inc_d = SCM_ARRAY_DIMS (dst)->inc; i_d = SCM_ARRAY_BASE (dst); @@ -674,22 +674,21 @@ racp (SCM src, SCM dst) case scm_tc7_bvect: if (SCM_TYP7 (src) != scm_tc7_bvect) goto gencase; - if (1 == inc_d && 1 == inc_s && i_s % SCM_BITS_LENGTH == i_d % SCM_BITS_LENGTH - && n >= SCM_BITS_LENGTH) + if (1 == inc_d && 1 == inc_s && i_s % SCM_LONG_BIT == i_d % SCM_LONG_BIT && n >= SCM_LONG_BIT) { - scm_bits_t *sv = (scm_bits_t *) SCM_VELTS (src); - scm_bits_t *dv = (scm_bits_t *) SCM_VELTS (dst); - sv += i_s / SCM_BITS_LENGTH; - dv += i_d / SCM_BITS_LENGTH; - if (i_s % SCM_BITS_LENGTH) + long *sv = (long *) SCM_VELTS (src); + long *dv = (long *) SCM_VELTS (dst); + sv += i_s / SCM_LONG_BIT; + dv += i_d / SCM_LONG_BIT; + if (i_s % SCM_LONG_BIT) { /* leading partial word */ - *dv = (*dv & ~(~0L << (i_s % SCM_BITS_LENGTH))) | (*sv & (~0L << (i_s % SCM_BITS_LENGTH))); + *dv = (*dv & ~(~0L << (i_s % SCM_LONG_BIT))) | (*sv & (~0L << (i_s % SCM_LONG_BIT))); dv++; sv++; - n -= SCM_BITS_LENGTH - (i_s % SCM_BITS_LENGTH); + n -= SCM_LONG_BIT - (i_s % SCM_LONG_BIT); } IVDEP (src != dst, - for (; n >= SCM_BITS_LENGTH; n -= SCM_BITS_LENGTH, sv++, dv++) + for (; n >= SCM_LONG_BIT; n -= SCM_LONG_BIT, sv++, dv++) *dv = *sv;) if (n) /* trailing partial word */ *dv = (*dv & (~0L << n)) | (*sv & ~(~0L << n)); @@ -854,11 +853,11 @@ int scm_ra_eqp (SCM ra0, SCM ras) { SCM ra1 = SCM_CAR (ras), ra2 = SCM_CAR (SCM_CDR (ras)); - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; - scm_bits_t inc2 = SCM_ARRAY_DIMS (ra1)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; + long inc2 = SCM_ARRAY_DIMS (ra1)->inc; ra0 = SCM_ARRAY_V (ra0); ra1 = SCM_ARRAY_V (ra1); ra2 = SCM_ARRAY_V (ra2); @@ -913,11 +912,11 @@ scm_ra_eqp (SCM ra0, SCM ras) static int ra_compare (SCM ra0,SCM ra1,SCM ra2,int opt) { - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; - scm_bits_t inc2 = SCM_ARRAY_DIMS (ra1)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; + long inc2 = SCM_ARRAY_DIMS (ra1)->inc; ra0 = SCM_ARRAY_V (ra0); ra1 = SCM_ARRAY_V (ra1); ra2 = SCM_ARRAY_V (ra2); @@ -1007,15 +1006,15 @@ scm_ra_greqp (SCM ra0, SCM ras) int scm_ra_sum (SCM ra0, SCM ras) { - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; ra0 = SCM_ARRAY_V (ra0); if (SCM_NNULLP(ras)) { SCM ra1 = SCM_CAR (ras); - scm_bits_t i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); switch (SCM_TYP7 (ra0) == SCM_TYP7 (ra1) ? SCM_TYP7 (ra0) : 0) { @@ -1046,9 +1045,9 @@ scm_ra_sum (SCM ra0, SCM ras) int scm_ra_difference (SCM ra0, SCM ras) { - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; ra0 = SCM_ARRAY_V (ra0); if (SCM_NULLP (ras)) { @@ -1074,8 +1073,8 @@ scm_ra_difference (SCM ra0, SCM ras) else { SCM ra1 = SCM_CAR (ras); - scm_bits_t i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); switch (SCM_TYP7 (ra0) == SCM_TYP7 (ra1) ? SCM_TYP7 (ra0) : 0) { @@ -1102,15 +1101,15 @@ scm_ra_difference (SCM ra0, SCM ras) int scm_ra_product (SCM ra0, SCM ras) { - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; ra0 = SCM_ARRAY_V (ra0); if (SCM_NNULLP (ras)) { SCM ra1 = SCM_CAR (ras); - scm_bits_t i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); switch (SCM_TYP7 (ra0) == SCM_TYP7 (ra1) ? SCM_TYP7 (ra0) : 0) { @@ -1153,9 +1152,9 @@ scm_ra_product (SCM ra0, SCM ras) int scm_ra_divide (SCM ra0, SCM ras) { - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; ra0 = SCM_ARRAY_V (ra0); if (SCM_NULLP (ras)) { @@ -1189,8 +1188,8 @@ scm_ra_divide (SCM ra0, SCM ras) else { SCM ra1 = SCM_CAR (ras); - scm_bits_t i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); switch (SCM_TYP7 (ra0) == SCM_TYP7 (ra1) ? SCM_TYP7 (ra0) : 0) { @@ -1238,10 +1237,10 @@ scm_array_identity (SCM dst, SCM src) static int ramap (SCM ra0,SCM proc,SCM ras) { - scm_bits_t i = SCM_ARRAY_DIMS (ra0)->lbnd; - scm_bits_t inc = SCM_ARRAY_DIMS (ra0)->inc; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd; - scm_bits_t base = SCM_ARRAY_BASE (ra0) - i * inc; + long i = SCM_ARRAY_DIMS (ra0)->lbnd; + long inc = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd; + long base = SCM_ARRAY_BASE (ra0) - i * inc; ra0 = SCM_ARRAY_V (ra0); if (SCM_NULLP (ras)) for (; i <= n; i++) @@ -1250,8 +1249,8 @@ ramap (SCM ra0,SCM proc,SCM ras) { SCM ra1 = SCM_CAR (ras); SCM args, *ve = &ras; - scm_bits_t k, i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long k, i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); ras = SCM_CDR (ras); if (SCM_NULLP(ras)) @@ -1279,9 +1278,9 @@ ramap_cxr (SCM ra0,SCM proc,SCM ras) { SCM ra1 = SCM_CAR (ras); SCM e1 = SCM_UNDEFINED; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc, inc1 = SCM_ARRAY_DIMS (ra1)->inc; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra1)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc, inc1 = SCM_ARRAY_DIMS (ra1)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra1)->lbnd + 1; ra0 = SCM_ARRAY_V (ra0); ra1 = SCM_ARRAY_V (ra1); switch (SCM_TYP7 (ra0)) @@ -1340,11 +1339,11 @@ ramap_rp (SCM ra0,SCM proc,SCM ras) { SCM ra1 = SCM_CAR (ras), ra2 = SCM_CAR (SCM_CDR (ras)); SCM e1 = SCM_UNDEFINED, e2 = SCM_UNDEFINED; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; - scm_bits_t inc2 = SCM_ARRAY_DIMS (ra1)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; + long inc2 = SCM_ARRAY_DIMS (ra1)->inc; ra0 = SCM_ARRAY_V (ra0); ra1 = SCM_ARRAY_V (ra1); ra2 = SCM_ARRAY_V (ra2); @@ -1425,9 +1424,9 @@ ramap_1 (SCM ra0,SCM proc,SCM ras) { SCM ra1 = SCM_CAR (ras); SCM e1 = SCM_UNDEFINED; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc, inc1 = SCM_ARRAY_DIMS (ra1)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc, inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra0 = SCM_ARRAY_V (ra0); ra1 = SCM_ARRAY_V (ra1); if (scm_tc7_vector == SCM_TYP7 (ra0) || scm_tc7_wvect == SCM_TYP7 (ra0)) @@ -1446,9 +1445,9 @@ ramap_2o (SCM ra0,SCM proc,SCM ras) { SCM ra1 = SCM_CAR (ras); SCM e1 = SCM_UNDEFINED; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc, inc1 = SCM_ARRAY_DIMS (ra1)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc, inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra0 = SCM_ARRAY_V (ra0); ra1 = SCM_ARRAY_V (ra1); ras = SCM_CDR (ras); @@ -1469,8 +1468,8 @@ ramap_2o (SCM ra0,SCM proc,SCM ras) { SCM ra2 = SCM_CAR (ras); SCM e2 = SCM_UNDEFINED; - scm_bits_t i2 = SCM_ARRAY_BASE (ra2); - scm_bits_t inc2 = SCM_ARRAY_DIMS (ra2)->inc; + unsigned long i2 = SCM_ARRAY_BASE (ra2); + long inc2 = SCM_ARRAY_DIMS (ra2)->inc; ra2 = SCM_ARRAY_V (ra2); if (scm_tc7_vector == SCM_TYP7 (ra0) || scm_tc7_wvect == SCM_TYP7 (ra0)) for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) @@ -1492,9 +1491,9 @@ static int ramap_a (SCM ra0,SCM proc,SCM ras) { SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1; + unsigned long i0 = SCM_ARRAY_BASE (ra0); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; ra0 = SCM_ARRAY_V (ra0); if (SCM_NULLP (ras)) for (; n-- > 0; i0 += inc0) @@ -1502,8 +1501,8 @@ ramap_a (SCM ra0,SCM proc,SCM ras) else { SCM ra1 = SCM_CAR (ras); - scm_bits_t i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); for (; n-- > 0; i0 += inc0, i1 += inc1) scm_array_set_x (ra0, SCM_SUBRF (proc) (RVREF (ra0, i0, e0), RVREF (ra1, i1, e1)), @@ -1632,10 +1631,10 @@ SCM_DEFINE (scm_array_map_x, "array-map!", 2, 0, 1, static int rafe (SCM ra0,SCM proc,SCM ras) { - scm_bits_t i = SCM_ARRAY_DIMS (ra0)->lbnd; - scm_bits_t i0 = SCM_ARRAY_BASE (ra0); - scm_bits_t inc0 = SCM_ARRAY_DIMS (ra0)->inc; - scm_bits_t n = SCM_ARRAY_DIMS (ra0)->ubnd; + long i = SCM_ARRAY_DIMS (ra0)->lbnd; + unsigned long i0 = SCM_ARRAY_BASE (ra0); + long inc0 = SCM_ARRAY_DIMS (ra0)->inc; + long n = SCM_ARRAY_DIMS (ra0)->ubnd; ra0 = SCM_ARRAY_V (ra0); if (SCM_NULLP (ras)) for (; i <= n; i++, i0 += inc0) @@ -1644,8 +1643,8 @@ rafe (SCM ra0,SCM proc,SCM ras) { SCM ra1 = SCM_CAR (ras); SCM args, *ve = &ras; - scm_bits_t k, i1 = SCM_ARRAY_BASE (ra1); - scm_bits_t inc1 = SCM_ARRAY_DIMS (ra1)->inc; + unsigned long k, i1 = SCM_ARRAY_BASE (ra1); + long inc1 = SCM_ARRAY_DIMS (ra1)->inc; ra1 = SCM_ARRAY_V (ra1); ras = SCM_CDR (ras); if (SCM_NULLP(ras)) @@ -1702,7 +1701,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0, "@end lisp") #define FUNC_NAME s_scm_array_index_map_x { - scm_bits_t i; + unsigned long i; SCM_VALIDATE_NIM (1,ra); SCM_VALIDATE_PROC (2,proc); switch (SCM_TYP7(ra)) @@ -1730,7 +1729,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0, case scm_tc7_dvect: case scm_tc7_cvect: { - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (ra)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (ra)); for (i = 0; i < length; i++) scm_array_set_x (ra, scm_apply (proc, SCM_MAKINUM (i), scm_listofnull), SCM_MAKINUM (i)); @@ -1741,7 +1740,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0, { SCM args = SCM_EOL; SCM inds = scm_make_uve (SCM_ARRAY_NDIM (ra), SCM_MAKINUM (-1L)); - scm_bits_t *vinds = (scm_bits_t *) SCM_VELTS (inds); + long *vinds = (long *) SCM_VELTS (inds); int j, k, kmax = SCM_ARRAY_NDIM (ra) - 1; if (kmax < 0) return scm_array_set_x (ra, scm_apply(proc, SCM_EOL, SCM_EOL), @@ -1788,9 +1787,9 @@ static int raeql_1 (SCM ra0,SCM as_equal,SCM ra1) { SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED; - scm_bits_t i0 = 0, i1 = 0; - scm_bits_t inc0 = 1, inc1 = 1; - scm_bits_t n; + unsigned long i0 = 0, i1 = 0; + long inc0 = 1, inc1 = 1; + unsigned long n; ra1 = SCM_CAR (ra1); if (SCM_ARRAYP(ra0)) { @@ -1918,7 +1917,7 @@ raeql (SCM ra0,SCM as_equal,SCM ra1) SCM v0 = ra0, v1 = ra1; scm_array_dim_t dim0, dim1; scm_array_dim_t *s0 = &dim0, *s1 = &dim1; - scm_bits_t bas0 = 0, bas1 = 0; + unsigned long bas0 = 0, bas1 = 0; int k, unroll = 1, vlen = 1, ndim = 1; if (SCM_ARRAYP (ra0)) { diff --git a/libguile/root.c b/libguile/root.c index 23ca98256..f3d6edd86 100644 --- a/libguile/root.c +++ b/libguile/root.c @@ -171,7 +171,7 @@ scm_make_root (SCM parent) #if 0 SCM scm_exitval; /* INUM with return value */ #endif -static scm_bits_t n_dynamic_roots = 0; +static long n_dynamic_roots = 0; /* cwdr fills out both of these structures, and then passes a pointer diff --git a/libguile/rw.c b/libguile/rw.c index e0d271cf5..28d4ea604 100644 --- a/libguile/rw.c +++ b/libguile/rw.c @@ -111,13 +111,13 @@ SCM_DEFINE (scm_read_string_x_partial, "read-string!/partial", 1, 3, 0, #define FUNC_NAME s_scm_read_string_x_partial { char *dest; - scm_bits_t read_len; - scm_bits_t chars_read = 0; + long read_len; + long chars_read = 0; int fdes; { - scm_bits_t offset; - scm_bits_t last; + long offset; + long last; SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, dest, 3, start, offset, 4, end, last); diff --git a/libguile/smob.c b/libguile/smob.c index a487b9715..e2d9fcb7c 100644 --- a/libguile/smob.c +++ b/libguile/smob.c @@ -67,7 +67,7 @@ */ #define MAX_SMOB_COUNT 256 -scm_bits_t scm_numsmob; +long scm_numsmob; scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT]; /* {Mark} @@ -119,7 +119,7 @@ scm_smob_free (SCM obj) int scm_smob_print (SCM exp, SCM port, scm_print_state *pstate) { - size_t n = SCM_SMOBNUM (exp); + long n = SCM_SMOBNUM (exp); scm_puts ("#<", port); scm_puts (SCM_SMOBNAME (n) ? SCM_SMOBNAME (n) : "smob", port); scm_putc (' ', port); @@ -289,7 +289,7 @@ scm_bits_t scm_make_smob_type (char *name, size_t size) #define FUNC_NAME "scm_make_smob_type" { - size_t new_smob; + long new_smob; SCM_ENTER_A_SECTION; /* scm_numsmob */ new_smob = scm_numsmob; @@ -453,7 +453,7 @@ scm_set_smob_apply (scm_bits_t tc, SCM (*apply) (), SCM scm_make_smob (scm_bits_t tc) { - size_t n = SCM_TC2SMOBNUM (tc); + long n = SCM_TC2SMOBNUM (tc); size_t size = scm_smobs[n].size; SCM z; SCM_NEWCELL (z); @@ -487,7 +487,7 @@ scm_make_smob_type_mfpe (char *name, size_t size, int (*print) (SCM, SCM, scm_print_state *), SCM (*equalp) (SCM, SCM)) { - scm_bits_t answer = scm_make_smob_type (name, size); + long answer = scm_make_smob_type (name, size); scm_set_smob_mfpe (answer, mark, free, print, equalp); return answer; } @@ -526,7 +526,7 @@ free_print (SCM exp, SCM port, scm_print_state *pstate) void scm_smob_prehistory () { - size_t i; + long i; scm_bits_t tc; scm_numsmob = 0; diff --git a/libguile/smob.h b/libguile/smob.h index 9cbf38738..c0dd0976a 100644 --- a/libguile/smob.h +++ b/libguile/smob.h @@ -124,7 +124,7 @@ do { \ #define SCM_SMOB_APPLY_2(x,a1,a2) (SCM_SMOB_DESCRIPTOR (x).apply_2 (x, (a1), (a2))) #define SCM_SMOB_APPLY_3(x,a1,a2,rst) (SCM_SMOB_DESCRIPTOR (x).apply_3 (x, (a1), (a2), (rst))) -extern scm_bits_t scm_numsmob; +extern long scm_numsmob; extern scm_smob_descriptor scm_smobs[]; diff --git a/libguile/sort.c b/libguile/sort.c index 5b5dc9584..5f849328f 100644 --- a/libguile/sort.c +++ b/libguile/sort.c @@ -456,7 +456,7 @@ SCM_DEFINE (scm_sorted_p, "sorted?", 2, 0, 0, "applied to all elements i - 1 and i") #define FUNC_NAME s_scm_sorted_p { - scm_bits_t len, j; /* list/vector length, temp j */ + long len, j; /* list/vector length, temp j */ SCM item, rest; /* rest of items loop variable */ SCM *vp; cmp_fun_t cmp = scm_cmp_function (less); @@ -528,7 +528,7 @@ SCM_DEFINE (scm_merge, "merge", 3, 0, 0, "Note: this does _not_ accept vectors.") #define FUNC_NAME s_scm_merge { - scm_bits_t alen, blen; /* list lengths */ + long alen, blen; /* list lengths */ SCM build, last; cmp_fun_t cmp = scm_cmp_function (less); SCM_VALIDATE_NIM (3,less); @@ -641,7 +641,7 @@ SCM_DEFINE (scm_merge_x, "merge!", 3, 0, 0, "Note: this does _not_ accept vectors.") #define FUNC_NAME s_scm_merge_x { - scm_bits_t alen, blen; /* list lengths */ + long alen, blen; /* list lengths */ SCM_VALIDATE_NIM (3,less); if (SCM_NULLP (alist)) @@ -669,13 +669,13 @@ static SCM scm_merge_list_step (SCM * seq, cmp_fun_t cmp, SCM less, - scm_bits_t n) + long n) { SCM a, b; if (n > 2) { - scm_bits_t mid = n / 2; + long mid = n / 2; a = scm_merge_list_step (seq, cmp, less, mid); b = scm_merge_list_step (seq, cmp, less, n - mid); return scm_merge_list_x (a, b, mid, n - mid, cmp, less); @@ -717,7 +717,7 @@ SCM_DEFINE (scm_sort_x, "sort!", 2, 0, 0, "This is not a stable sort.") #define FUNC_NAME s_scm_sort_x { - scm_bits_t len; /* list/vector length */ + long len; /* list/vector length */ if (SCM_NULLP(items)) return SCM_EOL; @@ -757,7 +757,7 @@ SCM_DEFINE (scm_sort, "sort", 2, 0, 0, SCM_VALIDATE_NIM (2,less); if (SCM_CONSP (items)) { - scm_bits_t len; + long len; SCM_VALIDATE_LIST_COPYLEN (1,items,len); items = scm_list_copy (items); @@ -767,7 +767,7 @@ SCM_DEFINE (scm_sort, "sort", 2, 0, 0, /* support ordinary vectors even if arrays not available? */ else if (SCM_VECTORP (items)) { - scm_bits_t len = SCM_VECTOR_LENGTH (items); + long len = SCM_VECTOR_LENGTH (items); SCM sortvec = scm_make_uve (len, scm_array_prototype (items)); scm_array_copy_x (items, sortvec); @@ -788,15 +788,15 @@ scm_merge_vector_x (void *const vecbase, void *const tempbase, cmp_fun_t cmp, SCM less, - scm_bits_t low, - scm_bits_t mid, - scm_bits_t high) + long low, + long mid, + long high) { register SCM *vp = (SCM *) vecbase; register SCM *temp = (SCM *) tempbase; - scm_bits_t it; /* Index for temp vector */ - scm_bits_t i1 = low; /* Index for lower vector segment */ - scm_bits_t i2 = mid + 1; /* Index for upper vector segment */ + long it; /* Index for temp vector */ + long i1 = low; /* Index for lower vector segment */ + long i2 = mid + 1; /* Index for upper vector segment */ /* Copy while both segments contain more characters */ for (it = low; (i1 <= mid) && (i2 <= high); ++it) @@ -823,12 +823,12 @@ scm_merge_vector_step (void *const vp, void *const temp, cmp_fun_t cmp, SCM less, - scm_bits_t low, - scm_bits_t high) + long low, + long high) { if (high > low) { - scm_bits_t mid = (low + high) / 2; + long mid = (low + high) / 2; scm_merge_vector_step (vp, temp, cmp, less, low, mid); scm_merge_vector_step (vp, temp, cmp, less, mid+1, high); scm_merge_vector_x (vp, temp, cmp, less, low, mid, high); @@ -847,7 +847,7 @@ SCM_DEFINE (scm_stable_sort_x, "stable-sort!", 2, 0, 0, "This is a stable sort.") #define FUNC_NAME s_scm_stable_sort_x { - scm_bits_t len; /* list/vector length */ + long len; /* list/vector length */ if (SCM_NULLP (items)) return SCM_EOL; @@ -887,7 +887,7 @@ SCM_DEFINE (scm_stable_sort, "stable-sort", 2, 0, 0, "This is a stable sort.") #define FUNC_NAME s_scm_stable_sort { - scm_bits_t len; /* list/vector length */ + long len; /* list/vector length */ if (SCM_NULLP (items)) return SCM_EOL; @@ -933,7 +933,7 @@ SCM_DEFINE (scm_sort_list_x, "sort-list!", 2, 0, 0, "This is a stable sort.") #define FUNC_NAME s_scm_sort_list_x { - scm_bits_t len; + long len; SCM_VALIDATE_LIST_COPYLEN (1,items,len); SCM_VALIDATE_NIM (2,less); return scm_merge_list_step (&items, scm_cmp_function (less), less, len); @@ -947,7 +947,7 @@ SCM_DEFINE (scm_sort_list, "sort-list", 2, 0, 0, "list elements. This is a stable sort.") #define FUNC_NAME s_scm_sort_list { - scm_bits_t len; + long len; SCM_VALIDATE_LIST_COPYLEN (1,items,len); SCM_VALIDATE_NIM (2,less); items = scm_list_copy (items); diff --git a/libguile/stacks.c b/libguile/stacks.c index 9085bec68..d6a6e16af 100644 --- a/libguile/stacks.c +++ b/libguile/stacks.c @@ -153,10 +153,10 @@ * is read from a continuation. */ static scm_bits_t -stack_depth (scm_debug_frame_t *dframe,scm_bits_t offset,SCM *id,int *maxp) +stack_depth (scm_debug_frame_t *dframe,long offset,SCM *id,int *maxp) { - scm_bits_t n; - scm_bits_t max_depth = SCM_BACKTRACE_MAXDEPTH; + long n; + long max_depth = SCM_BACKTRACE_MAXDEPTH; for (n = 0; dframe && !SCM_VOIDFRAMEP (*dframe) && n < max_depth; dframe = RELOC_FRAME (dframe->prev, offset)) @@ -185,7 +185,7 @@ stack_depth (scm_debug_frame_t *dframe,scm_bits_t offset,SCM *id,int *maxp) /* Read debug info from DFRAME into IFRAME. */ static void -read_frame (scm_debug_frame_t *dframe,scm_bits_t offset,scm_info_frame_t *iframe) +read_frame (scm_debug_frame_t *dframe,long offset,scm_info_frame_t *iframe) { scm_bits_t flags = SCM_UNPACK (SCM_INUM0); /* UGh. */ if (SCM_EVALFRAMEP (*dframe)) @@ -252,7 +252,7 @@ do { \ */ static scm_bits_t -read_frames (scm_debug_frame_t *dframe,scm_bits_t offset,scm_bits_t n,scm_info_frame_t *iframes) +read_frames (scm_debug_frame_t *dframe,long offset,long n,scm_info_frame_t *iframes) { scm_info_frame_t *iframe = iframes; scm_debug_info_t *info; @@ -345,11 +345,11 @@ read_frames (scm_debug_frame_t *dframe,scm_bits_t offset,scm_bits_t n,scm_info_f */ static void -narrow_stack (SCM stack,scm_bits_t inner,SCM inner_key,scm_bits_t outer,SCM outer_key) +narrow_stack (SCM stack,long inner,SCM inner_key,long outer,SCM outer_key) { scm_stack_t *s = SCM_STACK (stack); - scm_bits_t i; - scm_bits_t n = s->length; + long i; + long n = s->length; /* Cut inner part. */ if (SCM_EQ_P (inner_key, SCM_BOOL_T)) @@ -421,11 +421,11 @@ SCM_DEFINE (scm_make_stack, "make-stack", 1, 0, 1, "resulting stack will be narrowed.") #define FUNC_NAME s_scm_make_stack { - scm_bits_t n, size; + long n, size; int maxp; scm_debug_frame_t *dframe = scm_last_debug_frame; scm_info_frame_t *iframe; - scm_bits_t offset = 0; + long offset = 0; SCM stack, id; SCM inner_cut, outer_cut; @@ -514,7 +514,7 @@ SCM_DEFINE (scm_stack_id, "stack-id", 1, 0, 0, #define FUNC_NAME s_scm_stack_id { scm_debug_frame_t *dframe; - scm_bits_t offset = 0; + long offset = 0; if (SCM_EQ_P (stack, SCM_BOOL_T)) dframe = scm_last_debug_frame; else @@ -588,7 +588,7 @@ SCM_DEFINE (scm_last_stack_frame, "last-stack-frame", 1, 0, 0, #define FUNC_NAME s_scm_last_stack_frame { scm_debug_frame_t *dframe; - scm_bits_t offset = 0; + long offset = 0; SCM stack; SCM_VALIDATE_NIM (1,obj); @@ -672,7 +672,7 @@ SCM_DEFINE (scm_frame_previous, "frame-previous", 1, 0, 0, "@var{frame} is the first frame in its stack.") #define FUNC_NAME s_scm_frame_previous { - scm_bits_t n; + long n; SCM_VALIDATE_FRAME (1,frame); n = SCM_INUM (SCM_CDR (frame)) + 1; if (n >= SCM_STACK_LENGTH (SCM_CAR (frame))) @@ -688,7 +688,7 @@ SCM_DEFINE (scm_frame_next, "frame-next", 1, 0, 0, "@var{frame} is the last frame in its stack.") #define FUNC_NAME s_scm_frame_next { - scm_bits_t n; + long n; SCM_VALIDATE_FRAME (1,frame); n = SCM_INUM (SCM_CDR (frame)) - 1; if (n < 0) diff --git a/libguile/stacks.h b/libguile/stacks.h index b596f87cf..b86d87aa3 100644 --- a/libguile/stacks.h +++ b/libguile/stacks.h @@ -69,8 +69,8 @@ typedef struct scm_info_frame_t { typedef struct scm_stack_t { SCM id; /* Stack id */ scm_info_frame_t *frames; /* Info frames */ - scm_bits_t length; /* Stack length */ - scm_bits_t tail_length; + unsigned long length; /* Stack length */ + unsigned long tail_length; scm_info_frame_t tail[1]; } scm_stack_t; diff --git a/libguile/strings.c b/libguile/strings.c index c2ab44166..b87864973 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -96,7 +96,7 @@ SCM_DEFINE (scm_string, "string", 0, 0, 1, SCM result; { - scm_bits_t i = scm_ilength (chrs); + long i = scm_ilength (chrs); SCM_ASSERT (i >= 0, chrs, SCM_ARGn, FUNC_NAME); result = scm_allocate_string (i); @@ -248,7 +248,7 @@ SCM_DEFINE (scm_make_string, "make-string", 1, 1, 0, { if (SCM_INUMP (k)) { - scm_bits_t i = SCM_INUM (k); + long int i = SCM_INUM (k); SCM res; SCM_ASSERT_RANGE (1, k, i >= 0); @@ -290,7 +290,7 @@ SCM_DEFINE (scm_string_ref, "string-ref", 2, 0, 0, "indexing. @var{k} must be a valid index of @var{str}.") #define FUNC_NAME s_scm_string_ref { - scm_bits_t idx; + long idx; SCM_VALIDATE_STRING (1, str); SCM_VALIDATE_INUM_COPY (2, k, idx); @@ -330,8 +330,8 @@ SCM_DEFINE (scm_substring, "substring", 2, 1, 0, "0 <= @var{start} <= @var{end} <= (string-length @var{str}).") #define FUNC_NAME s_scm_substring { - scm_bits_t from; - scm_bits_t to; + long int from; + long int to; SCM_VALIDATE_STRING (1, str); SCM_VALIDATE_INUM (2, start); @@ -393,8 +393,8 @@ SCM_DEFINE (scm_make_shared_substring, "make-shared-substring", 1, 2, 0, "occupies the same storage space as @var{str}.") #define FUNC_NAME s_scm_make_shared_substring { - scm_bits_t f; - scm_bits_t t; + long f; + long t; SCM answer; SCM len_str; @@ -411,7 +411,7 @@ SCM_DEFINE (scm_make_shared_substring, "make-shared-substring", 1, 2, 0, SCM_DEFER_INTS; if (SCM_SUBSTRP (str)) { - scm_bits_t offset; + long offset; offset = SCM_INUM (SCM_SUBSTR_OFFSET (str)); f += offset; t += offset; diff --git a/libguile/strop.c b/libguile/strop.c index 4efb95599..ff2698fb3 100644 --- a/libguile/strop.c +++ b/libguile/strop.c @@ -48,14 +48,14 @@ xSCM_DEFINE (scm_i_index, "i-index", 2, 2, 0, "@code{rindex} function, depending on the value of @var{direction}." */ /* implements index if direction > 0 otherwise rindex. */ -static scm_bits_t +static long scm_i_index (SCM *str, SCM chr, int direction, SCM sub_start, SCM sub_end, const char *why) { unsigned char * p; - scm_bits_t x; - scm_bits_t lower; - scm_bits_t upper; + long x; + long lower; + long upper; int ch; SCM_ASSERT (SCM_STRINGP (*str), *str, SCM_ARG1, why); @@ -116,7 +116,7 @@ SCM_DEFINE (scm_string_index, "string-index", 2, 2, 0, "@end lisp") #define FUNC_NAME s_scm_string_index { - scm_bits_t pos; + long pos; if (SCM_UNBNDP (frm)) frm = SCM_BOOL_F; @@ -146,7 +146,7 @@ SCM_DEFINE (scm_string_rindex, "string-rindex", 2, 2, 0, "@end lisp") #define FUNC_NAME s_scm_string_rindex { - scm_bits_t pos; + long pos; if (SCM_UNBNDP (frm)) frm = SCM_BOOL_F; @@ -238,7 +238,7 @@ SCM_DEFINE (scm_substring_move_x, "substring-move!", 5, 0, 0, "are different strings, it does not matter which function you use.") #define FUNC_NAME s_scm_substring_move_x { - scm_bits_t s1, s2, e, len; + long s1, s2, e, len; SCM_VALIDATE_STRING (1,str1); SCM_VALIDATE_INUM_COPY (2,start1,s1); @@ -274,7 +274,7 @@ SCM_DEFINE (scm_substring_fill_x, "substring-fill!", 4, 0, 0, "@end lisp") #define FUNC_NAME s_scm_substring_fill_x { - scm_bits_t i, e; + long i, e; char c; SCM_VALIDATE_STRING (1,str); SCM_VALIDATE_INUM_COPY (2,start,i); @@ -313,7 +313,7 @@ SCM_DEFINE (scm_string_to_list, "string->list", 1, 0, 0, "concerned.") #define FUNC_NAME s_scm_string_to_list { - scm_bits_t i; + long i; SCM res = SCM_EOL; unsigned char *src; SCM_VALIDATE_STRING (1,str); @@ -352,7 +352,7 @@ SCM_DEFINE (scm_string_fill_x, "string-fill!", 2, 0, 0, #define FUNC_NAME s_scm_string_fill_x { register char *dst, c; - register scm_bits_t k; + register long k; SCM_VALIDATE_STRING_COPY (1,str,dst); SCM_VALIDATE_CHAR_COPY (2,chr,c); for (k = SCM_STRING_LENGTH (str)-1;k >= 0;k--) dst[k] = c; @@ -366,7 +366,7 @@ SCM_DEFINE (scm_string_fill_x, "string-fill!", 2, 0, 0, static SCM string_upcase_x (SCM v) { - scm_bits_t k; + unsigned long k; for (k = 0; k < SCM_STRING_LENGTH (v); ++k) SCM_STRING_UCHARS (v) [k] = scm_upcase (SCM_STRING_UCHARS (v) [k]); @@ -411,7 +411,7 @@ SCM_DEFINE (scm_string_upcase, "string-upcase", 1, 0, 0, static SCM string_downcase_x (SCM v) { - scm_bits_t k; + unsigned long k; for (k = 0; k < SCM_STRING_LENGTH (v); ++k) SCM_STRING_UCHARS (v) [k] = scm_downcase (SCM_STRING_UCHARS (v) [k]); @@ -457,7 +457,7 @@ static SCM string_capitalize_x (SCM str) { char *sz; - scm_bits_t i, len; + long i, len; int in_word=0; len = SCM_STRING_LENGTH(str); @@ -532,7 +532,7 @@ SCM_DEFINE (scm_string_split, "string-split", 2, 0, 0, "@end lisp") #define FUNC_NAME s_scm_string_split { - scm_bits_t idx, last_idx; + long idx, last_idx; char * p; int ch; SCM res = SCM_EOL; diff --git a/libguile/strports.c b/libguile/strports.c index 4fb102664..21bffde78 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -101,9 +101,9 @@ st_resize_port (scm_port_t *pt, off_t new_size) { SCM old_stream = SCM_PACK (pt->stream); SCM new_stream = scm_allocate_string (new_size); - size_t old_size = SCM_STRING_LENGTH (old_stream); - size_t min_size = min (old_size, new_size); - size_t i; + unsigned long int old_size = SCM_STRING_LENGTH (old_stream); + unsigned long int min_size = min (old_size, new_size); + unsigned long int i; off_t index = pt->write_pos - pt->write_buf; diff --git a/libguile/struct.c b/libguile/struct.c index 5710f4080..b13a8c1c8 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -736,8 +736,8 @@ SCM_DEFINE (scm_struct_vtable_tag, "struct-vtable-tag", 1, 0, 0, * how to associate names with vtables. */ -scm_bits_t -scm_struct_ihashq (SCM obj, scm_bits_t n) +unsigned long +scm_struct_ihashq (SCM obj, unsigned long n) { /* The length of the hash table should be a relative prime it's not necessary to shift down the address. */ diff --git a/libguile/struct.h b/libguile/struct.h index b66db2122..bd952f7eb 100644 --- a/libguile/struct.h +++ b/libguile/struct.h @@ -119,7 +119,7 @@ extern SCM scm_struct_ref (SCM handle, SCM pos); extern SCM scm_struct_set_x (SCM handle, SCM pos, SCM val); extern SCM scm_struct_vtable (SCM handle); extern SCM scm_struct_vtable_tag (SCM handle); -extern scm_bits_t scm_struct_ihashq (SCM obj, scm_bits_t n); +extern unsigned long scm_struct_ihashq (SCM obj, unsigned long n); extern SCM scm_struct_create_handle (SCM obj); extern SCM scm_struct_vtable_name (SCM vtable); extern SCM scm_set_struct_vtable_name_x (SCM vtable, SCM name); diff --git a/libguile/symbols.h b/libguile/symbols.h index fe4870b0e..3691ac46e 100644 --- a/libguile/symbols.h +++ b/libguile/symbols.h @@ -55,11 +55,11 @@ */ #define SCM_SYMBOLP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_symbol)) -#define SCM_SYMBOL_LENGTH(x) (((scm_ubits_t) SCM_CELL_WORD_0 (x)) >> 8) +#define SCM_SYMBOL_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) #define SCM_SET_SYMBOL_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s), ((l) << 8) + scm_tc7_symbol)) #define SCM_SYMBOL_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x))) #define SCM_SET_SYMBOL_CHARS(s, c) (SCM_SET_CELL_WORD_1 ((s), (c))) -#define SCM_SYMBOL_HASH(X) ((scm_ubits_t) SCM_CELL_WORD_2 (X)) +#define SCM_SYMBOL_HASH(X) ((unsigned long) SCM_CELL_WORD_2 (X)) #define SCM_SET_SYMBOL_HASH(X, v) (SCM_SET_CELL_WORD_2 ((X), (v))) #define SCM_PROP_SLOTS(X) (SCM_CELL_WORD_3 (X)) @@ -103,7 +103,7 @@ extern void scm_init_symbols (void); #define SCM_SUBSTR_STR(x) (SCM_CDDR (x)) #define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x)) #define SCM_LENGTH_MAX (0xffffffL) -#define SCM_LENGTH(x) (((scm_ubits_t) SCM_CELL_WORD_0 (x)) >> 8) +#define SCM_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) #define SCM_SETLENGTH(x, v, t) (SCM_SET_CELL_WORD_0 ((x), ((v) << 8) + (t))) #define SCM_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \ || (SCM_TYP7(x) == scm_tc7_symbol))) diff --git a/libguile/tags.h b/libguile/tags.h index eebe63e75..e64ad4c35 100644 --- a/libguile/tags.h +++ b/libguile/tags.h @@ -58,8 +58,7 @@ /* In the beginning was the Word: */ -typedef SCM_BITS_T scm_bits_t; -typedef SCM_UBITS_T scm_ubits_t; +typedef long scm_bits_t; /* But as external interface, we use SCM, which may, according to the desired * level of type checking, be defined in several ways: diff --git a/libguile/unif.c b/libguile/unif.c index aad700af9..fbb9b96d7 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -101,8 +101,6 @@ scm_uniform_element_size (SCM obj) switch (SCM_TYP7 (obj)) { case scm_tc7_bvect: - result = sizeof (scm_bits_t); - break; case scm_tc7_uvect: case scm_tc7_ivect: result = sizeof (long); @@ -156,32 +154,20 @@ singp (SCM obj) } } -#if (SIZEOF_SIZE_T < SCM_SIZEOF_BITS_T) -# define CHECK_BYTE_SIZE(s,k) SCM_ASSERT_RANGE (1, scm_bits2num (k), k <= (size_t)(~(size_t)0)) -#else -# define CHECK_BYTE_SIZE(s,k) -#endif - SCM -scm_make_uve (scm_bits_t k, SCM prot) +scm_make_uve (long k, SCM prot) #define FUNC_NAME "scm_make_uve" { SCM v; - size_t i; - scm_bits_t type; - scm_ubits_t size_in_bytes; + long i, type; if (SCM_EQ_P (prot, SCM_BOOL_T)) { SCM_NEWCELL (v); if (k > 0) { - SCM_ASSERT_RANGE (1, scm_bits2num (k), - k <= SCM_BITVECTOR_MAX_LENGTH); - size_in_bytes = sizeof (scm_bits_t) * ((k + SCM_BITS_LENGTH - 1) / - SCM_BITS_LENGTH); - CHECK_BYTE_SIZE (size_in_bytes, k); - i = (size_t) size_in_bytes; + SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_BITVECTOR_MAX_LENGTH); + i = sizeof (long) * ((k + SCM_LONG_BIT - 1) / SCM_LONG_BIT); SCM_SET_BITVECTOR_BASE (v, (char *) scm_must_malloc (i, "vector")); SCM_SET_BITVECTOR_LENGTH (v, k); } @@ -194,19 +180,17 @@ scm_make_uve (scm_bits_t k, SCM prot) } else if (SCM_CHARP (prot) && (SCM_CHAR (prot) == '\0')) { - size_in_bytes = sizeof (char) * k; + i = sizeof (char) * k; type = scm_tc7_byvect; } else if (SCM_CHARP (prot)) { - size_in_bytes = sizeof (char) * k; - CHECK_BYTE_SIZE (size_in_bytes, k); - i = (size_t) size_in_bytes; + i = sizeof (char) * k; return scm_allocate_string (i); } else if (SCM_INUMP (prot)) { - size_in_bytes = sizeof (long) * k; + i = sizeof (long) * k; if (SCM_INUM (prot) > 0) type = scm_tc7_uvect; else @@ -219,13 +203,13 @@ scm_make_uve (scm_bits_t k, SCM prot) s = SCM_SYMBOL_CHARS (prot)[0]; if (s == 's') { - size_in_bytes = sizeof (short) * k; + i = sizeof (short) * k; type = scm_tc7_svect; } #ifdef HAVE_LONG_LONGS else if (s == 'l') { - size_in_bytes = sizeof (long long) * k; + i = sizeof (long long) * k; type = scm_tc7_llvect; } #endif @@ -233,7 +217,6 @@ scm_make_uve (scm_bits_t k, SCM prot) { return scm_c_make_vector (k, SCM_UNDEFINED); } - } else if (!SCM_INEXACTP (prot)) /* Huge non-unif vectors are NOT supported. */ @@ -241,24 +224,21 @@ scm_make_uve (scm_bits_t k, SCM prot) return scm_c_make_vector (k, SCM_UNDEFINED); else if (singp (prot)) { - size_in_bytes = sizeof (float) * k; + i = sizeof (float) * k; type = scm_tc7_fvect; } else if (SCM_COMPLEXP (prot)) { - size_in_bytes = 2 * sizeof (double) * k; + i = 2 * sizeof (double) * k; type = scm_tc7_cvect; } else { - size_in_bytes = sizeof (double) * k; + i = sizeof (double) * k; type = scm_tc7_dvect; } - CHECK_BYTE_SIZE (size_in_bytes, k); - i = (size_t) size_in_bytes; - - SCM_ASSERT_RANGE (1, scm_bits2num (k), k <= SCM_UVECTOR_MAX_LENGTH); + SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_UVECTOR_MAX_LENGTH); SCM_NEWCELL (v); SCM_DEFER_INTS; @@ -503,14 +483,14 @@ SCM_DEFINE (scm_shared_array_increments, "shared-array-increments", 1, 0, 0, static char s_bad_ind[] = "Bad scm_array index"; -scm_bits_t +long scm_aind (SCM ra, SCM args, const char *what) #define FUNC_NAME what { SCM ind; - register scm_bits_t j; - register scm_bits_t pos = SCM_ARRAY_BASE (ra); - register size_t k = SCM_ARRAY_NDIM (ra); + register long j; + register unsigned long pos = SCM_ARRAY_BASE (ra); + register unsigned long k = SCM_ARRAY_NDIM (ra); scm_array_dim_t *s = SCM_ARRAY_DIMS (ra); if (SCM_INUMP (args)) { @@ -608,7 +588,7 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1, #define FUNC_NAME s_scm_dimensions_to_uniform_array { size_t k; - scm_bits_t rlen = 1; + unsigned long rlen = 1; scm_array_dim_t *s; SCM ra; @@ -634,7 +614,6 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1, while (k--) { s[k].inc = rlen; - SCM_ASSERT_RANGE (1, dims, s[k].inc >= 0); SCM_ASSERT_RANGE (1, dims, s[k].lbnd <= s[k].ubnd); rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc; } @@ -649,7 +628,7 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1, scm_array_fill_x (ra, prot); if (1 == SCM_ARRAY_NDIM (ra) && 0 == SCM_ARRAY_BASE (ra)) - if (s[0].ubnd < s[0].lbnd || (0 == s[0].lbnd && 1 == s[0].inc)) + if (s->ubnd < s->lbnd || (0 == s->lbnd && 1 == s->inc)) return SCM_ARRAY_V (ra); return ra; } @@ -662,7 +641,7 @@ scm_ra_set_contp (SCM ra) size_t k = SCM_ARRAY_NDIM (ra); if (k) { - scm_bits_t inc = SCM_ARRAY_DIMS (ra)[k - 1].inc; /*??*/ + long inc = SCM_ARRAY_DIMS (ra)[k - 1].inc; while (k--) { if (inc != SCM_ARRAY_DIMS (ra)[k].inc) @@ -700,9 +679,8 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1, SCM ra; SCM inds, indptr; SCM imap; - size_t k; - scm_bits_t i; - scm_bits_t old_min, new_min, old_max, new_max; + size_t k, i; + long old_min, new_min, old_max, new_max; scm_array_dim_t *s; SCM_VALIDATE_REST_ARGUMENT (dims); @@ -745,7 +723,7 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1, } imap = scm_apply (mapfunc, scm_reverse (inds), SCM_EOL); if (SCM_ARRAYP (oldra)) - i = scm_aind (oldra, imap, FUNC_NAME); + i = (size_t) scm_aind (oldra, imap, FUNC_NAME); else { if (SCM_NINUMP (imap)) @@ -794,7 +772,7 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1, if (1 == SCM_ARRAY_NDIM (ra) && 0 == SCM_ARRAY_BASE (ra)) { SCM v = SCM_ARRAY_V (ra); - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (v)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (v)); if (1 == s->inc && 0 == s->lbnd && length == 1 + s->ubnd) return v; if (s->ubnd < s->lbnd) @@ -1024,9 +1002,9 @@ SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1, #define FUNC_NAME s_scm_array_in_bounds_p { SCM ind = SCM_EOL; - scm_bits_t pos = 0; + long pos = 0; register size_t k; - register scm_bits_t j; + register long j; scm_array_dim_t *s; SCM_VALIDATE_REST_ARGUMENT (args); @@ -1090,7 +1068,7 @@ tail: case scm_tc7_vector: case scm_tc7_wvect: { - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (v)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (v)); SCM_ASRTGO (SCM_NULLP (args) && SCM_INUMP (ind), wna); return SCM_BOOL(pos >= 0 && pos < length); } @@ -1109,7 +1087,7 @@ SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0, "@var{array}.") #define FUNC_NAME s_scm_uniform_vector_ref { - scm_bits_t pos; + long pos; if (SCM_IMP (v)) { @@ -1123,7 +1101,7 @@ SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0, } else { - scm_bits_t length; + unsigned long int length; if (SCM_NIMP (args)) { SCM_ASSERT (SCM_CONSP (args) && SCM_INUMP (SCM_CAR (args)), args, SCM_ARG2, FUNC_NAME); @@ -1204,7 +1182,7 @@ SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0, tries to recycle conses. (Make *sure* you want them recycled.) */ SCM -scm_cvref (SCM v, scm_bits_t pos, SCM last) +scm_cvref (SCM v, unsigned long pos, SCM last) #define FUNC_NAME "scm_cvref" { switch SCM_TYP7 (v) @@ -1287,7 +1265,7 @@ SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1, "@var{new-value}. The value returned by array-set! is unspecified.") #define FUNC_NAME s_scm_array_set_x { - scm_bits_t pos = 0; + long pos = 0; SCM_VALIDATE_REST_ARGUMENT (args); SCM_ASRTGO (SCM_NIMP (v), badarg1); @@ -1298,7 +1276,7 @@ SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1, } else { - scm_bits_t length; + unsigned long int length; if (SCM_NIMP (args)) { SCM_ASSERT (SCM_CONSP(args) && SCM_INUMP (SCM_CAR (args)), args, @@ -1426,8 +1404,7 @@ SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0, return ra; case scm_tc7_smob: { - size_t k, ndim = SCM_ARRAY_NDIM (ra); - scm_bits_t len = 1; + size_t k, ndim = SCM_ARRAY_NDIM (ra), len = 1; if (!SCM_ARRAYP (ra) || !SCM_ARRAY_CONTP (ra)) return SCM_BOOL_F; for (k = 0; k < ndim; k++) @@ -1439,15 +1416,15 @@ SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0, if (scm_tc7_bvect == SCM_TYP7 (SCM_ARRAY_V (ra))) { if (len != SCM_BITVECTOR_LENGTH (SCM_ARRAY_V (ra)) || - SCM_ARRAY_BASE (ra) % SCM_BITS_LENGTH || - len % SCM_BITS_LENGTH) + SCM_ARRAY_BASE (ra) % SCM_LONG_BIT || + len % SCM_LONG_BIT) return SCM_BOOL_F; } } { SCM v = SCM_ARRAY_V (ra); - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (v)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (v)); if ((len == length) && 0 == SCM_ARRAY_BASE (ra) && SCM_ARRAY_DIMS (ra)->inc) return v; } @@ -1469,9 +1446,8 @@ SCM scm_ra2contig (SCM ra, int copy) { SCM ret; - scm_bits_t inc = 1; - size_t k; - scm_bits_t len = 1; + long inc = 1; + size_t k, len = 1; for (k = SCM_ARRAY_NDIM (ra); k--;) len *= SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd + 1; k = SCM_ARRAY_NDIM (ra); @@ -1480,8 +1456,8 @@ scm_ra2contig (SCM ra, int copy) if (scm_tc7_bvect != SCM_TYP7 (SCM_ARRAY_V (ra))) return ra; if ((len == SCM_BITVECTOR_LENGTH (SCM_ARRAY_V (ra)) && - 0 == SCM_ARRAY_BASE (ra) % SCM_BITS_LENGTH && - 0 == len % SCM_BITS_LENGTH)) + 0 == SCM_ARRAY_BASE (ra) % SCM_LONG_BIT && + 0 == len % SCM_LONG_BIT)) return ra; } ret = scm_make_ra (k); @@ -1519,10 +1495,10 @@ SCM_DEFINE (scm_uniform_array_read_x, "uniform-array-read!", 1, 3, 0, #define FUNC_NAME s_scm_uniform_array_read_x { SCM cra = SCM_UNDEFINED, v = ra; - int sz; - scm_bits_t vlen, ans; - scm_bits_t cstart = 0, cend = 0; - scm_bits_t offset = 0; + long sz, vlen, ans; + long cstart = 0; + long cend; + long offset = 0; char *base; SCM_ASRTGO (SCM_NIMP (v), badarg1); @@ -1553,9 +1529,9 @@ loop: break; case scm_tc7_bvect: base = (char *) SCM_BITVECTOR_BASE (v); - vlen = (vlen + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; - cstart /= SCM_BITS_LENGTH; - sz = sizeof (scm_bits_t); + vlen = (vlen + SCM_LONG_BIT - 1) / SCM_LONG_BIT; + cstart /= SCM_LONG_BIT; + sz = sizeof (long); break; case scm_tc7_byvect: base = (char *) SCM_UVECTOR_BASE (v); @@ -1594,15 +1570,15 @@ loop: if (!SCM_UNBNDP (start)) { offset = - SCM_NUM2BITS (3, start); + SCM_NUM2LONG (3, start); if (offset < 0 || offset >= cend) scm_out_of_range (FUNC_NAME, start); if (!SCM_UNBNDP (end)) { - scm_bits_t tend = - SCM_NUM2BITS (4, end); + long tend = + SCM_NUM2LONG (4, end); if (tend <= offset || tend > cend) scm_out_of_range (FUNC_NAME, end); @@ -1658,7 +1634,7 @@ loop: SCM_SYSERROR; } if (SCM_TYP7 (v) == scm_tc7_bvect) - ans *= SCM_BITS_LENGTH; + ans *= SCM_LONG_BIT; if (!SCM_EQ_P (v, ra) && !SCM_EQ_P (cra, ra)) scm_array_copy_x (cra, ra); @@ -1681,9 +1657,10 @@ SCM_DEFINE (scm_uniform_array_write, "uniform-array-write", 1, 3, 0, "@code{(current-output-port)}.") #define FUNC_NAME s_scm_uniform_array_write { - int sz; - scm_bits_t vlen, ans; - scm_bits_t offset = 0, cstart = 0, cend; + long sz, vlen, ans; + long offset = 0; + long cstart = 0; + long cend; char *base; port_or_fd = SCM_COERCE_OUTPORT (port_or_fd); @@ -1716,9 +1693,9 @@ loop: break; case scm_tc7_bvect: base = (char *) SCM_BITVECTOR_BASE (v); - vlen = (vlen + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; - cstart /= SCM_BITS_LENGTH; - sz = sizeof (scm_bits_t); + vlen = (vlen + SCM_LONG_BIT - 1) / SCM_LONG_BIT; + cstart /= SCM_LONG_BIT; + sz = sizeof (long); break; case scm_tc7_byvect: base = (char *) SCM_UVECTOR_BASE (v); @@ -1757,15 +1734,15 @@ loop: if (!SCM_UNBNDP (start)) { offset = - SCM_NUM2BITS (3, start); + SCM_NUM2LONG (3, start); if (offset < 0 || offset >= cend) scm_out_of_range (FUNC_NAME, start); if (!SCM_UNBNDP (end)) { - scm_bits_t tend = - SCM_NUM2BITS (4, end); + long tend = + SCM_NUM2LONG (4, end); if (tend <= offset || tend > cend) scm_out_of_range (FUNC_NAME, end); @@ -1789,7 +1766,7 @@ loop: SCM_SYSERROR; } if (SCM_TYP7 (v) == scm_tc7_bvect) - ans *= SCM_BITS_LENGTH; + ans *= SCM_LONG_BIT; return SCM_MAKINUM (ans); } @@ -1810,13 +1787,13 @@ SCM_DEFINE (scm_bit_count, "bit-count", 2, 0, 0, if (SCM_BITVECTOR_LENGTH (bitvector) == 0) { return SCM_INUM0; } else { - scm_bits_t count = 0; - size_t i = (SCM_BITVECTOR_LENGTH (bitvector) - 1) / SCM_BITS_LENGTH; - scm_ubits_t w = SCM_UNPACK (SCM_VELTS (bitvector)[i]); + unsigned long int count = 0; + unsigned long int i = (SCM_BITVECTOR_LENGTH (bitvector) - 1) / SCM_LONG_BIT; + unsigned long int w = SCM_UNPACK (SCM_VELTS (bitvector)[i]); if (SCM_FALSEP (b)) { w = ~w; }; - w <<= SCM_BITS_LENGTH - 1 - ((SCM_BITVECTOR_LENGTH (bitvector) - 1) % SCM_BITS_LENGTH); + w <<= SCM_LONG_BIT - 1 - ((SCM_BITVECTOR_LENGTH (bitvector) - 1) % SCM_LONG_BIT); while (1) { while (w) { count += cnt_tab[w & 0x0f]; @@ -1844,11 +1821,8 @@ SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0, "within the specified range @code{#f} is returned.") #define FUNC_NAME s_scm_bit_position { - size_t i; - scm_bits_t pos; - size_t lenw; - int xbits; - register scm_ubits_t w; + long i, lenw, xbits, pos; + register unsigned long w; SCM_VALIDATE_BOOL (1, item); SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG2, FUNC_NAME); @@ -1858,15 +1832,15 @@ SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0, if (pos == SCM_BITVECTOR_LENGTH (v)) return SCM_BOOL_F; - lenw = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_BITS_LENGTH; /* watch for part words */ - i = pos / SCM_BITS_LENGTH; + lenw = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_LONG_BIT; /* watch for part words */ + i = pos / SCM_LONG_BIT; w = SCM_UNPACK (SCM_VELTS (v)[i]); if (SCM_FALSEP (item)) w = ~w; - xbits = (pos % SCM_BITS_LENGTH); + xbits = (pos % SCM_LONG_BIT); pos -= xbits; w = ((w >> xbits) << xbits); - xbits = SCM_BITS_LENGTH - 1 - (SCM_BITVECTOR_LENGTH (v) - 1) % SCM_BITS_LENGTH; + xbits = SCM_LONG_BIT - 1 - (SCM_BITVECTOR_LENGTH (v) - 1) % SCM_LONG_BIT; while (!0) { if (w && (i == lenw)) @@ -1893,7 +1867,7 @@ SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0, } if (++i > lenw) break; - pos += SCM_BITS_LENGTH; + pos += SCM_LONG_BIT; w = SCM_UNPACK (SCM_VELTS (v)[i]); if (SCM_FALSEP (item)) w = ~w; @@ -1915,8 +1889,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0, "@var{bool}. The return value is unspecified.") #define FUNC_NAME s_scm_bit_set_star_x { - register size_t i; - scm_bits_t vlen; + register long i, k, vlen; SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG1, FUNC_NAME); SCM_ASRTGO (SCM_NIMP (kv), badarg2); switch SCM_TYP7 (kv) @@ -1924,13 +1897,11 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0, default: badarg2:SCM_WRONG_TYPE_ARG (2, kv); case scm_tc7_uvect: - { - unsigned long k; vlen = SCM_BITVECTOR_LENGTH (v); if (SCM_FALSEP (obj)) for (i = SCM_UVECTOR_LENGTH (kv); i;) { - k = ((unsigned long *) SCM_VELTS (kv))[--i]; + k = SCM_UNPACK (SCM_VELTS (kv)[--i]); if (k >= vlen) scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k)); SCM_BITVEC_CLR(v,k); @@ -1938,7 +1909,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0, else if (SCM_EQ_P (obj, SCM_BOOL_T)) for (i = SCM_UVECTOR_LENGTH (kv); i;) { - k = ((unsigned long *) SCM_VELTS (kv))[--i]; + k = SCM_UNPACK (SCM_VELTS (kv)[--i]); if (k >= vlen) scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k)); SCM_BITVEC_SET(v,k); @@ -1946,22 +1917,18 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0, else badarg3:SCM_WRONG_TYPE_ARG (3, obj); break; - } case scm_tc7_bvect: - { - scm_ubits_t k; SCM_ASSERT (SCM_BITVECTOR_LENGTH (v) == SCM_BITVECTOR_LENGTH (kv), v, SCM_ARG1, FUNC_NAME); if (SCM_FALSEP (obj)) - for (k = (SCM_BITVECTOR_LENGTH (v) + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; k--;) - ((scm_ubits_t *) SCM_VELTS (v))[k] &= ~ ((scm_ubits_t *) SCM_VELTS (kv))[k]; + for (k = (SCM_BITVECTOR_LENGTH (v) + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k--;) + SCM_UNPACK (SCM_VELTS (v)[k]) &= ~ SCM_UNPACK(SCM_VELTS (kv)[k]); else if (SCM_EQ_P (obj, SCM_BOOL_T)) - for (k = (SCM_BITVECTOR_LENGTH (v) + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; k--;) - ((scm_ubits_t *) SCM_VELTS (v))[k] |= ((scm_ubits_t *) SCM_VELTS (kv))[k]; + for (k = (SCM_BITVECTOR_LENGTH (v) + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k--;) + SCM_UNPACK (SCM_VELTS (v)[k]) |= SCM_UNPACK (SCM_VELTS (kv)[k]); else goto badarg3; break; } - } return SCM_UNSPECIFIED; } #undef FUNC_NAME @@ -1976,8 +1943,8 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0, "@var{bv} is not modified.") #define FUNC_NAME s_scm_bit_count_star { - register size_t i; - scm_bits_t vlen, count = 0; + register long i, vlen, count = 0; + register unsigned long k; int fObj = 0; SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG1, FUNC_NAME); @@ -1988,13 +1955,11 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0, badarg2: SCM_WRONG_TYPE_ARG (2, kv); case scm_tc7_uvect: - { - unsigned long k; vlen = SCM_BITVECTOR_LENGTH (v); if (SCM_FALSEP (obj)) for (i = SCM_UVECTOR_LENGTH (kv); i;) { - k = ((unsigned long *) SCM_VELTS (kv))[--i]; + k = SCM_UNPACK (SCM_VELTS (kv)[--i]); if (k >= vlen) scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k)); if (!SCM_BITVEC_REF(v,k)) @@ -2003,7 +1968,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0, else if (SCM_EQ_P (obj, SCM_BOOL_T)) for (i = SCM_UVECTOR_LENGTH (kv); i;) { - k = ((unsigned long *) SCM_VELTS (kv))[--i]; + k = SCM_UNPACK (SCM_VELTS (kv)[--i]); if (k >= vlen) scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k)); if (SCM_BITVEC_REF (v,k)) @@ -2012,20 +1977,15 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0, else badarg3:SCM_WRONG_TYPE_ARG (3, obj); break; - } case scm_tc7_bvect: - { - scm_ubits_t k; SCM_ASSERT (SCM_BITVECTOR_LENGTH (v) == SCM_BITVECTOR_LENGTH (kv), v, SCM_ARG1, FUNC_NAME); if (0 == SCM_BITVECTOR_LENGTH (v)) return SCM_INUM0; SCM_ASRTGO (SCM_BOOLP (obj), badarg3); fObj = SCM_EQ_P (obj, SCM_BOOL_T); - i = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_BITS_LENGTH; - k = - ((scm_ubits_t *) SCM_VELTS (kv))[i] - & (fObj ? ((scm_ubits_t *) SCM_VELTS (v))[i] : ~ ((scm_ubits_t *) SCM_VELTS (v))[i]); - k <<= SCM_BITS_LENGTH - 1 - ((SCM_BITVECTOR_LENGTH (v) - 1) % SCM_BITS_LENGTH); + i = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_LONG_BIT; + k = SCM_UNPACK (SCM_VELTS (kv)[i]) & (fObj ? SCM_UNPACK (SCM_VELTS (v)[i]) : ~ SCM_UNPACK (SCM_VELTS (v)[i])); + k <<= SCM_LONG_BIT - 1 - ((SCM_BITVECTOR_LENGTH (v) - 1) % SCM_LONG_BIT); while (1) { for (; k; k >>= 4) @@ -2034,10 +1994,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0, return SCM_MAKINUM (count); /* urg. repetitive (see above.) */ - k = - ((scm_ubits_t *) SCM_VELTS (kv))[i] - & (fObj ? ((scm_ubits_t *) SCM_VELTS (v))[i] : ~ ((scm_ubits_t *) SCM_VELTS (v))[i]); - } + k = SCM_UNPACK (SCM_VELTS (kv)[i]) & (fObj ? SCM_UNPACK(SCM_VELTS (v)[i]) : ~SCM_UNPACK (SCM_VELTS (v)[i])); } } return SCM_MAKINUM (count); @@ -2050,13 +2007,13 @@ SCM_DEFINE (scm_bit_invert_x, "bit-invert!", 1, 0, 0, "Modifies @var{bv} by replacing each element with its negation.") #define FUNC_NAME s_scm_bit_invert_x { - scm_bits_t k; + long int k; SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG1, FUNC_NAME); k = SCM_BITVECTOR_LENGTH (v); - for (k = (k + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; k--;) - ((scm_ubits_t *) SCM_VELTS (v))[k] = ~((scm_ubits_t *) SCM_VELTS (v))[k]; + for (k = (k + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k--;) + SCM_UNPACK (SCM_VELTS (v)[k]) = ~SCM_UNPACK (SCM_VELTS (v)[k]); return SCM_UNSPECIFIED; } @@ -2064,19 +2021,19 @@ SCM_DEFINE (scm_bit_invert_x, "bit-invert!", 1, 0, 0, SCM -scm_istr2bve (char *str, scm_bits_t len) +scm_istr2bve (char *str, long len) { SCM v = scm_make_uve (len, SCM_BOOL_T); - scm_ubits_t *data = (scm_ubits_t *) SCM_VELTS (v); - register scm_bits_t mask; - register size_t k; - register int j; - for (k = 0; k < (len + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; k++) + long *data = (long *) SCM_VELTS (v); + register unsigned long mask; + register long k; + register long j; + for (k = 0; k < (len + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k++) { data[k] = 0L; - j = len - k * SCM_BITS_LENGTH; - if (j > SCM_BITS_LENGTH) - j = SCM_BITS_LENGTH; + j = len - k * SCM_LONG_BIT; + if (j > SCM_LONG_BIT) + j = SCM_LONG_BIT; for (mask = 1L; j--; mask <<= 1) switch (*str++) { @@ -2095,11 +2052,11 @@ scm_istr2bve (char *str, scm_bits_t len) static SCM -ra2l (SCM ra, scm_bits_t base, size_t k) +ra2l (SCM ra,unsigned long base,unsigned long k) { register SCM res = SCM_EOL; - register scm_bits_t inc = SCM_ARRAY_DIMS (ra)[k].inc; - register scm_bits_t i; + register long inc = SCM_ARRAY_DIMS (ra)[k].inc; + register size_t i; if (SCM_ARRAY_DIMS (ra)[k].ubnd < SCM_ARRAY_DIMS (ra)[k].lbnd) return SCM_EOL; i = base + (1 + SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd) * inc; @@ -2130,7 +2087,7 @@ SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0, #define FUNC_NAME s_scm_array_to_list { SCM res = SCM_EOL; - register size_t k; + register long k; SCM_ASRTGO (SCM_NIMP (v), badarg1); switch SCM_TYP7 (v) { @@ -2146,35 +2103,35 @@ SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0, return scm_string_to_list (v); case scm_tc7_bvect: { - scm_ubits_t *data = (scm_ubits_t *) SCM_VELTS (v); - register scm_ubits_t mask; - for (k = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_BITS_LENGTH; k > 0; k--) - for (mask = 1UL << (SCM_BITS_LENGTH - 1); mask; mask >>= 1) - res = scm_cons (SCM_BOOL(data[k] & mask), res); - for (mask = 1L << ((SCM_BITVECTOR_LENGTH (v) % SCM_BITS_LENGTH) - 1); mask; mask >>= 1) - res = scm_cons (SCM_BOOL(data[k] & mask), res); + long *data = (long *) SCM_VELTS (v); + register unsigned long mask; + for (k = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_LONG_BIT; k > 0; k--) + for (mask = 1UL << (SCM_LONG_BIT - 1); mask; mask >>= 1) + res = scm_cons (SCM_BOOL(((long *) data)[k] & mask), res); + for (mask = 1L << ((SCM_BITVECTOR_LENGTH (v) % SCM_LONG_BIT) - 1); mask; mask >>= 1) + res = scm_cons (SCM_BOOL(((long *) data)[k] & mask), res); return res; } case scm_tc7_byvect: { signed char *data = (signed char *) SCM_VELTS (v); - scm_bits_t k = SCM_UVECTOR_LENGTH (v); + unsigned long k = SCM_UVECTOR_LENGTH (v); while (k != 0) res = scm_cons (SCM_MAKINUM (data[--k]), res); return res; } case scm_tc7_uvect: { - scm_ubits_t *data = (scm_ubits_t *) SCM_VELTS(v); + long *data = (long *)SCM_VELTS(v); for (k = SCM_UVECTOR_LENGTH(v) - 1; k >= 0; k--) - res = scm_cons(scm_ubits2num(data[k]), res); + res = scm_cons(scm_ulong2num(data[k]), res); return res; } case scm_tc7_ivect: { - scm_bits_t *data = (scm_bits_t *) SCM_VELTS(v); + long *data = (long *)SCM_VELTS(v); for (k = SCM_UVECTOR_LENGTH(v) - 1; k >= 0; k--) - res = scm_cons(scm_bits2num(data[k]), res); + res = scm_cons(scm_long2num(data[k]), res); return res; } case scm_tc7_svect: @@ -2219,7 +2176,7 @@ SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0, #undef FUNC_NAME -static int l2ra (SCM lst, SCM ra, scm_bits_t base, size_t k); +static int l2ra(SCM lst, SCM ra, unsigned long base, unsigned long k); SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0, (SCM ndim, SCM prot, SCM lst), @@ -2233,7 +2190,7 @@ SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0, SCM shp = SCM_EOL; SCM row = lst; SCM ra; - scm_bits_t k; + unsigned long k; long n; SCM_VALIDATE_INUM_COPY (1,ndim,k); while (k--) @@ -2254,7 +2211,7 @@ SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0, } if (!SCM_ARRAYP (ra)) { - scm_bits_t length = SCM_INUM (scm_uniform_vector_length (ra)); + unsigned long int length = SCM_INUM (scm_uniform_vector_length (ra)); for (k = 0; k < length; k++, lst = SCM_CDR (lst)) scm_array_set_x (ra, SCM_CAR (lst), SCM_MAKINUM (k)); return ra; @@ -2267,10 +2224,10 @@ SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0, #undef FUNC_NAME static int -l2ra (SCM lst, SCM ra, scm_bits_t base, size_t k) +l2ra (SCM lst, SCM ra, unsigned long base, unsigned long k) { - register scm_bits_t inc = SCM_ARRAY_DIMS (ra)[k].inc; - register scm_bits_t n = (1 + SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd); + register long inc = SCM_ARRAY_DIMS (ra)[k].inc; + register long n = (1 + SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd); int ok = 1; if (n <= 0) return (SCM_NULLP (lst)); @@ -2305,10 +2262,10 @@ l2ra (SCM lst, SCM ra, scm_bits_t base, size_t k) static void -rapr1 (SCM ra, scm_bits_t j, size_t k, SCM port, scm_print_state *pstate) +rapr1 (SCM ra,unsigned long j,unsigned long k,SCM port,scm_print_state *pstate) { - scm_bits_t inc = 1; - scm_bits_t n = (SCM_TYP7 (ra) == scm_tc7_smob + long inc = 1; + long n = (SCM_TYP7 (ra) == scm_tc7_smob ? 0 : SCM_INUM (scm_uniform_vector_length (ra))); int enclosed = 0; @@ -2331,7 +2288,7 @@ tail: } if (k + 1 < SCM_ARRAY_NDIM (ra)) { - scm_bits_t i; + long i; inc = SCM_ARRAY_DIMS (ra)[k].inc; for (i = SCM_ARRAY_DIMS (ra)[k].lbnd; i < SCM_ARRAY_DIMS (ra)[k].ubnd; i++) { @@ -2484,7 +2441,7 @@ int scm_raprin1 (SCM exp, SCM port, scm_print_state *pstate) { SCM v = exp; - scm_bits_t base = 0; + unsigned long base = 0; scm_putc ('#', port); tail: switch SCM_TYP7 (v) @@ -2511,23 +2468,21 @@ tail: case scm_tc7_bvect: if (SCM_EQ_P (exp, v)) { /* a uve, not an scm_array */ - register size_t i; - register int j; - scm_ubits_t w; + register long i, j, w; scm_putc ('*', port); - for (i = 0; i < (SCM_BITVECTOR_LENGTH (exp) / SCM_BITS_LENGTH); i++) + for (i = 0; i < (SCM_BITVECTOR_LENGTH (exp)) / SCM_LONG_BIT; i++) { - w = SCM_UNPACK (SCM_VELTS (exp)[i]); - for (j = SCM_BITS_LENGTH; j; j--) + scm_bits_t w = SCM_UNPACK (SCM_VELTS (exp)[i]); + for (j = SCM_LONG_BIT; j; j--) { scm_putc (w & 1 ? '1' : '0', port); w >>= 1; } } - j = SCM_BITVECTOR_LENGTH (exp) % SCM_BITS_LENGTH; + j = SCM_BITVECTOR_LENGTH (exp) % SCM_LONG_BIT; if (j) { - w = SCM_UNPACK (SCM_VELTS (exp)[SCM_BITVECTOR_LENGTH (exp) / SCM_BITS_LENGTH]); + w = SCM_UNPACK (SCM_VELTS (exp)[SCM_BITVECTOR_LENGTH (exp) / SCM_LONG_BIT]); for (; j; j--) { scm_putc (w & 1 ? '1' : '0', port); diff --git a/libguile/unif.h b/libguile/unif.h index 3da009a12..1a7b1b46f 100644 --- a/libguile/unif.h +++ b/libguile/unif.h @@ -64,14 +64,14 @@ typedef struct scm_array_t { SCM v; /* the contents of the array, e.g., a vector or uniform vector. */ - scm_bits_t base; + unsigned long base; } scm_array_t; typedef struct scm_array_dim_t { - scm_bits_t lbnd; - scm_bits_t ubnd; - scm_bits_t inc; + long lbnd; + long ubnd; + long inc; } scm_array_dim_t; #if (SCM_DEBUG_DEPRECATED == 0) @@ -88,7 +88,7 @@ extern scm_bits_t scm_tc16_array; #endif #define SCM_ARRAYP(a) SCM_TYP16_PREDICATE (scm_tc16_array, a) -#define SCM_ARRAY_NDIM(x) ((size_t) ((scm_ubits_t) (SCM_CELL_WORD_0 (x)) >> 17)) +#define SCM_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)) >> 17) #define SCM_ARRAY_CONTP(x) (SCM_CELL_WORD_0 (x) & SCM_ARRAY_FLAG_CONTIGUOUS) #define SCM_SET_ARRAY_CONTIGUOUS_FLAG(x) \ (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) | SCM_ARRAY_FLAG_CONTIGUOUS)) @@ -100,25 +100,25 @@ extern scm_bits_t scm_tc16_array; #define SCM_ARRAY_BASE(a) (SCM_ARRAY_MEM (a)->base) #define SCM_ARRAY_DIMS(a) ((scm_array_dim_t *)((char *) SCM_ARRAY_MEM (a) + sizeof (scm_array_t))) -#define SCM_I_MAX_LENGTH ((scm_ubits_t)((scm_bits_t)-1) >> 8) +#define SCM_I_MAX_LENGTH ((unsigned long) (-1L) >> 8) #define SCM_UVECTOR_BASE(x) ((void *) (SCM_CELL_WORD_1 (x))) #define SCM_SET_UVECTOR_BASE(v, b) (SCM_SET_CELL_WORD_1 ((v), (b))) #define SCM_UVECTOR_MAX_LENGTH SCM_I_MAX_LENGTH -#define SCM_UVECTOR_LENGTH(x) (((scm_ubits_t) SCM_CELL_WORD_0 (x)) >> 8) +#define SCM_UVECTOR_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) #define SCM_SET_UVECTOR_LENGTH(v, l, t) (SCM_SET_CELL_WORD_0 ((v), ((l) << 8) + (t))) #define SCM_BITVECTOR_P(x) (!SCM_IMP (x) && (SCM_TYP7 (x) == scm_tc7_bvect)) #define SCM_BITVECTOR_BASE(x) ((void *) (SCM_CELL_WORD_1 (x))) #define SCM_SET_BITVECTOR_BASE(v, b) (SCM_SET_CELL_WORD_1 ((v), (b))) #define SCM_BITVECTOR_MAX_LENGTH SCM_I_MAX_LENGTH -#define SCM_BITVECTOR_LENGTH(x) (((scm_ubits_t) SCM_CELL_WORD_0 (x)) >> 8) +#define SCM_BITVECTOR_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) #define SCM_SET_BITVECTOR_LENGTH(v, l) (SCM_SET_CELL_WORD_0 ((v), ((l) << 8) + scm_tc7_bvect)) extern size_t scm_uniform_element_size (SCM obj); -extern SCM scm_make_uve (scm_bits_t k, SCM prot); +extern SCM scm_make_uve (long k, SCM prot); extern SCM scm_uniform_vector_length (SCM v); extern SCM scm_array_p (SCM v, SCM prot); extern SCM scm_array_rank (SCM ra); @@ -126,7 +126,7 @@ extern SCM scm_array_dimensions (SCM ra); extern SCM scm_shared_array_root (SCM ra); extern SCM scm_shared_array_offset (SCM ra); extern SCM scm_shared_array_increments (SCM ra); -extern scm_bits_t scm_aind (SCM ra, SCM args, const char *what); +extern long scm_aind (SCM ra, SCM args, const char *what); extern SCM scm_make_ra (int ndim); extern SCM scm_shap2ra (SCM args, const char *what); extern SCM scm_dimensions_to_uniform_array (SCM dims, SCM prot, SCM fill); @@ -136,7 +136,7 @@ extern SCM scm_transpose_array (SCM ra, SCM args); extern SCM scm_enclose_array (SCM ra, SCM axes); extern SCM scm_array_in_bounds_p (SCM v, SCM args); extern SCM scm_uniform_vector_ref (SCM v, SCM args); -extern SCM scm_cvref (SCM v, scm_bits_t pos, SCM last); +extern SCM scm_cvref (SCM v, unsigned long pos, SCM last); extern SCM scm_array_set_x (SCM v, SCM obj, SCM args); extern SCM scm_array_contents (SCM ra, SCM strict); extern SCM scm_ra2contig (SCM ra, int copy); @@ -147,7 +147,7 @@ extern SCM scm_bit_position (SCM item, SCM v, SCM k); extern SCM scm_bit_set_star_x (SCM v, SCM kv, SCM obj); extern SCM scm_bit_count_star (SCM v, SCM kv, SCM obj); extern SCM scm_bit_invert_x (SCM v); -extern SCM scm_istr2bve (char *str, scm_bits_t len); +extern SCM scm_istr2bve (char *str, long len); extern SCM scm_array_to_list (SCM v); extern SCM scm_list_to_uniform_array (SCM ndim, SCM prot, SCM lst); extern int scm_raprin1 (SCM exp, SCM port, scm_print_state *pstate); diff --git a/libguile/validate.h b/libguile/validate.h index cc8df1561..5f152138c 100644 --- a/libguile/validate.h +++ b/libguile/validate.h @@ -1,4 +1,4 @@ -/* $Id: validate.h,v 1.32 2001-05-24 00:50:51 cmm Exp $ */ +/* $Id: validate.h,v 1.33 2001-05-26 20:51:22 cmm Exp $ */ /* Copyright (C) 1999,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -81,16 +81,6 @@ #define SCM_NUM2USHORT_DEF(pos, arg, def) \ (SCM_UNBNDP (arg) ? def : scm_num2ushort (arg, pos, FUNC_NAME)) -#define SCM_NUM2BITS(pos, arg) (scm_num2bits (arg, pos, FUNC_NAME)) - -#define SCM_NUM2BITS_DEF(pos, arg, def) \ - (SCM_UNBNDP (arg) ? def : scm_num2bits (arg, pos, FUNC_NAME)) - -#define SCM_NUM2UBITS(pos, arg) (scm_num2ubits (arg, pos, FUNC_NAME)) - -#define SCM_NUM2UBITS_DEF(pos, arg, def) \ - (SCM_UNBNDP (arg) ? def : scm_num2ubits (arg, pos, FUNC_NAME)) - #define SCM_NUM2INT(pos, arg) (scm_num2int (arg, pos, FUNC_NAME)) #define SCM_NUM2INT_DEF(pos, arg, def) \ diff --git a/libguile/values.c b/libguile/values.c index 2fbfaaae9..5aad29a89 100644 --- a/libguile/values.c +++ b/libguile/values.c @@ -77,7 +77,7 @@ SCM_DEFINE (scm_values, "values", 0, 0, 1, "were not created by @code{call-with-values} is unspecified.") #define FUNC_NAME s_scm_values { - scm_bits_t n; + long n; SCM result; SCM_VALIDATE_LIST_COPYLEN (1, args, n); diff --git a/libguile/vectors.c b/libguile/vectors.c index d6d5a7867..4407d57d8 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -73,7 +73,7 @@ static char s_vector_set_length_x[] = "vector-set-length!"; SCM scm_vector_set_length_x (SCM vect, SCM len) { - scm_bits_t l; + long l; size_t siz; size_t sz; char *base; @@ -84,7 +84,7 @@ scm_vector_set_length_x (SCM vect, SCM len) #ifdef HAVE_ARRAYS if (SCM_TYP7 (vect) == scm_tc7_bvect) { - l = (l + SCM_BITS_LENGTH - 1) / SCM_BITS_LENGTH; + l = (l + SCM_LONG_BIT - 1) / SCM_LONG_BIT; } sz = scm_uniform_element_size (vect); if (sz != 0) @@ -180,7 +180,7 @@ SCM_DEFINE (scm_vector, "vector", 0, 0, 1, { SCM res; SCM *data; - scm_bits_t i; + long i; /* Dirk:FIXME:: In case of multiple threads, the list might get corrupted while the vector is being created. */ @@ -222,7 +222,7 @@ scm_vector_ref (SCM v, SCM k) SCM_GASSERT2 (SCM_INUMP (k), g_vector_ref, v, k, SCM_ARG2, s_vector_ref); SCM_ASSERT_RANGE (2, k, SCM_INUM (k) < SCM_VECTOR_LENGTH (v) && SCM_INUM (k) >= 0); - return SCM_VELTS (v)[(ptrdiff_t) SCM_INUM (k)]; + return SCM_VELTS (v)[(long) SCM_INUM (k)]; } #undef FUNC_NAME @@ -250,7 +250,7 @@ scm_vector_set_x (SCM v, SCM k, SCM obj) g_vector_set_x, SCM_LIST3 (v, k, obj), SCM_ARG2, s_vector_set_x); SCM_ASSERT_RANGE (2, k, SCM_INUM (k) < SCM_VECTOR_LENGTH (v) && SCM_INUM (k) >= 0); - SCM_VELTS(v)[(ptrdiff_t) SCM_INUM(k)] = obj; + SCM_VELTS(v)[(long) SCM_INUM(k)] = obj; return SCM_UNSPECIFIED; } #undef FUNC_NAME @@ -281,7 +281,7 @@ SCM_DEFINE (scm_make_vector, "make-vector", 1, 1, 0, SCM -scm_c_make_vector (size_t k, SCM fill) +scm_c_make_vector (unsigned long int k, SCM fill) #define FUNC_NAME s_scm_make_vector { SCM v; @@ -289,9 +289,9 @@ scm_c_make_vector (size_t k, SCM fill) if (k > 0) { - size_t j; + unsigned long int j; - SCM_ASSERT_RANGE (1, scm_size2num (k), k <= SCM_VECTOR_MAX_LENGTH); + SCM_ASSERT_RANGE (1, scm_ulong2num (k), k <= SCM_VECTOR_MAX_LENGTH); base = scm_must_malloc (k * sizeof (scm_bits_t), FUNC_NAME); for (j = 0; j != k; ++j) @@ -322,7 +322,7 @@ SCM_DEFINE (scm_vector_to_list, "vector->list", 1, 0, 0, #define FUNC_NAME s_scm_vector_to_list { SCM res = SCM_EOL; - scm_bits_t i; + long i; SCM *data; SCM_VALIDATE_VECTOR (1,v); data = SCM_VELTS(v); @@ -338,7 +338,7 @@ SCM_DEFINE (scm_vector_fill_x, "vector-fill!", 2, 0, 0, "returned by @code{vector-fill!} is unspecified.") #define FUNC_NAME s_scm_vector_fill_x { - register scm_bits_t i; + register long i; register SCM *data; SCM_VALIDATE_VECTOR (1, v); data = SCM_VELTS (v); @@ -352,7 +352,7 @@ SCM_DEFINE (scm_vector_fill_x, "vector-fill!", 2, 0, 0, SCM scm_vector_equal_p(SCM x, SCM y) { - scm_bits_t i; + long i; for(i = SCM_VECTOR_LENGTH (x) - 1; i >= 0; i--) if (SCM_FALSEP (scm_equal_p (SCM_VELTS (x)[i], SCM_VELTS (y)[i]))) return SCM_BOOL_F; @@ -365,9 +365,9 @@ SCM_DEFINE (scm_vector_move_left_x, "vector-move-left!", 5, 0, 0, "Vector version of @code{substring-move-left!}.") #define FUNC_NAME s_scm_vector_move_left_x { - scm_bits_t i; - scm_bits_t j; - scm_bits_t e; + long i; + long j; + long e; SCM_VALIDATE_VECTOR (1,vec1); SCM_VALIDATE_INUM_COPY (2,start1,i); @@ -388,9 +388,9 @@ SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 5, 0, 0, "Vector version of @code{substring-move-right!}.") #define FUNC_NAME s_scm_vector_move_right_x { - scm_bits_t i; - scm_bits_t j; - scm_bits_t e; + long i; + long j; + long e; SCM_VALIDATE_VECTOR (1,vec1); SCM_VALIDATE_INUM_COPY (2,start1,i); diff --git a/libguile/vectors.h b/libguile/vectors.h index 7058dcac2..77d6131bf 100644 --- a/libguile/vectors.h +++ b/libguile/vectors.h @@ -55,7 +55,7 @@ #define SCM_VECTOR_BASE(x) ((scm_bits_t *) SCM_CELL_WORD_1 (x)) #define SCM_SET_VECTOR_BASE(v, b) (SCM_SET_CELL_WORD_1 ((v), (b))) #define SCM_VECTOR_MAX_LENGTH ((1L << 24) - 1) -#define SCM_VECTOR_LENGTH(x) (((scm_ubits_t) SCM_CELL_WORD_0 (x)) >> 8) +#define SCM_VECTOR_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) #define SCM_SET_VECTOR_LENGTH(v, l, t) (SCM_SET_CELL_WORD_0 ((v), ((l) << 8) + (t))) #define SCM_VELTS(x) ((SCM *) SCM_CELL_WORD_1 (x)) @@ -67,14 +67,14 @@ /* bit vectors */ -#define SCM_BITVEC_REF(a, i) ((SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_BITS_LENGTH]) & (1L<<((i)%SCM_BITS_LENGTH))) ? 1 : 0) -#define SCM_BITVEC_SET(a, i) SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_BITS_LENGTH]) |= (1L<<((i)%SCM_BITS_LENGTH)) -#define SCM_BITVEC_CLR(a, i) SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_BITS_LENGTH]) &= ~(1L<<((i)%SCM_BITS_LENGTH)) +#define SCM_BITVEC_REF(a, i) ((SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_LONG_BIT]) & (1L<<((i)%SCM_LONG_BIT))) ? 1 : 0) +#define SCM_BITVEC_SET(a, i) SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_LONG_BIT]) |= (1L<<((i)%SCM_LONG_BIT)) +#define SCM_BITVEC_CLR(a, i) SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_LONG_BIT]) &= ~(1L<<((i)%SCM_LONG_BIT)) -extern SCM scm_c_make_vector (size_t k, SCM fill); +extern SCM scm_c_make_vector (unsigned long int k, SCM fill); extern SCM scm_vector_p (SCM x); extern SCM scm_vector_length (SCM v); diff --git a/libguile/weaks.c b/libguile/weaks.c index 1432ae264..4bfe975a0 100644 --- a/libguile/weaks.c +++ b/libguile/weaks.c @@ -90,7 +90,7 @@ SCM_DEFINE (scm_weak_vector, "weak-vector", 0, 0, 1, { SCM res; SCM *data; - scm_bits_t i; + long i; /* Dirk:FIXME:: In case of multiple threads, the list might get corrupted while the vector is being created. */ @@ -235,7 +235,8 @@ scm_mark_weak_vector_spines (void *dummy1, void *dummy2, void *dummy3) { SCM *ptr; SCM obj; - scm_bits_t j, n; + long j; + long n; obj = w; ptr = SCM_VELTS (w); @@ -279,8 +280,8 @@ scm_scan_weak_vectors (void *dummy1, void *dummy2, void *dummy3) else /* if (SCM_IS_WHVEC_ANY (scm_weak_vectors[i])) */ { SCM obj = w; - register scm_bits_t n = SCM_VECTOR_LENGTH (w); - register scm_bits_t j; + register long n = SCM_VECTOR_LENGTH (w); + register long j; int weak_keys = SCM_IS_WHVEC (obj) || SCM_IS_WHVEC_B (obj); int weak_values = SCM_IS_WHVEC_V (obj) || SCM_IS_WHVEC_B (obj); -- 2.20.1