Smalltalk.st
changeset 12022 205ac90337cc
parent 12019 4fb7ba173794
child 12023 6e78c6a9ce19
--- a/Smalltalk.st	Thu Sep 24 10:43:23 2009 +0200
+++ b/Smalltalk.st	Thu Sep 24 11:13:46 2009 +0200
@@ -412,66 +412,66 @@
 initSystemPath
     "setup path where system files are searched for.
      the default path is set to:
-            .
-            <directory of exe>       (WIN32 only)
-            $HOME                    (if defined)
-            $HOME/.smalltalk         (if defined & existing)
-            $SMALLTALK_LIBDIR        (if defined & existing)
-            $STX_LIBDIR              (if defined & existing)
-            $STX_TOPDIR              (if defined & existing)
-            REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only)
-            REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir')                  (WIN32 only)
-            <standard places>
+	    .
+	    <directory of exe>       (WIN32 only)
+	    $HOME                    (if defined)
+	    $HOME/.smalltalk         (if defined & existing)
+	    $SMALLTALK_LIBDIR        (if defined & existing)
+	    $STX_LIBDIR              (if defined & existing)
+	    $STX_TOPDIR              (if defined & existing)
+	    REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only)
+	    REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir')                  (WIN32 only)
+	    <standard places>
 
      standard places (unix):
-            /opt/smalltalk/<release> (if existing)
-            /opt/smalltalk           (if existing)
-            /usr/local/lib/smalltalk (if existing)
-            /usr/lib/smalltalk       (if existing)
-            /lib/smalltalk           (if existing)
+	    /opt/smalltalk/<release> (if existing)
+	    /opt/smalltalk           (if existing)
+	    /usr/local/lib/smalltalk (if existing)
+	    /usr/lib/smalltalk       (if existing)
+	    /lib/smalltalk           (if existing)
 
      win32:
-            \programs\exept\smalltalk (if existing)
-            \programs\smalltalk       (if existing)
-            \smalltalk                (if existing)
+	    \programs\exept\smalltalk (if existing)
+	    \programs\smalltalk       (if existing)
+	    \smalltalk                (if existing)
 
      vms:
-            $stx:lib                 (if existing)
-            $stx:root                (if existing)
+	    $stx:lib                 (if existing)
+	    $stx:root                (if existing)
 
      of course, it is possible to add entries from the 'smalltalk.rc'
      startup file; add expressions such as:
-            Smalltalk systemPath addFirst:'/foo/bar/baz'.
-        or:
-            Smalltalk systemPath addLast:'/fee/foe/foo'.
+	    Smalltalk systemPath addFirst:'/foo/bar/baz'.
+	or:
+	    Smalltalk systemPath addLast:'/fee/foe/foo'.
 
      However, smalltalk.rc itself must be found along the above path.
     "
 
     ChangeFileName := 'changes'.
     OperatingSystem isVMSlike ifTrue:[
-        BitmapDirName := 'bitmaps.dir'.
-        BinaryDirName := 'binary.dir'.
-        SourceDirName := 'source.dir'.
-        ResourceDirName := 'resources.dir'.
-        FileInDirName := 'filein.dir'.
-        PackageDirName := 'packages.dir'.
+	BitmapDirName := 'bitmaps.dir'.
+	BinaryDirName := 'binary.dir'.
+	SourceDirName := 'source.dir'.
+	ResourceDirName := 'resources.dir'.
+	FileInDirName := 'filein.dir'.
+	PackageDirName := 'packages.dir'.
     ] ifFalse:[
-        BitmapDirName := 'bitmaps'.
-        BinaryDirName := 'binary'.
-        SourceDirName := 'source'.
-        ResourceDirName := 'resources'.
-        FileInDirName := 'fileIn'.
-        PackageDirName := 'packages'.
+	BitmapDirName := 'bitmaps'.
+	BinaryDirName := 'binary'.
+	SourceDirName := 'source'.
+	ResourceDirName := 'resources'.
+	FileInDirName := 'fileIn'.
+	PackageDirName := 'packages'.
     ].
 
     SystemPath isNil ifTrue:[
-        SystemPath := OperatingSystem defaultSystemPath.
-        self flushPathCaches
+	SystemPath := OperatingSystem defaultSystemPath.
+	self flushPathCaches
     ].
 
     PackagePath isNil ifTrue:[
-        PackagePath := OperatingSystem defaultPackagePath.
+	PackagePath := OperatingSystem defaultPackagePath.
     ].
 
     "
@@ -1852,9 +1852,9 @@
     "enumerate all methods in the Smalltalk namespace's classes"
 
     Smalltalk allClassesDo:[:eachClass |
-        eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
-            aBlock value:mthd
-        ]
+	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
+	    aBlock value:mthd
+	]
     ].
 !
 
@@ -1862,9 +1862,9 @@
     "enumerate all methods in the Smalltalk namespace's classes"
 
     Smalltalk allClassesDo:[:eachClass |
-        eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
-            aBlock value:mthd value:sel
-        ]
+	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
+	    aBlock value:mthd value:sel
+	]
     ].
 !
 
@@ -2003,9 +2003,9 @@
      #aboutToQuit."
 
     ExitBlocks isNil ifTrue:[
-        ExitBlocks := OrderedCollection with:aBlock
+	ExitBlocks := OrderedCollection with:aBlock
     ] ifFalse:[
-        ExitBlocks add:aBlock
+	ExitBlocks add:aBlock
     ]
 !
 
@@ -3273,11 +3273,11 @@
     int clr = 0;
 
     if (__isString(aMessageStringOrNil)) {
-        msg = __stringVal(aMessageStringOrNil);
+	msg = __stringVal(aMessageStringOrNil);
     }
     if (__isSmallInteger(rgbValueOrNil)) {
-        clr = __intVal(rgbValueOrNil);
-        __win32_splashMessageColor(clr);
+	clr = __intVal(rgbValueOrNil);
+	__win32_splashMessageColor(clr);
     }
     __win32_splashMessage(msg);
 #endif
@@ -3459,23 +3459,23 @@
     |p|
 
     p :=
-        [
-            |startBlocks|
-
-            startBlocks := self startBlocks.
-            startBlocks notNil ifTrue:[
-                startBlocks do:[:aBlock|
-                    aBlock value
-                ].
-                startBlocks removeAll.
-            ].
-        ] newProcess.
-
-    p 
-        priority:(Processor userSchedulingPriority);
-        name:'start block handler';
-        beGroupLeader;
-        resume.
+	[
+	    |startBlocks|
+
+	    startBlocks := self startBlocks.
+	    startBlocks notNil ifTrue:[
+		startBlocks do:[:aBlock|
+		    aBlock value
+		].
+		startBlocks removeAll.
+	    ].
+	] newProcess.
+
+    p
+	priority:(Processor userSchedulingPriority);
+	name:'start block handler';
+	beGroupLeader;
+	resume.
 ! !
 
 !Smalltalk class methodsFor:'startup queries'!
@@ -3793,26 +3793,26 @@
     table := IdentityDictionary new:100.
 
     Method allSubInstancesDo:[:aMethod |
-        source := nil.
-        aMethod sourcePosition notNil ifTrue:[
-            aMethod sourceFilename = 'st.src' ifTrue:[
-                source := aMethod source.
-            ]
-        ] ifFalse:[
-            source := aMethod source
-        ].
-
-        source notNil ifTrue:[
-            pos := newStream position1Based.
-            newStream nextChunkPut:source.
-
-            "
-             dont change the methods info - maybe some write error
-             occurs later, in that case we abort and leave everything
-             untouched.
-            "
-            table at:aMethod put:pos
-        ]
+	source := nil.
+	aMethod sourcePosition notNil ifTrue:[
+	    aMethod sourceFilename = 'st.src' ifTrue:[
+		source := aMethod source.
+	    ]
+	] ifFalse:[
+	    source := aMethod source
+	].
+
+	source notNil ifTrue:[
+	    pos := newStream position1Based.
+	    newStream nextChunkPut:source.
+
+	    "
+	     dont change the methods info - maybe some write error
+	     occurs later, in that case we abort and leave everything
+	     untouched.
+	    "
+	    table at:aMethod put:pos
+	]
     ].
 
     newStream syncData; close.
@@ -3827,7 +3827,7 @@
      source reference"
 
     table keysAndValuesDo:[:aMethod :pos |
-        aMethod localSourceFilename:fileName position:pos.
+	aMethod localSourceFilename:fileName position:pos.
 "/        aMethod printCR.
     ].
 
@@ -3855,18 +3855,18 @@
     table := IdentityDictionary new:100.
 
     Method allSubInstancesDo:[:aMethod |
-        source := aMethod source.
-        source notNil ifTrue:[
-            pos := newStream position1Based.
-            newStream nextChunkPut:source.
-
-            "
-             dont change the methods info - maybe some write error
-             occurs later, in that case we abort and leave everything
-             untouched.
-            "
-            table at:aMethod put:pos
-        ]
+	source := aMethod source.
+	source notNil ifTrue:[
+	    pos := newStream position1Based.
+	    newStream nextChunkPut:source.
+
+	    "
+	     dont change the methods info - maybe some write error
+	     occurs later, in that case we abort and leave everything
+	     untouched.
+	    "
+	    table at:aMethod put:pos
+	]
     ].
 
     newStream syncData; close.
@@ -3881,7 +3881,7 @@
      source reference"
 
     table keysAndValuesDo:[:aMethod :pos |
-        aMethod localSourceFilename:fileName position:pos.
+	aMethod localSourceFilename:fileName position:pos.
 "/        aMethod printCR.
     ].
 
@@ -3967,15 +3967,15 @@
 
     "/ along the package-path
     self packagePath do:[:eachPathComponent |
-        (dirsConsulted includes:eachPathComponent) ifFalse:[
-            self
-                recursiveInstallAutoloadedClassesFrom:eachPathComponent
-                rememberIn:dirsConsulted
-                maxLevels:15
-                noAutoload:false
-                packageTop:eachPathComponent
-                showSplashInLevels:2.
-        ]
+	(dirsConsulted includes:eachPathComponent) ifFalse:[
+	    self
+		recursiveInstallAutoloadedClassesFrom:eachPathComponent
+		rememberIn:dirsConsulted
+		maxLevels:15
+		noAutoload:false
+		packageTop:eachPathComponent
+		showSplashInLevels:2.
+	]
     ].
     self splashInfo:nil.
 
@@ -4181,9 +4181,9 @@
      If a file called NOPACKAGES is found, no further searching is done in that directory or below."
 
     self
-        recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted 
-        maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
-        showSplashInLevels:0.
+	recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
+	maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
+	showSplashInLevels:0.
 
     "
      Smalltalk installAutoloadedClasses
@@ -4192,7 +4192,7 @@
     "Modified: / 17-08-2006 / 16:48:43 / cg"
 !
 
-recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted 
+recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
 maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
 showSplashInLevels:showSplashInLevels
     "read all abbrev.stc files from and under aDirectory
@@ -4205,48 +4205,48 @@
 
     maxLevels == 0 ifTrue:[
 "/        'Smalltalk [warning]: max directory nesting reached.' infoPrintCR.
-        ^ self
+	^ self
     ].
 
     dir := aDirectory asFilename.
     dirName := dir pathName.
 
     (dirsConsulted includes:dirName) ifTrue:[
-        ^ self
+	^ self
     ].
     dirsConsulted add:dirName.
 
     (dir construct:'NOPACKAGES') exists ifTrue:[
-        ^ self.
+	^ self.
     ].
     (dir construct:'NOSUBAUTOLOAD') exists ifTrue:[
-        ^ self.
+	^ self.
     ].
 
     noAutoloadHere := noAutoloadIn.
     noAutoloadHere ifFalse:[
-        (dir construct:'NOAUTOLOAD') exists ifTrue:[
-            noAutoloadHere := true.
-        ].
+	(dir construct:'NOAUTOLOAD') exists ifTrue:[
+	    noAutoloadHere := true.
+	].
     ] ifTrue:[
-        (dir construct:'AUTOLOAD') exists ifTrue:[
-            noAutoloadHere := false.
-        ].
+	(dir construct:'AUTOLOAD') exists ifTrue:[
+	    noAutoloadHere := false.
+	].
     ].
 
     ((dir construct:'loadAll') exists
     or:[(dir construct:'abbrev.stc') exists
     or:[(dir construct:(dir baseName , '.prj')) exists]]) ifTrue:[
-        KnownPackages isNil ifTrue:[
-            KnownPackages := Set new.
-        ].
-        pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1.
-        KnownPackages add:pkgName
+	KnownPackages isNil ifTrue:[
+	    KnownPackages := Set new.
+	].
+	pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1.
+	KnownPackages add:pkgName
     ].
 
     showSplashInLevels >= 0 ifTrue:[
-        self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...'
-                                bindWith:(dirName contractAtBeginningTo:35)).
+	self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...'
+				bindWith:(dirName contractAtBeginningTo:35)).
     ].
 
     "/
@@ -4254,60 +4254,60 @@
     "/ below; however, still traverse the directories to find packages ...
     "/
     noAutoloadHere ifFalse:[
-        [
-            abbrevStream := (dir construct:'abbrev.stc') asFilename readStream.
-            self installAutoloadedClassesFromStream:abbrevStream.
-            abbrevStream close.
-        ] on:FileStream openErrorSignal do:[:ex| "ignore this file"].
+	[
+	    abbrevStream := (dir construct:'abbrev.stc') asFilename readStream.
+	    self installAutoloadedClassesFromStream:abbrevStream.
+	    abbrevStream close.
+	] on:FileStream openErrorSignal do:[:ex| "ignore this file"].
     ].
 
     [
-        directoryContents := dir directoryContents.
+	directoryContents := dir directoryContents.
     ] on:FileStream openErrorSignal do:[:ex|
-        "non-accessable directory: we are done"
-        ^ self
+	"non-accessable directory: we are done"
+	^ self
     ].
 
     directoryContents do:[:aFilename |
-        |f|
-
-        (#(
-            'objbc'
-            'doc'
-            'CVS'
-            'bitmaps'
-            'resources'
-            'source'
-            'not_delivered'
-            'not_ported'
-        ) includes:aFilename) ifFalse:[
-            ((dir baseName ~= 'stx')
-            or:[
-                (#(
-                    'configurations'
-                    'include'
-                    'rules'
-                    'stc'
-                    'support'
-                ) includes:aFilename) not])
-            ifTrue:[
-                f := dir construct:aFilename.
-                f isDirectory ifTrue:[
-                     self
-                        recursiveInstallAutoloadedClassesFrom:f
-                        rememberIn:dirsConsulted
-                        maxLevels:maxLevels-1
-                        noAutoload:noAutoloadHere
-                        packageTop:packageTopPath
-                        showSplashInLevels:showSplashInLevels - 1.
-                ]
-            ]
-        ].
+	|f|
+
+	(#(
+	    'objbc'
+	    'doc'
+	    'CVS'
+	    'bitmaps'
+	    'resources'
+	    'source'
+	    'not_delivered'
+	    'not_ported'
+	) includes:aFilename) ifFalse:[
+	    ((dir baseName ~= 'stx')
+	    or:[
+		(#(
+		    'configurations'
+		    'include'
+		    'rules'
+		    'stc'
+		    'support'
+		) includes:aFilename) not])
+	    ifTrue:[
+		f := dir construct:aFilename.
+		f isDirectory ifTrue:[
+		     self
+			recursiveInstallAutoloadedClassesFrom:f
+			rememberIn:dirsConsulted
+			maxLevels:maxLevels-1
+			noAutoload:noAutoloadHere
+			packageTop:packageTopPath
+			showSplashInLevels:showSplashInLevels - 1.
+		]
+	    ]
+	].
     ].
 
     showSplashInLevels >= 0 ifTrue:[
-        self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...'
-                                bindWith:(dirName contractAtBeginningTo:35)).
+	self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...'
+				bindWith:(dirName contractAtBeginningTo:35)).
     ].
 
     "
@@ -5022,8 +5022,8 @@
      and load it. This installs all of its contained classes.
      Return true if ok, false if not.
      Notice: the argument may not have an extension (by purpose);
-             the sharedLib extension (.dll / .so / .sl) is added here, to
-             make the caller independent of the underlying operatingSystem."
+	     the sharedLib extension (.dll / .so / .sl) is added here, to
+	     make the caller independent of the underlying operatingSystem."
 
     |baseName handle libraryFilename packagePath|
 
@@ -5031,9 +5031,9 @@
 
     baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
     baseName exists ifTrue:[
-        "/ load local file first...
-        handle := (ObjectFileLoader loadObjectFile:baseName).
-        handle notNil ifTrue:[^ true].
+	"/ load local file first...
+	handle := (ObjectFileLoader loadObjectFile:baseName).
+	handle notNil ifTrue:[^ true].
     ].
 
     packagePath := self getPackageDirectoryForPackage:packageID.
@@ -5041,8 +5041,8 @@
     packagePath := packagePath asFilename.
     libraryFilename := packagePath / baseName.
     libraryFilename exists ifFalse:[
-        "in windows (with Borland compiler, DLLs in development environment are under objbc"
-        libraryFilename := packagePath / 'objbc' / baseName.
+	"in windows (with Borland compiler, DLLs in development environment are under objbc"
+	libraryFilename := packagePath / 'objbc' / baseName.
     ].
     libraryFilename exists ifFalse:[^ false].
 
@@ -5079,38 +5079,38 @@
 
     inStream := streamArg.
     inStream isNil ifTrue:[^ false].
-    inStream := ChangeSet isNil 
-                    ifTrue:[ inStream ]
-                    ifFalse:[ ChangeSet decodedStreamFor:inStream ].
+    inStream := ChangeSet isNil
+		    ifTrue:[ inStream ]
+		    ifFalse:[ ChangeSet decodedStreamFor:inStream ].
 
     lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy].
     silent notNil ifTrue:[wasSilent := self silentLoading:silent].
     morePath notNil ifTrue:[
-        oldSystemPath := SystemPath copy.
-        SystemPath addFirst:morePath.
-        oldRealPath := RealSystemPath.
-        RealSystemPath := nil.
+	oldSystemPath := SystemPath copy.
+	SystemPath addFirst:morePath.
+	oldRealPath := RealSystemPath.
+	RealSystemPath := nil.
     ].
     [
-        (Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[
-            inStream fileIn.
-        ]
+	(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[
+	    inStream fileIn.
+	]
     ] ensure:[
-        morePath notNil ifTrue:[
-            "take care, someone could have changed SystemPath during fileIn!!"
-            (SystemPath copyFrom:2) = oldSystemPath ifTrue:[
-                SystemPath := oldSystemPath.
-                RealSystemPath := oldRealPath.
-            ] ifFalse:[
-                (oldSystemPath includes:morePath) ifFalse:[
-                    SystemPath remove:morePath ifAbsent:[].
-                ].
-                RealSystemPath := nil.
-            ].
-        ].
-        lazy notNil ifTrue:[Compiler compileLazy:wasLazy].
-        silent notNil ifTrue:[self silentLoading:wasSilent].
-        inStream close
+	morePath notNil ifTrue:[
+	    "take care, someone could have changed SystemPath during fileIn!!"
+	    (SystemPath copyFrom:2) = oldSystemPath ifTrue:[
+		SystemPath := oldSystemPath.
+		RealSystemPath := oldRealPath.
+	    ] ifFalse:[
+		(oldSystemPath includes:morePath) ifFalse:[
+		    SystemPath remove:morePath ifAbsent:[].
+		].
+		RealSystemPath := nil.
+	    ].
+	].
+	lazy notNil ifTrue:[Compiler compileLazy:wasLazy].
+	silent notNil ifTrue:[self silentLoading:wasSilent].
+	inStream close
     ].
     ^ true
 
@@ -5290,6 +5290,60 @@
     ^ nil
 !
 
+fileNameForClass:aClassOrClassName
+    "return a actual or expected (or most wanted) filename for aClassOrClassName
+     - only the base name (without directory part) and without suffix."
+
+    |cls nonMetaclass nm nameWithPrefix nameWithoutPrefix|
+
+    aClassOrClassName isBehavior ifTrue:[
+	cls := aClassOrClassName.
+    ] ifFalse:[
+	cls := Smalltalk classNamed:aClassOrClassName.
+	cls isNil ifTrue:[
+	    nameWithPrefix := aClassOrClassName.
+	    nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1).
+	].
+    ].
+
+    cls notNil ifTrue:[
+	nonMetaclass := cls theNonMetaclass.
+	nm := nonMetaclass getClassFilename.
+	nm notNil ifTrue:[^ nm asFilename withoutSuffix baseName].
+	nameWithPrefix := nonMetaclass name.
+	nameWithoutPrefix := nonMetaclass nameWithoutPrefix.
+    ].
+
+    CachedAbbreviations notNil ifTrue:[
+	nameWithPrefix := nameWithPrefix asSymbol.
+	(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[
+	    ^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName
+	].
+	nameWithoutPrefix := nameWithoutPrefix asSymbol.
+	(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[
+	    ^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName
+	].
+    ].
+
+    ^ nameWithPrefix copyReplaceAll:$: with:$_
+
+    "
+     Smalltalk fileNameForClass:#Complex
+     Smalltalk fileNameForClass:'SmallInteger'
+     Smalltalk fileNameForClass:'UnixOperatingSystem'
+     Smalltalk fileNameForClass:'Launcher'
+     Smalltalk fileNameForClass:'SomeUnknownClass'
+
+     Smalltalk fileNameForClass:HTML::Encoder
+     Smalltalk fileNameForClass:OSI::FTAMOperation
+     Smalltalk fileNameForClass:'OSI::Foobar'
+     Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons)
+     Workflow::UnsuccessfulFinishReasons classFilename
+    "
+
+    "Modified: / 06-10-2006 / 16:16:01 / cg"
+!
+
 filenameAbbreviations
     "return a dictionary containing the classname-to-filename
      mappings. (needed for sys5.3 users, where filenames are limited
@@ -5452,22 +5506,22 @@
     packageSubDirectory := aPackageID asPackageId directory.
 
     checkForPackageDirectory :=
-        [:moduleDir |
-            |packageDir|
-
-            moduleDir isDirectory ifTrue:[
-                packageDir := moduleDir construct:packageSubDirectory.
-                packageDir isDirectory ifTrue:[
-                    ^ packageDir
-                ]
-            ].
-        ].
+	[:moduleDir |
+	    |packageDir|
+
+	    moduleDir isDirectory ifTrue:[
+		packageDir := moduleDir construct:packageSubDirectory.
+		packageDir isDirectory ifTrue:[
+		    ^ packageDir
+		]
+	    ].
+	].
 
     self packagePath do:[:aPath |
-        |moduleDir|
-
-        moduleDir := aPath asFilename construct:module.
-        checkForPackageDirectory value:moduleDir.
+	|moduleDir|
+
+	moduleDir := aPath asFilename construct:module.
+	checkForPackageDirectory value:moduleDir.
     ].
 
     ^ nil
@@ -5491,20 +5545,20 @@
     "/ search along packagePath ...
     f := self searchPath:self packagePath for:aFileName in:nil.
     f isNil ifTrue:[
-        "/ search under packages-directory along systemPath ...
-        f := self searchPath:self realSystemPath for:aFileName in:PackageDirName.
-        "/ kludge - allow for stx-directory to be named differently
-        f isNil ifTrue:[
-            ((aFileName startsWith:'stx') and:[(aFileName startsWith:'stx' , Filename separator)]) ifTrue:[
-                f := '../..' asFilename construct:(aFileName copyFrom:5).
-                f exists ifTrue:[
-                    ^ f pathName
-                ].
-            ]
-        ].
+	"/ search under packages-directory along systemPath ...
+	f := self searchPath:self realSystemPath for:aFileName in:PackageDirName.
+	"/ kludge - allow for stx-directory to be named differently
+	f isNil ifTrue:[
+	    ((aFileName startsWith:'stx') and:[(aFileName startsWith:'stx' , Filename separator)]) ifTrue:[
+		f := '../..' asFilename construct:(aFileName copyFrom:5).
+		f exists ifTrue:[
+		    ^ f pathName
+		].
+	    ]
+	].
     ].
     (f notNil and:[(f := f asFilename) exists]) ifTrue:[
-        ^ f pathName
+	^ f pathName
     ].
     ^ nil
 
@@ -5914,32 +5968,32 @@
     |nP|
 
     RealSystemPath isNil ifTrue:[
-        OperatingSystem isVMSlike ifTrue:[
-            "/ temporary kludge: since we cannot currently
-            "/ check for existance of a name like 'volume:',
-            "/ leave those in the Path without a check.
-            RealSystemPath := SystemPath select:[:dirName |  |f|
-                f := dirName asFilename.
-                f isVolumeOnly or:[(f isDirectory) and:[f isReadable]]
-            ]
-        ] ifFalse:[
-            RealSystemPath := SystemPath 
-                select:[:eachDirectoryName |  |f|
-                    f := eachDirectoryName asFilename.
-                    (f isDirectory) and:[f isReadable]
-                ] thenCollect:[:eachDirectoryName|
-                    eachDirectoryName asFilename pathName.
-                ].
-
-            "/ remove duplicates (but keep order)
-            nP := OrderedCollection new.
-            RealSystemPath do:[:p |
-                (nP includes:p) ifFalse:[
-                    nP add:p
-                ]
-            ].
-            RealSystemPath := nP.
-        ].
+	OperatingSystem isVMSlike ifTrue:[
+	    "/ temporary kludge: since we cannot currently
+	    "/ check for existance of a name like 'volume:',
+	    "/ leave those in the Path without a check.
+	    RealSystemPath := SystemPath select:[:dirName |  |f|
+		f := dirName asFilename.
+		f isVolumeOnly or:[(f isDirectory) and:[f isReadable]]
+	    ]
+	] ifFalse:[
+	    RealSystemPath := SystemPath
+		select:[:eachDirectoryName |  |f|
+		    f := eachDirectoryName asFilename.
+		    (f isDirectory) and:[f isReadable]
+		] thenCollect:[:eachDirectoryName|
+		    eachDirectoryName asFilename pathName.
+		].
+
+	    "/ remove duplicates (but keep order)
+	    nP := OrderedCollection new.
+	    RealSystemPath do:[:p |
+		(nP includes:p) ifFalse:[
+		    nP add:p
+		]
+	    ].
+	    RealSystemPath := nP.
+	].
     ].
     ^ RealSystemPath
 !
@@ -6382,7 +6436,7 @@
     "make certain, that some particular package is loaded into the system."
 
     (aPackageIdOrPackage isString) ifTrue:[
-        ^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:asAutoloaded
+	^ self loadPackageWithId:aPackageIdOrPackage asAutoloaded:asAutoloaded
     ].
     self shouldImplement.
 
@@ -6567,7 +6621,7 @@
      projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded|
 
     packageDirOrStringOrNil notNil ifTrue:[
-        packageDir := packageDirOrStringOrNil asFilename.
+	packageDir := packageDirOrStringOrNil asFilename.
     ].
     silent := SilentLoading or:[ StandAlone ].
 
@@ -6582,27 +6636,27 @@
 
     "if not, file it in ..."
     (projectDefinitionClass isNil and:[packageDir notNil]) ifTrue:[
-        projectDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageId.
-        "/ try to load the project definition class
-        filename := (packageDir construct:projectDefinitionClassName) withSuffix:'st'.
-        filename exists ifFalse:[
-            filename := ((packageDir construct:'source') construct:projectDefinitionClassName) withSuffix:'st'.
-        ].
-        filename exists ifTrue:[
-            Class withoutUpdatingChangesDo:[
-                filename fileIn.
-            ].
-            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageId.
-        ].
+	projectDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageId.
+	"/ try to load the project definition class
+	filename := (packageDir construct:projectDefinitionClassName) withSuffix:'st'.
+	filename exists ifFalse:[
+	    filename := ((packageDir construct:'source') construct:projectDefinitionClassName) withSuffix:'st'.
+	].
+	filename exists ifTrue:[
+	    Class withoutUpdatingChangesDo:[
+		filename fileIn.
+	    ].
+	    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageId.
+	].
     ].
 
     projectDefinitionClass notNil ifTrue:[
-        projectDefinitionClass autoload.
-        somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
-        (silent not and:[somethingHasBeenLoaded]) ifTrue:[
-            Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project definition').
-        ].
-        ^ true.
+	projectDefinitionClass autoload.
+	somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
+	(silent not and:[somethingHasBeenLoaded]) ifTrue:[
+	    Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from project definition').
+	].
+	^ true.
     ].
 
     "Is there a shared library (.dll or .so) ?"
@@ -6610,45 +6664,45 @@
 
     filename := Filename currentDirectory construct:shLibName.
     filename exists ifFalse:[
-        packageDir notNil ifTrue:[
-            filename := packageDir construct:shLibName.
-            filename exists ifFalse:[
-                filename := (packageDir construct:'objbc') construct:shLibName.
-            ]
-        ]
+	packageDir notNil ifTrue:[
+	    filename := packageDir construct:shLibName.
+	    filename exists ifFalse:[
+		filename := (packageDir construct:'objbc') construct:shLibName.
+	    ]
+	]
     ].
     filename exists ifTrue:[
-        (self loadPackage:aPackageId fromClassLibrary:filename) ifTrue:[
-            silent ifFalse:[
-                Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , filename pathName).
-            ].
-            doLoadAsAutoloaded ifFalse:[
-                "/ force autoloading...
-                Smalltalk allClassesDo:[:eachClass |
-                    eachClass package == aPackageId ifTrue:[eachClass autoload].
-                ].
-            ].
-            ^ true
-        ]
+	(self loadPackage:aPackageId fromClassLibrary:filename) ifTrue:[
+	    silent ifFalse:[
+		Transcript showCR:('loaded package: ' , aPackageId , ' from binary classLib file: ' , filename pathName).
+	    ].
+	    doLoadAsAutoloaded ifFalse:[
+		"/ force autoloading...
+		Smalltalk allClassesDo:[:eachClass |
+		    eachClass package == aPackageId ifTrue:[eachClass autoload].
+		].
+	    ].
+	    ^ true
+	]
     ].
 
     packageDir isNil ifTrue:[
-        ^ false.
+	^ false.
     ].
 
 
     "/ loadAll ? - will be soon obsolete
     filename := packageDir construct:'loadAll'.
     filename exists ifFalse:[
-        filename := packageDir construct:'loadall'.
+	filename := packageDir construct:'loadall'.
     ].
     filename exists ifTrue:[
-        (self loadPackage:aPackageId fromLoadAllFile:filename) ifTrue:[
-            silent ifFalse:[
-                Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , filename pathName).
-            ].
-            ^ true
-        ]
+	(self loadPackage:aPackageId fromLoadAllFile:filename) ifTrue:[
+	    silent ifFalse:[
+		Transcript showCR:('loaded package: ' , aPackageId , ' from loadAll file: ' , filename pathName).
+	    ].
+	    ^ true
+	]
     ].
 
     packageName := packageDir baseName.
@@ -6728,7 +6782,7 @@
 
     packageDir := self getPackageFileName:packageDirName.
     packageDir isNil ifTrue:[
-        ^ nil.
+	^ nil.
     ].
     ^ packageDir asFilename
 
@@ -7037,7 +7091,7 @@
      to the outside world.
 
      ST/X revision Naming is:
-        <major>.<minor>.<revision>.<release>"
+	<major>.<minor>.<revision>.<release>"
 
     ^ 6
 
@@ -7130,5 +7184,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.886 2009-09-23 19:59:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.887 2009-09-24 09:13:46 cg Exp $'
 ! !