MiniInspector.st
author Stefan Vogel <sv@exept.de>
Thu, 16 Apr 2015 18:28:45 +0200
branchexpecco_2_7_5
changeset 18220 361e98951d47
parent 16635 ee5ebbb9e049
child 18120 e3a375d5f6a8
child 19381 ff17cf92e2c3
permissions -rw-r--r--
Add methods for backward compatibilty with older sublasses
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
308
f04744ef7b5d *** empty log message ***
claus
parents: 93
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
    12
"{ Package: 'stx:libbasic' }"
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
    13
720
f31e0e5ab6e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
    14
Object subclass:#MiniInspector
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
    15
	instanceVariableNames:'inspectedObject commandArg'
1297
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    16
	classVariableNames:''
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    17
	poolDictionaries:''
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    18
	category:'System-Debugging-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    21
!MiniInspector class methodsFor:'documentation'!
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    22
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    23
copyright
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    24
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    25
 COPYRIGHT (c) 1989 by Claus Gittinger
308
f04744ef7b5d *** empty log message ***
claus
parents: 93
diff changeset
    26
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    27
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    28
 This software is furnished under a license and may be used
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    29
 only in accordance with the terms of that license and with the
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    31
 be provided or otherwise made available to, or used by, any
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    32
 other person.  No title to or ownership of the software is
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    33
 hereby transferred.
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    34
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    35
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    36
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    37
documentation
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    38
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    39
    a primitive (non graphical) inspector for use on systems without
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
    40
    graphics or when the real inspector dies (i.e. the UI is locked).
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
    41
    Sometimes useful as a last chance to fix a broken UI / event handling.
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
    42
    Needs a console.
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
    43
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
    44
    MiniInspector openOn: Display
1297
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    45
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    46
    [author:]
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    47
	Claus Gittinger
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    48
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    49
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    50
a27a279701f8 Initial revision
claus
parents:
diff changeset
    51
!MiniInspector class methodsFor:'instance creation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    52
a27a279701f8 Initial revision
claus
parents:
diff changeset
    53
openOn:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
    54
    |anInspector|
14938
bb6698374550 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 10323
diff changeset
    55
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    56
    anInspector := (self new) initializeFor:anObject.
14938
bb6698374550 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 10323
diff changeset
    57
    anInspector enter.
bb6698374550 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 10323
diff changeset
    58
    ^ anInspector
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    59
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
    60
a27a279701f8 Initial revision
claus
parents:
diff changeset
    61
!MiniInspector methodsFor:'private'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    62
a27a279701f8 Initial revision
claus
parents:
diff changeset
    63
commandLoop
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
    64
    |cmd valid|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
16250
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
    66
    'MiniInspector on ' errorPrint.  inspectedObject displayString errorPrintCR.
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
    67
    '' errorPrintCR.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
    68
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
    69
    [true] whileTrue:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    70
	valid := false.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    71
	cmd := self getCommand:'inspector> '.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    72
	cmd isNil ifTrue:[   "/ EOF -> quit
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    73
	    cmd := $q
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    74
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    75
	cmd isNumber ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    76
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    77
	    self inspectInstvar:cmd of:inspectedObject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    78
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    79
	(cmd == $i) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    80
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    81
	    self printInstVarsOf:inspectedObject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    82
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    83
	(cmd == $p) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    84
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    85
	    inspectedObject displayString errorPrintCR
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    86
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    87
	(cmd == $c) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    88
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    89
	    inspectedObject class displayString errorPrintCR
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    90
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    91
	(cmd == $C) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    92
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    93
	    MiniInspector openOn:inspectedObject class.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    94
	    'back in previous inspector; inspecting ' errorPrint.  inspectedObject displayString errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    95
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    96
	(cmd == $d) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    97
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    98
	    ObjectMemory dumpObject:inspectedObject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
    99
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   100
	(cmd == $E) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   101
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   102
	    Parser evaluate:commandArg receiver:inspectedObject.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   103
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   104
	(cmd == $e) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   105
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   106
	    (Parser evaluate:commandArg receiver:inspectedObject) errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   107
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   108
	(cmd == $e) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   109
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   110
	    ObjectMemory dumpObject:inspectedObject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   111
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   112
	(cmd == $*) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   113
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   114
	    inspectedObject becomeNil.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   115
	    ^ cmd.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   116
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   117
	(cmd == $I) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   118
	    valid := true.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   119
	    self interpreterLoopWith:inspectedObject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   120
	].
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   121
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   122
	(cmd == $q) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   123
	    ^ cmd.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   124
	].
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   125
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   126
	valid ifFalse: [
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   127
	    'valid commands:
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   128
 p ...... print inspected object
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   129
 c ...... print inspected objects class
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   130
 i ...... print instvars
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   131
 d ...... VM-dump inspected object
5804
33282793d66d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5803
diff changeset
   132
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   133
 I ...... interpreter
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   134
 e expr   evaluate expression & print result ("E" to not print)
5804
33282793d66d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5803
diff changeset
   135
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   136
 C ...... inspect class
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   137
 <Num> .. inspect instvar num (1..)
5803
a478ecef08c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5802
diff changeset
   138
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   139
 * ...... becomeNil and quit (dangerous)
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   140
 q ...... quit
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   141
'       errorPrintCR
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   142
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   143
    ].
1426
3b565d5d0791 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   144
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   145
    "Modified: / 03-02-2014 / 10:19:46 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   146
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   147
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   148
enter
15904
7b8100b48c7a AbortSignal -> AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 14938
diff changeset
   149
    AbortOperationRequest handle:[:ex |
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   150
	'** Abort Signal caught - back in previous debugLevel' printCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   151
	ex restart
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   152
    ] do:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   153
	Error handle:[:ex |
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   154
	    |yesNo|
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   155
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   156
	    'Error while executing command: ' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   157
	    ex description errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   158
	    yesNo := self getCommand:'- (i)gnore / (p)roceed / (d)ebug ? '.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   159
	    yesNo == $d ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   160
		ex reject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   161
	    ].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   162
	    yesNo == $p ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   163
		ex proceed
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   164
	    ].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   165
	    ex restart
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   166
	] do:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   167
	    self commandLoop.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   168
	].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   169
    ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   170
    ^ nil
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   171
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   172
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   173
getCommand:prompt
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   174
    |cmd c num arg|
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   175
16250
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   176
    prompt errorPrint.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   177
16250
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   178
    c := cmd := Character fromUser.
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   179
    c isNil ifTrue:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   180
	^ nil.
16250
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   181
    ].
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   182
    c isDigit ifTrue:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   183
	num := 0.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   184
	[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   185
	    num := (num * 10) + c digitValue.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   186
	    c := Character fromUser.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   187
	] doWhile:[c notNil and:[c isDigit]].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   188
	^ num "/ numeric
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   189
    ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   190
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   191
    c := Character fromUser.
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   192
    [c notNil and:[c isEndOfLineCharacter not and:[c isSeparator ]]] whileTrue:[ c := Character fromUser ].
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   193
    arg := ''.
4965
e4f22bc0d3c8 Fix input of nil character.
Stefan Vogel <sv@exept.de>
parents: 2775
diff changeset
   194
    [c notNil and:[c isEndOfLineCharacter]] whileFalse:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   195
	arg := arg copyWith:c.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   196
	c := Character fromUser
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   197
    ].
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   198
    commandArg := arg.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   199
    ^ cmd
15926
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   200
2a89ee50988c class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 15904
diff changeset
   201
    "Modified: / 03-02-2014 / 10:16:49 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   202
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   203
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   204
initializeFor:anObject
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   205
    inspectedObject := anObject.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   206
    ^self
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   207
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   208
16635
ee5ebbb9e049 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 16558
diff changeset
   209
inspect:anObject
ee5ebbb9e049 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 16558
diff changeset
   210
    inspectedObject := anObject.
ee5ebbb9e049 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 16558
diff changeset
   211
!
ee5ebbb9e049 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 16558
diff changeset
   212
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   213
inspectInstvar:which of:anObject
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   214
    |numInsts idx|
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   215
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   216
    numInsts := anObject class instSize.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   217
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   218
    which > numInsts ifTrue:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   219
	idx := which - numInsts.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   220
	idx > anObject basicSize ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   221
	    'invalid indexed instvar index: ' errorPrint. idx errorPrintCR
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   222
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   223
	    'Inspecting indexed instVar ' errorPrint. idx errorPrint. '...' errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   224
	    MiniInspector openOn:(anObject basicAt:idx).
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   225
	    'back in previous inspector; inspecting ' errorPrint.  inspectedObject displayString errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   226
	]
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   227
    ] ifFalse: [
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   228
	which < 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   229
	    'invalid instVar # (must be >= 1)' errorPrintCR
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   230
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   231
	    'Inspecting instVar ' errorPrint. which errorPrint. '...' errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   232
	    MiniInspector openOn:(anObject instVarAt:which).
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   233
	    'back in previous inspector; inspecting ' errorPrint.  inspectedObject displayString errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   234
	].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   235
    ]
1426
3b565d5d0791 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   236
3b565d5d0791 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   237
    "Modified: 20.5.1996 / 10:27:40 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   238
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   239
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   240
interpreterLoopWith:anObject
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   241
    |line done rslt|
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   242
16250
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   243
    'read-eval-print loop; exit with empty line' errorPrintCR.
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   244
    '' errorPrintCR.
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   245
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   246
    done := false.
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   247
    [done] whileFalse:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   248
	'> ' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   249
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   250
	line := Stdin nextLine.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   251
	(line size == 0) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   252
	    done := true
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   253
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   254
	    rslt := Compiler
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   255
		evaluate:line
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   256
		in:nil
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   257
		receiver:anObject
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   258
		notifying:nil
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   259
		ifFail:[].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   260
	    rslt errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   261
	]
7092
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   262
    ]
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   263
!
630807cd320f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 5805
diff changeset
   264
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   265
printInstVarsOf:anObject
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   266
    |n "{ Class: SmallInteger }" names |
903
234a9d6e4492 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   267
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   268
    n := anObject class instSize.
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   269
    names := anObject class allInstVarNames.
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   270
16250
c376e523d007 class: MiniInspector
Stefan Vogel <sv@exept.de>
parents: 15926
diff changeset
   271
    'number of instvars: ' errorPrint. n errorPrintCR.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   272
    1 to:n do:[:i |
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   273
	(i printStringLeftPaddedTo:2) errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   274
	' {' errorPrint. (names at:i) errorPrint. '}' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   275
	': ' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   276
	((anObject instVarAt:i) displayString contractAtEndTo:80) errorPrintCR
903
234a9d6e4492 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   277
    ].
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   278
903
234a9d6e4492 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   279
    n := anObject basicSize.
5805
007549d68d4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5804
diff changeset
   280
    n > 0 ifTrue:[
16558
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   281
	'number of indexed instvars: ' errorPrint. n errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   282
	n > 10 ifTrue:[n := 10].
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   283
	1 to:n do:[:i |
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   284
	    ' [' errorPrint. i errorPrint. ']: ' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   285
	    ((anObject basicAt:i) displayString contractAtEndTo:80) errorPrintCR
Claus Gittinger <cg@exept.de>
parents: 16250
diff changeset
   286
	]
903
234a9d6e4492 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   287
    ].
1426
3b565d5d0791 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   288
3b565d5d0791 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   289
    "Modified: 20.5.1996 / 10:27:45 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   290
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   291
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   292
!MiniInspector class methodsFor:'documentation'!
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   293
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   294
version
16635
ee5ebbb9e049 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 16558
diff changeset
   295
    ^ '$Header: /cvs/stx/stx/libbasic/MiniInspector.st,v 1.32 2014-06-25 16:30:11 cg Exp $'
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   296
! !
16635
ee5ebbb9e049 class: MiniInspector
Claus Gittinger <cg@exept.de>
parents: 16558
diff changeset
   297