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