From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:45:31 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>ExampleSubsystem</name> <environment>Examples</environment> <super>Core.Subsystem</super> <private>false</private> none <imports></imports> <category>System-Subsystems</category> <attributes> <package>ExampleSubsystem</package> </attributes> </class> <comment> Examples.ExampleSubsystem
This serves as an example of a subsystem to illustrate what is possible using them.
</comment> <methods> Examples.ExampleSubsystem <category>actions</category>
pauseAction "In this method we prepare for an image save. The image may start up again, or may be going to quit. If we want to know if it's going to quit, we can ask (Snapshot isAboutToQuit)." "self suspendThingsThatNeedSuspending"
resumeAction "In this method we return from an image save. The image may or may not be going to quit. If we want to know if it's going to quit, we can ask (Snapshot isAboutToQuit)." "self resumeSuspendedThings"
setUp "This method is called when we are activating this system, normally because the image is starting up. It should do anything that's necessary in order to make this subsystem active" "self readConfigurationInfo. self turnThingsOn"
tearDown "This method is called when we are deactivating this system, normally because the image is shutting down. It should do anything that's necessary in order to make this subsystem inactive, releasing resources" "self releaseResources"
</methods> <methods> Examples.ExampleSubsystem <category>prerequisites</category>
prerequisiteSystems ^#().
</methods> <methods> Examples.ExampleSubsystem <category>command-line options</category>
bar: aStream "This implements a command-line option. The method will be invoked if the -bar option is present on the command line. A stream containing the command line from the point of this option forward is available" <option: '-bar'> (CommandLineInterest argumentsFrom: aStream) do: [:each | each yourself].
foo "This implements a command-line option. The method will be invoked if the -foo option is present on the command line. A stream containing the command line from the point of this option forward is available if the option takes arguments" <option: '-foo'>
xyzLevel: aStream "This implements a command-line option that takes an argument, where the argument is directly attached to the option. That is, things of the form -xFoo, where the option is -x and the argument is Foo. The method will be invoked if the -x option is present on the command line. A stream containing the command line from the point of this option forward is available. Note that to get the argument, we actually need to back up the stream" <option: '-xyz*'> | optionString argument | aStream skip: -1. optionString := aStream next. argument := optionString copyFrom: 5 to: optionString size. self setXYZLevelTo: argument.
</methods> <methods> Examples.ExampleSubsystem <category>prerequisites</category>
additionalPrerequisites <prerequisites> ^Array with: CoreSystem with: DelaySystem.
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>Subsystem</name> <environment>Core</environment> <super>Core.Object</super> <private>false</private> none state canActivate prerequisites current <imports></imports> <category>System-Subsystems</category> <attributes> <package>System-Subsystems</package> </attributes> </class>