Making [IF] [THEN] work at console, bumping version.

This commit is contained in:
Brad Nelson
2023-01-03 21:01:51 -08:00
parent a1a934397d
commit 3d1cf4b93c
4 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
VERSION=7.0.7.4 VERSION=7.0.7.5
STABLE_VERSION=7.0.6.19 STABLE_VERSION=7.0.6.19
OLD_STABLE_VERSION=7.0.5.4 OLD_STABLE_VERSION=7.0.5.4
REVISION=$(shell git rev-parse HEAD | head -c 20) REVISION=$(shell git rev-parse HEAD | head -c 20)

View File

@ -15,9 +15,12 @@
( Interpret time conditionals ) ( Interpret time conditionals )
: DEFINED? ( "name" -- xt|0 ) : DEFINED? ( "name" -- xt|0 )
bl parse find state @ if aliteral then ; immediate begin bl parse dup 0= while 2drop refill 0= throw repeat
find state @ if aliteral then ; immediate
defer [SKIP] defer [SKIP]
: [THEN] ; : [ELSE] [SKIP] ; : [IF] 0= if [SKIP] then ; : [THEN] ; immediate
: [ELSE] [SKIP] ; immediate
: [IF] 0= if [SKIP] then ; immediate
: [SKIP]' 0 begin postpone defined? dup if : [SKIP]' 0 begin postpone defined? dup if
dup ['] [IF] = if swap 1+ swap then dup ['] [IF] = if swap 1+ swap then
dup ['] [ELSE] = if swap dup 0 <= if 2drop exit then swap then dup ['] [ELSE] = if swap dup 0 <= if 2drop exit then swap then

View File

@ -109,6 +109,9 @@ static cell_t same(const char *a, const char *b, cell_t len) {
} }
static cell_t find(const char *name, cell_t len) { static cell_t find(const char *name, cell_t len) {
if (len == 0) {
return 0;
}
for (cell_t ***voc = g_sys->context; *voc; ++voc) { for (cell_t ***voc = g_sys->context; *voc; ++voc) {
cell_t xt = (cell_t) **voc; cell_t xt = (cell_t) **voc;
while (xt) { while (xt) {

View File

@ -117,6 +117,9 @@ function BUILTIN_CODE(i) {
} }
function Find(name) { function Find(name) {
if (name.length === 0) {
return 0;
}
name = name.toUpperCase(); name = name.toUpperCase();
var raw = unescape(encodeURIComponent(name)); var raw = unescape(encodeURIComponent(name));
for (var voc = i32[g_sys_context>>2]; i32[voc>>2]; voc += 4) { for (var voc = i32[g_sys_context>>2]; i32[voc>>2]; voc += 4) {