Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 31 May 2016 10:23:18 +0100
branchjv
changeset 19912 ca84ec5f80a7
parent 19903 bde12a6eb128 (current diff)
parent 19911 0b24a97a0bb7 (diff)
child 19945 9c7cd0ca7991
Merge
AbstractOperatingSystem.st
Behavior.st
ProjectDefinition.st
Smalltalk.st
String.st
UnixOperatingSystem.st
--- a/AbstractOperatingSystem.st	Wed May 25 07:03:30 2016 +0200
+++ b/AbstractOperatingSystem.st	Tue May 31 10:23:18 2016 +0100
@@ -6544,7 +6544,7 @@
     "/ fallBack dummy
 
     aNumber == self getUserID ifTrue:[
-	^ self getLoginName
+        ^ self getLoginName
     ].
 
     ^ '? (' , aNumber printString , ')'
@@ -6553,6 +6553,7 @@
      OperatingSystem getUserNameFromID:0
      OperatingSystem getUserNameFromID:100
      OperatingSystem getUserNameFromID:9991
+     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)
     "
 !
 
--- a/Behavior.st	Wed May 25 07:03:30 2016 +0200
+++ b/Behavior.st	Tue May 31 10:23:18 2016 +0100
@@ -2754,10 +2754,10 @@
 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
 #  endif
 # else
-		    while (nInstVars--)
+                    while (nInstVars-- != 0)
 			*op++ = nil;
 		    fp = (float *)op;
-		    while (nindexedinstvars--)
+                    while (nindexedinstvars-- != 0)
 			*fp++ = 0.0;
 # endif
 		    RETURN ( newobj );
@@ -2791,7 +2791,7 @@
 #  endif
 # else
 		    op = __InstPtr(newobj)->i_instvars;
-		    while (nInstVars--)
+                    while (nInstVars-- != 0)
 			*op++ = nil;
 
 #  ifdef __NEED_DOUBLE_ALIGN
@@ -2804,7 +2804,7 @@
 		    }
 #  endif
 		    dp = (double *)op;
-		    while (nindexedinstvars--)
+                    while (nindexedinstvars-- != 0)
 			*dp++ = 0.0;
 # endif
 		    RETURN ( newobj );
@@ -2847,7 +2847,7 @@
 			    nInstVars -= 8;
 			}
 		    }
-		    while (nInstVars) {
+                    while (nInstVars != 0) {
 			*op++ = 0;
 			nInstVars--;
 		    }
@@ -2866,7 +2866,7 @@
 			    nInstVars -= 8;
 			}
 		    }
-		    while (nInstVars) {
+                    while (nInstVars != 0) {
 			*op++ = 0;
 			nInstVars--;
 		    }
@@ -2883,7 +2883,7 @@
 			op[6] = nil; op[7] = nil;
 			op += 8;
 		    }
-		    while (nInstVars--)
+                    while (nInstVars-- != 0)
 			*op++ = nil;
 #    endif
 #   endif
@@ -2921,7 +2921,7 @@
 			    op = __InstPtr(newobj)->i_instvars;
 			    do {
 				*op++ = nil;
-			    } while (--nInstVars);
+                            } while (--nInstVars != 0);
 #  endif
 # endif
 			}
--- a/ProjectDefinition.st	Wed May 25 07:03:30 2016 +0200
+++ b/ProjectDefinition.st	Tue May 31 10:23:18 2016 +0100
@@ -5269,6 +5269,14 @@
 
 !ProjectDefinition class methodsFor:'loading'!
 
+checkForLoad
+    "raise an error, if the package is not suitable for loading-"
+
+    self supportedOnPlatform ifFalse:[
+        PackageNotCompatibleError raiseWith:self package.
+    ].
+!
+
 ensureFullyLoaded
     "ensure that all classes and extensions are loaded properly.
      This is normally no problem for compiled classLibs - however, if a package
--- a/Smalltalk.st	Wed May 25 07:03:30 2016 +0200
+++ b/Smalltalk.st	Tue May 31 10:23:18 2016 +0100
@@ -2381,8 +2381,8 @@
 
     "maybe, it is already in the image"
     projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
-    (projectDefinitionClass notNil and:[projectDefinitionClass supportedOnPlatform not]) ifTrue:[
-        ^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
+    projectDefinitionClass notNil ifTrue:[
+        projectDefinitionClass checkForLoad.
     ].
 
     "Is there a shared library (.dll or .so) ?"
@@ -2411,11 +2411,9 @@
             self breakPoint:#cg.
             projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
             projectDefinitionClass notNil ifTrue:[
-                projectDefinitionClass supportedOnPlatform ifTrue:[
-                    "/ load prerequisites...
-                    projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
-                    self breakPoint:#cg.
-                ].
+                projectDefinitionClass
+                    checkForLoad; 
+                    loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
             ].
         ].
     ].
@@ -2457,11 +2455,11 @@
         ].
     ].
     projectDefinitionClass notNil ifTrue:[
-        projectDefinitionClass autoload.
-        projectDefinitionClass supportedOnPlatform ifFalse:[
-            ^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
-        ].
-        projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
+        projectDefinitionClass
+            autoload;
+            checkForLoad;
+            loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
+
         somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
         errorInInitialize ifTrue:[
             Transcript showCR:('Smalltalk [info]: retrying #initialize').
@@ -2827,9 +2825,9 @@
     "load a package from a .zip delivery file.
      Experimental."
 
-    ^ PackageLoadError
-	raiseRequestWith:aPackageId
-	errorString:' - package loading from zip is not yet implemented'.
+    PackageLoadError
+        raiseWith:aPackageId
+        errorString:' - package loading from zip is not yet implemented'.
 !
 
 loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded
@@ -5410,20 +5408,21 @@
     f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath].
 
     f notNil ifTrue:[
-	f := f asFilename.
-	f isDirectory ifTrue:[
-	    f := f construct:'abbrev.stc'
-	].
-	[
-	    s := f readStream.
-	    self installAutoloadedClassesFromStream:s.
-	    s close.
-	] on:FileStream openErrorSignal
-	do:[:ex| "do nothing"].
+        f := f asFilename.
+        f isDirectory ifTrue:[
+            f := f construct:'abbrev.stc'
+        ].
+        [
+            s := f readStream.
+            self installAutoloadedClassesFromStream:s.
+            s close.
+        ] on:FileStream openErrorSignal
+        do:[:ex| "do nothing"].
     ]
 
     "
      Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc'
+     Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc'
     "
 
     "Modified: / 5.11.1998 / 15:10:51 / cg"
@@ -5431,9 +5430,13 @@
 
 installAutoloadedClassesFromAbbrevFile:aFilename
     aFilename readingFileDo:[:abbrevStream |
-	self installAutoloadedClassesFromStream:abbrevStream.
+        self installAutoloadedClassesFromStream:abbrevStream.
     ]
 
+    "
+     self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename)
+    "
+    
     "Created: / 29-07-2011 / 20:39:21 / cg"
 !
 
@@ -5446,71 +5449,71 @@
     |s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w|
 
     anAbbrevFileStream isFileStream ifTrue:[
-	abbrevFileName := anAbbrevFileStream pathName.
-	info := 'declared from: ', abbrevFileName.
+        abbrevFileName := anAbbrevFileStream pathName.
+        info := 'declared from: ', abbrevFileName.
     ].
 
     "/ yes, create any required nameSpace, without asking user.
     Class createNameSpaceQuerySignal answer:true do:[
 
-	[anAbbrevFileStream atEnd] whileFalse:[
-	    l := anAbbrevFileStream nextLine withoutSeparators.
-	    "Skip empty lines and comments"
-	    (l notEmpty and:[l first ~= $#]) ifTrue:[
-		"/ must do it manually, caring for quoted strings.
+        [anAbbrevFileStream atEnd] whileFalse:[
+            l := anAbbrevFileStream nextLine withoutSeparators.
+            "Skip empty lines and comments"
+            (l notEmpty and:[l first ~= $#]) ifTrue:[
+                "/ must do it manually, caring for quoted strings.
 "/                words := line asCollectionOfWords.
 
-		words := OrderedCollection new.
-		s2 := l readStream.
-		[s2 atEnd] whileFalse:[
-		    s2 skipSeparators.
-		    s2 peek == $' ifTrue:[
-			s2 next.
-			w := s2 upTo:$'.
-			s2 skipSeparators.
-		    ] ifFalse:[
-			w := s2 upToSeparator
-		    ].
-		    words add:w
-		].
-		words size < 3 ifTrue:[
-		    'Smalltalk [warning]: bad abbrev entry' errorPrint.
-		    anAbbrevFileStream isFileStream ifTrue:[
-			' (in ''' errorPrint.
-			anAbbrevFileStream pathName errorPrint.
-			''')' errorPrint
-		    ].
-		    ': ' errorPrint. l errorPrintCR
-		] ifFalse:[
-		    clsName := (words at:1) asSymbol.
-		    abbrev := (words at:2).
-		    package := (words at:3) asSymbol.
-		    cat := words at:4 ifAbsent:nil.
-		    numClassInstVars := words at:5 ifAbsent:'0'.
-		    numClassInstVars := Integer readFrom:numClassInstVars onError:[0].
-
-		    (cat size == 0) ifTrue:[
-			cat := 'autoloaded'
-		    ].
-
-		    "/ on the fly, update the abbreviations
-		    self setFilename:abbrev forClass:clsName package:package.
-
-		    "/ '  autoloaded: ' print. clsName print. ' in ' print. cat printCR.
-
-		    cls := self
-			installAutoloadedClassNamed:clsName
-			category:cat
-			package:package
-			revision:nil
-			numClassInstVars:numClassInstVars.
+                words := OrderedCollection new.
+                s2 := l readStream.
+                [s2 atEnd] whileFalse:[
+                    s2 skipSeparators.
+                    s2 peek == $' ifTrue:[
+                        s2 next.
+                        w := s2 upTo:$'.
+                        s2 skipSeparators.
+                    ] ifFalse:[
+                        w := s2 upToSeparator
+                    ].
+                    words add:w
+                ].
+                words size < 3 ifTrue:[
+                    'Smalltalk [warning]: bad abbrev entry' errorPrint.
+                    anAbbrevFileStream isFileStream ifTrue:[
+                        ' (in ''' errorPrint.
+                        anAbbrevFileStream pathName errorPrint.
+                        ''')' errorPrint
+                    ].
+                    ': ' errorPrint. l errorPrintCR
+                ] ifFalse:[
+                    clsName := (words at:1) asSymbol.
+                    abbrev := (words at:2).
+                    package := (words at:3) asSymbol.
+                    cat := words at:4 ifAbsent:nil.
+                    numClassInstVars := words at:5 ifAbsent:'0'.
+                    numClassInstVars := Integer readFrom:numClassInstVars onError:[0].
+
+                    (cat size == 0) ifTrue:[
+                        cat := 'autoloaded'
+                    ].
+
+                    "/ on the fly, update the abbreviations
+                    self setFilename:abbrev forClass:clsName package:package.
+
+                    "/ '  autoloaded: ' print. clsName print. ' in ' print. cat printCR.
+
+                    cls := self
+                        installAutoloadedClassNamed:clsName
+                        category:cat
+                        package:package
+                        revision:nil
+                        numClassInstVars:numClassInstVars.
 
 "/                    info notNil ifTrue:[
 "/                        cls setComment:info.
 "/                    ].
-		]
-	    ]
-	]
+                ]
+            ]
+        ]
     ]
 !
 
--- a/String.st	Wed May 25 07:03:30 2016 +0200
+++ b/String.st	Tue May 31 10:23:18 2016 +0100
@@ -125,7 +125,7 @@
 "
     Strings are ByteArrays storing Characters.
 
-    Strings are kind of kludgy: to allow for easy handling by c-functions,
+    Strings are kind of kludgy: to allow for easy handling by C functions,
     there is always one 0-byte added at the end, which is not counted
     in the strings size, and is not accessible from the smalltalk level.
     This guarantees, that a smalltalk string can always be passed to a
@@ -143,12 +143,17 @@
     For strings with other encodings, either keep the encoding separately,
     or use instances of encodedString.
 
+    Be careful when using the 0-byte in a String. This is not prohibited, but 
+    the implementations of some String methods use C functions and may
+    therefore yield unexpected results (e.g. compareWith:collating:) when
+    processing a String containing the 0-byte.
+
     [author:]
-	Claus Gittinger
+        Claus Gittinger
 
     [see also:]
-	Text StringCollection TwoByteString JISEncodedString
-	Symbol
+        Text StringCollection TwoByteString JISEncodedString
+        Symbol
 "
 ! !
 
@@ -555,7 +560,6 @@
     "Modified: / 12-01-2011 / 12:33:58 / cg"
 ! !
 
-
 !String methodsFor:'accessing'!
 
 at:index
@@ -4873,3 +4877,4 @@
 version_CVS
     ^ '$Header$'
 ! !
+
--- a/UnixOperatingSystem.st	Wed May 25 07:03:30 2016 +0200
+++ b/UnixOperatingSystem.st	Tue May 31 10:23:18 2016 +0100
@@ -10583,27 +10583,24 @@
 
 %{  /* NOCONTEXT */
 
-# ifndef NO_PWD
+#ifndef NO_PWD
     struct passwd *p;
 
     if (__isSmallInteger(aNumber)) {
-	p = getpwuid(__intVal(aNumber));
-	if (p) {
-	    RETURN ( __MKSTRING(p->pw_name) );
-	}
+        p = getpwuid(__intVal(aNumber));
+        if (p && p->pw_name && (strlen(p->pw_name) > 0)) {
+            RETURN ( __MKSTRING(p->pw_name) );
+        }
     }
 #endif /* unix-like */
 %}.
-    aNumber == self getUserID ifTrue:[
-	^ self getLoginName
-    ].
-
-    ^ '? (' , aNumber printString , ')'
+    ^ super getUserNameFromID:aNumber
 
     "
      OperatingSystem getUserNameFromID:0
      OperatingSystem getUserNameFromID:100
      OperatingSystem getUserNameFromID:9991
+     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)
     "
 !