StandaloneStartup.st
changeset 11354 618eaa4e2a32
parent 11353 6167f1e604c9
child 11355 2aa83c61ebd4
equal deleted inserted replaced
11353:6167f1e604c9 11354:618eaa4e2a32
    89 ! !
    89 ! !
    90 
    90 
    91 !StandaloneStartup class methodsFor:'initialization'!
    91 !StandaloneStartup class methodsFor:'initialization'!
    92 
    92 
    93 initialize
    93 initialize
    94     "/ Verbose := true.
    94     Verbose := true.
    95     Verbose := false.
    95     Verbose := false.
    96 ! !
    96 ! !
    97 
    97 
    98 !StandaloneStartup class methodsFor:'helpers'!
    98 !StandaloneStartup class methodsFor:'helpers'!
    99 
    99 
   506     ^ true
   506     ^ true
   507 
   507 
   508     "Modified: / 31-10-2007 / 16:05:59 / cg"
   508     "Modified: / 31-10-2007 / 16:05:59 / cg"
   509 !
   509 !
   510 
   510 
   511 setupToolsForDebug
   511 you into a debugger.').
   512     Debugger := DebugView ? MiniDebugger.
       
   513     Inspector := InspectorView ? MiniInspector.
       
   514     self verboseInfo:('debug enabled - CTRL-C brings you into a debugger.').
       
   515 
   512 
   516     "Created: / 19-09-2006 / 16:40:32 / cg"
   513     "Created: / 19-09-2006 / 16:40:32 / cg"
   517 !
   514 !
   518 
   515 
   519 setupToolsForNoDebug
   516 tStandardStreams.
   520     Smalltalk isStandAloneApp ifTrue:[
       
   521         Debugger := nil.
       
   522         Inspector := nil.
       
   523         NewLauncher := nil.
       
   524         self redirectStandardStreams.
       
   525     ].
   517     ].
   526 
   518 
   527     "Created: / 19-09-2006 / 16:40:47 / cg"
   519     "Created: / 19-09-2006 / 16:40:47 / cg"
   528     "Modified: / 31-10-2007 / 16:18:40 / cg"
   520     "Modified: / 31-10-2007 / 16:18:40 / cg"
   529 !
   521 !
   530 
   522 
   531 start
   523 StringCollection asString).
   532     CommandLineArguments := Smalltalk commandLineArguments.
       
   533 
       
   534     self verboseInfo:('starting...').
       
   535     self verboseInfo:('args: ', CommandLineArguments asStringCollection asString).
       
   536 
   524 
   537     Smalltalk isStandAloneApp ifTrue:[
   525     Smalltalk isStandAloneApp ifTrue:[
   538         self loadPatches.
   526         self loadPatches.
   539         self verboseInfo:('setup Smalltalk').
   527         self verboseInfo:('setup Smalltalk').
   540     ].
   528     ].
   542     self main
   530     self main
   543 
   531 
   544     "Modified: / 31-10-2007 / 16:03:44 / cg"
   532     "Modified: / 31-10-2007 / 16:03:44 / cg"
   545 !
   533 !
   546 
   534 
   547 usage
   535 utLine:'          --help .................. output this message'.
   548     Stderr nextPutLine:'usage:'.
       
   549     Stderr nextPutLine:'  ',self applicationName,' [options...]'.
       
   550     Stderr nextPutLine:'    options:'.
       
   551     Stderr nextPutLine:'          --help .................. output this message'.
       
   552     Stderr nextPutLine:'          --verbose ............... verbose startup'.
   536     Stderr nextPutLine:'          --verbose ............... verbose startup'.
   553     self allowScriptingOption ifTrue:[
   537     self allowScriptingOption ifTrue:[
   554         Stderr nextPutLine:'          --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'.
   538         Stderr nextPutLine:'          --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'.
   555     ].
   539     ].
   556     self allowDebugOption ifTrue:[
   540     self allowDebugOption ifTrue:[
   563     "Created: / 19-09-2006 / 16:37:55 / cg"
   547     "Created: / 19-09-2006 / 16:37:55 / cg"
   564 ! !
   548 ! !
   565 
   549 
   566 !StandaloneStartup class methodsFor:'startup-to be redefined'!
   550 !StandaloneStartup class methodsFor:'startup-to be redefined'!
   567 
   551 
   568 main
   552 / 31-10-2007 / 16:03:22 / cg"
   569     self verboseInfo:('entering main').
   553 !
   570 
   554 
   571     self main:CommandLineArguments.
   555 ion').
   572 
       
   573     "
       
   574      self main
       
   575      self main:#('--info') 
       
   576     "
       
   577 
       
   578     "Modified: / 31-10-2007 / 16:03:22 / cg"
       
   579 !
       
   580 
       
   581 main:argv
       
   582     self subclassResponsibility.
       
   583 
       
   584 "/ a typical main: looks like (in a subclass):
       
   585 
       
   586 "/    |app fileArg|
       
   587 "/
       
   588 "/    self verboseInfo:('starting application').
       
   589 "/    app := <someGUIApplicationModelClass> open.
   556 "/    app := <someGUIApplicationModelClass> open.
   590 "/
   557 "/
   591 "/    self verboseInfo:('looking for args in ',argv).
   558 "/    self verboseInfo:('looking for args in ',argv).
   592 "/    argv notEmptyOrNil ifTrue:[
   559 "/    argv notEmptyOrNil ifTrue:[
   593 "/        fileArg := argv last asFilename.
   560 "/        fileArg := argv last asFilename.
   612 ! !
   579 ! !
   613 
   580 
   614 !StandaloneStartup class methodsFor:'documentation'!
   581 !StandaloneStartup class methodsFor:'documentation'!
   615 
   582 
   616 version
   583 version
   617     ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.18 2008-11-20 22:12:29 cg Exp $'
   584     ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.19 2008-11-20 22:15:14 cg Exp $'
   618 ! !
   585 ! !
   619 
   586 
   620 StandaloneStartup initialize!
   587 StandaloneStartup initialize!