Lines Matching defs:pp

64 	register struct proc*	pp;
66 for (pp = mp->procs; pp; pp = pp->next)
67 if (pp->pid == pid) return(pp);
68 if (!(pp = newof(0, struct proc, 1, 0)) ||
69 !(pp->bp = pp->fp = newof(0, struct frame, 1, 0)) ||
70 !(pp->rules = hashalloc(0, HASH_set, HASH_ALLOCATE, HASH_free, freerule, HASH_name, "mam-rules", 0)) ||
71 !(pp->vars = hashalloc(0, HASH_set, HASH_ALLOCATE, HASH_free, free, HASH_name, "mam-variables", 0)))
76 pp->next = mp->procs;
77 mp->procs = pp;
78 pp->pid = pid;
79 pp->fp->rule = pp->root = mamrule(pp, "");
80 return(pp);
111 register struct proc* pp;
113 while (pp = mp->procs)
115 mp->procs = pp->next;
116 if (pp->rules) hashfree(pp->rules);
117 if (pp->vars) hashfree(pp->vars);
118 if (pp->pwd) free(pp->pwd);
119 if (pp->view) free(pp->view);
120 if (pp->root) freerule(pp->root);
121 free(pp);
133 alias(struct proc* pp, const char* name)
137 if (*name != '/' || *pp->fp->rule->name == '/' || !pp->pwd) return(0);
138 sfsprintf(buf, sizeof(buf), "%s/%s", pp->pwd, pp->fp->rule->name);
141 putrule(pp, name, pp->fp->rule);
142 return(pp->fp->rule);
151 attributes(struct proc* pp, struct rule* r, char* s)
163 p = &pp->fp->rule->implicit;
179 register struct proc* pp;
214 if (!(pp = getproc(mp, strtol(op, NiL, 10)))) return(-1);
217 else pp = mp->main;
218 if (!pp->bp)
220 errorf(mp, mp, 1, "%s: process %d is finished", op, pp->pid);
231 mamvar(pp, arg, strdup(val));
236 if (n) r = mamrule(pp, arg);
237 else if (!(r = getrule(pp, arg)) && !(r = alias(pp, arg)))
242 mamprereq(pp, pp->fp->rule, r, attributes(pp, r, s));
245 if (!pp->fp->next)
247 if (!(pp->fp->next = newof(0, struct frame, 1, 0)))
252 pp->fp->next->prev = pp->fp;
254 pp->fp = pp->fp->next;
255 pp->fp->rule = r;
263 if (!pp->fp->prev) goto missing;
264 r = pp->fp->rule;
266 else r = mamrule(pp, arg);
280 if (!pp->fp->prev) goto missing;
282 if (!streq(pp->fp->rule->name, arg) && !alias(pp, arg))
283 errorf(mp, mp, 1, "%s: %s %s expected", arg, op, pp->fp->rule->name);
284 attributes(pp, pp->fp->rule, s);
285 pp->fp = pp->fp->prev;
290 if (!(r = getrule(pp, arg)) && !(r = alias(pp, arg)))
301 if (!(r = getrule(pp, arg)) && !(r = alias(pp, arg)))
319 tokscan(s, NiL, " %lu %d ", &pp->start, &n);
320 if (!pp->pid) pp->pid = n;
321 else if (pp->parent = getproc(mp, n))
323 register struct proc* ppp = pp->parent;
325 if (!ppp->child) ppp->child = pp;
326 else if (!ppp->child->sibling) ppp->child->sibling = ppp->child->stail = pp;
327 else ppp->child->stail = ppp->child->stail->sibling = pp;
334 tokscan(s, NiL, " %lu %d ", &pp->finish, &pp->status);
335 if (pp->fp != pp->bp)
337 while (fp = pp->bp)
339 pp->bp = fp->next;
346 pp->pwd = strdup(val);
351 pp->view = strdup(val);
372 mamrule(register struct proc* pp, const char* name)
376 if (!(r = getrule(pp, name)) && (r = newof(0, struct rule, 1, 0)))
377 r->name = putrule(pp, 0, r);
388 mamvar(register struct proc* pp, const char* name, const char* value)
392 if (!(v = getvar(pp, name)))
395 v->name = putvar(pp, 0, v);
406 mamprereq(struct proc* pp, struct rule* r, struct rule* x, struct list** p)
410 NoP(pp);