Annotation of researchv10no/libplot/lib4014/text.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include "tek.h"
        !             3: #define N 0104
        !             4: #define E 0101
        !             5: #define NE 0105
        !             6: #define S 0110
        !             7: #define W 0102
        !             8: #define SW 0112
        !             9: /*     arrange by incremental plotting that an initial
        !            10:  *     character such as +, X, *, etc will fall
        !            11:  *     right on the point, and undo it so that further
        !            12:  *     labels will fall properly in place
        !            13:  */
        !            14: #define POINTPL        036
        !            15: #define BACKSP ''
        !            16: char   lbl_mv[] = {
        !            17:        POINTPL,040,S,S,S,S,S,S,SW,SW,SW,SW,SW,SW,SW,SW,SW,SW,PLOTOUT,0
        !            18: };
        !            19: char   lbl_umv[] = {
        !            20:        POINTPL,040,N,N,N,N,N,N,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,PLOTOUT,0
        !            21: };
        !            22: char   plotout[] = {
        !            23:        PLOTOUT,0
        !            24: };
        !            25: text(s)
        !            26: char   *s;
        !            27: {
        !            28:        register int    n;
        !            29:        register char *p;
        !            30:        int centered, right, newline, more, tweek;
        !            31:        double y;
        !            32: 
        !            33:        while(1){
        !            34:        n = centered = right = newline = more = tweek = 0;
        !            35:        for(p=s; *p != '\0'; p++){
        !            36:                if(*p == '\\'){
        !            37:                        switch(*(++p)){
        !            38:                        case 'C': centered++;
        !            39:                                s = p+1;
        !            40:                                continue;
        !            41:                        case 'R': right++;
        !            42:                                s = p+1;
        !            43:                                continue;
        !            44:                        case 'n': newline++;
        !            45:                                *(p-1) = '\0';
        !            46:                                if(*(p+1) != '\0')more++;
        !            47:                                goto output;
        !            48:                        case 'L': s=p+1;
        !            49:                                continue;
        !            50:                        }
        !            51:                }
        !            52:                else if( (n==0) && (*p=='+' || *p == '*' || *p == 'x' ||
        !            53:                        *p == 'X' || *p == '.' || *p == 'o'))tweek++;
        !            54:                else n = 1;
        !            55:        }
        !            56: output:
        !            57:        if(tweek)
        !            58:                printf("%s",lbl_mv);
        !            59:        else printf("%s",plotout);
        !            60:        n = 0;
        !            61:        if(centered) n = (p - s)/2 + 1;
        !            62:        else if(right)n = p - s +1;
        !            63:        if(n > 0)
        !            64:                while(--n)
        !            65:                        putchar(BACKSP);
        !            66:        *p = '\0';
        !            67:        printf("%s", s);
        !            68:        if(tweek)
        !            69:                printf("%s",lbl_umv);
        !            70:        if(newline){
        !            71:                y = SCY(e1->copyy) ;
        !            72:                y -= 34.;
        !            73:                e1->copyy = (y - e1->bottom)/e1->scaley + e1->ymin;
        !            74:        }
        !            75:        move(e1->copyx, e1->copyy);
        !            76:        if(!more)break;
        !            77:        s = p+1;
        !            78:        }
        !            79: }

unix.superglobalmegacorp.com

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