From fa350ff0513dcd84e284d48312548a7381e8988f Mon Sep 17 00:00:00 2001 From: mkv Date: Fri, 14 Dec 2012 16:51:39 +0400 Subject: [PATCH] 0023452: Couldn't catch results produced by commands "data" and "tpstat" Add new printer Improving of duplication of command's output Simplification of removing duplication of command's output Removing of brackets improved version Test correction --- src/Draw/Draw_Printer.cxx | 15 +++++++++------ src/XSDRAW/XSDRAW.cdl | 2 +- src/XSDRAW/XSDRAW.cxx | 7 +++++++ tests/bugs/iges/buc60685 | 24 +++++++++--------------- 4 files changed, 26 insertions(+), 22 deletions(-) mode change 100644 => 100755 tests/bugs/iges/buc60685 diff --git a/src/Draw/Draw_Printer.cxx b/src/Draw/Draw_Printer.cxx index 284ee40568..044bfca2ae 100755 --- a/src/Draw/Draw_Printer.cxx +++ b/src/Draw/Draw_Printer.cxx @@ -45,8 +45,9 @@ void Draw_Printer::Send (const TCollection_ExtendedString& theString, if ( ! myTcl ) return; (*(Draw_Interpretor*)myTcl) << theString; - if ( putEndl ) - (*(Draw_Interpretor*)myTcl) << '\n'; + if ( putEndl ){ + (*(Draw_Interpretor*)myTcl) << "\n"; + } } //======================================================================= @@ -61,8 +62,9 @@ void Draw_Printer::Send (const Standard_CString theString, if ( ! myTcl ) return; (*(Draw_Interpretor*)myTcl) << theString; - if ( putEndl ) - (*(Draw_Interpretor*)myTcl) << '\n'; + if ( putEndl ){ + (*(Draw_Interpretor*)myTcl) << "\n"; + } } //======================================================================= @@ -77,6 +79,7 @@ void Draw_Printer::Send (const TCollection_AsciiString& theString, if ( ! myTcl ) return; (*(Draw_Interpretor*)myTcl) << theString; - if ( putEndl ) - (*(Draw_Interpretor*)myTcl) << '\n'; + if ( putEndl ){ + (*(Draw_Interpretor*)myTcl) << "\n"; + } } diff --git a/src/XSDRAW/XSDRAW.cdl b/src/XSDRAW/XSDRAW.cdl index 800bf8c292..da492582bd 100755 --- a/src/XSDRAW/XSDRAW.cdl +++ b/src/XSDRAW/XSDRAW.cdl @@ -31,7 +31,7 @@ package XSDRAW uses TCollection, TColStd, TopTools, gp, Geom, Geom2d, TopoDS, MoniTool, - Interface, Transfer, IFSelect, XSControl, Draw, SWDRAW + Interface, Transfer, IFSelect, XSControl, Draw, SWDRAW, Message is diff --git a/src/XSDRAW/XSDRAW.cxx b/src/XSDRAW/XSDRAW.cxx index f7a04e6d8c..d653647af3 100755 --- a/src/XSDRAW/XSDRAW.cxx +++ b/src/XSDRAW/XSDRAW.cxx @@ -39,6 +39,8 @@ #include #include +#include +#include static int deja = 0, dejald = 0; //unused variable @@ -109,6 +111,11 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands) // performed not in IFSelect_SessionPilot but in standard Tcl interpretor XSDRAW::RemoveCommand("x"); XSDRAW::RemoveCommand("exit"); + const Handle(Message_Messenger) &sout = Message::DefaultMessenger(); + if (!sout.IsNull()){ + sout->RemovePrinters(STANDARD_TYPE(Message_PrinterOStream)); + sout->AddPrinter(new Draw_Printer(theCommands)); + } // if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew"); Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands(0); diff --git a/tests/bugs/iges/buc60685 b/tests/bugs/iges/buc60685 old mode 100644 new mode 100755 index 49c415f343..195116e3c8 --- a/tests/bugs/iges/buc60685 +++ b/tests/bugs/iges/buc60685 @@ -10,21 +10,15 @@ set l [igesbrep [locate_data_file buc60685a.igs] a xst-transferrable-roots] tpcompound result puts [checkshape result r] -set start [lindex $l 60] -set bug_list_numb [ llength $l ] -set bug_list_elem 0 -while { $bug_list_elem != $bug_list_numb } { - if { [ string compare "Nb" [ lindex $l $bug_list_elem ] ] == 0 && [ string compare "entities" [ lindex $l [ expr { $bug_list_elem + 1 } ] ] ] == 0 && [ string compare "selected" [ lindex $l [ expr { $bug_list_elem + 2 } ] ] ] == 0 && [ string compare ":" [ lindex $l [ expr { $bug_list_elem + 3 } ] ] ] == 0 } { - set start [ lindex $l [ expr { $bug_list_elem + 4 } ] ] - set bug_list_elem [ expr { $bug_list_numb - 1 } ] - } - set bug_list_elem [ expr { $bug_list_elem + 1 } ] -} - -set n [llength $l] -set end [lindex $l [expr $n-1]] -if { $start != $end } { - puts "Error : wrong number of translated shapes. It is ${end} instead of ${start}" +regexp {List given by xst-transferrable-roots : Nb entities selected : +([-0-9+eE]+)} ${l} full start +regexp {List given by xst-transferrable-roots : Nb entities selected : +([-0-9+eE]+)} ${l} full end +puts "start = ${start}" +puts "end = ${end}" +if { ${start} == ${end} && ${start} == 19 } { + puts "BUC60685: OK" +} else { + puts "Faulty : wrong number of translated shapes. It is ${end} instead of ${start}" + puts "BUC60685: Faulty" } set 2dviewer 0 -- 2.39.5