Annotation of researchv9/cmd/grap/frame.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include "grap.h"
        !             3: #include "y.tab.h"
        !             4: 
        !             5: double frame_ht;       /* default frame height */
        !             6: double frame_wid;      /* and width */
        !             7: 
        !             8: int    nsides  = 0;            /* how many sides given on this frame */
        !             9: char   *sides[] = {
        !            10:                "\tline from Frame.nw to Frame.ne",
        !            11:                "\tline from Frame.sw to Frame.se",
        !            12:                "\tline from Frame.sw to Frame.nw",
        !            13:                "\tline from Frame.se to Frame.ne"
        !            14: };
        !            15: char   *newsides[4] = { 0, 0, 0, 0 };  /* filled in later */
        !            16: 
        !            17: frame()                /* pump out frame definition, reset for next */
        !            18: {
        !            19:        int i;
        !            20: 
        !            21:        fprintf(tfd, "\tframeht = %g\n", frame_ht);
        !            22:        fprintf(tfd, "\tframewid = %g\n", frame_wid);
        !            23:        fprintf(tfd, "Frame:\tbox ht frameht wid framewid with .sw at 0,0 ");
        !            24:        if (nsides == 0)
        !            25:                fprintf(tfd, "\n");
        !            26:        else {
        !            27:                fprintf(tfd, "invis\n");
        !            28:                for (i = 0; i < 4; i++) {
        !            29:                        if (newsides[i]) {
        !            30:                                fprintf(tfd, "%s\n", newsides[i]);
        !            31:                                free(newsides[i]);
        !            32:                                newsides[i] = 0;
        !            33:                        } else
        !            34:                                fprintf(tfd, "%s\n", sides[i]);
        !            35:                }
        !            36:                nsides = 0;
        !            37:        }
        !            38: }
        !            39: 
        !            40: frameht(f)     /* set height of frame */
        !            41:        double f;
        !            42: {
        !            43:        frame_ht = f;
        !            44: }
        !            45: 
        !            46: framewid(f)    /* set width of frame */
        !            47:        double f;
        !            48: {
        !            49:        frame_wid = f;
        !            50: }
        !            51: 
        !            52: frameside(type, desc)  /* create and remember sides */
        !            53:        int type;
        !            54:        Attr *desc;
        !            55: {
        !            56:        int n;
        !            57:        char buf[100];
        !            58: 
        !            59:        nsides++;
        !            60:        switch (type) {
        !            61:        case 0:         /* no side specified; kludge up all */
        !            62:                frameside(TOP, desc);
        !            63:                frameside(BOT, desc);
        !            64:                frameside(LEFT, desc);
        !            65:                frameside(RIGHT, desc);
        !            66:                return;
        !            67:        case TOP:       n = 0; break;
        !            68:        case BOT:       n = 1; break;
        !            69:        case LEFT:      n = 2; break;
        !            70:        case RIGHT:     n = 3; break;
        !            71:        }
        !            72:        sprintf(buf, "%s %s", sides[n], desc_str(desc));
        !            73:        newsides[n] = tostring(buf);
        !            74: }

unix.superglobalmegacorp.com

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