xref: /aoo4110/main/slideshow/qa/debug/nodetree.sh (revision b1cdbd2c)
1*b1cdbd2cSJim Jagielski#!/bin/sh
2*b1cdbd2cSJim Jagielski# *************************************************************
3*b1cdbd2cSJim Jagielski#
4*b1cdbd2cSJim Jagielski#  Licensed to the Apache Software Foundation (ASF) under one
5*b1cdbd2cSJim Jagielski#  or more contributor license agreements.  See the NOTICE file
6*b1cdbd2cSJim Jagielski#  distributed with this work for additional information
7*b1cdbd2cSJim Jagielski#  regarding copyright ownership.  The ASF licenses this file
8*b1cdbd2cSJim Jagielski#  to you under the Apache License, Version 2.0 (the
9*b1cdbd2cSJim Jagielski#  "License"); you may not use this file except in compliance
10*b1cdbd2cSJim Jagielski#  with the License.  You may obtain a copy of the License at
11*b1cdbd2cSJim Jagielski#
12*b1cdbd2cSJim Jagielski#    http://www.apache.org/licenses/LICENSE-2.0
13*b1cdbd2cSJim Jagielski#
14*b1cdbd2cSJim Jagielski#  Unless required by applicable law or agreed to in writing,
15*b1cdbd2cSJim Jagielski#  software distributed under the License is distributed on an
16*b1cdbd2cSJim Jagielski#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*b1cdbd2cSJim Jagielski#  KIND, either express or implied.  See the License for the
18*b1cdbd2cSJim Jagielski#  specific language governing permissions and limitations
19*b1cdbd2cSJim Jagielski#  under the License.
20*b1cdbd2cSJim Jagielski#
21*b1cdbd2cSJim Jagielski# *************************************************************
22*b1cdbd2cSJim Jagielski#
23*b1cdbd2cSJim Jagielski#  $Revision: 1.3 $
24*b1cdbd2cSJim Jagielski#
25*b1cdbd2cSJim Jagielski#  Last changes: $Author: kz $ $Date: 2005-01-21 16:54:21 $
26*b1cdbd2cSJim Jagielski#
27*b1cdbd2cSJim Jagielski#  Generate node tree from verbose logfile
28*b1cdbd2cSJim Jagielski#
29*b1cdbd2cSJim Jagielski#  HOWTO USE
30*b1cdbd2cSJim Jagielski#  =========
31*b1cdbd2cSJim Jagielski#
32*b1cdbd2cSJim Jagielski#  First of all, you need to recompile modules slideshow and canvas
33*b1cdbd2cSJim Jagielski#  with VERBOSE=t set in the environment, and debug=t defined at the
34*b1cdbd2cSJim Jagielski#  build tool command line. Then run your slideshow and redirect stdout
35*b1cdbd2cSJim Jagielski#  to a file.
36*b1cdbd2cSJim Jagielski#
37*b1cdbd2cSJim Jagielski#  Then, call 'nodetree.sh trace-file > tree.ps' to generate a
38*b1cdbd2cSJim Jagielski#  PostScript file for the AnimationNode tree generated during the show.
39*b1cdbd2cSJim Jagielski#  Since these easily get pretty huge, use only one page, and try to
40*b1cdbd2cSJim Jagielski#  limit the slide content (which have effects assigned, that is) to
41*b1cdbd2cSJim Jagielski#  the bare minimum (to reproduce your bug, or whatever you need this
42*b1cdbd2cSJim Jagielski#  for).
43*b1cdbd2cSJim Jagielski#
44*b1cdbd2cSJim Jagielski#  The generated output will have all nodes color-coded with their state
45*b1cdbd2cSJim Jagielski#  at the point when the tree was dumped (see colors.sh for the color
46*b1cdbd2cSJim Jagielski#  codes)
47*b1cdbd2cSJim Jagielski#
48*b1cdbd2cSJim Jagielski#  When looking for the mechanics that generate the relevant output,
49*b1cdbd2cSJim Jagielski#  grep for the DEBUG_NODES_SHOWTREE macros in the slideshow source:
50*b1cdbd2cSJim Jagielski#  Each such place dumps the current node tree to the trace output. Thus,
51*b1cdbd2cSJim Jagielski#  if you need to check the tree state at other places or times, just add
52*b1cdbd2cSJim Jagielski#  a DEBUG_NODES_SHOWTREE (or DEBUG_NODES_SHOWTREE_WITHIN, that is).
53*b1cdbd2cSJim Jagielski#
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski###################################################
56*b1cdbd2cSJim Jagielski#
57*b1cdbd2cSJim Jagielski# Generate node tree
58*b1cdbd2cSJim Jagielski#
59*b1cdbd2cSJim Jagielski###################################################
60*b1cdbd2cSJim Jagielski
61*b1cdbd2cSJim Jagielskiegrep "Node connection|Node state" $1 | 										\
62*b1cdbd2cSJim Jagielski	sed -e '/Node state/ s/.*Node state.*: \(.*\)/\1/' 							\
63*b1cdbd2cSJim Jagielski		-e '/Node connection/ s/.*Node connection.*: \(n.*\)/\1/' | 			\
64*b1cdbd2cSJim Jagielski																				\
65*b1cdbd2cSJim Jagielskiawk 'BEGIN { print "digraph Event_network {" }; { print } END { print "}" }' |	\
66*b1cdbd2cSJim Jagielski																				\
67*b1cdbd2cSJim Jagielski																				\
68*b1cdbd2cSJim Jagielski# fill a complete A1 page with graph output
69*b1cdbd2cSJim Jagielskidot -Gratio=fill -Gsize=23,33 -Tps
70*b1cdbd2cSJim Jagielski#dot -Gratio=fill -Gorientation=land -Tps
71