Changeset 38721 in project


Ignore:
Timestamp:
05/31/20 01:02:57 (6 weeks ago)
Author:
Kon Lovett
Message:

add common slib-compat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/slib-prec/trunk/slib-compat.scm

    r38716 r38721  
    1 ;;;; slib-compat.scm  -*- Scheme -*-
     1;;;; slib-compat.scm  -*- scheme -*-
    22;;;; Kon Lovett, Apr '20
    33
     
    55(import (only (chicken port) call-with-output-string))
    66(import (only (chicken pretty-print) pretty-print))
     7(import (only (chicken base) let-values identity))
    78
    89(define mod modulo)
     
    8081(define (print-call-stack out)
    8182  (import (only (chicken base) print-call-chain))
    82   (print-call-chain out))
     83  (print-call-chain out) )
    8384
    84 (define slib:warn
    85   (lambda args
    86     (let ((cep (current-error-port)))
    87       (if (provided? 'trace) (print-call-stack cep))
    88       (display "Warn: " cep)
    89       (for-each (lambda (x) (display #\space cep) (write x cep)) args))))
     85(define (slib:warn args)
     86  (import (only (chicken base) current-error-port))
     87  (let ((cep (current-error-port)))
     88    (if (provided? 'trace) (print-call-stack cep))
     89    (display "Warn: " cep)
     90    (for-each (lambda (x) (display #\space cep) (write x cep)) args) ) )
    9091
    91 (define slib:error
     92(define slib:error)
     93(let ()
     94  (import (only (chicken base) error))
    9295  (let ((error error))
    93     (lambda args
     96    (set! slib:error (lambda args
     97      (import (only (chicken base) current-error-port))
    9498      (if (provided? 'trace) (print-call-stack (current-error-port)))
    95       (apply error args))))
     99      (apply error args))) ) )
    96100
    97101(define slib:tab #\tab)
Note: See TracChangeset for help on using the changeset viewer.