diff options
author | Jim Blandy <jimb@red-bean.com> | 1997-04-14 06:42:27 +0000 |
---|---|---|
committer | Jim Blandy <jimb@red-bean.com> | 1997-04-14 06:42:27 +0000 |
commit | ee2a8b9bdd1d548e5530f4f132aa436167154a00 (patch) | |
tree | 752b54578b9f14e466cc3e8c712e47b4bf4a9c78 | |
parent | f4d7dfb69da543557bfca4b63e992868e0e37110 (diff) | |
download | guile-ee2a8b9bdd1d548e5530f4f132aa436167154a00.tar.gz |
* gh_init.c (gh_standard_handler): Return SCM_BOOL_F, not garbage.
Merge GH interface library into libguile.
* gh.h, gh_data.c, gh_eval.c, gh_funcs.c, gh_init.c, gh_io.c,
gh_list.c, gh_predicates.c, gh_test_c, gh_test_c.c, gh_test_repl,
gh_test_repl.c: New files.
* Makefile.am (libguile_la_SOURCES): Add gh_data.c, gh_eval.c,
gh_funcs.c, gh_init.c, gh_io.c, gh_list.c, gh_predicates.c. Move
_scm.h to ...
(EXTRA_libguile_la_SOURCES): ... here.
(pkginclude_HEADERS): Add variable, to get gh.h installed.
(THREAD_LIBS, check_ldadd, check_PROGRAMS, gh_test_c_SOURCES,
gh_test_c_LDADD, gh_test_repl_SOURCES, gh_test_repl_LDADD):
New variables, describing how to build the gh test programs.
* configure.in: Check for -lm, -lsocket, -lnsl; we need this to
build the test programs, and we probably should have been linking
libguile.la against them all along, to support AIX shared libs.
Add cflags for threads to CFLAGS; add libs for threads to new
variable THREAD_LIBS, used in Makefile.am.
* ChangeLog-gh: log from old `gh' subdirectory.
* Makefile.in, configure, scmconfig.h.in: Rebuilt.
-rw-r--r-- | libguile/ChangeLog | 24 | ||||
-rw-r--r-- | libguile/ChangeLog-gh | 250 | ||||
-rw-r--r-- | libguile/Makefile.am | 37 | ||||
-rw-r--r-- | libguile/Makefile.in | 159 | ||||
-rwxr-xr-x | libguile/configure | 371 | ||||
-rw-r--r-- | libguile/configure.in | 6 | ||||
-rw-r--r-- | libguile/gh.h | 195 | ||||
-rw-r--r-- | libguile/gh_data.c | 286 | ||||
-rw-r--r-- | libguile/gh_eval.c | 180 | ||||
-rw-r--r-- | libguile/gh_funcs.c | 169 | ||||
-rw-r--r-- | libguile/gh_init.c | 107 | ||||
-rw-r--r-- | libguile/gh_io.c | 57 | ||||
-rw-r--r-- | libguile/gh_list.c | 142 | ||||
-rw-r--r-- | libguile/gh_predicates.c | 121 | ||||
-rw-r--r-- | libguile/gh_test_c.c | 221 | ||||
-rw-r--r-- | libguile/gh_test_repl.c | 156 | ||||
-rw-r--r-- | libguile/scmconfig.h.in | 9 |
17 files changed, 2306 insertions, 184 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index ea4d11789..fdcce8c16 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,12 +1,28 @@ -Sun Apr 13 23:03:55 1997 Jim Blandy <jimb@floss.cyclic.com> +Mon Apr 14 01:32:57 1997 Jim Blandy <jimb@floss.cyclic.com> * gh_init.c (gh_standard_handler): Return SCM_BOOL_F, not garbage. + Merge GH interface library into libguile. + * gh.h, gh_data.c, gh_eval.c, gh_funcs.c, gh_init.c, gh_io.c, + gh_list.c, gh_predicates.c, gh_test_c, gh_test_c.c, gh_test_repl, + gh_test_repl.c: New files. * Makefile.am (libguile_la_SOURCES): Add gh_data.c, gh_eval.c, - gh_funcs.c, gh_init.c, gh_io.c, gh_list.c, gh_predicates.c. - - * Makefile.am (libguile_la_SOURCES): Move _scm.h to... + gh_funcs.c, gh_init.c, gh_io.c, gh_list.c, gh_predicates.c. Move + _scm.h to ... (EXTRA_libguile_la_SOURCES): ... here. + (pkginclude_HEADERS): Add variable, to get gh.h installed. + (THREAD_LIBS, check_ldadd, check_PROGRAMS, gh_test_c_SOURCES, + gh_test_c_LDADD, gh_test_repl_SOURCES, gh_test_repl_LDADD): + New variables, describing how to build the gh test programs. + * configure.in: Check for -lm, -lsocket, -lnsl; we need this to + build the test programs, and we probably should have been linking + libguile.la against them all along, to support AIX shared libs. + Add cflags for threads to CFLAGS; add libs for threads to new + variable THREAD_LIBS, used in Makefile.am. + * ChangeLog-gh: log from old `gh' subdirectory. + * Makefile.in, configure, scmconfig.h.in: Rebuilt. + +Sun Apr 13 23:03:55 1997 Jim Blandy <jimb@floss.cyclic.com> * acconfig.h: Undo change of Apr 9; including the definition of PACKAGE in the guile headers conflicts with applications' own diff --git a/libguile/ChangeLog-gh b/libguile/ChangeLog-gh new file mode 100644 index 000000000..3837e19bb --- /dev/null +++ b/libguile/ChangeLog-gh @@ -0,0 +1,250 @@ +Thu Apr 10 16:14:43 1997 Jim Blandy <jimb@floss.cyclic.com> + + Let the test programs build even when we're not using threads. + * configure.in: Use CY_AC_WITH_THREADS to decide whether to build + with threads. + * Makefile.am (check_PROGRAMS_LDADD): Remove -lthreads -lqt. The + configure script will stick them in LIBS if they're needed. + * Makefile.in, aclocal.m4, configure: Rebuilt. + + * gh_funcs.c (gh_apply, gh_call0, gh_call1, gh_call2, gh_call3): + New functions. + * gh.h: Prototypes for above. + * gh_test_c.c (main_prog): Added test cases for above. + + * gh.h (gh_display, gh_newline): Added prototypes. + + * gh_test_c.c (main_prog): Remove bizarre single quote from test + of gh_symbol2scm, and from "test" of (display "hello world"). + + * gh.c: Removed; its guts have been redistributed to the other + gh-mumble.c files. + + * gh.c, gh_data.c, gh_eval.c, gh_funcs.c, gh_init.c, gh_io.c, + gh_list.c, gh_predicates.c, gh_test_c.c, gh_test_repl.c: + Re-indented, according to the GNU coding standards. (Put function + names at beginning of lines, basically.) + +Wed Apr 9 17:56:34 1997 Jim Blandy <jimb@floss.cyclic.com> + + Changes to work with automake-1.1n, which has better libtool support. + * Makefile.am: Use lib_LTLIBRARIES, not lib_PROGRAMS. + * Makefile.in: Regenerated. + +Sat Mar 8 06:37:23 1997 Gary Houston <ghouston@actrix.gen.nz> + + * gh_eval.c (gh_eval_file): remove case_i, sharp arguments from + scm_primitive_load call. + +Mon Feb 24 21:45:32 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se> + + * configure.in: Added AM_MAINTAINER_MODE + +Wed Feb 12 16:34:42 1997 Mark Galassi <rosalia@sarastro.lanl.gov> + + * gh_data.c (gh_symbol2newstr): added this conversion from SCM + symbol to C string. + (gh_set_substr): more data conversion: from part of a (possibly + large) C string to an existing SCM string. + (gh_get_substr): more data conversion: from part of a (possibly + large) SCM string to an existing C char array. + +Mon Feb 10 14:03:09 1997 Mark Galassi <rosalia@sarastro.lanl.gov> + + * gh_funcs.c (gh_define): added this function. + + * gh_init.c (gh_catch): fixed stupid bug, gh_catch() was not + returning anything. + + * gh_data.c (gh_scm2newstr): Renamed gh_scm2str0() to + gh_scm2newstr(), and did away with the str0 convention (it doesn't + seem to belong in gh_). + (gh_scm2str): this function now copies Scheme data to a + pre-allocated C string. + +Fri Feb 7 15:12:30 1997 Mark Galassi <rosalia@sarastro.lanl.gov> + + * gh_data.c (gh_scm2str0): On Sascha Ziemann and Jim Blandy's + suggestion I changed gh_scm2str0() so that it returns a malloc-ed + string, rather than taking a pre-allocated string with a maximum + length... + +Fri Jan 24 08:18:28 1997 Mark Galassi <rosalia@sarastro.lanl.gov> + + * gh_eval.c (gh_eval_str): gh_eval_str() now returns an SCM object + with the result of the evaluation. It has also been simplified to + just call scm_eval_0str(). gh_eval_file() has been similarly + altered. + +Sat Jan 11 14:40:17 1997 Marius Vollmer <mvo@zagadka.ping.de> + + * ltconfig, ltmain.sh: New files for libtool support. libguile, + rx, gh and gtcltk-lib can now be build as shared libraries. + * Makefile.am (EXTRA_DIST): Added ltconfig and ltmain.sh + +Sun Jan 5 16:57:10 1997 Jim Blandy <jimb@floss.cyclic.com> + + * Guile 1.0 released. This is the first release by the Free + Software Foundation; Cygnus has also released earlier versions of + Guile. + + * GUILE-VERSION: Updated version number. + * NEWS: Added comments for all the user-visible changes marked in + the ChangeLogs. + * README: Updated for release. + +Thu Dec 12 00:14:32 1996 Gary Houston <ghouston@actrix.gen.nz> + + * scsh: new directory. + +Mon Dec 2 17:33:04 1996 Tom Tromey <tromey@cygnus.com> + + * configure.in: Generate doc/guile-programmer/Makefile and + doc/guile-user/Makefile. + +Sat Nov 30 23:45:54 1996 Tom Tromey <tromey@cygnus.com> + + * aclocal.m4: Now automatically generated by aclocal. + * threads.m4: New file. + * guile.m4: New file. + * Makefile.am, doc/Makefile.am: New files. + * configure.in: Updated for Automake. Avoid excessively verbose + "greet" messages. + +Wed Oct 16 07:32:14 1996 Mark Galassi <rosalia@sarastro.lanl.gov> + + * lgh: directory renamed to gh, along with all prefixes of the + high level library procedures. + +Thu Oct 10 14:37:43 1996 Jim Blandy <jimb@floss.cyclic.com> + + * Makefile.in (TAGS tags): Find the source files in $srcdir. + +Wed Oct 9 19:37:14 1996 Jim Blandy <jimb@floss.cyclic.com> + + * Makefile.in (DISTFILES): Add AUTHORS and aclocal.m4. + +Tue Oct 1 00:13:55 1996 Mikael Djurfeldt <mdj@woody.nada.kth.se> + + * configure.in: Added some configuration magic from the Cygnus + distribution. + + * aclocal.m4: New file. For now used for thread support + configuration. + +Fri Sep 13 14:39:30 1996 Mark Galassi <rosalia@sarastro.lanl.gov> + + * Makefile.in (DISTFILES): added mkinstalldirs to the DISTFILES + + * PLUGIN: changed the PLUGIN/REQ files in the ice-9 and lgh + directories, to arrange for lgh to the last thing + configured/built. + +Wed Sep 11 21:11:33 1996 Mark Galassi <rosalia@nis.lanl.gov> + + * lgh/: added the directory in which I implement the high level + libguile library (lgh_) for this release of Guile. See the + ChangeLog in there for further details. + +Wed Sep 11 16:12:53 1996 Mark Galassi <rosalia@sarastro.lanl.gov> + + * doc/ (guile-user and guile-programmer): added the guile-user and + guile-programmer directories which contain the user and programmer + manuals. See the ChangeLog entries there for detail. + +Wed Sep 11 14:33:49 1996 Jim Blandy <jimb@floss.cyclic.com> + + * Makefile.in (distclean): Don't forget to delete doc/Makefile. + + * Makefile.in (distclean): Don't forget to delete + config.build-subdirs. + +Thu Sep 5 17:36:15 1996 Jim Blandy <jimb@floss.cyclic.com> + + * Makefile.in (tags): New name for `TAGS' target, which will + always run the commands. + +Thu Sep 5 09:56:50 1996 Jim Blandy <jimb@totoro.cyclic.com> + + * README: Doc fixes. + +Fri Aug 30 16:56:27 1996 Jim Blandy <jimb@floss.cyclic.com> + + * Makefile.in (TAGS): Produce a single tags file for all of Guile. + +Thu Aug 15 19:03:03 1996 Jim Blandy <jimb@floss.cyclic.com> + + * configure.in: Check for -ldl, so the check for Tcl won't fail + spuriously. + +Thu Aug 15 01:29:29 1996 Jim Blandy <jimb@totoro.cyclic.com> + + Change the way we decide whether to build gtcltk-lib, so that it's + omitted from the build process when appropriate, but never from + the dist process. + * configure.in: Don't edit all_subdirs depending on the + availability of Tk; let that be the list of all PLUGIN + subdirectories present, as it used to be. Instead, edit a new + variable, build_subdirs; write its final value, the list of + subdirs we do want to compile in, to config.build-subdirs. + Substitute that into the top-level Makefile too. + * Makefile.in (subdirs): Set this to @build_subdirs@, so we only + recurse on the subdirectories we should build. + (distdirs): Set this to @existingdirs@, so it includes the subdirs + we decided not to build. + + * doc/gtcltk.texi: File resurrected from old Guile releases. + * doc/Makefile.in (info): Build the gtcltk documentation. + (DIST_FILES): Include it in the distribution. + + * configure.in: If we can find the library for tcl7.5, build + gtcltk-lib. Call AC_PROG_CC, to help run that test with the right + compiler (not sure this is necessary). + +Mon Aug 12 15:09:37 1996 Jim Blandy <jimb@totoro.cyclic.com> + + * NEWS: Fix bug reporting address. + +Fri Aug 9 15:58:42 1996 Jim Blandy <jimb@totoro.cyclic.com> + + * AUTHORS: New file, in accordance with the GNU maintainers' + standards. + +Tue Aug 6 14:40:44 1996 Jim Blandy <jimb@totoro.cyclic.com> + + * README: Renamed from ANNOUNCE; include bug report address, + description, and short tour. + * INSTALL: Renamed from BUILDING. + * NEWS: New file. + * Makefile.in (DISTFILES): Update appropriately. + +Thu Aug 1 02:31:53 1996 Jim Blandy <jimb@totoro.cyclic.com> + + * doc/Makefile.in: Added pattern targets for creating DVI and + PostScript files. + (%.ps, %.dvi, %.txt): New targets. + (DVIPS, TEXI2DVI): New variables. + + * GUILE-VERSION: Updated to 1.0b3. + + Rehashed distribution system, in preparation for nightly + snapshots. Other changes in subdirectories. + * Makefile.in (dist): Rewritten --- the old target was out of + date, dependent on files that we don't have, and relied on GNU + tar. The new target is simpler. + (VERSION, srcdir, dist_dirs): New variables. + (DISTFILES): Renamed from localfiles. Added GUILE-VERSION and + TODO. + (localtreats): Variable removed. We don't have this file. + (info): cd to doc and make info there; don't make info in every + ${subdir}; those Makefiles don't know what to do. + (distname, distdir, treats, announcefile): Variables removed. + (manifest-file): Target removed. + (dist-dir): New target, responsible for distributable files in + this directory. + (GZIP, GZIP_EXT, TAR_VERBOSE, DIST_NAME): New variables, + controlling the 'dist' target. + * configure.in: Substitute GUILE-VERSION into the top-level + Makefile. Build doc/Makefile from doc/Makefile.in. + + * doc/Makefile.in: New file. diff --git a/libguile/Makefile.am b/libguile/Makefile.am index 978095a2e..6c92b0137 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -8,18 +8,20 @@ AUTOMAKE_OPTIONS = foreign INCLUDES = -I.. -I$(srcdir)/.. lib_LTLIBRARIES = libguile.la -libguile_la_SOURCES = alist.c append.c appinit.c arbiters.c async.c \ - boolean.c chars.c continuations.c dynl.c dynwind.c eq.c \ - error.c eval.c extchrs.c feature.c filesys.c fports.c gc.c \ - gdbint.c genio.c gsubr.c hash.c hashtab.c init.c ioext.c \ - kw.c list.c load.c mallocs.c markers.c mbstrings.c net_db.c \ - numbers.c objprop.c \ - options.c pairs.c ports.c posix.c print.c procprop.c procs.c ramap.c \ - read.c root.c scmsigs.c sequences.c simpos.c smob.c socket.c \ - stackchk.c stime.c strings.c strop.c strorder.c \ - strports.c struct.c symbols.c tag.c throw.c unif.c variable.c \ - vectors.c version.c vports.c weaks.c _scm.h -EXTRA_libguile_la_SOURCES = backtrace.c stacks.c debug.c srcprop.c \ + +libguile_la_SOURCES = \ + alist.c append.c appinit.c arbiters.c async.c boolean.c chars.c \ + continuations.c dynl.c dynwind.c eq.c error.c eval.c extchrs.c \ + feature.c filesys.c fports.c gc.c gdbint.c genio.c gh_data.c gh_eval.c \ + gh_funcs.c gh_init.c gh_io.c gh_list.c gh_predicates.c gsubr.c hash.c \ + hashtab.c init.c ioext.c kw.c list.c load.c mallocs.c markers.c \ + mbstrings.c net_db.c numbers.c objprop.c options.c pairs.c ports.c \ + posix.c print.c procprop.c procs.c ramap.c read.c root.c scmsigs.c \ + sequences.c simpos.c smob.c socket.c stackchk.c stime.c strings.c \ + strop.c strorder.c strports.c struct.c symbols.c tag.c throw.c unif.c \ + variable.c vectors.c version.c vports.c weaks.c +EXTRA_libguile_la_SOURCES = _scm.h \ + backtrace.c stacks.c debug.c srcprop.c \ strerror.c inet_aton.c putenv.c libguile_la_DEPENDENCIES = @LIBLOBJS@ libguile_la_LIBADD = @LIBLOBJS@ @@ -27,6 +29,9 @@ libguile_la_LDFLAGS = -version-info 0:0 -rpath $(libdir) include_HEADERS = libguile.h +# These are headers visible as <guile/mumble.h> +pkginclude_HEADERS = gh.h + # These are headers visible as <libguile/mumble.h>. modincludedir = $(includedir)/@module@ modinclude_HEADERS = __scm.h alist.h append.h arbiters.h async.h \ @@ -47,6 +52,14 @@ modinclude_DATA = scmconfig.h bin_SCRIPTS = guile-snarf +THREAD_LIBS = @THREAD_LIBS@ +check_ldadd = libguile.la ${THREAD_LIBS} +check_PROGRAMS = gh_test_c gh_test_repl +gh_test_c_SOURCES = gh_test_c.c +gh_test_c_LDADD = ${check_ldadd} +gh_test_repl_SOURCES = gh_test_repl.c +gh_test_repl_LDADD = ${check_ldadd} + EXTRA_DIST = gscm.c gscm.h ChangeLog-scm dynl-dl.c dynl-dld.c dynl-shl.c \ dynl-vms.c DYNAMIC-LINKING PLUGIN/REQ PLUGIN/guile.config \ PLUGIN/guile.libs.in cpp_signal.c cpp_errno.c cpp_err_symbols.in \ diff --git a/libguile/Makefile.in b/libguile/Makefile.in index f04543fa7..35d015357 100644 --- a/libguile/Makefile.in +++ b/libguile/Makefile.in @@ -67,18 +67,20 @@ AUTOMAKE_OPTIONS = foreign INCLUDES = -I.. -I$(srcdir)/.. lib_LTLIBRARIES = libguile.la -libguile_la_SOURCES = alist.c append.c appinit.c arbiters.c async.c \ - boolean.c chars.c continuations.c dynl.c dynwind.c eq.c \ - error.c eval.c extchrs.c feature.c filesys.c fports.c gc.c \ - gdbint.c genio.c gsubr.c hash.c hashtab.c init.c ioext.c \ - kw.c list.c load.c mallocs.c markers.c mbstrings.c net_db.c \ - numbers.c objprop.c \ - options.c pairs.c ports.c posix.c print.c procprop.c procs.c ramap.c \ - read.c root.c scmsigs.c sequences.c simpos.c smob.c socket.c \ - stackchk.c stime.c strings.c strop.c strorder.c \ - strports.c struct.c symbols.c tag.c throw.c unif.c variable.c \ - vectors.c version.c vports.c weaks.c _scm.h -EXTRA_libguile_la_SOURCES = backtrace.c stacks.c debug.c srcprop.c \ + +libguile_la_SOURCES = \ + alist.c append.c appinit.c arbiters.c async.c boolean.c chars.c \ + continuations.c dynl.c dynwind.c eq.c error.c eval.c extchrs.c \ + feature.c filesys.c fports.c gc.c gdbint.c genio.c gh_data.c gh_eval.c \ + gh_funcs.c gh_init.c gh_io.c gh_list.c gh_predicates.c gsubr.c hash.c \ + hashtab.c init.c ioext.c kw.c list.c load.c mallocs.c markers.c \ + mbstrings.c net_db.c numbers.c objprop.c options.c pairs.c ports.c \ + posix.c print.c procprop.c procs.c ramap.c read.c root.c scmsigs.c \ + sequences.c simpos.c smob.c socket.c stackchk.c stime.c strings.c \ + strop.c strorder.c strports.c struct.c symbols.c tag.c throw.c unif.c \ + variable.c vectors.c version.c vports.c weaks.c +EXTRA_libguile_la_SOURCES = _scm.h \ + backtrace.c stacks.c debug.c srcprop.c \ strerror.c inet_aton.c putenv.c libguile_la_DEPENDENCIES = @LIBLOBJS@ libguile_la_LIBADD = @LIBLOBJS@ @@ -86,6 +88,9 @@ libguile_la_LDFLAGS = -version-info 0:0 -rpath $(libdir) include_HEADERS = libguile.h +# These are headers visible as <guile/mumble.h> +pkginclude_HEADERS = gh.h + # These are headers visible as <libguile/mumble.h>. modincludedir = $(includedir)/@module@ modinclude_HEADERS = __scm.h alist.h append.h arbiters.h async.h \ @@ -104,6 +109,14 @@ modinclude_DATA = scmconfig.h bin_SCRIPTS = guile-snarf +THREAD_LIBS = @THREAD_LIBS@ +check_ldadd = libguile.la ${THREAD_LIBS} +check_PROGRAMS = gh_test_c gh_test_repl +gh_test_c_SOURCES = gh_test_c.c +gh_test_c_LDADD = ${check_ldadd} +gh_test_repl_SOURCES = gh_test_repl.c +gh_test_repl_LDADD = ${check_ldadd} + EXTRA_DIST = gscm.c gscm.h ChangeLog-scm dynl-dl.c dynl-dld.c dynl-shl.c \ dynl-vms.c DYNAMIC-LINKING PLUGIN/REQ PLUGIN/guile.config \ PLUGIN/guile.libs.in cpp_signal.c cpp_errno.c cpp_err_symbols.in \ @@ -131,13 +144,21 @@ LIBS = @LIBS@ libguile_la_OBJECTS = alist.lo append.lo appinit.lo arbiters.lo \ async.lo boolean.lo chars.lo continuations.lo dynl.lo dynwind.lo eq.lo \ error.lo eval.lo extchrs.lo feature.lo filesys.lo fports.lo gc.lo \ -gdbint.lo genio.lo gsubr.lo hash.lo hashtab.lo init.lo ioext.lo kw.lo \ -list.lo load.lo mallocs.lo markers.lo mbstrings.lo net_db.lo numbers.lo \ -objprop.lo options.lo pairs.lo ports.lo posix.lo print.lo procprop.lo \ -procs.lo ramap.lo read.lo root.lo scmsigs.lo sequences.lo simpos.lo \ -smob.lo socket.lo stackchk.lo stime.lo strings.lo strop.lo strorder.lo \ -strports.lo struct.lo symbols.lo tag.lo throw.lo unif.lo variable.lo \ -vectors.lo version.lo vports.lo weaks.lo +gdbint.lo genio.lo gh_data.lo gh_eval.lo gh_funcs.lo gh_init.lo \ +gh_io.lo gh_list.lo gh_predicates.lo gsubr.lo hash.lo hashtab.lo \ +init.lo ioext.lo kw.lo list.lo load.lo mallocs.lo markers.lo \ +mbstrings.lo net_db.lo numbers.lo objprop.lo options.lo pairs.lo \ +ports.lo posix.lo print.lo procprop.lo procs.lo ramap.lo read.lo \ +root.lo scmsigs.lo sequences.lo simpos.lo smob.lo socket.lo stackchk.lo \ +stime.lo strings.lo strop.lo strorder.lo strports.lo struct.lo \ +symbols.lo tag.lo throw.lo unif.lo variable.lo vectors.lo version.lo \ +vports.lo weaks.lo +gh_test_c_OBJECTS = gh_test_c.o +gh_test_c_DEPENDENCIES = libguile.la +gh_test_c_LDFLAGS = +gh_test_repl_OBJECTS = gh_test_repl.o +gh_test_repl_DEPENDENCIES = libguile.la +gh_test_repl_LDFLAGS = SCRIPTS = $(bin_SCRIPTS) CFLAGS = @CFLAGS@ @@ -146,7 +167,8 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CF LINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ DATA = $(modinclude_DATA) -HEADERS = $(include_HEADERS) $(modinclude_HEADERS) +HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \ +$(pkginclude_HEADERS) DIST_COMMON = COPYING ChangeLog Makefile.am Makefile.in acconfig.h \ acinclude.m4 aclocal.m4 configure configure.in guile-snarf.in \ @@ -162,21 +184,23 @@ DEP_FILES = .deps/alist.P .deps/append.P .deps/appinit.P \ .deps/chars.P .deps/continuations.P .deps/debug.P .deps/dynl.P \ .deps/dynwind.P .deps/eq.P .deps/error.P .deps/eval.P .deps/extchrs.P \ .deps/feature.P .deps/filesys.P .deps/fports.P .deps/gc.P \ -.deps/gdbint.P .deps/genio.P .deps/gsubr.P .deps/hash.P .deps/hashtab.P \ -.deps/inet_aton.P .deps/init.P .deps/ioext.P .deps/kw.P .deps/list.P \ -.deps/load.P .deps/mallocs.P .deps/markers.P .deps/mbstrings.P \ -.deps/net_db.P .deps/numbers.P .deps/objprop.P .deps/options.P \ -.deps/pairs.P .deps/ports.P .deps/posix.P .deps/print.P \ -.deps/procprop.P .deps/procs.P .deps/putenv.P .deps/ramap.P \ -.deps/read.P .deps/root.P .deps/scmsigs.P .deps/sequences.P \ -.deps/simpos.P .deps/smob.P .deps/socket.P .deps/srcprop.P \ -.deps/stackchk.P .deps/stacks.P .deps/stime.P .deps/strerror.P \ -.deps/strings.P .deps/strop.P .deps/strorder.P .deps/strports.P \ -.deps/struct.P .deps/symbols.P .deps/tag.P .deps/throw.P .deps/unif.P \ -.deps/variable.P .deps/vectors.P .deps/version.P .deps/vports.P \ -.deps/weaks.P -SOURCES = $(libguile_la_SOURCES) $(EXTRA_libguile_la_SOURCES) -OBJECTS = $(libguile_la_OBJECTS) +.deps/gdbint.P .deps/genio.P .deps/gh_data.P .deps/gh_eval.P \ +.deps/gh_funcs.P .deps/gh_init.P .deps/gh_io.P .deps/gh_list.P \ +.deps/gh_predicates.P .deps/gh_test_c.P .deps/gh_test_repl.P \ +.deps/gsubr.P .deps/hash.P .deps/hashtab.P .deps/inet_aton.P \ +.deps/init.P .deps/ioext.P .deps/kw.P .deps/list.P .deps/load.P \ +.deps/mallocs.P .deps/markers.P .deps/mbstrings.P .deps/net_db.P \ +.deps/numbers.P .deps/objprop.P .deps/options.P .deps/pairs.P \ +.deps/ports.P .deps/posix.P .deps/print.P .deps/procprop.P \ +.deps/procs.P .deps/putenv.P .deps/ramap.P .deps/read.P .deps/root.P \ +.deps/scmsigs.P .deps/sequences.P .deps/simpos.P .deps/smob.P \ +.deps/socket.P .deps/srcprop.P .deps/stackchk.P .deps/stacks.P \ +.deps/stime.P .deps/strerror.P .deps/strings.P .deps/strop.P \ +.deps/strorder.P .deps/strports.P .deps/struct.P .deps/symbols.P \ +.deps/tag.P .deps/throw.P .deps/unif.P .deps/variable.P .deps/vectors.P \ +.deps/version.P .deps/vports.P .deps/weaks.P +SOURCES = $(libguile_la_SOURCES) $(EXTRA_libguile_la_SOURCES) $(gh_test_c_SOURCES) $(gh_test_repl_SOURCES) +OBJECTS = $(libguile_la_OBJECTS) $(gh_test_c_OBJECTS) $(gh_test_repl_OBJECTS) default: all @@ -271,7 +295,24 @@ distclean-libtool: maintainer-clean-libtool: libguile.la: $(libguile_la_OBJECTS) $(libguile_la_DEPENDENCIES) - $(LINK) -rpath lib $(libguile_la_LDFLAGS) $(libguile_la_OBJECTS) $(libguile_la_LIBADD) $(LIBS) + $(LINK) -rpath $(libdir) $(libguile_la_LDFLAGS) $(libguile_la_OBJECTS) $(libguile_la_LIBADD) $(LIBS) + +mostlyclean-checkPROGRAMS: + +clean-checkPROGRAMS: + test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) + +distclean-checkPROGRAMS: + +maintainer-clean-checkPROGRAMS: + +gh_test_c: $(gh_test_c_OBJECTS) $(gh_test_c_DEPENDENCIES) + @rm -f gh_test_c + $(LINK) $(gh_test_c_LDFLAGS) $(gh_test_c_OBJECTS) $(gh_test_c_LDADD) $(LIBS) + +gh_test_repl: $(gh_test_repl_OBJECTS) $(gh_test_repl_DEPENDENCIES) + @rm -f gh_test_repl + $(LINK) $(gh_test_repl_LDFLAGS) $(gh_test_repl_OBJECTS) $(gh_test_repl_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @@ -339,6 +380,20 @@ uninstall-modincludeHEADERS: rm -f $(modincludedir)/$$p; \ done +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(pkgincludedir) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(pkgincludedir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(pkgincludedir)/$$p; \ + done + +uninstall-pkgincludeHEADERS: + $(NORMAL_UNINSTALL) + list='$(pkginclude_HEADERS)'; for p in $$list; do \ + rm -f $(pkgincludedir)/$$p; \ + done + tags: TAGS ID: $(HEADERS) $(SOURCES) @@ -429,19 +484,19 @@ maintainer-clean-depend: $(MKDEP) $< | sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," > $@ info: dvi: -check: all +check: all $(check_PROGRAMS) $(MAKE) installcheck: install-exec: install-libLTLIBRARIES install-binSCRIPTS @$(NORMAL_INSTALL) -install-data: install-modincludeDATA install-includeHEADERS install-modincludeHEADERS +install-data: install-modincludeDATA install-includeHEADERS install-modincludeHEADERS install-pkgincludeHEADERS @$(NORMAL_INSTALL) install: install-exec install-data all @: -uninstall: uninstall-libLTLIBRARIES uninstall-binSCRIPTS uninstall-modincludeDATA uninstall-includeHEADERS uninstall-modincludeHEADERS +uninstall: uninstall-libLTLIBRARIES uninstall-binSCRIPTS uninstall-modincludeDATA uninstall-includeHEADERS uninstall-modincludeHEADERS uninstall-pkgincludeHEADERS all: $(LTLIBRARIES) $(SCRIPTS) $(DATA) $(HEADERS) Makefile scmconfig.h @@ -449,7 +504,7 @@ install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install installdirs: $(mkinstalldirs) $(libdir) $(bindir) $(modincludedir) $(includedir) \ - $(modincludedir) + $(modincludedir) $(pkgincludedir) mostlyclean-generic: @@ -468,21 +523,24 @@ maintainer-clean-generic: test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean: mostlyclean-hdr mostlyclean-libLTLIBRARIES \ mostlyclean-compile mostlyclean-libtool \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic + mostlyclean-checkPROGRAMS mostlyclean-tags \ + mostlyclean-depend mostlyclean-generic clean: clean-hdr clean-libLTLIBRARIES clean-compile clean-libtool \ - clean-tags clean-depend clean-generic mostlyclean + clean-checkPROGRAMS clean-tags clean-depend \ + clean-generic mostlyclean distclean: distclean-hdr distclean-libLTLIBRARIES distclean-compile \ - distclean-libtool distclean-tags distclean-depend \ - distclean-generic clean + distclean-libtool distclean-checkPROGRAMS \ + distclean-tags distclean-depend distclean-generic clean rm -f config.status rm -f libtool maintainer-clean: maintainer-clean-hdr maintainer-clean-libLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean + maintainer-clean-checkPROGRAMS maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f config.status @@ -494,9 +552,12 @@ maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \ install-libLTLIBRARIES mostlyclean-compile distclean-compile \ clean-compile maintainer-clean-compile mostlyclean-libtool \ distclean-libtool clean-libtool maintainer-clean-libtool \ -uninstall-binSCRIPTS install-binSCRIPTS uninstall-modincludeDATA \ -install-modincludeDATA uninstall-includeHEADERS install-includeHEADERS \ -uninstall-modincludeHEADERS install-modincludeHEADERS tags \ +mostlyclean-checkPROGRAMS distclean-checkPROGRAMS clean-checkPROGRAMS \ +maintainer-clean-checkPROGRAMS uninstall-binSCRIPTS install-binSCRIPTS \ +uninstall-modincludeDATA install-modincludeDATA \ +uninstall-includeHEADERS install-includeHEADERS \ +uninstall-modincludeHEADERS install-modincludeHEADERS \ +uninstall-pkgincludeHEADERS install-pkgincludeHEADERS tags \ mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ distdir mostlyclean-depend distclean-depend clean-depend \ maintainer-clean-depend info dvi installcheck install-exec install-data \ diff --git a/libguile/configure b/libguile/configure index 8eb66dabc..e644c7d67 100755 --- a/libguile/configure +++ b/libguile/configure @@ -1410,14 +1410,17 @@ fi echo "$ac_t""$cy_cv_threads_package" 1>&6 +CFLAGS="$CFLAGS $cy_cv_threads_cflags" +THREAD_LIBS="$cy_cv_threads_libs" + echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1416: checking for working const" >&5 +echo "configure:1419: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1421 "configure" +#line 1424 "configure" #include "confdefs.h" int main() { @@ -1466,7 +1469,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1488,12 +1491,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1492: checking for ANSI C header files" >&5 +echo "configure:1495: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1497 "configure" +#line 1500 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1501,7 +1504,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1518,7 +1521,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1522 "configure" +#line 1525 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1536,7 +1539,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1540 "configure" +#line 1543 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1557,7 +1560,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1561 "configure" +#line 1564 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1568,7 +1571,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1596,12 +1599,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1600: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1603: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1605 "configure" +#line 1608 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -1609,7 +1612,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1634,7 +1637,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1638: checking for opendir in -ldir" >&5 +echo "configure:1641: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1642,7 +1645,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 1646 "configure" +#line 1649 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1653,7 +1656,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1675,7 +1678,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1679: checking for opendir in -lx" >&5 +echo "configure:1682: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1683,7 +1686,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 1687 "configure" +#line 1690 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1694,7 +1697,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1717,12 +1720,12 @@ fi fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1721: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1724: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1726 "configure" +#line 1729 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -1731,7 +1734,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1752,12 +1755,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1756: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1759: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1761 "configure" +#line 1764 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -1773,7 +1776,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1780: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1797,17 +1800,17 @@ for ac_hdr in libc.h limits.h malloc.h memory.h string.h sys/ioctl.h sys/select. do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1801: checking for $ac_hdr" >&5 +echo "configure:1804: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1806 "configure" +#line 1809 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1838,17 +1841,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1842: checking for $ac_hdr" >&5 +echo "configure:1845: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1847 "configure" +#line 1850 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1875,7 +1878,7 @@ fi done echo $ac_n "checking "whether libc.h and unistd.h can be included together"""... $ac_c" 1>&6 -echo "configure:1879: checking "whether libc.h and unistd.h can be included together"" >&5 +echo "configure:1882: checking "whether libc.h and unistd.h can be included together"" >&5 if eval "test \"`echo '$''{'guile_cv_header_libc_with_unistd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1886,7 +1889,7 @@ else guile_cv_header_libc_with_unistd="yes" else cat > conftest.$ac_ext <<EOF -#line 1890 "configure" +#line 1893 "configure" #include "confdefs.h" # include <libc.h> @@ -1896,7 +1899,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* guile_cv_header_libc_with_unistd=yes else @@ -1923,12 +1926,12 @@ EOF echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1927: checking for uid_t in sys/types.h" >&5 +echo "configure:1930: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1932 "configure" +#line 1935 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -1957,7 +1960,7 @@ EOF fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:1961: checking type of array argument to getgroups" >&5 +echo "configure:1964: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1965,7 +1968,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <<EOF -#line 1969 "configure" +#line 1972 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ @@ -1990,7 +1993,7 @@ main() } EOF -if { (eval echo configure:1994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -2004,7 +2007,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext <<EOF -#line 2008 "configure" +#line 2011 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -2028,12 +2031,12 @@ EOF echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2032: checking return type of signal handlers" >&5 +echo "configure:2035: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2037 "configure" +#line 2040 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -2050,7 +2053,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2069,12 +2072,12 @@ EOF echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:2073: checking for mode_t" >&5 +echo "configure:2076: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2078 "configure" +#line 2081 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2105,12 +2108,12 @@ fi for ac_func in ctermid ftime getcwd geteuid gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2109: checking for $ac_func" >&5 +echo "configure:2112: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2114 "configure" +#line 2117 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2133,7 +2136,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2161,12 +2164,12 @@ done for ac_func in inet_aton putenv strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2165: checking for $ac_func" >&5 +echo "configure:2168: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2170 "configure" +#line 2173 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2189,7 +2192,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2219,19 +2222,19 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2223: checking for working alloca.h" >&5 +echo "configure:2226: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2228 "configure" +#line 2231 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2252,12 +2255,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2256: checking for alloca" >&5 +echo "configure:2259: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2261 "configure" +#line 2264 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -2280,7 +2283,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:2284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2312,12 +2315,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2316: checking whether alloca needs Cray hooks" >&5 +echo "configure:2319: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2321 "configure" +#line 2324 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2342,12 +2345,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2346: checking for $ac_func" >&5 +echo "configure:2349: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2351 "configure" +#line 2354 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2370,7 +2373,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2397,7 +2400,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2401: checking stack direction for C alloca" >&5 +echo "configure:2404: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2405,7 +2408,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2409 "configure" +#line 2412 "configure" #include "confdefs.h" find_stack_direction () { @@ -2424,7 +2427,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2447,12 +2450,12 @@ fi echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:2451: checking for st_rdev in struct stat" >&5 +echo "configure:2454: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2456 "configure" +#line 2459 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2460,7 +2463,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:2464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -2481,12 +2484,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:2485: checking for st_blksize in struct stat" >&5 +echo "configure:2488: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2490 "configure" +#line 2493 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2494,7 +2497,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:2498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -2515,12 +2518,12 @@ EOF fi echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:2519: checking for st_blocks in struct stat" >&5 +echo "configure:2522: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2524 "configure" +#line 2527 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2528,7 +2531,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:2532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -2551,12 +2554,12 @@ else fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2555: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2558: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2560 "configure" +#line 2563 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -2564,7 +2567,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2585,12 +2588,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2589: checking for tm_zone in struct tm" >&5 +echo "configure:2592: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2594 "configure" +#line 2597 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -2598,7 +2601,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2605: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2618,12 +2621,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2622: checking for tzname" >&5 +echo "configure:2625: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2627 "configure" +#line 2630 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -2633,7 +2636,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2656,12 +2659,12 @@ fi echo $ac_n "checking whether we need POSIX to get struct utimbuf""... $ac_c" 1>&6 -echo "configure:2660: checking whether we need POSIX to get struct utimbuf" >&5 +echo "configure:2663: checking whether we need POSIX to get struct utimbuf" >&5 if eval "test \"`echo '$''{'guile_cv_struct_utimbuf_needs_posix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2665 "configure" +#line 2668 "configure" #include "confdefs.h" #ifdef __EMX__ @@ -2673,7 +2676,7 @@ struct utime blah; EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2704,7 +2707,7 @@ xtra_PLUGIN_guile_libs="" if test "$enable_dynamic_linking" = "yes"; then echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2708: checking for dlopen in -ldl" >&5 +echo "configure:2711: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2712,7 +2715,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2716 "configure" +#line 2719 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2723,7 +2726,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:2727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2758,7 +2761,7 @@ EOF else echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -echo "configure:2762: checking for dld_link in -ldld" >&5 +echo "configure:2765: checking for dld_link in -ldld" >&5 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2766,7 +2769,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <<EOF -#line 2770 "configure" +#line 2773 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2777,7 +2780,7 @@ int main() { dld_link() ; return 0; } EOF -if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2811,15 +2814,144 @@ if test "$ac_cv_lib_dld_dld_link" = "yes"; then EOF else +echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 +echo "configure:2819: checking for main in -lm" >&5 +ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lm $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2827 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lm $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 +echo "configure:2862: checking for main in -lsocket" >&5 +ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2870 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lsocket $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 +echo "configure:2905: checking for main in -lnsl" >&5 +ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2913 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lnsl $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + for ac_func in shl_load do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2818: checking for $ac_func" >&5 +echo "configure:2950: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2823 "configure" +#line 2955 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2842,7 +2974,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2887,13 +3019,13 @@ if test "$cross_compiling" = yes; then echo "configure: warning: Guessing that stack grows down -- see scmconfig.h.in" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 2891 "configure" +#line 3023 "configure" #include "confdefs.h" aux (l) unsigned long l; { int x; exit (l >= ((unsigned long)&x)); } main () { int q; aux((unsigned long)&q); } EOF -if { (eval echo configure:2897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define SCM_STACK_GROWS_UP 1 @@ -2916,11 +3048,11 @@ EOF echo "configure: warning: Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 2920 "configure" +#line 3052 "configure" #include "confdefs.h" main () { exit (sizeof(float) != sizeof(long)); } EOF -if { (eval echo configure:2924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define SCM_SINGLES 1 @@ -2935,12 +3067,12 @@ fi echo $ac_n "checking for struct linger""... $ac_c" 1>&6 -echo "configure:2939: checking for struct linger" >&5 +echo "configure:3071: checking for struct linger" >&5 if eval "test \"`echo '$''{'scm_cv_struct_linger'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2944 "configure" +#line 3076 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2949,7 +3081,7 @@ int main() { struct linger lgr; lgr.l_linger = 100 ; return 0; } EOF -if { (eval echo configure:2953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_struct_linger="yes" else @@ -2976,19 +3108,19 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking how to set a stream file descriptor""... $ac_c" 1>&6 -echo "configure:2980: checking how to set a stream file descriptor" >&5 +echo "configure:3112: checking how to set a stream file descriptor" >&5 if eval "test \"`echo '$''{'scm_cv_fd_setter'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2985 "configure" +#line 3117 "configure" #include "confdefs.h" #include <stdio.h> int main() { stdout->_file = 1 ; return 0; } EOF -if { (eval echo configure:2992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_fd_setter="_file" else @@ -2996,14 +3128,14 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 3000 "configure" +#line 3132 "configure" #include "confdefs.h" #include <stdio.h> int main() { stdout->_fileno = 1 ; return 0; } EOF -if { (eval echo configure:3007: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_fd_setter="_fileno" else @@ -3041,19 +3173,19 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking how to get buffer char count from FILE structure""... $ac_c" 1>&6 -echo "configure:3045: checking how to get buffer char count from FILE structure" >&5 +echo "configure:3177: checking how to get buffer char count from FILE structure" >&5 if eval "test \"`echo '$''{'scm_cv_struct_file_count'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3050 "configure" +#line 3182 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_cnt = 0 ; return 0; } EOF -if { (eval echo configure:3057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_struct_file_count="_cnt" else @@ -3061,14 +3193,14 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 3065 "configure" +#line 3197 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_r = 0 ; return 0; } EOF -if { (eval echo configure:3072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_struct_file_count="_r" else @@ -3076,14 +3208,14 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 3080 "configure" +#line 3212 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->readCount = 0 ; return 0; } EOF -if { (eval echo configure:3087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_struct_file_count="readCount" else @@ -3110,14 +3242,14 @@ if eval "test \"`echo '$''{'scm_cv_struct_file_gptr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3114 "configure" +#line 3246 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_gptr = f->egptr; ; return 0; } EOF -if { (eval echo configure:3121: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_struct_file_gptr=1 else @@ -3140,14 +3272,14 @@ if eval "test \"`echo '$''{'scm_cv_struct_file_readptr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3144 "configure" +#line 3276 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end; ; return 0; } EOF -if { (eval echo configure:3151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* scm_cv_struct_file_readptr=1 else @@ -3220,7 +3352,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3224: checking for $ac_word" >&5 +echo "configure:3356: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3422,6 +3554,7 @@ s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@RANLIB@%$RANLIB%g s%@LIBTOOL@%$LIBTOOL%g +s%@THREAD_LIBS@%$THREAD_LIBS%g s%@LIBOBJS@%$LIBOBJS%g s%@ALLOCA@%$ALLOCA%g s%@xtra_PLUGIN_guile_libs@%$xtra_PLUGIN_guile_libs%g diff --git a/libguile/configure.in b/libguile/configure.in index aaf642663..1e84d5ae7 100644 --- a/libguile/configure.in +++ b/libguile/configure.in @@ -37,6 +37,9 @@ AC_ISC_POSIX AC_MINIX CY_AC_WITH_THREADS +CFLAGS="$CFLAGS $cy_cv_threads_cflags" +THREAD_LIBS="$cy_cv_threads_libs" +AC_SUBST(THREAD_LIBS) AC_C_CONST @@ -80,6 +83,9 @@ if test "$ac_cv_lib_dld_dld_link" = "yes"; then xtra_PLUGIN_guile_libs="-lguile -ldld" AC_DEFINE(DYNAMIC_LINKING) else +AC_CHECK_LIB(m, main) +AC_CHECK_LIB(socket, main) +AC_CHECK_LIB(nsl, main) AC_CHECK_FUNCS(shl_load) if test "$ac_cv_func_shl_load" = "yes"; then AC_DEFINE(DYNAMIC_LINKING) diff --git a/libguile/gh.h b/libguile/gh.h new file mode 100644 index 000000000..890b48883 --- /dev/null +++ b/libguile/gh.h @@ -0,0 +1,195 @@ +/* Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +#ifndef __GH_H +#define __GH_H + +#include <stdio.h> + +#include <libguile.h> + +/* gcc has extern inline functions that are basically as fast as macros */ +#ifdef __GNUC__ +# define INL inline +# define EXTINL extern inline +#else +# define INL +#define EXTINL +#endif /* __GNUC__ */ + +void gh_enter(int argc, char *argv[], void (*c_main_prog)()); +void gh_repl(); +SCM gh_catch(SCM tag, scm_catch_body_t body, void *body_data, + scm_catch_handler_t handler, void *handler_data); + +/* SCM gh_catch_with_saved_stack (SCM tag, scm_catch_body_t body, */ +/* void *body_data, scm_catch_handler_t handler, */ +/* void *handler_data); */ +SCM gh_standard_handler(void *data, SCM tag, SCM throw_args); +#if 0 +SCM gh_repl_handler(void *data, SCM tag, SCM throw_args); +void gh_enter_repl(int argc, char *argv[], void (*init_proc)()); +#endif /* 0 */ + +SCM gh_eval_str(char *scheme_code); +SCM gh_eval_str_with_catch(char *scheme_code, scm_catch_handler_t handler); +SCM gh_eval_str_with_standard_handler(char *scheme_code); +SCM gh_eval_str_with_stack_saving_handler(char *scheme_code); + +SCM gh_eval_file(char *fname); +SCM gh_eval_file_with_catch(char *scheme_code, scm_catch_handler_t handler); +SCM gh_eval_file_with_standard_handler(char *scheme_code); + +#define gh_defer_ints() SCM_DEFER_INTS +#define gh_allow_ints() SCM_ALLOW_INTS + +SCM gh_new_procedure(char *proc_name, SCM (*fn)(), + int n_required_args, int n_optional_args, int varp); +SCM gh_new_procedure0_0(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure0_1(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure0_2(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure1_0(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure1_1(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure1_2(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure2_0(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure2_1(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure2_2(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure3_0(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure4_0(char *proc_name, SCM (*fn)()); +SCM gh_new_procedure5_0(char *proc_name, SCM (*fn)()); + +/* C to Scheme conversion */ +SCM gh_bool2scm(int x); +SCM gh_int2scm(int x); +SCM gh_ulong2scm(unsigned long x); +SCM gh_long2scm(long x); +SCM gh_double2scm(double x); +SCM gh_char2scm(char c); +SCM gh_str2scm(char *s, int len); +SCM gh_str02scm(char *s); +void gh_set_substr(char *src, SCM dst, int start, int len); +SCM gh_symbol2scm(char *symbol_str); + + +/* Scheme to C conversion */ +int gh_scm2bool(SCM obj); +int gh_scm2int(SCM obj); +unsigned long gh_scm2ulong(SCM obj); +long gh_scm2long(SCM obj); +char gh_scm2char(SCM obj); +double gh_scm2double(SCM obj); +char *gh_scm2newstr(SCM str, int *lenp); +void gh_get_substr(SCM src, char *dst, int start, int len); +char *gh_symbol2newstr(SCM sym, int *lenp); + +/* type predicates: tell you if an SCM object has a given type */ +int gh_boolean_p(SCM val); +int gh_symbol_p(SCM val); +int gh_char_p(SCM val); +int gh_vector_p(SCM val); +int gh_pair_p(SCM val); +int gh_number_p(SCM val); +int gh_string_p(SCM val); +int gh_procedure_p(SCM val); +int gh_list_p(SCM val); +int gh_inexact_p(SCM val); +int gh_exact_p(SCM val); + +/* more predicates */ +int gh_eq_p(SCM x, SCM y); +int gh_eqv_p(SCM x, SCM y); +int gh_equal_p(SCM x, SCM y); + +/* standard Scheme procedures available from C */ + +SCM gh_define(char *name, SCM val); + +SCM gh_vector(SCM length, SCM val); +SCM gh_vset(SCM vec, SCM pos, SCM val); +SCM gh_vref(SCM vec, SCM pos); +unsigned long gh_vector_length(SCM v); + +SCM gh_cons(SCM x, SCM y); +#define gh_list scm_listify +unsigned long gh_list_length(SCM l); + +SCM gh_car(SCM x); +SCM gh_cdr(SCM x); + +SCM gh_caar(SCM x); +SCM gh_cadr(SCM x); +SCM gh_cdar(SCM x); +SCM gh_cddr(SCM x); + +SCM gh_caaar(SCM x); +SCM gh_caadr(SCM x); +SCM gh_cadar(SCM x); +SCM gh_caddr(SCM x); +SCM gh_cdaar(SCM x); +SCM gh_cdadr(SCM x); +SCM gh_cddar(SCM x); +SCM gh_cdddr(SCM x); + +/* Calling Scheme functions from C. */ +SCM gh_apply (SCM proc, SCM ls); +SCM gh_call0 (SCM proc); +SCM gh_call1 (SCM proc, SCM arg); +SCM gh_call2 (SCM proc, SCM arg1, SCM arg2); +SCM gh_call3 (SCM proc, SCM arg1, SCM arg2, SCM arg3); + +/* reading and writing Scheme objects. */ +void gh_display (SCM x); +void gh_newline (void); + +/* void gh_gc_mark(SCM) : mark an SCM as in use. */ +/* void gh_defer_ints() : don't interrupt code section. */ +/* void gh_allow_ints() : see gh_defer_ints(). */ +/* void gh_new_cell(SCM, int tag) : initialize SCM to be of type 'tag' */ +/* int gh_type_p(SCM, tag) : test if SCM is of type 'tag' */ +/* SCM gh_intern(char*) : get symbol corresponding to c-string.*/ +/* void gh_set_ext_data(SCM, void*) : set extension data on SCM */ +/* void *gh_get_ext_data(SCM) : return extension data from SCM. */ + +/* void gh_assert(int cond, char *msg, SCM obj); */ + + +#endif /* __GH_H */ diff --git a/libguile/gh_data.c b/libguile/gh_data.c new file mode 100644 index 000000000..5992365c8 --- /dev/null +++ b/libguile/gh_data.c @@ -0,0 +1,286 @@ +/* Copyright (C) 1995,1996,1987 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +/* data initialization and C<->Scheme data conversion */ + +#include <stdio.h> + +#include <gh.h> + +/* data conversion C->scheme */ +SCM +gh_int2scmb (int x) +{ + return (x ? SCM_BOOL_T : SCM_BOOL_F); +} +SCM +gh_int2scm (int x) +{ + return scm_long2num ((long) x); +} +SCM +gh_ulong2scm (unsigned long x) +{ + return scm_ulong2num (x); +} +SCM +gh_long2scm (long x) +{ + return scm_long2num (x); +} +SCM +gh_double2scm (double x) +{ + return scm_makdbl (x, 0.0); +} +SCM +gh_char2scm (char c) +{ + return SCM_MAKICHR (c); +} +SCM +gh_str2scm (char *s, int len) +{ + return scm_makfromstr (s, len, 0); +} +SCM +gh_str02scm (char *s) +{ + return scm_makfrom0str (s); +} +/* Copy LEN characters at SRC into the *existing* Scheme string DST, + starting at START. START is an index into DST; zero means the + beginning of the string. + + If START + LEN is off the end of DST, signal an out-of-range + error. */ +void +gh_set_substr (char *src, SCM dst, int start, int len) +{ + char *dst_ptr, dst_len, effective_length; + + SCM_ASSERT (SCM_NIMP (dst) && SCM_STRINGP (dst), dst, SCM_ARG3, + "gh_set_substr"); + scm_protect_object (dst); + dst_ptr = SCM_CHARS (dst); + dst_len = SCM_LENGTH (dst); + effective_length = (len < dst_len) ? len : dst_len; + memcpy (dst_ptr + start, src, effective_length); + /* FIXME: must signal an error if len > dst_len */ + scm_unprotect_object (dst); +} + +/* Return the symbol named SYMBOL_STR. */ +SCM +gh_symbol2scm (char *symbol_str) +{ + return SCM_CAR (scm_intern (symbol_str, strlen (symbol_str))); +} + + +/* data conversion scheme->C */ +int +gh_scm2bool (SCM obj) +{ + return ((obj) == SCM_BOOL_F) ? 0 : 1; +} +unsigned long +gh_scm2ulong (SCM obj) +{ + return scm_num2ulong (obj, (char *) SCM_ARG1, "gh_scm2ulong"); +} +long +gh_scm2long (SCM obj) +{ + return scm_num2long (obj, (char *) SCM_ARG1, "gh_scm2long"); +} +int +gh_scm2int (SCM obj) +{ + /* NOTE: possible loss of precision here */ + return (int) scm_num2long (obj, (char *) SCM_ARG1, "gh_scm2int"); +} +double +gh_scm2double (SCM obj) +{ + return scm_num2dbl (obj, "gh_scm2double"); +} +char +gh_scm2char (SCM obj) +{ + return SCM_ICHR (obj); +} + +/* string conversions between C and Scheme */ + +/* gh_scm2newstr() -- Given a Scheme string STR, return a pointer to a + new copy of its contents, followed by a null byte. If lenp is + non-null, set *lenp to the string's length. + + This function uses malloc to obtain storage for the copy; the + caller is responsible for freeing it. + + Note that Scheme strings may contain arbitrary data, including null + characters. This means that null termination is not a reliable way + to determine the length of the returned value. However, the + function always copies the complete contents of STR, and sets + *LEN_P to the true length of the string (when LEN_P is non-null). */ +char * +gh_scm2newstr (SCM str, int *lenp) +{ + char *ret_str; + int len; + + SCM_ASSERT (SCM_NIMP (str) && SCM_STRINGP (str), str, SCM_ARG3, + "gh_scm2newstr"); + + /* protect str from GC while we copy off its data */ + scm_protect_object (str); + + len = SCM_LENGTH (str); + + ret_str = (char *) malloc ((len + 1) * sizeof (char)); + /* so we copy tmp_str to ret_str, which is what we will allocate */ + memcpy (ret_str, SCM_CHARS (str), len); + /* now make sure we null-terminate it */ + ret_str[len] = '\0'; + + scm_unprotect_object (str); + + if (lenp != NULL) + { + *lenp = len; + } + + return ret_str; +} + + +/* Copy LEN characters at START from the Scheme string SRC to memory + at DST. START is an index into SRC; zero means the beginning of + the string. DST has already been allocated by the caller. + + If START + LEN is off the end of SRC, silently truncate the source + region to fit the string. If truncation occurs, the corresponding + area of DST is left unchanged. */ +void +gh_get_substr (SCM src, char *dst, int start, int len) +{ + int src_len, effective_length; + SCM_ASSERT (SCM_NIMP (src) && SCM_STRINGP (src), src, SCM_ARG3, + "gh_get_substr"); + + scm_protect_object (src); + src_len = SCM_LENGTH (src); + effective_length = (len < src_len) ? len : src_len; + memcpy (dst + start, SCM_CHARS (src), effective_length * sizeof (char)); + /* FIXME: must signal an error if len > src_len */ + scm_unprotect_object (src); +} + + +/* gh_scm2newsymbol() -- Given a Scheme symbol 'identifier, return a + pointer to a string with the symbol characters "identifier", + followed by a null byte. If lenp is non-null, set *lenp to the + string's length. + + This function uses malloc to obtain storage for the copy; the + caller is responsible for freeing it. */ +char * +gh_symbol2newstr (SCM sym, int *lenp) +{ + char *ret_str; + int len; + + SCM_ASSERT (SCM_NIMP (sym) && SCM_SYMBOLP (sym), sym, SCM_ARG3, + "gh_scm2newsymbol"); + + /* protect str from GC while we copy off its data */ + scm_protect_object (sym); + + len = SCM_LENGTH (sym); + + ret_str = (char *) malloc ((len + 1) * sizeof (char)); + /* so we copy tmp_str to ret_str, which is what we will allocate */ + memcpy (ret_str, SCM_CHARS (sym), len); + /* now make sure we null-terminate it */ + ret_str[len] = '\0'; + + scm_unprotect_object (sym); + + if (lenp != NULL) + { + *lenp = len; + } + + return ret_str; +} + + +/* create a new vector of the given length, all initialized to the + given value */ +SCM +gh_vector (SCM length, SCM val) +{ + return scm_make_vector (length, val, SCM_UNDEFINED); +} + +/* set the given element of the given vector to the given value */ +SCM +gh_vset (SCM vec, SCM pos, SCM val) +{ + return scm_vector_set_x (vec, pos, val); +} + +/* retrieve the given element of the given vector */ +SCM +gh_vref (SCM vec, SCM pos) +{ + return scm_vector_ref (vec, pos); +} + +/* returns the length of the given vector */ +unsigned long +gh_vector_length (SCM v) +{ + return gh_scm2ulong (scm_vector_length (v)); +} diff --git a/libguile/gh_eval.c b/libguile/gh_eval.c new file mode 100644 index 000000000..bad70ed13 --- /dev/null +++ b/libguile/gh_eval.c @@ -0,0 +1,180 @@ +/* Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +/* routines to evaluate Scheme code */ + +#include <stdio.h> + +#include <gh.h> + +typedef SCM (*gh_eval_t) (void *data, SCM jmpbuf); + +struct cwss_data + { + SCM tag; + scm_catch_body_t body; + void *data; + }; + +/* Evaluate the string; toss the value. */ +#if 0 +void +gh_eval_str (char *scheme_code) +{ + /* Create a port that reads characters from SCHEME_CODE. */ + SCM port = scm_mkstrport (SCM_MAKINUM (0), + scm_makfrom0str (scheme_code), + SCM_OPN | SCM_RDNG, + "guile_main"); + SCM form; + + /* Read expressions from that port; ignore the values. */ + while ((form = scm_read (port, SCM_BOOL_F, SCM_BOOL_F)) != SCM_EOF_VAL) + scm_eval_x (form); + + /* Dispose of the port when done. (Oh icky.) */ + scm_close_port (port); +} +#endif /* 0 */ + +SCM +gh_eval_str (char *scheme_code) +{ + return scm_eval_0str (scheme_code); +} + +/* evaluate the file by passing it to the lower level scm_primitive_load() */ +SCM +gh_eval_file (char *fname) +{ + return scm_primitive_load (gh_str02scm (fname)); +} + +static SCM +eval_str_wrapper (void *data, SCM jmpbuf) +{ +/* gh_eval_t real_eval_proc = (gh_eval_t) (* ((gh_eval_t *) data)); */ + + char *scheme_code = (char *) data; + return gh_eval_str (scheme_code); +} + +SCM +gh_eval_str_with_catch (char *scheme_code, scm_catch_handler_t handler) +{ + /* FIXME: not there yet */ + return gh_catch (SCM_BOOL_T, (scm_catch_body_t) eval_str_wrapper, scheme_code, + (scm_catch_handler_t) gh_standard_handler, scheme_code); +} + +SCM +gh_eval_str_with_standard_handler (char *scheme_code) +{ + return gh_eval_str_with_catch (scheme_code, gh_standard_handler); +} + + +SCM +ss_handler (void *data, SCM tag, SCM throw_args) +{ + /* Save the stack */ + SCM_SETCDR (scm_the_last_stack_var, + scm_make_stack (scm_cons (SCM_BOOL_T, SCM_EOL))); + /* Throw the error */ + return scm_throw (tag, throw_args); +} + +static SCM +cwss_body (void *data, SCM jmpbuf) +{ + struct cwss_data *d = data; + return scm_internal_lazy_catch (d->tag, d->body, d->data, ss_handler, NULL); +} +/* FIXME: should catch_with_saved_stack() be in the gh_ API? */ +static SCM +catch_with_saved_stack (SCM tag, + scm_catch_body_t body, + void *body_data, + scm_catch_handler_t handler, + void *handler_data) +{ + struct cwss_data d; + d.tag = tag; + d.body = body; + d.data = body_data; + return scm_internal_catch (tag, cwss_body, &d, handler, handler_data); +} + +SCM +gh_eval_str_with_stack_saving_handler (char *scheme_code) +{ + return catch_with_saved_stack (SCM_BOOL_T, + (scm_catch_body_t) eval_str_wrapper, + scheme_code, + (scm_catch_handler_t) + gh_standard_handler, + scheme_code); +} + +static SCM +eval_file_wrapper (void *data, SCM jmpbuf) +{ +/* gh_eval_t real_eval_proc = (gh_eval_t) (* ((gh_eval_t *) data)); */ + + char *scheme_code = (char *) data; + return gh_eval_file (scheme_code); +} + +SCM +gh_eval_file_with_catch (char *scheme_code, scm_catch_handler_t handler) +{ + /* FIXME: not there yet */ + return gh_catch (SCM_BOOL_T, (scm_catch_body_t) eval_file_wrapper, + scheme_code, (scm_catch_handler_t) gh_standard_handler, + scheme_code); +} + +SCM +gh_eval_file_with_standard_handler (char *scheme_code) +{ + return gh_eval_file_with_catch (scheme_code, gh_standard_handler); +} diff --git a/libguile/gh_funcs.c b/libguile/gh_funcs.c new file mode 100644 index 000000000..048ab209a --- /dev/null +++ b/libguile/gh_funcs.c @@ -0,0 +1,169 @@ +/* Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + + +/* Defining Scheme functions implemented by C functions --- subrs. */ + +#include <stdio.h> + +#include <gh.h> + +/* allows you to define new scheme primitives written in C */ +SCM +gh_new_procedure (char *proc_name, SCM (*fn) (), + int n_required_args, int n_optional_args, int varp) +{ + return scm_make_gsubr (proc_name, n_required_args, n_optional_args, + varp, fn); +} + +SCM +gh_new_procedure0_0 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 0, 0, 0); +} + +SCM +gh_new_procedure0_1 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 0, 1, 0); +} + +SCM +gh_new_procedure0_2 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 0, 2, 0); +} + +SCM +gh_new_procedure1_0 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 1, 0, 0); +} + +SCM +gh_new_procedure1_1 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 1, 1, 0); +} + +SCM +gh_new_procedure1_2 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 1, 2, 0); +} + +SCM +gh_new_procedure2_0 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 2, 0, 0); +} + +SCM +gh_new_procedure2_1 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 2, 1, 0); +} + +SCM +gh_new_procedure2_2 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 2, 2, 0); +} + +SCM +gh_new_procedure3_0 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 3, 0, 0); +} + +SCM +gh_new_procedure4_0 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 4, 0, 0); +} + +SCM +gh_new_procedure5_0 (char *proc_name, SCM (*fn) ()) +{ + return gh_new_procedure (proc_name, fn, 5, 0, 0); +} + +/* some (possibly most) Scheme functions available from C */ +SCM +gh_define (char *name, SCM val) +{ + return scm_sysintern (name, val); +} + + +/* Calling Scheme functions from C. */ + +SCM +gh_apply (SCM proc, SCM args) +{ + return scm_apply (proc, args, SCM_EOL); +} + +SCM +gh_call0 (SCM proc) +{ + return scm_apply (proc, SCM_EOL, SCM_EOL); +} + +SCM +gh_call1 (SCM proc, SCM arg) +{ + return scm_apply (proc, arg, scm_listofnull); +} + +SCM +gh_call2 (SCM proc, SCM arg1, SCM arg2) +{ + return scm_apply (proc, arg1, scm_cons (arg2, scm_listofnull)); +} + +SCM +gh_call3 (SCM proc, SCM arg1, SCM arg2, SCM arg3) +{ + return scm_apply (proc, arg1, scm_cons2 (arg2, arg3, scm_listofnull)); +} diff --git a/libguile/gh_init.c b/libguile/gh_init.c new file mode 100644 index 000000000..50517d441 --- /dev/null +++ b/libguile/gh_init.c @@ -0,0 +1,107 @@ +/* Copyright (C) 1995,1996 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +/* Guile high level (gh_) interface, initialization-related stuff */ + +#include <stdio.h> + +#include <gh.h> + +typedef void (*main_prog_t) (int argc, char **argv); +typedef void (*repl_prog_t) (int argc, char **argv); + +/* This function takes care of all real GH initialization. Since it's + called by scm_boot_guile, it can safely work with heap objects, or + call functions that do so. */ +static void +gh_launch_pad (void *closure, int argc, char **argv) +{ + main_prog_t c_main_prog = (main_prog_t) closure; + + gh_eval_str ("(primitive-load-path \"ice-9/boot-9.scm\")"); + c_main_prog (argc, argv); + exit (0); +} + + +/* starts up the Scheme interpreter, and stays in it. c_main_prog() + is the address of the user's main program, since gh_enter() never + returns. */ +void +gh_enter (int argc, char *argv[], main_prog_t c_main_prog) +{ + scm_boot_guile (argc, argv, gh_launch_pad, c_main_prog); + /* never returns */ +} + +/* offer a REPL to the C programmer; for now I just invoke the ice-9 + REPL that is written in Scheme */ +void +gh_repl () +{ +/* gh_eval_str("(primitive-load-path \"ice-9/boot-9.scm\")"); */ + gh_eval_str ("(top-repl)"); +} + +/* libguile programmers need exception handling mechanisms; here is + the recommended way of doing it with the gh_ interface */ + +/* gh_catch() -- set up an exception handler for a particular type of + error (or any thrown error if tag is SCM_BOOL_T); see + ../libguile/throw.c for the comments explaining scm_internal_catch */ +SCM +gh_catch (SCM tag, scm_catch_body_t body, void *body_data, + scm_catch_handler_t handler, void *handler_data) +{ + return scm_internal_catch (tag, body, body_data, handler, handler_data); +} + +SCM +gh_standard_handler (void *data, SCM tag, SCM throw_args) +{ + fprintf (stderr, "\nJust got an error; tag is\n "); + scm_display (tag, scm_current_output_port ()); + scm_newline (scm_current_output_port ()); + scm_newline (scm_current_output_port ()); + + return SCM_BOOL_F; +} diff --git a/libguile/gh_io.c b/libguile/gh_io.c new file mode 100644 index 000000000..7488c189c --- /dev/null +++ b/libguile/gh_io.c @@ -0,0 +1,57 @@ +/* Copyright (C) 1995,1996 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +#include <stdio.h> + +#include <gh.h> + +void +gh_display (SCM x) +{ + scm_display (x, scm_current_output_port ()); +} + +void +gh_newline () +{ + scm_newline (scm_current_output_port ()); +} diff --git a/libguile/gh_list.c b/libguile/gh_list.c new file mode 100644 index 000000000..b54c03d60 --- /dev/null +++ b/libguile/gh_list.c @@ -0,0 +1,142 @@ +/* Copyright (C) 1995,1996 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +/* list manipulation */ + +#include <stdio.h> + +#include <gh.h> + +/* returns the length of a list */ +unsigned long +gh_list_length (SCM l) +{ + return gh_scm2ulong (scm_list_length (l)); +} + +/* list operations */ + +/* analogous to the Scheme cons operator */ +SCM +gh_cons (SCM x, SCM y) +{ + return scm_cons (x, y); +} + +/* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */ + +/* analogous to the Scheme car operator */ +SCM +gh_car (SCM x) +{ + return SCM_CAR (x); +} + +/* analogous to the Scheme cdr operator */ +SCM +gh_cdr (SCM x) +{ + return SCM_CDR (x); +} + +/* now for the multiple car/cdr utility procedures */ +SCM +gh_caar (SCM x) +{ + return SCM_CAAR (x); +} +SCM +gh_cadr (SCM x) +{ + return SCM_CADR (x); +} +SCM +gh_cdar (SCM x) +{ + return SCM_CDAR (x); +} +SCM +gh_cddr (SCM x) +{ + return SCM_CDDR (x); +} + +SCM +gh_caaar (SCM x) +{ + return SCM_CAAAR (x); +} +SCM +gh_caadr (SCM x) +{ + return SCM_CAADR (x); +} +SCM +gh_cadar (SCM x) +{ + return SCM_CADAR (x); +} +SCM +gh_caddr (SCM x) +{ + return SCM_CADDR (x); +} +SCM +gh_cdaar (SCM x) +{ + return SCM_CDAAR (x); +} +SCM +gh_cdadr (SCM x) +{ + return SCM_CDADR (x); +} +SCM +gh_cddar (SCM x) +{ + return SCM_CDDAR (x); +} +SCM +gh_cdddr (SCM x) +{ + return SCM_CDDDR (x); +} diff --git a/libguile/gh_predicates.c b/libguile/gh_predicates.c new file mode 100644 index 000000000..e0183955c --- /dev/null +++ b/libguile/gh_predicates.c @@ -0,0 +1,121 @@ +/* Copyright (C) 1995,1996 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +/* type predicates and equality predicates */ + +#include <stdio.h> + +#include <gh.h> + +/* type predicates: tell you if an SCM object has a given type */ +int +gh_boolean_p (SCM val) +{ + return (scm_boolean_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_symbol_p (SCM val) +{ + return (scm_symbol_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_char_p (SCM val) +{ + return (scm_char_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_vector_p (SCM val) +{ + return (scm_vector_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_pair_p (SCM val) +{ + return (scm_pair_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_number_p (SCM val) +{ + return (scm_number_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_string_p (SCM val) +{ + return (scm_string_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_procedure_p (SCM val) +{ + return (scm_procedure_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_list_p (SCM val) +{ + return (scm_list_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_inexact_p (SCM val) +{ + return (scm_inexact_p (val) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_exact_p (SCM val) +{ + return (scm_exact_p (val) == SCM_BOOL_T) ? 1 : 0; +} + +/* the three types of equality */ +int +gh_eq_p (SCM x, SCM y) +{ + return (scm_eq_p (x, y) == SCM_BOOL_T) ? 1 : 0; +} +int +gh_eqv_p (SCM x, SCM y) +{ + return (scm_eqv_p (x, y) != SCM_BOOL_T) ? 1 : 0; +} +int +gh_equal_p (SCM x, SCM y) +{ + return (scm_equal_p (x, y) != SCM_BOOL_T) ? 1 : 0; +} diff --git a/libguile/gh_test_c.c b/libguile/gh_test_c.c new file mode 100644 index 000000000..526b50e92 --- /dev/null +++ b/libguile/gh_test_c.c @@ -0,0 +1,221 @@ +/* Copyright (C) 1995,1996,1987 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +#include <stdio.h> +#include <math.h> +#include <assert.h> + +#include <gh.h> + +SCM c_factorial (SCM s_n); +SCM c_sin (SCM s_x); +SCM c_vector_test (SCM s_length); + +/* the gh_enter() routine, the standard entryp point for the gh_ + interface, makes you use a separate main function */ +void +main_prog (int argc, char *argv[]) +{ + int done; + char input_str[1000]; + SCM cf; + SCM result_dummy; + + result_dummy = gh_eval_str ("(display \"hello guile\n\")"); + gh_display (result_dummy); + + printf ("\ntesting gh_define\n"); + gh_define ("test_symbol", gh_double2scm (2.5)); + gh_eval_str ("(display test_symbol) (newline)"); + + /* test playing with symbols */ + { + SCM sym; + char *sym_string; + sym = gh_symbol2scm ("a-test-symbol"); + sym_string = gh_symbol2newstr (sym, NULL); + printf ("the symbol was <%s>; after converting to Scheme and back to\n", + "a-test-symbol"); + printf ("a C string it is now <%s>\n", sym_string); + free (sym_string); + } + + /* here result dummy should be a string object */ + result_dummy = gh_eval_str ("\"test_string\""); + assert (gh_string_p (result_dummy)); + { + char *s; + s = gh_scm2newstr (result_dummy, NULL); + printf ("result of converting \"test_string\" from SCM to C is <%s>\n", s); + free (s); /* remember to free s!! */ + } + + gh_eval_str ("(define (square x) (* x x))"); + gh_eval_str ("(define (fact n) (if (= n 1) 1 (* n (fact (- n 1)))))"); + + gh_eval_str ("(display (square 9)) (newline)"); + gh_eval_str ("(display (fact 100)) (newline)"); + + gh_eval_str_with_standard_handler ("(display \"dude!\n\")"); + + /* in this next line I have a wilful typo: dosplay is not a defined + procedure, so it should throw an error */ + gh_eval_str_with_standard_handler ("(dosplay \"dude!\n\")"); + + /* now define some new primitives in C */ + cf = gh_new_procedure1_0 ("c_factorial", c_factorial); + gh_new_procedure1_0 ("c_sin", c_sin); + gh_new_procedure1_0 ("c_vector_test", c_vector_test); + + /* now try some (eval ...) action from C */ + { + SCM l = SCM_EOL; + l = gh_cons (gh_str02scm ("hello world"), l); + l = gh_cons (gh_symbol2scm ("display"), l); + printf ("expression is: "); + gh_display (l); + gh_newline (); + /* Don't have a function for evaluating sexps yet. */ + } + + printf ("testing the predicates for procedure? and vector?\n"); + printf ("gh_procedure_p(c_factorial) is %d, gh_vector_p(c_factorial) is %d\n", + gh_procedure_p (cf), gh_vector_p (cf)); + + /* Test calling procedures. */ + { + SCM list = gh_eval_str ("list"); + + printf ("testing gh_apply\n"); + printf ("gh_apply (list, '(1 2)) => "); + gh_display (gh_apply (list, gh_cons (gh_int2scm (1), + gh_cons (gh_int2scm (2), + SCM_EOL)))); + gh_newline (); + + printf ("gh_call0 (list) => "); + gh_display (gh_call0 (list)); + gh_newline (); + + printf ("gh_call1 (list, 1) => "); + gh_display (gh_call1 (list, gh_int2scm (1))); + gh_newline (); + + printf ("gh_call2 (list, 1, 2) => "); + gh_display (gh_call2 (list, gh_int2scm (1), gh_int2scm (2))); + gh_newline (); + + printf ("gh_call3 (list, 1, 2, 3) => "); + gh_display (gh_call3 (list, + gh_int2scm (1), gh_int2scm (2), gh_int2scm (3))); + gh_newline (); + } + + /* now sit in a scheme eval loop: I input the expressions, have + guile evaluate them, and then get another expression. */ + done = 0; + while (!done) + { + printf ("\n%s> ", argv[0]); + if (gets (input_str) == NULL) + { + done = 1; + } + else + { +/* gh_display(gh_eval_str_with_standard_handler(input_str)); */ + gh_display (gh_eval_str_with_stack_saving_handler (input_str)); + } + } +} + +int +main (int argc, char *argv[]) +{ + gh_enter (argc, argv, main_prog); + return 0; +} + +SCM +c_factorial (SCM s_n) +{ + int i, n; + unsigned long result = 1; + + n = gh_scm2ulong (s_n); + + for (i = 1; i <= n; ++i) + { + result = result * i; + } + return gh_ulong2scm (result); +} + +/* a sin routine in C, callable from scheme. it is named c_sin() to + distinguish it from the default scheme sin function */ +SCM +c_sin (SCM s_x) +{ + double x = gh_scm2double (s_x); + + return gh_double2scm (sin (x)); +} + +/* play around with vectors in guile: this routine creates a vector of + the given length, initializes it all to zero except element 2 which + is set to 1.9. */ +SCM +c_vector_test (SCM s_length) +{ + SCM xvec; + unsigned long c_length; + + c_length = gh_scm2ulong (s_length); + printf ("requested length for vector: %ld\n", c_length); + + /* create a vector filled witth 0.0 entries */ + xvec = gh_vector (c_length, gh_double2scm (0.0)); + /* set the second element in it to some floating point value */ + gh_vset (xvec, 2, gh_double2scm (1.9)); + + return xvec; +} diff --git a/libguile/gh_test_repl.c b/libguile/gh_test_repl.c new file mode 100644 index 000000000..5ef7a44b7 --- /dev/null +++ b/libguile/gh_test_repl.c @@ -0,0 +1,156 @@ +/* Copyright (C) 1995,1996 Free Software Foundation, Inc. + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for GUILE, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + */ + + +/* gh_test_repl -- a program that demonstrates starting Guile, adding + some privmitive procedures and entering a REPL form C */ + +#include <stdio.h> +#include <math.h> + +#include <gh.h> + +SCM c_factorial (SCM s_n); +SCM c_sin (SCM s_x); +SCM c_vector_test (SCM s_length); + +/* the gh_enter() routine, the standard entryp point for the gh_ + interface, makes you use a separate main function */ +void +main_prog (int argc, char *argv[]) +{ + SCM cf; + + gh_eval_str ("(display \"hello guile\n\")"); + + gh_eval_str ("(define (square x) (* x x))"); + gh_eval_str ("(define (fact n) (if (= n 1) 1 (* n (fact (- n 1)))))"); + + gh_eval_str ("(display (square 9)) (newline)"); + gh_eval_str ("(display (fact 100)) (newline)"); + + gh_eval_str ("(define s \"A string\")"); + gh_eval_str ("(define p '(A . pair))"); + gh_eval_str ("(display s)"); + gh_eval_str ("(display p)"); + gh_eval_str ("(display (string? s))"); + gh_eval_str ("(display (pair? s))"); + + /* now define some new primitives in C */ + cf = gh_new_procedure1_0 ("c_factorial", c_factorial); + gh_new_procedure1_0 ("c_sin", c_sin); + gh_new_procedure1_0 ("c_vector_test", c_vector_test); + + /* now try some (eval ...) action from C */ + { + SCM l = SCM_EOL; + l = gh_cons (gh_str02scm ("hello world"), l); + l = gh_cons (gh_symbol2scm ("'display"), l); + gh_display (l); + } + + { + SCM a_string; + a_string = gh_str02scm ("A string"); + + printf ("testing the predicates for pair? and string?\n"); + printf ("gh_pair_p(a_string) is %d, gh_string_p(a_string) is %d\n", + gh_pair_p (a_string), gh_string_p (a_string)); + } + + printf ("testing the predicates for procedure? and vector?\n"); + printf ("gh_procedure_p(c_factorial) is %d, gh_vector_p(c_factorial) is %d\n", + gh_procedure_p (cf), gh_vector_p (cf)); + + gh_repl (); +} + +int +main (int argc, char *argv[]) +{ + gh_enter (argc, argv, main_prog); + return 0; +} + +SCM +c_factorial (SCM s_n) +{ + int i, n; + unsigned long result = 1; + + n = gh_scm2ulong (s_n); + + for (i = 1; i <= n; ++i) + { + result = result * i; + } + return gh_ulong2scm (result); +} + +/* a sin routine in C, callable from scheme. it is named c_sin() to + distinguish it from the default scheme sin function */ +SCM +c_sin (SCM s_x) +{ + double x = gh_scm2double (s_x); + + return gh_double2scm (sin (x)); +} + +/* play around with vectors in guile: this routine creates a vector of + the given length, initializes it all to zero except element 2 which + is set to 1.9. */ +SCM +c_vector_test (SCM s_length) +{ + SCM xvec; + unsigned long c_length; + + c_length = gh_scm2ulong (s_length); + printf ("requested length for vector: %ld\n", c_length); + + /* create a vector filled witth 0.0 entries */ + xvec = gh_vector (c_length, gh_double2scm (0.0)); + /* set the second element in it to some floating point value */ + gh_vset (xvec, 2, gh_double2scm (1.9)); + + return xvec; +} diff --git a/libguile/scmconfig.h.in b/libguile/scmconfig.h.in index 27ee2d6fc..213a9a7d5 100644 --- a/libguile/scmconfig.h.in +++ b/libguile/scmconfig.h.in @@ -313,3 +313,12 @@ /* Define if you have the dld library (-ldld). */ #undef HAVE_LIBDLD + +/* Define if you have the m library (-lm). */ +#undef HAVE_LIBM + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET |