[RFC 06/14] Remove support for old versions of Guile

Tom Tromey <[email protected]> Sat, 19 Aug 2023 11:42:05 -0600
Newsgroups gmane.comp.tools.cgen.devel
Message-ID <[email protected]>
This removes support for older versions of Guile.
---
 README    |  2 +-
 cos.scm   |  9 +------
 guile.scm | 71 +++++--------------------------------------------------
 3 files changed, 8 insertions(+), 74 deletions(-)

diff --git a/README b/README
index cc286d4..e9f9c7f 100644
--- a/README
+++ b/README
@@ -43,7 +43,7 @@ Binutils/GDB developers wishing to use CGEN must configure Binutils/GDB with
 opcodes/Makefile and sim/<arch>/Makefile for the supported processors.
 
 CGEN uses Guile so Guile must be installed.
-CGEN has been tested with Guile 1.4.1, 1.6.8, and 1.8.5.
+CGEN has been tested with Guile 3.0.7.
 Support for older versions of Guile will be removed in time.
 
 Source Layout
diff --git a/cos.scm b/cos.scm
index 0210b20..1ba4c54 100644
--- a/cos.scm
+++ b/cos.scm
@@ -1263,11 +1263,4 @@
 
 ;; Misc. internal utilities.
 
-;; We need a fast vector copy operation.
-;; If `vector-copy' doesn't exist (which is assumed to be the fast one),
-;; provide a simple version.
-
-(if (defined? 'vector-copy)
-    (define /object-vector-copy vector-copy)
-    (define (/object-vector-copy v) (list->vector (vector->list v)))
-)
+(define /object-vector-copy vector-copy)
diff --git a/guile.scm b/guile.scm
index 85c37d4..9d7c64c 100644
--- a/guile.scm
+++ b/guile.scm
@@ -3,56 +3,14 @@
 ; This file is part of CGEN.
 ; See file COPYING.CGEN for details.
 
-(define *guile-major-version* (string->number (major-version)))
-(define *guile-minor-version* (string->number (minor-version)))
+(define (eval1 expr)
+  (eval expr (current-module)))
 
-; eval takes a module argument in 1.6 and later
+(define load primitive-load-path)
 
-(if (or (> *guile-major-version* 1)
-	(>= *guile-minor-version* 6))
-    (define (eval1 expr)
-      (eval expr (current-module)))
-    (define (eval1 expr)
-      (eval expr))
-)
+(define %stat stat)
 
-; symbol-bound? is deprecated in 1.6
-
-(if (or (> *guile-major-version* 1)
-	(>= *guile-minor-version* 6))
-    (define (symbol-bound? table s)
-      (if table
-	  (error "must pass #f for symbol-bound? first arg"))
-      ; FIXME: Not sure this is 100% correct.
-      (module-defined? (current-module) s))
-)
-
-(if (symbol-bound? #f 'load-from-path)
-    (begin
-      (define (load file)
-	(begin
-	  ;(load-from-path file)
-	  (primitive-load-path file)
-	  ))
-      )
-)
-
-(if (not (symbol-bound? #f '%stat))
-    (begin
-      (define %stat stat)
-      )
-)
-
-(if (symbol-bound? #f 'debug-enable)
-    (debug-enable 'backtrace)
-)
-
-; Guile 1.3 has reverse!, Guile 1.2 has list-reverse!.
-; CGEN uses reverse!
-(if (and (not (symbol-bound? #f 'reverse!))
-	 (symbol-bound? #f 'list-reverse!))
-    (define reverse! list-reverse!)
-)
+(debug-enable 'backtrace)
 
 (define (debug-write . objs)
   (map (lambda (o)
@@ -60,28 +18,11 @@
        objs)
   (newline (current-error-port)))
 
-;; Guile 1.8 no longer has "." in %load-path so relative path loads
-;; no longer work.
-
-(if (or (> *guile-major-version* 1)
-	(>= *guile-minor-version* 8))
-    (set! %load-path (append %load-path (list ".")))
-)
+(add-to-load-path ".")
 
 
 ;;; Enabling and disabling debugging features of the host Scheme.
 
-;;; For the initial load proces, turn everything on.  We'll disable it
-;;; before we start doing the heavy computation.
-(if (memq 'debug-extensions *features*)
-    (begin
-      (debug-enable 'backtrace)
-      (debug-enable 'debug)
-      (debug-enable 'backwards)
-      (debug-set! depth 2000)
-      (debug-set! maxdepth 2000)
-      (debug-set! stack 100000)
-      (debug-set! frames 10)))
 (read-enable 'positions)
 
 ;;; Call THUNK, with debugging enabled if FLAG is true, or disabled if
-- 
2.41.0