/*
 *  CELLS       An Implementation of the WireWorld cellular automata
 *              as described in Scientific American, Jan 1990.
 *
 *              Copyright 1990 by Davide P. Cervone.
 *  You may use this code, provided this copyright notice is kept intact.
 *  See the CELLS.HELP file for complete information on distribution conditions.
 */

/*
 *  File:  cParts.h             structures for Parts and Library lists
 */


#include "cMemory.h"

typedef struct Part PART;
typedef struct PartLibrary LIBRARY;

/*
 *  Linked list of Parts (in a library)
 */

struct Part
{
   PART    *Next,*Prev;
   char    *Name;
   UWORD    NameLen;
   UWORD    Flags;
      #define PT_STATIC     BIT(15)     /* don't FREE this structure */
   UWORD    w,h;            /* size of part's bounding box */
   UBYTE   *Data;           /* array of cells for this part */
};


/*
 *  Linked list of Libraries loaded in a circuit
 */

struct PartLibrary
{
   LIBRARY *Next,*Prev;
   char    *Name;
   UWORD    NameLen;
   UWORD    Flags;
      #define PL_STATIC     BIT(15)     /* don't FREE this structure */
      #define PL_NODELETE   BIT(14)     /* this library may not be REMOVED */
      #define PL_ASPARTS    BIT(13)     /* save as PARTS */
   PART    *FirstPart;
};

#define CANCELPART       ((PART *)TRUE)

extern LIBRARY PartsList;               /* main parts list */
extern LIBRARY *FirstLibrary;           /* first library */
extern LIBRARY *SelectedLibrary;        /* current library */
