/* stack_functions.c Part of ForthBASIC, the BASIC interpreter and menuing system of POWER X Y This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "stack.h" #include "datatypes.h" // Discard top value of stack. // ( value -- ) void basicfn_drop(void) { unsigned char t=*stackptr++; if(t==BTYPE_NULL) { // nothing to do! } else if(t==BTYPE_U8) { stackptr++; } else if(t==BTYPE_U16 || t==BTYPE_S16) { stackptr+=2; } else if(t==BTYPE_U32 || t==BTYPE_S32) { stackptr+=4; } else if(t==BTYPE_RAWSTR || t==BTYPE_437STR || t==BTYPE_NKSTR) { int L= *(int *) stackptr; stackptr += sizeof(int); // length of string while(L) { stackptr++; L--; } stackptr++; // for the terminating null, used to send BASIC strings to C function calls } // TODO: Other data types }