]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/CodeTools/TianoTools/Pccts/h/SList.h
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / CodeTools / TianoTools / Pccts / h / SList.h
CommitLineData
878ddf1f 1#ifndef SList_h\r
2#define SList_h\r
3\r
4/*\r
5 * SList.h\r
6 *\r
7 * SOFTWARE RIGHTS\r
8 *\r
9 * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public\r
10 * domain. An individual or company may do whatever they wish with\r
11 * source code distributed with SORCERER or the code generated by\r
12 * SORCERER, including the incorporation of SORCERER, or its output, into\r
13 * commerical software.\r
14 *\r
15 * We encourage users to develop software with SORCERER. However, we do\r
16 * ask that credit is given to us for developing SORCERER. By "credit",\r
17 * we mean that if you incorporate our source code into one of your\r
18 * programs (commercial product, research project, or otherwise) that you\r
19 * acknowledge this fact somewhere in the documentation, research report,\r
20 * etc... If you like SORCERER and have developed a nice tool with the\r
21 * output, please mention that you developed it using SORCERER. In\r
22 * addition, we ask that this header remain intact in our source code.\r
23 * As long as these guidelines are kept, we expect to continue enhancing\r
24 * this system and expect to make other tools available as they are\r
25 * completed.\r
26 *\r
27 * PCCTS 1.33\r
28 * Terence Parr\r
29 * Parr Research Corporation\r
30 * with Purdue University and AHPCRC, University of Minnesota\r
31 * 1992-2000\r
32 */\r
33\r
34#include "pcctscfg.h"\r
35\r
36#include "pccts_stdio.h"\r
37#include "pccts_stdlib.h"\r
38\r
39PCCTS_NAMESPACE_STD\r
40\r
41#include "PCCTSAST.h"\r
42\r
43class PCCTS_AST;\r
44\r
45class SListNode {\r
46protected:\r
47 void *_elem; /* pointer to any kind of element */\r
48 SListNode *_next;\r
49public:\r
50 SListNode() {_elem=_next=NULL;}\r
51 virtual ~SListNode() {_elem=_next=NULL;}\r
52 void *elem() { return _elem; }\r
53 void setElem(void *e) { _elem = e; }\r
54 void setNext(SListNode *t) { _next = t; }\r
55 SListNode *next() { return _next; }\r
56};\r
57\r
58class SList {\r
59 SListNode *head, *tail;\r
60public:\r
61 SList() {head=tail=NULL;}\r
62 virtual ~SList() {head=tail=NULL;}\r
63 virtual void *iterate(SListNode **);\r
64 virtual void add(void *e);\r
65 virtual void lfree();\r
66 virtual PCCTS_AST *to_ast(SList list);\r
67 virtual void require(int e,char *err){ if ( !e ) panic(err); }\r
68 virtual void panic(char *err){ /* MR23 */ printMessage(stderr, "SList panic: %s\n", err); exit(PCCTS_EXIT_FAILURE); }\r
69 virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23\r
70};\r
71\r
72#endif\r