Annotation of researchv10no/cmd/picasso/movegen.c, revision 1.1

1.1     ! root        1: /*     Copyright (c) 1988 AT&T */
        !             2: /*       All Rights Reserved   */
        !             3: 
        !             4: /*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
        !             5: /*     The copyright notice above does not evidence any        */
        !             6: /*     actual or intended publication of such source code.     */
        !             7: 
        !             8: /*     @(#)picasso:movegen.c   1.0     */
        !             9: #include       "picasso.h"
        !            10: #include       "y.tab.h"
        !            11: 
        !            12: obj *movegen()
        !            13: {
        !            14: static double prevdx, prevdy;
        !            15: static int     xtab[] = { 1, 0, -1, 0 };       /* R=0, U=1, L=2, D=3 */
        !            16: static int     ytab[] = { 0, 1, 0, -1 };
        !            17: 
        !            18: struct objattr obat;
        !            19:        double  defx, defy, dx, dy, tcolor;
        !            20:        int     i, some;
        !            21:        obj     *p;
        !            22:        obj     *ppos;
        !            23:        Attr    *ap;
        !            24: 
        !            25:        defx = getfval("movewid");
        !            26:        defy = getfval("moveht");
        !            27:        tcolor = -1;
        !            28:        set_text();
        !            29:        dx = dy = some = 0;
        !            30:        for (i = 0; i < nattr; i++) {
        !            31:                ap = &attr[i];
        !            32:                switch (ap->a_type) {
        !            33:                case FONT:
        !            34:                case SIZE:
        !            35:                case SPACE:
        !            36:                case TEXTATTR:
        !            37:                        miscattrs(ap, &obat);   /* obat not really used here */ 
        !            38:                        break;
        !            39:                case TCOLOR:
        !            40:                        tcolor = ap->a_val.f;
        !            41:                        break;
        !            42:                case SAME:
        !            43:                        dx = prevdx;
        !            44:                        dy = prevdy;
        !            45:                        some++;
        !            46:                        break;
        !            47:                case LEFT:
        !            48:                        dx -= (ap->a_sub==DEFAULT) ? defx : ap->a_val.f;
        !            49:                        some++;
        !            50:                        hvmode = L_DIR;
        !            51:                        break;
        !            52:                case RIGHT:
        !            53:                        dx += (ap->a_sub==DEFAULT) ? defx : ap->a_val.f;
        !            54:                        some++;
        !            55:                        hvmode = R_DIR;
        !            56:                        break;
        !            57:                case UP:
        !            58:                        dy += (ap->a_sub==DEFAULT) ? defy : ap->a_val.f;
        !            59:                        some++;
        !            60:                        hvmode = U_DIR;
        !            61:                        break;
        !            62:                case DOWN:
        !            63:                        dy -= (ap->a_sub==DEFAULT) ? defy : ap->a_val.f;
        !            64:                        some++;
        !            65:                        hvmode = D_DIR;
        !            66:                        break;
        !            67:                case TO:
        !            68:                        ppos = ap->a_val.o;
        !            69:                        dx = Xformx(ppos, 1, ppos->o_x, ppos->o_y) - curx;
        !            70:                        dy = Xformy(ppos, 0, ppos->o_x, ppos->o_y) - cury;
        !            71:                        some++;
        !            72:                        break;
        !            73:                case BY:
        !            74:                        ppos = ap->a_val.o;
        !            75:                        dx = Xformx(ppos, 1, ppos->o_x, ppos->o_y);
        !            76:                        dy = Xformy(ppos, 0, ppos->o_x, ppos->o_y);
        !            77:                        some++;
        !            78:                        break;
        !            79:                case FROM:
        !            80:                case AT:
        !            81:                        ppos = ap->a_val.o;
        !            82:                        curx = Xformx(ppos, 1, ppos->o_x, ppos->o_y);
        !            83:                        cury = Xformy(ppos, 0, ppos->o_x, ppos->o_y);
        !            84:                        break;
        !            85:                }
        !            86:        }
        !            87:        if (some) {
        !            88:                defx = dx;
        !            89:                defy = dy;
        !            90:        } else {
        !            91:                defx *= xtab[hvmode];
        !            92:                defy *= ytab[hvmode];
        !            93:        }
        !            94:        prevdx = defx;
        !            95:        prevdy = defy;
        !            96:        extreme(curx, cury, Gbox);
        !            97:        curx += defx;
        !            98:        cury += defy;
        !            99:        extreme(curx, cury, Gbox);
        !           100:        p = makenode(MOVE, 0, 0);
        !           101:        if (p->o_nt2 > p->o_nt1) {
        !           102:                p->o_text = tcolor;
        !           103:                checktextcolor(p);
        !           104:                text_bounds(p);
        !           105:        }
        !           106:        return(p);
        !           107: }

unix.superglobalmegacorp.com

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