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

1.1     ! root        1: #include <stdio.h>
        !             2: #include "tr.h"
        !             3: /*     arrange by incremental plotting that an initial
        !             4:  *     character such as +, X, *, etc will fall
        !             5:  *     right on the point, and undo it so that further
        !             6:  *     labels will fall properly in place
        !             7:  */
        !             8: text(s)
        !             9: char   *s;
        !            10: {
        !            11:        register int    n;
        !            12:        register char *p;
        !            13:        int centered, right, newline, more, tweek;
        !            14:        double y;
        !            15: 
        !            16:        while(1){
        !            17:        n = centered = right = newline = more = tweek = 0;
        !            18:        for(p=s; *p != '\0'; p++){
        !            19:                if(*p == '\\'){
        !            20:                        switch(*(++p)){
        !            21:                        case 'C': centered++;
        !            22:                                s = p+1;
        !            23:                                continue;
        !            24:                        case 'R': right++;
        !            25:                                s = p+1;
        !            26:                                continue;
        !            27:                        case 'n': newline++;
        !            28:                                *(p-1) = '\0';
        !            29:                                if(*(p+1) != '\0')more++;
        !            30:                                goto output;
        !            31:                        case 'L': s=p+1;
        !            32:                                continue;
        !            33:                        }
        !            34:                }
        !            35:                else if( (n==0) && (*p=='+' || *p == '*' || *p == 'x' ||
        !            36:                        *p == 'X' || *p == '.' || *p == 'o'))tweek++;
        !            37:                else n = 1;
        !            38:        }
        !            39: output:
        !            40:        if(tweek)
        !            41:                printf("\\h'-0.m'\\v'.2m'"); /*shift down & left */
        !            42:        *p = '\0';
        !            43:        if(right)
        !            44:                printf("\\h\\(ts-\\w\\(ts%s\\(tsu\\(ts%s", s, s);
        !            45:        else if(centered)
        !            46:                printf("\\h\\(ts-\\w\\(ts%s\\(tsu/2u\\(ts%s\\h\\(ts-\\w\\(ts%s\\(tsu/2u\\(ts", s, s, s);
        !            47:        else
        !            48:                printf("%s", s);
        !            49:        if(newline){
        !            50:                y = SCY(e1->copyy) ;
        !            51:                y -= e1->psize * linespace;
        !            52:                e1->copyy = (y - e1->bottom)/e1->scaley + e1->ymin;
        !            53:        }
        !            54:        move(e1->copyx, e1->copyy);
        !            55:        if(!more)break;
        !            56:        s = p+1;
        !            57:        }
        !            58: }

unix.superglobalmegacorp.com

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