guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-scsh ChangeLog INCOMPAT README init...


From: Gary Houston
Subject: guile/guile-scsh ChangeLog INCOMPAT README init...
Date: Thu, 12 Oct 2000 11:58:29 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Gary Houston <address@hidden>   00/10/12 11:58:28

Modified files:
        guile-scsh     : ChangeLog INCOMPAT README init.scm 
        guile-scsh/rx  : re-low.scm 

Log message:
        2000-10-12  Gary Houston  <address@hidden>
        
        * rx/re-low.scm (compile-posix-re->c-struct cre-search, cre-search?):
        use (regex spencer).
        
        * init.scm: use the guilerxspencer module, distributed
        separately, instead of the regex routines in guile-core.
        Scsh takes advantage of the support for embedded ASCII nuls
        in Spencer's library.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-scsh/ChangeLog.diff?r1=1.38&r2=1.39
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-scsh/INCOMPAT.diff?r1=1.16&r2=1.17
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-scsh/README.diff?r1=1.5&r2=1.6
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-scsh/init.scm.diff?r1=1.29&r2=1.30
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-scsh/rx/re-low.scm.diff?r1=1.1&r2=1.2

Patches:
Index: guile/guile-scsh/ChangeLog
diff -u guile/guile-scsh/ChangeLog:1.38 guile/guile-scsh/ChangeLog:1.39
--- guile/guile-scsh/ChangeLog:1.38     Sun Sep 17 02:03:54 2000
+++ guile/guile-scsh/ChangeLog  Thu Oct 12 11:58:28 2000
@@ -1,3 +1,13 @@
+2000-10-12  Gary Houston  <address@hidden>
+
+       * rx/re-low.scm (compile-posix-re->c-struct cre-search, cre-search?):
+       use (regex spencer).
+
+       * init.scm: use the guilerxspencer module, distributed
+       separately, instead of the regex routines in guile-core.
+       Scsh takes advantage of the support for embedded ASCII nuls
+       in Spencer's library.
+
 2000-09-14  Gary Houston  <address@hidden>
 
        * lib/string-lib.scm (string->list): fix a known scsh bug:
Index: guile/guile-scsh/INCOMPAT
diff -u guile/guile-scsh/INCOMPAT:1.16 guile/guile-scsh/INCOMPAT:1.17
--- guile/guile-scsh/INCOMPAT:1.16      Sun Sep 17 02:03:21 2000
+++ guile/guile-scsh/INCOMPAT   Thu Oct 12 11:58:28 2000
@@ -1,18 +1,12 @@
 Bugs:
+====
 
 extended process forms don't work:
 
 (run (echo hello) (> out.log)))
 
-there's a problem with compiling regular expressions: the POSIX regex
-library doesn't support imbedded NUL characters.  this probably causes
-numerous problems, e.g.,:
-
-compare the posix string in the result of (rx (- alpha ("ae")))
-with the one in (rx (- alpha ("aei"))): the latter contains garbage
-and can't be used.
-
 Incompatibilities with the original scsh:
+========================================
 
 everything is defined at the top level, no modules.
 
Index: guile/guile-scsh/README
diff -u guile/guile-scsh/README:1.5 guile/guile-scsh/README:1.6
--- guile/guile-scsh/README:1.5 Mon Sep  4 11:37:13 2000
+++ guile/guile-scsh/README     Thu Oct 12 11:58:28 2000
@@ -1,16 +1,30 @@
-This is an incomplete port of the scheme shell (scsh) 0.5.2 to Guile.
+This is an incomplete port of the scheme shell, scsh 0.5.2 to Guile.
 
 For the original scsh package and documentation, see:
 
 http://www.swiss.ai.mit.edu/ftpdir/scsh/
 
+Prerequisites for guile-scsh:
+
+SLIB must be available to Guile: see the guile reference manual for
+information on installing SLIB (FIXME: we may be able to do without
+SLIB).
+
+The guilerxspencer module must be installed.  It's available from
+http://arglist.com/guile/
+(FIXME: use modules, so that guilerxspencer is only needed if using
+the scsh regex stuff).
+
 To install the package, use something like:
 
 configure --prefix=/usr/local
 make
 make install
+
+See the INSTALL file for more details.
 
-The configure prefix must match the one used for Guile itself.
+For now, the configure prefix must match the one where Guile is installed.
+(FIXME: use guile-config to find the installation directory).
 
 Alternatively it's sufficient to rename (or link) the main guile-scsh
 directory to "scsh" and place it somewhere in the guile load path (type
@@ -22,12 +36,13 @@
 
 (load-from-path "scsh/init")
 
-Note that SLIB must be available to Guile: see the guile reference
-manual for information on installing SLIB.
-
 The Guile port uses a record type to represent the multiple values
 returned by many scsh procedures.  The values can be retrieved
-using call-with-values or receive.
+using call-with-values or receive.  FIXME: check modern multiple values
+usage in guile-core.
+
+FIXME: delete the autogenerated files from the repository and remove
+the text below.
 
 Hacking It Yourself ==================================================
 
Index: guile/guile-scsh/init.scm
diff -u guile/guile-scsh/init.scm:1.29 guile/guile-scsh/init.scm:1.30
--- guile/guile-scsh/init.scm:1.29      Mon Sep  4 11:37:14 2000
+++ guile/guile-scsh/init.scm   Thu Oct 12 11:58:28 2000
@@ -24,6 +24,7 @@
 (defmacro structure-ref (structure symb)
   symb)
 
+;; FIXME: check whether slib is still necessary.
 (use-modules (ice-9 slib))
 (require 'values)
 (require 'format)
@@ -51,6 +52,8 @@
 (load-from-path "scsh/scsh-condition.scm")
 (load-from-path "scsh/jar-defrecord.scm")
 (load-from-path "scsh/char-set.scm")
+
+(use-modules (regex spencer))
 
 (define guile-regexp? regexp?)
 (load-from-path "scsh/rx/re-low.scm")
Index: guile/guile-scsh/rx/re-low.scm
diff -u guile/guile-scsh/rx/re-low.scm:1.1 guile/guile-scsh/rx/re-low.scm:1.2
--- guile/guile-scsh/rx/re-low.scm:1.1  Mon Sep  4 11:37:14 2000
+++ guile/guile-scsh/rx/re-low.scm      Thu Oct 12 11:58:28 2000
@@ -62,9 +62,7 @@
 ;             compile-posix-re->c-struct re-string sm?))))
 
 (define (compile-posix-re->c-struct re-string sm?)
-  ;; Guile make-regexp, regexp-exec can't handle REG_NOSUB so ignore "sm?"
-  ;; for now.
-  (make-regexp re-string))
+  (regcomp re-string (logior REG_EXTENDED REG_PEND (if sm? 0 REG_NOSUB))))
 
 (define-foreign %compile-re (compile_re (string-desc pattern) (bool 
submatches?))
   integer ; 0 or error code
@@ -100,17 +98,17 @@
                                             re-str #t)))
                               (set-cre:bytes cre C-bytes)
                               C-bytes)))
-               (retcode (regexp-exec C-bytes str start))
+               (retcode (regexec C-bytes str REG_STARTEND -1 start))
                (tvec (cre:tvec cre)))
           (cond (retcode
-                 (vector-set! start-vec 0 (car (vector-ref retcode 1)))
-                 (vector-set! end-vec 0 (cdr (vector-ref retcode 1)))
+                 (vector-set! start-vec 0 (regmatch:start retcode 0))
+                 (vector-set! end-vec 0 (regmatch:end retcode 0))
                  (do ((i (- (vector-length start-vec) 2) (- i 1)))
                      ((< i 0))
                    (let ((j-scm (vector-ref tvec i)))
                      (cond (j-scm
-                            (let ((k (car (vector-ref retcode j-scm)))
-                                  (l (cdr (vector-ref retcode j-scm))))
+                            (let ((k (regmatch:start retcode j-scm))
+                                  (l (regmatch:end retcode j-scm)))
                               (vector-set! start-vec (+ i 1)
                                            (if (= k -1) #f k))
                               (vector-set! end-vec (+ i 1)
@@ -134,13 +132,12 @@
 (define (cre-search? cre str start)
   (let ((re-str (cre:string cre)))     ;; RE-STR = #F => empty match.
     (and re-str
-        (let* ((C-bytes (or (cre:bytes cre)
+        (let* ((C-bytes (or (cre:bytes/nm cre)
                             (let ((C-bytes (compile-posix-re->c-struct
-                                            re-str #t)))
-                              (set-cre:bytes cre C-bytes)
-                              C-bytes)))
-               (retcode (regexp-exec C-bytes str start)))
-          (and retcode #t)))))
+                                            re-str #f)))
+                              (set-cre:bytes/nm cre C-bytes)
+                              C-bytes))))
+          (regexec C-bytes str REG_STARTEND 0 start)))))
 
 (define-foreign %cre-search
   (re_search ((C "const regex_t *~a") compiled-regexp)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]