|
From: <cli...@li...> - 2005-06-07 11:09: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.55,1.56 ChangeLog,1.376,1.377 (Bruno Haible) 2. clisp/doc impissue.xml,1.21,1.22 (Bruno Haible) 3. clisp/modules/rawsock rawsock.c,1.33,1.34 (Bruno Haible) 4. clisp/src ChangeLog,1.4684,1.4685 (Bruno Haible) 5. clisp/src/m4 alloca.m4,1.4,1.5 (Bruno Haible) 6. clisp/modules/regexp alloca_.h,NONE,1.1 alloca.c,NONE,1.1 (Bruno Haible) 7. clisp/src/m4 restrict.m4,NONE,1.1 (Bruno Haible) 8. clisp/src ChangeLog,1.4685,1.4686 (Bruno Haible) 9. clisp/modules/regexp configure.in,1.13,1.14 regex.c,1.7,1.8 Makefile.in,1.13,1.14 link.sh.in,1.4,1.5 (Bruno Haible) --__--__-- Message: 1 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/tests path.tst,1.55,1.56 ChangeLog,1.376,1.377 Date: Tue, 07 Jun 2005 11:03:43 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23752/tests Modified Files: path.tst ChangeLog Log Message: FIXME -> UNKNOWN. Index: path.tst =================================================================== RCS file: /cvsroot/clisp/clisp/tests/path.tst,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- path.tst 20 May 2005 19:28:28 -0000 1.55 +++ path.tst 7 Jun 2005 11:03:41 -0000 1.56 @@ -58,18 +58,18 @@ #+CLISP #S(PATHNAME :HOST NIL :DEVICE NIL :DIRECTORY NIL :NAME NIL :TYPE NIL :VERSION NIL) -#-CLISP FIXME +#-CLISP UNKNOWN (PARSE-NAMESTRING "./") #+CLISP #S(PATHNAME :HOST NIL :DEVICE NIL :DIRECTORY (:RELATIVE) :NAME NIL :TYPE NIL :VERSION NIL) -#-CLISP FIXME +#-CLISP UNKNOWN (NAMESTRING #P"./") #+WIN32 ".\\" #+UNIX "./" -#-(OR WIN32 UNIX) FIXME +#-(OR WIN32 UNIX) UNKNOWN (PARSE-NAMESTRING STRING) #+XCL @@ -583,7 +583,7 @@ :DIRECTORY (:RELATIVE :WILD-INFERIORS) :NAME :WILD :TYPE "FASL" :VERSION NIL) #-CLISP -FIXME +UNKNOWN (make-pathname :defaults "/**/*.FASL" :host "CL-LIBRARY") #+CLISP @@ -591,52 +591,52 @@ :DIRECTORY (:ABSOLUTE :WILD-INFERIORS) :NAME :WILD :TYPE "FASL" :VERSION NIL) #-CLISP -FIXME +UNKNOWN (logical-pathname ":") #+CLISP #S(LOGICAL-PATHNAME :HOST "" :DEVICE NIL :DIRECTORY (:ABSOLUTE) :NAME NIL :TYPE NIL :VERSION NIL) #-CLISP -FIXME +UNKNOWN (merge-pathnames (logical-pathname "cl-systems:") "metering.system") #+CLISP #S(LOGICAL-PATHNAME :HOST "CL-SYSTEMS" :DEVICE NIL :DIRECTORY (:ABSOLUTE) :NAME "METERING" :TYPE "SYSTEM" :VERSION :NEWEST) #-CLISP -FIXME +UNKNOWN (merge-pathnames (logical-pathname "cl-systems:") #P"metering.system") #+CLISP #S(LOGICAL-PATHNAME :HOST "CL-SYSTEMS" :DEVICE NIL :DIRECTORY (:ABSOLUTE) :NAME "METERING" :TYPE "SYSTEM" :VERSION :NEWEST) #-CLISP -FIXME +UNKNOWN (merge-pathnames (logical-pathname "clocc:clocc.lisp")) #+CLISP #S(logical-pathname :host "CLOCC" :device nil :directory (:absolute) :name "CLOCC" :type "LISP" :version :newest) #-CLISP -FIXME +UNKNOWN (merge-pathnames ".fas" (logical-pathname "clocc:src;cllib;xml.lisp")) #+CLISP #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL :DIRECTORY (:ABSOLUTE "SRC" "CLLIB") :NAME "XML" :TYPE "FAS" :VERSION :NEWEST) #-CLISP -FIXME +UNKNOWN (logical-pathname "clocc:;foo;bar;") #+CLISP #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE :UNSPECIFIC :DIRECTORY (:RELATIVE "FOO" "BAR") :NAME NIL :TYPE NIL :VERSION NIL) -#-CLISP FIXME +#-CLISP UNKNOWN (logical-pathname "clocc:baz;quux.lisp.3") #+CLISP #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE :UNSPECIFIC :DIRECTORY (:ABSOLUTE "BAZ") :NAME "QUUX" :TYPE "LISP" :VERSION 3) -#-CLISP FIXME +#-CLISP UNKNOWN (merge-pathnames (logical-pathname "clocc:;foo;bar;") (logical-pathname "clocc:baz;quux.lisp.3")) @@ -644,35 +644,35 @@ #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL :DIRECTORY (:ABSOLUTE "BAZ" "FOO" "BAR") :NAME "QUUX" :TYPE "LISP" :VERSION 3) #-CLISP -FIXME +UNKNOWN (compile-file-pathname (logical-pathname "clocc:clocc.lisp")) #+CLISP #S(logical-pathname :host "CLOCC" :device nil :directory (:absolute) :name "CLOCC" :type "FAS" :version :newest) #-CLISP -FIXME +UNKNOWN (compile-file-pathname (logical-pathname "clocc:src;cllib;xml.lisp")) #+CLISP #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL :DIRECTORY (:ABSOLUTE "SRC" "CLLIB") :NAME "XML" :TYPE "FAS" :VERSION :NEWEST) #-CLISP -FIXME +UNKNOWN (parse-namestring "foo;bar;baz.fas.3" "clocc") #+CLISP #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL :DIRECTORY (:ABSOLUTE "FOO" "BAR") :NAME "BAZ" :TYPE "FAS" :VERSION 3) #-CLISP -FIXME +UNKNOWN (parse-namestring "foo;bar;baz.fas.3" nil (logical-pathname "clocc:")) #+CLISP #S(LOGICAL-PATHNAME :HOST "CLOCC" :DEVICE NIL :DIRECTORY (:ABSOLUTE "FOO" "BAR") :NAME "BAZ" :TYPE "FAS" :VERSION 3) #-CLISP -FIXME +UNKNOWN (let* ((s "abcdefghijk") (d (make-array 5 :displaced-to s :displaced-index-offset 3 @@ -1005,4 +1005,4 @@ (compile-file-pathname "foo" :OUTPUT-FILE (logical-pathname "SYS:foo.fas")) #+CLISP #S(LOGICAL-PATHNAME :HOST "SYS" :DEVICE NIL :DIRECTORY (:ABSOLUTE) :NAME "FOO" :TYPE "FAS" :VERSION :NEWEST) -#-CLISP FIXME +#-CLISP UNKNOWN Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/tests/ChangeLog,v retrieving revision 1.376 retrieving revision 1.377 diff -u -d -r1.376 -r1.377 --- ChangeLog 30 May 2005 13:32:17 -0000 1.376 +++ ChangeLog 7 Jun 2005 11:03:41 -0000 1.377 @@ -1,3 +1,8 @@ +2005-06-04 Bruno Haible <br...@cl...> + + * path.tst: Use UNKNOWN, not FIXME, for not-yet-determined values in + other implementations. + 2005-05-29 Bruno Haible <br...@cl...> * clos.tst: Adjust numbering of last patch. Add a little sharper test. --__--__-- Message: 2 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/doc impissue.xml,1.21,1.22 Date: Tue, 07 Jun 2005 11:04:22 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24132/doc Modified Files: impissue.xml Log Message: More details about issue082. Index: impissue.xml =================================================================== RCS file: /cvsroot/clisp/clisp/doc/impissue.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- impissue.xml 5 Apr 2005 18:53:06 -0000 1.21 +++ impissue.xml 7 Jun 2005 11:04:20 -0000 1.22 @@ -93,11 +93,12 @@ <varlistentry id="iss080"><term>&iss080;</term>&yes;</varlistentry> <varlistentry id="iss081"><term>&iss081;</term>&yes;</varlistentry> <varlistentry id="iss082"><term>&iss082;</term> - <listitem><simpara>&clisp; can dump compiled but ¬-e; interpreted - closures, which should not be a problem, because an - <emphasis>interpreted</emphasis> closure in a + <listitem><simpara>&clisp; can dump compiled functions defined in the + global &lex-env;. Interpreted functions can ¬-e; be dumped; + this should not be a problem, because an + <emphasis>interpreted</emphasis> function in a <emphasis>compiled</emphasis> file usually indicate a programmer - error (often an extra "e;)</simpara></listitem></varlistentry> + error (often an extra "e;).</simpara></listitem></varlistentry> <varlistentry id="iss083"><term>&iss083;</term>&yes;</varlistentry> <varlistentry id="iss084"><term>&iss084;</term>&yes;</varlistentry> <varlistentry id="iss085"><term>&iss085;</term>&yes;</varlistentry> @@ -113,7 +114,7 @@ <varlistentry id="iss095"><term>&iss095;</term>&yes;</varlistentry> <varlistentry id="iss096"><term>&iss096;</term>&yes;</varlistentry> <varlistentry id="iss097"><term>&iss097;</term> - <listitem><simpara>there is no writeup, but but all affected + <listitem><simpara>there is no writeup, but all affected operators are fully implemented as specified </simpara></listitem></varlistentry> <varlistentry id="iss098"><term>&iss098;</term>&yes;</varlistentry> --__--__-- Message: 3 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/modules/rawsock rawsock.c,1.33,1.34 Date: Tue, 07 Jun 2005 11:05:26 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/modules/rawsock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24440/modules/rawsock Modified Files: rawsock.c Log Message: Make it work on systems without htonl(), ntohl() etc. Index: rawsock.c =================================================================== RCS file: /cvsroot/clisp/clisp/modules/rawsock/rawsock.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- rawsock.c 20 May 2005 13:08:20 -0000 1.33 +++ rawsock.c 7 Jun 2005 11:05:23 -0000 1.34 @@ -3,6 +3,7 @@ * Fred Cohen, 2003-2004 * Don Cohen, 2003-2004 * Sam Steingold 2004-2005 + * Bruno Haible 2004-2005 * <http://www.opengroup.org/onlinepubs/007908799/xns/syssocket.h.html> */ @@ -147,36 +148,72 @@ } while(0) /* ================== arpa/inet.h interface ================== */ -/* define even when the OS lacks the C functions; in that case, - return the argument on the assumption - that the host order is the same as the network order */ +/* Define even when the OS lacks the C functions; in that case, + we emulate the C functions. */ DEFUN(RAWSOCK:HTONL, num) { uint32 arg = I_to_uint32(check_uint32(popSTACK())); + uint32 result; #if defined(HAVE_HTONL) - begin_system_call(); arg = htonl(arg); end_system_call(); + begin_system_call(); result = htonl(arg); end_system_call(); +#else + union { struct { uint8 octet3; uint8 octet2; uint8 octet1; uint8 octet0; } o; + uint32 all; + } + word; + word.all = arg; + result = ((uint32)word.o.octet3 << 24) | ((uint32)word.o.octet2 << 16) + | ((uint32)word.o.octet1 << 8) | (uint32)word.o.octet0; #endif - VALUES1(uint32_to_I(arg)); + VALUES1(uint32_to_I(result)); } DEFUN(RAWSOCK:NTOHL, num) { uint32 arg = I_to_uint32(check_uint32(popSTACK())); + uint32 result; #if defined(HAVE_NTOHL) - begin_system_call(); arg = ntohl(arg); end_system_call(); + begin_system_call(); result = ntohl(arg); end_system_call(); +#else + union { struct { uint8 octet3; uint8 octet2; uint8 octet1; uint8 octet0; } o; + uint32 all; + } + word; + word.o.octet3 = (arg >> 24) & 0xff; + word.o.octet2 = (arg >> 16) & 0xff; + word.o.octet1 = (arg >> 8) & 0xff; + word.o.octet0 = arg & 0xff; + result = word.all; #endif - VALUES1(uint32_to_I(arg)); + VALUES1(uint32_to_I(result)); } DEFUN(RAWSOCK:HTONS, num) { uint16 arg = I_to_uint16(check_uint16(popSTACK())); + uint16 result; #if defined(HAVE_HTONS) - begin_system_call(); arg = htons(arg); end_system_call(); + begin_system_call(); result = htons(arg); end_system_call(); +#else + union { struct { uint8 octet1; uint8 octet0; } o; + uint16 all; + } + word; + word.all = arg; + result = ((uint16)word.o.octet1 << 8) | (uint16)word.o.octet0; #endif - VALUES1(uint16_to_I(arg)); + VALUES1(uint16_to_I(result)); } DEFUN(RAWSOCK:NTOHS, num) { uint16 arg = I_to_uint16(check_uint16(popSTACK())); + uint16 result; #if defined(HAVE_NTOHS) - begin_system_call(); arg = ntohs(arg); end_system_call(); + begin_system_call(); result = ntohs(arg); end_system_call(); +#else + union { struct { uint8 octet1; uint8 octet0; } o; + uint16 all; + } + word; + word.o.octet1 = (arg >> 8) & 0xff; + word.o.octet0 = arg & 0xff; + result = word.all; #endif - VALUES1(uint16_to_I(arg)); + VALUES1(uint16_to_I(result)); } DEFUN(RAWSOCK:CONVERT-ADDRESS, family address) { int family = check_socket_domain(STACK_1); --__--__-- Message: 4 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/src ChangeLog,1.4684,1.4685 Date: Tue, 07 Jun 2005 11:05:26 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24440/src Modified Files: ChangeLog Log Message: Make it work on systems without htonl(), ntohl() etc. Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/src/ChangeLog,v retrieving revision 1.4684 retrieving revision 1.4685 diff -u -d -r1.4684 -r1.4685 --- ChangeLog 7 Jun 2005 11:00:32 -0000 1.4684 +++ ChangeLog 7 Jun 2005 11:05:24 -0000 1.4685 @@ -1,5 +1,13 @@ 2005-06-04 Bruno Haible <br...@cl...> + * modules/rawsock/rawsock.c (RAWSOCK:HTONL): Make it work also if the + system doesn't have the htonl() function. + (RAWSOCK:NTOHL): Likewise for ntohl(). + (RAWSOCK:HTONS): Likewise for htons(). + (RAWSOCK:NTOHS): Likewise for ntohs(). + +2005-06-04 Bruno Haible <br...@cl...> + Emulate Unix APIs on Woe32, not vice versa. * lispbibl.d (handle_dup): Remove declaration. (INVALID_HANDLE_VALUE, HNULLP): Remove macro. --__--__-- Message: 5 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/src/m4 alloca.m4,1.4,1.5 Date: Tue, 07 Jun 2005 11:07:23 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/src/m4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25524/src/m4 Added Files: alloca.m4 Log Message: gnulib module 'alloca'. --- NEW FILE: alloca.m4 --- # alloca.m4 serial 5 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ALLOCA], [ dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_EGREP]) AC_REQUIRE([AC_FUNC_ALLOCA]) if test $ac_cv_func_alloca_works = no; then gl_PREREQ_ALLOCA fi # Define an additional variable used in the Makefile substitution. if test $ac_cv_working_alloca_h = yes; then AC_EGREP_CPP([Need own alloca], [ #if defined __GNUC__ || defined _AIX || defined _MSC_VER Need own alloca #endif ], [AC_DEFINE(HAVE_ALLOCA, 1, [Define to 1 if you have `alloca' after including <alloca.h>, a header that may be supplied by this distribution.]) ALLOCA_H=alloca.h], [ALLOCA_H=]) else ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) AC_DEFINE(HAVE_ALLOCA_H, 1, [Define HAVE_ALLOCA_H for backward compatibility with older code that includes <alloca.h> only if HAVE_ALLOCA_H is defined.]) ]) # Prerequisites of lib/alloca.c. # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. AC_DEFUN([gl_PREREQ_ALLOCA], [:]) --__--__-- Message: 6 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/modules/regexp alloca_.h,NONE,1.1 alloca.c,NONE,1.1 Date: Tue, 07 Jun 2005 11:07:23 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/modules/regexp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25524/modules/regexp Added Files: alloca_.h alloca.c Log Message: gnulib module 'alloca'. --- NEW FILE: alloca_.h --- /* Memory allocation on the stack. Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004 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 program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H means there is a real alloca function. */ #ifndef _GNULIB_ALLOCA_H # define _GNULIB_ALLOCA_H /* alloca (N) returns a pointer to N bytes of memory allocated on the stack, which will last until the function returns. Use of alloca should be avoided: - inside arguments of function calls - undefined behaviour, - in inline functions - the allocation may actually last until the calling function returns, - for huge N (say, N >= 65536) - you never know how large (or small) the stack is, and when the stack cannot fulfill the memory allocation request, the program just crashes. */ #ifdef __GNUC__ # define alloca __builtin_alloca #elif defined _AIX # define alloca __alloca #elif defined _MSC_VER # include <malloc.h> # define alloca _alloca #else # include <stddef.h> # ifdef __cplusplus extern "C" # endif void *alloca (size_t); #endif #endif /* _GNULIB_ALLOCA_H */ --- NEW FILE: alloca.c --- /* alloca.c -- allocate automatically reclaimed memory (Mostly) portable public-domain implementation -- D A Gwyn This implementation of the PWB library alloca function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. J.Otto Tennant <jo...@cr...> contributed the Cray support. There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <alloca.h> #include <string.h> #include <stdlib.h> #ifdef emacs # include "lisp.h" # include "blockinput.h" # ifdef EMACS_FREE # undef free # define free EMACS_FREE # endif #else # define memory_full() abort () #endif /* If compiling with GCC 2, this file's not needed. */ #if !defined (__GNUC__) || __GNUC__ < 2 /* If someone has defined alloca as a macro, there must be some other way alloca is supposed to work. */ # ifndef alloca # ifdef emacs # ifdef static /* actually, only want this if static is defined as "" -- this is for usg, in which emacs must undefine static in order to make unexec workable */ # ifndef STACK_DIRECTION you lose -- must know STACK_DIRECTION at compile-time /* Using #error here is not wise since this file should work for old and obscure compilers. */ # endif /* STACK_DIRECTION undefined */ # endif /* static */ # endif /* emacs */ /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ # if defined (CRAY) && defined (CRAY_STACKSEG_END) long i00afunc (); # define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) # else # define ADDRESS_FUNCTION(arg) &(arg) # endif /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ # ifndef STACK_DIRECTION # define STACK_DIRECTION 0 /* Direction unknown. */ # endif # if STACK_DIRECTION != 0 # define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ # else /* STACK_DIRECTION == 0; need run-time code. */ static int stack_dir; /* 1 or -1 once known. */ # define STACK_DIR stack_dir static void find_stack_direction (void) { static char *addr = NULL; /* Address of first `dummy', once known. */ auto char dummy; /* To get stack address. */ if (addr == NULL) { /* Initial entry. */ addr = ADDRESS_FUNCTION (dummy); find_stack_direction (); /* Recurse once. */ } else { /* Second entry. */ if (ADDRESS_FUNCTION (dummy) > addr) stack_dir = 1; /* Stack grew upward. */ else stack_dir = -1; /* Stack grew downward. */ } } # endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca'ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc alignment chunk size. The following default should work okay. */ # ifndef ALIGN_SIZE # define ALIGN_SIZE sizeof(double) # endif typedef union hdr { char align[ALIGN_SIZE]; /* To force sizeof(header). */ struct { union hdr *next; /* For chaining headers. */ char *deep; /* For stack depth measure. */ } h; } header; static header *last_alloca_header = NULL; /* -> last alloca header. */ /* Return a pointer to at least SIZE bytes of storage, which will be automatically reclaimed upon exit from the procedure that called alloca. Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ void * alloca (size_t size) { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); # if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ find_stack_direction (); # endif /* Reclaim garbage, defined as all alloca'd storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* Traverses linked list. */ # ifdef emacs BLOCK_INPUT; # endif for (hp = last_alloca_header; hp != NULL;) if ((STACK_DIR > 0 && hp->h.deep > depth) || (STACK_DIR < 0 && hp->h.deep < depth)) { register header *np = hp->h.next; free (hp); /* Collect garbage. */ hp = np; /* -> next header. */ } else break; /* Rest are not deeper. */ last_alloca_header = hp; /* -> last valid storage. */ # ifdef emacs UNBLOCK_INPUT; # endif } if (size == 0) return NULL; /* No allocation required. */ /* Allocate combined header + user data storage. */ { /* Address of header. */ register header *new; size_t combined_size = sizeof (header) + size; if (combined_size < sizeof (header)) memory_full (); new = malloc (combined_size); if (! new) memory_full (); new->h.next = last_alloca_header; new->h.deep = depth; last_alloca_header = new; /* User storage begins just after header. */ return (void *) (new + 1); } } # if defined (CRAY) && defined (CRAY_STACKSEG_END) # ifdef DEBUG_I00AFUNC # include <stdio.h> # endif # ifndef CRAY_STACK # define CRAY_STACK # ifndef CRAY2 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ struct stack_control_header { long shgrow:32; /* Number of times stack has grown. */ long shaseg:32; /* Size of increments to stack. */ long shhwm:32; /* High water mark of stack. */ long shsize:32; /* Current size of stack (all segments). */ }; /* The stack segment linkage control information occurs at the high-address end of a stack segment. (The stack grows from low addresses to high addresses.) The initial part of the stack segment linkage control information is 0200 (octal) words. This provides for register storage for the routine which overflows the stack. */ struct stack_segment_linkage { long ss[0200]; /* 0200 overflow words. */ long sssize:32; /* Number of words in this segment. */ long ssbase:32; /* Offset to stack base. */ long:32; long sspseg:32; /* Offset to linkage control of previous segment of stack. */ long:32; long sstcpt:32; /* Pointer to task common address block. */ long sscsnm; /* Private control structure number for microtasking. */ long ssusr1; /* Reserved for user. */ long ssusr2; /* Reserved for user. */ long sstpid; /* Process ID for pid based multi-tasking. */ long ssgvup; /* Pointer to multitasking thread giveup. */ long sscray[7]; /* Reserved for Cray Research. */ long ssa0; long ssa1; long ssa2; long ssa3; long ssa4; long ssa5; long ssa6; long ssa7; long sss0; long sss1; long sss2; long sss3; long sss4; long sss5; long sss6; long sss7; }; # else /* CRAY2 */ /* The following structure defines the vector of words returned by the STKSTAT library routine. */ struct stk_stat { long now; /* Current total stack size. */ long maxc; /* Amount of contiguous space which would be required to satisfy the maximum stack demand to date. */ long high_water; /* Stack high-water mark. */ long overflows; /* Number of stack overflow ($STKOFEN) calls. */ long hits; /* Number of internal buffer hits. */ long extends; /* Number of block extensions. */ long stko_mallocs; /* Block allocations by $STKOFEN. */ long underflows; /* Number of stack underflow calls ($STKRETN). */ long stko_free; /* Number of deallocations by $STKRETN. */ long stkm_free; /* Number of deallocations by $STKMRET. */ long segments; /* Current number of stack segments. */ long maxs; /* Maximum number of stack segments so far. */ long pad_size; /* Stack pad size. */ long current_address; /* Current stack segment address. */ long current_size; /* Current stack segment size. This number is actually corrupted by STKSTAT to include the fifteen word trailer area. */ long initial_address; /* Address of initial segment. */ long initial_size; /* Size of initial segment. */ }; /* The following structure describes the data structure which trails any stack segment. I think that the description in 'asdef' is out of date. I only describe the parts that I am sure about. */ struct stk_trailer { long this_address; /* Address of this block. */ long this_size; /* Size of this block (does not include this trailer). */ long unknown2; long unknown3; long link; /* Address of trailer block of previous segment. */ long unknown5; long unknown6; long unknown7; long unknown8; long unknown9; long unknown10; long unknown11; long unknown12; long unknown13; long unknown14; }; # endif /* CRAY2 */ # endif /* not CRAY_STACK */ # ifdef CRAY2 /* Determine a "stack measure" for an arbitrary ADDRESS. I doubt that "lint" will like this much. */ static long i00afunc (long *address) { struct stk_stat status; struct stk_trailer *trailer; long *block, size; long result = 0; /* We want to iterate through all of the segments. The first step is to get the stack status structure. We could do this more quickly and more directly, perhaps, by referencing the $LM00 common block, but I know that this works. */ STKSTAT (&status); /* Set up the iteration. */ trailer = (struct stk_trailer *) (status.current_address + status.current_size - 15); /* There must be at least one stack segment. Therefore it is a fatal error if "trailer" is null. */ if (trailer == 0) abort (); /* Discard segments that do not contain our argument address. */ while (trailer != 0) { block = (long *) trailer->this_address; size = trailer->this_size; if (block == 0 || size == 0) abort (); trailer = (struct stk_trailer *) trailer->link; if ((block <= address) && (address < (block + size))) break; } /* Set the result to the offset in this segment and add the sizes of all predecessor segments. */ result = address - block; if (trailer == 0) { return result; } do { if (trailer->this_size <= 0) abort (); result += trailer->this_size; trailer = (struct stk_trailer *) trailer->link; } while (trailer != 0); /* We are done. Note that if you present a bogus address (one not in any segment), you will get a different number back, formed from subtracting the address of the first block. This is probably not what you want. */ return (result); } # else /* not CRAY2 */ /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. Determine the number of the cell within the stack, given the address of the cell. The purpose of this routine is to linearize, in some sense, stack addresses for alloca. */ static long i00afunc (long address) { long stkl = 0; long size, pseg, this_segment, stack; long result = 0; struct stack_segment_linkage *ssptr; /* Register B67 contains the address of the end of the current stack segment. If you (as a subprogram) store your registers on the stack and find that you are past the contents of B67, you have overflowed the segment. B67 also points to the stack segment linkage control area, which is what we are really interested in. */ stkl = CRAY_STACKSEG_END (); ssptr = (struct stack_segment_linkage *) stkl; /* If one subtracts 'size' from the end of the segment, one has the address of the first word of the segment. If this is not the first segment, 'pseg' will be nonzero. */ pseg = ssptr->sspseg; size = ssptr->sssize; this_segment = stkl - size; /* It is possible that calling this routine itself caused a stack overflow. Discard stack segments which do not contain the target address. */ while (!(this_segment <= address && address <= stkl)) { # ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); # endif if (pseg == 0) break; stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; this_segment = stkl - size; } result = address - this_segment; /* If you subtract pseg from the current end of the stack, you get the address of the previous stack segment's end. This seems a little convoluted to me, but I'll bet you save a cycle somewhere. */ while (pseg != 0) { # ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o\n", pseg, size); # endif stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; result += size; } return (result); } # endif /* not CRAY2 */ # endif /* CRAY */ # endif /* no alloca */ #endif /* not GCC version 2 */ --__--__-- Message: 7 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/src/m4 restrict.m4,NONE,1.1 Date: Tue, 07 Jun 2005 11:07:35 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/src/m4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25688/src/m4 Added Files: restrict.m4 Log Message: gnulib module 'restrict'. --- NEW FILE: restrict.m4 --- #serial 1003 dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # This macro can be removed once we can rely on Autoconf 2.57a or later, # since we can then use its AC_C_RESTRICT. # gl_C_RESTRICT # -------------- # Determine whether the C/C++ compiler supports the "restrict" keyword # introduced in ANSI C99, or an equivalent. Do nothing if the compiler # accepts it. Otherwise, if the compiler supports an equivalent, # define "restrict" to be that. Here are some variants: # - GCC supports both __restrict and __restrict__ # - older DEC Alpha C compilers support only __restrict # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C # Otherwise, define "restrict" to be empty. AC_DEFUN([gl_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict, [gl_cv_c_restrict=no # Try the official restrict keyword, then gcc's __restrict, and # the less common variants. for ac_kw in restrict __restrict __restrict__ _Restrict; do AC_COMPILE_IFELSE([AC_LANG_SOURCE( [float * $ac_kw x;])], [gl_cv_c_restrict=$ac_kw; break]) done ]) case $gl_cv_c_restrict in restrict) ;; no) AC_DEFINE(restrict,, [Define to equivalent of C99 restrict keyword, or to nothing if this is not supported. Do not define if restrict is supported directly.]) ;; *) AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;; esac ]) --__--__-- Message: 8 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/src ChangeLog,1.4685,1.4686 Date: Tue, 07 Jun 2005 11:08:17 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25772/src Modified Files: ChangeLog Log Message: Make it work on platform which have no <alloca.h> header. Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/src/ChangeLog,v retrieving revision 1.4685 retrieving revision 1.4686 diff -u -d -r1.4685 -r1.4686 --- ChangeLog 7 Jun 2005 11:05:24 -0000 1.4685 +++ ChangeLog 7 Jun 2005 11:08:13 -0000 1.4686 @@ -1,5 +1,23 @@ 2005-06-04 Bruno Haible <br...@cl...> + * modules/regexp/regex.c: Undo 2005-03-18 patch. + * modules/regexp/alloca_.h: New file, from gnulib. + * modules/regexp/alloca.c: New file, from gnulib. + * src/m4/alloca.m4: New file, from gnulib. + * src/m4/restrict.m4: New file, from gnulib. + * modules/regexp/configure.in: Invoke 'restrict' and 'alloca' + requisites. Set ALLOCA to empty if we don't need it. + * modules/regexp/Makefile.in (ALLOCA_H): New variable. + (DISTRIBFILES): Add alloca.o if needed. + (all): Depend on alloca.o if needed. + (regex.o): Depend on $(ALLOCA_H). + (alloca.o, alloca.h): New rules. + (clean): Also remove alloca.h. + * modules/regexp/link.sh.in (NEW_FILES, NEW_LIBS): Add alloca.o if + needed. + +2005-06-04 Bruno Haible <br...@cl...> + * modules/rawsock/rawsock.c (RAWSOCK:HTONL): Make it work also if the system doesn't have the htonl() function. (RAWSOCK:NTOHL): Likewise for ntohl(). --__--__-- Message: 9 From: Bruno Haible <ha...@us...> To: cli...@li... Subject: clisp/modules/regexp configure.in,1.13,1.14 regex.c,1.7,1.8 Makefile.in,1.13,1.14 link.sh.in,1.4,1.5 Date: Tue, 07 Jun 2005 11:08:14 +0000 Reply-To: cli...@li... Update of /cvsroot/clisp/clisp/modules/regexp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25772/modules/regexp Modified Files: configure.in regex.c Makefile.in link.sh.in Log Message: Make it work on platform which have no <alloca.h> header. Index: link.sh.in =================================================================== RCS file: /cvsroot/clisp/clisp/modules/regexp/link.sh.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- link.sh.in 25 Feb 2004 16:23:00 -0000 1.4 +++ link.sh.in 7 Jun 2005 11:08:12 -0000 1.5 @@ -6,8 +6,8 @@ make clisp-module \ CC="${CC}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" \ INCLUDES="$absolute_linkkitdir" -NEW_FILES="$file_list @REGEX_O@ regexp.dvi" -NEW_LIBS="$file_list @REGEX_O@" +NEW_FILES="$file_list @REGEX_O@ @ALLOCA@ regexp.dvi" +NEW_LIBS="$file_list @REGEX_O@ @ALLOCA@" NEW_MODULES="$mod_list" TO_LOAD='regexp' TO_PRELOAD='preload.lisp' Index: Makefile.in =================================================================== RCS file: /cvsroot/clisp/clisp/modules/regexp/Makefile.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.in 14 May 2005 23:18:56 -0000 1.13 +++ Makefile.in 7 Jun 2005 11:08:12 -0000 1.14 @@ -7,6 +7,7 @@ MODPREP = ../modprep.fas REGEX_O = @REGEX_O@ REGEX_H = @REGEX_H@ +ALLOCA_H = @ALLOCA_H@ CLISP = clisp -q -norc @@ -16,10 +17,10 @@ SHELL = /bin/sh -DISTRIBFILES = regexi.o $(REGEX_O) link.sh Makefile README regexp.lisp regexp.texinfo regexp.dvi preload.lisp +DISTRIBFILES = regexi.o $(REGEX_O) @ALLOCA@ link.sh Makefile README regexp.lisp regexp.texinfo regexp.dvi preload.lisp distribdir = -all : regexp.fas regexi.o $(REGEX_O) +all : regexp.fas regexi.o $(REGEX_O) @ALLOCA@ regexp.fas : regexp.lisp $(CLISP) -c regexp.lisp @@ -30,9 +31,16 @@ regexi.m.c : regexi.c $(MODPREP) $(CLISP) $(MODPREP) regexi.c -regex.o : regex.c regex.h +regex.o : regex.c regex.h $(ALLOCA_H) $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(INCLUDES) -DHAVE_CONFIG_H -c regex.c +alloca.o : alloca.c $(ALLOCA_H) + $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(INCLUDES) -DHAVE_CONFIG_H -c alloca.c + +alloca.h : alloca_.h + cp alloca_.h alloca.h-t + mv alloca.h-t alloca.h + # Make a module clisp-module : all @@ -41,7 +49,7 @@ $(LN) $(DISTRIBFILES) $(distribdir) clean : force - rm -f core *.o *.a + rm -f core *.o *.a alloca.h rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr distclean : clean Index: configure.in =================================================================== RCS file: /cvsroot/clisp/clisp/modules/regexp/configure.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- configure.in 22 Mar 2005 16:18:33 -0000 1.13 +++ configure.in 7 Jun 2005 11:08:12 -0000 1.14 @@ -15,11 +15,14 @@ AC_HEADER_STDC AC_CHECK_HEADERS(string.h sys/types.h) AM_GNU_GETTEXT([external]) +gl_C_RESTRICT +gl_FUNC_ALLOCA CL_REGEXP # can we use the system-wide regex implementation? if test "$ac_cv_use_included_regexp" = no -a "$cl_cv_regexp" = yes; then REGEX_H="" REGEX_O="" + ALLOCA="" else REGEX_H="regex.h" REGEX_O="regex.o" Index: regex.c =================================================================== RCS file: /cvsroot/clisp/clisp/modules/regexp/regex.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- regex.c 20 May 2005 20:03:51 -0000 1.7 +++ regex.c 7 Jun 2005 11:08:12 -0000 1.8 @@ -272,7 +272,7 @@ # else /* not REGEX_MALLOC */ /* Emacs already defines alloca, sometimes. */ -# if !defined(alloca) && defined(HAVE_ALLOCA_H) +# ifndef alloca /* Make alloca work the best possible way. */ # include <alloca.h> --__--__-- _______________________________________________ clisp-cvs mailing list cli...@li... https://lists.sourceforge.net/lists/listinfo/clisp-cvs End of clisp-cvs Digest |