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