diff -r 7a042f543d73 -r 641df14854e2 Smalltalk.st --- a/Smalltalk.st Fri May 18 14:49:09 2018 +0200 +++ b/Smalltalk.st Fri May 18 17:59:54 2018 +0200 @@ -1,5 +1,3 @@ -"{ Encoding: utf8 }" - " COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved @@ -6573,320 +6571,320 @@ should not send notes to the transcript; it can be true, false or nil, where nil uses the value from SilentLoading." - |classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr + |classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibSuffix inStream mgr filenameToSet packageDir packageFile bos| ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ - wasLazy := Compiler compileLazy:loadLazy. - beSilent notNil ifTrue:[ - wasSilent := self silentLoading:beSilent. - ]. - - classFileName := Smalltalk fileNameForClass:aClassName. - (classFileName = aClassName) ifTrue:[ - "/ no abbrev.stc translation for className - (aClassName includes:$:) ifTrue:[ - "/ a nameSpace name - alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 - ]. - ]. - - classFileName asFilename isAbsolute ifTrue:[ - classFileName asFilename suffix notEmptyOrNil ifTrue:[ - ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. - ] ifFalse:[ - ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. - ] - ] ifFalse:[ - classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. - [ - Class withoutUpdatingChangesDo:[ - |zarFn zar entry| - - ok := false. - - package notNil ifTrue:[ - packageDir := package asPackageId packageDirectory. - "/ packageDir := package asString. - "/ packageDir := packageDir copyReplaceAll:$: with:$/. - packageDir isNil ifTrue:[ - packageDir := self packageDirectoryForPackageId:package - ]. - packageDir notNil ifTrue:[ - packageDir := packageDir asFilename. - ]. - ]. - - Class packageQuerySignal answer:package do:[ - " - then, if dynamic linking is available, - " - (LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ - sharedLibExtension := ObjectFileLoader sharedLibraryExtension. - " - first look for a class packages shared binary in binary/xxx.o - " - libName := self libraryFileNameOfClass:aClassName. - libName notNil ifTrue:[ - (ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) - ifFalse:[ - sharedLibExtension ~= '.o' ifTrue:[ - ok := self fileInClass:aClassName fromObject:(libName, '.o') - ] - ]. - ]. - " - then, look for a shared binary in binary/xxx.o - " - ok ifFalse:[ - (ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) - ifFalse:[ - sharedLibExtension ~= '.o' ifTrue:[ - ok := self fileInClass:aClassName fromObject:(classFileName, '.o') - ]. - ok ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - (ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) - ifFalse:[ - sharedLibExtension ~= '.o' ifTrue:[ - ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') - ] - ] - ]. - ]. - ]. - ]. - ]. - - " - if that did not work, look for a compiled-bytecode file ... - " - ok ifFalse:[ - (ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent - ] - ] - ]. - " - if that did not work, and the classes package is known, - look for an st-cls file - in a package subdir of the source-directory ... - " - ok ifFalse:[ - (packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ - packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). - packageFile isNil ifTrue:[ - packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. - ]. - (ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). - packageFile isNil ifTrue:[ - packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). - ]. - ok := self fileIn:packageFile lazy:loadLazy silent:beSilent - ] - ]. - - zarFn := self getPackageFileName:(packageDir / 'classes.zip'). - zarFn notNil ifTrue:[ - zar := ZipArchive oldFileNamed:zarFn. - zar notNil ifTrue:[ - entry := zar extract:(classFileName , '.cls'). - (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ - entry := zar extract:(alternativeClassFileName , '.cls'). - ]. - entry notNil ifTrue:[ - bos := BinaryObjectStorage onOld:(entry asByteArray readStream). - bos next. - bos close. - ok := true - ]. - ] - ] - ] - ]. - - " - if that did not work, look for an st-source file ... - " - ok ifFalse:[ - filenameToSet := classFileName. - (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - filenameToSet := alternativeClassFileName. - ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent - ]. - ok ifFalse:[ - " - ... and in the standard source-directory - " - filenameToSet := 'source' asFilename / classFileName. - (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - filenameToSet := 'source' asFilename / alternativeClassFileName. - ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent - ] - ] - ] - ]. - " - if that did not work, and the classes package is known, - look for an st-source file - in a package subdir of the source-directory ... - " - ok ifFalse:[ - packageDir notNil ifTrue:[ - packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). - packageFile isNil ifTrue:[ - packageFile := (packageDir / 'source' / classFileName). - ]. - filenameToSet := packageFile. - (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). - packageFile isNil ifTrue:[ - packageFile := (packageDir / 'source' / alternativeClassFileName). - ]. - filenameToSet := packageFile. - ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent - ]. - ok ifFalse:[ - packageFile := self getPackageSourceFileName:(packageDir / classFileName). - packageFile isNil ifTrue:[ - packageFile := (packageDir / classFileName). - ]. - filenameToSet := packageFile. - (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). - packageFile isNil ifTrue:[ - packageFile := packageDir / alternativeClassFileName. - ]. - filenameToSet := packageFile. - ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent - ]. - ok ifFalse:[ - " - ... and in the standard source-directory - " - filenameToSet := 'source' asFilename / packageDir / classFileName. - (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) - ifFalse:[ - alternativeClassFileName notNil ifTrue:[ - filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. - ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent - ] - ] - ] - ]. - ]. - ]. - ] - ]. - " - if that did not work, and the classes package is known, - look for a zipArchive containing a class entry. - " - ok ifFalse:[ - packageDir notNil ifTrue:[ - zarFn := self getPackageFileName:(packageDir / 'source.zip'). - zarFn isNil ifTrue:[ - zarFn := packageDir withSuffix:'zip'. - zarFn := self getSourceFileName:zarFn. - ]. - (zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ - zar := ZipArchive oldFileNamed:zarFn. - zar notNil ifTrue:[ - entry := zar extract:(classFileName , '.st'). - (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ - entry := zar extract:(alternativeClassFileName , '.st'). - ]. - entry notNil ifTrue:[ - filenameToSet := zarFn. - ok := self - fileInStream:(entry asString readStream) - lazy:loadLazy - silent:beSilent - logged:false - addPath:nil - ]. - ] - ] - ] - ]. - - " - if that did not work, - look for a zipArchive containing a class entry. - " - ok ifFalse:[ - zarFn := self getSourceFileName:'source.zip'. - zarFn notNil ifTrue:[ - zar := ZipArchive oldFileNamed:zarFn. - zar notNil ifTrue:[ - entry := zar extract:(zarFn := classFileName , '.st'). - (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ - entry := zar extract:(zarFn := alternativeClassFileName , '.st'). - ]. - entry notNil ifTrue:[ - filenameToSet := zarFn. - ok := self - fileInStream:(entry asString readStream) - lazy:loadLazy - silent:beSilent - logged:false - addPath:nil - ]. - ] - ] - ]. - ok ifFalse:[ - " - if there is a sourceCodeManager, ask it for the classes sourceCode - " - (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ - inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. - inStream notNil ifTrue:[ - filenameToSet := nil. - ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. - ] - ]. - ]. - ]. - ] - ]. - ] ensure:[ - Compiler compileLazy:wasLazy. - wasSilent notNil ifTrue:[ - self silentLoading:wasSilent - ] - ]. - ]. - - ok ifTrue:[ - newClass := self at:(aClassName asSymbol). - newClass notNil ifTrue:[ - "set the classes name - but do not change if already set" - filenameToSet notNil ifTrue:[ - newClass getClassFilename isNil ifTrue:[ - newClass setClassFilename:(filenameToSet asFilename baseName) - ]. - ]. - - doInit ifTrue:[ - newClass initialize - ] - ] - ]. + wasLazy := Compiler compileLazy:loadLazy. + beSilent notNil ifTrue:[ + wasSilent := self silentLoading:beSilent. + ]. + + classFileName := Smalltalk fileNameForClass:aClassName. + (classFileName = aClassName) ifTrue:[ + "/ no abbrev.stc translation for className + (aClassName includes:$:) ifTrue:[ + "/ a nameSpace name + alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 + ]. + ]. + + classFileName asFilename isAbsolute ifTrue:[ + classFileName asFilename suffix notEmptyOrNil ifTrue:[ + ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. + ] ifFalse:[ + ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. + ] + ] ifFalse:[ + classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. + [ + Class withoutUpdatingChangesDo:[ + |zarFn zar entry| + + ok := false. + + package notNil ifTrue:[ + packageDir := package asPackageId packageDirectory. + "/ packageDir := package asString. + "/ packageDir := packageDir copyReplaceAll:$: with:$/. + packageDir isNil ifTrue:[ + packageDir := self packageDirectoryForPackageId:package + ]. + packageDir notNil ifTrue:[ + packageDir := packageDir asFilename. + ]. + ]. + + Class packageQuerySignal answer:package do:[ + " + then, if dynamic linking is available, + " + (LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ + sharedLibSuffix := ObjectFileLoader sharedLibrarySuffix. + " + first look for a class packages shared binary in binary/xxx.o + " + libName := self libraryFileNameOfClass:aClassName. + libName notNil ifTrue:[ + (ok := self fileInClass:aClassName fromObject:(libName asFilename withSuffix:sharedLibSuffix) name) + ifFalse:[ + sharedLibSuffix ~= 'o' ifTrue:[ + ok := self fileInClass:aClassName fromObject:(libName, '.o') + ] + ]. + ]. + " + then, look for a shared binary in binary/xxx.o + " + ok ifFalse:[ + (ok := self fileInClass:aClassName fromObject:(classFileName asFilename withSuffix:sharedLibSuffix) name) + ifFalse:[ + sharedLibSuffix ~= 'o' ifTrue:[ + ok := self fileInClass:aClassName fromObject:(classFileName, '.o') + ]. + ok ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + (ok := self fileInClass:aClassName fromObject:(alternativeClassFileName asFilename withSuffix:sharedLibSuffix) name) + ifFalse:[ + sharedLibSuffix ~= 'o' ifTrue:[ + ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') + ] + ] + ]. + ]. + ]. + ]. + ]. + + " + if that did not work, look for a compiled-bytecode file ... + " + ok ifFalse:[ + (ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent + ] + ] + ]. + " + if that did not work, and the classes package is known, + look for an st-cls file + in a package subdir of the source-directory ... + " + ok ifFalse:[ + (packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ + packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). + packageFile isNil ifTrue:[ + packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. + ]. + (ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). + packageFile isNil ifTrue:[ + packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). + ]. + ok := self fileIn:packageFile lazy:loadLazy silent:beSilent + ] + ]. + + zarFn := self getPackageFileName:(packageDir / 'classes.zip'). + zarFn notNil ifTrue:[ + zar := ZipArchive oldFileNamed:zarFn. + zar notNil ifTrue:[ + entry := zar extract:(classFileName , '.cls'). + (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ + entry := zar extract:(alternativeClassFileName , '.cls'). + ]. + entry notNil ifTrue:[ + bos := BinaryObjectStorage onOld:(entry asByteArray readStream). + bos next. + bos close. + ok := true + ]. + ] + ] + ] + ]. + + " + if that did not work, look for an st-source file ... + " + ok ifFalse:[ + filenameToSet := classFileName. + (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + filenameToSet := alternativeClassFileName. + ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent + ]. + ok ifFalse:[ + " + ... and in the standard source-directory + " + filenameToSet := 'source' asFilename / classFileName. + (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + filenameToSet := 'source' asFilename / alternativeClassFileName. + ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent + ] + ] + ] + ]. + " + if that did not work, and the classes package is known, + look for an st-source file + in a package subdir of the source-directory ... + " + ok ifFalse:[ + packageDir notNil ifTrue:[ + packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). + packageFile isNil ifTrue:[ + packageFile := (packageDir / 'source' / classFileName). + ]. + filenameToSet := packageFile. + (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). + packageFile isNil ifTrue:[ + packageFile := (packageDir / 'source' / alternativeClassFileName). + ]. + filenameToSet := packageFile. + ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent + ]. + ok ifFalse:[ + packageFile := self getPackageSourceFileName:(packageDir / classFileName). + packageFile isNil ifTrue:[ + packageFile := (packageDir / classFileName). + ]. + filenameToSet := packageFile. + (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). + packageFile isNil ifTrue:[ + packageFile := packageDir / alternativeClassFileName. + ]. + filenameToSet := packageFile. + ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent + ]. + ok ifFalse:[ + " + ... and in the standard source-directory + " + filenameToSet := 'source' asFilename / packageDir / classFileName. + (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) + ifFalse:[ + alternativeClassFileName notNil ifTrue:[ + filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. + ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent + ] + ] + ] + ]. + ]. + ]. + ] + ]. + " + if that did not work, and the classes package is known, + look for a zipArchive containing a class entry. + " + ok ifFalse:[ + packageDir notNil ifTrue:[ + zarFn := self getPackageFileName:(packageDir / 'source.zip'). + zarFn isNil ifTrue:[ + zarFn := packageDir withSuffix:'zip'. + zarFn := self getSourceFileName:zarFn. + ]. + (zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ + zar := ZipArchive oldFileNamed:zarFn. + zar notNil ifTrue:[ + entry := zar extract:(classFileName , '.st'). + (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ + entry := zar extract:(alternativeClassFileName , '.st'). + ]. + entry notNil ifTrue:[ + filenameToSet := zarFn. + ok := self + fileInStream:(entry asString readStream) + lazy:loadLazy + silent:beSilent + logged:false + addPath:nil + ]. + ] + ] + ] + ]. + + " + if that did not work, + look for a zipArchive containing a class entry. + " + ok ifFalse:[ + zarFn := self getSourceFileName:'source.zip'. + zarFn notNil ifTrue:[ + zar := ZipArchive oldFileNamed:zarFn. + zar notNil ifTrue:[ + entry := zar extract:(zarFn := classFileName , '.st'). + (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ + entry := zar extract:(zarFn := alternativeClassFileName , '.st'). + ]. + entry notNil ifTrue:[ + filenameToSet := zarFn. + ok := self + fileInStream:(entry asString readStream) + lazy:loadLazy + silent:beSilent + logged:false + addPath:nil + ]. + ] + ] + ]. + ok ifFalse:[ + " + if there is a sourceCodeManager, ask it for the classes sourceCode + " + (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ + inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. + inStream notNil ifTrue:[ + filenameToSet := nil. + ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. + ] + ]. + ]. + ]. + ] + ]. + ] ensure:[ + Compiler compileLazy:wasLazy. + wasSilent notNil ifTrue:[ + self silentLoading:wasSilent + ] + ]. + ]. + + ok ifTrue:[ + newClass := self at:(aClassName asSymbol). + newClass notNil ifTrue:[ + "set the classes name - but do not change if already set" + filenameToSet notNil ifTrue:[ + newClass getClassFilename isNil ifTrue:[ + newClass setClassFilename:(filenameToSet asFilename baseName) + ]. + ]. + + doInit ifTrue:[ + newClass initialize + ] + ] + ]. ]. ^ newClass @@ -8812,13 +8810,13 @@ (lang == #de) ifTrue:[ proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'. ] ifFalse:[ (lang == #fr) ifTrue:[ - proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)' + proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)' ] ifFalse:[ (lang == #it) ifTrue:[ proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)' ] ifFalse:[ (lang == #es) ifTrue:[ proto := 'Hola, bienvenida a %1 (%4version %2 de %3)' ] ifFalse:[ (lang == #pt) ifTrue:[ - proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' + proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' ] ifFalse:[ (lang == #no) ifTrue:[ proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)' ]]]]]].