Not logged in
Check-in [85b0e5fa0a]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:update to compile & debug better with mingw and to print xml
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 85b0e5fa0a75c10c0440afd0dde4f902228a780f
User & Date: ramsan 2015-12-10 13:44:02
Context
2015-12-11
13:34
improvements in view variables windows for viewing XML check-in: 3ff8cd9b2f user: ramsan tags: trunk
2015-12-10
13:44
update to compile & debug better with mingw and to print xml check-in: 85b0e5fa0a user: ramsan tags: trunk
2015-11-17
22:11
Control-MouseWheel changes font size check-in: be8f899fa5 user: ramsan tags: trunk
Changes

Changes to RamDebugger.tcl.

  1725   1725   	fconfigure $fin -translation binary
  1726   1726   	set header [read $fin 1024]
  1727   1727   	seek $fin 0
  1728   1728   	fconfigure $fin {*}$fconf
  1729   1729   	if { $opts(-encoding) != 0 && $opts(-encoding) != "" } {
  1730   1730   	    fconfigure $fin -encoding $opts(-encoding)
  1731   1731   	} else {
         1732  +	    if {[string range $header 0 2] eq [binary format ccc 0xEF 0xBB 0xBF] } {
         1733  +		fconfigure $fin -encoding utf-8
         1734  +	    }
  1732   1735   	    set rex {-\*-.*coding:\s*utf-8\s*;.*-\*-|encoding=['\"]utf-8['\"]}
  1733   1736   	    append rex {|<\?xml\s+version=\S+\s*\?>}
  1734   1737   	    if { [regexp -nocase -line -- $rex $header] } {
  1735   1738   		fconfigure $fin -encoding utf-8
  1736   1739   	    }
  1737   1740   	}
  1738   1741   	set currentfile_endline auto
................................................................................
  5659   5662       if { $remoteserver == "" } {
  5660   5663   	if { $currentfile == "" } {
  5661   5664   	    WarnWin [_ "Cannot start debugging. There is no currentfile"] $text
  5662   5665   	    return
  5663   5666   	}
  5664   5667   	set filetype [GiveFileType $currentfile]
  5665   5668   	if { $filetype eq "C/C++" } {
  5666         -	    if { $::tcl_platform(platform) eq "windows" } {
         5669  +	    if { $::tcl_platform(platform) eq "windows" && [cproject::has_visual_studio] } {
  5667   5670   		cproject::start_visual_studio
  5668   5671   		return
  5669   5672   	    }
  5670   5673   	    if { $options(ConfirmStartDebugging) && $remoteserver != "" } {
  5671   5674   		set ret [DialogWin::messageBox -default yes -icon question -message \
  5672   5675   		             [_ "Do you want to start to debug c++ program?"] -parent $text \
  5673   5676   		             -title [_ "start debugging"] -type yesnocancel]
................................................................................
  6216   6219       $textOUT conf -state disabled
  6217   6220       if { $yend == 1 } { $textOUT yview moveto 1 }
  6218   6221   }
  6219   6222   
  6220   6223   proc RamDebugger::TextOutRaiseDo { pane } {
  6221   6224       variable options
  6222   6225   
  6223         -    if { [info exists options(auto_raise_stack_trace)] && $options(auto_raise_stack_trace) } {
  6224         -	catch { $pane raise output }
  6225         -    }
         6226  +#     if { [info exists options(auto_raise_stack_trace)] && $options(auto_raise_stack_trace) } {
         6227  +#         catch { $pane raise output }
         6228  +#     }
         6229  +    catch { $pane raise output }
  6226   6230   }
  6227   6231   
  6228   6232   proc RamDebugger::TextCompGet {} {
  6229   6233       variable textCOMP
  6230   6234   
  6231   6235       if { ![info exists textCOMP] || ![winfo exists $textCOMP] } { return "" }
  6232   6236       return [$textCOMP get 1.0 end-1c]
................................................................................
  6616   6620   	    }
  6617   6621   	    if { ![file exists $file] } {
  6618   6622   		set fullfile [cproject::TryToFindPath $file]
  6619   6623   		if { $fullfile != "" } {
  6620   6624   		    set file $fullfile
  6621   6625   		}
  6622   6626   	    }
         6627  +	    set file [file tail $file]
  6623   6628   	    if { ![file exists $file] && [file exists [file join $options(defaultdir) $file]] } {
  6624   6629   		set file [file join $options(defaultdir) $file]
  6625   6630   	    }
  6626   6631   	    if { ![file exists $file] } {
  6627   6632   		foreach fileF $WindowFilesList {
  6628   6633   		    if { [file tail $fileF] eq $file } {
  6629   6634   		        set file $fileF

Changes to scripts/HelperWindows.tcl.

   199    199   		    } else {
   200    200   		        foreach key [lsort -dictionary [dict keys $dict]] {
   201    201   		            [$w give_uservar_value textv] insert end "$key = [dict get $dict $key]\n"
   202    202   		        }
   203    203   		    }
   204    204   		} else {
   205    205   		    $w set_uservar_value type ""
   206         -		    [$w give_uservar_value textv] insert end [lindex [lindex $res 1] 1]
          206  +		    set txt [lindex [lindex $res 1] 1]
          207  +		    set rex {^type\s*=\s*char\s*\*\s+[^\"]*\"(.+)\"}
          208  +		    if { [regexp $rex $txt {} txt] } {
          209  +		       set txt [string map [list \\\" \" \\n \n] $txt]
          210  +		    }
          211  +		    [$w give_uservar_value textv] insert end $txt
   207    212   		}
   208    213   	    }
   209    214   	    1 {
   210    215   		$w set_uservar_value type error
   211    216   		[$w give_uservar_value textv] configure -fg red
   212    217   		[$w give_uservar_value textv] insert end [lindex $res 1]
   213    218   	    }
................................................................................
   344    349   	}
   345    350   	selectall {
   346    351   	    $text tag add sel 1.0 end-1c
   347    352   	    focus $text
   348    353   	}
   349    354       }
   350    355   }
          356  +
          357  +proc RamDebugger::entry_PSx { entry preffix suffix } {
          358  +    
          359  +    $entry insert 0 $preffix
          360  +    $entry insert end $suffix
          361  +    $entry icursor insert
          362  +}
   351    363   
   352    364   proc RamDebugger::DisplayVarWindow { mainwindow { var "" } } {
   353    365       variable text
   354    366       variable options
   355    367       variable varwindows
   356    368       
   357    369       if { $var eq "" } {
................................................................................
   383    395   	
   384    396   	*  variablename: Enter the name of a variable 
   385    397   	*  $variablename+4: Enter any expression that gdb accepts
   386    398   	*  $variablename@10: print expression and the next 10 similar values
   387    399   	*  $variablename[4:2][6::8]: One extension to the gdb expressions. Permmits to
   388    400   	   print part of a string or vector
   389    401   	*  gdb set print elements 1000 (to send a literal gdb command to debugger, prefix it with "gdb ...")
          402  +	    
          403  +	try Ctrl-2,9,+,n
   390    404       }]
   391    405   
   392    406       if { ![info exists options(old_expressions)] } {
   393    407   	set options(old_expressions) ""
   394    408       }
   395    409   
   396    410       $w set_uservar_value combo [ttk::combobox $f.e1 -textvariable [$w give_uservar expression] \
   397    411   	-values $options(old_expressions)]
   398    412   
   399    413       cu::text_entry_bindings $f.e1
   400         -
   401         -    set c { %W icursor [expr { [%W index "insert"]-1}] }
   402         -    bind $f.e1 <$::control-Key-2> "[list ttk::entry::Insert $f.e1 {""}];$c"
   403         -    bind $f.e1 <$::control-Key-9> "[list ttk::entry::Insert $f.e1 {()}];$c"
   404         -    bind $f.e1 <$::control-plus> "[list ttk::entry::Insert $f.e1 {[]}];$c"
          414  +    
          415  +    bind $f.e1 <$::control-Key-2> [list RamDebugger::entry_PSx $f.e1 \" \"]
          416  +    bind $f.e1 <$::control-Key-9> [list RamDebugger::entry_PSx $f.e1 ( )]
          417  +    bind $f.e1 <$::control-plus> [list RamDebugger::entry_PSx $f.e1 \[ \]]
          418  +    bind $f.e1 <$::control-n> [list RamDebugger::entry_PSx $f.e1 nprint( )]
          419  +    
          420  +#     set c { %W icursor [expr { [%W index "insert"]-1}] }
          421  +#     bind $f.e1 <$::control-Key-2> "[list ttk::entry::Insert $f.e1 {""}];$c"
          422  +#     bind $f.e1 <$::control-Key-9> "[list ttk::entry::Insert $f.e1 {()}];$c"
          423  +#     bind $f.e1 <$::control-plus> "[list ttk::entry::Insert $f.e1 {[]}];$c"
   405    424   
   406    425       $w set_uservar_value expression $var
   407    426       
   408    427       set sw [ScrolledWindow $f.lf -relief sunken -borderwidth 0]
   409    428       $w set_uservar_value textv [text $sw.text -background white -wrap word -width 40 -height 10 \
   410    429   		                       -exportselection 0 -font FixedFont -highlightthickness 0]
   411    430   

Changes to scripts/cplusplusproject.tcl.

  2134   2134   	    puts $fout "\n"
  2135   2135   	}
  2136   2136       }
  2137   2137       close $fout
  2138   2138       
  2139   2139       return $make
  2140   2140   }
         2141  +
         2142  +proc cproject::has_visual_studio {} {
         2143  +    variable dataM
         2144  +    
         2145  +    set debrel $RamDebugger::options(debugrelease)
         2146  +    if { $dataM($debrel,has_userdefined_vs) } {
         2147  +	return 1
         2148  +    } else {
         2149  +	return 0
         2150  +    }
         2151  +}
  2141   2152   
  2142   2153   proc cproject::start_visual_studio {} {
  2143   2154       variable project
  2144   2155       variable dataM
         2156  +    variable dataE
  2145   2157       
  2146   2158       if { $project eq "" } {
  2147   2159   	if { [info exists RamDebugger::options(recentprojects)] && \
  2148   2160   		[llength $RamDebugger::options(recentprojects)] > 0 } {
  2149   2161   	    set project [lindex $RamDebugger::options(recentprojects) 0]
  2150   2162   	    set err [catch { cproject::OpenProject $w 0 }]
  2151   2163   	    if { $err } { set project "" }
................................................................................
  2165   2177       if { $dataM($debrel,has_userdefined_vs)  } {
  2166   2178   	set make $dataM($debrel,vs_solution)
  2167   2179   	set make_args $dataM($debrel,vs_arguments)
  2168   2180   	set make_executable $dataM($debrel,vs_executable)
  2169   2181       } else {
  2170   2182   	error "visual studio project not defined"
  2171   2183       }
         2184  +    
         2185  +    set exe [set! dataE($debrel,exe)]
         2186  +    set exeargs [set! dataE($debrel,exeargs)]
         2187  +    set execdir [set! dataE($debrel,execdir)]
         2188  +    
         2189  +    if { [file executable $exe] } {
         2190  +	cd $execdir
         2191  +	set err [catch { open "|$exe $exeargs |& cat" r+ } fid]
         2192  +	if { $err } {
         2193  +	    snit_messageBox -message $fid
         2194  +	    return
         2195  +	}
         2196  +	RamDebugger::TextOutInsert [_ "Started program '%s'\n" "$exe $exeargs"]
         2197  +	RamDebugger::ViewOnlyTextOrAll -force_all
         2198  +	RamDebugger::TextOutRaise
         2199  +	
         2200  +	fconfigure $fid -blocking 0 -buffering line
         2201  +	fileevent $fid readable [list cproject::dump_program_output $fid]
         2202  +	return
         2203  +    }
  2172   2204       
  2173   2205       set comm [auto_execok devenv.com]
  2174   2206       if { $comm eq "" } {
  2175   2207   	set txt [_ "Add directory for file 'devenv.com' in Preferences->Directories"]
  2176   2208   	snit_messageBox -message $txt -parent $w
  2177   2209   	return
  2178   2210       }
................................................................................
  2184   2216       set err [catch { exec {*}$comm & } errstring]
  2185   2217       if { $err } {
  2186   2218   	WarnWin [_ "error: %s" $errstring]
  2187   2219   	return -1
  2188   2220       }
  2189   2221       cd $pwd
  2190   2222   }
         2223  +
         2224  +proc cproject::dump_program_output { fid } {
         2225  +    
         2226  +    if { [eof $fid] } {
         2227  +	set err [catch { close $fid } ret]
         2228  +	if { $err } {
         2229  +	    RamDebugger::TextOutInsertRed [_ "Program finished --- %s\n" $ret]
         2230  +	} else {
         2231  +	    RamDebugger::TextOutInsert [_ "Program finished\n"]  
         2232  +	}
         2233  +	return
         2234  +    }
         2235  +    set aa [read $fid]
         2236  +    if { $aa ne "" } {
         2237  +	RamDebugger::ViewOnlyTextOrAll -force_all
         2238  +	RamDebugger::TextOutInsert $aa
         2239  +    }
         2240  +}
  2191   2241   
  2192   2242   proc cproject::CompileDo { w debrel nostop { unique_file "" } } {
  2193   2243       variable project
  2194   2244       variable dataM
  2195   2245       variable compilationstatus
  2196   2246   
  2197   2247       if { $project eq "" } {