/*-----------------------------------------------------------------------*
   data.h - define data structure for mycpp
   Copyright (C) 2003 Robert Maul

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
   
   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Log: data.h,v $
   Revision 1.1.1.1  2003/01/24 22:19:05  maulr


 *-----------------------------------------------------------------------*/

#define STACK     0
#define DEFINE    1
#define IFDEF     2
#define IFNDEF    3
#define ELSE      4
#define ENDIF     5
#define INCLUDE   6
#define TEXT      7
#define STATEMENT 8

#define BUFLEN 1000
#define BUFINC 100

#define NSYMS 3000

#define NEW(structure) (structure *)malloc(sizeof(structure))


#define ADD_LIST(head_ptr,tail_ptr,ptr) { \
        node_p head, tail; \
	head = (node_p) head_ptr; \
	tail = (node_p) tail_ptr; \
	if (!head) { \
	  head = tail = ptr; \
	} else { \
	  tail->next = ptr; \
	  tail = ptr; \
	} \
	head_ptr = head; \
	tail_ptr = tail; \
}
     
extern struct node_t *make_node(int toktyp,
			 struct node_t *data1,
			 struct node_t *data2,
			 struct node_t *data3,
			 struct node_t *next);

typedef struct node_t *node_p;

typedef struct node_t  {
  int toktyp; 
  void *data1;
  void *data2;
  void *data3;
  struct node_t *next;
} node_t;

struct symtab {
  char *name;
  int val;
} symtab[NSYMS];

extern node_p top; /* top of stack (see: data.c) */
extern node_p cur; /* current statement ptr */
extern node_p root; /* root of statement list */
