Annotation of researchv10no/cmd/picasso/objcopy.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:objcopy.c   1.0     */
        !             9: #include       "picasso.h"
        !            10: #include       "y.tab.h"
        !            11: 
        !            12: obj *copyone (p, delx, dely)
        !            13:        obj     *p;
        !            14:        double  delx, dely;
        !            15: {
        !            16:        obj     *q, *r;
        !            17:        unsigned n;
        !            18: 
        !            19:        if (p->o_type > TEXT)
        !            20:                return p;
        !            21:        n = sizeof(obj) + sizeof(YYSTYPE) * (p->o_size - 1);
        !            22:        if ((q = (obj *)malloc(n)) == NULL) {
        !            23:                yyerror("out of space in object copy");
        !            24:                exit(1);
        !            25:        }
        !            26:        memcpy (q, p, n);
        !            27:        q->o_next = objtail;
        !            28:        q->o_prev = objtail->o_prev;
        !            29:        q->o_prev->o_next = objtail->o_prev = q;        
        !            30:        q->o_nt1 = ntext;               /* copy all the text strings */
        !            31:        q->o_nt2 = copytext(p->o_nt1, p->o_nt2);
        !            32:        translate(q, delx, dely);
        !            33: 
        !            34:        if (q->o_type == BLOCK) {       /* copy objects through BLOCKEND */
        !            35: 
        !            36:                for (r = p->o_next; r != p->o_val[N_VAL].o; r = r->o_next)
        !            37:                        copyone(r, 0.0, 0.0)->o_parent = q;
        !            38: 
        !            39:                q->o_val[N_VAL].o = r = makenode (BLOCKEND, 0, p->o_layer);
        !            40:                r->o_parent = q;
        !            41:        }
        !            42:        return q;
        !            43: }
        !            44: 
        !            45: obj *copypos (p, q)
        !            46:        obj     *p, *q;
        !            47: {
        !            48:        obj     *r;
        !            49:        float   bnd[4];
        !            50:        double  ox,oy;
        !            51: 
        !            52:        ox = Xformx(p, 1, p->o_x, p->o_y);
        !            53:        oy = Xformy(p, 0, p->o_x, p->o_y);
        !            54:        r = copyone(p, q->o_x - ox, q->o_y - oy);
        !            55:        get_bounds(r, bnd, 1);
        !            56:        track_bounds(bnd[0],bnd[1],bnd[2],bnd[3]);
        !            57: }
        !            58: 
        !            59: obj *copyobj (p, xx, yy)
        !            60:        obj     *p;
        !            61:        char    *xx, *yy;
        !            62: {
        !            63:        obj     *q;
        !            64:        struct  symtab  *x, *y;
        !            65:        int     i;
        !            66:        float   cbox[4], obox[4];
        !            67:        double  x0, y0, x1, y1;
        !            68: 
        !            69:        if ((x = lookup(xx)) == NULL || (y = lookup(yy)) == NULL) {
        !            70:                yyerror("no position defined by (%s,%s)", xx, yy);
        !            71:                return (p);
        !            72:        }
        !            73:        else {
        !            74:                x0 = Xformx(p, 1, p->o_x, p->o_y);
        !            75:                y0 = Xformy(p, 0, p->o_x, p->o_y);
        !            76:                cbox[0] = cbox[1] = cbox[2] = cbox[3] = 0;
        !            77:                first_xy (x, y, &x1, &y1);
        !            78:                do {
        !            79:                        q = copyone (p, x1-x0, y1-y0);
        !            80:                        extreme (x1-x0, y1-y0, cbox);
        !            81:                } while (next_xy (x, y, &x1, &y1));
        !            82:                get_bounds (p, obox, 1);
        !            83:                for (i = 0; i < 4; ++i)
        !            84:                        cbox[i] += obox[i];
        !            85:                track_bounds(cbox[0],cbox[1],cbox[2],cbox[3]);
        !            86:                return q;       /* i.e., last copy */
        !            87:        }
        !            88: }

unix.superglobalmegacorp.com

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