Hi,I attached a patch to port getopt-long to Chicken 6. It replaces the call to the deprecated `define-record-printer` with `set-record-printer!` and fixes the imports.
zilti
diff -ruN getopt-long-orig/getopt-long.scm getopt-long/getopt-long.scm
--- getopt-long-orig/getopt-long.scm 2024-09-29 23:58:45.776711192 +0200
+++ getopt-long/getopt-long.scm 2024-09-30 00:04:31.862966574 +0200
@@ -170,7 +170,7 @@
default-long-option-value-cset
long-option-value-quoting)
- (import scheme (chicken base) (chicken string))
+ (import scheme (scheme base) (chicken base) (chicken string))
(import (srfi 1) (srfi 13) (srfi 14) matchable)
@@ -252,42 +252,44 @@
;; Join together option names in spec with commas, and append the
;; argument type and name
-(define-record-printer (option-spec x out)
- (let* ((name (option-spec-name x))
- (value-policy (option-spec-value x))
- (required? (option-spec-required? x))
- (single-char (option-spec-single-char x))
- (docstring (option-spec-docstring x))
- (multiple? (option-spec-multiple? x))
- (long-option (and (not (make-single-char name))
- (string-append "--" (->string name))))
- (short-option (or (and single-char
- (list->string (list #\- single-char)))
- (make-single-char name)))
- (option-lst (cond ((and short-option long-option)
- (list long-option (separator) short-option))
- (long-option
- (list long-option))
- (else (list short-option))))
- (option-lst
- (cond
- (value-policy
- (if (value-policy-optional? value-policy)
- (cons* "]" (->string (value-policy-name value-policy) )
- "=" "[" option-lst)
- (cons* (->string (value-policy-name value-policy))
- "="
- option-lst)))
- (else option-lst)))
-
- (option-string (string-concatenate (reverse option-lst))))
-
- (display
- (string-append (spaces (indent))
- (string-pad-right option-string (width))
- docstring
- "\n")
- out)))
+(set-record-printer!
+ option-spec
+ (lambda (x out)
+ (let* ((name (option-spec-name x))
+ (value-policy (option-spec-value x))
+ (required? (option-spec-required? x))
+ (single-char (option-spec-single-char x))
+ (docstring (option-spec-docstring x))
+ (multiple? (option-spec-multiple? x))
+ (long-option (and (not (make-single-char name))
+ (string-append "--" (->string name))))
+ (short-option (or (and single-char
+ (list->string (list #\- single-char)))
+ (make-single-char name)))
+ (option-lst (cond ((and short-option long-option)
+ (list long-option (separator) short-option))
+ (long-option
+ (list long-option))
+ (else (list short-option))))
+ (option-lst
+ (cond
+ (value-policy
+ (if (value-policy-optional? value-policy)
+ (cons* "]" (->string (value-policy-name value-policy) )
+ "=" "[" option-lst)
+ (cons* (->string (value-policy-name value-policy))
+ "="
+ option-lst)))
+ (else option-lst)))
+
+ (option-string (string-concatenate (reverse option-lst))))
+
+ (display
+ (string-append (spaces (indent))
+ (string-pad-right option-string (width))
+ docstring
+ "\n")
+ out))))
;; Generate a formatted list of options from OPTION-LIST, and return a
;; string suitable for embedding into help text. The single string
OpenPGP_0xB38976E82C9DAE42.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature
