Changeset 29107 in project


Ignore:
Timestamp:
06/16/13 12:06:10 (8 years ago)
Author:
juergen
Message:

no-checker added

Location:
release/4/multi-methods
Files:
3 edited
4 copied

Legend:

Unmodified
Added
Removed
  • release/4/multi-methods/tags/0.2/multi-methods.scm

    r29088 r29107  
    11; Author: Juergen Lorenz ; ju (at) jugilo (dot) de
    22;
    3 ; Last update: June 13, 2013
     3; Last update: June 10, 2013
    44;
    55; Copyright (c) 2013, Juergen Lorenz
     
    7979
    8080(module methods
    81   (methods method query-checker command-checker method? method-variadic?
    82            method-arity method-name method-assumptions method-effects
    83            effects-checked?)
     81  (methods no-checker query-checker command-checker method method?
     82           method-variadic?  method-arity method-name method-assumptions
     83           method-effects effects-checked?)
    8484
    8585(import scheme
     
    9696                  (lambda (x)
    9797                   (if (boolean? x) x #f))))
     98
     99;;; (no-checker doc . docs)
     100;;; -----------------------
     101;;; in case no effect checks are wanted, this macro can be used. It
     102;;; provides only documentation and returns its procedure argument
     103;;; unchecked.
     104(define-syntax no-checker
     105  (syntax-rules ()
     106    ((_ doc . docs)
     107     (lambda (proc)
     108       (if (eq? proc state)
     109         (list doc . docs)
     110         (lambda args
     111           (apply proc args)))))))
    98112
    99113;;; (command-checker check0 check1 ...)
     
    306320
    307321(define (methods . args)
    308   (let ((lst '(method query-checker command-checker method? method-variadic?
    309                method-arity method-name method-assumptions method-effects
    310                effects-checked?)))
     322  (let ((lst '(no-checker query-checker command-checker method method?
     323               method-variadic?  method-arity method-name method-assumptions
     324               method-effects effects-checked?)))
    311325    (if (null? args)
    312326      lst
    313327      (case (car args)
     328        ((no-checker)
     329         '(macro ()
     330            ((_ doc . docs)
     331             "documentation strings or symbols"
     332             "returns a procedure which which returns its procure argument unchecked")))
     333        ((command-checker)
     334         '(macro ()
     335            ((_ check0 check1 ...)
     336"checks are procedures of the same arguments as the command to check returning three values - query-call, compare-proc, doc-string  -  needed for checking"
     337             "returns the command in case of successfull tests")))
     338        ((query-checker)
     339         '(macro ()
     340            ((_ (name0 check0 . checks0) (name1 check1 . checks1) ...)
     341             "check0, checks0 are predicates to test result0 ... of the query"
     342             "returns the query in case of successfull tests")))
    314343        ((method)
    315344         '(macro ()
     
    318347                (name pred . preds)
    319348                ...)
    320              "proc is the actual procedure, effect-checker one of
    321  command-checke or query-checker, preds are predicates to
    322  check args in sequence, variadic? defaults to #f"
     349"proc is the actual procedure, effect-checker one of no-checker command-checker or query-checker, preds are predicates to check args in sequence, variadic? defaults to #f"
    323350             (method? result))))
    324         ((command-checker)
    325          '(macro ()
    326             ((_ check0 check1 ...)
    327              "checks are procedures of the same arguments as the command to check returning three values - query-call, compare-proc, doc-string  -  needed for checking"
    328              "returns the command in case of successfull tests")))
    329         ((query-checker)
    330          '(macro ()
    331             ((_ (name0 check0 . checks0) (name1 check1 . checks1) ...)
    332              "check0, checks0 are predicates to test result0 ... of the query"
    333              "returns the query in case of successfull tests")))
    334351        ((method?)
    335352         '(procedure (result)
  • release/4/multi-methods/tags/0.2/multi-methods.setup

    r29088 r29107  
    99 'multi-methods
    1010 '("multi-methods.so" "method-helper.import.so" "methods.import.so" "multi-methods.import.so")
    11  '((version "0.1.2")))
     11 '((version "0.2")))
  • release/4/multi-methods/tags/0.2/tests/run.scm

    r29088 r29107  
    1818    (extend-procedure set-car! 'set-car!))
    1919    pair 10)
     20  (= (((no-checker "doc") add1) 5) 6)
    2021  "POSTCONDITION VIOLATED:"
    2122  (condition-case
  • release/4/multi-methods/trunk/multi-methods.scm

    r29088 r29107  
    11; Author: Juergen Lorenz ; ju (at) jugilo (dot) de
    22;
    3 ; Last update: June 13, 2013
     3; Last update: June 10, 2013
    44;
    55; Copyright (c) 2013, Juergen Lorenz
     
    7979
    8080(module methods
    81   (methods method query-checker command-checker method? method-variadic?
    82            method-arity method-name method-assumptions method-effects
    83            effects-checked?)
     81  (methods no-checker query-checker command-checker method method?
     82           method-variadic?  method-arity method-name method-assumptions
     83           method-effects effects-checked?)
    8484
    8585(import scheme
     
    9696                  (lambda (x)
    9797                   (if (boolean? x) x #f))))
     98
     99;;; (no-checker doc . docs)
     100;;; -----------------------
     101;;; in case no effect checks are wanted, this macro can be used. It
     102;;; provides only documentation and returns its procedure argument
     103;;; unchecked.
     104(define-syntax no-checker
     105  (syntax-rules ()
     106    ((_ doc . docs)
     107     (lambda (proc)
     108       (if (eq? proc state)
     109         (list doc . docs)
     110         (lambda args
     111           (apply proc args)))))))
    98112
    99113;;; (command-checker check0 check1 ...)
     
    306320
    307321(define (methods . args)
    308   (let ((lst '(method query-checker command-checker method? method-variadic?
    309                method-arity method-name method-assumptions method-effects
    310                effects-checked?)))
     322  (let ((lst '(no-checker query-checker command-checker method method?
     323               method-variadic?  method-arity method-name method-assumptions
     324               method-effects effects-checked?)))
    311325    (if (null? args)
    312326      lst
    313327      (case (car args)
     328        ((no-checker)
     329         '(macro ()
     330            ((_ doc . docs)
     331             "documentation strings or symbols"
     332             "returns a procedure which which returns its procure argument unchecked")))
     333        ((command-checker)
     334         '(macro ()
     335            ((_ check0 check1 ...)
     336"checks are procedures of the same arguments as the command to check returning three values - query-call, compare-proc, doc-string  -  needed for checking"
     337             "returns the command in case of successfull tests")))
     338        ((query-checker)
     339         '(macro ()
     340            ((_ (name0 check0 . checks0) (name1 check1 . checks1) ...)
     341             "check0, checks0 are predicates to test result0 ... of the query"
     342             "returns the query in case of successfull tests")))
    314343        ((method)
    315344         '(macro ()
     
    318347                (name pred . preds)
    319348                ...)
    320              "proc is the actual procedure, effect-checker one of
    321  command-checke or query-checker, preds are predicates to
    322  check args in sequence, variadic? defaults to #f"
     349"proc is the actual procedure, effect-checker one of no-checker command-checker or query-checker, preds are predicates to check args in sequence, variadic? defaults to #f"
    323350             (method? result))))
    324         ((command-checker)
    325          '(macro ()
    326             ((_ check0 check1 ...)
    327              "checks are procedures of the same arguments as the command to check returning three values - query-call, compare-proc, doc-string  -  needed for checking"
    328              "returns the command in case of successfull tests")))
    329         ((query-checker)
    330          '(macro ()
    331             ((_ (name0 check0 . checks0) (name1 check1 . checks1) ...)
    332              "check0, checks0 are predicates to test result0 ... of the query"
    333              "returns the query in case of successfull tests")))
    334351        ((method?)
    335352         '(procedure (result)
  • release/4/multi-methods/trunk/multi-methods.setup

    r29088 r29107  
    99 'multi-methods
    1010 '("multi-methods.so" "method-helper.import.so" "methods.import.so" "multi-methods.import.so")
    11  '((version "0.1.2")))
     11 '((version "0.2")))
  • release/4/multi-methods/trunk/tests/run.scm

    r29088 r29107  
    1818    (extend-procedure set-car! 'set-car!))
    1919    pair 10)
     20  (= (((no-checker "doc") add1) 5) 6)
    2021  "POSTCONDITION VIOLATED:"
    2122  (condition-case
Note: See TracChangeset for help on using the changeset viewer.