Array.st
changeset 220 9079bd965dd7
parent 219 9fa50f3223e7
child 249 810798c5c2e5
equal deleted inserted replaced
219:9fa50f3223e7 220:9079bd965dd7
    19 
    19 
    20 Array comment:'
    20 Array comment:'
    21 COPYRIGHT (c) 1989 by Claus Gittinger
    21 COPYRIGHT (c) 1989 by Claus Gittinger
    22 	      All Rights Reserved
    22 	      All Rights Reserved
    23 
    23 
    24 $Header: /cvs/stx/stx/libbasic/Array.st,v 1.15 1995-02-03 13:42:53 claus Exp $
    24 $Header: /cvs/stx/stx/libbasic/Array.st,v 1.16 1995-02-05 21:27:38 claus Exp $
    25 '!
    25 '!
    26 
    26 
    27 !Array class methodsFor:'documentation'!
    27 !Array class methodsFor:'documentation'!
    28 
    28 
    29 copyright
    29 copyright
    40 "
    40 "
    41 !
    41 !
    42 
    42 
    43 version
    43 version
    44 "
    44 "
    45 $Header: /cvs/stx/stx/libbasic/Array.st,v 1.15 1995-02-03 13:42:53 claus Exp $
    45 $Header: /cvs/stx/stx/libbasic/Array.st,v 1.16 1995-02-05 21:27:38 claus Exp $
    46 "
    46 "
    47 !
    47 !
    48 
    48 
    49 documentation
    49 documentation
    50 "
    50 "
   155 ! !
   155 ! !
   156 
   156 
   157 !Array methodsFor:'copying'!
   157 !Array methodsFor:'copying'!
   158 
   158 
   159 copyWith:something
   159 copyWith:something
   160     "reimplemented for speed if receiver is an Array"
   160     "return a new collection containing the receivers elements
       
   161      and the single new element, newElement. 
       
   162      This is different from concatentation, which expects another collection
       
   163      as argument, but equivalent to copy-and-addLast.
       
   164      Reimplemented for speed if receiver is an Array"
   161 %{
   165 %{
   162     OBJ nObj, element;
   166     OBJ nObj, element;
   163     unsigned int sz;
   167     unsigned int sz;
   164     unsigned int nIndex;
   168     unsigned int nIndex;
   165     REGISTER OBJ *srcP, *dstP;
   169     REGISTER OBJ *srcP, *dstP;
   575      && (_BlockInstPtr(aBlock)->b_nargs == _MKSMALLINT(2))) {
   579      && (_BlockInstPtr(aBlock)->b_nargs == _MKSMALLINT(2))) {
   576 #ifdef NEW_BLOCK_CALL
   580 #ifdef NEW_BLOCK_CALL
   577 	for (; index < nIndex; index++) {
   581 	for (; index < nIndex; index++) {
   578 	    if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   582 	    if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   579 
   583 
   580 	    (*codeVal)(aBlock, CON_COMMA  _MKSMALLINT(index),
   584 	    (*codeVal)(aBlock, CON_COMMA  _MKSMALLINT(index+1),
   581 					  _InstPtr(self)->i_instvars[index]);
   585 					  _InstPtr(self)->i_instvars[index]);
   582 	} 
   586 	} 
   583 #else
   587 #else
   584 	home = _BlockInstPtr(aBlock)->b_home;
   588 	home = _BlockInstPtr(aBlock)->b_home;
   585 	rHome = home;
   589 	rHome = home;
   588 	     * home will not move - keep in a fast register
   592 	     * home will not move - keep in a fast register
   589 	     */
   593 	     */
   590 	    for (; index < nIndex; index++) {
   594 	    for (; index < nIndex; index++) {
   591 		if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   595 		if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   592 
   596 
   593 		(*codeVal)(rHome, CON_COMMA  _MKSMALLINT(index),
   597 		(*codeVal)(rHome, CON_COMMA  _MKSMALLINT(index+1),
   594 					     _InstPtr(self)->i_instvars[index]);
   598 					     _InstPtr(self)->i_instvars[index]);
   595 	    } 
   599 	    } 
   596 	} else {
   600 	} else {
   597 	    for (; index < nIndex; index++) {
   601 	    for (; index < nIndex; index++) {
   598 		if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   602 		if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   599 
   603 
   600 		(*codeVal)(home, CON_COMMA  _MKSMALLINT(index),
   604 		(*codeVal)(home, CON_COMMA  _MKSMALLINT(index+1),
   601 					    _InstPtr(self)->i_instvars[index]);
   605 					    _InstPtr(self)->i_instvars[index]);
   602 	    } 
   606 	    } 
   603 	} 
   607 	} 
   604 #endif
   608 #endif
   605     } else {
   609     } else {
   607 	    if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   611 	    if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
   608 
   612 
   609 	    (*val.ilc_func)(aBlock, 
   613 	    (*val.ilc_func)(aBlock, 
   610 			    @symbol(value:value:), 
   614 			    @symbol(value:value:), 
   611 			    CON_COMMA  nil, &val2,
   615 			    CON_COMMA  nil, &val2,
   612 			    _MKSMALLINT(index),
   616 			    _MKSMALLINT(index+1),
   613 			    _InstPtr(self)->i_instvars[index]);
   617 			    _InstPtr(self)->i_instvars[index]);
   614 	} 
   618 	} 
   615     }
   619     }
   616 %}
   620 %}
   617 .
   621 .