Annotation of gforth/errore.fs, revision 1.8

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"
                     37: -3 ERR" Stack overflow"                 -4 ERR" Stack underflow"
                     38: -5 ERR" Return stack overflow"          -6 ERR" Return stack undeflow"
                     39: -7 ERR" Do-loops nested too deeply"     -8 ERR" Dictionary overflow"
                     40: -9 ERR" Invalid memory address"         -10 ERR" Division by zero"
                     41: -11 ERR" Result out of range"           -12 ERR" Argument type mismatch"
                     42: -13 ERR" Undefined word"                -14 ERR" Interpreting a compile-only word"
                     43: -15 ERR" Invalid FORGET"                -16 ERR" Attempt to use zero-length string as a name"
                     44: -17 ERR" Pictured numeric ouput string overflow"
                     45: -18 ERR" Parsed string overflow"        -19 ERR" Word name too long"
                     46: -20 ERR" Write to a read-only location" -21 ERR" Unsupported operation"
                     47: -22 ERR" Control structure mismatch"    -23 ERR" Address alignment exception"
                     48: -24 ERR" Invalid numeric argument"      -25 ERR" Return stack imbalance"
                     49: -26 ERR" Loop parameters unavailable"   -27 ERR" Invalid recursion"
                     50: -28 ERR" User interupt"                 -29 ERR" Compiler nesting"
                     51: -30 ERR" Obsolescent feature"           -31 ERR" >BODY used on non-CREATEd definition"
                     52: -32 ERR" Invalid name argument"         -33 ERR" Block read exception"
                     53: -34 ERR" Block write exception"         -35 ERR" Invalid block number"
                     54: -36 ERR" Invalid file position"         -37 ERR" File I/O exception"
                     55: -38 ERR" Non-existent file"             -39 ERR" Unexpected end of file"
                     56: -40 ERR" Invalid BASE for floating point conversion"
                     57: -41 ERR" Loss of precision"             -42 ERR" Floating-point divide by zero"
                     58: -43 ERR" Floating-point result out of range"
                     59: -44 ERR" Floating-point stack overflow" -45 ERR" Floating-point stack underflow"
                     60: -46 ERR" Floating-point invalid argument"
                     61: -47 ERR" Compilation word list deleted" -48 ERR" invalid POSTPONE"
                     62: -49 ERR" Search-order overflow"         -50 ERR" Search-order underflow"
                     63: -51 ERR" Compilation word list changed" -52 ERR" Control-flow stack overflow"
                     64: -53 ERR" Exception stack overflow"      -54 ERR" Floating-point underflow"
                     65: -55 ERR" Floating-point unidentified fault"
                     66: -56 ERR" QUIT"                          -57 ERR" Error in sending or receiving a character"
                     67: -58 ERR" [IF], [ELSE], [THEN] error"
1.6       anton      68: 
                     69: \ signals are handled with strsignal
                     70: \ but some signals produce throw-codes > -256, e.g., -28
                     71: \ signals: ( We list them all, except those already present, just in case )
                     72: \ -256 ERR" Hangup signal"
                     73: \ -257 ERR" Quit signal"
                     74: \ -258 ERR" Illegal Instruction"
                     75: \ -259 ERR" Trace Trap"
                     76: \ -260 ERR" IOT instruction"
                     77: \ -261 ERR" EMT instruction" \ abort() call?
                     78: \ -262 ERR" Kill signal" \ cannot be caught but so what
                     79: \ -263 ERR" Bad arg to system call"
                     80: \ -264 ERR" Broken pipe"
                     81: \ -265 ERR" Alarm signal"
                     82: \ -266 ERR" Terminate signal"
                     83: \ -267 ERR" User signal 1"
                     84: \ -268 ERR" User signal 2"
1.4       anton      85: \ error numbers between -512 and -2047 are for OS errors and are
                     86: \ handled with strerror
1.1       anton      87: 
                     88: : .error ( n -- )
1.4       anton      89:     cr ." Error: "
                     90:     ErrLink
                     91:     BEGIN @ dup
                     92:     WHILE
                     93:        2dup cell+ @ =
                     94:        IF 2 cells + count type drop exit THEN
                     95:     REPEAT
                     96:     drop
1.6       anton      97:     dup -511 -255 within
                     98:     IF
                     99:        256 + negate strsignal type exit
                    100:     THEN
1.5       anton     101:     dup -2047 -511 within
1.4       anton     102:     IF
                    103:        512 + negate strerror type exit
                    104:     THEN
                    105:     . ;
1.1       anton     106: 

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