|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include "trace.h" ! 3: #include "trace.d" ! 4: ! 5: struct Swiffle *slist, *slast, *flast; ! 6: int nswiff = 0, fswiff = 0; ! 7: ! 8: struct Swiffle * ! 9: unswiffle(avoid) ! 10: struct STATE *avoid; ! 11: { ! 12: register struct Swiffle *try; ! 13: register int i; ! 14: struct Swiffle *result = (struct Swiffle *) NULL; ! 15: ! 16: for (i = nswiff, try = slist; i > 0; i--, try = try->next) ! 17: if (try->st != avoid) ! 18: { result = try; ! 19: getput(try, i); ! 20: break; ! 21: } ! 22: ! 23: return result; ! 24: } ! 25: ! 26: swiffle(this, that) ! 27: struct STATE *this; ! 28: struct VISIT *that; ! 29: { ! 30: struct Swiffle *getswiff(), *try; ! 31: ! 32: try = getswiff(); ! 33: try->st = this; ! 34: try->vi = that; ! 35: ! 36: if (nswiff++ == 0) ! 37: slist = try; ! 38: else ! 39: { slast->next = try; ! 40: try->last = slast; ! 41: } ! 42: slast = try; ! 43: } ! 44: ! 45: getput(try, n) ! 46: struct Swiffle *try; ! 47: { ! 48: /* unlink from slist: */ ! 49: if (try == slist) ! 50: slist = try->next; ! 51: else ! 52: try->last->next = try->next; ! 53: ! 54: if (n > 1) ! 55: try->next->last = try->last; ! 56: ! 57: if (try == slast) ! 58: { if (try == slist) ! 59: slast = (struct Swiffle *) NULL; ! 60: else ! 61: slast = try->last; ! 62: } ! 63: nswiff--; ! 64: ! 65: /* relink in flist: */ ! 66: ! 67: try->next = (struct Swiffle *) NULL; ! 68: ! 69: if (fswiff++ == 0) ! 70: try->last = (struct Swiffle *) NULL; ! 71: else ! 72: { flast->next = try; ! 73: try->last = flast; ! 74: } ! 75: flast = try; ! 76: } ! 77: ! 78: struct Swiffle * ! 79: getswiff() ! 80: { struct Swiffle *try; ! 81: char *Smalloc(); ! 82: ! 83: if (fswiff == 0) ! 84: try = (struct Swiffle *) Smalloc(sizeof(struct Swiffle)); ! 85: else ! 86: { fswiff--; ! 87: try = flast; ! 88: if ((flast = try->last) != NULL) ! 89: flast->next = (struct Swiffle *) NULL; ! 90: } ! 91: try->next = try->last = (struct Swiffle *) NULL; ! 92: ! 93: return try; ! 94: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.