- live browsing of Self object memory -

lobby shellshortcuts

This object (which is inherited by the shell) contains
various methods which are useful shorthands.  If you
want to add your own shorthands to the shell, put them
here.

CopyDowns: vector

CreatorPath: shell shortcuts

Module: shortcuts

VM debugging

useNIC =
( 
    _Compilers: (vector copyAddFirst: 'nic') Limits: vector.
    _Flush)
useNICSIC =
( 
    _Compilers: ('nic' & 'sic') asVector Limits: vector copyAddFirst: 10000.
    _Flush)
useSIC =
( 
    _Compilers: (vector copyAddFirst: 'sic') Limits: vector.
    _Flush)

compiling

cc = shell ccA shortcut to bypass typing single quotes when reading in files: instead of typing 'myStuff' _RunScript you can just type cc myStuff Since the cc object does not understand `myStuff', it invokes the undefinedSelector method, which takes the selector (`myStuff') and sends _RunScript to it (concatenated with .self)! Since the return value is self (cc), you can read in several files by cascading their names: cc myStuff moreStuff otherStuff This works because each successive send is being sent to cc. Typing cc rc reads in ~/.selfrc. (The above technique doesn't work for .selfrc, because 'cc .selfrc' does not parse as a Self expression.)

debugging

lookup = shell lookupA technique similar to `cc' (q.v.). To lookup a slot named `foo' in the current activation of a process being debugged (attached to the debugger using `attach:'), type lookup foo Again, this simply allows you to avoid typing the single quotes around foo. This shortcut is only meaningful when there is a process attached to the debugger.

editing

editFile: = ( fileEditor openOnFile: name)Open a file editor on the file named by the string argument. Doesn't work in the 4.0 user interface yet.

shutdown

quit =
( | line |
    ('Save to ', memory snapshotOptions fileName, ' before quitting? ') printLine.
     '  y => save, then quit' printLine.
     '  n => quit without saving' printLine.
     '  RET => cancel' printLine.
     'Response: ' print.
    line:  stdin readLine uncapitalize.
    line = '' ifTrue: [ 'quit cancelled' printLine.  ^ self ].
    line first = 'y' ifTrue: [^saveThenQuit].
    line first = 'n' ifTrue: [^quitNoSave].
    'Invalid input -- quit cancelled' printLine)
Quit the system. Asks (via a shell-level prompt) whether the user wants to write a snapshot first. Valid responses: y or Y - writes snapshot, quits n or N - quits immediately return - quit is cancelled, system continues to run.
quitNoSave = ( programmingLog close. _Quit)Exit the system. Nothing is saved.
saveThenQuit =
( 
    memory snapshotOptions:
      memory snapshotOptions copy askUser.
    memory thoroughCleanup: false.
    userQuery showEverybody: 'Writing snapshot to ', memory snapshotOptions fileName
    While: [
     memory
      writeSnapshotIfBackupFails: [|:e| 
        userQuery report: 
          'Could not backup old snapshot: "', e, '".\n',
          'Quit cancelled.'.
        ^self]
      IfSnapshotFails: [|:e|
        userQuery report: 
          'Could not save snapshot: "', e, '".\n',
          'Quit cancelled.'.
        ^self].
    ].
    ^quitNoSave)
Save the world in the default snapshot file, then quit the system.

snapshots

save =
( 
    "memory quickCleanup." "OS X is so fast..."
    userQuery showEverybody: 'Writing snapshot to ', memory snapshotOptions fileName
                      While: [ times delay: 500. "graphics update time"
                               memory writeSnapshot  ].
    self)
Write a snapshot to the default name.
saveAs =
( 
    memory snapshotOptions:
      memory snapshotOptions copy askUser.
    save)
saveAs: =
( 
    memory snapshotOptions:  memory snapshotOptions copy.
    memory snapshotOptions fileName: fileName.
    save)

spying

spyOff = ( _Spy: false)
spyOn =
( 
    _Spy: false. "this to work around a suspected VM bug"
    _Spy: true)
Turn on the spy (system monitor). The spy shows information about the internals of the system. The return value is the previous value of _Spy.