author | Merge Script |
Sat, 06 Jun 2015 06:39:31 +0200 | |
branch | jv |
changeset 18442 | bd42fa983e3f |
parent 18430 | bd95f94284c8 (current diff) |
parent 18441 | dc7abfccf547 (diff) |
child 18457 | 214d760f8247 |
Annotation.st | file | annotate | diff | comparison | revisions | |
Behavior.st | file | annotate | diff | comparison | revisions | |
Block.st | file | annotate | diff | comparison | revisions | |
BlockContext.st | file | annotate | diff | comparison | revisions | |
CompiledCode.st | file | annotate | diff | comparison | revisions | |
Context.st | file | annotate | diff | comparison | revisions | |
Method.st | file | annotate | diff | comparison | revisions | |
Object.st | file | annotate | diff | comparison | revisions | |
ProtoObject.st | file | annotate | diff | comparison | revisions | |
Timestamp.st | file | annotate | diff | comparison | revisions |
--- a/Annotation.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Annotation.st Sat Jun 06 06:39:31 2015 +0200 @@ -343,6 +343,12 @@ ^ self arguments at: anInteger. ! +argumentCount + "Answer the number of arguments in the pragma." + + ^ self arguments size. +! + message "Answer the message of the receiving pragma." @@ -685,15 +691,15 @@ !Annotation class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.19 2015-03-27 09:24:52 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.20 2015-06-05 16:07:38 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.19 2015-03-27 09:24:52 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.20 2015-06-05 16:07:38 stefan Exp $' ! version_SVN - ^ '$Id: Annotation.st,v 1.19 2015-03-27 09:24:52 cg Exp $' + ^ '$Id: Annotation.st,v 1.20 2015-06-05 16:07:38 stefan Exp $' ! !
--- a/Behavior.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Behavior.st Sat Jun 06 06:39:31 2015 +0200 @@ -1326,7 +1326,7 @@ "Return all selectors defined in this class that take this number of arguments." ^ self selectors - select:[:sel | sel numArgs == numberOfArgs] + select:[:sel | sel argumentCount == numberOfArgs] " SmallInteger selectorsWithArgs:0 @@ -1426,6 +1426,7 @@ ^ self nameWithoutPrefix ! ! + !Behavior methodsFor:'RefactoringBrowser'! realClass @@ -1513,7 +1514,7 @@ self primAddSelector:newSelector withMethod:newMethod. - nargs := newMethod numArgs. + nargs := newMethod argumentCount. ObjectMemory flushMethodCacheForSelector:newSelector. "/ ObjectMemory flushMethodCache. @@ -3284,22 +3285,22 @@ |dict oldMethod| newMethod isNil ifTrue:[ - self error:'invalid method'. + self error:'invalid method'. ]. dict := self methodDictionary. oldMethod := dict at:aSelector ifAbsent:nil. (Smalltalk - changeRequest:#methodInClass - with:(Array with:self with:aSelector with:oldMethod)) ifFalse:[ - ^ false + changeRequest:#methodInClass + with:(Array with:self with:aSelector with:oldMethod)) ifFalse:[ + ^ false ]. self setMethodDictionary:(dict at:aSelector putOrAppend:newMethod). newMethod mclass:self. - ObjectMemory flushCachesForSelector:aSelector numArgs:newMethod numArgs. + ObjectMemory flushCachesForSelector:aSelector numArgs:newMethod argumentCount. ^ true "Modified: / 07-06-1996 / 14:48:45 / stefan" @@ -5334,9 +5335,10 @@ !Behavior class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.380 2015-05-31 09:24:57 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.381 2015-06-05 16:09:05 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.380 2015-05-31 09:24:57 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.381 2015-06-05 16:09:05 stefan Exp $' ! ! +
--- a/Block.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Block.st Sat Jun 06 06:39:31 2015 +0200 @@ -537,24 +537,24 @@ |numArgs| - numArgs := handlerBlock isBlock ifTrue:[handlerBlock numArgs] ifFalse:[0]. + numArgs := handlerBlock isBlock ifTrue:[handlerBlock argumentCount] ifFalse:[0]. numArgs == 1 ifTrue:[ - ^ self on:Error do:handlerBlock + ^ self on:Error do:handlerBlock ]. ^ self - on:Error - do:[:ex | - |errString errReceiver| - - numArgs == 0 ifTrue:[ - ex return:handlerBlock value - ] ifFalse:[ - errString := ex description. - errReceiver := ex suspendedContext receiver. - ex return:(handlerBlock value:errString value:errReceiver) - ]. - ] + on:Error + do:[:ex | + |errString errReceiver| + + numArgs == 0 ifTrue:[ + ex return:handlerBlock value + ] ifFalse:[ + errString := ex description. + errReceiver := ex suspendedContext receiver. + ex return:(handlerBlock value:errString value:errReceiver) + ]. + ] " |a| @@ -742,7 +742,7 @@ !Block methodsFor:'compatibility-Cola & Pepsi'! arity - ^ self numArgs + ^ self argumentCount ! ! !Block methodsFor:'conversion'! @@ -2556,10 +2556,10 @@ "repeat the receiver n times - similar to timesRepeat, but optionally passes the loop counter as argument" - self numArgs == 0 ifTrue:[ - n timesRepeat:self + self argumentCount == 0 ifTrue:[ + n timesRepeat:self ] ifFalse:[ - 1 to:n do:self + 1 to:n do:self ]. " @@ -3247,11 +3247,11 @@ !Block class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.212 2015-05-05 12:41:29 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.213 2015-06-05 16:08:43 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.212 2015-05-05 12:41:29 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.213 2015-06-05 16:08:43 stefan Exp $' ! !
--- a/BlockContext.st Wed Jun 03 06:50:11 2015 +0200 +++ b/BlockContext.st Sat Jun 06 06:39:31 2015 +0200 @@ -1,3 +1,5 @@ +"{ Encoding: utf8 }" + " COPYRIGHT (c) 1993 by Claus Gittinger All Rights Reserved @@ -11,6 +13,8 @@ " "{ Package: 'stx:libbasic' }" +"{ NameSpace: Smalltalk }" + Context variableSubclass:#BlockContext instanceVariableNames:'' classVariableNames:'' @@ -145,7 +149,7 @@ |nargs| - nargs := self numArgs. + nargs := self argumentCount. (nargs == 0) ifTrue:[^ #value]. (nargs == 1) ifTrue:[^ #value:]. (nargs == 2) ifTrue:[^ #value:value:]. @@ -261,10 +265,10 @@ !BlockContext class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.39 2013-07-04 06:29:43 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.40 2015-06-05 16:08:35 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.39 2013-07-04 06:29:43 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.40 2015-06-05 16:08:35 stefan Exp $' ! !
--- a/CompiledCode.st Wed Jun 03 06:50:11 2015 +0200 +++ b/CompiledCode.st Sat Jun 06 06:39:31 2015 +0200 @@ -540,11 +540,12 @@ ! numberOfMethodArgs + <resource: #obsolete> "return the number of arguments, the method expects. - This method is left for backward compatibility - use #numArgs." + This method is left for backward compatibility - use #argumentCount." - "/ self obsoleteMethodWarning:'use numArgs'. - ^ self numArgs + "/ self obsoleteMethodWarning:'use argumentCount'. + ^ self argumentCount "Modified: / 30.1.1999 / 14:55:27 / cg" "Created: / 30.1.1999 / 14:55:47 / cg" @@ -991,11 +992,11 @@ With a normal send, this error cannot happen." ^ WrongNumberOfArgumentsError - raiseRequestWith:self - errorString:(' - %1 got %2 arg(s) where %3 expected' - bindWith:self printString "/ self class name - with:numArgsGiven - with:self numArgs) + raiseRequestWith:self + errorString:(' - %1 got %2 arg(s) where %3 expected' + bindWith:self printString "/ self class name + with:numArgsGiven + with:self argumentCount) " 2 perform:#+ @@ -1105,24 +1106,24 @@ %{ #ifdef __SCHTEAM__ { - int numArgs = 0; - STVector v = null; + int numArgs = 0; + STVector v = null; - if (argArray != STObject.Nil) { - v = argArray.asSTVector(); - numArgs = v.vectorLength(); - } + if (argArray != STObject.Nil) { + v = argArray.asSTVector(); + numArgs = v.vectorLength(); + } - STCallable me = (STCompiledMethod)self.smalltalkCheckNumberOfArgs(1+numArgs); + STCallable me = (STCompiledMethod)self.smalltalkCheckNumberOfArgs(1+numArgs); - __c__.push(anObject); - for (int i=0; i<numArgs; i++) { - __c__.push( v.vectorRef(i) ); - } - // the selector and searchClass args are not needed/passed - // the virtualSender is (currently) not supported - // (this is cosmetics only; therefore it's done later) - return __c__.TAILCALL_nPUSHED( me, 1+numArgs); + __c__.push(anObject); + for (int i=0; i<numArgs; i++) { + __c__.push( v.vectorRef(i) ); + } + // the selector and searchClass args are not needed/passed + // the virtualSender is (currently) not supported + // (this is cosmetics only; therefore it's done later) + return __c__.TAILCALL_nPUSHED( me, 1+numArgs); } /* NOT REACHED */ #else @@ -1136,286 +1137,286 @@ * args must be an array, or nil */ if (__isArrayLike(argArray)) { - nargs = __arraySize(argArray); - ap = __ArrayInstPtr(argArray)->a_element; + nargs = __arraySize(argArray); + ap = __ArrayInstPtr(argArray)->a_element; } else { - if (argArray != nil) { - goto badArgs; - } - nargs = 0; - ap = (OBJ *)0; + if (argArray != nil) { + goto badArgs; + } + nargs = 0; + ap = (OBJ *)0; } # ifdef F_NARGS if (((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT) == nargs) # endif { - code = __MethodInstPtr(self)->m_code; - if (aClass == nil) { - searchClass = dummy.ilc_class = __Class(anObject); - } else { - searchClass = dummy.ilc_class = aClass; - } + code = __MethodInstPtr(self)->m_code; + if (aClass == nil) { + searchClass = dummy.ilc_class = __Class(anObject); + } else { + searchClass = dummy.ilc_class = aClass; + } - if (nargs <= 15) { - OBJ rslt; + if (nargs <= 15) { + OBJ rslt; # ifdef CONTEXT_DEBUG - OBJ sav = __thisContext; + OBJ sav = __thisContext; # endif - /* - * add virtual sender (unwinding) here later, - * to allow hiding contexts in lazy methods. - * (this is cosmetics only; therefore its done later) - */ - if (code) { - /* compiled code */ - switch (nargs) { - case 0: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy); - break; + /* + * add virtual sender (unwinding) here later, + * to allow hiding contexts in lazy methods. + * (this is cosmetics only; therefore its done later) + */ + if (code) { + /* compiled code */ + switch (nargs) { + case 0: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy); + break; - case 1: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0]); - break; + case 1: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0]); + break; - case 2: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1]); - break; + case 2: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1]); + break; - case 3: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1], ap[2]); - break; + case 3: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1], ap[2]); + break; - case 4: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3]); - break; + case 4: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3]); + break; - case 5: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4]); - break; + case 5: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4]); + break; - case 6: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]); - break; + case 6: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]); + break; - case 7: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]); - break; + case 7: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]); + break; - case 8: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]); - break; + case 8: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]); + break; - case 9: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]); - break; + case 9: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]); + break; - case 10: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], - ap[9]); - break; + case 10: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], + ap[9]); + break; - case 11: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], - ap[9], ap[10]); - break; + case 11: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], + ap[9], ap[10]); + break; - case 12: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], - ap[9], ap[10], ap[11]); - break; + case 12: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], + ap[9], ap[10], ap[11]); + break; - case 13: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], - ap[9], ap[10], ap[11], ap[12]); - break; + case 13: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], + ap[9], ap[10], ap[11], ap[12]); + break; - case 14: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], - ap[9], ap[10], ap[11], ap[12], ap[13]); - break; + case 14: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], + ap[9], ap[10], ap[11], ap[12], ap[13]); + break; - case 15: - rslt = (*code)(anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], - ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]); - break; - } - } else { - /* interpreted code */ + case 15: + rslt = (*code)(anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], + ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]); + break; + } + } else { + /* interpreted code */ # ifdef PASS_ARG_POINTER - rslt = __interpret(self, nargs, anObject, aSymbol, searchClass, &dummy, ap); + rslt = __interpret(self, nargs, anObject, aSymbol, searchClass, &dummy, ap); # else - switch (nargs) { - case 0: - rslt = __interpret(self, 0, anObject, aSymbol, searchClass, &dummy); - break; + switch (nargs) { + case 0: + rslt = __interpret(self, 0, anObject, aSymbol, searchClass, &dummy); + break; - case 1: - rslt = __interpret(self, 1, anObject, aSymbol, searchClass, &dummy, - ap[0]); - break; + case 1: + rslt = __interpret(self, 1, anObject, aSymbol, searchClass, &dummy, + ap[0]); + break; - case 2: - rslt = __interpret(self, 2, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1]); - break; + case 2: + rslt = __interpret(self, 2, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1]); + break; - case 3: - rslt = __interpret(self, 3, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2]); - break; + case 3: + rslt = __interpret(self, 3, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2]); + break; - case 4: - rslt = __interpret(self, 4, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3]); - break; + case 4: + rslt = __interpret(self, 4, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3]); + break; - case 5: - rslt = __interpret(self, 5, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4]); - break; + case 5: + rslt = __interpret(self, 5, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4]); + break; - case 6: - rslt = __interpret(self, 6, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]); - break; + case 6: + rslt = __interpret(self, 6, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]); + break; - case 7: - rslt = __interpret(self, 7, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]); - break; + case 7: + rslt = __interpret(self, 7, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]); + break; - case 8: - rslt = __interpret(self, 8, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7]); - break; + case 8: + rslt = __interpret(self, 8, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7]); + break; - case 9: - rslt = __interpret(self, 9, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8]); - break; + case 9: + rslt = __interpret(self, 9, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8]); + break; - case 10: - rslt = __interpret(self, 10, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8], ap[9]); - break; + case 10: + rslt = __interpret(self, 10, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8], ap[9]); + break; - case 11: - rslt = __interpret(self, 11, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8], ap[9], ap[10]); - break; + case 11: + rslt = __interpret(self, 11, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8], ap[9], ap[10]); + break; - case 12: - rslt = __interpret(self, 12, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8], ap[9], ap[10], ap[11]); - break; + case 12: + rslt = __interpret(self, 12, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8], ap[9], ap[10], ap[11]); + break; - case 13: - rslt = __interpret(self, 13, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8], ap[9], ap[10], ap[11], ap[12]); - break; + case 13: + rslt = __interpret(self, 13, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8], ap[9], ap[10], ap[11], ap[12]); + break; - case 14: - rslt = __interpret(self, 14, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13]); - break; + case 14: + rslt = __interpret(self, 14, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13]); + break; - case 15: - rslt = __interpret(self, 15, anObject, aSymbol, searchClass, &dummy, - ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], - ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]); - break; - } + case 15: + rslt = __interpret(self, 15, anObject, aSymbol, searchClass, &dummy, + ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], + ap[7], ap[8], ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]); + break; + } # endif - } + } # ifdef CONTEXT_DEBUG - if (sav != __thisContext) { - if (code) { - printf("CONTEXT BOTCH after execution of %x\n", code); - } else { - printf("CONTEXT BOTCH after execution of interpreted method\n"); - printf("code now: %x\n", __MethodInstPtr(self)->m_code); - } - printf("context before:\n"); - __dumpObject__(sav, __LINE__); - printf("context now:\n"); - __dumpObject__(__thisContext, __LINE__); - } + if (sav != __thisContext) { + if (code) { + printf("CONTEXT BOTCH after execution of %x\n", code); + } else { + printf("CONTEXT BOTCH after execution of interpreted method\n"); + printf("code now: %x\n", __MethodInstPtr(self)->m_code); + } + printf("context before:\n"); + __dumpObject__(sav, __LINE__); + printf("context now:\n"); + __dumpObject__(__thisContext, __LINE__); + } # endif - RETURN (rslt); - } + RETURN (rslt); + } } badArgs: ; #endif /* not SCHTEAM */ %}. (argArray isArray) ifFalse:[ - (self numArgs ~~ 0 - or:[argArray notNil]) ifTrue:[ - " - arguments must be either nil or an array - " - ^ self badArgumentArray:argArray - ] + (self argumentCount ~~ 0 + or:[argArray notNil]) ifTrue:[ + " + arguments must be either nil or an array + " + ^ self badArgumentArray:argArray + ] ]. (argArray size ~~ self numArgs) ifTrue:[ - " - the method expects a different number of arguments - " - ^ self wrongNumberOfArguments:argArray size + " + the method expects a different number of arguments + " + ^ self wrongNumberOfArguments:argArray size ]. "/ if the VM only supports a limited number of arguments in sends (ST/X: 15) argArray size > self class maxNumberOfArguments ifTrue:[ - ^ self tooManyArguments + ^ self tooManyArguments ]. ^ self primitiveFailed " (Float compiledMethodAt:#+) - valueWithReceiver:1.0 arguments:#(2.0) + valueWithReceiver:1.0 arguments:#(2.0) 'the next example is a wrong one - which is detected by True's method ...'. (True compiledMethodAt:#printString) - valueWithReceiver:false arguments:nil + valueWithReceiver:false arguments:nil 'the next example is a wrong one - it is nowhere detected and a wrong value returned ...'. (Point compiledMethodAt:#x) - valueWithReceiver:(1->2) arguments:nil + valueWithReceiver:(1->2) arguments:nil 'the next example is VERY bad one - it is nowhere detected and may crash the system WARNING: save your work before doing this ...'. (Point compiledMethodAt:#x) - valueWithReceiver:(Object new) arguments:nil + valueWithReceiver:(Object new) arguments:nil 'the next example is a wrong one - which is detected here ...'. (Object compiledMethodAt:#printOn:) - valueWithReceiver:false arguments:nil + valueWithReceiver:false arguments:nil 'the next example is a wrong one - which is detected here ...'. (Object compiledMethodAt:#printOn:) - valueWithReceiver:false arguments:#() + valueWithReceiver:false arguments:#() " "Modified: / 07-10-2011 / 13:58:21 / cg" @@ -1994,13 +1995,14 @@ !CompiledCode class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.129 2015-05-31 09:24:36 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.130 2015-06-05 16:09:24 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.129 2015-05-31 09:24:36 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.130 2015-06-05 16:09:24 stefan Exp $' ! version_SVN ^ '$ Id: CompiledCode.st 10643 2011-06-08 21:53:07Z vranyj1 $' ! ! +
--- a/Context.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Context.st Sat Jun 06 06:39:31 2015 +0200 @@ -298,8 +298,8 @@ argAt:n "return the n'th argument" - n > self numArgs ifTrue:[ - ^ self error:'invalid arg access' + n > self argumentCount ifTrue:[ + ^ self subscriptBoundsError:n. ]. ^ self at:n @@ -309,8 +309,8 @@ argAt:n put:value "set the n'th argument - useful when the receiver should be restarted" - n > self numArgs ifTrue:[ - ^ self error:'invalid arg access' + n > self argumentCount ifTrue:[ + ^ self subscriptBoundsError:n. ]. self at:n put:value. ^ value @@ -323,10 +323,10 @@ |n| - n := self numArgs. + n := self argumentCount. n == 0 ifTrue:[ - "/ little optimization here - avaoid creating empty containers - ^ #() + "/ little optimization here - avaoid creating empty containers + ^ #() ]. ^ (Array new:n) replaceFrom:1 to:n with:self. ! @@ -336,10 +336,10 @@ |n| - n := self numArgs + self numVars. + n := self argumentCount + self numVars. n == 0 ifTrue:[ - "/ little optimization here - avoid creating empty containers - ^ #() + "/ little optimization here - avoid creating empty containers + ^ #() ]. ^ (Array new:n) replaceFrom:1 to:n with:self. @@ -691,7 +691,7 @@ "return the number of temporary variables of the Block/Method. (for debugging only)" - ^ self size - self numArgs - self numVars + ^ self size - self argumentCount - self numVars "Created: 23.10.1996 / 16:19:10 / cg" "Modified: 23.10.1996 / 16:19:48 / cg" @@ -876,11 +876,11 @@ |nonTemps mySize| - nonTemps := self numArgs + self numVars. + nonTemps := self argumentCount + self numVars. mySize := self numTemps. mySize == 0 ifTrue:[ - "/ little optimization here - avaoid creating empty containers - ^ #() + "/ little optimization here - avaoid creating empty containers + ^ #() ]. ^ (Array new:mySize) replaceFrom:1 to:mySize with:self startingAt:nonTemps+1 @@ -890,14 +890,14 @@ varAt:n "return the n'th local variable" - ^ self at:(n + self numArgs) + ^ self at:(n + self argumentCount) ! varAt:n put:value "set the n'th local variable - useful when the receiver should be restarted or continued" - self at:(n + self numArgs) put:value + self at:(n + self argumentCount) put:value ! vars @@ -905,11 +905,11 @@ |nonVars mySize| - nonVars := self numArgs. + nonVars := self argumentCount. mySize := self numVars. mySize == 0 ifTrue:[ - "/ little optimization here - avaoid creating empty containers - ^ #() + "/ little optimization here - avaoid creating empty containers + ^ #() ]. ^ (Array new:mySize) replaceFrom:1 to:mySize with:self startingAt:nonVars+1 @@ -1034,8 +1034,8 @@ - used only for MiniDebuggers walkback print" self receiverPrintString errorPrint. ' ' errorPrint. selector errorPrint. - self numArgs ~~ 0 ifTrue: [ - ' ' errorPrint. self argsDisplayString errorPrint + self argumentCount ~~ 0 ifTrue: [ + ' ' errorPrint. self argsDisplayString errorPrint ]. ' [' errorPrint. self lineNumber errorPrint. ']' errorPrintCR @@ -1732,17 +1732,17 @@ | n "{ Class: SmallInteger }" s | - n := self numArgs. + n := self argumentCount. 1 to:n do:[:index | - Error handle:[:ex | - s := '*Error in argString*'. - ] do:[ - s := self argStringFor:(self at:index). - s := s contractTo:100. - ]. - - aStream nextPutAll:s asString string. - index ~~ n ifTrue:[ aStream space ]. + Error handle:[:ex | + s := '*Error in argString*'. + ] do:[ + s := self argStringFor:(self at:index). + s := s contractTo:100. + ]. + + aStream nextPutAll:s asString string. + index ~~ n ifTrue:[ aStream space ]. ]. "Modified: / 07-03-2012 / 13:09:17 / cg" @@ -2533,111 +2533,111 @@ |homeContext homeMethod block numArgs numVars m src sel isDoIt blocksLineNr extractFromBlock sender| - numArgs := self numArgs. + numArgs := self argumentCount. numVars := self numVars. (numArgs == 0 and:[numVars == 0]) ifTrue:[^ #()]. homeContext := self methodHome. homeContext notNil ifTrue:[ - sel := homeContext selector. - homeMethod := homeContext method. + sel := homeContext selector. + homeMethod := homeContext method. ]. extractFromBlock := - [ - |blockNode argNames varNames vars args blocksHome| - - blockNode := Compiler - blockAtLine:blocksLineNr - in:m - orSource:src - numArgs:numArgs - numVars:numVars. - - blockNode notNil ifTrue:[ - "/ a kludge - blockNode lineNumber == blocksLineNr ifTrue:[ - blocksHome := blockNode home. - (blocksHome notNil and:[blocksHome isBlock]) ifTrue:[ - (blocksHome numArgs == numArgs - and:[ blocksHome numVars == numVars ]) ifTrue:[ - blockNode := blocksHome - ]. - ]. - ]. - - argNames := #(). - varNames := #(). - - numArgs > 0 ifTrue:[ - vars := blockNode arguments. - vars notEmptyOrNil ifTrue:[ - argNames := vars collect:[:var | var name] - ] - ]. - numVars > 0 ifTrue:[ - vars := blockNode variablesIncludingInlined: (homeMethod code notNil and:[homeMethod byteCode isNil]). - vars notEmptyOrNil ifTrue:[ - varNames := vars collect:[:var | var name]. - ] - ]. - ^ argNames , varNames - ]. - ]. + [ + |blockNode argNames varNames vars args blocksHome| + + blockNode := Compiler + blockAtLine:blocksLineNr + in:m + orSource:src + numArgs:numArgs + numVars:numVars. + + blockNode notNil ifTrue:[ + "/ a kludge + blockNode lineNumber == blocksLineNr ifTrue:[ + blocksHome := blockNode home. + (blocksHome notNil and:[blocksHome isBlock]) ifTrue:[ + (blocksHome numArgs == numArgs + and:[ blocksHome numVars == numVars ]) ifTrue:[ + blockNode := blocksHome + ]. + ]. + ]. + + argNames := #(). + varNames := #(). + + numArgs > 0 ifTrue:[ + vars := blockNode arguments. + vars notEmptyOrNil ifTrue:[ + argNames := vars collect:[:var | var name] + ] + ]. + numVars > 0 ifTrue:[ + vars := blockNode variablesIncludingInlined: (homeMethod code notNil and:[homeMethod byteCode isNil]). + vars notEmptyOrNil ifTrue:[ + varNames := vars collect:[:var | var name]. + ] + ]. + ^ argNames , varNames + ]. + ]. "/ #doIt needs special handling below isDoIt := (sel == #'doIt') or:[sel == #'doIt:']. self isBlockContext ifFalse:[ - isDoIt ifTrue:[ - homeMethod notNil ifTrue:[ - "/ special for #doIt - m := nil. - src := ('[' , homeMethod source , '\]') withCRs. - "/ blocksLineNr := self lineNumber. - blocksLineNr := (self home ? self) lineNumber. - extractFromBlock value. - ] - ]. - - homeMethod notNil ifTrue:[ - ^ homeMethod methodArgAndVarNamesInContext: self. - ]. - ^ #() + isDoIt ifTrue:[ + homeMethod notNil ifTrue:[ + "/ special for #doIt + m := nil. + src := ('[' , homeMethod source , '\]') withCRs. + "/ blocksLineNr := self lineNumber. + blocksLineNr := (self home ? self) lineNumber. + extractFromBlock value. + ] + ]. + + homeMethod notNil ifTrue:[ + ^ homeMethod methodArgAndVarNamesInContext: self. + ]. + ^ #() ]. homeMethod notNil ifTrue:[ - isDoIt ifTrue:[ - "/ special for #doIt - "/ my source is found in the method. - m := nil. - src := ('[' , homeMethod source , '\]') withCRs. - ] ifFalse:[ - m := homeMethod. - src := nil. - ]. - blocksLineNr := self lineNumber. - extractFromBlock value. - blocksLineNr := self home lineNumber. - extractFromBlock value. + isDoIt ifTrue:[ + "/ special for #doIt + "/ my source is found in the method. + m := nil. + src := ('[' , homeMethod source , '\]') withCRs. + ] ifFalse:[ + m := homeMethod. + src := nil. + ]. + blocksLineNr := self lineNumber. + extractFromBlock value. + blocksLineNr := self home lineNumber. + extractFromBlock value. ]. blocksLineNr isNil ifTrue:[ - self isBlockContext ifTrue:[ - sender := self sender. - (sender notNil - and:[sender receiver isBlock - and:[sender selector startsWith:'value']]) - ifTrue:[ - block := sender receiver. - src := block source. - src isNil ifTrue:[ - self error:'no source'. - ]. - blocksLineNr := 1. - extractFromBlock value. - ]. - sender := nil. - ]. + self isBlockContext ifTrue:[ + sender := self sender. + (sender notNil + and:[sender receiver isBlock + and:[sender selector startsWith:'value']]) + ifTrue:[ + block := sender receiver. + src := block source. + src isNil ifTrue:[ + self error:'no source'. + ]. + blocksLineNr := 1. + extractFromBlock value. + ]. + sender := nil. + ]. ]. ^ #() @@ -2847,29 +2847,29 @@ c := self findNextContextWithSelector:selector or:nil or:nil. [c notNil] whileTrue:[ - (c receiver == receiver) ifTrue:[ - c method == self method ifTrue:[ - sameArgs := true. - 1 to:self numArgs do:[:i | - (c argAt:1) ~~ (self argAt:i)ifTrue:[ - sameArgs := false - ] - ]. - sameArgs ifTrue:[^ true]. - ] - ]. - c := c findNextContextWithSelector:selector or:nil or:nil. - - " - this special test was added to get out after a while - if the sender chain is corrupt - this gives us at least - a chance to find those errors. - " - count := count + 1. - count >= 100000 ifTrue:[ - 'Context [warning]: bad context chain' errorPrintCR. - ^ true - ] + (c receiver == receiver) ifTrue:[ + c method == self method ifTrue:[ + sameArgs := true. + 1 to:self argumentCount do:[:i | + (c argAt:1) ~~ (self argAt:i)ifTrue:[ + sameArgs := false + ] + ]. + sameArgs ifTrue:[^ true]. + ] + ]. + c := c findNextContextWithSelector:selector or:nil or:nil. + + " + this special test was added to get out after a while + if the sender chain is corrupt - this gives us at least + a chance to find those errors. + " + count := count + 1. + count >= 100000 ifTrue:[ + 'Context [warning]: bad context chain' errorPrintCR. + ^ true + ] ]. ^ false ! @@ -2922,11 +2922,11 @@ !Context class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.224 2015-05-27 19:09:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.225 2015-06-05 16:09:48 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.224 2015-05-27 19:09:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.225 2015-06-05 16:09:48 stefan Exp $' ! version_HG
--- a/Method.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Method.st Sat Jun 06 06:39:31 2015 +0200 @@ -1,3 +1,5 @@ +"{ Encoding: utf8 }" + " COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved @@ -1333,7 +1335,7 @@ doFlush ifTrue:[ (aSymbol == #public and:[old ~~ #ignored]) ifFalse:[ (sel := self selector) notNil ifTrue:[ - ObjectMemory flushCachesForSelector:sel numArgs:self numArgs + ObjectMemory flushCachesForSelector:sel numArgs:self argumentCount ] ifFalse:[ ObjectMemory flushCaches. ]. @@ -2186,7 +2188,7 @@ mgr := mclass sourceCodeManagerFromBinaryRevision ] ifFalse:[ "I'm an extension and we don't have binary revision info (!!) - for extensions, try tp guess here" + for extensions, try to guess here" pkgDef := ProjectDefinition definitionClassForPackage: package. pkgDef notNil ifTrue:[ mgr := pkgDef sourceCodeManagerFromBinaryRevision @@ -2213,7 +2215,7 @@ who notNil ifTrue:[ myClass := who methodClass. - (package notNil and:[package ~= myClass package]) ifTrue:[ + (package notNil and:[package ~= myClass package and:[package ~= #'__NoProject__']]) ifTrue:[ "/ I am an extension mgr notNil ifTrue:[ "/ try to get the source using my package information ... @@ -2663,7 +2665,7 @@ myCode := self code. - m := self trapMethodForNumArgs:(self numArgs). + m := self trapMethodForNumArgs:(self argumentCount). (m notNil and:[self ~~ m]) ifTrue:[ (myCode notNil and:[myCode = m code]) ifTrue:[^ true]. (byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true]. @@ -3064,7 +3066,7 @@ sourceString := self source. (parserClass notNil and:[sourceString notNil]) ifTrue:[ - parseSelector numArgs == 2 ifTrue:[ + parseSelector argumentCount == 2 ifTrue:[ parser := parserClass perform:parseSelector with:sourceString with:arg2. ] ifFalse:[ parser := parserClass perform:parseSelector with:sourceString. @@ -3682,7 +3684,7 @@ |invldMethod| - invldMethod := self trapMethodForNumArgs:(self numArgs). + invldMethod := self trapMethodForNumArgs:(self argumentCount). self code:invldMethod code. self byteCode:nil. @@ -3909,11 +3911,11 @@ !Method class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.462 2015-05-28 16:32:00 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.464 2015-06-05 16:10:36 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.462 2015-05-28 16:32:00 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.464 2015-06-05 16:10:36 stefan Exp $' ! version_SVN
--- a/Object.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Object.st Sat Jun 06 06:39:31 2015 +0200 @@ -256,6 +256,7 @@ "Modified: / 4.8.1999 / 08:54:06 / stefan" ! ! + !Object class methodsFor:'Compatibility-ST80'! rootError @@ -494,6 +495,7 @@ InfoPrinting := aBoolean ! ! + !Object class methodsFor:'queries'! isAbstract @@ -693,6 +695,7 @@ " ! ! + !Object methodsFor:'accessing'! _at:index @@ -2057,6 +2060,7 @@ ^ aBlock ensure:[ self addDependent:someone ] ! ! + !Object methodsFor:'comparing'! = anObject @@ -6561,8 +6565,8 @@ "send aSelector-message to the receiver. If the message expects an argument, pass arg." - aSelector numArgs == 1 ifTrue:[ - ^ self perform:aSelector with:arg + aSelector argumentCount == 1 ifTrue:[ + ^ self perform:aSelector with:arg ]. ^ self perform:aSelector @@ -6585,12 +6589,12 @@ |numArgs| - numArgs := aSelector numArgs. + numArgs := aSelector argumentCount. numArgs == 0 ifTrue:[ - ^ self perform:aSelector + ^ self perform:aSelector ]. numArgs == 1 ifTrue:[ - ^ self perform:aSelector with:optionalArg1 + ^ self perform:aSelector with:optionalArg1 ]. ^ self perform:aSelector with:optionalArg1 with:optionalArg2. @@ -6613,15 +6617,15 @@ |numArgs| - numArgs := aSelector numArgs. + numArgs := aSelector argumentCount. numArgs == 0 ifTrue:[ - ^ self perform:aSelector + ^ self perform:aSelector ]. numArgs == 1 ifTrue:[ - ^ self perform:aSelector with:optionalArg1 + ^ self perform:aSelector with:optionalArg1 ]. numArgs == 2 ifTrue:[ - ^ self perform:aSelector with:optionalArg1 with:optionalArg2 + ^ self perform:aSelector with:optionalArg1 with:optionalArg2 ]. ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3. @@ -6644,18 +6648,18 @@ |numArgs| - numArgs := aSelector numArgs. + numArgs := aSelector argumentCount. numArgs == 0 ifTrue:[ - ^ self perform:aSelector + ^ self perform:aSelector ]. numArgs == 1 ifTrue:[ - ^ self perform:aSelector with:optionalArg1 + ^ self perform:aSelector with:optionalArg1 ]. numArgs == 2 ifTrue:[ - ^ self perform:aSelector with:optionalArg1 with:optionalArg2 + ^ self perform:aSelector with:optionalArg1 with:optionalArg2 ]. numArgs == 3 ifTrue:[ - ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 + ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 ]. ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 with:optionalArg4. @@ -7944,6 +7948,7 @@ ^ self ! ! + !Object methodsFor:'secure message sending'! ?:selector @@ -8549,6 +8554,7 @@ " ! ! + !Object methodsFor:'synchronized evaluation'! freeSynchronizationSemaphore @@ -9038,11 +9044,11 @@ "return the value of the first arg, if I am nil, the result from evaluating the 2nd argument, if I am not nil. Notice: - This method is open coded (inlined) by the compiler(s) - - redefining it may not work as expected." - - (notNilBlockOrValue isBlock and:[notNilBlockOrValue numArgs == 1]) ifTrue:[ - ^ notNilBlockOrValue value:self. + This method is open coded (inlined) by the compiler(s) + - redefining it may not work as expected." + + (notNilBlockOrValue isBlock and:[notNilBlockOrValue argumentCount == 1]) ifTrue:[ + ^ notNilBlockOrValue value:self. ]. ^ notNilBlockOrValue value ! @@ -9051,11 +9057,11 @@ "return myself if nil, or the result from evaluating the argument, if I am not nil. Notice: - This method is open coded (inlined) by the compiler(s) - - redefining it may not work as expected." - - (aBlockOrValue isBlock and:[aBlockOrValue numArgs == 1]) ifTrue:[ - ^ aBlockOrValue value:self. + This method is open coded (inlined) by the compiler(s) + - redefining it may not work as expected." + + (aBlockOrValue isBlock and:[aBlockOrValue argumentCount == 1]) ifTrue:[ + ^ aBlockOrValue value:self. ]. ^ aBlockOrValue value ! @@ -9064,11 +9070,11 @@ "return the value of the 2nd arg, if I am nil, the result from evaluating the 1st argument, if I am not nil. Notice: - This method is open coded (inlined) by the compiler(s) - - redefining it may not work as expected." - - (notNilBlockOrValue isBlock and:[notNilBlockOrValue numArgs == 1]) ifTrue:[ - ^ notNilBlockOrValue value:self. + This method is open coded (inlined) by the compiler(s) + - redefining it may not work as expected." + + (notNilBlockOrValue isBlock and:[notNilBlockOrValue argumentCount == 1]) ifTrue:[ + ^ notNilBlockOrValue value:self. ]. ^ notNilBlockOrValue value ! @@ -10290,14 +10296,16 @@ ^ aVisitor visitObject:self with:aParameter ! ! + + !Object class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.808 2015-05-31 09:23:08 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.809 2015-06-05 16:11:10 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.808 2015-05-31 09:23:08 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.809 2015-06-05 16:11:10 stefan Exp $' ! version_HG
--- a/ProtoObject.st Wed Jun 03 06:50:11 2015 +0200 +++ b/ProtoObject.st Sat Jun 06 06:39:31 2015 +0200 @@ -146,7 +146,7 @@ ! ifNotNil:aBlockOrValue - (aBlockOrValue isBlock and:[aBlockOrValue numArgs == 1]) ifTrue:[ + (aBlockOrValue isBlock and:[aBlockOrValue argumentCount == 1]) ifTrue:[ ^ aBlockOrValue value:self. ]. ^ aBlockOrValue value @@ -190,10 +190,10 @@ !ProtoObject class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProtoObject.st,v 1.15 2015-05-16 09:50:57 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProtoObject.st,v 1.16 2015-06-05 16:10:58 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ProtoObject.st,v 1.15 2015-05-16 09:50:57 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProtoObject.st,v 1.16 2015-06-05 16:10:58 stefan Exp $' ! !
--- a/Timestamp.st Wed Jun 03 06:50:11 2015 +0200 +++ b/Timestamp.st Sat Jun 06 06:39:31 2015 +0200 @@ -771,32 +771,31 @@ On error, exceptionalValue is returned. If exceptionalValue is a one-arg block, an error message is passed as argument. Format: - %h hours, 00..23 (i.e. european) 0-padded to length 2 - %u hours, 00..12 (i.e. us) 0-padded to length 2 - %m minutes, 00..59 0-padded to length 2 - %s seconds, 00..59 0-padded to length 2 - %i milliseconds, 000..999 0-padded to length 3 - %a am/pm - - %d - day - %D - day - %(day) - day - - %m - month - %M - month - %(month) - month - - %(monthName) - monthName - - %(year) - year, full 4 digits - %Y - year, last 2 digits only, - 0..71 map to 2000..2071; - 72..99 map to 1972..1999; - %Y1900 - year, last 2 digits only, map to 1900..1999 - %Y2000 - year, last 2 digits only, map to 2000..2099 + %h hours, 00..23 (i.e. european) 0-padded to length 2 + %u hours, 00..12 (i.e. us) 0-padded to length 2 + %m minutes, 00..59 0-padded to length 2 + %s seconds, 00..59 0-padded to length 2 + %i milliseconds, 000..999 0-padded to length 3 + %a am/pm + + %d - day + %D - day + %(day) - day + + %(month) - month + + %(monthName) - monthName + + %(year) - year, full 4 digits + %Y - year, last 2 digits only, + 0..71 map to 2000..2071; + 72..99 map to 1972..1999; + %Y1900 - year, last 2 digits only, map to 1900..1999 + %Y2000 - year, last 2 digits only, map to 2000..2099 an optional length after the % gives a field length; - i.e. %2h%2m%2s parses 123557 as 12:35:37 + i.e. %2h%2m%2s parses '123557' as 12:35:37 + and '%4(year)%2(month)%2(day)' parses '20060620' as 2006-06-20 00:00:00 Please consider using a standard format, such as iso8601. " @@ -807,83 +806,83 @@ len now s| error := [:msg | - exceptionalValue isBlock ifTrue:[ - ^ exceptionalValue valueWithOptionalArgument:'format error; space expcected' - ] ifFalse:[ - ^ exceptionalValue value - ]. - ]. + exceptionalValue isBlock ifTrue:[ + ^ exceptionalValue valueWithOptionalArgument:'format error; space expcected' + ] ifFalse:[ + ^ exceptionalValue value + ]. + ]. itemHandler := [:format | - |input| - input := len isNil ifTrue:[ inStream ] ifFalse:[ inStream next: len ]. - - ( #('d' 'D' 'day' ) includes:format ) ifTrue:[ - day := Integer readFrom:input onError:[ error value:'invalid day' ]. - - ] ifFalse:[ ( format = 'month' ) ifTrue:[ - month := Integer readFrom:input onError:[ error value:'invalid month' ]. - - ] ifFalse:[ ( format = 'year' or:[ format = 'y' ]) ifTrue:[ - year := Integer readFrom:input onError:[ error value:'invalid year' ]. - - ] ifFalse:[ ( format = 'Y' ) ifTrue:[ - year := Integer readFrom:input onError:[ error value:'invalid year' ]. - (year between:0 and: 99) ifFalse:[ error value:'invalid year' ]. - (year between:0 and:71) ifTrue:[ - year := year + 1900 - ] ifFalse:[ - year := year + 2000 - ] - - ] ifFalse:[ (format = 'monthName') ifTrue:[ - s := input nextMatching:[:c | c isLetter] thenMatching:[:c | c isLetter]. - month := Date indexOfMonth:s asLowercase language:languageOrNil - - ] ifFalse:[ ( format = 'Y1900' ) ifTrue:[ - year := Integer readFrom:input onError:[ error value:'invalid year' ]. - (year between:0 and: 99) ifFalse:[ error value:'invalid year' ]. - year := year + 1900 - - ] ifFalse:[ ( format = 'Y2000' ) ifTrue:[ - year := Integer readFrom:input onError:[ error value:'invalid year' ]. - (year between:0 and: 99) ifFalse:[ error value:'invalid year' ]. - year := year + 2000 - - ] ifFalse:[ ( format = 'h' or:[ format = 'H' ]) ifTrue:[ - hour := Integer readFrom:input onError:[ error value:'invalid hour' ]. - - ] ifFalse:[ ( format = 'u' or:[ format = 'U']) ifTrue:[ - hour := Integer readFrom:input onError:[ error value:'invalid hour' ]. - - ] ifFalse:[ ( format = 'm' or:[ format = 'M' ]) ifTrue:[ - minute := Integer readFrom:input onError:[ error value:'invalid minute' ]. - - ] ifFalse:[ ( format = 's' or:[ format = 'S' ]) ifTrue:[ - second := Integer readFrom:input onError:[ error value:'invalid second' ]. - - ] ifFalse:[ ( format = 'i' or:[ format = 'I' ]) ifTrue:[ - millisecond := Integer readFrom:input onError:[ error value:'invalid month' ]. - - ] ifFalse:[ ( format = 'tz' ) ifTrue:[ - utcOffset := self utcOffsetFrom:input. - utcOffset isNil ifTrue:[ error value:'invalid timezone' ] - ] ifFalse:[ ( format = 'a' ) ifTrue:[ - s := (input next:2) asLowercase. - s = 'am' ifTrue:[ - (hour between:0 and:12) ifFalse:[ error value:'invalid hour' ] - ] ifFalse:[ - s = 'pm' ifTrue:[ - (hour between:1 and:12) ifFalse:[ error value:'invalid hour' ]. - hour := hour + 12. - ] ifFalse:[ - error value:'invalid am/pm' - ] - ] - - ] ifFalse:[ - error value:'unhandled format:',format - ]]]]]]]]]]]]]] + |input| + input := len isNil ifTrue:[ inStream ] ifFalse:[ inStream next: len ]. + + ( #('d' 'D' 'day' ) includes:format ) ifTrue:[ + day := Integer readFrom:input onError:[ error value:'invalid day' ]. + + ] ifFalse:[ ( format = 'month' ) ifTrue:[ + month := Integer readFrom:input onError:[ error value:'invalid month' ]. + + ] ifFalse:[ ( format = 'year' or:[ format = 'y' ]) ifTrue:[ + year := Integer readFrom:input onError:[ error value:'invalid year' ]. + + ] ifFalse:[ ( format = 'Y' ) ifTrue:[ + year := Integer readFrom:input onError:[ error value:'invalid year' ]. + (year between:0 and: 99) ifFalse:[ error value:'invalid year' ]. + (year between:0 and:71) ifTrue:[ + year := year + 1900 + ] ifFalse:[ + year := year + 2000 + ] + + ] ifFalse:[ (format = 'monthName') ifTrue:[ + s := input nextMatching:[:c | c isLetter] thenMatching:[:c | c isLetter]. + month := Date indexOfMonth:s asLowercase language:languageOrNil + + ] ifFalse:[ ( format = 'Y1900' ) ifTrue:[ + year := Integer readFrom:input onError:[ error value:'invalid year' ]. + (year between:0 and: 99) ifFalse:[ error value:'invalid year' ]. + year := year + 1900 + + ] ifFalse:[ ( format = 'Y2000' ) ifTrue:[ + year := Integer readFrom:input onError:[ error value:'invalid year' ]. + (year between:0 and: 99) ifFalse:[ error value:'invalid year' ]. + year := year + 2000 + + ] ifFalse:[ ( format = 'h' or:[ format = 'H' ]) ifTrue:[ + hour := Integer readFrom:input onError:[ error value:'invalid hour' ]. + + ] ifFalse:[ ( format = 'u' or:[ format = 'U']) ifTrue:[ + hour := Integer readFrom:input onError:[ error value:'invalid hour' ]. + + ] ifFalse:[ ( format = 'm' or:[ format = 'M' ]) ifTrue:[ + minute := Integer readFrom:input onError:[ error value:'invalid minute' ]. + + ] ifFalse:[ ( format = 's' or:[ format = 'S' ]) ifTrue:[ + second := Integer readFrom:input onError:[ error value:'invalid second' ]. + + ] ifFalse:[ ( format = 'i' or:[ format = 'I' ]) ifTrue:[ + millisecond := Integer readFrom:input onError:[ error value:'invalid month' ]. + + ] ifFalse:[ ( format = 'tz' ) ifTrue:[ + utcOffset := self utcOffsetFrom:input. + utcOffset isNil ifTrue:[ error value:'invalid timezone' ] + ] ifFalse:[ ( format = 'a' ) ifTrue:[ + s := (input next:2) asLowercase. + s = 'am' ifTrue:[ + (hour between:0 and:12) ifFalse:[ error value:'invalid hour' ] + ] ifFalse:[ + s = 'pm' ifTrue:[ + (hour between:1 and:12) ifFalse:[ error value:'invalid hour' ]. + hour := hour + 12. + ] ifFalse:[ + error value:'invalid am/pm' + ] + ] + + ] ifFalse:[ + error value:'unhandled format:',format + ]]]]]]]]]]]]]] ]. hour := 0. @@ -896,41 +895,41 @@ formatStream := formatString readStream. [formatStream atEnd] whileFalse:[ - fChar := formatStream next. - fChar = Character space ifTrue:[ - inStream peek isSeparator ifFalse:[ error value: 'format error; space expcected' ]. - inStream skipSeparators. - ] ifFalse:[ - fChar == $% ifTrue:[ - len := nil. - (formatStream peek isDigit) ifTrue:[ - len := Integer readFrom:formatStream onError:[ error value: 'format error; invalid length' ] - ]. - (formatStream peek == $() ifTrue:[ - formatStream next. - format := formatStream upTo:$). - ] ifFalse:[ - (formatStream peek == ${) ifTrue:[ - formatStream next. - format := formatStream upTo:$}. - ] ifFalse:[ - (formatStream peek isLetter) ifTrue:[ - format := formatStream nextAlphaNumericWord. - ] ifFalse:[ - error value:'unhandled format:',formatStream peek - ] - ] - ]. - itemHandler value:format. - ] ifFalse:[ - inStream peek = fChar ifFalse:[^ error value: 'format error; ',fChar,' expcected']. - inStream next. - ] - ]. + fChar := formatStream next. + fChar = Character space ifTrue:[ + inStream peek isSeparator ifFalse:[ error value: 'format error; space expcected' ]. + inStream skipSeparators. + ] ifFalse:[ + fChar == $% ifTrue:[ + len := nil. + (formatStream peek isDigit) ifTrue:[ + len := Integer readFrom:formatStream onError:[ error value: 'format error; invalid length' ] + ]. + (formatStream peek == $() ifTrue:[ + formatStream next. + format := formatStream upTo:$). + ] ifFalse:[ + (formatStream peek == ${) ifTrue:[ + formatStream next. + format := formatStream upTo:$}. + ] ifFalse:[ + (formatStream peek isLetter) ifTrue:[ + format := formatStream nextAlphaNumericWord. + ] ifFalse:[ + error value:'unhandled format:',formatStream peek + ] + ] + ]. + itemHandler value:format. + ] ifFalse:[ + inStream peek = fChar ifFalse:[^ error value: 'format error; ',fChar,' expcected']. + inStream next. + ] + ]. ]. year isNil ifTrue:[ - year := (now := Timestamp now) year + year := (now := Timestamp now) year ]. ^ (self year:year month:month day:day hour:(hour ? 0) minute:(minute ? 0) second:(second ? 0) millisecond:millisecond) + utcOffset @@ -1624,7 +1623,6 @@ " ! ! - !Timestamp methodsFor:'accessing'! day @@ -2932,8 +2930,6 @@ " ! ! - - !Timestamp methodsFor:'testing'! isLocalTimestamp @@ -3912,11 +3908,11 @@ !Timestamp class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.214 2015-02-13 21:59:03 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.215 2015-06-05 17:41:37 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.214 2015-02-13 21:59:03 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.215 2015-06-05 17:41:37 cg Exp $' ! !