/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1989-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Bell Laboratories
*
* make abstract machine library
*/
#include <mamlib.h>
#include <ctype.h>
#include <error.h>
#include <tok.h>
/*
* free a rule
*/
static int
{
register struct list* p;
register struct list* x;
x = r->prereqs;
while (p = x)
{
x = p->next;
free(p);
}
free(r);
return(0);
}
/*
* get a process context
*/
static struct proc*
{
!(pp->rules = hashalloc(0, HASH_set, HASH_ALLOCATE, HASH_free, freerule, HASH_name, "mam-rules", 0)) ||
!(pp->vars = hashalloc(0, HASH_set, HASH_ALLOCATE, HASH_free, free, HASH_name, "mam-variables", 0)))
{
return(0);
}
return(pp);
}
/*
* allocate a mam scope
*/
struct mam*
mamalloc(void)
{
{
return(0);
}
return(mp);
}
/*
* free a mam scope
*/
void
{
if (mp)
{
{
}
}
}
/*
* check for rule alias
* this covers for an nmake mam output bug
*/
static struct rule*
{
}
/*
* set r attributes from s
* prereq list pointer returned
*/
static struct list**
{
char* arg;
struct list** p = 0;
{
r->attributes |= A_archive;
r->attributes |= A_dontcare;
r->attributes |= A_metarule;
r->attributes |= A_virtual;
}
return(p);
}
/*
* scan a mam input stream
*/
int
{
struct rule* r;
struct block* a;
char* s;
char* op;
char* arg;
char* val;
unsigned long t;
int n;
char* ofile;
int oline;
#if __sparc__ /* strcpy() and strcmp() bug() when '\0' is last byte in last page */
#endif
{
return(-1);
}
#if __sparc__
#endif
error_info.line = 0;
{
error_info.line++;
{
}
{
continue;
}
{
/* comment */;
}
{
}
{
{
continue;
}
if (n)
{
{
{
return(-1);
}
}
}
}
{
{
}
while (isspace(*s)) s++;
{
return(-1);
}
else r->action = a;
r->atail = a;
}
{
}
{
{
continue;
}
r->time = t;
}
{
{
continue;
}
r->status = n;
}
{
{
}
{
{
}
}
{
{
}
}
{
}
{
}
}
continue;
}
return(0);
}
/*
* return old rule pointer if found
* otherwise make a new rule
*/
struct rule*
{
struct rule* r;
return(r);
}
/*
* return old var pointer if found
* otherwise make a new var
* if value!=0 then var value is set
*/
struct var*
{
struct var* v;
{
}
return(v);
}
/*
* add x to r prereq list
*/
void
{
struct list* q;
if (x != r)
{
if (!p) p = &r->prereqs;
if (q = *p)
{
while (q)
{
if (x == q->rule) break;
if (!q->next)
{
break;
}
q = q->next;
}
}
else (*p)->rule = x;
}
}