00001 void pstable()
00002 {
00003
00004
00005 char *symbol1[] =
00006 {"A","B","C","D","E","F","G","H","I","J","K","L","M","N",
00007 "O","P","Q","R","S","T","U","V","W","X","Y","Z",
00008 "0","1","2","3","4","5","6","7","8","9",
00009 ".",",","+","-","*","/","=","(",")","{","}","END"};
00010
00011 char *symbol2[] =
00012 {"a","b","c","d","e","f","g","h","i","j","k","l","m","n",
00013 "o","p","q","r","s","t","u","v","w","x","y","z",
00014 ":","\;","\@","\\","\_","\|","\%",
00015 "@'","<",">","[","]","\42","@\43","@\136",
00016 "@\77","@\41","@&","$","@\176"," ","END"};
00017
00018 char *symbol3[] =
00019 {"\241","\242","\243","\244","\245","\246","\247","\250",
00020 "\251","\252","\253","\254","\255","\256","\257","\260",
00021 "\261","\262","\263","\264","\265","\266","\267","\270",
00022 "\271","\272","\273","\274","\275","\276","\277","\300",
00023 "\301","\302","\303","\304","\305","\306","\307","\310",
00024 "\311","\312","\313","\314","\315","\316","\317","END"};
00025
00026 char *symbol4[] =
00027 {"\321","\322","\323","\324","\325","\326","\327","\330",
00028 "\331","\332","\333","\334","\335","\336","\337","\340",
00029 "\341","\342","\343","\344","\345","\346","\347","\340",
00030 "\351","\352","\353","\354","\355","\356","\357","\360",
00031 "\361","\362","\363","\364","\365","\366","\367","\370",
00032 "\371","\372","\373","\374","\375","\376","\377","END"};
00033
00034 char *symbol5[] =
00035 {"\177","\200","\201","\202","\203","\204","\205","\206",
00036 "\207","\210","\211","\212","\213","\214","\215","\216",
00037 "\217","\220","\221","\222","\223","\224","\225","\226",
00038 "\227","\230","\231","\232","\233","\234","\235","\236",
00039 "\237","\240","END"};
00040
00041 Float_t xrange = 18;
00042 Float_t yrange = 25;
00043 Int_t w = 650;
00044 Int_t h = w*yrange/xrange;
00045
00046 TCanvas *c1 = new TCanvas("c1","c1",200,10,w,h);
00047 c1->Range(0,0,xrange,yrange);
00048
00049 TText *t = new TText(0,0,"a");
00050 t->SetTextSize(0.02);
00051 t->SetTextFont(62);
00052 t->SetTextAlign(22);
00053
00054 table(0.5,0.5*xrange-0.5,yrange,t,symbol1,0);
00055 table(0.5*xrange+0.5,xrange-0.5,yrange,t,symbol2,0);
00056 TText *tlabel = new TText(0,0,"a");
00057 tlabel->SetTextFont(72);
00058 tlabel->SetTextSize(0.018);
00059 tlabel->SetTextAlign(22);
00060 tlabel->DrawText(0.5*xrange,1.3,
00061 "Input characters are standard keyboard characters");
00062 c1->Modified();
00063 c1->Update();
00064 c1->Print("pstable1.ps");
00065
00066 TCanvas *c2 = new TCanvas("c2","c2",220,20,w,h);
00067 c2->Range(0,0,xrange,yrange);
00068
00069 table(0.5,0.5*xrange-0.5,yrange,t,symbol3,1);
00070 table(0.5*xrange+0.5,xrange-0.5,yrange,t,symbol4,1);
00071 tlabel->DrawText(0.5*xrange,1.3,
00072 "Input characters using backslash and octal numbers");
00073 c2->Modified();
00074 c2->Update();
00075 c2->Print("pstable2.ps");
00076
00077 TCanvas *c3 = new TCanvas("c3","c3",240,20,w,h);
00078 c3->Range(0,0,xrange,yrange);
00079
00080 table(0.5,0.5*xrange-0.5,yrange,t,symbol5,1);
00081 tlabel->DrawText(0.5*xrange,1.3,
00082 "Input characters using backslash and octal numbers");
00083 c3->Modified();
00084 c3->Update();
00085 c3->Print("pstable3.ps");
00086 }
00087 void table(Float_t x1, Float_t x2, Float_t yrange, TText *t,
00088 char **symbol, Bool_t octal)
00089 {
00090 Int_t i;
00091 Int_t n = 0;
00092 for (i=0;i<1000;i++) {
00093 if (!strcmp(symbol[i],"END")) break;
00094 n++;
00095 }
00096 Float_t y1 = 2.5;
00097 Float_t y2 = yrange - 0.5;
00098 Float_t dx = (x2-x1)/5;
00099 Float_t dy = (y2 - 1 -y1)/(n+1);
00100 Float_t y = y2 - 1 - 0.7*dy;
00101 Float_t xc0 = x1 + 0.5*dx;
00102 Float_t xc1 = xc0 + dx;
00103 Float_t xc2 = xc1 + dx;
00104 Float_t xc3 = xc2 + dx;
00105 Float_t xc4 = xc3 + dx;
00106 TLine *line = new TLine();
00107 line->DrawLine(x1,y1,x1,y2);
00108 line->DrawLine(x1,y1,x2,y1);
00109 line->DrawLine(x1,y2,x2,y2);
00110 line->DrawLine(x2,y1,x2,y2);
00111 line->DrawLine(x1,y2-1,x2,y2-1);
00112 line->DrawLine(x1+ dx,y1,x1+ dx,y2);
00113 line->DrawLine(x1+2*dx,y1,x1+2*dx,y2);
00114 line->DrawLine(x1+3*dx,y1,x1+3*dx,y2);
00115 line->DrawLine(x1+4*dx,y1,x1+4*dx,y2);
00116 TText *tit = new TText(0,0,"a");
00117 tit->SetTextSize(0.015);
00118 tit->SetTextFont(72);
00119 tit->SetTextAlign(22);
00120 tit->DrawText(xc0,y2-0.6,"Input");
00121 tit->DrawText(xc1,y2-0.6,"Roman");
00122 tit->DrawText(xc2,y2-0.6,"Greek");
00123 tit->DrawText(xc3,y2-0.6,"Special");
00124 tit->DrawText(xc4,y2-0.6,"Zapf");
00125 char text[12];
00126 for (i=0;i<n;i++) {
00127 if (octal) {
00128 unsigned char value = *symbol[i];
00129 sprintf(text,"@\\ %3o",value);
00130 } else {
00131 strcpy(text,symbol[i]);
00132 }
00133 t->DrawText(xc0,y,text);
00134 sprintf(text,"%s",symbol[i]);
00135 t->DrawText(xc1,y,text);
00136 sprintf(text,"`%s",symbol[i]);
00137 t->DrawText(xc2,y,text);
00138 sprintf(text,"'%s",symbol[i]);
00139 t->DrawText(xc3,y,text);
00140 sprintf(text,"~%s",symbol[i]);
00141 t->DrawText(xc4,y,text);
00142 y -= dy;
00143 }
00144 }