ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
analyze.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// This macro produces the flowchart of TFormula::Analyze.
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Rene Brun
9 
10 
11 void analyze() {
12  TCanvas *c1 = new TCanvas("c1","Analyze.mac",620,790);
13  c1->Range(-1,0,19,30);
14  TPaveLabel *pl1 = new TPaveLabel(0,27,3.5,29,"Analyze");
15  pl1->SetFillColor(42);
16  pl1->Draw();
17  TPaveText *pt1 = new TPaveText(0,22.8,4,25.2);
18  TText *t1 = pt1->AddText("Parenthesis matching");
19  TText *t2 = pt1->AddText("Remove unnecessary");
20  TText *t2a = pt1->AddText("parenthesis");
21  pt1->Draw();
22  TPaveText *pt2 = new TPaveText(6,23,10,25);
23  TText *t3 = pt2->AddText("break of");
24  TText *t4 = pt2->AddText("Analyze");
25  pt2->Draw();
26  TPaveText *pt3 = new TPaveText(0,19,4,21);
27  t4=pt3->AddText("look for simple");
28  TText *t5 = pt3->AddText("operators");
29  pt3->Draw();
30  TPaveText *pt4 = new TPaveText(0,15,4,17);
31  TText *t6 = pt4->AddText("look for an already");
32  TText *t7 = pt4->AddText("defined expression");
33  pt4->Draw();
34  TPaveText *pt5 = new TPaveText(0,11,4,13);
35  TText *t8 = pt5->AddText("look for usual");
36  TText *t9 = pt5->AddText("functions :cos sin ..");
37  pt5->Draw();
38  TPaveText *pt6 = new TPaveText(0,7,4,9);
39  TText *t10 = pt6->AddText("look for a");
40  TText *t11 = pt6->AddText("numeric value");
41  pt6->Draw();
42  TPaveText *pt7 = new TPaveText(6,18.5,10,21.5);
43  TText *t12 = pt7->AddText("Analyze left and");
44  TText *t13 = pt7->AddText("right part of");
45  TText *t14 = pt7->AddText("the expression");
46  pt7->Draw();
47  TPaveText *pt8 = new TPaveText(6,15,10,17);
48  TText *t15 = pt8->AddText("Replace expression");
49  pt8->Draw();
50  TPaveText *pt9 = new TPaveText(6,11,10,13);
51  TText *t16 = pt9->AddText("Analyze");
52  pt9->SetFillColor(42);
53  pt9->Draw();
54  TPaveText *pt10 = new TPaveText(6,7,10,9);
55  TText *t17 = pt10->AddText("Error");
56  TText *t18 = pt10->AddText("Break of Analyze");
57  pt10->Draw();
58  TPaveText *pt11 = new TPaveText(14,22,17,24);
59  pt11->SetFillColor(42);
60  TText *t19 = pt11->AddText("Analyze");
61  TText *t19a = pt11->AddText("Left");
62  pt11->Draw();
63  TPaveText *pt12 = new TPaveText(14,19,17,21);
64  pt12->SetFillColor(42);
65  TText *t20 = pt12->AddText("Analyze");
66  TText *t20a = pt12->AddText("Right");
67  pt12->Draw();
68  TPaveText *pt13 = new TPaveText(14,15,18,18);
69  TText *t21 = pt13->AddText("StackNumber++");
70  TText *t22 = pt13->AddText("operator[StackNumber]");
71  TText *t23 = pt13->AddText("= operator found");
72  pt13->Draw();
73  TPaveText *pt14 = new TPaveText(12,10.8,17,13.2);
74  TText *t24 = pt14->AddText("StackNumber++");
75  TText *t25 = pt14->AddText("operator[StackNumber]");
76  TText *t26 = pt14->AddText("= function found");
77  pt14->Draw();
78  TPaveText *pt15 = new TPaveText(6,7,10,9);
79  TText *t27 = pt15->AddText("Error");
80  TText *t28 = pt15->AddText("break of Analyze");
81  pt15->Draw();
82  TPaveText *pt16 = new TPaveText(0,2,7,5);
83  TText *t29 = pt16->AddText("StackNumber++");
84  TText *t30 = pt16->AddText("operator[StackNumber] = 0");
85  TText *t31 = pt16->AddText("value[StackNumber] = value found");
86  pt16->Draw();
87  TArrow *ar = new TArrow(2,27,2,25.4,0.012,"|>");
88  ar->SetFillColor(1);
89  ar->Draw();
90  ar->DrawArrow(2,22.8,2,21.2,0.012,"|>");
91  ar->DrawArrow(2,19,2,17.2,0.012,"|>");
92  ar->DrawArrow(2,15,2,13.2,0.012,"|>");
93  ar->DrawArrow(2,11,2, 9.2,0.012,"|>");
94  ar->DrawArrow(2, 7,2, 5.2,0.012,"|>");
95  ar->DrawArrow(4,24,6,24,0.012,"|>");
96  ar->DrawArrow(4,20,6,20,0.012,"|>");
97  ar->DrawArrow(4,16,6,16,0.012,"|>");
98  ar->DrawArrow(4,12,6,12,0.012,"|>");
99  ar->DrawArrow(4, 8,6, 8,0.012,"|>");
100  ar->DrawArrow(10,20,14,20,0.012,"|>");
101  ar->DrawArrow(12,23,14,23,0.012,"|>");
102  ar->DrawArrow(12,16.5,14,16.5,0.012,"|>");
103  ar->DrawArrow(10,12,12,12,0.012,"|>");
104  TText *ta = new TText(2.2,22.2,"err = 0");
105  ta->SetTextFont(71);
106  ta->SetTextSize(0.015);
107  ta->SetTextColor(4);
108  ta->SetTextAlign(12);
109  ta->Draw();
110  ta->DrawText(2.2,18.2,"not found");
111  ta->DrawText(2.2,6.2,"found");
112  TText *tb = new TText(4.2,24.1,"err != 0");
113  tb->SetTextFont(71);
114  tb->SetTextSize(0.015);
115  tb->SetTextColor(4);
116  tb->SetTextAlign(11);
117  tb->Draw();
118  tb->DrawText(4.2,20.1,"found");
119  tb->DrawText(4.2,16.1,"found");
120  tb->DrawText(4.2,12.1,"found");
121  tb->DrawText(4.2, 8.1,"not found");
122  TLine *l1 = new TLine(12,16.5,12,23);
123  l1->Draw();
124 }
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:211
virtual void DrawArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize=0, Option_t *option="")
Draw this arrow with new coordinates.
Definition: TArrow.cxx:138
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Definition: TPaveText.cxx:160
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
virtual void SetTextFont(Font_t tfont=62)
Definition: TAttText.h:59
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:121
Base class for several text objects.
Definition: TText.h:42
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:32
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:4623
A simple line.
Definition: TLine.h:41
The Canvas class.
Definition: TCanvas.h:48
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:35
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
Definition: TText.cxx:171
virtual void SetTextColor(Color_t tcolor=1)
Definition: TAttText.h:57
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60
Draw all kinds of Arrows.
Definition: TArrow.h:35