mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
* module/Makefile.am (LIB_SOURCES): Add statprof, sxml, and texinfo to the build. (NOCOMP_SOURCES): Reindent, and add the upstream SSAX files. * module/statprof.scm: * module/sxml/apply-templates.scm: * module/sxml/fold.scm: * module/sxml/simple.scm: * module/sxml/ssax.scm: * module/sxml/ssax/input-parse.scm: * module/sxml/transform.scm: * module/sxml/upstream/COPYING.SSAX: * module/sxml/upstream/SSAX.scm: * module/sxml/upstream/SXML-tree-trans.scm: * module/sxml/upstream/SXPath-old.scm: * module/sxml/upstream/assert.scm: * module/sxml/upstream/input-parse.scm: * module/sxml/xpath.scm: * module/texinfo.scm: * module/texinfo/docbook.scm: * module/texinfo/html.scm: * module/texinfo/indexing.scm: * module/texinfo/plain-text.scm: * module/texinfo/reflection.scm: * module/texinfo/serialize.scm: * module/texinfo/string-utils.scm: Add files from guile-lib to Guile. It's only Richard, Andreas, Rob, and myself that have copyright on these, and we have all assigned to the FSF. SSAX itself is in the public domain.
35 lines
No EOL
1.4 KiB
Scheme
35 lines
No EOL
1.4 KiB
Scheme
;
|
|
; syntax: assert ?expr ?expr ... [report: ?r-exp ?r-exp ...]
|
|
;
|
|
; If (and ?expr ?expr ...) evaluates to anything but #f, the result
|
|
; is the value of that expression.
|
|
; If (and ?expr ?expr ...) evaluates to #f, an error is reported.
|
|
; The error message will show the failed expressions, as well
|
|
; as the values of selected variables (or expressions, in general).
|
|
; The user may explicitly specify the expressions whose
|
|
; values are to be printed upon assertion failure -- as ?r-exp that
|
|
; follow the identifier 'report:'
|
|
; Typically, ?r-exp is either a variable or a string constant.
|
|
; If the user specified no ?r-exp, the values of variables that are
|
|
; referenced in ?expr will be printed upon the assertion failure.
|
|
|
|
(define-syntax assert
|
|
(syntax-rules (report:)
|
|
((assert "doit" (expr ...) (r-exp ...))
|
|
(cond
|
|
((and expr ...) => (lambda (x) x))
|
|
(else
|
|
(error "assertion failure: ~a" (list '(and expr ...) r-exp ...)))))
|
|
((assert "collect" (expr ...))
|
|
(assert "doit" (expr ...) ()))
|
|
((assert "collect" (expr ...) report: r-exp ...)
|
|
(assert "doit" (expr ...) (r-exp ...)))
|
|
((assert "collect" (expr ...) expr1 stuff ...)
|
|
(assert "collect" (expr ... expr1) stuff ...))
|
|
((assert stuff ...)
|
|
(assert "collect" () stuff ...))))
|
|
|
|
(define-syntax assure
|
|
(syntax-rules ()
|
|
((assure exp error-msg)
|
|
(assert exp report: error-msg)))) |