Annotation of coherent/b/bin/as/new.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Turn table.386 into a better form.
                      3:  */
                      4: #include <misc.h>
                      5: #include <string.h>
                      6: #include <ctype.h>
                      7: 
                      8: main()
                      9: {
                     10:        char buf[100];
                     11: 
                     12:        while (NULL != gets(buf)) {
                     13:                int x;
                     14:                char c, *p, y[10];
                     15: 
                     16:                if ('#' == buf[0]) {
                     17:                        puts(buf);
                     18:                        continue;
                     19:                }
                     20:                sscanf(buf, "%x", &x);
                     21:                y[0] = '\0';
                     22: 
                     23:                for (p = buf; c = *p; p++)
                     24:                        if (' ' == c || '\t' == c)
                     25:                                break;
                     26: 
                     27:                if (!x)         /* General op code */
                     28:                        strcpy(y, "G");
                     29:                else {
                     30: #define foo(n, c) if (n & x) strcat(y, #c);
                     31:                /* flag one is trashed */
                     32:                        foo(0x02, w)
                     33:                        foo(0x04, d)
                     34:                        foo(0x08, m)
                     35:                        foo(0x10, a)
                     36:                        foo(0x20, p)
                     37:                        foo(0xC0, P);   /* lumped */
                     38:                                        /* 100 eliminated */
                     39:                        foo(0x200, t)
                     40:                        foo(0x400, i)
                     41:                        foo(0x800, r)
                     42:                        foo(0x1000, R)
                     43:                        foo(0x2000, l)
                     44:                        foo(0x4000, L)
                     45:                        foo(0x8000, X)
                     46: #undef foo
                     47:                        if (!y[0])
                     48:                                strcpy(y, "-");
                     49:                }
                     50:                printf("%-4s%s\n", y, p);
                     51:        }
                     52: }
                     53:        

unix.superglobalmegacorp.com

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