equal
deleted
inserted
replaced
17 |
17 |
18 Object subclass:#ReadEvalPrintLoop |
18 Object subclass:#ReadEvalPrintLoop |
19 instanceVariableNames:'inputStream outputStream errorStream compiler prompt |
19 instanceVariableNames:'inputStream outputStream errorStream compiler prompt |
20 doChunkFormat traceFlag timingFlag profilingFlag printFlag |
20 doChunkFormat traceFlag timingFlag profilingFlag printFlag |
21 exitAction currentDirectory lastEditedClass lastEditedSelector |
21 exitAction currentDirectory lastEditedClass lastEditedSelector |
22 editorCommand confirmDebugger debuggerUsed' |
22 editorCommand confirmDebugger debuggerUsed returnValuePrinting' |
23 classVariableNames:'' |
23 classVariableNames:'' |
24 poolDictionaries:'' |
24 poolDictionaries:'' |
25 category:'System-Support' |
25 category:'System-Support' |
26 ! |
26 ! |
27 |
27 |
196 |
196 |
197 outputStream notNil ifTrue:[^ outputStream]. |
197 outputStream notNil ifTrue:[^ outputStream]. |
198 ^ Processor activeProcess stdout |
198 ^ Processor activeProcess stdout |
199 |
199 |
200 "Created: / 07-12-2006 / 19:12:27 / cg" |
200 "Created: / 07-12-2006 / 19:12:27 / cg" |
|
201 ! |
|
202 |
|
203 printFlag |
|
204 "true if the return value of expressions should be printed" |
|
205 |
|
206 ^ printFlag ? true |
|
207 ! |
|
208 |
|
209 printFlag:aBoolean |
|
210 "true if the return value of expressions should be printed" |
|
211 |
|
212 printFlag := aBoolean |
201 ! |
213 ! |
202 |
214 |
203 prompt:aString |
215 prompt:aString |
204 "set the prompt" |
216 "set the prompt" |
205 |
217 |
534 trace .............. tracing execution |
546 trace .............. tracing execution |
535 timing ............. timing execution |
547 timing ............. timing execution |
536 profiling .......... show execution profile |
548 profiling .......... show execution profile |
537 chunkFormat ........ traditional bang chunk format input mode |
549 chunkFormat ........ traditional bang chunk format input mode |
538 editor ............. command used with #edit directive |
550 editor ............. command used with #edit directive |
|
551 confirmDebugger .... ask for debug on error |
|
552 print .............. print return values |
539 #debug ................. enter a MiniDebugger |
553 #debug ................. enter a MiniDebugger |
540 #edit <what> ........ open an external editor |
554 #edit <what> ........ open an external editor |
541 class .............. on a class |
555 class .............. on a class |
542 class selector ..... on a method |
556 class selector ..... on a method |
543 <empty> ............ on previously edited method/last class |
557 <empty> ............ on previously edited method/last class |
690 ]. |
704 ]. |
691 (what startsWith:'con') ifTrue:[ |
705 (what startsWith:'con') ifTrue:[ |
692 confirmDebugger := aBoolean. |
706 confirmDebugger := aBoolean. |
693 ^ self. |
707 ^ self. |
694 ]. |
708 ]. |
|
709 (what startsWith:'pri') ifTrue:[ |
|
710 printFlag := aBoolean. |
|
711 ^ self. |
|
712 ]. |
695 ]. |
713 ]. |
696 self errorStream |
714 self errorStream |
697 showCR:'? usage: set/clear <flag>'; |
715 showCR:'? usage: set/clear <flag>'; |
698 showCR:'? (<flag> must be one of: trace, times, profile, chunk, editor, confirmDebug)'. |
716 showCR:'? (<flag> must be one of: trace, times, profile, chunk, editor, confirmDebug, print)'. |
699 |
717 |
700 "Modified: / 08-11-2016 / 22:49:17 / cg" |
718 "Modified: / 08-11-2016 / 22:49:17 / cg" |
701 ! |
719 ! |
702 |
720 |
703 cmd_show:lineStream |
721 cmd_show:lineStream |
1033 ex reject |
1051 ex reject |
1034 ]. |
1052 ]. |
1035 (self confirmDebugger not |
1053 (self confirmDebugger not |
1036 or:[ ex creator isControlInterrupt |
1054 or:[ ex creator isControlInterrupt |
1037 or:[ self askYesNo:('Error encountered: %1\Debug? ' |
1055 or:[ self askYesNo:('Error encountered: %1\Debug? ' |
1038 bindWith:ex description)]] |
1056 withCRs bindWith:ex description)]] |
1039 ) ifTrue:[ |
1057 ) ifTrue:[ |
1040 MiniDebugger enterWithMessage:(ex errorString) mayProceed:true. |
1058 MiniDebugger enterWithMessage:(ex errorString) mayProceed:true. |
1041 "/ if we arrive here, user typed 'c' - continue |
1059 "/ if we arrive here, user typed 'c' - continue |
1042 ex mayProceed ifTrue:[ |
1060 ex mayProceed ifTrue:[ |
1043 ex proceed. |
1061 ex proceed. |
1052 MessageTally spyDetailedOn:[ |
1070 MessageTally spyDetailedOn:[ |
1053 value := (compilerClass new requestor:self) |
1071 value := (compilerClass new requestor:self) |
1054 evaluate:chunk |
1072 evaluate:chunk |
1055 compile:true. |
1073 compile:true. |
1056 ]. |
1074 ]. |
1057 doPrint ifTrue:[ |
1075 (doPrint and:[printFlag]) ifTrue:[ |
1058 '-> (Return value): ' print. |
1076 '-> (Return value): ' print. |
1059 value displayString printOn:output. output cr. |
1077 value displayString printOn:output. output cr. |
1060 output flush. |
1078 output flush. |
1061 ]. |
1079 ]. |
1062 ] ifFalse:[ |
1080 ] ifFalse:[ |
1063 us := Time microsecondsToRun:[ |
1081 us := Time microsecondsToRun:[ |
1064 value := (compilerClass new requestor:self) |
1082 value := (compilerClass new requestor:self) |
1065 evaluate:chunk compile:true. |
1083 evaluate:chunk compile:true. |
1066 ]. |
1084 ]. |
1067 doPrint ifTrue:[ |
1085 (doPrint and:[printFlag]) ifTrue:[ |
1068 value isVoid ifFalse:[ |
1086 value isVoid ifFalse:[ |
1069 '-> (Return value): ' print. |
1087 '-> (Return value): ' print. |
1070 value displayString printOn:output. output cr. |
1088 value displayString printOn:output. output cr. |
1071 output flush. |
1089 output flush. |
1072 ]. |
1090 ]. |
1144 ]. |
1162 ]. |
1145 (error isOpen not) ifTrue:[ |
1163 (error isOpen not) ifTrue:[ |
1146 ]. |
1164 ]. |
1147 ] do:[ |
1165 ] do:[ |
1148 input signalAtEnd:true. |
1166 input signalAtEnd:true. |
|
1167 |
1149 self |
1168 self |
1150 basicReadEvalPrintLoopWithInput:input output:output error:error |
1169 basicReadEvalPrintLoopWithInput:input output:output error:error |
1151 compiler:compilerClass prompt:prompt print:(printFlag ? true). |
1170 compiler:compilerClass prompt:prompt print:true. |
1152 ] |
1171 |
|
1172 ]. |
1153 ]. |
1173 ]. |
1154 "/ self errorStream showCR:('done.'). |
1174 "/ self errorStream showCR:('done.'). |
1155 |
1175 |
1156 " |
1176 " |
1157 Stdin atEnd |
1177 Stdin atEnd |