stack.h 792 Bytes
/*
 * Copyright (C) 1996-1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */

/*****************************************************************
 * stack.h
 *
 *****************************************************************/

#include "simtypes.h"

typedef struct Stack Stack;
typedef uint64 StackItem;

#define MAX_STACK_SIZE 64

struct Stack {
   int head;
   StackItem element[MAX_STACK_SIZE];
};

extern Stack *StackInit(void);
extern int StackPush(Stack *stack, StackItem element);
extern StackItem StackPop(Stack *stack);
extern StackItem StackTop(Stack *stack);
extern int StackEmpty(Stack *stack);
extern StackItem StackIndex(Stack *stack, int depth);