Browse Source

repl - avoid unnecessary string rep conversion to aid analysis using tcl::unsupported::representation

master
Julian Noble 2 years ago
parent
commit
e30e834bf8
  1. 17
      src/punk86.vfs/lib/app-punk/repl.tcl

17
src/punk86.vfs/lib/app-punk/repl.tcl

@ -1040,7 +1040,18 @@ proc repl::repl_handler {inputchan prompt_config} {
} }
} else { } else {
rputs $resultprompt[string map [list \n "\n$resultprompt"] $result] #-----------------------------------------------------------
# avoid repl forcing string rep of simple results. This is just to aid analysis using tcl::unsupported::representation
set rparts [split $result {}]
if {[lsearch $rparts \n] < 0} {
#type of $result unaffected
rputs "$resultprompt $result"
} else {
#$result will be a string due to use of string map
rputs $resultprompt[string map [list \n "\n$resultprompt"] $result]
}
#-----------------------------------------------------------
#rputs $resultprompt[string map [list \n "\n$resultprompt"] $result]
} }
doprompt "P% " doprompt "P% "
} else { } else {
@ -1090,10 +1101,10 @@ proc repl::repl_handler {inputchan prompt_config} {
rputs stderr "${c}repl interrupted$n" rputs stderr "${c}repl interrupted$n"
#set command [list error "repl interrupted"] #set command [list error "repl interrupted"]
set command "" set command ""
doprompt ">_" doprompt ">_ "
} else { } else {
doprompt "> " doprompt "> "
} }
} }
fileevent $inputchan readable [list [namespace current]::repl_handler $inputchan $prompt_config] fileevent $inputchan readable [list [namespace current]::repl_handler $inputchan $prompt_config]

Loading…
Cancel
Save