From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: PHP to GUILE Date: Mon, 26 Sep 2005 20:37:25 +0100 Message-ID: <873bnrlix6.fsf@ossau.uklinux.net> References: <6efab235050925145055ba774c@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1127764126 11963 80.91.229.2 (26 Sep 2005 19:48:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Sep 2005 19:48:46 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Sep 26 21:48:37 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EJywf-000419-V8 for guile-user@m.gmane.org; Mon, 26 Sep 2005 21:47:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJywf-0008SK-4p for guile-user@m.gmane.org; Mon, 26 Sep 2005 15:47:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EJyuS-0007TB-CS for guile-user@gnu.org; Mon, 26 Sep 2005 15:45:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EJyuI-0007P9-5i for guile-user@gnu.org; Mon, 26 Sep 2005 15:44:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EJyu2-0006gm-Qc for guile-user@gnu.org; Mon, 26 Sep 2005 15:44:42 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EJynH-0003ev-5x for guile-user@gnu.org; Mon, 26 Sep 2005 15:37:43 -0400 Original-Received: from laruns (host81-139-70-226.in-addr.btopenworld.com [81.139.70.226]) by mail3.uklinux.net (Postfix) with ESMTP id 16E22409FA7; Mon, 26 Sep 2005 19:37:42 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 672AF6F71D; Mon, 26 Sep 2005 20:37:25 +0100 (BST) Original-To: Vorfeed Canal In-Reply-To: <6efab235050925145055ba774c@mail.gmail.com> (Vorfeed Canal's message of "Mon, 26 Sep 2005 01:50:37 +0400") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:4780 Archived-At: Vorfeed Canal writes: > Unfortunatelly while support for XML in scheme (and guile) is > excellent this is not the only thing needed for web-programming. I > found some problems with GUILE core and lack of usefull modules > (perhaps two problems are related?). If you mean just that Guile isn't finished yet, then yes. > Kawa does not support GOOPS-style overloading so may be it's better to > just remake throw and catch as "primitive with generic", declare > "try-finally" and "try-catch" as aliases to "catch", "primitive-throw" > as alias to "throw" and then make default exceptions catchable via > GOOPS exceptions classes ? This way "normal" catch/throw semantics > will not be affected but when GOOPS is loaded you'll get > sane^H^H^H^Hmodern exceptions handling... Yes, I've been thinking about this approach for some time. It's just a matter of time available, and I personally don't have much of that right now. > This is part where I do not know how change to core should look in the > end (one thing is clear: exceptions without hierarchy are not very > usefull), but with search path it's obvious: it should be something > like this: Commenting on the following to make sure I understand ... > diff -uNr guile-1.7.2.orig/guile-config/guile.m4 > guile-1.7.2/guile-config/guile.m4 > --- guile-1.7.2.orig/guile-config/guile.m4 2003-04-05 > 23:01:16.000000000 +0400 > +++ guile-1.7.2/guile-config/guile.m4 2005-09-18 23:15:30.000000000 +0400 > @@ -110,6 +110,24 @@ > AC_SUBST(GUILE_SITE) > ]) > > +# GUILE_SITELIB_DIR -- find path to Guile "site" lirbraries directory > +# > +# Usage: GUILE_SITELIB_DIR > +# > +# This looks for Guile's "site" libraries directory, usually something > +# like PREFIX/lib/guile/site, and sets var @var{GUILE_SITELIB} to the path. > +# Note that the var name is different from the macro name. > +# > +# The variable is marked for substitution, as by @code{AC_SUBST}. > +# > +AC_DEFUN([GUILE_SITELIB_DIR], > + [AC_REQUIRE([GUILE_PROGS])dnl > + AC_MSG_CHECKING(for Guile site libraries directory) > + GUILE_SITE=`[$GUILE_CONFIG] info pkglibdir`/site > + AC_MSG_RESULT($GUILE_SITEDIR) > + AC_SUBST(GUILE_SITEDIR) > + ]) > + Presumably (apart from the GUILE_SITE/GUILE_SITEDIR typo) this is for Guile packages, so they can install .sos to GUILE_SITEDIR. > # GUILE_CHECK -- evaluate Guile Scheme code and capture the return value > # > # Usage: GUILE_CHECK_RETVAL(var,check) > diff -uNr guile-1.7.2.orig/libguile/dynl.c guile-1.7.2/libguile/dynl.c > --- guile-1.7.2.orig/libguile/dynl.c 2005-03-04 01:12:31.000000000 +0300 > +++ guile-1.7.2/libguile/dynl.c 2005-09-18 23:51:56.000000000 +0400 > @@ -52,9 +52,37 @@ > #include "libguile/lang.h" > #include "libguile/validate.h" > #include "libguile/dynwind.h" > +#include "libguile/srfi-13.h" > +#include "libguile/load.h" > +#include "libguile/libpath.h" > > #include > > +/* List of names of directories we search for files to load. */ > +static SCM *scm_loc_load_path; scm_loc_load_libpath would be better. > + > +/* Initialize the global variable %load-libpath, given the value of the > + SCM_SITELIB_DIR and SCM_LIB_DIR preprocessor symbols and the > + GUILE_LOAD_LIBPATH environment variable. */ > +static void > +scm_init_load_libpath () > +{ > + char *env; > + SCM path = SCM_EOL; > + > +#ifdef SCM_LIB_DIR > + path = scm_list_3 (scm_from_locale_string (SCM_SITELIB_DIR), > + scm_from_locale_string (SCM_LIB_DIR), > + scm_from_locale_string (SCM_PKGLIB_DIR)); > +#endif /* SCM_LIB_DIR */ > + > + env = getenv ("GUILE_LOAD_LIBPATH"); > + if (env) > + path = scm_parse_path (scm_from_locale_string (env), path); > + > + *scm_loc_load_path = path; > +} > + > /* > From the libtool manual: "Note that libltdl is not threadsafe, > i.e. a multithreaded application has to use a mutex for libltdl.". > @@ -68,8 +95,16 @@ > static void * > sysdep_dynl_link (const char *fname, const char *subr) > { > - lt_dlhandle handle; > - handle = lt_dlopenext (fname); > + lt_dlhandle handle = NULL; > + SCM scm_search_path = scm_string_join (*scm_loc_load_path, > + scm_from_locale_string (":"), > + SCM_UNDEFINED/*scm_sym_infix*/); > + char * search_path = scm_to_locale_string (scm_search_path); > + scm_frame_free (search_path); > + if (!lt_dlsetsearchpath (search_path)) > + { > + handle = lt_dlopenext (fname); > + } Will this still allow loading from the usual places as well? > if (NULL == handle) > { > SCM fn; > @@ -314,6 +349,8 @@ > scm_tc16_dynamic_obj = scm_make_smob_type ("dynamic-object", 0); > scm_set_smob_mark (scm_tc16_dynamic_obj, dynl_obj_mark); > scm_set_smob_print (scm_tc16_dynamic_obj, dynl_obj_print); > + scm_loc_load_path = SCM_VARIABLE_LOC (scm_c_define > ("%load-libpath", SCM_EOL)); > + scm_init_load_libpath (); > sysdep_dynl_init (); > #include "libguile/dynl.x" > } > diff -uNr guile-1.7.2.orig/libguile/Makefile.am guile-1.7.2/libguile/Makefile.am > --- guile-1.7.2.orig/libguile/Makefile.am 2005-03-08 > 02:03:23.000000000 +0300 > +++ guile-1.7.2/libguile/Makefile.am 2005-09-18 23:23:44.000000000 +0400 > @@ -234,6 +234,9 @@ > @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp > @echo '#define SCM_LIBRARY_DIR > "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp > @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp > + @echo '#define SCM_PKGLIB_DIR "$(pkglibdir)"' >> libpath.tmp > + @echo '#define SCM_LIB_DIR > "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp > + @echo '#define SCM_SITELIB_DIR "$(pkglibdir)/site"' >> libpath.tmp > @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp > @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp > @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp > diff -uNr guile-1.7.2.orig/libguile/Makefile.in guile-1.7.2/libguile/Makefile.in > --- guile-1.7.2.orig/libguile/Makefile.in 2005-03-08 > 03:42:07.000000000 +0300 > +++ guile-1.7.2/libguile/Makefile.in 2005-09-18 23:23:50.000000000 +0400 > @@ -1898,6 +1898,9 @@ > @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp > @echo '#define SCM_LIBRARY_DIR > "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp > @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp > + @echo '#define SCM_PKGLIB_DIR "$(pkglibdir)"' >> libpath.tmp > + @echo '#define SCM_LIB_DIR > "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp > + @echo '#define SCM_SITELIB_DIR "$(pkglibdir)/site"' >> libpath.tmp > @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp > @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp > @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp Conclusion: this looks OK to me, but I'm not an expert on this subject. I recall previous threads on why it is (or is not) desirable for all Guile libraries to go into /usr/local/lib or /usr/lib, but I can't remember what the arguments were. Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user