Changeset 35777 in project


Ignore:
Timestamp:
07/06/18 18:56:55 (4 months ago)
Author:
kon
Message:

rel 3.1.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/check-errors

    r35772 r35777  
    4545</enscript>
    4646
     47==== Usage
     48
     49<enscript language=scheme>
     50(import type-checks-basic)
     51</enscript>
     52
    4753==== check-defined-value
    4854
     
    6066checking is necessary.
    6167
    62 ==== check-fixnum
    63 ==== check-positive-fixnum
    64 ==== check-natural-fixnum
    65 ==== check-negative-fixnum
    66 ==== check-non-positive-fixnum
    67 
    68 <procedure>(check-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
    69 <procedure>(check-positive-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
    70 <procedure>(check-natural-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
    71 <procedure>(check-negative-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
    72 <procedure>(check-non-positive-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
    73 
    74 ==== check-integer
    75 ==== check-positive-integer
    76 ==== check-natural-integer
    77 ==== check-negative-integer
    78 ==== check-non-positive-integer
    79 
    80 <procedure>(check-integer LOC OBJ [ARGNAM]) --> integer</procedure>
    81 <procedure>(check-positive-integer LOC OBJ [ARGNAM]) --> integer</procedure>
    82 <procedure>(check-natural-integer LOC OBJ [ARGNAM]) --> integer</procedure>
    83 <procedure>(check-negative-integer LOC OBJ [ARGNAM]) --> integer</procedure>
    84 <procedure>(check-non-positive-integer LOC OBJ [ARGNAM]) --> integer</procedure>
    85 
    86 ==== check-number
    87 ==== check-positive-number
    88 ==== check-natural-number
    89 ==== check-negative-number
    90 ==== check-non-positive-number
    91 
    92 <procedure>(check-number LOC OBJ [ARGNAM]) --> number</procedure>
    93 <procedure>(check-positive-number LOC OBJ [ARGNAM]) --> number</procedure>
    94 <procedure>(check-natural-number LOC OBJ [ARGNAM]) --> number</procedure>
    95 <procedure>(check-negative-number LOC OBJ [ARGNAM]) --> number</procedure>
    96 <procedure>(check-non-positive-number LOC OBJ [ARGNAM]) --> number</procedure>
    97 
    98 ==== check-flonum
    99 
    100 <procedure>(check-flonum LOC OBJ [ARGNAM]) -> flonum</procedure>
    101 
    102 ==== check-procedure
    103 
    104 <procedure>(check-procedure LOC OBJ [ARGNAM]) -> *</procedure>
    105 
    106 ==== check-input-port
    107 
    108 <procedure>(check-input-port LOC OBJ [ARGNAM]) -> *</procedure>
    109 
    110 ==== check-output-port
    111 
    112 <procedure>(check-output-port LOC OBJ [ARGNAM]) -> *</procedure>
    113 
    114 ==== check-list
    115 
    116 <procedure>(check-list LOC OBJ [ARGNAM]) -> *</procedure>
    117 
    118 ==== check-pair
    119 
    120 <procedure>(check-pair LOC OBJ [ARGNAM]) -> *</procedure>
    121 
    122 ==== check-blob
    123 
    124 <procedure>(check-blob LOC OBJ [ARGNAM]) -> *</procedure>
    125 
    126 ==== check-vector
    127 
    128 <procedure>(check-vector LOC OBJ [ARGNAM]) -> *</procedure>
    129 
    130 ==== check-structure
    131 
    132 <procedure>(check-structure LOC OBJ TAG [ARGNAM]) -> *</procedure>
    133 <procedure>(check-record LOC OBJ TAG [ARGNAM]) -> *</procedure>
    134 <procedure>(check-record-type LOC OBJ TAG [ARGNAM]) -> *</procedure>
    135 
    136 {{check-record}} and {{check-record-type}} are essentially synonyms.
    137 
    138 ==== check-symbol
    139 
    140 <procedure>(check-symbol LOC OBJ [ARGNAM]) -> *</procedure>
    141 
    142 ==== check-keyword
    143 
    144 <procedure>(check-keyword LOC OBJ [ARGNAM]) -> *</procedure>
    145 
    146 ==== check-string
    147 
    148 <procedure>(check-string LOC OBJ [ARGNAM]) -> *</procedure>
    149 
    150 ==== check-char
    151 
    152 <procedure>(check-char LOC OBJ [ARGNAM]) -> *</procedure>
    153 
    154 ==== check-boolean
    155 
    156 <procedure>(check-boolean LOC OBJ [ARGNAM]) -> *</procedure>
    157 
    158 ==== check-alist
    159 
    160 <procedure>(check-alist LOC OBJ [ARGNAM]) -> *</procedure>
    161 
    16268==== check-minimum-argument-count
    16369
     
    17177
    17278Does not verify the type of {{ARGC}}, and {{MAXARGC}}.
    173 
    174 ==== check-open-interval
    175 
    176 <procedure>(check-open-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
    177 
    178 {{NUM}} in {{]MINNUM MAXNUM[}}.
    179 
    180 Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
    181 
    182 ==== check-closed-interval
    183 
    184 <procedure>(check-closed-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
    185 
    186 {{NUM}} in {{[MINNUM MAXNUM]}}.
    187 
    188 Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
    189 
    190 ==== check-half-open-interval
    191 
    192 <procedure>(check-half-open-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
    193 
    194 {{NUM}} in {{]MINNUM MAXNUM]}}.
    195 
    196 Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
    197 
    198 ==== check-half-closed-interval
    199 
    200 <procedure>(check-half-closed-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
    201 
    202 {{NUM}} in {{[MINNUM MAXNUM[}}.
    203 
    204 Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
    205 
    206 ==== check-range
    207 
    208 <procedure>(check-range LOC START END [ARGNAM]) -> number number</procedure>
    209 
    210 Verify {{(<= START END)}} & return {{(values START END)}}.
    211 
    212 Does not verify the type of {{START}} and {{END}}, but assumes {{(or fixnum
    213 flonum)}}.
    21479
    21580==== define-check-type
     
    253118</enscript>
    254119
     120==== Usage
     121
     122<enscript language=scheme>
     123(import type-checks-numbers)
     124</enscript>
     125
     126==== check-fixnum
     127==== check-positive-fixnum
     128==== check-natural-fixnum
     129==== check-negative-fixnum
     130==== check-non-positive-fixnum
     131
     132<procedure>(check-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
     133<procedure>(check-positive-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
     134<procedure>(check-natural-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
     135<procedure>(check-negative-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
     136<procedure>(check-non-positive-fixnum LOC OBJ [ARGNAM]) --> fixnum</procedure>
     137
     138==== check-integer
     139==== check-positive-integer
     140==== check-natural-integer
     141==== check-negative-integer
     142==== check-non-positive-integer
     143
     144<procedure>(check-integer LOC OBJ [ARGNAM]) --> integer</procedure>
     145<procedure>(check-positive-integer LOC OBJ [ARGNAM]) --> integer</procedure>
     146<procedure>(check-natural-integer LOC OBJ [ARGNAM]) --> integer</procedure>
     147<procedure>(check-negative-integer LOC OBJ [ARGNAM]) --> integer</procedure>
     148<procedure>(check-non-positive-integer LOC OBJ [ARGNAM]) --> integer</procedure>
     149
     150==== check-number
     151==== check-positive-number
     152==== check-natural-number
     153==== check-negative-number
     154==== check-non-positive-number
     155
     156<procedure>(check-number LOC OBJ [ARGNAM]) --> number</procedure>
     157<procedure>(check-positive-number LOC OBJ [ARGNAM]) --> number</procedure>
     158<procedure>(check-natural-number LOC OBJ [ARGNAM]) --> number</procedure>
     159<procedure>(check-negative-number LOC OBJ [ARGNAM]) --> number</procedure>
     160<procedure>(check-non-positive-number LOC OBJ [ARGNAM]) --> number</procedure>
     161
     162==== check-flonum
     163
     164<procedure>(check-flonum LOC OBJ [ARGNAM]) -> flonum</procedure>
     165
     166==== check-open-interval
     167
     168<procedure>(check-open-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
     169
     170{{NUM}} in {{]MINNUM MAXNUM[}}.
     171
     172Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
     173
     174==== check-closed-interval
     175
     176<procedure>(check-closed-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
     177
     178{{NUM}} in {{[MINNUM MAXNUM]}}.
     179
     180Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
     181
     182==== check-half-open-interval
     183
     184<procedure>(check-half-open-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
     185
     186{{NUM}} in {{]MINNUM MAXNUM]}}.
     187
     188Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
     189
     190==== check-half-closed-interval
     191
     192<procedure>(check-half-closed-interval LOC NUM MINNUM MAXNUM [ARGNAM]) -> *</procedure>
     193
     194{{NUM}} in {{[MINNUM MAXNUM[}}.
     195
     196Does not verify the type of {{NUM}}, {{MINNUM}}, and {{MAXNUM}}.
     197
     198==== check-range
     199
     200<procedure>(check-range LOC START END [ARGNAM]) -> number number</procedure>
     201
     202Verify {{(<= START END)}} & return {{(values START END)}}.
     203
     204Does not verify the type of {{START}} and {{END}}, but assumes {{(or fixnum
     205flonum)}}.
     206
     207==== Usage
     208
     209<enscript language=scheme>
     210(import type-checks-structured)
     211</enscript>
     212
     213==== check-procedure
     214
     215<procedure>(check-procedure LOC OBJ [ARGNAM]) -> *</procedure>
     216
     217==== check-input-port
     218
     219<procedure>(check-input-port LOC OBJ [ARGNAM]) -> *</procedure>
     220
     221==== check-output-port
     222
     223<procedure>(check-output-port LOC OBJ [ARGNAM]) -> *</procedure>
     224
     225==== check-list
     226
     227<procedure>(check-list LOC OBJ [ARGNAM]) -> *</procedure>
     228
     229==== check-alist
     230
     231<procedure>(check-alist LOC OBJ [ARGNAM]) -> *</procedure>
     232
     233==== check-plist
     234
     235<procedure>(check-plist LOC OBJ [ARGNAM]) -> *</procedure>
     236
     237==== check-pair
     238
     239<procedure>(check-pair LOC OBJ [ARGNAM]) -> *</procedure>
     240
     241==== check-blob
     242
     243<procedure>(check-blob LOC OBJ [ARGNAM]) -> *</procedure>
     244
     245==== check-vector
     246
     247<procedure>(check-vector LOC OBJ [ARGNAM]) -> *</procedure>
     248
     249==== check-structure
     250
     251<procedure>(check-structure LOC OBJ TAG [ARGNAM]) -> *</procedure>
     252<procedure>(check-record LOC OBJ TAG [ARGNAM]) -> *</procedure>
     253<procedure>(check-record-type LOC OBJ TAG [ARGNAM]) -> *</procedure>
     254
     255{{check-record}} and {{check-record-type}} are essentially synonyms.
     256
     257==== check-string
     258
     259<procedure>(check-string LOC OBJ [ARGNAM]) -> *</procedure>
     260
     261==== Usage
     262
     263<enscript language=scheme>
     264(import type-checks-atoms)
     265</enscript>
     266
     267==== check-symbol
     268
     269<procedure>(check-symbol LOC OBJ [ARGNAM]) -> *</procedure>
     270
     271==== check-keyword
     272
     273<procedure>(check-keyword LOC OBJ [ARGNAM]) -> *</procedure>
     274
     275==== check-char
     276
     277<procedure>(check-char LOC OBJ [ARGNAM]) -> *</procedure>
     278
     279==== check-boolean
     280
     281<procedure>(check-boolean LOC OBJ [ARGNAM]) -> *</procedure>
     282
    255283
    256284=== Type Errors
     
    266294<enscript language=scheme>
    267295(import type-errors)
     296</enscript>
     297
     298==== Usage
     299
     300<enscript language=scheme>
     301(import type-errors-basic)
    268302</enscript>
    269303
     
    347381
    348382<procedure>(error-bound-value LOC OBJ [ARGNAM])</procedure>
     383
     384==== error-minimum-argument-count
     385
     386<procedure>(error-minimum-argument-count LOC ARGC MINARGC)</procedure>
     387
     388==== error-argument-count
     389
     390<procedure>(error-argument-count LOC ARGC MAXARGC)</procedure>
     391
     392==== define-error-type
     393
     394<macro>(define-error-type TYPNAM [TYPMSG])</macro>
     395
     396{{TYPNAM}} is a {{symbol}}.
     397
     398{{TYPMSG}} is a {{symbol}} or {{string}}.
     399
     400Creates a procedure definition for {{error-TYPNAM}} with the signature of the
     401above error procedures. The type-name is either {{TYPMSG}}, when present,
     402or {{"TYPNAM"}}.
     403
     404<enscript language=scheme>
     405(define-error-type hash-table)
     406;=>
     407;(define (error-hash-table loc obj #!optional argnam)
     408;  (error-argument-type loc obj "hash-table" argnam) )
     409
     410(define-error-type byte-order "symbol in {big-endian little-endian}")
     411;=>
     412;(define (error-byte-order loc obj #!optional argnam)
     413;  (error-argument-type loc obj "symbol in {big-endian little-endian}" argnam) )
     414</enscript>
     415
     416==== Usage
     417
     418<enscript language=scheme>
     419(import type-errors-numbers)
     420</enscript>
    349421
    350422==== error-fixnum
     
    388460<procedure>(error-flonum LOC OBJ [ARGNAM])</procedure>
    389461
    390 ==== error-procedure
    391 
    392 <procedure>(error-procedure LOC OBJ [ARGNAM])</procedure>
    393 
    394 ==== error-input-port
    395 
    396 <procedure>(error-input-port LOC OBJ [ARGNAM])</procedure>
    397 
    398 ==== error-output-port
    399 
    400 <procedure>(error-output-port LOC OBJ [ARGNAM])</procedure>
    401 
    402 ==== error-list
    403 
    404 <procedure>(error-list LOC OBJ [ARGNAM])</procedure>
    405 
    406 ==== error-pair
    407 
    408 <procedure>(error-pair LOC OBJ [ARGNAM])</procedure>
    409 
    410 ==== error-blob
    411 
    412 <procedure>(error-blob LOC OBJ [ARGNAM])</procedure>
    413 
    414 ==== error-vector
    415 
    416 <procedure>(error-vector LOC OBJ [ARGNAM])</procedure>
    417 
    418 ==== error-structure
    419 
    420 <procedure>(error-structure LOC OBJ TAG [ARGNAM])</procedure>
    421 
    422 {{error-record}} and {{error-record-type}} are essentially synonyms.
    423 
    424 ==== error-symbol
    425 
    426 <procedure>(error-symbol LOC OBJ [ARGNAM])</procedure>
    427 
    428 ==== error-keyword
    429 
    430 <procedure>(error-keyword LOC OBJ [ARGNAM])</procedure>
    431 
    432 ==== error-string
    433 
    434 <procedure>(error-string LOC OBJ [ARGNAM])</procedure>
    435 
    436 ==== error-char
    437 
    438 <procedure>(error-char LOC OBJ [ARGNAM])</procedure>
    439 
    440 ==== error-boolean
    441 
    442 <procedure>(error-boolean LOC OBJ [ARGNAM])</procedure>
    443 
    444 ==== error-alist
    445 
    446 <procedure>(error-alist LOC OBJ [ARGNAM])</procedure>
    447 
    448 ==== error-minimum-argument-count
    449 
    450 <procedure>(error-minimum-argument-count LOC ARGC MINARGC)</procedure>
    451 
    452 ==== error-argument-count
    453 
    454 <procedure>(error-argument-count LOC ARGC MAXARGC)</procedure>
    455 
    456462==== error-open-interval
    457463
     
    484490symbolic closing of an interval.
    485491
    486 ==== define-error-type
    487 
    488 <macro>(define-error-type TYPNAM [TYPMSG])</macro>
    489 
    490 {{TYPNAM}} is a {{symbol}}.
    491 
    492 {{TYPMSG}} is a {{symbol}} or {{string}}.
    493 
    494 Creates a procedure definition for {{error-TYPNAM}} with the signature of the
    495 above error procedures. The type-name is either {{TYPMSG}}, when present,
    496 or {{"TYPNAM"}}.
    497 
    498 <enscript language=scheme>
    499 (define-error-type hash-table)
    500 ;=>
    501 ;(define (error-hash-table loc obj #!optional argnam)
    502 ;  (error-argument-type loc obj "hash-table" argnam) )
    503 
    504 (define-error-type byte-order "symbol in {big-endian little-endian}")
    505 ;=>
    506 ;(define (error-byte-order loc obj #!optional argnam)
    507 ;  (error-argument-type loc obj "symbol in {big-endian little-endian}" argnam) )
    508 </enscript>
     492==== Usage
     493
     494<enscript language=scheme>
     495(import type-errors-structured)
     496</enscript>
     497
     498==== error-procedure
     499
     500<procedure>(error-procedure LOC OBJ [ARGNAM])</procedure>
     501
     502==== error-input-port
     503
     504<procedure>(error-input-port LOC OBJ [ARGNAM])</procedure>
     505
     506==== error-output-port
     507
     508<procedure>(error-output-port LOC OBJ [ARGNAM])</procedure>
     509
     510==== error-list
     511
     512<procedure>(error-list LOC OBJ [ARGNAM])</procedure>
     513
     514==== error-alist
     515
     516<procedure>(error-alist LOC OBJ [ARGNAM])</procedure>
     517
     518==== error-plist
     519
     520<procedure>(error-plist LOC OBJ [ARGNAM])</procedure>
     521
     522==== error-pair
     523
     524<procedure>(error-pair LOC OBJ [ARGNAM])</procedure>
     525
     526==== error-blob
     527
     528<procedure>(error-blob LOC OBJ [ARGNAM])</procedure>
     529
     530==== error-vector
     531
     532<procedure>(error-vector LOC OBJ [ARGNAM])</procedure>
     533
     534==== error-structure
     535
     536<procedure>(error-structure LOC OBJ TAG [ARGNAM])</procedure>
     537
     538{{error-record}} and {{error-record-type}} are essentially synonyms.
     539
     540==== error-string
     541
     542<procedure>(error-string LOC OBJ [ARGNAM])</procedure>
     543
     544==== Usage
     545
     546<enscript language=scheme>
     547(import type-errors-atoms)
     548</enscript>
     549
     550==== error-symbol
     551
     552<procedure>(error-symbol LOC OBJ [ARGNAM])</procedure>
     553
     554==== error-keyword
     555
     556<procedure>(error-keyword LOC OBJ [ARGNAM])</procedure>
     557
     558==== error-char
     559
     560<procedure>(error-char LOC OBJ [ARGNAM])</procedure>
     561
     562==== error-boolean
     563
     564<procedure>(error-boolean LOC OBJ [ARGNAM])</procedure>
    509565
    510566
     
    518574
    519575==== check-s8vector
     576==== check-u8vector
     577==== check-s16vector
     578==== check-u16vector
     579==== check-s32vector
     580==== check-u32vector
     581==== check-s64vector
     582==== check-u64vector
     583==== check-f32vector
     584==== check-f64vector
    520585
    521586<procedure>(check-s8vector LOC OBJ [ARGNAM]) -> *</procedure>
    522 
    523 ==== check-u8vector
    524 
    525587<procedure>(check-u8vector LOC OBJ [ARGNAM]) -> *</procedure>
    526 
    527 ==== check-s16vector
    528 
    529588<procedure>(check-s16vector LOC OBJ [ARGNAM]) -> *</procedure>
    530 
    531 ==== check-u16vector
    532 
    533589<procedure>(check-u16vector LOC OBJ [ARGNAM]) -> *</procedure>
    534 
    535 ==== check-s32vector
    536 
    537590<procedure>(check-s32vector LOC OBJ [ARGNAM]) -> *</procedure>
    538 
    539 ==== check-u32vector
    540 
    541591<procedure>(check-u32vector LOC OBJ [ARGNAM]) -> *</procedure>
    542 
    543 ==== check-s64vector
    544 
    545592<procedure>(check-s64vector LOC OBJ [ARGNAM]) -> *</procedure>
    546 
    547 ==== check-u64vector
    548 
    549593<procedure>(check-u64vector LOC OBJ [ARGNAM]) -> *</procedure>
    550 
    551 ==== check-f32vector
    552 
    553594<procedure>(check-f32vector LOC OBJ [ARGNAM]) -> *</procedure>
    554 
    555 ==== check-f64vector
    556 
    557595<procedure>(check-f64vector LOC OBJ [ARGNAM]) -> *</procedure>
    558596
     
    567605
    568606==== error-s8vector
     607==== error-u8vector
     608==== error-s16vector
     609==== error-u16vector
     610==== error-s32vector
     611==== error-u32vector
     612==== error-s64vector
     613==== error-u64vector
     614==== error-f32vector
     615==== error-f64vector
    569616
    570617<procedure>(error-s8vector LOC OBJ [ARGNAM])</procedure>
    571 
    572 ==== error-u8vector
    573 
    574618<procedure>(error-u8vector LOC OBJ [ARGNAM])</procedure>
    575 
    576 ==== error-s16vector
    577 
    578619<procedure>(error-s16vector LOC OBJ [ARGNAM])</procedure>
    579 
    580 ==== error-u16vector
    581 
    582620<procedure>(error-u16vector LOC OBJ [ARGNAM])</procedure>
    583 
    584 ==== error-s32vector
    585 
    586621<procedure>(error-s32vector LOC OBJ [ARGNAM])</procedure>
    587 
    588 ==== error-u32vector
    589 
    590622<procedure>(error-u32vector LOC OBJ [ARGNAM])</procedure>
    591 
    592 ==== error-s64vector
    593 
    594623<procedure>(error-s64vector LOC OBJ [ARGNAM])</procedure>
    595 
    596 ==== error-u64vector
    597 
    598624<procedure>(error-u64vector LOC OBJ [ARGNAM])</procedure>
    599 
    600 ==== error-f32vector
    601 
    602625<procedure>(error-f32vector LOC OBJ [ARGNAM])</procedure>
    603 
    604 ==== error-f64vector
    605 
    606626<procedure>(error-f64vector LOC OBJ [ARGNAM])</procedure>
    607627
     
    621641== Version history
    622642
     643; 3.1.0 ; Add {{type-errors/checks-basic/numbers/atoms/structured}} modules.
    623644; 3.0.0 ; CHICKEN 5 release.
    624645; 2.2.0 ; Fix {{check-range}} return.
Note: See TracChangeset for help on using the changeset viewer.