Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-ct.125.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.125
Author: ct
Time: 14 October 2019, 12:33:57.997932 am
UUID: bdc17b48-7f21-844e-ad05-f3ba9876fd3f
Ancestors: HelpSystem-Core-mt.116
Adds CustomHelp>>#defaultPageKey to show the contents of a specified subtopic if a ClassBasedHelpTopic is selected
=============== Diff against HelpSystem-Core-mt.116 ===============
Item was changed:
----- Method: ClassBasedHelpTopic>>contents (in category 'accessing') -----
contents
"A book has no contents. Only its pages do."
+ ^ self defaultSubtopic ifNil: [''] ifNotNil: #contents!
- ^ ''!
Item was added:
+ ----- Method: ClassBasedHelpTopic>>defaultSubtopic (in category 'accessing') -----
+ defaultSubtopic
+
+ ^ self helpClass defaultPageKey
+ ifNotNil: [:key |
+ self subtopics
+ detect: [:topic | topic key = key]
+ ifNone: [nil]]
+ ifNil: [nil]!
Item was added:
+ ----- Method: ClassBasedHelpTopic>>key (in category 'accessing') -----
+ key
+
+ ^ self helpClass!
Item was added:
+ ----- Method: CustomHelp class>>defaultPageKey (in category 'accessing') -----
+ defaultPageKey
+ "Key of the page to show if no subtopic is selected, or nil"
+ ^ nil!
Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-ct.127.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.127
Author: ct
Time: 14 December 2019, 12:40:38.430841 am
UUID: b862e17a-aac7-434c-a028-0e4c364feeb5
Ancestors: HelpSystem-Core-mt.118
Fix a small syntax error in the Help on Help cpde examples
=============== Diff against HelpSystem-Core-mt.118 ===============
Item was changed:
----- Method: HelpHowToHelpTopicsFromCode class>>step7 (in category 'pages') -----
step7
+ <generated>
"This method was automatically generated. Edit it using:"
"HelpHowToHelpTopicsFromCode edit: #step7"
+ ^(HelpTopic
- ^HelpTopic
title: 'Step 7 - Tips and Tricks'
+ contents:
+ 'STEP 7 - TIPS AND TRICKS
- contents:
- 'STEP 7 - TIPS AND TRICKS
Tip1:
If you implement the #pages method you can also
use the name of a custom help class that should be
integrated between the specific pages:
+ pages
+ ^#(firstPage MyAppTutorial secondPage)
- #pages
- ^(firstPage MyAppTutorial secondPage)
Tip2:
You can easily edit the help contents of a page by
using the #edit: message. For our example just evaluate:
MyAppHelp edit: #firstPage
This will open a workspace with the help contents and
when you accept it it will be saved back to the help
method defining the topic.
+ !!' readStream nextChunkText)
+ key: #step7;
+ shouldStyle: false;
+ yourself!
- '
- !
David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.1204.mcz
==================== Summary ====================
Name: System-dtl.1204
Author: dtl
Time: 18 December 2020, 9:57:54.912942 am
UUID: 47e43f60-e3fa-4174-ada2-b0b5eb6795d0
Ancestors: System-mt.1203
Enable removal of preference for 'Read document at startup'.
Simplify code such that #readDocumentAtStartup is assumed always true and document specifiers begining with '-' are not treated as start documents. The actual preference setting is no longer referenced.
Assumptions: if the start document resource name starts with '-' then it is unlikely to be a document. For the case of the first argument appearing to be a document but the user wishing to use it otherwise, the '--' token (or any other argument beginning with '-') may be used in the command line to protect the argument from evaluation. This allows the traditional start document processing to work normally in the general case, and allows start document processing to be bypassed from the command line if desired. No preference setting is required.
The #readDocumentAtStartup may be removed in a future update.
=============== Diff against System-mt.1203 ===============
Item was changed:
----- Method: ProjectLauncher>>startUpAfterLogin (in category 'running') -----
startUpAfterLogin
| scriptName loader isUrl |
self setupFlaps.
+ Smalltalk firstArgMightBeDocument
+ ifTrue: [scriptName := Smalltalk documentPath.
- Preferences readDocumentAtStartup
- ifTrue: [scriptName := Smalltalk documentPath
- ifNil: [''].
scriptName := scriptName convertFromSystemString.
scriptName isEmpty
ifFalse: ["figure out if script name is a URL by itself"
isUrl := (scriptName asLowercase beginsWith: 'http://')
or: [(scriptName asLowercase beginsWith: 'file://')
or: [scriptName asLowercase beginsWith: 'ftp://']].
isUrl
ifFalse: [| encodedPath pathTokens |
"Allow for ../dir/scriptName arguments"
pathTokens := scriptName splitBy: FileDirectory slash.
pathTokens := pathTokens
collect: [:s | s encodeForHTTP].
encodedPath := pathTokens
reduce: [:acc :each | acc , FileDirectory slash , each].
scriptName := (FileDirectory default uri resolveRelativeURI: encodedPath) asString]]]
ifFalse: [scriptName := ''].
scriptName isEmptyOrNil
ifTrue: [^ Preferences eToyFriendly
ifTrue: [self currentWorld addGlobalFlaps]].
loader := CodeLoader new.
loader
loadSourceFiles: (Array with: scriptName).
(scriptName asLowercase endsWith: '.pr')
ifTrue: [self installProjectFrom: loader]
ifFalse: [loader installSourceFiles]!
Item was changed:
----- Method: SmalltalkImage>>arguments (in category 'command line') -----
arguments
"Answer an array with all the command line arguments.
+ This does not include imagePath, documentPath nor any option.
+ The '--' token on the command line indicates that remaining arguments should
+ be passed to the image without interpretation, and should not be treated as e.g.
+ specification of a start script."
+
- This does not include imagePath, documentPath nor any option."
-
"Smalltalk commandLine arguments"
+ | args |
- | args strm |
args := self rawArguments.
+ (args includes: '--' )
+ ifTrue: [ ^ args copyAfter: '--' ]
+ ifFalse: [ | rs | rs := args readStream.
+ rs next. "skip image name"
+ self firstArgMightBeDocument
+ ifTrue: [rs next "skip startup document name"].
+ ^ rs upToEnd ].
- (args includes: '--')
- ifTrue: [ ^args copyAfter: self imageArgumentsMarker ].
- strm := args readStream.
- strm atEnd ifFalse: [ strm next. "skip image name"
- (Preferences readDocumentAtStartup and: [ strm atEnd not ])
- ifTrue: [ strm next "skip startup document name" ]].
- ^ strm upToEnd.
!
Item was changed:
----- Method: SmalltalkImage>>documentPath (in category 'command line') -----
documentPath
"Answer the absolute path of the document passed to the VM or nil if none."
"Smalltalk commandLine documentPath"
+ ^ (self getSystemAttribute: 2) ifNil: [ '' ]
- ^ (self getSystemAttribute: 2)
- ifNotNil: [ :arg | arg = self imageArgumentsMarker
- ifTrue: [nil] ifFalse: [arg]].
-
!
Item was added:
+ ----- Method: SmalltalkImage>>firstArgMightBeDocument (in category 'private') -----
+ firstArgMightBeDocument
+ "If the first argument begins with '-' then it is unlikely to be a document specification"
+ ^ (self documentPath beginsWith: '-') not
+ !
Item was removed:
- ----- Method: SmalltalkImage>>imageArgumentsMarker (in category 'command line') -----
- imageArgumentsMarker
- "The '--' token on the command line indicates that remaining arguments should
- be passed to the image without interpretation, and should not be treated as e.g.
- specification of a start script."
-
- ^ '--'!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1202.mcz
==================== Summary ====================
Name: System-mt.1202
Author: mt
Time: 18 December 2020, 10:11:47.76906 am
UUID: 29ceed8f-1bbf-fa4f-89ee-8e8aaabe25ba
Ancestors: System-dtl.1201
Fixes logging output of DoItFirst for cases where stdio streams are unavailable such as on Windows via Squeak.exe (instead of SqueakConsole.exe).
=============== Diff against System-dtl.1201 ===============
Item was removed:
- ----- Method: DoItFirst>>print:to: (in category 'private') -----
- print: aString to: stream
- [ stream nextPutAll: aString; lf; flush ]
- on: Error
- do: [ Transcript cr; show: self class name , ' output: ', aString; flush.
- ^false ].
- ^true.
- !
Item was changed:
----- Method: DoItFirst>>printError: (in category 'private') -----
printError: aString
"Print to stdout if available, otherwise to the transcript. Answer true if
the stdio stream was used, false if output was redirected to transcript."
+ [ FileStream stderr nextPutAll: aString; lf; flush ]
+ on: Error
+ do: [ TranscriptStream forceUpdate: false. "Graphics not yet fully initialized."
+ Transcript cr; show: self class name , ' error: ', aString; flush.
+ ^false ].
+ ^true.
- ^self print: aString to: FileStream stderr.
!
Item was changed:
----- Method: DoItFirst>>printOut: (in category 'private') -----
printOut: aString
"Print to stdout if available, otherwise to the transcript. Answer true if
the stdio stream was used, false if output was redirected to transcript."
+ [ FileStream stdout nextPutAll: aString; lf; flush ]
+ on: Error
+ do: [ TranscriptStream forceUpdate: false. "Graphics not yet fully initialized."
+ Transcript cr; show: self class name , ' output: ', aString; flush.
+ ^false ].
+ ^true.
- ^self print: aString to: FileStream stdout.
!
David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.1201.mcz
==================== Summary ====================
Name: System-dtl.1201
Author: dtl
Time: 17 December 2020, 9:48:42.965817 pm
UUID: 02a92044-45ac-40d7-b274-a29ead5778bb
Ancestors: System-mt.1200
Make DoItFirst safer on Windows and other platforms without access to stdo streams. If stdio not available, redirect output to transcript. Do not allow the image to quit if output was redirected to transcript, because otherwise command line results cannot be seen.
Also move reevalute methods to category 'system startup' to clarify their use. These are only sent from other classes in the startup list.
=============== Diff against System-mt.1200 ===============
Item was changed:
+ ----- Method: DoItFirst class>>reevaluateCwd (in category 'system startup') -----
- ----- Method: DoItFirst class>>reevaluateCwd (in category 'reevaluate options') -----
reevaluateCwd
"If a -cwd option was specified on the command line, reevaluate it now.
May be called from FileDirectory class>>startUp: to reevaluate the command line
option to ensure that the default directory is ultimately set as specified by the -cwd
image command line option."
^ self current evaluateArg: #cwd.!
Item was changed:
+ ----- Method: DoItFirst class>>reevaluateDebug (in category 'system startup') -----
- ----- Method: DoItFirst class>>reevaluateDebug (in category 'reevaluate options') -----
reevaluateDebug
"The -debug option cannot be evaluated at DoInNow startUp time, but may be called
later in the startUp processing. If -debug was not specified as a command option this
method does nothing.
May be called from Delay>>startup to invoke a debugger at the earliest possible time."
^ self current evaluateArg: #debug.!
Item was changed:
----- Method: DoItFirst>>cwd: (in category 'actions') -----
cwd: path
+ "Evaluate arg and print the result on stdout, or error message on stderr."
- "Evaluate arg and print the result on stdout, or error message on stderr.
- Exit immediately without saving the image."
(FileDirectory on: path) exists
ifTrue: [ FileDirectory setDefaultDirectory: path ]
+ ifFalse: [ (self printError: path, ': directory does not exist')
+ ifTrue: [ Smalltalk quitPrimitive ]].!
- ifFalse: [ FileStream stderr nextPutAll: path, ': directory does not exist'; lf; flush.
- Smalltalk quitPrimitive ]
- !
Item was changed:
----- Method: DoItFirst>>doIt: (in category 'actions') -----
doIt: arguments
"Evaluate arguments and print the result on stdout, or error message on stderr.
Exit the image after any error."
arguments do: [ :arg |
+ [ self printOut: (Compiler evaluate: arg) asString ]
- [FileStream stdout nextPutAll: (Compiler evaluate: arg) asString; lf; flush]
on: Error
+ do: [ :ex | self printError: ex asString ]].!
- do: [ :ex | FileStream stderr nextPutAll: ex asString; lf; flush.
- Smalltalk quitPrimitive ]]!
Item was changed:
----- Method: DoItFirst>>evaluateFileContents: (in category 'actions') -----
evaluateFileContents: fileName
"Evaluate the contents of a file and print the result on stdout, or error
message on stderr. Exit immediately without saving the image."
| fs arg |
+ [fs := FileStream oldFileNamed: fileName.
+ [arg := fs contentsOfEntireFile.
+ ^ self evaluateOption: arg]
+ ensure: [fs close]]
+ on: Exception
+ do: [:ex | (self printError: ex asString)
+ ifTrue: [Smalltalk quitPrimitive]].!
- [ [ fs := FileStream oldFileNamed: fileName. ]
- on: FileDoesNotExistException
- do: [ :ex | FileStream stderr nextPutAll: ex asString; lf; flush.
- Smalltalk quitPrimitive ].
- arg := fs contentsOfEntireFile.
- ^ self evaluateOption: arg.
- ] ensure: [ fs close ].
- !
Item was changed:
----- Method: DoItFirst>>evaluateOption: (in category 'actions') -----
evaluateOption: arg
"Evaluate option and print the result on stdout, or error message on stderr.
Exit immediately without saving the image."
+ | safeToQuit |
+ [ safeToQuit := self printOut: (Compiler evaluate: arg) asString ]
- [FileStream stdout nextPutAll: (Compiler evaluate: arg) asString; lf; flush]
on: Error
+ do: [ :ex | safeToQuit := self printError: ex asString ].
+ safeToQuit ifTrue: [ Smalltalk quitPrimitive ].!
- do: [ :ex | FileStream stderr nextPutAll: ex asString; lf; flush ].
- Smalltalk quitPrimitive!
Item was changed:
----- Method: DoItFirst>>fileIn: (in category 'actions') -----
fileIn: fileNames
"File in each named file. On error, print a message to stderr and exit the image."
fileNames do: [ :arg |
[ | fs |
fs := FileStream oldFileNamed: arg.
+ self printOut: 'file in ', fs name.
- FileStream stdout nextPutAll: 'file in ', fs name; lf; flush.
fs fileIn ]
on: Error
+ do: [ :ex | (self printError: ex asString)
+ ifTrue: [ Smalltalk quitPrimitive ]]].!
- do: [ :ex | FileStream stderr nextPutAll: ex asString; lf; flush.
- Smalltalk quitPrimitive ]]!
Item was changed:
----- Method: DoItFirst>>help (in category 'actions') -----
help
+ self printOut: self class name, ' image arguments:'.
- FileStream stdout nextPutAll: self class name, ' image arguments:'; lf.
{ '--doit argumentlist "evaluate each argument as a doIt expression"' .
'--evaluate arg "evaluate arg, print result then exit"' .
'--file filename "evaluate contents of filename, print result then exit"' .
'--filein filelist "file in each file named in fileList"' .
'--cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options"' .
'--debug "enter a debugger as soon as possible in the startUp processing"'.
'--help "print this message"'
+ } do: [ :e | self printOut: String tab, e ].
+ self printOut: 'some arguments have single character synonyms, -f is a synonym for --file, -d for --doit'.
+ (self printOut: 'single ''-'' may be used instead of ''--'', -help is interpreted as --help')
+ ifTrue: [ Smalltalk quitPrimitive ]. "do not quit if output went to the transcript"!
- } do: [ :e | FileStream stdout tab; nextPutAll: e; lf ].
- FileStream stdout
- nextPutAll: 'some arguments have single character synonyms, -f is a synonym for --file, -d for --doit'; lf;
- nextPutAll: 'single ''-'' may be used instead of ''--'', -help is interpreted as --help'; lf;
- flush.
- Smalltalk quitPrimitive.
-
- !
Item was added:
+ ----- Method: DoItFirst>>print:to: (in category 'private') -----
+ print: aString to: stream
+ [ stream nextPutAll: aString; lf; flush ]
+ on: Error
+ do: [ Transcript cr; show: self class name , ' output: ', aString; flush.
+ ^false ].
+ ^true.
+ !
Item was added:
+ ----- Method: DoItFirst>>printError: (in category 'private') -----
+ printError: aString
+ "Print to stdout if available, otherwise to the transcript. Answer true if
+ the stdio stream was used, false if output was redirected to transcript."
+ ^self print: aString to: FileStream stderr.
+ !
Item was added:
+ ----- Method: DoItFirst>>printOut: (in category 'private') -----
+ printOut: aString
+ "Print to stdout if available, otherwise to the transcript. Answer true if
+ the stdio stream was used, false if output was redirected to transcript."
+ ^self print: aString to: FileStream stdout.
+ !