~ubuntu-branches/ubuntu/oneiric/spass/oneiric

« back to all changes in this revision

Viewing changes to SPASS/stack.h

  • Committer: Bazaar Package Importer
  • Author(s): Roland Stigge
  • Date: 2010-06-27 18:59:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100627185928-kdjuqghv04rxyqmc
Tags: 3.7-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************/
 
2
/* ********************************************************** */
 
3
/* *                                                        * */
 
4
/* *              GLOBAL SYSTEM STACK                       * */
 
5
/* *                                                        * */
 
6
/* *  $Module:      STACK                                   * */ 
 
7
/* *                                                        * */
 
8
/* *  Copyright (C) 1996, 1998, 1999, 2001                  * */
 
9
/* *  MPI fuer Informatik                                   * */
 
10
/* *                                                        * */
 
11
/* *  This program is free software; you can redistribute   * */
 
12
/* *  it and/or modify it under the terms of the FreeBSD    * */
 
13
/* *  Licence.                                              * */
 
14
/* *                                                        * */
 
15
/* *  This program is distributed in the hope that it will  * */
 
16
/* *  be useful, but WITHOUT ANY WARRANTY; without even     * */
 
17
/* *  the implied warranty of MERCHANTABILITY or FITNESS    * */
 
18
/* *  FOR A PARTICULAR PURPOSE.  See the LICENCE file       * */ 
 
19
/* *  for more details.                                     * */
 
20
/* *                                                        * */
 
21
/* *                                                        * */
 
22
/* $Revision: 1.2 $                                     * */
 
23
/* $State: Exp $                                            * */
 
24
/* $Date: 2010-02-22 14:09:59 $                             * */
 
25
/* $Author: weidenb $                                         * */
 
26
/* *                                                        * */
 
27
/* *             Contact:                                   * */
 
28
/* *             Christoph Weidenbach                       * */
 
29
/* *             MPI fuer Informatik                        * */
 
30
/* *             Stuhlsatzenhausweg 85                      * */
 
31
/* *             66123 Saarbruecken                         * */
 
32
/* *             Email: spass@mpi-inf.mpg.de                * */
 
33
/* *             Germany                                    * */
 
34
/* *                                                        * */
 
35
/* ********************************************************** */
 
36
/**************************************************************/
 
37
 
 
38
 
 
39
/* $RCSfile: stack.h,v $ */
 
40
 
 
41
#ifndef _STACK_
 
42
#define _STACK_
 
43
 
 
44
/**************************************************************/
 
45
/* Includes                                                   */
 
46
/**************************************************************/
 
47
 
 
48
#include "misc.h"
 
49
 
 
50
/**************************************************************/
 
51
/* More basic types and macros                                */
 
52
/**************************************************************/
 
53
 
 
54
 
 
55
#define stack_SIZE 10000
 
56
 
 
57
typedef POINTER STACK[stack_SIZE];
 
58
 
 
59
 
 
60
/**************************************************************/
 
61
/* Global Variables                                           */
 
62
/**************************************************************/
 
63
 
 
64
extern STACK stack_STACK;
 
65
extern NAT   stack_POINTER;
 
66
 
 
67
 
 
68
/**************************************************************/
 
69
/* Inline Functions                                           */
 
70
/**************************************************************/
 
71
 
 
72
static __inline__ void stack_Init(void)
 
73
{
 
74
  stack_POINTER = 0;
 
75
}
 
76
 
 
77
static __inline__ void stack_Push(POINTER Entry)
 
78
{
 
79
#ifdef CHECK
 
80
  if (stack_POINTER >= stack_SIZE) {
 
81
    misc_StartErrorReport();
 
82
    misc_ErrorReport("\n In stack_Push: Stack Overflow.");
 
83
    misc_FinishErrorReport();
 
84
  }
 
85
#endif
 
86
  
 
87
  stack_STACK[stack_POINTER++]= Entry;
 
88
}
 
89
 
 
90
static __inline__ int stack_Pop(void)
 
91
{
 
92
  return --stack_POINTER;
 
93
}
 
94
 
 
95
static __inline__ POINTER stack_PopResult(void)
 
96
{
 
97
  return stack_STACK[--stack_POINTER];
 
98
}
 
99
 
 
100
static __inline__ void stack_NPop(NAT N)
 
101
{
 
102
  stack_POINTER -= N;
 
103
}
 
104
 
 
105
static __inline__ POINTER stack_Top(void)
 
106
{
 
107
  return stack_STACK[stack_POINTER-1];
 
108
}
 
109
 
 
110
static __inline__ POINTER stack_NthTop(NAT N)
 
111
{
 
112
  return stack_STACK[stack_POINTER-(1+N)];
 
113
}
 
114
 
 
115
static __inline__ void stack_RplacTop(POINTER Entry)
 
116
{
 
117
  stack_STACK[stack_POINTER-1] = Entry;
 
118
}
 
119
 
 
120
static __inline__ void stack_RplacNthTop(NAT N, POINTER Entry)
 
121
{
 
122
  stack_STACK[stack_POINTER-(1+N)] = Entry;
 
123
}
 
124
 
 
125
static __inline__ void stack_RplacNth(NAT N, POINTER Entry)
 
126
{
 
127
  stack_STACK[N] = Entry;
 
128
}
 
129
 
 
130
static __inline__ NAT stack_Bottom(void)
 
131
{
 
132
  return stack_POINTER;
 
133
}
 
134
 
 
135
static __inline__ void stack_SetBottom(NAT Ptr)
 
136
{
 
137
  stack_POINTER = Ptr;
 
138
}
 
139
 
 
140
static __inline__ BOOL stack_Empty(NAT Ptr)
 
141
{
 
142
  return stack_POINTER == Ptr;
 
143
}
 
144
 
 
145
 
 
146
#endif
 
147
 
 
148