/*
 *                   DATA STRUCTURES
 *                   ==== ==========
 *
 *                       FOR THE
 *                       === ===
 *
 *               DATA DECLARATION BUILDER
 *               ==== =========== =======
 *
 *      This module provides the internal structures needed
 *      for the data declaration builder.  It is itself the
 *      sort of output generated by the program.
 */


typedef char BOOL;

#define FALSE 0
#define TRUE  1

#define streq(a,b)	(strcmp((a),(b))==0)

struct declnlist;
typedef struct declnlist *declnlist;

struct shapelist;
typedef struct shapelist *shapelist;

struct paramlist;
typedef struct paramlist *paramlist;

struct printlist;
typedef struct printlist *printlist;

struct printitem;
typedef struct printitem *printitem;


#define printitem_is_str 0
#define printitem_is_num 1

struct printitem {
	int	tag;
	int	num;
	char	*str;
};


struct printlist {
	printlist	next;
	printitem	item;
};


struct paramlist {
        paramlist next;
        char      *type;
        char      *name;
};


struct shapelist {
        shapelist next;
        char      *name;
        paramlist params;
	printlist pl;
};


struct declnlist {
        declnlist next;
        char      *name;
        shapelist shapes;
	BOOL	  ManyShapes, TagField, Struct, Union, UseNull, PutLoop;
};


typedef declnlist decln;		/* JUST THE FIRST */
typedef shapelist shape;		/* JUST THE FIRST */
typedef paramlist param;		/* JUST THE FIRST */


/*
/^#ifdef HASPROTOS
!/endif$
prot %
*/


#ifdef HASPROTOS
extern declnlist build_declnlist( char * , shapelist , declnlist );
extern void print_declnlist( declnlist );
extern shapelist build_shapelist( char * , paramlist , printlist , shapelist );
extern void print_shape( shapelist );
extern void print_shapelist( shapelist );
extern paramlist build_paramlist( char * , char * , paramlist );
extern void print_paramlist( paramlist );
extern printitem build_printitem_str( char * );
extern printitem build_printitem_num( int );
extern void print_printitem( printitem );
extern printlist build_printlist( printitem , printlist );
extern void print_printlist( printlist );
extern param findnthparam( int , paramlist , char * , char * );
#else
extern declnlist build_declnlist();
extern void print_declnlist();
extern shapelist build_shapelist();
extern void print_shape();
extern void print_shapelist();
extern paramlist build_paramlist();
extern void print_paramlist();
extern printitem build_printitem_str();
extern printitem build_printitem_num();
extern void print_printitem();
extern printlist build_printlist();
extern void print_printlist();
extern param findnthparam();
#endif
