(scm_string_copy): Use scm_c_substring to get a copy-on-write string.
[bpt/guile.git] / libguile / ChangeLog
CommitLineData
f26b9395
MV
12004-08-19 Marius Vollmer <marius.vollmer@uni-dortmund.de>
2
3 New string implementation, with copy-on-write strings and
4 mutation-sharing substrings, and a new internal string API.
5 Symbols can now share memory with strings.
6
7 * tags.h (scm_tc7_stringbuf): New tag.
8
9 * strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,
10 scm_i_string_writable_chars, scm_i_string_stop_writing): New, to
11 replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all
12 uses.
13 (scm_i_make_string, scm_c_make_string): New, to replace
14 scm_allocate_string. Updated all uses.
15 (SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS,
16 SCM_STRING_LENGTH): Deprecated.
17 (scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string,
18 scm_str2string, scm_makfrom0str, scm_makfrom0str_opt):
19 Discouraged. Replaced all uses with scm_from_locale_string or
20 similar, as appropriate.
21 (scm_c_string_length, scm_c_string_ref, scm_c_string_set_x,
22 scm_c_substring, scm_c_substring_shared, scm_c_substring_copy,
23 scm_substring_shared, scm_substring_copy): New.
24
25 * symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC,
26 SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS,
27 SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol,
28 scm_str2symbol, scm_mem2uninterned_symbol): Discouraged.
29 (SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str):
30 Deprecated.
31 (SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS,
32 SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed.
33 (scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln):
34 New, to replace scm_str2symbol and scm_mem2symbol, respectively.
35 Updated all uses.
36 (scm_gensym): Generate only the number suffix in the buffer, just
37 string-append the prefix.
38
39 * error.c (scm_memory_error): Do not try to throw, just abort.
40 Throwing will not work anyway.
41
42 * gh.h, gh-data.c (gh_set_substr): Made src const.
43
44 * ports.c (scm_i_mode_bits_n): New, for counted strings.
45 (scm_mode_bits): Use it.
46 (scm_c_port_for_each): Blocking GC does not seem to work, allocate
47 a vector normally and fill that instead of consing a list with a
48 blocked GC.
49
50 * read.c (scm_i_casei_streq): New, for counted strings.
51
52 * threads.c (gc_section_count): Removed, thread-sleeping can not
53 be nested.
54 (scm_i_thread_put_to_sleep): Call scm_i_leave_guile before locking
55 admin mutex so that we can be put to sleep by other threads while
56 blocking on that mutex. Lock all the heap mutex of all threads,
57 including ourselves.
58 (scm_i_thread_wake_up): Unlock all threads, including ourselves,
59 call scm_i_enter_guile.
60 (scm_thread_mark_stacks): Expect all threads to be suspended.
61
62 * gc.h, gc.c (scm_i_gc_admin_mutex): New, to protect
63 scm_gc_mallocated, for now.
64 (scm_init_storage): Initialize it.
65 * gc-malloc.c (descrease_mtrigger, increase_mtrigger): Use it.
66
67 * gc-mark.c (scm_gc_mark_dependencies): Call scm_i_string_mark,
68 scm_i_stringbuf_mark and scm_i_symbol_mark, as appropriate.
69 * gc-card.c (scm_i_sweep_card): Call scm_i_string_free,
70 scm_i_stringbuf_free and scm_i_symbol_free, as appropriate.
71
8a807b26
KR
722004-08-18 Kevin Ryde <user42@zip.com.au>
73
74 * arbiters.c (FETCH_STORE): New macro.
75 (SCM_LOCK_VAL, SCM_UNLOCK_VAL): New constants.
76 (SCM_LOCK_ARB, SCM_UNLOCK_ARB): Remove, effectively absorbed into
77 scm_try_arbiter and scm_release_arbiter.
78 (scm_try_arbiter, scm_release_arbiter): Use FETCH_STORE to get xchg
79 for speed on i386, otherwise using mutex.
80
81 * eq.c (scm_equal_p): Remove real==fraction and fraction==real, they
82 must be #f according to R5RS. (equal? follows eqv?, and for eqv? an
83 exact and inexact is #f.)
84
85 * fports.c (fport_print): Use scm_ttyname instead of ttyname directly,
86 to get thread safety of scm_ttyname.
87
88 * ports.c (ttyname): Remove prototype, unused.
89
d6cd4c36 90 * socket.c (scm_init_socket): Add SOCK_SEQPACKET and SOCK_RDM.
1f3cc0d3 91 Reported by Michael Tuexen.
d6cd4c36 92
fa0c0a4b
MV
932004-08-13 Marius Vollmer <marius.vollmer@uni-dortmund.de>
94
95 * load.c (scm_init_load_path): Do not pass NULL to
96 scm_to_locale_string, which would happen when GUILE_LOAD_PATH is
97 not set. Thanks to Bill Schottstaedt.
98
70f7ee41
MV
992004-08-12 Marius Vollmer <marius.vollmer@uni-dortmund.de>
100
101 * socket.c (scm_inet_aton, scm_inet_pton): Convert SCM strings to
102 locale strings instead of accessing their internals.
103 (scm_recv, scm_send, scm_recvfrom, scm_sendto): Use
104 SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH instead of
105 SCM_STRING_CHARS and SCM_STRING_LENGTH.
106
107 * simpos.c (scm_system): Convert SCM strings to locale strings
108 instead of accessing their internals.
109
110 * script.c (scm_compile_shell_switches): Convert version to locale
111 string before printing it.
112
113 * rdelim.c (scm_read_delimited_x): Avoid
114 SCM_VALIDATE_SUBSTRING_SPEC_COPY and use scm_from_size_t instead
115 of scm_from_long for the returned number of read characters.
116
117 * ioext.c (scm_fdopen): Use scm_i_fdes_to_port together with
118 scm_i_mode_bits to avoid accessing internals of SCM string from C.
119
120 * filesys.c (STRING_SYSCALL, STRING2_SYSCALL): New helper macros.
121 Use them instead of SCM_SYSCALL when one or two strings need to be
122 converted into locale strings.
123 (my_rename): New, gathers platform dependent code for renaming.
124 (scm_rename): Use it.
125 (scm_readlink, scm_copy_file): Convert SCM strings to locale
126 strings instead of accessing their internals.
127 (scm_basename, scm_dirname): Use SCM_I_STRING_CHARS and
128 SCM_I_STRING_LENGTH instead of SCM_STRING_CHARS and
129 SCM_STRING_LENGTH.
130
131 * extensions.c (load_extension): Convert lib and init to locale
132 strings instead of accessing the internals directly.
133 (scm_c_load_extension): Use scm_from_locale_string instead of
134 scm_makfrom0str.
135
136 * fports.h, fports.c (scm_i_fdes_to_port): New, like
137 scm_fdes_to_port, but take mode bits directly instead of as a C
138 string.
139 (scm_i_fdes_to_port): Implement using above.
140 (scm_open_file): Use scm_i_fdes_to_port together with
141 scm_i_mode_bits to avoid accessing internals of SCM string from C.
142 * vports.c (scm_make_soft_port): Use scm_i_fdes_to_port together
143 with scm_i_mode_bits to avoid accessing internals of SCM string
144 from C.
145
146 * ports.h (scm_i_mode_bits): New, same as scm_mode_bits but with a
147 SCM string as argument.
148
149 * ports.c (scm_i_void_port): New, like scm_void_port but take mode
150 bits directly instead of C string.
151 (scm_void_port): Implement using above.
152 (scm_sys_make_void_port): Use scm_i_void_port together with
153 scm_i_mode_bits to avoid accessing internals of SCM string.
154
155 * strings.h, strings.c (scm_i_get_substring_spec): New.
156
157 * socket.c, rw.c, deprecated.h, validate.h
158 (SCM_VALIDATE_STRING_COPY): Deprecated. Replaced all uses with
159 SCM_VALIDATE_STRING plus SCM_I_STRING_CHARS or
160 scm_to_locale_string, etc.
161 (SCM_VALIDATE_SUBSTRING_SPEC_COPY): Deprecated. Replaced as
162 above, plus scm_i_get_substring_spec.
163
164 * regex-posix.c, read.c, random.c, ramap.c, print.c, numbers.c,
165 hash.c, gc.c, gc-card.c, convert.i.c, backtrace.c, strop.c,
166 strorder.c, strports.c, struct.c, symbols.c, unif.c, ports.c: Use
167 SCM_I_STRING_CHARS, SCM_I_STRING_UCHARS, and SCM_I_STRING_LENGTH
168 instead of SCM_STRING_CHARS, SCM_STRING_UCHARS, and
169 SCM_STRING_LENGTH, respectively. Also, replaced scm_return_first
170 with more explicit scm_remember_upto_here_1, etc, or introduced
171 them in the first place.
172
173 * posix.c (WITH_STRING): New helper macro. Use it where one
174 locale string is needed for a short piece of code.
175 (STRING_SYSCALL): New helper macro. Use it instead of SCM_SYSCALL
176 when one locale string is needed.
177 (scm_mkstemp): Convert tmpl to a locale string.
178 (scm_putenv): Rewritten to use only C strings.
179 (scm_setlocale, scm_crpt): Convert argument strings to locale
180 strings.
181
1822004-08-11 Marius Vollmer <marius.vollmer@uni-dortmund.de>
183
184 * load.c (scm_primitive_load_path): Do not check for absolute
185 filenames when scm_sys_search_load_path returns false, which will
186 return absolute filenames unchanged.
187
bb26cc2d
MV
1882004-08-11 Marius Vollmer <mvo@zagadka.de>
189
190 * gc.c, procprop.c (scm_init_storage, scm_stand_in_procs,
191 scm_stand_in_proc): Use a hastable for scm_stand_in_procs instead
192 of an alist. Thanks to Matthias Koeppe!
193
02573e4c
MV
1942004-08-10 Marius Vollmer <marius.vollmer@uni-dortmund.de>
195
196 * strings.h, deprecated.h (SCM_STRING_COERCE_0TERMINATION_X):
197 Moved from string.h to deprecated.h.
198
199 * deprecated.c, deprecated.h (SCM_CHARS, SCM_LENGTH): Removed.
200
f9751e86 201 * strings.h, strings.c (SCM_MAKE_STRING_TAG): Renamed to
02573e4c
MV
202 SCM_I_MAKE_STRING_TAG, changed all uses.
203 (SCM_STRING_CHARS, SCM_STRING_UCHARS, SCM_STRING_LENGTH): Renamed
204 to SCM_I_STRING_CHARS, SCM_I_STRING_UCHARS, and SCM_I_LENGTH
205 respectively. For a short time, the old names are still there as
206 aliases. Not all uses have been changed yet, but the ones in
207 strings.c have.
208 (SCM_STRING_MAX_LEN): Do not hardcode to 24 bits, compute from
209 SCM_T_BITS_MAX.
210 (scm_is_string, scm_from_locale_string, scm_from_locale_stringn,
211 scm_take_locale_string, scm_take_locale_stringn,
212 scm_to_locale_string, scm_to_locale_stringn,
213 scm_to_locale_stringbuf): New.
214 (scm_c_string2str, scm_c_substring2str): Deprecated by moving to
215 deprecated.[hc]. Implemented in terms of the new functions above.
216 (scm_take_str, scm_take0str, scm_mem2string, scm_str2string,
217 scm_makfrom0str): Reimplemented in terms of the new functions from
218 above. They will be discouraged shortly.
219 (scm_substring): Do not use scm_mem2string.
220 (scm_i_allocate_string_pointers, scm_i_free_string_pointers): New,
221 to replace similar code from posix.c, simpos.c, and dynl.c.
222 (scm_string_append): Use memcpy instead of explicit loop. Do not
223 use register keyword. Use plain 'char' instead of 'unsigned
224 char'.
225
226 * strports.c (scm_mkstrport): Use SCM_I_STRING_UCHARS instead of
227 SCM_STRING_UCHARS. Use SCM_I_STRINGP instead of SCM_STRINGP.
228
229 * strop.c (scm_i_index): Replaced SCM_STRINGP, SCM_STRING_CHARS,
230 and SCM_STRING_LENGTH with SCM_I_STRINGP, SCM_I_STRING_CHARS, and
231 SCM_I_STRING_LENGTH, respectively. Pass string object directly,
232 not as a pointer. Use scm_remember_upto_here_1 to protect it.
233
234 * read.c (scm_input_error): Use a SCM value for 'fn', not a C
235 string. This avoids a conversion round-trip.
236
237 * gh_data.c: Replaced SCM_STRINGP, SCM_STRING_CHARS, and
238 SCM_STRING_LENGTH with SCM_I_STRINGP, SCM_I_STRING_CHARS, and
239 SCM_I_STRING_LENGTH, respectively.
240 (gh_scm2newstr): Implement in terms of scm_to_locale_string.
241
242 * environments.c: Instead calling scm_puts on the SCM_STRING_CHARS
243 of a string, call scm_display on the string itself.
244
245 * dynwind.c, dynwind.h (scm_frame_free): New.
246
247 * stime.c, socket.c, simpos.c, procs.c, posix.c, ports.c,
248 net_db.c, fports.c, filesys.c, eval.c, deprecation.c, dynl.c:
249 Replaced uses of SCM_STRING_CHARS with proper uses of
250 scm_to_locale_string. Replaced SCM_STRINGP with scm_is_string.
251 Replaced scm_mem2string with scm_from_locale_string.
252
253 * simpos.c, posix.c (allocate_string_pointers, environ_list_to_c):
254 Removed, replaced all uses with scm_i_allocate_string_pointers.
255
256 * load.h, load.c (scm_internal_parse_path): Removed.
257 (scm_parse_path): Use scm_string_split to do the work.
258 (scm_init_load_path): Use scm_parse_path instead of
259 scm_internal_parse_path.
260 (scm_search_path): Rewritten string handling part of the code in
261 terms of scm_to_locale_stringbuf and so that it is thread safe.
262
263 * error.c (scm_error_scm): Throw directly instead of calling
264 scm_error, this avoids the back and forth conversion of SUBR and
265 MESSAGE and also plugs a memory leak.
266 (scm_error): Call scm_error_scm.
267
268 * backtrace.c: Replaced SCM_STRINGP with scm_is_string.
269 (display_header): Print FNAME when it is true, not
270 merely when it is a string.
271
272 * strings.h (SCM_SET_STRING_LENGTH, SCM_SET_STRING_CHARS): Removed
273 unceremoniously. They were unused by Guile itself, and external
274 use should stop immediately.
275
276
409eb4e5
MV
2772004-08-10 Marius Vollmer <mvo@zagadka.de>
278
279 * numbers.h, number.c, deprecated.h, deprecated.c (scm_round,
280 scm_truncate): Renamed to scm_c_round and scm_c_truncate;
281 deprecated versions installed in deprecated.h and deprecated.c.
282 Changed all uses.
283
a00eaf19
RB
2842004-08-06 Rob Browning <rlb@defaultvalue.org>
285
286 * net_db.c (scm_resolv_error): don't cause an exception while
287 trying to throw an exception -- call scm_misc_error with correct
288 arguments. The previous arguments needed a format escape that
289 wasn't in any of the format strings.
290
bcb88c93
KR
2912004-08-06 Kevin Ryde <user42@zip.com.au>
292
8f094b97
KR
293 * ramap.c (scm_array_fill_x): For byvect char fill, force signed char
294 so as not to depend on signedness of plain char. For byvect range
295 check, throw out-of-range rather than wrong-type-arg.
296
bcb88c93
KR
297 * unif.c (scm_uniform_vector_ref, scm_array_set_x): For byvect, force
298 signed byte range checks by using scm_to_schar and scm_from_schar,
299 don't want to depend on signedness of C char.
300
29e61124
KR
3012004-08-05 Kevin Ryde <user42@zip.com.au>
302
303 * arbiters.c (scm_try_arbiter): Use scm_i_misc_mutex instead of
304 SCM_DEFER_INTS.
305 (scm_release_arbiter): Use scm_i_misc_mutex so return value can be
306 guaranteed if multiple threads compete to unlock.
307 Update docstrings per doc/ref/api-scheduling.texi.
308
99de794f
KR
309 * filesys.c (scm_copy_file): Use fstat on the input fd rather than
310 stat on the filename, to be certain a file rename can't mean we get
311 info on one filesystem object but open another. This fstat usage is
312 similar to Emacs copy-file.
313
29e61124
KR
314 * posix.c (scm_setgroups): Enhance docstring, per doc/ref/posix.texi.
315
316 * simpos.c (scm_system_star): Change scm_from_long to scm_from_int on
317 SIGINT and SIGQUIT, since those values are ints.
318
759aa8f9
MV
3192004-08-03 Marius Vollmer <marius.vollmer@uni-dortmund.de>
320
7241f213
MV
321 * num2integral.i.c, num2float.i.c: Removed.
322 * Makefile.am (noinst_HEADERS): Updated.
323
f9656a9f
MV
324 * numbers.h. numbers.c (scm_make_ratio): Renamed to
325 scm_i_make_ratio and made static, replaced uses with scm_divide.
96d8c217
MV
326 (scm_complex_p): New, export as "complex?" to Scheme.
327 (scm_number_p): Export as "number?" to Scheme.
328 (scm_is_complex, scm_is_number): New.
329 (scm_c_make_rectangular, scm_c_make_polar): New.
330 (scm_make_rectangular, scm_make_polar): Use above.
331 (scm_c_real_part, scm_c_imag_part, scm_c_magnitude, scm_c_angle):
332 New.
333 (scm_make_complex): Discouraged by moving to discouraged.h and
334 discouraged.c. Replaced all uses with scm_c_make_rectangular.
335
759aa8f9
MV
336 * discouraged.h, discouraged.c, numbers.c, numbers.h
337 (scm_is_rational): New.
338 (scm_i_short2big, scm_i_int2big, scm_i_uint2big, scm_i_size2big,
339 scm_i_ptrdiff2big, scm_i_long_long2big, scm_i_ulong_long2big):
340 Removed prototypes.
341 (scm_make_real, scm_num2dbl, scm_float2num, scm_double2num):
342 Discouraged by moving to discouraged.h and discouraged.c.
343 Replaced all uses with scm_from_double.
344 (scm_num2float, scm_num2double): Discouraged by moving prototype
345 to discouraged.h and rewriting in terms of scm_to_double.
346 Replaced all uses with scm_to_double.
347 (scm_to_double): Do not implement in terms of scm_num2dbl, use
348 explicit code.
349 (scm_from_double): Do not implement in terms of scm_make_real, use
350 explicit code.
351
531bf3e6
MV
3522004-08-02 Marius Vollmer <marius.vollmer@uni-dortmund.de>
353
759aa8f9
MV
354 * init.c (scm_init_guile_1): Call scm_i_init_discouraged.
355
531bf3e6
MV
356 * gen-scmconfig.h.in (SCM_I_GSC_ENABLE_DISCOURAGED): New.
357 * gen-scmconfig.c (SCM_ENABLE_DISCOURAGED): Emit based on above.
358
359 * eval.c (SCM_EVALIM, SCM_EVALIM2, SCM_XEVAL, SCM_XEVALCAR):
360 Renamed to SCM_I_* in order to avoid collisions with the versions
361 defined in deprecated.h.
362
363 * discouraged.h, discouraged.c: New files.
364
365 * deprecated.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_EQ_P,
366 SCM_NEGATE_BOOL, SCM_BOOL, SCM_BOOT_NOT): Promoted from being
367 deprecated to being discouraged by moving to discouraged.h.
368
369 * numbers.h, numbers.c, discouraged.h, discouraged.c
370 (scm_short2num, scm_ushort2num, scm_int2num, scm_uint2num,
371 scm_long2num, scm_ulong2num, scm_size2num, scm_ptrdiff2num,
372 scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint,
373 scm_num2long, scm_num2ulong, scm_num2size, scm_num2ptrdiff,
374 scm_long_long2num, scm_ulong_long2num, scm_num2long_long,
375 scm_num2ulong_long): Discouraged by moving to discouraged.h and
376 discouraged.c and reimplementing in terms of scm_from_* and
377 scm_to_*. Changed all uses to the new scm_from_* and scm_to_*
378 functions.
379
380 * numbers.h, numbers.c: Removed GUILE_DEBUG code.
381 (scm_i_short2big, scm_i_ushort2big, scm_i_int2big, scm_i_uint2big,
382 scm_i_size2big, scm_i_ptrdiff2big): Removed.
383 (scm_i_long2big, scm_i_ulong2big): New, explicit definitions.
384 * conv-integer.i.c, conv-uinteger.i.c: Use them instead of
385 explicit code.
386
5ec82e96
KR
3872004-08-02 Kevin Ryde <user42@zip.com.au>
388
389 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): Add comments about past
390 and current usage and migration.
391
58f28989
KR
3922004-07-31 Kevin Ryde <user42@zip.com.au>
393
394 * error.c (scm_strerror): Use scm_i_misc_mutex around strerror since
395 it's not thread safe.
396 (scm_syserror): Use scm_strerror rather than SCM_I_STRERROR, to take
397 advantage of this.
398 * fports.c (scm_open_file): Use scm_strerror likewise.
399 * filesys.c (scm_stat, scm_lstat): Ditto.
400
401 * filesys.c (scm_copy_file): Avoid fd leak when destination file
402 cannot be opened.
403
404 * symbols.c (scm_gensym): Use scm_i_misc_mutex around gensym_counter
405 update, for thread safety.
406 (gensym_counter): Move into scm_gensym which is its only user.
407 (scm_init_symbols): No need to explicitly initialize gensym_counter.
408
03696aab
MV
4092004-07-29 Marius Vollmer <marius.vollmer@uni-dortmund.de>
410
51fdb325
MV
411 * numbers.h (scm_to_schar, scm_to_uchar, scm_to_char,
412 scm_to_short, scm_to_ushort, scm_to_int, scm_to_uint, scm_to_long,
413 scm_to_ulong, scm_to_long_long, scm_to_ulong_long, scm_to_intmax,
414 scm_to_uintmax, scm_to_size_t, scm_to_ssize_t scm_from_schar,
415 scm_from_uchar, scm_from_char, scm_from_short, scm_from_ushort,
416 scm_from_int, scm_from_uint, scm_from_long, scm_from_ulong,
417 scm_from_long_long, scm_from_ulong_long, scm_from_intmax,
418 scm_from_uintmax, scm_from_size_t, scm_from_ssize_t): No longer
419 defined in terms of scm_to_signed_integer, etc, but in terms of
420 scm_to_int8, etc.
421
422 * gen-scmconfig.c (SCM_SIZEOF_INTMAX, SCM_SIZEOF_SIZE_T): New.
423
03696aab
MV
424 * gen-scmconfig.h.in: Removed SCM_I_GSC_*_LIMITS macros, they are
425 no longer used.
426
427 * __scm.h (SCM_I_UTYPE_MAX, SCM_I_TYPE_MAX, SCM_I_TYPE_MIN,
428 SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN, SCM_I_SSIZE_MAX): New.
429
430 * __scm.h, gen-scmconfig.c (SCM_I_LLONG_MAX, SCM_I_LLONG_MIN,
431 SCM_I_ULLONG_MAX, SCM_T_INT8_MIN, SCM_T_INT8_MAX, SCM_T_UINT8_MAX,
432 SCM_T_INT16_MIN, SCM_T_INT16_MAX, SCM_T_UINT16_MAX,
433 SCM_T_INT32_MIN, SCM_T_INT32_MAX, SCM_T_UINT32_MAX,
434 SCM_T_INT64_MIN, SCM_T_INT64_MAX, SCM_T_UINT64_MAX,
435 SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX, SCM_T_UINTMAX_MAX): Moved
436 definition into __scm.h, using new SCM_I_TYPE_MIN, etc.
437
438 * conv-integer.i.c, conv-uinteger.i.c: New files, used to generate
439 the functions below.
440
441 * Makefile.am (noinst_HEADERS): Added conv-integer.i.c and
442 conv-uinteger.i.c.
443
444 * numbers.c, numbers.h (scm_to_int8, scm_to_uint8, scm_to_int16,
445 scm_to_uint16, scm_to_int32, scm_to_uint32, scm_to_int64,
446 scm_to_uint64, scm_from_int8, scm_from_uint8, scm_from_int16,
447 scm_from_uint16, scm_from_int32, scm_from_uint32, scm_from_int64,
448 scm_from_uint64): Turned from macros into proper functions.
449 (scm_to_signed_integer, scm_to_unsigned_integer,
450 scm_from_signed_integer, scm_from_unsigned_integer): Generate via
451 conv-integer.i.c and conv-uinteger.i.c, as well.
452
453 * number.h (scm_to_ssize_t, scm_to_size_t): Use the new
454 SCM_I_SSIZE_MIN, SCM_I_SSIZE_MAX, and SCM_I_SIZE_MAX macros for
455 the limits. Those are always defined.
456
1f15779e
KR
4572004-07-29 Kevin Ryde <user42@zip.com.au>
458
459 * posix.c (scm_ttyname): Use scm_i_misc_mutex for thread safety.
460
48360eb3
KR
4612004-07-28 Kevin Ryde <user42@zip.com.au>
462
463 * posix.c (scm_ctermid): Use an L_ctermid buf on the stack, for thread
464 safety.
465
c3f3c841
KR
466 * unif.c (scm_array_set_x): For svect, use scm_num2short for
467 consistency with other vector types and to get arg and func name into
468 error message.
469
c82f8ed6
MV
4702004-07-27 Marius Vollmer <marius.vollmer@uni-dortmund.de>
471
472 * deprecated.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_BOOL):
473 Reimplement using scm_is_false, scm_is_true, scm_is_bool, and
474 scm_from_bool, respectively.
475 (SCM_NINUMP): Added.
476
477 * tags.h, deprecated.h (SCM_EQ_P): Deprecated by moving it into
478 deprecated.h. Replaced all uses with scm_is_eq.
479
317b4c4a
KR
4802004-07-24 Kevin Ryde <user42@zip.com.au>
481
482 * threads.c, threads.h (scm_i_misc_mutex): New SCM_GLOBAL_MUTEX.
483 * posix.c (scm_crypt): Use it to protect static data in crypt().
484
e11e83f3
MV
4852004-07-23 Marius Vollmer <marius.vollmer@uni-dortmund.de>
486
487 * deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,
c82f8ed6 488 SCM_INUM): Deprecated by renaming them to SCM_I_INUMP,
e11e83f3
MV
489 SCM_I_NINUMP and SCM_I_INUM, respectively and adding deprecated
490 versions to deprecated.h and deprecated.c. Changed all uses to
491 either use the SCM_I_ variants or scm_is_*, scm_to_*, or
492 scm_from_*, as appropriate.
493
494 * dynwind.c (scm_i_dowinds): Removed unused code that would call
495 the unexisting scm_cross_dynwind_binding_scope for inums on the
496 windlist.
497
a55c2b68
MV
4982004-07-10 Marius Vollmer <marius.vollmer@uni-dortmund.de>
499
500 * socket.c (ipv6_net_to_num, scm_from_ipv6): Renamed
e11e83f3 501 ipv6_net_to_num to scm_from_ipv6, for converting from an IPv6
a55c2b68
MV
502 byte-wise address to a SCM integer. Changed all uses.
503 (ipv6_num_to_net, scm_to_ipv6): Renamed ipv6_num_to_net to
504 scm_to_ipv6 and added type and range checking, for converting from
505 an IPv& byte-wise address to a SCM integer. Changed all uses.
506 (bignum_in_ipv6_range_p, VALIDATE_INET6): Removed, their function
507 is now done by scm_to_ipv6.
508
509 * numbers.c (scm_to_signed_integer, scm_to_unsigned_integer): dot
510 not accept inexact integers.
511
512 * validate.h, deprecated.h (SCM_VALIDATE_INUM,
513 SCM_VALIDATE_INUM_COPY, SCM_VALIDATE_BIGINT,
514 SCM_VALIDATE_INUM_MIN, SCM_VALIDATE_INUM_MIN_COPY,
515 SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
516 SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
517 SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
518 fixnum/bignum distinction visible. Changed all uses to
519 scm_to_size_t or similar.
520
5212004-07-09 Marius Vollmer <marius.vollmer@uni-dortmund.de>
522
523 * cpp_cnvt.awk: Use scm_from_int instead of SCM_MAKINUM.
524
48a06bd5
KR
5252004-07-10 Kevin Ryde <user42@zip.com.au>
526
527 * hash.c (scm_hashq, scm_hashv, scm_hash): Restrict to size>=1 rather
528 than size>=0, since 0<=hash<size cannot be satisfied for size==0, and
529 such a size causes divide-by-zeros in scm_hasher.
530
052fbfd9
KR
531 * regex-posix.c (scm_make_regexp): Free rx on error, to avoid memory
532 leak.
533
43240c9c
MV
5342004-07-08 Marius Vollmer <marius.vollmer@uni-dortmund.de>
535
536 * numbers.c (scm_is_signed_integer, scm_is_unsigned_integer):
537 Rewritten using the same logic as scm_to_signed_integer and
538 scm_to_unsigned_integer, respectively, which is better(tm). Also,
539 use CHAR_BIT instead of hardcoding 8.
540 (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Removed and used
541 SCM_I_LLONG_MIN etc. instead.
542
543 * numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM to
544 SCM_I_MAKINUM and changed all uses.
545 * deprecated.h, deprecated.c (SCM_MAKINUM): Newly deprecated.
546
a3de8e7b
MV
547 * gen-scmconfig.c (SCM_I_LLONG_MIN, SCM_I_LLONG_MAX,
548 SCM_I_ULLONG_MAX): Instead of hard-coding the numbers, compute
43240c9c
MV
549 them by assuming twos-complement.
550
c9eb03bb
MV
5512004-07-07 Marius Vollmer <marius.vollmer@uni-dortmund.de>
552
553 * gen-scmconfig.h.in: Added all the new SCM_I_GSC_*_LIMITS that
554 configure now produces.
555 * gen-scmconfig.c: Use them to output SCM_T_INT8_MIN, etc
556 definitions, giving the limits of the integer types defined by
557 Guile. Also, output a hard coded SCM_I_LLONG_MIN, etc since
558 LLONG_MIN or LONG_LONG_MIN is hard to get at.
559
560 * numbers.h (scm_to_short, scm_to_ushort): It's SHRT_MIN, etc, not
561 SHORT_MIN.
562 (scm_to_size_t): Use SIZE_MAX instead of cooking our own.
563 (scm_to_long_long, scm_to_ulong_long, scm_to_int8, scm_to_uint8,
564 scm_to_int16, scm_to_uint16, scm_to_int32, scm_to_uint32,
565 scm_to_int64, scm_to_uint64, scm_to_intmax, scm_to_uintmax,
566 scm_from_long_long, scm_from_ulong_long, scm_from_int8,
567 scm_from_uint8, scm_from_int16, scm_from_uint16, scm_from_int32,
568 scm_from_uint32, scm_from_int64, scm_from_uint64, scm_from_intmax,
569 scm_from_uintmax): New.
570
7888309b
MV
5712004-07-06 Marius Vollmer <marius.vollmer@uni-dortmund.de>
572
573 * tags.h (scm_is_eq): New.
574
575 * deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,
576 SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into
577 "deprecated.h". Replaced all uses with scm_is_false, scm_is_true,
578 scm_from_bool, and scm_is_bool, respectively.
579
580 * boolean.h (scm_is_bool): Fix bug in prototype.
581 (scm_from_bool): The argument is "x" not "f", stupid.
582
583 * boolean.c (scm_is_bool): Fix typo.
584
585 * numbers.h, numbers.c (scm_is_integer, scm_is_signed_integer,
586 scm_is_unsigned_integer, scm_to_signed_integer,
587 scm_to_unsigned_integer, scm_to_schar, scm_to_uchar, scm_to_char,
588 scm_to_short, scm_to_ushort, scm_to_long, scm_to_ulong,
589 scm_to_size_t, scm_to_ssize_t, scm_from_schar, scm_from_uchar,
590 scm_from_char, scm_from_short, scm_from_ushort, scm_from_int,
591 scm_from_uint, scm_from_long, scm_from_ulong, scm_from_size_t,
592 scm_from_ssize_t, scm_is_real, scm_to_double, scm_from_double):
593 New.
594
800570a6
MV
5952004-07-05 Marius Vollmer <marius.vollmer@uni-dortmund.de>
596
597 * boolean.h, boolean.c (scm_is_true, scm_is_false, scm_from_bool,
598 scm_to_bool): New.
599
9fcf3cbb
DH
6002004-06-27 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
601
602 * backtrace.c (display_expression, display_frame): Call
603 scm_i_unmemoize_expr for unmemoizing a memoized object holding a
604 single memoized expression.
605
606 * debug.c (memoized_print): Don't try to unmemoize the memoized
607 object, since we can't know whether it holds a single expression
608 or a body.
609
610 (scm_mem_to_proc): Removed check for lambda expression, since it
611 was moot anyway. Whoever uses these functions for debugging
612 purposes should know what they do: Creating invalid memoized code
613 will cause crashes, independent of whether this check is present
614 or not.
615
616 (scm_proc_to_mem): Take the closure's code as it is and don't
617 append a SCM_IM_LAMBDA isym. To allow easier debugging, the
618 memoized code should not be modified.
619
620 * debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
621 scm_unmemoize from public use, but made scm_i_unmemoize_expr
622 available as a guile internal function instead. However,
623 scm_i_unmemoize_expr will only work on memoized objects that hold
624 a single memoized expression. It won't work with bodies.
625
626 * debug.c (scm_procedure_source), macros.c (macro_print), print.c
627 (scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
628 i. e. a list of expressions.
629
630 * eval.c (unmemoize_exprs): Drop internal body markers from the
631 output during unmemoization.
632
633 * eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
634 scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
635 but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
636 as guile internal functions instead. scm_i_unmemoize_expr will
637 only work on a single memoized expression, while
638 scm_i_unmemocopy_body will only work on bodies.
639
90df793f
DH
6402004-06-21 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
641
642 * eval.c (unmemoize_exprs): Handle semi-memoized code.
643
644 (scm_cons_source, scm_primitive_eval): Prefer higher level
645 predicate SCM_FALSEP over SCM_IMP.
646
8048c00b
RB
6472004-06-15 Rob Browning <rlb@defaultvalue.org>
648
649 * script.c (scm_shell_usage): minor phrasing change.
650
651 * gc_os_dep.c: update ifdefery for macosx.
652 (scm_get_stack_base): separate result initialization from
653 declaration to slience warnings with macosx and hp-ux using gcc
654