5039 |
5037 |
5040 "Modified: 16.1.1997 / 01:25:58 / cg" |
5038 "Modified: 16.1.1997 / 01:25:58 / cg" |
5041 "Created: 17.10.1997 / 13:52:19 / cg" |
5039 "Created: 17.10.1997 / 13:52:19 / cg" |
5042 ! |
5040 ! |
5043 |
5041 |
|
5042 recursiveInstallAutoloadedClassesFrom:aTopDirectory |
|
5043 "scan all packages and install all classes found there as |
|
5044 autoloaded. This takes some time ..." |
|
5045 |
|
5046 |dirsConsulted| |
|
5047 |
|
5048 dirsConsulted := Set new. |
|
5049 |
|
5050 self |
|
5051 recursiveInstallAutoloadedClassesFrom:aTopDirectory |
|
5052 rememberIn:dirsConsulted |
|
5053 maxLevels:15 |
|
5054 noAutoload:false |
|
5055 packageTop:nil |
|
5056 showSplashInLevels:-1. |
|
5057 |
|
5058 |
|
5059 " |
|
5060 Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
|
5061 " |
|
5062 |
|
5063 "Created: / 31-07-2012 / 15:27:40 / cg" |
|
5064 ! |
|
5065 |
5044 recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5066 recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5045 "read all abbrev.stc files from and under aDirectory |
5067 "read all abbrev.stc files from and under aDirectory |
5046 and install autoloaded classes. |
5068 and install autoloaded classes. |
5047 If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
5069 If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
5048 (however, the directories are searched for packages) |
5070 (however, the directories are searched for packages) |
5071 |
5093 |
5072 |dir noAutoloadHere dirName pkgName directoryContents| |
5094 |dir noAutoloadHere dirName pkgName directoryContents| |
5073 |
5095 |
5074 maxLevels == 0 ifTrue:[ |
5096 maxLevels == 0 ifTrue:[ |
5075 "/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
5097 "/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
5076 ^ self |
5098 ^ self |
5077 ]. |
5099 ]. |
5078 |
5100 |
5079 dir := aDirectory asFilename. |
5101 dir := aDirectory asFilename. |
5080 dirName := dir pathName. |
5102 dirName := dir pathName. |
5081 |
5103 |
5082 (dirsConsulted includes:dirName) ifTrue:[ |
5104 (dirsConsulted includes:dirName) ifTrue:[ |
5083 ^ self |
5105 ^ self |
5084 ]. |
5106 ]. |
5085 dirsConsulted add:dirName. |
5107 dirsConsulted add:dirName. |
5086 |
5108 |
5087 (dir / 'NOPACKAGES') exists ifTrue:[ |
5109 (dir / 'NOPACKAGES') exists ifTrue:[ |
5088 ^ self. |
5110 ^ self. |
5089 ]. |
5111 ]. |
5090 (dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
5112 (dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
5091 ^ self. |
5113 ^ self. |
5092 ]. |
5114 ]. |
5093 |
5115 |
5094 noAutoloadHere := noAutoloadIn. |
5116 noAutoloadHere := noAutoloadIn. |
5095 noAutoloadHere ifFalse:[ |
5117 noAutoloadHere ifFalse:[ |
5096 (dir / 'NOAUTOLOAD') exists ifTrue:[ |
5118 (dir / 'NOAUTOLOAD') exists ifTrue:[ |
5097 noAutoloadHere := true. |
5119 noAutoloadHere := true. |
5098 ]. |
5120 ]. |
5099 ] ifTrue:[ |
5121 ] ifTrue:[ |
5100 (dir / 'AUTOLOAD') exists ifTrue:[ |
5122 (dir / 'AUTOLOAD') exists ifTrue:[ |
5101 noAutoloadHere := false. |
5123 noAutoloadHere := false. |
5102 ]. |
5124 ]. |
5103 ]. |
5125 ]. |
5104 |
5126 |
5105 ((dir / 'loadAll') exists or:[(dir / 'abbrev.stc') exists]) ifTrue:[ |
5127 ((dir / 'loadAll') exists or:[(dir / 'abbrev.stc') exists]) ifTrue:[ |
5106 KnownPackages isNil ifTrue:[ |
5128 packageTopPath notNil ifTrue:[ |
5107 KnownPackages := Set new. |
5129 KnownPackages isNil ifTrue:[ |
5108 ]. |
5130 KnownPackages := Set new. |
5109 pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
5131 ]. |
5110 KnownPackages add:pkgName |
5132 pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
|
5133 KnownPackages add:pkgName |
|
5134 ]. |
5111 ]. |
5135 ]. |
5112 |
5136 |
5113 showSplashInLevels >= 0 ifTrue:[ |
5137 showSplashInLevels >= 0 ifTrue:[ |
5114 self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
5138 self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
5115 bindWith:(dirName contractAtBeginningTo:35)). |
5139 bindWith:(dirName contractAtBeginningTo:35)). |
5116 ]. |
5140 ]. |
5117 |
5141 |
5118 "/ |
5142 "/ |
5119 "/ suppress installation as autoloaded in this and everything |
5143 "/ suppress installation as autoloaded in this and everything |
5120 "/ below; however, still traverse the directories to find packages ... |
5144 "/ below; however, still traverse the directories to find packages ... |
5121 "/ |
5145 "/ |
5122 noAutoloadHere ifFalse:[ |
5146 noAutoloadHere ifFalse:[ |
5123 [ |
5147 [ |
5124 self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
5148 self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
5125 ] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
5149 ] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
5126 ]. |
5150 ]. |
5127 |
5151 |
5128 [ |
5152 [ |
5129 directoryContents := dir directoryContents asSet. "asSet to speed up remove" |
5153 directoryContents := dir directoryContents asSet. "asSet to speed up remove" |
5130 ] on:FileStream openErrorSignal do:[:ex| |
5154 ] on:FileStream openErrorSignal do:[:ex| |
5131 "non-accessable directory: we are done" |
5155 "non-accessable directory: we are done" |
5132 ^ self |
5156 ^ self |
5133 ]. |
5157 ]. |
5134 |
5158 |
5135 directoryContents removeAllFoundIn:#( |
5159 directoryContents removeAllFoundIn:#( |
5136 'objbc' |
5160 'objbc' |
5137 'objvc' |
5161 'objvc' |
5138 'doc' |
5162 'doc' |
5139 'CVS' |
5163 'CVS' |
5140 'bitmaps' |
5164 'bitmaps' |
5141 'resources' |
5165 'resources' |
5142 'source' |
5166 'source' |
5143 'not_delivered' |
5167 'not_delivered' |
5144 'not_ported' |
5168 'not_ported' |
5145 ). |
5169 ). |
5146 dir baseName = 'stx' ifTrue:[ |
5170 dir baseName = 'stx' ifTrue:[ |
5147 directoryContents removeAllFoundIn:#( |
5171 directoryContents removeAllFoundIn:#( |
5148 'configurations' |
5172 'configurations' |
5149 'include' |
5173 'include' |
5150 'rules' |
5174 'rules' |
5151 'stc' |
5175 'stc' |
5152 'support' |
5176 'support' |
5153 ). |
5177 ). |
5154 ]. |
5178 ]. |
5155 |
5179 |
5156 directoryContents do:[:eachFilenameString | |
5180 directoryContents do:[:eachFilenameString | |
5157 |f| |
5181 |f| |
5158 |
5182 |
5159 f := dir / eachFilenameString. |
5183 f := dir / eachFilenameString. |
5160 f isDirectory ifTrue:[ |
5184 f isDirectory ifTrue:[ |
5161 self |
5185 self |
5162 recursiveInstallAutoloadedClassesFrom:f |
5186 recursiveInstallAutoloadedClassesFrom:f |
5163 rememberIn:dirsConsulted |
5187 rememberIn:dirsConsulted |
5164 maxLevels:maxLevels-1 |
5188 maxLevels:maxLevels-1 |
5165 noAutoload:noAutoloadHere |
5189 noAutoload:noAutoloadHere |
5166 packageTop:packageTopPath |
5190 packageTop:packageTopPath |
5167 showSplashInLevels:showSplashInLevels - 1. |
5191 showSplashInLevels:showSplashInLevels - 1. |
5168 ] |
5192 ] |
5169 ]. |
5193 ]. |
5170 |
5194 |
5171 showSplashInLevels >= 0 ifTrue:[ |
5195 showSplashInLevels >= 0 ifTrue:[ |
5172 self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
5196 self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
5173 bindWith:(dirName contractAtBeginningTo:35)). |
5197 bindWith:(dirName contractAtBeginningTo:35)). |
5174 ]. |
5198 ]. |
5175 |
5199 |
5176 " |
5200 " |
5177 Smalltalk installAutoloadedClasses |
5201 Smalltalk installAutoloadedClasses |
5178 " |
5202 " |
5179 |
5203 |
5180 "Modified: / 29-07-2011 / 20:40:51 / cg" |
5204 "Modified: / 31-07-2012 / 15:26:54 / cg" |
5181 ! |
5205 ! |
5182 |
5206 |
5183 replaceReferencesTo:anObject with:newRef |
5207 replaceReferencesTo:anObject with:newRef |
5184 "if the receiver refers to the argument, anObject, replace this reference with newRef. |
5208 "if the receiver refers to the argument, anObject, replace this reference with newRef. |
5185 Return true, if any reference was changed. |
5209 Return true, if any reference was changed. |