Annotation of researchv10no/cmd/ideal/tests/tree.i, revision 1.1

1.1     ! root        1: tree
        !             2: .nf
        !             3: .IS
        !             4: box treenode
        !             5: {
        !             6: var ne, nw, sw, se,
        !             7:     hook, lchild, rchild, cen;
        !             8: ne = nw + width;
        !             9: se = sw + width;
        !            10: ne = se + (0,1)*height;
        !            11: hook = (ne + nw)/2;
        !            12: cen = (ne + sw)/2;
        !            13: lchild = (sw + cen)/2;
        !            14: rchild = (se + cen)/2;
        !            15: conn ne to nw;
        !            16: conn nw to sw;
        !            17: conn sw to se;
        !            18: conn se to ne;
        !            19: conn (nw + sw)/2 to (ne + se)/2;
        !            20: conn cen to (sw + se)/2;
        !            21: }
        !            22: 
        !            23: box tree
        !            24: {
        !            25: var height, width;
        !            26: height = ht/2;
        !            27: width = 2*wd/3;
        !            28: put node0:treenode{hook=root;};
        !            29: put node1:treenode{hook=node0.hook-(0,1)*ht-wd;};
        !            30: put node2:treenode{hook=node0.hook-(0,1)*ht+wd;};
        !            31: put node3:treenode{hook=node2.hook-(0,1)*ht-wd;};
        !            32: put node4:treenode{hook=node2.hook-(0,1)*ht+wd;};
        !            33: conn node0.lchild to node1.hook;
        !            34: conn node0.rchild to node2.hook;
        !            35: conn node2.lchild to node3.hook;
        !            36: conn node2.rchild to node4.hook;
        !            37: }
        !            38: 
        !            39: box main
        !            40: {
        !            41: put T:tree{var root, ht, wd;
        !            42: root = (1,-3);
        !            43: ht = 1;
        !            44: wd = 1;
        !            45: };
        !            46: }
        !            47: .IE
        !            48: .IS
        !            49: ...forget treenode tree
        !            50: .IE

unix.superglobalmegacorp.com

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