File:  [gforth] / gforth / errors.fs
Revision 1.16: download - view: text, annotated - select for diffs
Sun Jan 14 22:19:35 2007 UTC (17 years, 3 months ago) by anton
Branches: MAIN
CVS tags: HEAD
lists and C prelude stuff in libcc.fs
minor changes

    1: \ Load in error strings
    2: 
    3: \ Copyright (C) 1995,1996,1997,1998,1999,2003 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., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
   20: 
   21: : linked ( addr -- )
   22:     here over @ a, swap ! ;
   23: 
   24: : errstring ( addr u n -- )
   25:     ErrLink linked
   26:     ,
   27:     string, align ;
   28: 
   29: decimal
   30: 
   31: -1 s" Aborted" rot errstring
   32: -3 s" Stack overflow" rot errstring
   33: -4 s" Stack underflow" rot errstring
   34: -5 s" Return stack overflow" rot errstring
   35: -6 s" Return stack underflow" rot errstring
   36: -7 s" Do-loops nested too deeply" rot errstring
   37: -8 s" Dictionary overflow" rot errstring
   38: -9 s" Invalid memory address" rot errstring
   39: -10 s" Division by zero" rot errstring
   40: -11 s" Result out of range" rot errstring
   41: -12 s" Argument type mismatch" rot errstring
   42: -13 s" Undefined word" rot errstring
   43: -14 s" Interpreting a compile-only word" rot errstring
   44: -15 s" Invalid FORGET" rot errstring
   45: -16 s" Attempt to use zero-length string as a name" rot errstring
   46: -17 s" Pictured numeric ouput string overflow" rot errstring
   47: -18 s" Parsed string overflow" rot errstring
   48: -19 s" Word name too long" rot errstring
   49: -20 s" Write to a read-only location" rot errstring
   50: -21 s" Unsupported operation" rot errstring
   51: -22 s" Control structure mismatch" rot errstring
   52: -23 s" Address alignment exception" rot errstring
   53: -24 s" Invalid numeric argument" rot errstring
   54: -25 s" Return stack imbalance" rot errstring
   55: -26 s" Loop parameters unavailable" rot errstring
   56: -27 s" Invalid recursion" rot errstring
   57: -28 s" User interrupt" rot errstring
   58: -29 s" Compiler nesting" rot errstring
   59: -30 s" Obsolescent feature" rot errstring
   60: -31 s" >BODY used on non-CREATEd definition" rot errstring
   61: -32 s" Invalid name argument" rot errstring
   62: -33 s" Block read exception" rot errstring
   63: -34 s" Block write exception" rot errstring
   64: -35 s" Invalid block number" rot errstring
   65: -36 s" Invalid file position" rot errstring
   66: -37 s" File I/O exception" rot errstring
   67: -38 s" Non-existent file" rot errstring
   68: -39 s" Unexpected end of file" rot errstring
   69: -40 s" Invalid BASE for floating point conversion" rot errstring
   70: -41 s" Loss of precision" rot errstring
   71: -42 s" Floating-point divide by zero" rot errstring
   72: -43 s" Floating-point result out of range" rot errstring
   73: -44 s" Floating-point stack overflow" rot errstring
   74: -45 s" Floating-point stack underflow" rot errstring
   75: -46 s" Floating-point invalid argument" rot errstring
   76: -47 s" Compilation word list deleted" rot errstring
   77: -48 s" invalid POSTPONE" rot errstring
   78: -49 s" Search-order overflow" rot errstring
   79: -50 s" Search-order underflow" rot errstring
   80: -51 s" Compilation word list changed" rot errstring
   81: -52 s" Control-flow stack overflow" rot errstring
   82: -53 s" Exception stack overflow" rot errstring
   83: -54 s" Floating-point underflow" rot errstring
   84: -55 s" Floating-point unidentified fault" rot errstring
   85: -56 s" QUIT" rot errstring
   86: -57 s" Error in sending or receiving a character" rot errstring
   87: -58 s" [IF], [ELSE], [THEN] error" rot errstring
   88: 
   89: \ Gforth's errors:
   90: 
   91: -2048 s" Cannot tick compile-only word (try COMP' ... DROP)" rot errstring
   92: -2049 s" Write to broken pipe" rot errstring
   93: 
   94: variable next-exception -2050 next-exception !
   95: 
   96: : exception ( addr u -- n ) \ exception- gforth
   97:     \G @var{n} is a previously unused @code{throw} value in the range
   98:     \G (-4095...-256). Consecutive calls to @code{exception} return
   99:     \G consecutive decreasing numbers. Gforth uses the string
  100:     \G @var{addr u} as an error message.
  101:     next-exception @ errstring
  102:     next-exception @
  103:     -1 next-exception +! ;
  104: 
  105: -2049 constant broken-pipe-error ( -- n ) \ gforth
  106: \G the error number for a broken pipe
  107: 

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