Annotation of gforth/errore.fs, revision 1.9

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"
        !            62: -28 ERR" User interupt"
        !            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: 
                     94: \ signals are handled with strsignal
                     95: \ but some signals produce throw-codes > -256, e.g., -28
                     96: \ signals: ( We list them all, except those already present, just in case )
                     97: \ -256 ERR" Hangup signal"
                     98: \ -257 ERR" Quit signal"
                     99: \ -258 ERR" Illegal Instruction"
                    100: \ -259 ERR" Trace Trap"
                    101: \ -260 ERR" IOT instruction"
                    102: \ -261 ERR" EMT instruction" \ abort() call?
                    103: \ -262 ERR" Kill signal" \ cannot be caught but so what
                    104: \ -263 ERR" Bad arg to system call"
                    105: \ -264 ERR" Broken pipe"
                    106: \ -265 ERR" Alarm signal"
                    107: \ -266 ERR" Terminate signal"
                    108: \ -267 ERR" User signal 1"
                    109: \ -268 ERR" User signal 2"
1.4       anton     110: \ error numbers between -512 and -2047 are for OS errors and are
                    111: \ handled with strerror
1.1       anton     112: 
                    113: : .error ( n -- )
1.4       anton     114:     cr ." Error: "
                    115:     ErrLink
                    116:     BEGIN @ dup
                    117:     WHILE
                    118:        2dup cell+ @ =
                    119:        IF 2 cells + count type drop exit THEN
                    120:     REPEAT
                    121:     drop
1.6       anton     122:     dup -511 -255 within
                    123:     IF
                    124:        256 + negate strsignal type exit
                    125:     THEN
1.5       anton     126:     dup -2047 -511 within
1.4       anton     127:     IF
                    128:        512 + negate strerror type exit
                    129:     THEN
                    130:     . ;
1.1       anton     131: 

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