4839 This takes some time ..." |
4839 This takes some time ..." |
4840 |
4840 |
4841 |s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
4841 |s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
4842 |
4842 |
4843 anAbbrevFileStream isFileStream ifTrue:[ |
4843 anAbbrevFileStream isFileStream ifTrue:[ |
4844 abbrevFileName := anAbbrevFileStream pathName. |
4844 abbrevFileName := anAbbrevFileStream pathName. |
4845 info := 'declared from: ', abbrevFileName. |
4845 info := 'declared from: ', abbrevFileName. |
4846 ]. |
4846 ]. |
4847 |
4847 |
4848 KnownPackages isNil ifTrue:[ |
4848 KnownPackages isNil ifTrue:[ |
4849 KnownPackages := Set new. |
4849 KnownPackages := Set new. |
4850 ]. |
4850 ]. |
4851 |
4851 |
4852 "/ yes, create any required nameSpace, without asking user. |
4852 "/ yes, create any required nameSpace, without asking user. |
4853 Class createNameSpaceQuerySignal answer:true do:[ |
4853 Class createNameSpaceQuerySignal answer:true do:[ |
4854 |
4854 |
4855 [anAbbrevFileStream atEnd] whileFalse:[ |
4855 [anAbbrevFileStream atEnd] whileFalse:[ |
4856 l := anAbbrevFileStream nextLine withoutSeparators. |
4856 l := anAbbrevFileStream nextLine withoutSeparators. |
4857 l notEmpty ifTrue:[ |
4857 "Skip empty lines and comments" |
4858 "/ must do it manually, caring for quoted strings. |
4858 (l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
4859 "/ must do it manually, caring for quoted strings. |
4859 "/ words := line asCollectionOfWords. |
4860 "/ words := line asCollectionOfWords. |
4860 |
4861 |
4861 words := OrderedCollection new. |
4862 words := OrderedCollection new. |
4862 s2 := l readStream. |
4863 s2 := l readStream. |
4863 [s2 atEnd] whileFalse:[ |
4864 [s2 atEnd] whileFalse:[ |
4864 s2 skipSeparators. |
4865 s2 skipSeparators. |
4865 s2 peek == $' ifTrue:[ |
4866 s2 peek == $' ifTrue:[ |
4866 s2 next. |
4867 s2 next. |
4867 w := s2 upTo:$'. |
4868 w := s2 upTo:$'. |
4868 s2 skipSeparators. |
4869 s2 skipSeparators. |
4869 ] ifFalse:[ |
4870 ] ifFalse:[ |
4870 w := s2 upToSeparator |
4871 w := s2 upToSeparator |
4871 ]. |
4872 ]. |
4872 words add:w |
4873 words add:w |
4873 ]. |
4874 ]. |
4874 words size < 3 ifTrue:[ |
4875 words size < 3 ifTrue:[ |
4875 'Smalltalk [warning]: bad abbrev entry' errorPrint. |
4876 'Smalltalk [warning]: bad abbrev entry' errorPrint. |
4876 anAbbrevFileStream isFileStream ifTrue:[ |
4877 anAbbrevFileStream isFileStream ifTrue:[ |
4877 ' (in ''' errorPrint. |
4878 ' (in ''' errorPrint. |
4878 anAbbrevFileStream pathName errorPrint. |
4879 anAbbrevFileStream pathName errorPrint. |
4879 ''')' errorPrint |
4880 ''')' errorPrint |
4880 ]. |
4881 ]. |
4881 ': ' errorPrint. l errorPrintCR |
4882 ': ' errorPrint. l errorPrintCR |
4882 ] ifFalse:[ |
4883 ] ifFalse:[ |
4883 clsName := (words at:1) asSymbol. |
4884 clsName := (words at:1) asSymbol. |
4884 abbrev := (words at:2). |
4885 abbrev := (words at:2). |
4885 package := (words at:3) asSymbol. |
4886 package := (words at:3) asSymbol. |
4886 cat := words at:4 ifAbsent:nil. |
4887 cat := words at:4 ifAbsent:nil. |
4887 numClassInstVars := words at:5 ifAbsent:'0'. |
4888 numClassInstVars := words at:5 ifAbsent:'0'. |
4888 numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
4889 numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
4889 |
4890 |
4890 "/ KnownPackages add:package. |
4891 "/ KnownPackages add:package. |
4891 |
4892 |
4892 (cat size == 0) ifTrue:[ |
4893 (cat size == 0) ifTrue:[ |
4893 cat := 'autoloaded' |
4894 cat := 'autoloaded' |
4894 ]. |
4895 ]. |
4895 |
4896 |
4896 "/ on the fly, update the abbreviations |
4897 "/ on the fly, update the abbreviations |
4897 self setFilename:abbrev forClass:clsName package:package. |
4898 self setFilename:abbrev forClass:clsName package:package. |
4898 |
4899 |
4899 "/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
4900 "/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
4900 |
4901 |
4901 cls := self |
4902 cls := self |
4902 installAutoloadedClassNamed:clsName |
4903 installAutoloadedClassNamed:clsName |
4903 category:cat |
4904 category:cat |
4904 package:package |
4905 package:package |
4905 revision:nil |
4906 revision:nil |
4906 numClassInstVars:numClassInstVars. |
4907 numClassInstVars:numClassInstVars. |
4907 |
4908 |
4908 "/ info notNil ifTrue:[ |
4909 "/ info notNil ifTrue:[ |
4909 "/ cls setComment:info. |
4910 "/ cls setComment:info. |
4910 "/ ]. |
4911 "/ ]. |
4911 ] |
4912 ] |
4912 ] |
4913 ] |
4913 ] |
4914 ] |
4914 ] |
4915 ] |
4915 ! |
4916 ! |
4916 |
4917 |
4917 loadBinaries |
4918 loadBinaries |
4918 "return true, if binaries should be loaded into the system, |
4919 "return true, if binaries should be loaded into the system, |