554 flags .............. flags |
554 flags .............. flags |
555 modules ............ loaded modules |
555 modules ............ loaded modules |
556 packages ........... available packages to load |
556 packages ........... available packages to load |
557 all ................ all of the above |
557 all ................ all of the above |
558 #set/clear <flag> ... set or clear a flag |
558 #set/clear <flag> ... set or clear a flag |
|
559 print .............. print return values |
|
560 nodebug ............ no debugger on error |
|
561 confirmdebug ....... ask for debugger on error |
559 trace .............. tracing execution |
562 trace .............. tracing execution |
560 timing ............. timing execution |
563 timing ............. timing execution |
561 profiling .......... show execution profile |
564 profiling .......... show execution profile |
562 chunkFormat ........ traditional bang chunk format input mode |
565 chunkFormat ........ traditional bang chunk format input mode |
563 editor ............. command used with #edit directive |
566 editor ............. command used with #edit directive |
564 nodebug ............ no debugger on error |
|
565 confirmdebugger .... ask for debugger on error |
|
566 print .............. print return values |
|
567 #debug ................. enter a MiniDebugger |
567 #debug ................. enter a MiniDebugger |
568 #edit <what> ........ open an external editor |
568 #edit <what> ........ open an external editor |
569 class .............. on a class |
569 class .............. on a class |
570 class selector ..... on a method |
570 class selector ..... on a method |
571 <empty> ............ on previously edited method/last class |
571 <empty> ............ on previously edited method/last class |
739 ^ self. |
739 ^ self. |
740 ]. |
740 ]. |
741 ]. |
741 ]. |
742 self errorStream |
742 self errorStream |
743 showCR:'? usage: set/clear <flag>'; |
743 showCR:'? usage: set/clear <flag>'; |
744 showCR:'? (<flag> must be one of: trace, times, profile, chunk, editor, nodebug, confirmdebug, print)'. |
744 showCR:'? (<flag> must be one of: print, nodebug, confirmdebug, trace, times, profile, chunk, editor)'. |
745 self cmd_show:('flags' readStream). |
745 self cmd_show:('flags' readStream). |
746 |
746 |
747 "Modified: / 08-11-2016 / 22:49:17 / cg" |
747 "Modified: / 08-11-2016 / 22:49:17 / cg" |
748 ! |
748 ! |
749 |
749 |
807 ]. |
807 ]. |
808 |
808 |
809 (showAll or:[ what startsWith:'flag' ]) ifTrue:[ |
809 (showAll or:[ what startsWith:'flag' ]) ifTrue:[ |
810 errStream cr; showCR:'Flags:'; showCR:'------'. |
810 errStream cr; showCR:'Flags:'; showCR:'------'. |
811 errStream |
811 errStream |
|
812 showCR:('print: ',self printFlag printString); |
|
813 showCR:('nodebug: ',self noDebugger printString); |
|
814 showCR:('confirmdebug:',self confirmDebugger printString); |
812 showCR:('trace : ',(traceFlag ? false) printString); |
815 showCR:('trace : ',(traceFlag ? false) printString); |
813 showCR:('timing: ',(timingFlag ? false) printString); |
816 showCR:('timing: ',(timingFlag ? false) printString); |
814 showCR:('profiling: ',(profilingFlag ? false) printString); |
817 showCR:('profiling: ',(profilingFlag ? false) printString); |
815 showCR:('chunkFormat: ',(doChunkFormat ? false) printString); |
818 showCR:('chunkFormat: ',(doChunkFormat ? false) printString); |
816 showCR:('editor: ',self editorCommand printString); |
819 showCR:('editor: ',self editorCommand printString); |
817 showCR:('nodebug: ',self noDebugger printString); |
820 yourself. |
818 showCR:('confirmdebug:',self confirmDebugger printString); |
|
819 showCR:('print: ',self printFlag printString). |
|
820 ok := true. |
821 ok := true. |
821 ]. |
822 ]. |
822 ]. |
823 ]. |
823 |
824 |
824 ok ifFalse:[ |
825 ok ifFalse:[ |
1073 and:[chunk withoutSeparators notEmpty |
1074 and:[chunk withoutSeparators notEmpty |
1074 and:[chunk withoutSeparators ~= '.']] |
1075 and:[chunk withoutSeparators ~= '.']] |
1075 ) ifTrue:[ |
1076 ) ifTrue:[ |
1076 "abortAll is handled, but not asked for here!!" |
1077 "abortAll is handled, but not asked for here!!" |
1077 AbortAllOperationRequest handle:[:ex | |
1078 AbortAllOperationRequest handle:[:ex | |
|
1079 ObjectMemory sendTraceOff. |
1078 error nextPutLine:('Evaluation aborted.') |
1080 error nextPutLine:('Evaluation aborted.') |
1079 ] do:[ |
1081 ] do:[ |
1080 (Error, ControlInterrupt) handle:[:ex | |
1082 (Error, ControlInterrupt) handle:[:ex | |
|
1083 ObjectMemory sendTraceOff. |
1081 prompt isNil ifTrue:[ |
1084 prompt isNil ifTrue:[ |
1082 ex reject |
1085 ex reject |
1083 ]. |
1086 ]. |
1084 (self noDebugger |
1087 (self noDebugger |
1085 and:[ ex creator isControlInterrupt not]) ifTrue:[ |
1088 and:[ ex creator isControlInterrupt not]) ifTrue:[ |
1097 ]. |
1100 ]. |
1098 ]. |
1101 ]. |
1099 ]. |
1102 ]. |
1100 ex return. |
1103 ex return. |
1101 ] do:[ |
1104 ] do:[ |
1102 |value ms us| |
1105 |value ms us mthd codeBlock| |
1103 |
1106 |
1104 profilingFlag == true ifTrue:[ |
1107 traceFlag == true ifTrue:[ |
1105 MessageTally spyDetailedOn:[ |
1108 mthd := Compiler |
1106 value := (compilerClass new requestor:self) |
1109 compile:('[',chunk,']') forClass:nil |
1107 evaluate:chunk |
1110 inCategory:'doit' notifying:self |
1108 compile:true. |
1111 install:false. |
1109 ]. |
1112 |
1110 (doPrint and:[self printFlag]) ifTrue:[ |
1113 mthd isMethod ifTrue:[ |
|
1114 codeBlock := mthd valueWithReceiver:nil arguments:nil. |
|
1115 [ |
|
1116 ObjectMemory sendTraceOn. |
|
1117 codeBlock value. |
|
1118 ] ensure:[ |
|
1119 ObjectMemory sendTraceOff. |
|
1120 ] |
|
1121 ]. |
|
1122 ] ifFalse:[ |
|
1123 profilingFlag == true ifTrue:[ |
|
1124 MessageTally spyDetailedOn:[ |
|
1125 value := (compilerClass new requestor:self) |
|
1126 evaluate:chunk |
|
1127 compile:true. |
|
1128 ]. |
|
1129 ] ifFalse:[ |
|
1130 us := Time microsecondsToRun:[ |
|
1131 value := (compilerClass new requestor:self) |
|
1132 evaluate:chunk compile:true. |
|
1133 ]. |
|
1134 |
|
1135 timingFlag == true ifTrue:[ |
|
1136 'execution time: ' printOn:error. |
|
1137 us < 1000 ifTrue:[ |
|
1138 us < 1 ifTrue:[ |
|
1139 'too small to measure (<1us)' printOn:error. |
|
1140 ] ifFalse:[ |
|
1141 us printOn:output. 'us' printOn:error. |
|
1142 ] |
|
1143 ] ifFalse:[ |
|
1144 ((us / 1000) asFixedPoint:2) printOn:output. 'ms' printOn:error. |
|
1145 ]. |
|
1146 error cr. |
|
1147 ]. |
|
1148 ]. |
|
1149 ]. |
|
1150 (doPrint and:[self printFlag]) ifTrue:[ |
|
1151 value isVoid ifFalse:[ |
1111 '-> (Return value): ' print. |
1152 '-> (Return value): ' print. |
1112 value displayString printOn:output. output cr. |
1153 value displayString printOn:output. output cr. |
1113 output flush. |
1154 output flush. |
1114 ]. |
|
1115 ] ifFalse:[ |
|
1116 us := Time microsecondsToRun:[ |
|
1117 value := (compilerClass new requestor:self) |
|
1118 evaluate:chunk compile:true. |
|
1119 ]. |
|
1120 (doPrint and:[self printFlag]) ifTrue:[ |
|
1121 value isVoid ifFalse:[ |
|
1122 '-> (Return value): ' print. |
|
1123 value displayString printOn:output. output cr. |
|
1124 output flush. |
|
1125 ]. |
|
1126 ]. |
|
1127 |
|
1128 timingFlag == true ifTrue:[ |
|
1129 'execution time: ' printOn:error. |
|
1130 us < 1000 ifTrue:[ |
|
1131 us < 1 ifTrue:[ |
|
1132 'too small to measure (<1us)' printOn:error. |
|
1133 ] ifFalse:[ |
|
1134 us printOn:output. 'us' printOn:error. |
|
1135 ] |
|
1136 ] ifFalse:[ |
|
1137 ((us / 1000) asFixedPoint:2) printOn:output. 'ms' printOn:error. |
|
1138 ]. |
|
1139 error cr. |
|
1140 ]. |
1155 ]. |
1141 ]. |
1156 ]. |
1142 Workspace notNil ifTrue:[ |
1157 Workspace notNil ifTrue:[ |
1143 Workspace rememberResultAsWorkspaceVariable:value. |
1158 Workspace rememberResultAsWorkspaceVariable:value. |
1144 ]. |
1159 ]. |