chicken GNU MP 4.1 FFI Version 0.0.2
A chicken scheme interface to GNU MP 4.1
Copyright (C) 2002 Peter K. Keller

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

BUILDING:

To build this package, please see the INSTALL file.

GENERAL INFO:

This is a release of the GNU MP library version 4.1 interface for
chicken scheme. It is a pretty comprehensive interface, but without any
of the lowlevel functions(mpn_*). I'm slowly releasing versions that have
better documentation, more finished validation code, implementations of
previously unimplemented functions, and examples.

Since the validation code is pretty extensive, it shouldn't take too
much work to fix when later revisions of the MP library comes out.

Here is a tiny example of the interface usage:

(declare (uses gmp))

(let (	(mpz1 (make-mpz_t))
		(mpz2 (make-mpz_t))
		(mpz3 (make-mpz_t)))

	(mpz_init mpz1)
	(mpz_init mpz2)
	(mpz_init mpz3)

	(mpz_set_ui mpz2 6)
	(mpz_set_str mpz3 "7" 10)
	(mpz_mul mpz1 mpz2 mpz3)

	(print 
		"The answer to " 
		(mpz_get_str #f 10 mpz2) 
		" times "
		(mpz_get_str #f 10 mpz3) 
		" is " 
		(mpz_get_str #f 10 mpz1) 
		".")
	
	(mpz_clear mpz1)
	(mpz_clear mpz2)
	(mpz_clear mpz3))

For the high level functions that I have not implemented: mpf_get_d_2exp
mpz_array_init _mpz_realloc mpz_get_d_2exp mpz_getlimbm mpz_import
mpz_export mpf_random2, there exists a function that will warn you to stdout
when you accidentily use them. I will eventually get around to supporting
these functions as I learn more about chicken.

SPECIAL FUNCTIONS:

Here is an example of how the special function "mpf_get_str" is handled:
(let (	(mpf1 (make-mpf_t))
		(exp_p (make-mp_exp_t_p)))

	(mpf_init mpf1)
	(mpf_set_ui mpf1 42)

	;; get a string representation placing the exponent into exp_p
	(mpf_get_str #f exp_p 10 10 mpf1)

	;; The ONLY way to see the exponent is to dereference the "pointer"
	;; that is exp_p
	(print "The exponent is " (deref-mp_exp_t_p exp_p) ".")

	(mpf_clear mpf1))


VARIOUS CONVENTIONS IN THE SOURCE AND MAKEFILES:

These conventions are to handle the translating of scheme to c and
the subsequent bookeeping that needs to be done. The Makefile has some
interesting rules in it that I have to make sure don't cause source code
conflict(like a valid c file getting written over by a translation of
a similarly named scheme file).

+ c_*.c are conventions for C source files
+ s_*.scml is a "scheme library compilation unit" basically something that isn't
	the toplevel.
+ *.scm is the single toplevel code "main"
+ *.scmh are macros and type definitions, use like C header files.

LICENSE

This entire package and every file in it is under the LGPL as found in
the LICENSE file. However, there is one exception to the license: You
don't necessarily have to provide the source code WITH the executable in
question if you are only releasing an executable, just merely a pointer
to any changed sources you may have, or to the repository containing the
original sources.

All files in this package are copyrighted (C) 2002 Peter K. Keller regardless
if they actually say it or not at the top of the file.

MISC.

The TODO file contains future things I need to do. :)


