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