ref: 5393ee59ca344cb7f9d653d9390a981c21d60957
parent: d94fc20497e2cc7a537af73b9551b9e03e2df6d0
author: asau <asau@ficl.sf.net>
date: Thu Dec 2 10:28:03 CST 2010
Use ficlStackDepth function instead of a macro.
--- a/stack.c
+++ b/stack.c
@@ -3,7 +3,7 @@
** Forth Inspired Command Language
** Author: John Sadler (john_sadler@alum.mit.edu)
** Created: 16 Oct 1997
-** $Id: stack.c,v 1.13 2010/12/02 13:56:43 asau Exp $
+** $Id: stack.c,v 1.14 2010/12/02 16:28:03 asau Exp $
*******************************************************************/
/*
** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)
@@ -44,8 +44,6 @@
#include "ficl.h"
-#define STKDEPTH(s) (((s)->top - (s)->base) + 1)
-
/*
** N O T E: Stack convention:
**
@@ -70,9 +68,10 @@
void ficlStackCheck(ficlStack *stack, int popCells, int pushCells)
#if FICL_ROBUST >= 1
{
- int nFree = stack->size - STKDEPTH(stack);
+ int depth = ficlStackDepth(stack);
+ int nFree = stack->size - depth;
- if (popCells > STKDEPTH(stack))
+ if (popCells > depth)
{
ficlVmThrowError(stack->vm, "Error: %s stack underflow", stack->name);
}
@@ -136,7 +135,7 @@
int ficlStackDepth(ficlStack *stack)
{
- return STKDEPTH(stack);
+ return (stack->top - stack->base) + 1;
}
/*******************************************************************