Blame pccts/h/SList.h

Packit Service 3e823c
#ifndef SList_h
Packit Service 3e823c
#define SList_h
Packit Service 3e823c
Packit Service 3e823c
/*
Packit Service 3e823c
 * SList.h
Packit Service 3e823c
 *
Packit Service 3e823c
 * SOFTWARE RIGHTS
Packit Service 3e823c
 *
Packit Service 3e823c
 * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
Packit Service 3e823c
 * domain.  An individual or company may do whatever they wish with
Packit Service 3e823c
 * source code distributed with SORCERER or the code generated by
Packit Service 3e823c
 * SORCERER, including the incorporation of SORCERER, or its output, into
Packit Service 3e823c
 * commerical software.
Packit Service 3e823c
 *
Packit Service 3e823c
 * We encourage users to develop software with SORCERER.  However, we do
Packit Service 3e823c
 * ask that credit is given to us for developing SORCERER.  By "credit",
Packit Service 3e823c
 * we mean that if you incorporate our source code into one of your
Packit Service 3e823c
 * programs (commercial product, research project, or otherwise) that you
Packit Service 3e823c
 * acknowledge this fact somewhere in the documentation, research report,
Packit Service 3e823c
 * etc...  If you like SORCERER and have developed a nice tool with the
Packit Service 3e823c
 * output, please mention that you developed it using SORCERER.  In
Packit Service 3e823c
 * addition, we ask that this header remain intact in our source code.
Packit Service 3e823c
 * As long as these guidelines are kept, we expect to continue enhancing
Packit Service 3e823c
 * this system and expect to make other tools available as they are
Packit Service 3e823c
 * completed.
Packit Service 3e823c
 *
Packit Service 3e823c
 * PCCTS 1.33
Packit Service 3e823c
 * Terence Parr
Packit Service 3e823c
 * Parr Research Corporation
Packit Service 3e823c
 * with Purdue University and AHPCRC, University of Minnesota
Packit Service 3e823c
 * 1992-2000
Packit Service 3e823c
 */
Packit Service 3e823c
Packit Service 3e823c
#include "pcctscfg.h"
Packit Service 3e823c
Packit Service 3e823c
#include "pccts_stdio.h"
Packit Service 3e823c
#include "pccts_stdlib.h"
Packit Service 3e823c
Packit Service 3e823c
PCCTS_NAMESPACE_STD
Packit Service 3e823c
Packit Service 3e823c
#include "PCCTSAST.h"
Packit Service 3e823c
Packit Service 3e823c
class PCCTS_AST;
Packit Service 3e823c
Packit Service 3e823c
class SListNode {
Packit Service 3e823c
protected:
Packit Service 3e823c
	void *_elem;			/* pointer to any kind of element */
Packit Service 3e823c
	SListNode *_next;
Packit Service 3e823c
public:
Packit Service 3e823c
	SListNode()				{_elem=_next=NULL;}
Packit Service 3e823c
	virtual ~SListNode()	{_elem=_next=NULL;}
Packit Service 3e823c
	void *elem()			{ return _elem; }
Packit Service 3e823c
	void setElem(void *e)	{ _elem = e; }
Packit Service 3e823c
	void setNext(SListNode *t)	{ _next = t; }
Packit Service 3e823c
	SListNode *next()		{ return _next; }
Packit Service 3e823c
};
Packit Service 3e823c
Packit Service 3e823c
class SList {
Packit Service 3e823c
	SListNode *head, *tail;
Packit Service 3e823c
public:
Packit Service 3e823c
	SList() {head=tail=NULL;}
Packit Service 3e823c
	virtual ~SList() {head=tail=NULL;}
Packit Service 3e823c
	virtual void *iterate(SListNode **);
Packit Service 3e823c
	virtual void add(void *e);
Packit Service 3e823c
	virtual void lfree();
Packit Service 3e823c
	virtual PCCTS_AST *to_ast(SList list);
Packit Service 3e823c
	virtual void require(int e,char *err){ if ( !e ) panic(err); }
Packit Service 3e823c
	virtual void panic(char *err){ /* MR23 */ printMessage(stderr, "SList panic: %s\n", err); exit(PCCTS_EXIT_FAILURE); }
Packit Service 3e823c
	virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
Packit Service 3e823c
};
Packit Service 3e823c
Packit Service 3e823c
#endif