Annotation of researchv8dc/cmd/trace/trace9.c, revision 1.1.1.1

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:        struct Swiffle *try, *result = (struct Swiffle *) NULL;
                     13:        register int i;
                     14: 
                     15:        for (i = nswiff, try = slist; i > 0; i--, try = try->next)
                     16:                if (try->st != avoid)
                     17:                {       result = try;
                     18:                        getput(try, i);
                     19:                        if (try->vi->analyzed == 0)
                     20:                        {       fprintf(stderr, "assertion botched\n");
                     21:                                kill(getpid(), 3);
                     22:                        }
                     23:                        break;
                     24:                }
                     25: 
                     26:        return result;
                     27: }
                     28: 
                     29: swiffle(this, that)
                     30:        struct STATE *this;
                     31:        struct VISIT *that;
                     32: {
                     33:        struct Swiffle *getswiff(), *try;
                     34: 
                     35:        try = getswiff();
                     36:        try->st = this;
                     37:        try->vi = that;
                     38: 
                     39:        if (nswiff++ == 0)
                     40:                slist = try;
                     41:        else
                     42:        {       slast->next = try;
                     43:                try->last = slast;
                     44:        }
                     45:        slast = try;
                     46: }
                     47: 
                     48: getput(try, n)
                     49:        struct Swiffle *try;
                     50: {
                     51: /* unlink from slist: */
                     52:        if (try == slist)
                     53:                slist = try->next;
                     54:        else
                     55:                try->last->next = try->next;
                     56: 
                     57:        if (n > 1)
                     58:                try->next->last = try->last;
                     59: 
                     60:        if (try == slast)
                     61:        {       if (try == slist)
                     62:                        slast = (struct Swiffle *) NULL;
                     63:                else
                     64:                        slast = try->last;
                     65:        }
                     66:        nswiff--;
                     67: 
                     68: /* relink in flist: */
                     69:        try->next = (struct Swiffle *) NULL;
                     70: 
                     71:        if (fswiff++ == 0)
                     72:                try->last = (struct Swiffle *) NULL;
                     73:        else
                     74:        {       flast->next = try;
                     75:                try->last = flast;
                     76:        }
                     77:        flast = try;
                     78: }
                     79: 
                     80: struct Swiffle *
                     81: getswiff()
                     82: {      struct Swiffle *try;
                     83: 
                     84:        if (fswiff == 0)
                     85:                try = (struct Swiffle *) Smalloc(sizeof(struct Swiffle));
                     86:        else
                     87:        {       fswiff--;
                     88:                try = flast;
                     89:                if ((flast = try->last) != NULL)
                     90:                        flast->next = (struct Swiffle *) NULL;
                     91:        }
                     92:        try->next = try->last = (struct Swiffle *) NULL;
                     93: 
                     94:        return try;
                     95: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.