Changeset 15914 in project


Ignore:
Timestamp:
09/16/09 07:12:41 (10 years ago)
Author:
Kon Lovett
Message:

Added argc checking

Location:
release/4/check-errors/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/check-errors/trunk/type-checks.scm

    r15588 r15914  
    3939  check-boolean
    4040  ;;
    41   define-check-type define-check+error-type)
     41  define-check-type define-check+error-type
     42  ;;
     43  check-minimum-argument-count
     44  check-argument-count)
    4245
    4346(import chicken scheme type-errors)
     
    157160           (,$define-check-type ,typ ,@(if pred `(,pred) '())) ) ) ) ) )
    158161
     162;;
     163
     164(define (check-minimum-argument-count loc actargc minargc)
     165  (unless (<= minargc actargc)
     166    (error-minimum-argument-count loc actargc minargc)) )
     167
     168(define (check-argument-count loc actargc maxargc)
     169  (unless (<= actargc maxargc)
     170    (error-argument-count loc actargc maxargc)) )
     171
    159172) ;module type-checks
  • release/4/check-errors/trunk/type-errors.scm

    r15735 r15914  
    3535  error-boolean
    3636  ;;
    37   (define-error-type error-argument-type))
     37  (define-error-type error-argument-type)
     38  ;;
     39  error-minimum-argument-count
     40  error-argument-count)
    3841
    39 (import scheme chicken (only data-structures ->string conc))
     42(import scheme chicken foreign (only data-structures ->string conc))
    4043
    4144(declare
    42   (usual-integrations)
    4345  (fixnum)
    4446  (inline)
     
    4951    vowel?)
    5052  (bound-to-procedure
    51     ##sys#signal-hook) )
     53    ##sys#signal-hook
     54    ##sys#error-hook) )
    5255
    5356;;;
     
    133136        (error-argument-type loc obj (conc "structure" #\space tag) argnam) )
    134137
     138;;
     139
     140(define (error-minimum-argument-count loc argcnt cnt)
     141  (##sys#error-hook (foreign-value "C_BAD_MINIMUM_ARGUMENT_COUNT_ERROR" int) loc argcnt cnt) )
     142
     143(define (error-argument-count loc argcnt cnt)
     144  (##sys#error-hook (foreign-value "C_BAD_ARGUMENT_COUNT_ERROR" int) loc argcnt cnt) )
     145
    135146) ;module type-errors
Note: See TracChangeset for help on using the changeset viewer.