macro = ; var: actTree actNode nextNode done ; goto = %0 ; if (ntax < 0) goto OnError ; p/ ; end if (argnumber > 0) set actTree %1; else set actTree 0; end if ('actTree' > ntrees) quote ERROR: Invalid tree; goto OnError ; p /; end report- ; sil = all ; log tree.xml ; sil - file ; quote ; quote ; quote ; set done 0 ; set actNode root ; sil = con ; loop =nav 0 2 set done ++ ; progress 'done' (root*2) Converting...; quote ; set nextNode firstdes [ 'actTree' 'actNode' ] ; if ('nextNode' == -1) quote $taxon 'actNode' ; quote ; else quote node 'actNode' ; set actNode 'nextNode' ; setloop 0 ; continue ; end loop =gonx 0 2 set nextNode sister [ 'actTree' 'actNode' ] ; if (( 'nextNode' == -1) || ( 'nextNode' == firstdes [ 'actTree' anc [ 'actTree' 'actNode' ]])) set actNode anc [ 'actTree' 'actNode' ] ; if ('actNode' > nnodes [ 'actTree' ]) endloop ; end ; quote ; setloop 0 ; continue ; end set actNode 'nextNode' ; endloop ; stop ; if ('actNode' > nnodes [ 'actTree' ]) endloop ; end ; setloop 0 ; stop ; progress/; sil - all ; quote ; log /; report = ; p /; label OnError; quote *** --- From TNT To XML --- *** ; quote A simple macro to transform a TNT tree into a set of nodes on XML; quote to be readed with Vip.; quote toXML [T] ; quote Parameters: ; quote T, the number of tree used for the output (0 by default) ; quote Writes the result in tree.xml ; p/ ;