Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
/* $XConsortium: Stack.h /main/2 1996/07/18 16:49:58 drk $ */
#ifndef STACK_HEADRER
#define STACK_HEADER
//-----------------------------------------------------------------------
class Element{
friend class Stack;
friend class SearchEngine;
protected:
int name;
Element *next;
Element( int aName, Element *v=0) { name = aName; next = v; }
int GetName() const { return name; }
};
class Stack {
private:
Element *currentToken;
public:
void push( Element *tok ) { tok->next = currentToken; currentToken = tok; }
Element *pop() {
Element *ptr;
if ( currentToken ) {
ptr = currentToken;
currentToken = ptr->next;
return ( ptr );
}
else {
return ( NULL );
}
}
Element *GetTopToken() { return ( currentToken ); }
Stack() { currentToken = NULL; }
~Stack();
};
inline
Stack::~Stack()
{
Element *pt = currentToken;
while ( pt ) {
Element *tmp = pt;
pt = pt->next;
delete tmp;
}
}
#endif