Annotation of gforth/errore.fs, revision 1.10

1.1       anton       1: \ ERRORE.FS English error strings                      9may93jaw
                      2: 
1.7       anton       3: \ Copyright (C) 1995 Free Software Foundation, Inc.
                      4: 
                      5: \ This file is part of Gforth.
                      6: 
                      7: \ Gforth is free software; you can redistribute it and/or
                      8: \ modify it under the terms of the GNU General Public License
                      9: \ as published by the Free Software Foundation; either version 2
                     10: \ of the License, or (at your option) any later version.
                     11: 
                     12: \ This program is distributed in the hope that it will be useful,
                     13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: \ GNU General Public License for more details.
                     16: 
                     17: \ You should have received a copy of the GNU General Public License
                     18: \ along with this program; if not, write to the Free Software
                     19: \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
                     20: 
                     21: 
1.1       anton      22: \ The errors are defined by a linked list, for easy adding
                     23: \ and deleting. Speed is not neccassary at this point.
                     24: 
                     25: AVARIABLE ErrLink              \ Linked list entry point
1.8       pazsan     26: NIL ErrLink !
1.1       anton      27: 
                     28: : ERR" ( n -- )
                     29:        ErrLink linked
                     30:        ,
1.8       pazsan     31:        [char] " parse
1.3       anton      32:        string, align ;
1.1       anton      33: 
                     34: decimal
                     35: 
                     36: -1 ERR" Aborted"
1.9       anton      37: -3 ERR" Stack overflow"
                     38: -4 ERR" Stack underflow"
                     39: -5 ERR" Return stack overflow"
                     40: -6 ERR" Return stack undeflow"
                     41: -7 ERR" Do-loops nested too deeply"
                     42: -8 ERR" Dictionary overflow"
                     43: -9 ERR" Invalid memory address"
                     44: -10 ERR" Division by zero"
                     45: -11 ERR" Result out of range"
                     46: -12 ERR" Argument type mismatch"
                     47: -13 ERR" Undefined word"
                     48: -14 ERR" Interpreting a compile-only word"
                     49: -15 ERR" Invalid FORGET"
                     50: -16 ERR" Attempt to use zero-length string as a name"
1.1       anton      51: -17 ERR" Pictured numeric ouput string overflow"
1.9       anton      52: -18 ERR" Parsed string overflow"
                     53: -19 ERR" Word name too long"
                     54: -20 ERR" Write to a read-only location"
                     55: -21 ERR" Unsupported operation"
                     56: -22 ERR" Control structure mismatch"
                     57: -23 ERR" Address alignment exception"
                     58: -24 ERR" Invalid numeric argument"
                     59: -25 ERR" Return stack imbalance"
                     60: -26 ERR" Loop parameters unavailable"
                     61: -27 ERR" Invalid recursion"
1.10    ! anton      62: -28 ERR" User interrupt"
1.9       anton      63: -29 ERR" Compiler nesting"
                     64: -30 ERR" Obsolescent feature"
                     65: -31 ERR" >BODY used on non-CREATEd definition"
                     66: -32 ERR" Invalid name argument"
                     67: -33 ERR" Block read exception"
                     68: -34 ERR" Block write exception"
                     69: -35 ERR" Invalid block number"
                     70: -36 ERR" Invalid file position"
                     71: -37 ERR" File I/O exception"
                     72: -38 ERR" Non-existent file"
                     73: -39 ERR" Unexpected end of file"
1.1       anton      74: -40 ERR" Invalid BASE for floating point conversion"
1.9       anton      75: -41 ERR" Loss of precision"
                     76: -42 ERR" Floating-point divide by zero"
1.1       anton      77: -43 ERR" Floating-point result out of range"
1.9       anton      78: -44 ERR" Floating-point stack overflow"
                     79: -45 ERR" Floating-point stack underflow"
1.1       anton      80: -46 ERR" Floating-point invalid argument"
1.9       anton      81: -47 ERR" Compilation word list deleted"
                     82: -48 ERR" invalid POSTPONE"
                     83: -49 ERR" Search-order overflow"
                     84: -50 ERR" Search-order underflow"
                     85: -51 ERR" Compilation word list changed"
                     86: -52 ERR" Control-flow stack overflow"
                     87: -53 ERR" Exception stack overflow"
                     88: -54 ERR" Floating-point underflow"
1.1       anton      89: -55 ERR" Floating-point unidentified fault"
1.9       anton      90: -56 ERR" QUIT"
                     91: -57 ERR" Error in sending or receiving a character"
1.1       anton      92: -58 ERR" [IF], [ELSE], [THEN] error"
1.6       anton      93: 
1.10    ! anton      94: \ error numbers between -256 and -511 represent signals
1.6       anton      95: \ signals are handled with strsignal
                     96: \ but some signals produce throw-codes > -256, e.g., -28
1.10    ! anton      97: 
1.4       anton      98: \ error numbers between -512 and -2047 are for OS errors and are
                     99: \ handled with strerror
1.1       anton     100: 
                    101: : .error ( n -- )
1.4       anton     102:     cr ." Error: "
                    103:     ErrLink
                    104:     BEGIN @ dup
                    105:     WHILE
                    106:        2dup cell+ @ =
                    107:        IF 2 cells + count type drop exit THEN
                    108:     REPEAT
                    109:     drop
1.6       anton     110:     dup -511 -255 within
                    111:     IF
                    112:        256 + negate strsignal type exit
                    113:     THEN
1.5       anton     114:     dup -2047 -511 within
1.4       anton     115:     IF
                    116:        512 + negate strerror type exit
                    117:     THEN
                    118:     . ;
1.1       anton     119: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>