#lang racket/base
(require racket/contract/base)
   (->* (symbol? string?) () #:rest list? any))]
  (-> (or/c output-port? (-> output-port?))
      (->* (symbol? string?) () #:rest list? any))]
  (->* (symbol? string?) () #:rest list? void?)]
  (->* (symbol?) () #:rest list? void?)])

;; Goal: replace all uses of 'cerr' etc with 'sxml:warn'

;; warning-handler adds newline; fmt doesn't need to
(define (make-warning-handler out)
  (lambda (who fmt . args)
    (let ([out (if (procedure? out) (out) out)])
      (apply fprintf out (string-append "~a: " fmt "\n") who args))))

(define current-sxml-warning-handler
  (make-parameter (make-warning-handler current-error-port)))

(define (sxml:warn who fmt . args)
  (apply (current-sxml-warning-handler) who fmt args)

(define (sxml:warn/concat who . args)
   (apply string-append (map (lambda (x) (format "~a" x)) args))))