Forth Error Words
Home
Building
DHTML Scripting
Using Diaperglu
Documention Key
Script Commands Reference
C Library API Reference
Handy References
About
License
Contact
Forth Draft Standard
Directory
Documentation key
fortherror.cpp functions
dg_forthpushoerror
dg_forthpopoerror
dg_forthgetoerror
dg_forthgeterrorcount
dg_forthcheckerrordepth
dg_forthcompilegetolderrorcount
dg_forthdroptoerrorcount
dg_forthdoterrors
dg_clearerrors
dg_forthbracketwordnametoerror
dg_forthnametoe
dg_fortherrorquotes
dg_forthqueryerrorif
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthpushoerror ( PUSHOERROR0$ >ERROR >E ) // // C prototype: // void dg_forthpushoerror (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( offset bufferid -- ) // ( -error- offset bufferid ) // // Data stack in: // offset // buferid // // Error stack out: // offset // bufferid // // Action: // pushes the offset and bufferid of an error string to the error stack // // Failure cases: // error in a subroutine - (no error is pushed from this routine) // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthpopoerror ( POPOERROR0$ ERROR> E> ) // // C prototype: // void dg_forthpopoerror (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( offset bufferid -error- ) // ( -- offset bufferid ) // // Error stack in: // offset // bufferid // // Data stack out: // offset // buferid // // Action: // pops the offset and bufferid of an error string off the error stack // // Failure cases: // error in a subroutine - (no error is pushed from this routine) // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthgetoerror ( GETOERROR0$ ) // // C prototype: // void dg_forthgetoerror (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( errorstackindex -- pError0$ ) // // Data stack in: // errorstackindex 0 indexes the bottom (first pushed) error on the // error stack // // Data stack out: // error message 0$ offset offset in buffer of C style 0$ error message // error message 0$ bufferid buffer id of C style 0 string error message // // Action: // Pops the errorstackindex from the data stack // Retrieves the pointer to the error 0 string from the error stack as if it were a 0 // based array and pushes the pointer to the data stack. // // Failure cases: // error in a subroutine - (no error is pushed from this routine) // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthgeterrorcount ( GETERRORCOUNT ) // // C prototype: // void dg_forthgeterrorcount (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( -- errorcount ) // // Data stack out: // errorcount this represents the number of times dg_pusherror // was called but if the error was full, or missing // or something, then this number can be higher than // the number of errors on the stack // // Action: // Pushes the error count to the data stack. // // Failure cases: // error in a subroutine - (no error is pushed from this routine) // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthcheckerrordepth ( GETERRORDEPTH ) // // C prototype: // void dg_forthcheckerrordepth (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( -- errorstackdepth ) // // Data stack out: // errorstackdepth this is the number of pointers to 0 string error // messages on the error stack. // // Action: // Pushes the depth of the error stack to the data stack. If you fill up the error // stack or it's pointer gets lost or something, you can have an error count higher // than the number of errors on the stack. This routine lets you compare the two // values to see if any errors occurred that were not pushed to the error stack. // // Failure cases: // error in a subroutine - (no error is pushed from this routine) // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthcompilegetolderrorcount ( GETOLDERRORCOUNT ) // // C prototype: // void dg_forthcheckerrordepth (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( -- ) // // Compiles code that does: // ( -- olderrorcount ) // // Compiled code data stack out: // olderrorcount UINT64 error count at the time the current subroutine was // entered // // Action: // This is an immediate word. This word does this action when encountered in compiling // mode: // Compiles code that pushes the number of errors on the error stack at the time the // current subroutine was entered onto the data stack. // // Failure cases: // error pushing to the data stack, data stack is full // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthdroptoerrorcount ( DROPTOERRORCOUNT ) // // C prototype: // void dg_forthdroptoerrorcount (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored // // Stack action shorthand: // ( olderrorcount -- ) // // Data stack in: // oldstackdepth a previous error level // // Action: // Removes errors from the stack to return the error stack to a previous // error level // // Failure cases: // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthdoterrors ( .ERRORS SHOW-ERRORS .ES ) // // C prototype: // void dg_forthdoterrors (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored. // // Stack action shorthand: // ( -- ) // // Action: // displays the contents of the error stack from first pushed to most recently pushed // // Failure cases: // not checked // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_clearerrors ( EMPTY-ERRORS EES ) // // C prototype: // void dg_clearerrors (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored. // // Stack action shorthand: // ( -- ) // ( ... -error- ) // // Action // Clears all errors off the error stack and sets the error count to 0 // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthbracketwordnametoerror ( [WORDNAME>ERROR] ) // // C prototype: // void dg_forthbracketwordnametoerror (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored. // // Stack action shorthand: // ( -- ) // // Action // Compiles code to push the name of the latest defined word, which is // most likely the word being compiled, to the error stack. // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthnametoe ( NAME>E NAME>ERROR ) // // C prototype: // void dg_forthnametoe (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored. // // Stack action shorthand: // ( -- ) // // Compiled code does: // ( -error- latestname ) // // Action // Compiles code to push the offset and buffer id of the latest defined // word's null terminated name string to the data stack. // Then compiles a call to dg_forthpushoerror. // // Compiled code does: // Pushes the offset and bufferid of the latest defined word's null terminated // name string to the error stack. // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_fortherrorquotes ( ERROR" E" ) // // C prototype: // void dg_fortherrorquotes( Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored. // // Stack action shorthand: // ( "myerrormessage<quotes>morestuff" -currentinputbuffer- // "morestuff" ) // // Current input buffer's current offset in: // "myerrormessage<quotes>morestuff" // // Current input buffer's current offset out: // "morestuff" // // Compiled code does: // ( -error- omyerrormessage ) // // Action: // Moves the current input buffer's current offset pointer to the character // after the next ", the character after the next line terminator delimiter, or // to the end of the buffer, whichever comes first. // Then compiles a copy of the string to the current compile buffer. Then appends // a null terminator (byte 0x00) to the compiled string. Then compiles code to // push the offset and buffer id of the copied string to the error stack. // // Failure cases: // error calling dg_fortho0quotes // error compiling a call to dg_forthpushoerror // // //////////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////////// // // dg_forthqueryerrorif ( ?ERRORIF ) // // C prototype: // void dg_forthqueryerrorif (Bufferhandle* pBHarrayhead) // // Inputs: // Bufferhandle* pBHarrayhead pointer to a Bufferhandle structure which is // used as the bufferhandle for the array where the // other bufferhandles are stored. // // Stack action shorthand: // ( -- ifoffset ) // // Data stack out: // branchresolutionoffset next unused byte in current compile buffer which is // used by THEN // // Action: // compiles code to check for a change in the errorcount since the start of the // : definition and compiles an unresolved branch that is taken if the errorcount // has not changed // // Failure cases: // error getting current compile buffer id // error growing the current compile buffer // error getting a pointer to the current compile buffer // error pushing the branch resolution offset to the data stack // // //////////////////////////////////////////////////////////////////////////////////////