Annotation of researchv10no/cmd/ccom/common/t2print.c, revision 1.1.1.1

1.1       root        1: # include "mfile2.h"
                      2: 
                      3: char *cnames[] = 
                      4: {
                      5:        "CEFF",
                      6:        "NRGS",
                      7:        "CCC",
                      8:        0,
                      9: };
                     10: 
                     11: prgoal( goal ) 
                     12: register goal;
                     13: {
                     14:        /* print a nice-looking description of goal */
                     15: 
                     16:        register i, flag;
                     17: 
                     18:        flag = 0;
                     19:        for( i=0; cnames[i]; ++i )
                     20:        {
                     21:                if( goal & (1<<i) )
                     22:                {
                     23:                        if( flag ) printf( "|" );
                     24:                        ++flag;
                     25:                        printf( cnames[i] );
                     26:                }
                     27:        }
                     28:        if( !flag ) printf( "?%o", goal );
                     29: 
                     30: }
                     31: 
                     32: #ifndef NODBG
                     33: e2print( p )
                     34: register NODE *p; 
                     35: {
                     36:        printf( "\n********* costs=(0,...,NRGS;EFF;TEMP;CC)\n" );
                     37:        e22print( p ,"T");
                     38:        printf("=========\n");
                     39: }
                     40: 
                     41: e22print( p ,s)
                     42: register NODE *p; 
                     43: char *s;
                     44: {
                     45:        static down=0;
                     46:        register ty;
                     47: 
                     48:        ty = optype( p->tn.op );
                     49:        if( ty == BITYPE )
                     50:        {
                     51:                ++down;
                     52:                e22print( p->in.right ,"R");
                     53:                --down;
                     54:        }
                     55:        e222print( down, p, s );
                     56: 
                     57:        if( ty != LTYPE )
                     58:        {
                     59:                ++down;
                     60:                e22print( p->in.left, "L" );
                     61:                --down;
                     62:        }
                     63: }
                     64: 
                     65: t2print( t )
                     66: TWORD t;
                     67: {
                     68:        int i;
                     69:        static struct {
                     70:                TWORD mask;
                     71:                char * string;
                     72:                } t2tab[] = {
                     73:                        TANY, "ANY",
                     74:                        TINT, "INT",
                     75:                        TUNSIGNED, "UNSIGNED",
                     76:                        TCHAR, "CHAR",
                     77:                        TUCHAR, "UCHAR",
                     78:                        TSHORT, "SHORT",
                     79:                        TUSHORT, "USHORT",
                     80:                        TLONG, "LONG",
                     81:                        TULONG, "ULONG",
                     82:                        TFLOAT, "FLOAT",
                     83:                        TDOUBLE, "DOUBLE",
                     84:                        TPOINT, "POINTER",
                     85:                        TPOINT2, "POINTER2",
                     86:                        TSTRUCT, "STRUCT",
                     87:                        TVOID, "VOID",
                     88:                        0, 0
                     89:                        };
                     90: 
                     91:        for( i=0; t && t2tab[i].mask; ++i ) {
                     92:                if( (t&t2tab[i].mask) == t2tab[i].mask ) {
                     93:                        printf( " %s", t2tab[i].string );
                     94:                        t ^= t2tab[i].mask;
                     95:                        }
                     96:                }
                     97:        }
                     98: 
                     99: # else
                    100: e2print( p )
                    101: NODE *p; 
                    102: {
                    103:        werror( "e2print not compiled" );
                    104: }
                    105: e222print( p, s )
                    106: NODE *p; 
                    107: char *s;
                    108: {
                    109:        werror( "e222print not compiled" );
                    110: }
                    111: # endif
                    112: cprt( c, s )
                    113: register char *s; 
                    114: register c;
                    115: {
                    116:        if( c >= INFINITY ) printf( "*%s", s );
                    117:        else printf( "%d%s", c, s );
                    118: }

unix.superglobalmegacorp.com

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