summaryrefslogtreecommitdiff
path: root/libguile/random.c
AgeCommit message (Collapse)AuthorFilesLines
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-35/+11
2003-04-04* random.c (scm_c_random_bignum): rewrite to handle GMP bignums.Rob Browning1-84/+60
2003-03-27* random.c: fix various preprocessor usages of new publicRob Browning1-1/+1
symbols to expect 0 or 1 values rather than 1 or undefined. i.e. change #ifdef to #if, etc.
2003-03-25* random.c: #include <config.h> if HAVE_CONFIG_H. Replace usageRob Browning1-31/+19
of LONG32, LONG64, SIZEOF_LONG, and HAVE_LONG_LONGS with scm_t_int32, scm_t_int64, and SCM_HAVE_T_INT64. Rename usage of HAVE_ARRAYS to SCM_HAVE_ARRAYS.
2003-03-03Added comments to scm_c_random_bignumMikael Djurfeldt1-3/+26
2002-08-16* mallocs.c (scm_malloc_obj): use scm_gc_malloc in stead ofHan-Wen Nienhuys1-2/+2
malloc. * gc-segment.c (scm_i_get_new_heap_segment): remove cluster cruft: only use SCM_MIN_HEAP_SEG_SIZE. * ports.c (scm_add_to_port_table): add backwards compatibility function * ports.h: use scm_i_ prefix for port table and port table size.
2002-07-25(rstate_free): Return zero.Marius Vollmer1-1/+1
2002-07-202002-07-20 Han-Wen <hanwen@cs.uu.nl>Han-Wen Nienhuys1-16/+16
* *.c: add space after commas everywhere. * *.c: use SCM_VECTOR_SET everywhere, where a vector is written. Document cases where SCM_WRITABLE_VELTS() is used. * vectors.h (SCM_VELTS): prepare for write barrier, and let SCM_VELTS() return a const pointer (SCM_VECTOR_SET): add macro. * autogen.sh (mscripts): find and check version number of autoconf. Complain if 2.53 is not found.
2002-03-14Retire inclusion guard macro SCM_MAGIC_SNARFER.Thien-Thi Nguyen1-2/+0
2001-11-13* Miscellaneous small doc updates and fixes.Neil Jerram1-2/+2
2001-11-11* Documentation work.Neil Jerram1-7/+7
2001-07-09Remove "face-lift" comment.Thien-Thi Nguyen1-2/+0
2001-06-26Make compilation under Windows easier.Martin Grabmüller1-0/+8
2001-06-14replace "scm_*_t" with "scm_t_*".Marius Vollmer1-20/+20
2001-05-24* validate.hMichael Livshin1-22/+22
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]): new macros. * unif.h: type renaming: scm_array -> scm_array_t scm_array_dim -> scm_array_dim_t the old names are deprecated, all in-Guile uses changed. * tags.h (scm_ubits_t): new typedef, representing unsigned scm_bits_t. * stacks.h: type renaming: scm_info_frame -> scm_info_frame_t scm_stack -> scm_stack_t the old names are deprecated, all in-Guile uses changed. * srcprop.h: type renaming: scm_srcprops -> scm_srcprops_t scm_srcprops_chunk -> scm_srcprops_chunk_t the old names are deprecated, all in-Guile uses changed. * gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c, rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c, vectors.c, vports.c, weaks.c: various int/size_t -> size_t/scm_bits_t changes. * random.h: type renaming: scm_rstate -> scm_rstate_t scm_rng -> scm_rng_t scm_i_rstate -> scm_i_rstate_t the old names are deprecated, all in-Guile uses changed. * procs.h: type renaming: scm_subr_entry -> scm_subr_entry_t the old name is deprecated, all in-Guile uses changed. * options.h (scm_option_t.val): unsigned long -> scm_bits_t. type renaming: scm_option -> scm_option_t the old name is deprecated, all in-Guile uses changed. * objects.c: various long -> scm_bits_t changes. (scm_i_make_class_object): flags: unsigned long -> scm_ubits_t * numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to SCM_I_FIXNUM_BIT. * num2integral.i.c: new file, multiply included by numbers.c, used to "templatize" the various integral <-> num conversion routines. * numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl): deprecated. (scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig, scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big, scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big, scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big, scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big, scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num, scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff, scm_num2size): new functions. * modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x * load.c: change int -> size_t in various places (where the variable is used to store a string length). (search-path): call scm_done_free, not scm_done_malloc. * list.c (scm_ilength): return a scm_bits_t, not long. some other {int,long} -> scm_bits_t changes. * hashtab.c: various [u]int -> scm_bits_t changes. scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef). (scm_ihashx): n: uint -> scm_bits_t use scm_bits2num instead of scm_ulong2num. * gsubr.c: various int -> scm_bits_t changes. * gh_data.c (gh_scm2double): no loss of precision any more. * gh.h (gh_str2scm): len: int -> size_t (gh_{get,set}_substr): start: int -> scm_bits_t, len: int -> size_t (gh_<num>2scm): n: int -> scm_bits_t (gh_*vector_length): return scm_[u]size_t, not unsigned long. (gh_length): return scm_bits_t, not unsigned long. * fports.h: type renaming: scm_fport -> scm_fport_t the old name is deprecated, all in-Guile uses changed. * fports.c (fport_fill_input): count: int -> scm_bits_t (fport_flush): init_size, remaining, count: int -> scm_bits_t * debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed those prototypes, as the functions they prototype don't exist. * fports.c (default_buffer_size): int -> size_t (scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t default_size: int -> size_t (scm_setvbuf): csize: int -> scm_bits_t * fluids.c (n_fluids): int -> scm_bits_t (grow_fluids): old_length, i: int -> scm_bits_t (next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int -> scm_bits_t (scm_c_with_fluids): flen, vlen: int -> scm_bits_t * filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to the new and shiny SCM_NUM2INT. * extensions.c: extension -> extension_t (and made a typedef). * eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so there are no nasty surprises if/when the various deeply magic tag bits move somewhere else. * eval.c: changed the locals used to store results of SCM_IFRAME, scm_ilength and such to be of type scm_bits_t (and not int/long). (iqq): depth, edepth: int -> scm_bits_t (scm_eval_stack): int -> scm_bits_t (SCM_CEVAL): various vars are not scm_bits_t instead of int. (check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t i: int -> scm_bits_t * environments.c: changed the many calls to scm_ulong2num to scm_ubits2num. (import_environment_fold): proc_as_ul: ulong -> scm_ubits_t * dynwind.c (scm_dowinds): delta: long -> scm_bits_t * debug.h: type renaming: scm_debug_info -> scm_debug_info_t scm_debug_frame -> scm_debug_frame_t the old names are deprecated, all in-Guile uses changed. (scm_debug_eframe_size): int -> scm_bits_t * debug.c (scm_init_debug): use scm_c_define instead of the deprecated scm_define. * continuations.h: type renaming: scm_contregs -> scm_contregs_t the old name is deprecated, all in-Guile uses changed. (scm_contregs_t.num_stack_items): size_t -> scm_bits_t (scm_contregs_t.num_stack_items): ulong -> scm_ubits_t * continuations.c (scm_make_continuation): change the type of stack_size form long to scm_bits_t. * ports.h: type renaming: scm_port_rw_active -> scm_port_rw_active_t (and made a typedef) scm_port -> scm_port_t scm_ptob_descriptor -> scm_ptob_descriptor_t the old names are deprecated, all in-Guile uses changed. (scm_port_t.entry): int -> scm_bits_t. (scm_port_t.line_number): int -> long. (scm_port_t.putback_buf_size): int -> size_t. * __scm.h (long_long, ulong_long): deprecated (they pollute the global namespace and have little value besides that). (SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an SCM handle). (ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they exist (for size_t & ptrdiff_t) (scm_sizet): deprecated. * Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-15Merge from mvo-vcell-cleanup-1-branch.Marius Vollmer1-9/+9
2001-04-03Correct, update, improve and clean up a lot of docstrings in order to makeMartin Grabmüller1-7/+9
the documentation much more consistent.
2001-03-06* Remove uses of SCM_ASSERT that may result in error messages differentDirk Herrmann1-3/+7
from wrong-type-arg errors.
2001-02-17(scm_seed_to_random_state, scm_copy_random_state, scm_random):Martin Grabmüller1-7/+7
Added texinfo markup.
2001-02-16(scm_random, scm_random_normal, scm_random_solid_sphere_x,Martin Grabmüller1-12/+6
scm_random_hollow_sphere_x, scm_random_normal_vector_x, scm_random_exp): Removed unnecessary "" from docstrings.
2000-12-08Smob-related creanup.Keisuke Nishida1-4/+4
2000-11-22* Deprecated macros SCM_ROCHARS and SCM_ROUCHARS.Dirk Herrmann1-1/+1
2000-11-17* alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,Marius Vollmer1-0/+2
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c, environments.c, eq.c, error.c, eval.c, evalext.c, feature.c, filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c, hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c, list.c, load.c, macros.c, modules.c, net_db.c, numbers.c, objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c, print.c, procprop.c, procs.c, properties.c, ramap.c, random.c, read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c, socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c, strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c, version.c, vports.c, weaks.c: Makes sure the snarfer output inclusion is disabled when the snarfer is run on the file. Thanks to Lars J. Aas! * Makefile.am: Install guile-procedures.txt in version-specific directory to enable multiple installed guile versions. Suggested by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-10-26* String comparison functions don't accept symbols as arguments any more.Dirk Herrmann1-0/+1
* Added macro SCM_STRING_COERCE_0TERMINATION_X.
2000-10-11* Replace calls to SCM_LENGTH.Dirk Herrmann1-5/+5
2000-06-29* Cleaned up memory error signalling.Dirk Herrmann1-5/+2
2000-06-14* random.c: #include <string.h>. (Needed by memcpy.)Mikael Djurfeldt1-0/+1
2000-05-10More distinguished handling of real and complex values.Dirk Herrmann1-2/+2
2000-05-02* numbers.c (scm_logtest, scm_division): Reordered dispatch sequence.Dirk Herrmann1-6/+6
* removed calls to deprecated scm_makdbl.
2000-04-21* Makefile.am (DEFS): Added. automake adds -I options to DEFS,Mikael Djurfeldt1-9/+9
and we don't want that. (INCLUDES): Removed all -I options except for the root source directory and the root build directory. * *.*: Change includes so that they always use the "prefixes" libguile/, qt/, guile-readline/, or libltdl/. (Thanks to Tim Mooney.)
2000-04-13TypoMikael Djurfeldt1-1/+1
2000-03-19 * *.[hc]: add Emacs magic at the end of file, to ensure GNUMichael Livshin1-0/+6
indentation style.
2000-03-17Only include strings.h where it is actually needed.Dirk Herrmann1-0/+1
2000-03-17Only include vectors.h in those files, where it is actually needed.Dirk Herrmann1-0/+1
2000-03-17Removed empty file genio.h and references to it.Dirk Herrmann1-1/+0
2000-03-14* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,Mikael Djurfeldt1-2/+2
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive rewrite of handling of real and complex numbers. (SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been removed along with the support for floats. (Float vectors are still supported.)
2000-03-03* error.h, error.c: Added `scm_wrong_type_arg_msg' to supportGreg J. Badros1-1/+1
displaying the expected type. Use SCM_LISTn in a couple places instead of scm_cons-ing by hand. * __scm.h: Added SCM_ASSERT_TYPE macro. * validate.h, scm_validate.h: Added the former, as a renamed version of the latter with SCM_ASSERT_TYPE used in SCM_MAKE_VALIDATE (instead of just SCM_ASSERT) * Makefile.am: Rename scm_validate.h to validate.h. * *.c, *.h: Include validate.h, not scm_validate.h (old name's prefix was superfluous).
2000-01-25* random.c: Added documentation, from SLIB page:Greg J. Badros1-9/+42
http://angela.ctrl-c.liu.se/~calle/scheme/slib_toc.html
2000-01-05* *.[ch]: Whitespace changes -- added space after SCM_VALIDATE_*Greg J. Badros1-12/+12
macros and SCM_DEFINE macros to match GNU coding standards.
2000-01-05*.[ch]: Replace GUILE_PROC w/ SCM_DEFINE.Greg J. Badros1-9/+9
2000-01-05* guile-snarf.awk.in: Do argument/number mismatch checking andGreg J. Badros1-2/+2
print warnings in an Emacs compile-mode parseable format. * struct.c: Use SCM_ASSERT_RANGE instead of SCM_ASSERT w/ SCM_OUTOFRANGE as 3rd argument. * random.c: Fix argument/number mismatch (that I introduced :-( ). * __scm.h: Do not #define SCM_ARG* when snarfing; lets us distinguish between 1 and SCM_ARG1 when snarfing as only the former (using the number) requires the argument to match the formal in the current argument snarfing check. * ramap.c: Remove extraneous #undef FUNC_NAME.
2000-01-05* unif.c, symbols.c, strings.c, stacks.c, random.c, print.c,Greg J. Badros1-9/+3
posix.c: Eliminated a bunch of SCM_NIMP(..)s that are now redundant with the safer macros. Patch from Dirk Hermann applied by hand. Thanks Dirk! * scm_validate.h: Added SCM_VALIDATE_VECTOR_OR_DVECTOR for some uses in random.c. * ramap.c: whitespace change.
1999-12-16* coop-threads.c: Remove K&R function headers.Greg J. Badros1-1/+1
* scm_validate.h: Added SCM_VALIDATE_THREAD. * *.c: Remove SCM_NIMP(X) when it is an extraneous pre-test given that SCM_FOOP macros all now include SCM_NIMP in their expansion. This simplifies lots of code, making it far more readable.
1999-12-13Remove leading whitespace before empty docstrings.Greg J. Badros1-8/+8
1999-12-12* *.c, scm_validate.h: Use SCM_VALIDATE_NIM, not SCM_VALIDATE_NIMPGreg J. Badros1-1/+1
(none of the other validate macros have the trailing P).
1999-12-12* *.c: Pervasive software-engineering-motivated rewrite ofGreg J. Badros1-75/+66
function headers and argument checking. Switched SCM_PROC, SCM_PROC1 macros to be GUILE_PROC, GUILE_PROC1 (may change names later, but was useful to keep old versions around while migrate) that has docstrings and argument lists embedded in the GUILE_PROC macro invocations that expand into a function header. Use lots of new SCM_VALIDATE_* macros to simplify error checking and reduce tons of redundancy. This is very similar to what I did for Scwm. Note that none of the extraction of the docstrings, nor software engineering checks of Scwm is yet added to Guile. I'll work on that tomorrow, I expect. * Makefile.am: Added scm_validate.h to modinclude_HEADERS. * chars.c: Added docstrings for the primitives defined in here. * snarf.h: Added GUILE_PROC, GUILE_PROC1. Added SCM_REGISTER_PROC to be like old SCM_PROC, though old SCM_PROC still remains for now. Changed naming convention for the s_foo string name of the primitive to be s_scm_foo for ease of use with the macro. * scm_validate.h: Lots of new SCM_VALIDATE macros to simplify argument checking through guile. Maybe some of these should be folded into the header file for the types they check, but for now it was easiest to just stick them all in one place.
1999-11-19 * acconfig.h: add HAVE_ARRAYS.Gary Houston1-17/+20
* configure.in: add --disable-arrays option, probably temporary. * the following changes allow guile to be built with the array "module" omitted. some of this stuff is just tc7 type support, which wouldn't be needed if uniform array types were converted to smobs. * tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless HAVE_ARRAYS. (scm_tag): don't check array types unless HAVE_ARRAYS. * sort.c (scm_restricted_vector_sort_x, scm_sorted_p): remove the unused array types. * (scm_stable_sort, scm_sort): don't support vectors if not HAVE_ARRAYS. a bit excessive. * random.c (vector_scale, vector_sum_squares, scm_random_solid_sphere_x, scm_random_hollow_sphere_x, scm_random_normal_vector_x): don't define unless HAVE_ARRAYS. * gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect, gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect, gh_uniform_vector_length, gh_uniform_vector_ref): don't define unless HAVE_ARRAYS. (gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats, gh_scm2doubles): don't check vector types if not HAVE_ARRAYS. * eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1), gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of): don't support the array types unless HAVE_ARRAYS is defined. * tags.h: make nine tc7 types conditional on HAVE_ARRAYS. * read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is defined (this should use read-hash-extend). * ramap.c, unif.c: don't check whether ARRAYS is defined. * vectors.c (scm_vector_set_length_x): moved here from unif.c. call scm_uniform_element_size if HAVE_ARRAYS. vectors.h: prototype too. * unif.c (scm_uniform_element_size): new procedure. * init.c (scm_boot_guile_1): don't call scm_init_ramap or scm_init_unif unless HAVE_ARRAYS is defined. * __scm.h: don't define ARRAYS. * Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c moved here from libguile_la_SOURCES. * Makefile.am (ice9_sources): add arrays.scm. * boot-9.scm: load arrays.scm if 'array is provided. * arrays.scm: new file with stuff from boot-9.scm.
1999-07-25* random.c, random.h (scm_c_default_rstate, scm_c_uniform32):Mikael Djurfeldt1-19/+28
Added. Renamed functions in the random function library interface from scm_i_XXX --> scm_c_XXX.
1999-07-07Greg's smob patchMikael Djurfeldt1-19/+3
1999-01-26* random.c (scm_i_random_bignum): Made independent of endianness.Mikael Djurfeldt1-5/+7