From: <cli...@li...> - 2007-08-25 19:07:55
|
Send clisp-cvs mailing list submissions to cli...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/clisp-cvs or, via email, send a message with subject or body 'help' to cli...@li... You can reach the person managing the list at cli...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of clisp-cvs digest..." CLISP CVS commits for today Today's Topics: 1. clisp/tests path.tst,1.65,1.66 ChangeLog,1.513,1.514 (Sam Steingold) 2. clisp/doc impbody.xml,1.460,1.461 (Sam Steingold) 3. clisp/src subr.d, 1.222, 1.223 pathname.d, 1.399, 1.400 init.lisp, 1.265, 1.266 constsym.d, 1.331, 1.332 NEWS, 1.376, 1.377 ChangeLog, 1.5543, 1.5544 (Sam Steingold) 4. clisp/modules/bindings/glibc wrap.lisp,1.4,1.5 test.tst,1.1,1.2 (Sam Steingold) 5. clisp/doc impent.xml,1.282,1.283 impbody.xml,1.461,1.462 (Sam Steingold) 6. clisp/modules/syscalls syscalls.xml,1.76,1.77 (Sam Steingold) ---------------------------------------------------------------------- Message: 1 Date: Fri, 24 Aug 2007 20:15:23 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/tests path.tst,1.65,1.66 ChangeLog,1.513,1.514 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/tests In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31088/tests Modified Files: path.tst ChangeLog Log Message: implement RFE #[ 1779938 ]: RENAME-DIRECTORY: (RENAME-DIR): implement Index: path.tst =================================================================== RCS file: /cvsroot/clisp/clisp/tests/path.tst,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- path.tst 28 Nov 2006 05:22:49 -0000 1.65 +++ path.tst 24 Aug 2007 20:15:21 -0000 1.66 @@ -1091,3 +1091,7 @@ ;; http://sourceforge.net/tracker/index.php?func=detail&aid=1555096&group_id=1355&atid=101355 (make-pathname :directory '(:absolute :wild-inferiors "subdir")) #P"/**/subdir/" + +(ext:make-dir "foo/") T +(ext:rename-dir "foo/" "bar/") T +(ext:delete-dir "bar/") T Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/tests/ChangeLog,v retrieving revision 1.513 retrieving revision 1.514 diff -u -d -r1.513 -r1.514 --- ChangeLog 23 Aug 2007 22:11:18 -0000 1.513 +++ ChangeLog 24 Aug 2007 20:15:21 -0000 1.514 @@ -1,3 +1,7 @@ +2007-08-24 Sam Steingold <sd...@gn...> + + * path.tst: test rename-dir + 2007-08-23 Sam Steingold <sd...@gn...> * ffi.tst (ffi_uintp, my-uintp): add one argument def-c-type test ------------------------------ Message: 2 Date: Fri, 24 Aug 2007 20:15:25 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/doc impbody.xml,1.460,1.461 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31088/doc Modified Files: impbody.xml Log Message: implement RFE #[ 1779938 ]: RENAME-DIRECTORY: (RENAME-DIR): implement Index: impbody.xml =================================================================== RCS file: /cvsroot/clisp/clisp/doc/impbody.xml,v retrieving revision 1.460 retrieving revision 1.461 diff -u -d -r1.460 -r1.461 --- impbody.xml 19 Aug 2007 16:20:13 -0000 1.460 +++ impbody.xml 24 Aug 2007 20:15:22 -0000 1.461 @@ -3614,6 +3614,13 @@ <replaceable>directory-pathname</replaceable>)</code> removes an (empty) subdirectory.</para></simplesect> +<simplesect id="rename-dir"> + <title>Function <function>EXT:RENAME-DIR</function></title> +<para><code>(<function>EXT:RENAME-DIR</function> + <replaceable>old-directory-pathname</replaceable> + <replaceable>new-directory-pathname</replaceable>)</code> renames a + subdirectory to a new name.</para></simplesect> + </section> </chapter> ------------------------------ Message: 3 Date: Fri, 24 Aug 2007 20:15:24 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/src subr.d, 1.222, 1.223 pathname.d, 1.399, 1.400 init.lisp, 1.265, 1.266 constsym.d, 1.331, 1.332 NEWS, 1.376, 1.377 ChangeLog, 1.5543, 1.5544 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31088/src Modified Files: subr.d pathname.d init.lisp constsym.d NEWS ChangeLog Log Message: implement RFE #[ 1779938 ]: RENAME-DIRECTORY: (RENAME-DIR): implement Index: pathname.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/pathname.d,v retrieving revision 1.399 retrieving revision 1.400 diff -u -d -r1.399 -r1.400 --- pathname.d 28 Jun 2007 15:54:49 -0000 1.399 +++ pathname.d 24 Aug 2007 20:15:21 -0000 1.400 @@ -7752,6 +7752,19 @@ VALUES1(T); } +LISPFUNN(rename_dir,2) +{ /* (RENAME-DIR dirname newname) removes the subdirectory pathname. */ + var object newdir = shorter_directory(STACK_0,true); STACK_0 = newdir; + var object olddir = shorter_directory(STACK_2,true); STACK_2 = olddir; + with_sstring_0(STACK_2,O(pathname_encoding),oldnamestring_asciz, { + with_sstring_0(STACK_1,O(pathname_encoding),newnamestring_asciz, { + rename_existing_file(oldnamestring_asciz,newnamestring_asciz); + }); + }); + skipSTACK(4); + VALUES1(T); +} + /* (defun ensure-directories-exist (pathspec &key verbose) (let* ((dir (pathname-directory pathspec)) (path (make-pathname :host (pathname-host pathspec) Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/src/ChangeLog,v retrieving revision 1.5543 retrieving revision 1.5544 diff -u -d -r1.5543 -r1.5544 --- ChangeLog 24 Aug 2007 19:08:57 -0000 1.5543 +++ ChangeLog 24 Aug 2007 20:15:22 -0000 1.5544 @@ -1,5 +1,12 @@ 2007-08-24 Sam Steingold <sd...@gn...> + implement RFE #[ 1779938 ]: RENAME-DIRECTORY + * pathname.d (RENAME-DIR): implement + * constsym.d, subr.d (rename_dir): add + * init.lisp (rename-dir): exoirt + +2007-08-24 Sam Steingold <sd...@gn...> + * modules/berkeley-db/bdb.c: fix some error_bdb calls; use db->get_env instead of a direct dbenv slot access; avoid "DB->get_cachesize: method not permitted when environment Index: subr.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/subr.d,v retrieving revision 1.222 retrieving revision 1.223 diff -u -d -r1.222 -r1.223 --- subr.d 28 Dec 2006 00:29:51 -0000 1.222 +++ subr.d 24 Aug 2007 20:15:21 -0000 1.223 @@ -831,6 +831,7 @@ LISPFUN(cd,seclass_default,0,1,norest,nokey,0,NIL) LISPFUNN(make_dir,1) LISPFUNN(delete_dir,1) +LISPFUNN(rename_dir,2) LISPFUN(ensure_directories_exist,seclass_default,1,0,norest,key,1, (kw(verbose))) LISPFUNNR(file_write_date,1) Index: constsym.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/constsym.d,v retrieving revision 1.331 retrieving revision 1.332 diff -u -d -r1.331 -r1.332 --- constsym.d 28 Dec 2006 00:29:51 -0000 1.331 +++ constsym.d 24 Aug 2007 20:15:21 -0000 1.332 @@ -667,6 +667,7 @@ LISPSYM(cd,"CD",ext) LISPSYM(make_dir,"MAKE-DIR",ext) LISPSYM(delete_dir,"DELETE-DIR",ext) +LISPSYM(rename_dir,"RENAME-DIR",ext) LISPSYM(ensure_directories_exist,"ENSURE-DIRECTORIES-EXIST",lisp) LISPSYM(file_write_date,"FILE-WRITE-DATE",lisp) LISPSYM(file_author,"FILE-AUTHOR",lisp) Index: init.lisp =================================================================== RCS file: /cvsroot/clisp/clisp/src/init.lisp,v retrieving revision 1.265 retrieving revision 1.266 diff -u -d -r1.265 -r1.266 --- init.lisp 22 Jun 2007 18:01:07 -0000 1.265 +++ init.lisp 24 Aug 2007 20:15:21 -0000 1.266 @@ -333,7 +333,7 @@ encoding-line-terminator #+UNICODE encoding-charset times show-stack gc exit quit bye expand-form xor mapcap maplap proper-list-p elastic-newline absolute-pathname - probe-directory cd make-dir delete-dir default-directory dir + probe-directory cd make-dir delete-dir rename-dir default-directory dir xgcd exquo mod-expt ! evalhook applyhook substring string-concat string-char make-char string-width char-width int-char char-bits char-font char-bit set-char-bit char-key Index: NEWS =================================================================== RCS file: /cvsroot/clisp/clisp/src/NEWS,v retrieving revision 1.376 retrieving revision 1.377 diff -u -d -r1.376 -r1.377 --- NEWS 24 Aug 2007 19:08:57 -0000 1.376 +++ NEWS 24 Aug 2007 20:15:21 -0000 1.377 @@ -22,6 +22,9 @@ integer type. See <http://clisp.cons.org/impnotes/dffi.html#def-c-type> for details. +* New function EXT:RENAME-DIR can be used to rename directories. + See <http://clisp.cons.org/impnotes/file-dict.html#rename-dir> for details. + * Bug fixes: + Fixed EXT:LETF to work with more than one place. [ 1731462 ] + Fixed rounding of long floats [even+1/2]. [ 1589311 ] ------------------------------ Message: 4 Date: Fri, 24 Aug 2007 21:21:55 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/modules/bindings/glibc wrap.lisp,1.4,1.5 test.tst,1.1,1.2 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/modules/bindings/glibc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23000/modules/bindings/glibc Modified Files: wrap.lisp test.tst Log Message: move signal handling examples from wrap to test (work interactively, segfault in batch, see https://sourceforge.net/tracker/?func=detail&atid=101355&aid=1781476&group_id=1355) Index: test.tst =================================================================== RCS file: /cvsroot/clisp/clisp/modules/bindings/glibc/test.tst,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test.tst 23 Aug 2007 22:11:19 -0000 1.1 +++ test.tst 24 Aug 2007 21:21:52 -0000 1.2 @@ -10,3 +10,58 @@ (linux:telldir *d*) 0 (= linux:DT_DIR (linux:dirent64-d_type (show (linux:readdir64 *d*)))) T (linux:closedir *d*) 0 + +#| +;;; signal handling examples: +;;; changing signal handlers: +(defparameter *sigact* (show (linux:signal-action-retrieve linux:SIGINT))) +*SIGACT* +(defparameter *savehandler* (linux:sa-handler *sigact*)) +*SAVEHANDLER* +(defparameter *signals* nil) *SIGNALS* +(defun test-handler (s) (declare (compile)) (push s *signals*)) TEST-HANDLER + +(progn (setf (linux:sa-handler *sigact*) #'test-handler) + (linux:signal-action-install linux:SIGINT *sigact*)) +NIL + +;; Now Ctrl-C invokes TEST-HANDLER +*signals* NIL +(os:kill (os:process-id) :SIGINT) NIL +*signals* (2) + +(progn (setf (linux:sa-handler *sigact*) *savehandler*) + (linux:signal-action-install linux:SIGINT *sigact*)) +NIL ; the standard behavior is restored + +;; this is packaged into set-signal-handler: +(progn + (setf *savehandler* (linux:set-signal-handler linux:SIGINT #'test-handler)) + (linux:raise linux:SIGINT)) +0 + +*signals* (2 2) ; TEST-HANDLER is called - received sigint + +;; Please note that if you use SA_RESETHAND, you reset the handler to +;; the system's notion of default handler, not Clisp's, so if you then +;; hit Ctrl-c, you would exit Clisp! + +;;; sigprocmask & sigpending +(linux:set-sigprocmask linux:SIG_BLOCK (linux:sa-mask *sigact*)) NIL +(linux:raise linux:SIGINT) 0 ; nothing happens +*signals* (2 2) ; no signals + +(linux:sigset-pending) +#S(LINUX:sigset_t :VAL #(2)) + +(linux:set-sigprocmask linux:SIG_UNBLOCK (linux:sa-mask *sigact*)) NIL +*signals* (2 2 2) ; received SIGINT + +(linux:sigset-pending) #S(LINUX:sigset_t :VAL #()) + +(progn (linux:set-signal-handler linux:SIGINT *savehandler*) nil) +NIL ; the standard behavior is restored + +;; (linux:raise linux:SIGINT) +;; ==> ** - Continuable Error/PRINT: User break +|# Index: wrap.lisp =================================================================== RCS file: /cvsroot/clisp/clisp/modules/bindings/glibc/wrap.lisp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- wrap.lisp 22 Mar 2005 16:59:10 -0000 1.4 +++ wrap.lisp 24 Aug 2007 21:21:52 -0000 1.5 @@ -124,53 +124,4 @@ (signal-action-install signal sigact) ; install oh)) ; return the old handler -#| signal handling examples: - -;;; changing signal handlers: - - (setf oldsigact (signal-action-retrieve SIGINT)) -#S(LINUX:sigaction :|sa_handler| #<FOREIGN-FUNCTION #x080711D4> - :|sa_mask| #S(LINUX:sigset_t :|val| #(2)) :|sa_flags| 335544320 - :|sa_restorer| #<FOREIGN-FUNCTION #x401F1868>) - (setf savehandler (sa-handler oldsigact)) -#<FOREIGN-FUNCTION #x080711D4> -;; this is example is _BAD_ because one cannot do i/o in handlers -;; <https://sourceforge.net/mailarchive/message.php?msg_id=3599878> - (defun test-handler (s) (format t "~&~s: signal ~d~%" 'test-handler s)) - (setf (sa-handler oldsigact) #'test-handler) - (signal-action-install SIGINT oldsigact) -;; Now Ctrl-C invokes TEST-HANDLER - (setf (sa-handler oldsigact) savehandler) - (signal-action-install SIGINT oldsigact) -;; the standard behavior is restored - -;; this is packaged into set-signal-handler: - (setf savehandler (set-signal-handler SIGINT #'test-handler)) - (raise SIGINT) -;; TEST-HANDLER is called - (set-signal-handler SIGINT savehandler) -;; the standard behavior is restored - -;; Please note that if you use SA_RESETHAND, you reset the handler to -;; the system's notion of default handler, not Clisp's, so if you then -;; hit Ctrl-c, you would exit Clisp! - -;;; sigprocmask & sigpending - - (setf sigact (signal-action-retrieve SIGINT)) - (raise SIGINT) -;; ** - Continuable Error/PRINT: User break - (set-sigprocmask SIG_BLOCK (sa-mask sigact)) - (raise SIGINT) -;; nothing - (sigset-pending) -#S(LINUX:sigset_t :|val| #(2)) - (set-sigprocmask SIG_UNBLOCK (sa-mask sigact)) -;; ** - Continuable Error/EVAL: User break - (sigset-pending) -#S(LINUX:sigset_t :|val| #()) - (raise SIGINT) -;; ** - Continuable Error/PRINT: User break -;; |# - (pushnew "LINUX" custom:*system-package-list* :test #'string=) ------------------------------ Message: 5 Date: Fri, 24 Aug 2007 21:37:41 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/doc impent.xml,1.282,1.283 impbody.xml,1.461,1.462 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28791/doc Modified Files: impent.xml impbody.xml Log Message: (files/file-dict/dir-is-not-file): new section Index: impbody.xml =================================================================== RCS file: /cvsroot/clisp/clisp/doc/impbody.xml,v retrieving revision 1.461 retrieving revision 1.462 diff -u -d -r1.461 -r1.462 --- impbody.xml 24 Aug 2007 20:15:22 -0000 1.461 +++ impbody.xml 24 Aug 2007 21:37:39 -0000 1.462 @@ -3486,6 +3486,16 @@ <section id="file-dict"><title>The Files Dictionary <ulink url="&clhs;/Body/sec_the_files_dictionary.html">[CLHS-20.2]</ulink></title> +<simplesect id="dir-is-not-file"><title>Directory is not a file</title> +<para>&clisp; has traditionally taken the view that a directory is a + separate object and not a special kind of file, so whenever the + standard says that a function operates on <emphasis>files</emphasis> + without specifically mentioning that it also works on + <emphasis>directories</emphasis>, &clisp; &sig-err; when passed a + directory.</para> +<para>&clisp; provides separate directory functions, such as + &delete-dir;, &rename-dir; et al.</para></simplesect> + <simplesect id="probe-file"><title>Function &probe-file;</title> <para>&probe-file; cannot be used to check whether a directory exists. Use functions &probe-dir; or &directory; for this.</para></simplesect> @@ -3499,9 +3509,10 @@ <emphasis>owner</emphasis> and <emphasis>author</emphasis> are not the same; in particular, authorship is preserved by copying, while ownership is not.</para> -<para>Use - <link linkend="file-owner"><function>OS:FILE-OWNER</function></link> - to find the owner of the file.</para></simplesect> +<para>Use <link linkend="file-owner"><function>OS:FILE-OWNER</function></link> + to find the owner of the file. See also + <link linkend="file-properties"><function>OS:FILE-PROPERTIES</function></link> + (&win32-only;).</para></simplesect> <simplesect id="probe-dir"><title>Function &probe-dir;</title> <para><code>(&probe-dir; &path-r;)</code> tests whether &path-r; exists @@ -3514,7 +3525,12 @@ &path-r;, not its &truename;, and returns the absolute pathname it actually removed or &nil; if &path-r; did not exist. When &path-r; points to a file which is currently open in &clisp;, - an &err-sig;.</para></simplesect> + an &err-sig;. + To remove a directory, use &delete-dir; instead.</para></simplesect> + +<simplesect id="rename-file"><title>Function &rename-file;</title> + <para>This function cannot operate on directories, + use &rename-dir; to rename a directory.</para></simplesect> <simplesect id="directory"><title>Function &directory;</title> @@ -3608,17 +3624,13 @@ <replaceable>directory-pathname</replaceable>)</code> creates a new subdirectory.</para></simplesect> -<simplesect id="delete-dir"> - <title>Function <function>EXT:DELETE-DIR</function></title> -<para><code>(<function>EXT:DELETE-DIR</function> - <replaceable>directory-pathname</replaceable>)</code> removes an - (empty) subdirectory.</para></simplesect> +<simplesect id="delete-dir"><title>Function &delete-dir;</title> +<para><code>(&delete-dir; <replaceable>directory-pathname</replaceable>)</code> + removes an (empty) subdirectory.</para></simplesect> -<simplesect id="rename-dir"> - <title>Function <function>EXT:RENAME-DIR</function></title> -<para><code>(<function>EXT:RENAME-DIR</function> - <replaceable>old-directory-pathname</replaceable> - <replaceable>new-directory-pathname</replaceable>)</code> renames a +<simplesect id="rename-dir"><title>Function &rename-dir;</title> +<para><code>(&rename-dir; <replaceable>old-directory-pathname</replaceable> + <replaceable>new-directory-pathname</replaceable>)</code> renames a subdirectory to a new name.</para></simplesect> </section> Index: impent.xml =================================================================== RCS file: /cvsroot/clisp/clisp/doc/impent.xml,v retrieving revision 1.282 retrieving revision 1.283 diff -u -d -r1.282 -r1.283 --- impent.xml 28 Dec 2006 00:29:49 -0000 1.282 +++ impent.xml 24 Aug 2007 21:37:39 -0000 1.283 @@ -195,6 +195,8 @@ <!ENTITY modern-k '<link linkend="package-case"><constant>:MODERN</constant></link>'> <!ENTITY cd '<link linkend="cd"><function>EXT:CD</function></link>'> <!ENTITY default-dir '<link linkend="default-dir"><function>EXT:DEFAULT-DIRECTORY</function></link>'> +<!ENTITY delete-dir '<link linkend="delete-dir"><function>EXT:DELETE-DIR</function></link>'> +<!ENTITY rename-dir '<link linkend="rename-dir"><function>EXT:RENAME-DIR</function></link>'> <!ENTITY ch-ctrl '<link linkend="char-bits"><constant>EXT:CHAR-CONTROL-BIT</constant></link>'> <!ENTITY ch-hyper '<link linkend="char-bits"><constant>EXT:CHAR-HYPER-BIT</constant></link>'> <!ENTITY ch-meta '<link linkend="char-bits"><constant>EXT:CHAR-META-BIT</constant></link>'> ------------------------------ Message: 6 Date: Fri, 24 Aug 2007 21:37:41 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/modules/syscalls syscalls.xml,1.76,1.77 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/modules/syscalls In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28791/modules/syscalls Modified Files: syscalls.xml Log Message: (files/file-dict/dir-is-not-file): new section Index: syscalls.xml =================================================================== RCS file: /cvsroot/clisp/clisp/modules/syscalls/syscalls.xml,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- syscalls.xml 18 Oct 2006 01:43:07 -0000 1.76 +++ syscalls.xml 24 Aug 2007 21:37:39 -0000 1.77 @@ -370,7 +370,7 @@ <varlistentry><term><code>(OS:MEMORY-STATUS)</code></term> <listitem><simpara>Return &win32; memory status information in a <type>MEMORY-STATUS</type> structure.</simpara></listitem></varlistentry> - <varlistentry><term><code>(OS:FILE-PROPERTIES filename set + <varlistentry id="file-properties"><term><code>(OS:FILE-PROPERTIES filename set &key-amp; :INITID &allow-other-keys-amp;)</code></term> <listitem><para>Wrapper for the &win32; <function role="win32">IPropertyStorage</function> functionality. ------------------------------ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ------------------------------ _______________________________________________ clisp-cvs mailing list cli...@li... https://lists.sourceforge.net/lists/listinfo/clisp-cvs End of clisp-cvs Digest, Vol 16, Issue 9 **************************************** |
From: Hoehle, Joerg-C. <Joe...@t-...> - 2007-08-27 13:22:52
|
Hi, >Update of /cvsroot/clisp/clisp/modules/bindings/glibc >In directory=20 >sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23000/modules/bindings/glibc > >Modified Files: > wrap.lisp test.tst=20 >Log Message: >move signal handling examples from wrap to test >(work interactively, segfault in batch, see >https://sourceforge.net/tracker/?func=3Ddetail&atid=3D101355&aid=3D17814= 76&gr oup_id=3D1355) I miss a mention in these files that signal handling does not work in Lisp, as I've explained a couple of times in several articles in the past. Signal handling with Lisp functions/closures is worth as much as Gilbert Baumann's e-mail from 1998 IIRC about working threading in CLISP. From what I remember, he wrote "it [telnet server demo] works until the first GC, then crashes ;-)"... No surprise. The tongue-in-* is intentional (if you believe this is a critique of Gilbert's work, read again). One must not call Lisp-level code from within a signal handler context. Other Lisps (cmucl AFAIK) have additional code to remember the signal and invoke Lisp code from a safe (not asynchronous) place -- outside the signal handler context! Nobody ever wrote such a thing for CLISP. BTW, I've had 0 time to look at the FFI thing. I'm way too busy right now. Regards, Jorg Hohle |
From: Sam S. <sd...@gn...> - 2007-08-27 13:57:08
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hoehle, Joerg-Cyril wrote: > Hi, > >> Update of /cvsroot/clisp/clisp/modules/bindings/glibc >> In directory >> sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23000/modules/bindings/glibc >> >> Modified Files: >> wrap.lisp test.tst >> Log Message: >> move signal handling examples from wrap to test >> (work interactively, segfault in batch, see >> https://sourceforge.net/tracker/?func=detail&atid=101355&aid=1781476&gr > oup_id=1355) > > I miss a mention in these files that signal handling does not work in > Lisp, as I've explained a couple of times in several articles in the > past. it was not in wrap.lisp, so it is not in test.tst > Signal handling with Lisp functions/closures is worth as much as Gilbert > Baumann's e-mail from 1998 IIRC about working threading in CLISP. From > what I remember, he wrote > "it [telnet server demo] works until the first GC, then crashes ;-)"... > No surprise. The tongue-in-* is intentional (if you believe this is a > critique of Gilbert's work, read again). I don't get it. why do we have all those nice signal handling wrappers in glibc/wrap.lisp if they are not expected to work? besides, if the only problem is GC, then a non-consing lisp function should be OK. besides, the crash happens BEFORE any lisp handlers are called - on the first call to retrieve the current handler. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG0tgoPp1Qsf2qnMcRAi4wAKCc+8a4JjwnXUmQhaPsB+cWqSUpfgCfarAV Dy3VJ8W97isQj8XmfQF5LC8= =4Aue -----END PGP SIGNATURE----- |
From: Hoehle, Joerg-C. <Joe...@t-...> - 2007-08-28 18:19:06
|
Hi, Sam Steingold wrote: >> Signal handling with Lisp functions/closures is worth as much as Gilbert >> Baumann's e-mail from 1998 IIRC about working threading in CLISP. From >> what I remember, he wrote >> "it [telnet server demo] works until the first GC, then crashes ;-)"... >> No surprise. The tongue-in-* is intentional (if you believe this is a >> critique of Gilbert's work, read again). >I don't get it. Starting a thread and crashing no later than the first GC was to be expected. I considered it as an funny experiment and invitation to others to hack his code base. 10 years ago, I myself had some ideas (nothing more) about a multithreading Amiga-CLISP (the Amiga has all shared memory, much like threads). >why do we have all those nice signal handling wrappers in >glibc/wrap.lisp if they are not expected to work? IIRC, you added that code years ago based on examples Pascal Bourguignon posted to the list. >besides, if the only problem is GC, then a non-consing lisp function >should be OK. No, it's not. GC is an obvious problem, but not the primary one. I think the problem #1 is the asynchronous nature of signal handling. Hence, the internal state of CLISP is completely inconsistent/unknown, which is not a good basis for starting Lisp code. Look, when a #<FOREIGN-FUNCTION> is called, clisp goes through save_env(), then jumps to the foreign code. The callback goes through restore_env(). I.e. Callbacks may only be called while CLISP is sitting inside foreign-call-out after save_env()! When the Lisp callback exists, the somewhat reverse sequence is performed (but see how begin/end_call and _callback differ). I.e. the only safe program traces are: ...Lisp... begin_call ...C... end_call ...Lisp ...Lisp... begin_call ...C... begin_callback ...Lisp... end_callback ...C... end_call ...Lisp That's why invoking X_event_loop() with Lisp some event handlers works. This use case is supported. When signal handlers are called by UNIX out of nowhere, no such setup happened. I'm not sure that's the only problem, because it could be used to argue that Lisp signal handlers never work, which is not what Pascal observes. ...Lisp... begin_callback... BOOM >besides, the crash happens BEFORE any lisp handlers are called - on the >first call to retrieve the current handler. Because the Lisp environment is completely messed up given the asynchronous nature of the signal handling? Lisp Signal handling that could work is the one defered to the main execution (i.e. remember in the C signal handler to invoke some Lisp function later), much like green threads, i.e. scheduled by the CLISP VM (while in consistent state). Right now I have no idea where to add that *without* slowing down the bytecode_interpreter loop (important!) -- but I have not looked at it. Back in the Amiga version, we had synchronous checking of ^C somewhere in that loop. Maybe that's a good place to add it? To implement that, clisp MUST provide its own EXT:API to install a Lisp signal handler (much like CMUCL -- IIRC, that was >10 years ago), linux:sig* MUST NOT be used for that purpose. FFI:install-signal-handler would install a C handler that would set a bit in an array for the bytecode_loop to act later (and do some type checks to only do this for Lisp functions (including FFI callbacks), but not pure C addresses. CMUCL nowadays documents system:enable-interrupt. http://common-lisp.net/project/cmucl/doc/cmu-user/unix.html Regards, Jorg Hohle |