/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1989-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20/*21* Glenn Fowler22* AT&T Bell Laboratories23*24* make abstract machine definitions25*/2627#ifndef _MAM_H28#define _MAM_H2930#include <ast.h>31#include <hash.h>3233#define getrule(p,n) (struct rule*)hashget((p)->rules,(n))34#define putrule(p,n,r) hashput((p)->rules,(char*)(n),(char*)(r))35#define getvar(p,n) (struct var*)hashget((p)->vars,(n))36#define putvar(p,n,v) hashput((p)->vars,(char*)(n),(char*)(v))3738#define A_archive (1<<0) /* archive target */39#define A_dontcare (1<<1) /* don't care if error */40#define A_metarule (1<<2) /* metarule info */41#define A_virtual (1<<3) /* a file not */42#define A_LAST (1<<7) /* last A_* bit used */4344#define B_LAST (1<<7) /* last B_* bit used */4546#define V_LAST (1<<7) /* last V_* bit used */4748struct rule /* rule info */49{50char* name; /* rule name */51char* bound; /* bound name */52time_t time; /* modify time */53long attributes; /* A_* attributes */54int status; /* action exit status */55struct list* prereqs; /* explicit prerequisite list */56struct list* implicit; /* implicit prerequisite list */57struct block* action; /* action */58union59{60char* pointer;61long number;62} local; /* user defined */6364#ifdef _MAM_RULE_PRIVATE65_MAM_RULE_PRIVATE66#endif6768};6970struct var /* variable info */71{72char* name; /* var name */73char* value; /* var value */74long attributes; /* V_* attributes */75union76{77char* pointer;78long number;79} local; /* user defined */8081#ifdef _MAM_VAR_PRIVATE82_MAM_VAR_PRIVATE83#endif8485};8687struct list /* prereq list */88{89struct list* next; /* next prereq */90struct rule* rule; /* this prereq */91};9293struct block /* data block list */94{95struct block* next; /* next item */96char* data; /* this item */97long attributes; /* B_* attributes */98};99100struct proc /* mam process trace */101{102struct rule* root; /* root target */103struct proc* parent; /* parent proc */104struct proc* child; /* child proc list */105struct proc* sibling; /* sibling procs */106char* pwd; /* pwd */107char* view; /* 3d view */108Hash_table_t* rules; /* rule hash */109Hash_table_t* vars; /* variable hash */110long pid; /* pid (invalid now) */111int status; /* exit status */112time_t start; /* start time */113time_t finish; /* finish time */114115#ifdef _MAM_PROC_PRIVATE116_MAM_PROC_PRIVATE117#endif118119};120121struct mam /* mam state */122{123const char* id; /* library id */124char* version; /* input version */125struct proc* main; /* main proc */126127#ifdef _MAM_MAM_PRIVATE128_MAM_MAM_PRIVATE129#endif130131};132133/*134* library globals135*/136137extern struct mam* mamalloc(void);138extern void mamfree(struct mam*);139extern int mamscan(struct mam*, const char*);140extern struct rule* mamrule(struct proc*, const char*);141extern struct var* mamvar(struct proc*, const char*, const char*);142extern void mamprereq(struct proc*, struct rule*, struct rule*, struct list**);143144#endif145146147