*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 23 Jan 1997 15:23:52 +0100
changeset 2247 3e227e6ea1fb
parent 2246 57451418f10a
child 2248 b11a16f51048
*** empty log message ***
CheapBlk.st
CheapBlock.st
Make.proto
VarArgCheapBlock.st
--- a/CheapBlk.st	Thu Jan 23 14:37:03 1997 +0100
+++ b/CheapBlk.st	Thu Jan 23 15:23:52 1997 +0100
@@ -105,6 +105,33 @@
     "Created: 21.10.1996 / 13:58:29 / cg"
 ! !
 
+!CheapBlock methodsFor:'conversion'!
+
+beVarArg
+    "convert myself into a varArg block;
+     this one has 1 formal argument, which gets the list
+     of actual arguments when evaluated."
+
+    nargs ~~ 1 ifTrue:[
+        self error:'vararg blocks must take exactly 1 argument - the arg list'.
+        ^ nil
+    ].
+
+    self changeClassTo:VarArgCheapBlock.
+    ^ self
+
+    "
+     |b|
+
+     b := [:argList | argList printCR] beVarArg.
+     b value.
+     b value:'arg1' value:'arg2' value:'arg3' value:'arg4'
+    "
+
+    "Created: 23.1.1997 / 13:35:28 / cg"
+    "Modified: 23.1.1997 / 13:35:48 / cg"
+! !
+
 !CheapBlock methodsFor:'printing & storing'!
 
 printOn:aStream
@@ -140,5 +167,5 @@
 !CheapBlock class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/CheapBlk.st,v 1.17 1997-01-23 12:45:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/CheapBlk.st,v 1.18 1997-01-23 14:23:39 cg Exp $'
 ! !
--- a/CheapBlock.st	Thu Jan 23 14:37:03 1997 +0100
+++ b/CheapBlock.st	Thu Jan 23 15:23:52 1997 +0100
@@ -105,6 +105,33 @@
     "Created: 21.10.1996 / 13:58:29 / cg"
 ! !
 
+!CheapBlock methodsFor:'conversion'!
+
+beVarArg
+    "convert myself into a varArg block;
+     this one has 1 formal argument, which gets the list
+     of actual arguments when evaluated."
+
+    nargs ~~ 1 ifTrue:[
+        self error:'vararg blocks must take exactly 1 argument - the arg list'.
+        ^ nil
+    ].
+
+    self changeClassTo:VarArgCheapBlock.
+    ^ self
+
+    "
+     |b|
+
+     b := [:argList | argList printCR] beVarArg.
+     b value.
+     b value:'arg1' value:'arg2' value:'arg3' value:'arg4'
+    "
+
+    "Created: 23.1.1997 / 13:35:28 / cg"
+    "Modified: 23.1.1997 / 13:35:48 / cg"
+! !
+
 !CheapBlock methodsFor:'printing & storing'!
 
 printOn:aStream
@@ -140,5 +167,5 @@
 !CheapBlock class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CheapBlock.st,v 1.17 1997-01-23 12:45:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CheapBlock.st,v 1.18 1997-01-23 14:23:39 cg Exp $'
 ! !
--- a/Make.proto	Thu Jan 23 14:37:03 1997 +0100
+++ b/Make.proto	Thu Jan 23 15:23:52 1997 +0100
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libbasic/Make.proto,v 1.86 1997-01-08 23:06:17 cg Exp $
+# $Header: /cvs/stx/stx/libbasic/Make.proto,v 1.87 1997-01-23 14:23:35 cg Exp $
 #
 # -------------- no need to change anything below ----------
 
@@ -78,7 +78,9 @@
       ExecFunc.$(O)          \
 	CompCode.$(O)        \
 	  Block.$(O)         \
+	    VarArgBlock.$(O) \
 	    CheapBlk.$(O)    \
+	      VarArgCheapBlock.$(O) \
 	  Method.$(O)        \
       Filename.$(O)          \
       InterestC.$(O)         \
@@ -313,6 +315,8 @@
 UIBytes.o: UIBytes.st $(STCHDR) ../include/ByteArray.H ../include/ArrColl.H ../include/SeqColl.H ../include/Coll.H ../include/Object.H
 UndefObj.o: UndefObj.st $(STCHDR) ../include/Object.H
 Unix.o: Unix.st $(STCHDR) ../include/Object.H
+VarArgBlk.o: VarArgBlk.st $(STCHDR) ../include/Block.H ../include/CompCode.H ../include/ExecFunc.H ../include/Object.H
+VarArgCheapBlk.o: VarArgCheapBlk.st $(STCHDR) ../include/CheapBlk.H ../include/Block.H ../include/CompCode.H ../include/ExecFunc.H ../include/Object.H
 WeakArr.o: WeakArr.st $(STCHDR) ../include/Array.H ../include/ArrColl.H ../include/SeqColl.H ../include/Coll.H ../include/Object.H
 WeakIdDict.o: WeakIdDict.st $(STCHDR) ../include/IdDict.H ../include/Dict.H ../include/Set.H ../include/Coll.H ../include/Object.H
 WeakDepDict.o: WeakDepDict.st $(STCHDR) ../include/WeakIdDict.H ../include/IdDict.H ../include/Dict.H ../include/Set.H ../include/Coll.H ../include/Object.H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VarArgCheapBlock.st	Thu Jan 23 15:23:52 1997 +0100
@@ -0,0 +1,183 @@
+"
+ COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+
+
+CheapBlock subclass:#VarArgCheapBlock
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Kernel-Methods'
+!
+
+!VarArgCheapBlock class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+
+!
+
+documentation
+"
+    read the documentation in VarArgBlocks.
+
+
+    [author:]
+        Claus Gittinger
+
+    [see also:]
+        Block CheapBlock
+"
+! !
+
+!VarArgCheapBlock methodsFor:'evaluation'!
+
+value
+    "evaluate the receiver with no block args."
+
+    ^ super value:#()
+
+    "Created: 23.1.1997 / 04:57:49 / cg"
+!
+
+value:arg
+    "evaluate the receiver with a single argument."
+
+    ^ super value:(Array with:arg)
+
+    "Created: 23.1.1997 / 04:57:57 / cg"
+!
+
+value:arg1 value:arg2
+    "evaluate the receiver with two arguments."
+
+    ^ super value:(Array with:arg1 with:arg2)
+
+    "Created: 23.1.1997 / 04:58:03 / cg"
+!
+
+value:arg1 value:arg2 value:arg3
+    "evaluate the receiver with three arguments."
+
+    ^ super value:(Array with:arg1 with:arg2 with:arg3)
+
+    "Created: 23.1.1997 / 04:58:09 / cg"
+!
+
+value:arg1 value:arg2 value:arg3 value:arg4
+    "evaluate the receiver with four arguments."
+
+    ^ super value:(Array 
+		    with:arg1 
+		    with:arg2 
+		    with:arg3 
+		    with:arg4)
+
+    "Modified: 22.1.1997 / 19:41:22 / cg"
+    "Created: 23.1.1997 / 04:58:14 / cg"
+!
+
+value:arg1 value:arg2 value:arg3 value:arg4 value:arg5
+    "evaluate the receiver with five arguments."
+
+    ^ super value:(Array 
+		    with:arg1 
+		    with:arg2 
+		    with:arg3 
+		    with:arg4
+		    with:arg5)
+
+    "Modified: 22.1.1997 / 19:41:26 / cg"
+    "Created: 23.1.1997 / 04:58:18 / cg"
+!
+
+value:arg1 value:arg2 value:arg3 value:arg4 value:arg5 value:arg6
+    "evaluate the receiver with six arguments."
+
+    ^ super value:(Array 
+		    with:arg1 
+		    with:arg2 
+		    with:arg3 
+		    with:arg4
+		    with:arg5
+		    with:arg6)
+
+    "Modified: 22.1.1997 / 19:41:29 / cg"
+    "Created: 23.1.1997 / 04:58:22 / cg"
+!
+
+value:arg1 value:arg2 value:arg3 value:arg4 value:arg5 value:arg6 value:arg7
+    "evaluate the receiver with seven arguments."
+
+    ^ super value:(Array 
+		    with:arg1 
+		    with:arg2 
+		    with:arg3 
+		    with:arg4
+		    with:arg5
+		    with:arg6
+		    with:arg7)
+
+    "Modified: 22.1.1997 / 19:41:33 / cg"
+    "Created: 23.1.1997 / 04:58:26 / cg"
+!
+
+value:arg1 value:arg2 value:arg3 value:arg4 value:arg5 value:arg6 value:arg7 value:arg8
+    "evaluate the receiver with eight arguments."
+
+    ^ super value:(Array 
+		    with:arg1 
+		    with:arg2 
+		    with:arg3 
+		    with:arg4
+		    with:arg5
+		    with:arg6
+		    with:arg7
+		    with:arg8)
+
+    "Created: 23.1.1997 / 04:58:30 / cg"
+!
+
+valueWithArguments:argArray
+    "evaluate the receiver with all arguments in argArray."
+
+    ^ super value:argArray
+
+    "Created: 23.1.1997 / 04:59:16 / cg"
+! !
+
+!VarArgCheapBlock methodsFor:'testing'!
+
+isVarArgBlock
+    "return true, if this block accepts a variable number of arguments"
+
+    ^ true
+
+    "Created: 23.1.1997 / 05:00:18 / cg"
+! !
+
+!VarArgCheapBlock class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/VarArgCheapBlock.st,v 1.1 1997-01-23 14:23:52 cg Exp $'
+! !