Changeset 15996 in project


Ignore:
Timestamp:
09/20/09 22:05:48 (10 years ago)
Author:
Kon Lovett
Message:

Rel 1.5.0

File:
1 edited

Legend:

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

    r15745 r15996  
    1111
    1212
    13 === Conditions
    14 
    15 <enscript language=scheme>
    16 (require-extension conditions)
    17 </enscript>
    18 
    19 ==== make-exn-condition
    20 
    21 <procedure>(make-exn-condition LOCATION MESSAGE ARGUMENTS) => PROPERTY-CONDITION</procedure>
    22 
    23 {{LOCATION}} is a {{symbol}}.
    24 
    25 {{MESSAGE}} is a {{string}}.
    26 
    27 {{ARGUMENTS}} is a {{list}}.
    28 
    29 {{LOCATION}}, {{MESSAGE}} and {{ARGUMENTS}} maybe {{#f}}.
    30 
    31 Returns an {{exn}} {{property-condition}} with optional {{location}},
    32 {{message}} and {{arguments}} properties.
    33 
    34 ==== make-exn-condition+
    35 
    36 <procedure>(make-exn-condition+ LOCATION MESSAGE ARGUMENTS [CONDITION...]) => PROPERTY-CONDITION</procedure>
    37 
    38 {{LOCATION}}, {{MESSAGE}} and {{ARGUMENTS}} as {{make-exn-condition}}.
    39 
    40 {{CONDITION}} is a:
    41 
    42 ; {{property-condition}} : literal
    43 ; {{symbol}} : {{(make-property-condition <symbol>)}}
    44 ; {{list}} : {{(apply make-property-condition <list>)}}
    45 
    46 Returns a {{composite-condition}} {{exn CONDITION...}}.
    47 
    48 ==== make-condition+
    49 
    50 <procedure>(make-condition+ CONDITION...) => PROPERTY-CONDITION</procedure>
    51 
    52 {{CONDITION}} as {{make-exn-condition+}}
    53 
    54 Returns a {{composite-condition}} {{CONDITION...}}.
    55 
    56 ==== condition-predicate*
    57 
    58 <procedure>(condition-predicate* KIND) => PROCEDURE/1</procedure>
    59 
    60 Returns a "memioized" {{condition-predicate}} for {{KIND}}.
    61 
    62 {{KIND}} is a {{symbol}}.
    63 
    64 ==== make-condition-predicate
    65 
    66 <syntax>(make-condition-predicate KIND...) => PROCEDURE/1</syntax>
    67 
    68 Returns a {{condition-predicate}} for {{KIND...}}.
    69 
    70 {{KIND}} is a {{symbol}}.
    71 
    72 ==== condition-property-accessor*
    73 
    74 <procedure>(condition-property-accessor* KIND PROP [DEFAULT]) => PROCEDURE/1</procedure>
    75 
    76 Returns a "memioized" {{condition-property-accessor}} for {{KIND}}.
    77 
    78 {{KIND}} and {{PROP}} are {{symbol}}.
    79 
    80 ==== make-condition-property-accessor
    81 
    82 <syntax>(make-condition-property-accessor KIND PROP [DEFAULT]) => PROCEDURE/1</syntax>
    83 
    84 Returns a {{condition-property-accessor}} for {{KIND PROP}}.
    85 
    86 {{KIND}} and {{PROP}} are {{symbol}}.
    87 
    88 
    89 === Type Errors
    90 
    91 <enscript language=scheme>
    92 (require-extension type-errors)
    93 </enscript>
    94 
    95 ==== make-error-type-message
    96 
    97 <procedure>(make-error-type-message TYPE-NAME [ARGUMENT-NAME]) => STRING</procedure>
    98 
    99 {{TYPE-NAME}} and {{ARGUMENT-NAME}} are a {{symbol}} or {{string}}.
    100 
    101 Returns a type error message from the {{TYPE-NAME}} and optional {{ARGUMENT-NAME}}.
    102 
    103 Example:
    104 
    105 <enscript language=scheme>
    106 (make-error-type-message 'integer "count") ;=> "bad `count' argument type - not an integer"
    107 </enscript>
    108 
    109 ==== signal-type-error
    110 
    111 <procedure>(signal-type-error LOCATION MESSAGE OBJECT...)</procedure>
    112 
    113 Raises a non-continuable type error - (({exn type)}}.
    114 
    115 ==== error-argument-type
    116 
    117 <procedure>(error-argument-type LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    118 
    119 {{TYPE-NAME}} is a {{symbol}} or {{string}}. {{ARGUMENT-NAME}} is a {{string}}.
    120 
    121 Raises a {{type-error}} where is message is constructed from the {{TYPE-NAME}}
    122 and optional {{ARGUMENT-NAME}}.
    123 
    124 ==== warning-argument-type
    125 
    126 <procedure>(warning-argument-type LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    127 
    128 A warning is issued with a message similar to that of {{error-argument-type}}.
    129 
    130 ==== error-fixnum
    131 
    132 <procedure>(error-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    133 
    134 ==== error-positive-fixnum
    135 
    136 <procedure>(error-positive-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    137 
    138 ==== error-cardinal-fixnum
    139 
    140 <procedure>(error-cardinal-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    141 
    142 ==== error-flonum
    143 
    144 <procedure>(error-flonum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    145 
    146 ==== error-integer
    147 
    148 <procedure>(error-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    149 
    150 ==== error-positive-integer
    151 
    152 <procedure>(error-positive-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    153 
    154 ==== error-cardinal-integer
    155 
    156 <procedure>(error-cardinal-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    157 
    158 ==== error-number
    159 
    160 <procedure>(error-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    161 
    162 ==== error-positive-number
    163 
    164 <procedure>(error-positive-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    165 
    166 ==== error-cardinal-number
    167 
    168 <procedure>(error-cardinal-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    169 
    170 ==== error-procedure
    171 
    172 <procedure>(error-procedure LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    173 
    174 ==== error-input-port
    175 
    176 <procedure>(error-input-port LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    177 
    178 ==== error-output-port
    179 
    180 <procedure>(error-output-port LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    181 
    182 ==== error-list
    183 
    184 <procedure>(error-list LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    185 
    186 ==== error-pair
    187 
    188 <procedure>(error-pair LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    189 
    190 ==== error-blob
    191 
    192 <procedure>(error-blob LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    193 
    194 ==== error-vector
    195 
    196 <procedure>(error-vector LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    197 
    198 ==== error-structure
    199 
    200 <procedure>(error-structure LOCATION OBJECT TAG [ARGUMENT-NAME])</procedure>
    201 
    202 ==== error-symbol
    203 
    204 <procedure>(error-symbol LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    205 
    206 ==== error-keyword
    207 
    208 <procedure>(error-keyword LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    209 
    210 ==== error-string
    211 
    212 <procedure>(error-string LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    213 
    214 ==== error-char
    215 
    216 <procedure>(error-char LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    217 
    218 ==== error-boolean
    219 
    220 <procedure>(error-boolean LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
    221 
    222 ==== define-error-type
    223 
    224 <syntax>(define-error-type TYPE [MESSAGE])</syntax>
    225 
    226 Creates a procedure definition for {{error-TYPE}} with the signature of the
    227 above error procedures. The error message is either {{MESSAGE}}, when present,
    228 or {{"TYPE"}}.
    229 
    230 <enscript language=scheme>
    231 (define-error-type hash-table)
    232 ;=> (define (error-hash-table loc obj #!optional argnam)
    233 ;     (error-argument-type loc obj "hash-table" argnam) )
    234 </enscript>
    235 
    236 
    23713=== Type Checks
    23814
     
    334110
    335111<procedure>(check-boolean LOCATION OBJECT [ARGUMENT-NAME])</procedure>
     112
     113==== check-alist
     114
     115<procedure>(check-alist LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     116
     117==== check-minimum-argument-count
     118
     119<procedure>(check-minimum-argument-count LOCATION ARGC MINARGC)</procedure>
     120
     121==== check-argument-count
     122
     123<procedure>(check-argument-count LOCATION ARGC MAXARGC)</procedure>
    336124
    337125==== define-check-type
     
    367155
    368156
     157=== Type Errors
     158
     159<enscript language=scheme>
     160(require-extension type-errors)
     161</enscript>
     162
     163==== make-error-type-message
     164
     165<procedure>(make-error-type-message TYPE-NAME [ARGUMENT-NAME]) => STRING</procedure>
     166
     167{{TYPE-NAME}} and {{ARGUMENT-NAME}} are a {{symbol}} or {{string}}.
     168
     169Returns a type error message from the {{TYPE-NAME}} and optional {{ARGUMENT-NAME}}.
     170
     171Example:
     172
     173<enscript language=scheme>
     174(make-error-type-message 'integer "count") ;=> "bad `count' argument type - not an integer"
     175</enscript>
     176
     177==== signal-type-error
     178
     179<procedure>(signal-type-error LOCATION MESSAGE OBJECT...)</procedure>
     180
     181Raises a non-continuable type error - (({exn type)}}.
     182
     183==== error-argument-type
     184
     185<procedure>(error-argument-type LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     186
     187{{TYPE-NAME}} is a {{symbol}} or {{string}}. {{ARGUMENT-NAME}} is a {{string}}.
     188
     189Raises a {{type-error}} where is message is constructed from the {{TYPE-NAME}}
     190and optional {{ARGUMENT-NAME}}.
     191
     192==== warning-argument-type
     193
     194<procedure>(warning-argument-type LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     195
     196A warning is issued with a message similar to that of {{error-argument-type}}.
     197
     198==== error-fixnum
     199
     200<procedure>(error-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     201
     202==== error-positive-fixnum
     203
     204<procedure>(error-positive-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     205
     206==== error-cardinal-fixnum
     207
     208<procedure>(error-cardinal-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     209
     210==== error-flonum
     211
     212<procedure>(error-flonum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     213
     214==== error-integer
     215
     216<procedure>(error-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     217
     218==== error-positive-integer
     219
     220<procedure>(error-positive-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     221
     222==== error-cardinal-integer
     223
     224<procedure>(error-cardinal-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     225
     226==== error-number
     227
     228<procedure>(error-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     229
     230==== error-positive-number
     231
     232<procedure>(error-positive-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     233
     234==== error-cardinal-number
     235
     236<procedure>(error-cardinal-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     237
     238==== error-procedure
     239
     240<procedure>(error-procedure LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     241
     242==== error-input-port
     243
     244<procedure>(error-input-port LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     245
     246==== error-output-port
     247
     248<procedure>(error-output-port LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     249
     250==== error-list
     251
     252<procedure>(error-list LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     253
     254==== error-pair
     255
     256<procedure>(error-pair LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     257
     258==== error-blob
     259
     260<procedure>(error-blob LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     261
     262==== error-vector
     263
     264<procedure>(error-vector LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     265
     266==== error-structure
     267
     268<procedure>(error-structure LOCATION OBJECT TAG [ARGUMENT-NAME])</procedure>
     269
     270==== error-symbol
     271
     272<procedure>(error-symbol LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     273
     274==== error-keyword
     275
     276<procedure>(error-keyword LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     277
     278==== error-string
     279
     280<procedure>(error-string LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     281
     282==== error-char
     283
     284<procedure>(error-char LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     285
     286==== error-boolean
     287
     288<procedure>(error-boolean LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     289
     290==== error-alist
     291
     292<procedure>(error-alist LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])</procedure>
     293
     294==== error-minimum-argument-count
     295
     296<procedure>(error-minimum-argument-count LOCATION ARGC MINARGC)</procedure>
     297
     298==== error-argument-count
     299
     300<procedure>(error-argument-count LOCATION ARGC MAXARGC)</procedure>
     301
     302==== define-error-type
     303
     304<syntax>(define-error-type TYPE [MESSAGE])</syntax>
     305
     306Creates a procedure definition for {{error-TYPE}} with the signature of the
     307above error procedures. The error message is either {{MESSAGE}}, when present,
     308or {{"TYPE"}}.
     309
     310<enscript language=scheme>
     311(define-error-type hash-table)
     312;=> (define (error-hash-table loc obj #!optional argnam)
     313;     (error-argument-type loc obj "hash-table" argnam) )
     314</enscript>
     315
     316
     317=== Conditions
     318
     319<enscript language=scheme>
     320(require-extension conditions)
     321</enscript>
     322
     323==== make-exn-condition
     324
     325<procedure>(make-exn-condition LOCATION MESSAGE ARGUMENTS) => PROPERTY-CONDITION</procedure>
     326
     327{{LOCATION}} is a {{symbol}}.
     328
     329{{MESSAGE}} is a {{string}}.
     330
     331{{ARGUMENTS}} is a {{list}}.
     332
     333{{LOCATION}}, {{MESSAGE}} and {{ARGUMENTS}} maybe {{#f}}.
     334
     335Returns an {{exn}} {{property-condition}} with optional {{location}},
     336{{message}} and {{arguments}} properties.
     337
     338==== make-exn-condition+
     339
     340<procedure>(make-exn-condition+ LOCATION MESSAGE ARGUMENTS [CONDITION...]) => PROPERTY-CONDITION</procedure>
     341
     342{{LOCATION}}, {{MESSAGE}} and {{ARGUMENTS}} as {{make-exn-condition}}.
     343
     344{{CONDITION}} is a:
     345
     346; {{property-condition}} : literal
     347; {{symbol}} : {{(make-property-condition <symbol>)}}
     348; {{list}} : {{(apply make-property-condition <list>)}}
     349
     350Returns a {{composite-condition}} {{exn CONDITION...}}.
     351
     352==== make-condition+
     353
     354<procedure>(make-condition+ CONDITION...) => PROPERTY-CONDITION</procedure>
     355
     356{{CONDITION}} as {{make-exn-condition+}}
     357
     358Returns a {{composite-condition}} {{CONDITION...}}.
     359
     360==== condition-predicate*
     361
     362<procedure>(condition-predicate* KIND) => PROCEDURE/1</procedure>
     363
     364Returns a "memioized" {{condition-predicate}} for {{KIND}}.
     365
     366{{KIND}} is a {{symbol}}.
     367
     368==== make-condition-predicate
     369
     370<syntax>(make-condition-predicate KIND...) => PROCEDURE/1</syntax>
     371
     372Returns a {{condition-predicate}} for {{KIND...}}.
     373
     374{{KIND}} is a {{symbol}}.
     375
     376==== condition-property-accessor*
     377
     378<procedure>(condition-property-accessor* KIND PROP [DEFAULT]) => PROCEDURE/1</procedure>
     379
     380Returns a "memioized" {{condition-property-accessor}} for {{KIND}}.
     381
     382{{KIND}} and {{PROP}} are {{symbol}}.
     383
     384==== make-condition-property-accessor
     385
     386<syntax>(make-condition-property-accessor KIND PROP [DEFAULT]) => PROCEDURE/1</syntax>
     387
     388Returns a {{condition-property-accessor}} for {{KIND PROP}}.
     389
     390{{KIND}} and {{PROP}} are {{symbol}}.
     391
     392
    369393== Usage
    370394
     
    389413== Version history
    390414
     415; 1.5.0 : Added alist and argument count support.
     416; 1.4.0 :
    391417; 1.3.0 : Added {{warning-argument-type}}.
    392418; 1.2.0 : Added {{make-error-type-message}} & fixed {{define-check+error-type}}.
Note: See TracChangeset for help on using the changeset viewer.