Behavior.st
changeset 3920 0c1b9b2fa23b
parent 3882 3e11ea1568d5
child 3931 0724c3fc6f7d
equal deleted inserted replaced
3919:9003ca082dcf 3920:0c1b9b2fa23b
   485 	RETURN ( __MKSMALLINT(DOUBLEARRAY) );
   485 	RETURN ( __MKSMALLINT(DOUBLEARRAY) );
   486     }
   486     }
   487     if (aSymbol == @symbol(long)) {
   487     if (aSymbol == @symbol(long)) {
   488 	RETURN ( __MKSMALLINT(LONGARRAY) );
   488 	RETURN ( __MKSMALLINT(LONGARRAY) );
   489     }
   489     }
       
   490     if (aSymbol == @symbol(longLong)) {
       
   491 	RETURN ( __MKSMALLINT(LONGLONGARRAY) );
       
   492     }
   490     if (aSymbol == @symbol(word)) {
   493     if (aSymbol == @symbol(word)) {
   491 	RETURN ( __MKSMALLINT(WORDARRAY) );
   494 	RETURN ( __MKSMALLINT(WORDARRAY) );
   492     }
   495     }
   493     if (aSymbol == @symbol(signedWord)) {
   496     if (aSymbol == @symbol(signedWord)) {
   494 	RETURN ( __MKSMALLINT(SWORDARRAY) );
   497 	RETURN ( __MKSMALLINT(SWORDARRAY) );
   495     }
   498     }
   496     if (aSymbol == @symbol(signedLong)) {
   499     if (aSymbol == @symbol(signedLong)) {
   497 	RETURN ( __MKSMALLINT(SLONGARRAY) );
   500 	RETURN ( __MKSMALLINT(SLONGARRAY) );
   498     }
   501     }
       
   502     if (aSymbol == @symbol(signedLongLong)) {
       
   503 	RETURN ( __MKSMALLINT(SLONGLONGARRAY) );
       
   504     }
   499     if (aSymbol == @symbol(byte)) {
   505     if (aSymbol == @symbol(byte)) {
   500 	RETURN ( __MKSMALLINT(BYTEARRAY) );
   506 	RETURN ( __MKSMALLINT(BYTEARRAY) );
   501     }
   507     }
   502 %}.
   508 %}.
   503     ^ 0         "/ not indexed
   509     ^ 0         "/ not indexed
   541     "
   547     "
   542      Behavior flagLongs    
   548      Behavior flagLongs    
   543     "
   549     "
   544 !
   550 !
   545 
   551 
       
   552 flagLongLongs
       
   553     "return the flag code for longlong-valued indexed instances (i.e. 8-byte).
       
   554      The VM masks the flag value with the indexMask (maskIndexType) 
       
   555      and compares it to this flag value, when checking for 
       
   556      unsigned long valued variable instances."
       
   557 
       
   558 %{  /* NOCONTEXT */
       
   559     /* this is defined as a primitive to get defines from stc.h */
       
   560 
       
   561     RETURN ( __MKSMALLINT(LONGLONGARRAY) );
       
   562 %}
       
   563     "
       
   564      Behavior flagLongLongs    
       
   565     "
       
   566 !
       
   567 
   546 flagMethod
   568 flagMethod
   547     "return the flag code which marks Method-like instances.
   569     "return the flag code which marks Method-like instances.
   548      The VM checks this single bit in the flag value when
   570      The VM checks this single bit in the flag value when
   549      checking for a method."
   571      checking for a method."
   550 
   572 
   610 
   632 
   611     RETURN ( __MKSMALLINT(SLONGARRAY) );
   633     RETURN ( __MKSMALLINT(SLONGARRAY) );
   612 %}
   634 %}
   613     "
   635     "
   614      Behavior flagSignedLongs
   636      Behavior flagSignedLongs
       
   637     "
       
   638 !
       
   639 
       
   640 flagSignedLongLongs
       
   641     "return the flag code for signed longlong-valued indexed instances (i.e. 8-byte).
       
   642      The VM masks the flag value with the indexMask (maskIndexType) 
       
   643      and compares it to this flag value, when checking for 
       
   644      signed long valued variable instances."
       
   645 
       
   646 %{  /* NOCONTEXT */
       
   647     /* this is defined as a primitive to get defines from stc.h */
       
   648 
       
   649     RETURN ( __MKSMALLINT(SLONGLONGARRAY) );
       
   650 %}
       
   651     "
       
   652      Behavior flagSignedLongLongs
   615     "
   653     "
   616 !
   654 !
   617 
   655 
   618 flagSignedWords
   656 flagSignedWords
   619     "return the flag code for signed word-valued indexed instances (i.e. 2-byte).
   657     "return the flag code for signed word-valued indexed instances (i.e. 2-byte).
  1003     "/ for correct recompilation, just create a new class ...
  1041     "/ for correct recompilation, just create a new class ...
  1004     "/ but care to avoid a nameSpace change, by giving my
  1042     "/ but care to avoid a nameSpace change, by giving my
  1005     "/ full name and answering with Smalltalk to a nameSpace query.
  1043     "/ full name and answering with Smalltalk to a nameSpace query.
  1006 
  1044 
  1007     (owner := self owningClass) notNil ifTrue:[
  1045     (owner := self owningClass) notNil ifTrue:[
  1008         ns := owner.
  1046 	ns := owner.
  1009         name := self nameWithoutPrefix asSymbol
  1047 	name := self nameWithoutPrefix asSymbol
  1010     ] ifFalse:[
  1048     ] ifFalse:[
  1011         ns := Smalltalk.
  1049 	ns := Smalltalk.
  1012         name := self name
  1050 	name := self name
  1013     ].
  1051     ].
  1014 
  1052 
  1015     Class classRedefinitionSignal answer:#keep do:[
  1053     Class classRedefinitionSignal answer:#keep do:[
  1016         Class nameSpaceQuerySignal answer:ns
  1054 	Class nameSpaceQuerySignal answer:ns
  1017         do:[
  1055 	do:[
  1018             aClass 
  1056 	    aClass 
  1019                 perform:(self definitionSelector) 
  1057 		perform:(self definitionSelector) 
  1020                 withArguments:(Array with:name 
  1058 		withArguments:(Array with:name 
  1021                                with:(self instanceVariableString) 
  1059 			       with:(self instanceVariableString) 
  1022                                with:(self classVariableString)
  1060 			       with:(self classVariableString)
  1023                                with:'' "/ pool 
  1061 			       with:'' "/ pool 
  1024                                with:(self category)).
  1062 			       with:(self category)).
  1025         ]
  1063 	]
  1026     ]
  1064     ]
  1027 
  1065 
  1028     "Modified: / 20.6.1998 / 18:17:37 / cg"
  1066     "Modified: / 20.6.1998 / 18:17:37 / cg"
  1029 ! !
  1067 ! !
  1030 
  1068 
  1307 !
  1345 !
  1308 
  1346 
  1309 compiler
  1347 compiler
  1310     "return the compiler to use for this class.
  1348     "return the compiler to use for this class.
  1311      OBSOLETE: This is the old ST/X interface, kept for migration. 
  1349      OBSOLETE: This is the old ST/X interface, kept for migration. 
  1312                Dont use it - it will vanish."
  1350 	       Dont use it - it will vanish."
  1313 
  1351 
  1314     self obsoleteMethodWarning:'use #compilerClass'.
  1352     self obsoleteMethodWarning:'use #compilerClass'.
  1315     ^ self compilerClass
  1353     ^ self compilerClass
  1316 
  1354 
  1317     "Modified: 31.7.1997 / 23:04:33 / cg"
  1355     "Modified: 31.7.1997 / 23:04:33 / cg"
  1428 !
  1466 !
  1429 
  1467 
  1430 allInstancesDo:aBlock
  1468 allInstancesDo:aBlock
  1431     "evaluate aBlock for all of my instances"
  1469     "evaluate aBlock for all of my instances"
  1432 
  1470 
  1433 "/    ObjectMemory allObjectsDo:[:anObject |
       
  1434 "/        (anObject class == self) ifTrue:[
       
  1435 "/            aBlock value:anObject
       
  1436 "/        ]
       
  1437 "/    ]
       
  1438 
       
  1439     ObjectMemory allInstancesOf:self do:[:anObject |
  1471     ObjectMemory allInstancesOf:self do:[:anObject |
  1440 	aBlock value:anObject
  1472 	aBlock value:anObject
  1441     ]
  1473     ]
  1442 
  1474 
  1443     "
  1475     "
  1461 
  1493 
  1462 allSubclassesDo:aBlock
  1494 allSubclassesDo:aBlock
  1463     "evaluate aBlock for all of my subclasses.
  1495     "evaluate aBlock for all of my subclasses.
  1464      There is no specific order, in which the entries are enumerated.
  1496      There is no specific order, in which the entries are enumerated.
  1465      Warning:
  1497      Warning:
  1466         This will only enumerate globally known classes - for anonymous
  1498 	This will only enumerate globally known classes - for anonymous
  1467         behaviors, you have to walk over all instances of Behavior."
  1499 	behaviors, you have to walk over all instances of Behavior."
  1468 
  1500 
  1469     self isMeta ifTrue:[
  1501     self isMeta ifTrue:[
  1470         "/ metaclasses are not found via Smalltalk allBehaviorsDo:
  1502 	"/ metaclasses are not found via Smalltalk allBehaviorsDo:
  1471         "/ here, walk over classes and enumerate corresponding metas.
  1503 	"/ here, walk over classes and enumerate corresponding metas.
  1472         self soleInstance allSubclassesDo:[:aSubClass |
  1504 	self soleInstance allSubclassesDo:[:aSubClass |
  1473             aBlock value:(aSubClass class)
  1505 	    aBlock value:(aSubClass class)
  1474         ].
  1506 	].
  1475     ] ifFalse:[
  1507     ] ifFalse:[
  1476         Smalltalk allBehaviorsDo:[:aClass |
  1508 	Smalltalk allBehaviorsDo:[:aClass |
  1477             (aClass isSubclassOf:self) ifTrue:[
  1509 	    (aClass isSubclassOf:self) ifTrue:[
  1478                 aBlock value:aClass
  1510 		aBlock value:aClass
  1479             ]
  1511 	    ]
  1480         ]
  1512 	]
  1481     ]
  1513     ]
  1482 
  1514 
  1483     "
  1515     "
  1484      Collection allSubclassesDo:[:c | Transcript showCR:(c name)]
  1516      Collection allSubclassesDo:[:c | Transcript showCR:(c name)]
  1485      Collection class allSubclassesDo:[:c | Transcript showCR:(c name)]
  1517      Collection class allSubclassesDo:[:c | Transcript showCR:(c name)]
  1521      String allSuperclassesDo:[:c | Transcript showCR:(c name)]
  1553      String allSuperclassesDo:[:c | Transcript showCR:(c name)]
  1522     "
  1554     "
  1523 !
  1555 !
  1524 
  1556 
  1525 selectorsAndMethodsDo:aTwoArgBlock
  1557 selectorsAndMethodsDo:aTwoArgBlock
       
  1558     "evaluate the argument, aBlock for all selectors,
       
  1559      passing the corresponding method as second argument"
       
  1560 
  1526     methodDictionary keysAndValuesDo:aTwoArgBlock
  1561     methodDictionary keysAndValuesDo:aTwoArgBlock
  1527 
  1562 
  1528     "Created: / 27.10.1997 / 14:09:27 / cg"
  1563     "Created: / 27.10.1997 / 14:09:27 / cg"
  1529 !
  1564 !
  1530 
  1565 
  1589      This is sent to a class after it
  1624      This is sent to a class after it
  1590      has been loaded into the system.
  1625      has been loaded into the system.
  1591      Statically compiled classes are initialized by the VM"
  1626      Statically compiled classes are initialized by the VM"
  1592 
  1627 
  1593     (self class implements:#initialize) ifTrue:[
  1628     (self class implements:#initialize) ifTrue:[
  1594         self initialize.
  1629 	self initialize.
  1595     ].
  1630     ].
  1596     self privateClassesSorted do:[:aPrivateClass |
  1631     self privateClassesSorted do:[:aPrivateClass |
  1597         aPrivateClass initializeWithAllPrivateClasses.
  1632 	aPrivateClass initializeWithAllPrivateClasses.
  1598     ].
  1633     ].
  1599 
  1634 
  1600     "Created: / 13.5.1998 / 23:33:16 / cg"
  1635     "Created: / 13.5.1998 / 23:33:16 / cg"
  1601     "Modified: / 13.5.1998 / 23:34:06 / cg"
  1636     "Modified: / 13.5.1998 / 23:34:06 / cg"
  1602 !
  1637 !
  1684 #else
  1719 #else
  1685 	    REGISTER OBJ *op;
  1720 	    REGISTER OBJ *op;
  1686 
  1721 
  1687 	    op = __InstPtr(newobj)->i_instvars;
  1722 	    op = __InstPtr(newobj)->i_instvars;
  1688 
  1723 
  1689 # if !defined(NEGATIVE_ADDRESSES)
       
  1690 	    /*
  1724 	    /*
  1691 	     * knowing that nil is 0
  1725 	     * knowing that nil is 0
  1692 	     */
  1726 	     */
  1693 #  if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED)
  1727 # if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED)
  1694 	    if (nInstVars > 8) {
  1728 	    if (nInstVars > 8) {
  1695 		*op++ = nil;    /* for alignment */
  1729 		*op++ = nil;    /* for alignment */
  1696 		nInstVars--;
  1730 		nInstVars--;
  1697 		while (nInstVars >= 8) {
  1731 		while (nInstVars >= 8) {
  1698 		    *(double *)op = 0.0;
  1732 		    *(double *)op = 0.0;
  1705 	    }
  1739 	    }
  1706 	    while (nInstVars != 0) {
  1740 	    while (nInstVars != 0) {
  1707 		*op++ = 0;
  1741 		*op++ = 0;
  1708 		nInstVars--;
  1742 		nInstVars--;
  1709 	    }
  1743 	    }
  1710 #  else
  1744 # else
  1711 #   if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED)
  1745 #  if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED)
  1712 	    if (nInstVars > 8) {
  1746 	    if (nInstVars > 8) {
  1713 		*op++ = nil;    /* for alignment */
  1747 		*op++ = nil;    /* for alignment */
  1714 		nInstVars--;
  1748 		nInstVars--;
  1715 		while (nInstVars >= 8) {
  1749 		while (nInstVars >= 8) {
  1716 		    *(long long *)op = 0;
  1750 		    *(long long *)op = 0;
  1724 	    while (nInstVars != 0) {
  1758 	    while (nInstVars != 0) {
  1725 		*op++ = 0;
  1759 		*op++ = 0;
  1726 		nInstVars--;
  1760 		nInstVars--;
  1727 	    }
  1761 	    }
  1728 
  1762 
  1729 #   else
  1763 #  else
  1730 #    if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED)
  1764 #   if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED)
  1731 	    while (nInstVars >= 8) {
  1765 	    while (nInstVars >= 8) {
  1732 		*op = nil;
  1766 		*op = nil;
  1733 		*(op+1) = nil;
  1767 		*(op+1) = nil;
  1734 		*(op+2) = nil;
  1768 		*(op+2) = nil;
  1735 		*(op+3) = nil;
  1769 		*(op+3) = nil;
  1742 	    }
  1776 	    }
  1743 	    while (nInstVars != 0) {
  1777 	    while (nInstVars != 0) {
  1744 		*op++ = nil;
  1778 		*op++ = nil;
  1745 		nInstVars--;
  1779 		nInstVars--;
  1746 	    }
  1780 	    }
       
  1781 #   else
       
  1782 #    if defined(FAST_MEMSET)
       
  1783 	    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
  1747 #    else
  1784 #    else
  1748 #     if defined(FAST_MEMSET)
       
  1749 	    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
       
  1750 #     else
       
  1751 	    do {
  1785 	    do {
  1752 		*op++ = nil;
  1786 		*op++ = nil;
  1753 		nInstVars--;
  1787 		nInstVars--;
  1754 	    } while (nInstVars != 0);
  1788 	    } while (nInstVars != 0);
  1755 #     endif
       
  1756 #    endif
  1789 #    endif
  1757 #   endif
  1790 #   endif
  1758 #  endif
  1791 #  endif
  1759 # else /* nil could be ~~ 0 */
       
  1760 	    while (nInstVars >= 8) {
       
  1761 		*op = nil;
       
  1762 		*(op+1) = nil;
       
  1763 		*(op+2) = nil;
       
  1764 		*(op+3) = nil;
       
  1765 		*(op+4) = nil;
       
  1766 		*(op+5) = nil;
       
  1767 		*(op+6) = nil;
       
  1768 		*(op+7) = nil;
       
  1769 		op += 8;
       
  1770 		nInstVars -= 8;
       
  1771 	    }
       
  1772 	    while (nInstVars != 0) {
       
  1773 		*op++ = nil;
       
  1774 		nInstVars--;
       
  1775 	    }
       
  1776 # endif
  1792 # endif
  1777 #endif
  1793 #endif
  1778 	}
  1794 	}
  1779 	RETURN ( newobj );
  1795 	RETURN ( newobj );
  1780     }
  1796     }
  1809 
  1825 
  1810     OBJ newobj;
  1826     OBJ newobj;
  1811     unsigned INT instsize, nInstVars;
  1827     unsigned INT instsize, nInstVars;
  1812     INT nindexedinstvars;
  1828     INT nindexedinstvars;
  1813     unsigned INT flags;
  1829     unsigned INT flags;
  1814 #if ! defined(FAST_ARRAY_MEMSET) || defined(NEGATIVE_ADDRESSES)
  1830 #if ! defined(FAST_ARRAY_MEMSET)
  1815     REGISTER char *cp;
  1831     REGISTER char *cp;
  1816     short *sp;
  1832     short *sp;
  1817     long *lp;
  1833     long *lp;
  1818 #endif
  1834 #endif
  1819     REGISTER OBJ *op;
  1835     REGISTER OBJ *op;
  1827 	    flags = __intVal(__INST(flags)) & ARRAYMASK;
  1843 	    flags = __intVal(__INST(flags)) & ARRAYMASK;
  1828 	    switch (flags) {
  1844 	    switch (flags) {
  1829 		case BYTEARRAY:
  1845 		case BYTEARRAY:
  1830 		    instsize = OHDR_SIZE + nindexedinstvars;
  1846 		    instsize = OHDR_SIZE + nindexedinstvars;
  1831 		    if (nInstVars == 0) {
  1847 		    if (nInstVars == 0) {
  1832 			if (__CanDoQuickNew(instsize)) {	/* OBJECT ALLOCATION */
  1848 			if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
  1833 			    /*
  1849 			    /*
  1834 			     * the most common case
  1850 			     * the most common case
  1835 			     */
  1851 			     */
  1836 			    __qCheckedNew(newobj, instsize);
  1852 			    __qCheckedNew(newobj, instsize);
  1837 			    __InstPtr(newobj)->o_class = self;
  1853 			    __InstPtr(newobj)->o_class = self;
  1838 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  1854 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  1839 			    nInstVars = nindexedinstvars >> 2;
  1855 			    nInstVars = nindexedinstvars >> 2;
  1840 			    if (nindexedinstvars & 3) nInstVars++;
  1856 			    if (nindexedinstvars & 3) nInstVars++;
  1841 			    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
  1857 			    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
  1842 #else
  1858 #else
  1843 # if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
  1859 # if defined(FAST_ARRAY_MEMSET)
  1844 			    memset(__InstPtr(newobj)->i_instvars, 0, nindexedinstvars);
  1860 			    memset(__InstPtr(newobj)->i_instvars, 0, nindexedinstvars);
  1845 # else
  1861 # else
  1846 			    cp = (char *)__InstPtr(newobj)->i_instvars;
  1862 			    cp = (char *)__InstPtr(newobj)->i_instvars;
  1847 			    while (nindexedinstvars >= sizeof(long)) {
  1863 			    while (nindexedinstvars >= sizeof(long)) {
  1848 				*(long *)cp = 0;
  1864 				*(long *)cp = 0;
  1857 			}
  1873 			}
  1858 		    } else {
  1874 		    } else {
  1859 			instsize += __OBJS2BYTES__(nInstVars);
  1875 			instsize += __OBJS2BYTES__(nInstVars);
  1860 		    }
  1876 		    }
  1861 		    __PROTECT_CONTEXT__
  1877 		    __PROTECT_CONTEXT__
  1862 		    __qNew(newobj, instsize);	/* OBJECT ALLOCATION */
  1878 		    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
  1863 		    __UNPROTECT_CONTEXT__
  1879 		    __UNPROTECT_CONTEXT__
  1864 		    if (newobj == nil) {
  1880 		    if (newobj == nil) {
  1865 			break;
  1881 			break;
  1866 		    }
  1882 		    }
  1867 		    __InstPtr(newobj)->o_class = self;
  1883 		    __InstPtr(newobj)->o_class = self;
  1870 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  1886 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  1871 		    nInstVars = (instsize-OHDR_SIZE) >> 2;
  1887 		    nInstVars = (instsize-OHDR_SIZE) >> 2;
  1872 		    if (instsize & 3) nInstVars++;
  1888 		    if (instsize & 3) nInstVars++;
  1873 		    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
  1889 		    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
  1874 #else
  1890 #else
  1875 # if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
  1891 # if defined(FAST_ARRAY_MEMSET)
  1876 		    /*
  1892 		    /*
  1877 		     * knowing that nil is 0
  1893 		     * knowing that nil is 0
  1878 		     */
  1894 		     */
  1879 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
  1895 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
  1880 # else
  1896 # else
  1896 
  1912 
  1897 		case WORDARRAY:
  1913 		case WORDARRAY:
  1898 		case SWORDARRAY:
  1914 		case SWORDARRAY:
  1899 		    instsize = OHDR_SIZE + 
  1915 		    instsize = OHDR_SIZE + 
  1900 			       __OBJS2BYTES__(nInstVars) + 
  1916 			       __OBJS2BYTES__(nInstVars) + 
  1901 			       nindexedinstvars * sizeof(short);
  1917 			       nindexedinstvars * 2;
  1902 		    __PROTECT_CONTEXT__
  1918 		    __PROTECT_CONTEXT__
  1903 		    __qNew(newobj, instsize);	/* OBJECT ALLOCATION */
  1919 		    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
  1904 		    __UNPROTECT_CONTEXT__
  1920 		    __UNPROTECT_CONTEXT__
  1905 		    if (newobj == nil) {
  1921 		    if (newobj == nil) {
  1906 			break;
  1922 			break;
  1907 		    }
  1923 		    }
  1908 		    __InstPtr(newobj)->o_class = self;
  1924 		    __InstPtr(newobj)->o_class = self;
  1909 		    __qSTORE(newobj, self);
  1925 		    __qSTORE(newobj, self);
  1910 
  1926 
  1911 #if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
  1927 #if defined(FAST_ARRAY_MEMSET)
  1912 		    /*
  1928 		    /*
  1913 		     * knowing that nil is 0
  1929 		     * knowing that nil is 0
  1914 		     */
  1930 		     */
  1915 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  1931 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  1916 #else
  1932 #else
  1926 
  1942 
  1927 	       case LONGARRAY:
  1943 	       case LONGARRAY:
  1928 	       case SLONGARRAY:
  1944 	       case SLONGARRAY:
  1929 		    instsize = OHDR_SIZE + 
  1945 		    instsize = OHDR_SIZE + 
  1930 			       __OBJS2BYTES__(nInstVars) + 
  1946 			       __OBJS2BYTES__(nInstVars) + 
  1931 			       nindexedinstvars * sizeof(long);
  1947 			       nindexedinstvars * 4;
  1932 		    __PROTECT_CONTEXT__
  1948 		    __PROTECT_CONTEXT__
  1933 		    __qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
  1949 		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
  1934 		    __UNPROTECT_CONTEXT__
  1950 		    __UNPROTECT_CONTEXT__
  1935 		    if (newobj == nil) {
  1951 		    if (newobj == nil) {
  1936 			break;
  1952 			break;
  1937 		    }
  1953 		    }
  1938 		    __InstPtr(newobj)->o_class = self;
  1954 		    __InstPtr(newobj)->o_class = self;
  1939 		    __qSTORE(newobj, self);
  1955 		    __qSTORE(newobj, self);
  1940 
  1956 
  1941 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  1957 #if defined(memset4)
  1942 		    /*
  1958 		    /*
  1943 		     * knowing that nil is 0
  1959 		     * knowing that nil is 0
  1944 		     */
  1960 		     */
  1945 		    {
  1961 		    {
  1946 			int n4 = nInstVars + nindexedinstvars;
  1962 			int n4 = nInstVars + nindexedinstvars;
  1947 
  1963 
  1948 		        memset4(__InstPtr(newobj)->i_instvars, 0, n4);
  1964 			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
  1949 		    }
  1965 		    }
  1950 #else
  1966 #else
  1951 # if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
  1967 # if defined(FAST_ARRAY_MEMSET)
  1952 		    /*
  1968 		    /*
  1953 		     * knowing that nil is 0
  1969 		     * knowing that nil is 0
  1954 		     */
  1970 		     */
  1955 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  1971 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  1956 # else
  1972 # else
  1963 # endif
  1979 # endif
  1964 #endif
  1980 #endif
  1965 		    RETURN ( newobj );
  1981 		    RETURN ( newobj );
  1966 		    break;
  1982 		    break;
  1967 
  1983 
  1968 	       case FLOATARRAY:
  1984 	       case LONGLONGARRAY:
  1969 		    instsize = sizeof(struct __floatArray) + 
  1985 	       case SLONGLONGARRAY:
  1970 			       __OBJS2BYTES__(nInstVars) + 
  1986 		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
  1971 			       (nindexedinstvars - 1) * sizeof(float);
  1987 
       
  1988 #ifdef __NEED_LONGLONG_ALIGN
       
  1989 		    instsize = ((instsize-1) + __LONGLONG_ALIGN) & ~(__LONGLONG_ALIGN-1);
       
  1990 #endif
       
  1991 		    instsize += nindexedinstvars * 8;
  1972 
  1992 
  1973 		    __PROTECT_CONTEXT__
  1993 		    __PROTECT_CONTEXT__
  1974 		    __qNew(newobj, instsize);	/* OBJECT ALLOCATION */
  1994 		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
  1975 		    __UNPROTECT_CONTEXT__
  1995 		    __UNPROTECT_CONTEXT__
  1976 		    if (newobj == nil) {
  1996 		    if (newobj == nil) {
  1977 			break;
  1997 			break;
  1978 		    }
  1998 		    }
  1979 		    __InstPtr(newobj)->o_class = self;
  1999 		    __InstPtr(newobj)->o_class = self;
  1980 		    __qSTORE(newobj, self);
  2000 		    __qSTORE(newobj, self);
  1981 
  2001 
       
  2002 #if defined(memset4)
       
  2003 		    {
       
  2004 			int n4 = (instsize-OHDR_SIZE) / 4;
       
  2005 
       
  2006 			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
       
  2007 		    }
       
  2008 #else
       
  2009 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
       
  2010 #endif
       
  2011 		    RETURN ( newobj );
       
  2012 		    break;
       
  2013 
       
  2014 	       case FLOATARRAY:
       
  2015 		    instsize = sizeof(struct __floatArray) + 
       
  2016 			       __OBJS2BYTES__(nInstVars) + 
       
  2017 			       (nindexedinstvars - 1) * sizeof(float);
       
  2018 
       
  2019 		    __PROTECT_CONTEXT__
       
  2020 		    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
       
  2021 		    __UNPROTECT_CONTEXT__
       
  2022 		    if (newobj == nil) {
       
  2023 			break;
       
  2024 		    }
       
  2025 		    __InstPtr(newobj)->o_class = self;
       
  2026 		    __qSTORE(newobj, self);
       
  2027 
  1982 		    op = __InstPtr(newobj)->i_instvars;
  2028 		    op = __InstPtr(newobj)->i_instvars;
  1983 #if defined(FLOAT0_IS_INT0) /* knowin that float 0.0 is all-zeros */
  2029 #if defined(__FLOAT0_IS_INT0) /* knowin that float 0.0 is all-zeros */
       
  2030 # if defined(memset4)
       
  2031 		    {
       
  2032 			int n4 = (instsize-OHDR_SIZE) / 4;
       
  2033 
       
  2034 			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
       
  2035 		    }
       
  2036 # else
  1984 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  2037 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
       
  2038 # endif
  1985 #else
  2039 #else
  1986 		    while (nInstVars--)
  2040 		    while (nInstVars--)
  1987 			*op++ = nil;
  2041 			*op++ = nil;
  1988 		    fp = (float *)op;
  2042 		    fp = (float *)op;
  1989 		    while (nindexedinstvars--)
  2043 		    while (nindexedinstvars--)
  1991 #endif
  2045 #endif
  1992 		    RETURN ( newobj );
  2046 		    RETURN ( newobj );
  1993 		    break;
  2047 		    break;
  1994 
  2048 
  1995 	       case DOUBLEARRAY:
  2049 	       case DOUBLEARRAY:
  1996 		    instsize = sizeof(struct __doubleArray) + 
  2050 		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
  1997 			       __OBJS2BYTES__(nInstVars) + 
  2051 #ifdef __NEED_DOUBLE_ALIGN
  1998 			       (nindexedinstvars - 1) * sizeof(double);
  2052 		    instsize = ((instsize-1) + sizeof(__DOUBLE_ALIGN)) & ~(__DOUBLE_ALIGN-1)
       
  2053 #endif
       
  2054 		    instsize += nindexedinstvars * sizeof(double);
  1999 
  2055 
  2000 		    __PROTECT_CONTEXT__
  2056 		    __PROTECT_CONTEXT__
  2001 		    __qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
  2057 		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
  2002 		    __UNPROTECT_CONTEXT__
  2058 		    __UNPROTECT_CONTEXT__
  2003 		    if (newobj == nil) {
  2059 		    if (newobj == nil) {
  2004 			break;
  2060 			break;
  2005 		    }
  2061 		    }
  2006 		    __InstPtr(newobj)->o_class = self;
  2062 		    __InstPtr(newobj)->o_class = self;
  2007 		    __qSTORE(newobj, self);
  2063 		    __qSTORE(newobj, self);
  2008 
  2064 
       
  2065 #if defined(__DOUBLE0_IS_INT0) /* knowin that double 0.0 is all-zeros */
       
  2066 # ifdef memset4
       
  2067 		    {
       
  2068 			int n4 = (instsize-OHDR_SIZE) / 4;
       
  2069 
       
  2070 			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
       
  2071 		    }
       
  2072 # else
       
  2073 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
       
  2074 # endif
       
  2075 #else
  2009 		    op = __InstPtr(newobj)->i_instvars;
  2076 		    op = __InstPtr(newobj)->i_instvars;
  2010 #if defined(DOUBLE0_IS_INT0) /* knowin that double 0.0 is all-zeros */
       
  2011 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
       
  2012 #else
       
  2013 		    while (nInstVars--)
  2077 		    while (nInstVars--)
  2014 			*op++ = nil;
  2078 			*op++ = nil;
  2015 # ifdef NEED_DOUBLE_ALIGN
  2079 
       
  2080 # ifdef __NEED_DOUBLE_ALIGN
  2016 		    /*
  2081 		    /*
  2017 		     * care for double alignment
  2082 		     * care for double alignment
  2018 		     * add filler.
  2083 		     * add filler.
  2019 		     */
  2084 		     */
  2020 		    if ((INT)op & (__ALIGN__-1)) {
  2085 		    if ((INT)op & (__DOUBLE_ALIGN-1)) {
  2021 			*op++ = nil;
  2086 			*op++ = nil;
  2022 		    }
  2087 		    }
  2023 # endif
  2088 # endif
  2024 		    dp = (double *)op;
  2089 		    dp = (double *)op;
  2025 		    while (nindexedinstvars--)
  2090 		    while (nindexedinstvars--)
  2031 		case WKPOINTERARRAY:
  2096 		case WKPOINTERARRAY:
  2032 		case POINTERARRAY:
  2097 		case POINTERARRAY:
  2033 		    nInstVars += nindexedinstvars;
  2098 		    nInstVars += nindexedinstvars;
  2034 		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
  2099 		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
  2035 		    __PROTECT_CONTEXT__
  2100 		    __PROTECT_CONTEXT__
  2036 		    __qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
  2101 		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
  2037 		    __UNPROTECT_CONTEXT__
  2102 		    __UNPROTECT_CONTEXT__
  2038 		    if (newobj == nil) {
  2103 		    if (newobj == nil) {
  2039 			break;
  2104 			break;
  2040 		    }
  2105 		    }
  2041 		    __InstPtr(newobj)->o_class = self;
  2106 		    __InstPtr(newobj)->o_class = self;
  2042 		    __qSTORE(newobj, self);
  2107 		    __qSTORE(newobj, self);
  2043 
  2108 
  2044 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  2109 #if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
  2045 		    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
  2110 		    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
  2046 #else
  2111 #else
  2047 # if !defined(NEGATIVE_ADDRESSES)
       
  2048 		    /*
  2112 		    /*
  2049 		     * knowing that nil is 0
  2113 		     * knowing that nil is 0
  2050 		     */
  2114 		     */
  2051 #ifdef XXmips
  2115 # ifdef sparc
  2052 # undef FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
  2116 #  define FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
  2053 # undef FAST_ARRAY_MEMSET_LONGLONG_UNROLLED
  2117 # endif
  2054 /* seems to be slightly faster */
  2118 
  2055 # define FAST_ARRAY_MEMSET
  2119 # if defined(FAST_ARRAY_MEMSET_DOUBLES_UNROLLED)
  2056 #endif
       
  2057 #ifdef sparc
       
  2058 # define FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
       
  2059 #endif
       
  2060 
       
  2061 #  if defined(FAST_ARRAY_MEMSET_DOUBLES_UNROLLED)
       
  2062 		    op = __InstPtr(newobj)->i_instvars;
  2120 		    op = __InstPtr(newobj)->i_instvars;
  2063 		    if (nInstVars > 8) {
  2121 		    if (nInstVars > 8) {
  2064 			*op++ = nil;    /* for alignment */
  2122 			*op++ = nil;    /* for alignment */
  2065 			nInstVars--;
  2123 			nInstVars--;
  2066 			while (nInstVars >= 8) {
  2124 			while (nInstVars >= 8) {
  2074 		    }
  2132 		    }
  2075 		    while (nInstVars) {
  2133 		    while (nInstVars) {
  2076 			*op++ = 0;
  2134 			*op++ = 0;
  2077 			nInstVars--;
  2135 			nInstVars--;
  2078 		    }
  2136 		    }
  2079 #  else
  2137 # else
  2080 #   if defined(FAST_ARRAY_MEMSET_LONGLONG_UNROLLED)
  2138 #  if defined(FAST_ARRAY_MEMSET_LONGLONG_UNROLLED)
  2081 		    op = __InstPtr(newobj)->i_instvars;
  2139 		    op = __InstPtr(newobj)->i_instvars;
  2082 		    if (nInstVars > 8) {
  2140 		    if (nInstVars > 8) {
  2083 			*op++ = nil;    /* for alignment */
  2141 			*op++ = nil;    /* for alignment */
  2084 			nInstVars--;
  2142 			nInstVars--;
  2085 			while (nInstVars >= 8) {
  2143 			while (nInstVars >= 8) {
  2093 		    }
  2151 		    }
  2094 		    while (nInstVars) {
  2152 		    while (nInstVars) {
  2095 			*op++ = 0;
  2153 			*op++ = 0;
  2096 			nInstVars--;
  2154 			nInstVars--;
  2097 		    }
  2155 		    }
       
  2156 #  else
       
  2157 #   if defined(FAST_ARRAY_MEMSET)
       
  2158 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  2098 #   else
  2159 #   else
  2099 #    if defined(FAST_ARRAY_MEMSET)
       
  2100 		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
       
  2101 #    else
       
  2102 		    op = __InstPtr(newobj)->i_instvars;
  2160 		    op = __InstPtr(newobj)->i_instvars;
  2103 		    while (nInstVars--)
  2161 		    while (nInstVars--)
  2104 			*op++ = nil;
  2162 			*op++ = nil;
  2105 #    endif
       
  2106 #   endif
  2163 #   endif
  2107 #  endif
  2164 #  endif
  2108 # else
       
  2109 		    op = __InstPtr(newobj)->i_instvars;
       
  2110 		    while (nInstVars--)
       
  2111 			*op++ = nil;
       
  2112 # endif
  2165 # endif
  2113 #endif
  2166 #endif
  2114 		    RETURN ( newobj );
  2167 		    RETURN ( newobj );
  2115 		    break;
  2168 		    break;
  2116 
  2169 
  2120 		     * n == 0
  2173 		     * n == 0
  2121 		     */
  2174 		     */
  2122 		    if (nindexedinstvars == 0) {
  2175 		    if (nindexedinstvars == 0) {
  2123 			instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
  2176 			instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
  2124 			__PROTECT_CONTEXT__
  2177 			__PROTECT_CONTEXT__
  2125 			__qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
  2178 			__qAlignedNew(newobj, instsize);        /* OBJECT ALLOCATION */
  2126 			__UNPROTECT_CONTEXT__
  2179 			__UNPROTECT_CONTEXT__
  2127 			if (newobj == nil) {
  2180 			if (newobj == nil) {
  2128 			    break;
  2181 			    break;
  2129 			}
  2182 			}
  2130 			__InstPtr(newobj)->o_class = self;
  2183 			__InstPtr(newobj)->o_class = self;
  2132 
  2185 
  2133 			if (nInstVars) {
  2186 			if (nInstVars) {
  2134 #if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
  2187 #if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
  2135 			    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
  2188 			    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
  2136 #else
  2189 #else
  2137 # if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
  2190 # if defined(FAST_MEMSET)
  2138 			    /*
  2191 			    /*
  2139 			     * knowing that nil is 0
  2192 			     * knowing that nil is 0
  2140 			     */
  2193 			     */
  2141 			    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  2194 			    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
  2142 # else
  2195 # else
  2197 
  2250 
  2198     ^ self new fromLiteralArrayEncoding:anArray.
  2251     ^ self new fromLiteralArrayEncoding:anArray.
  2199 
  2252 
  2200     "
  2253     "
  2201      Rectangle
  2254      Rectangle
  2202         decodeFromLiteralArray:#(Rectangle 10 10 100 100)
  2255 	decodeFromLiteralArray:#(Rectangle 10 10 100 100)
  2203     "
  2256     "
  2204 
  2257 
  2205     "Modified: / 28.1.1998 / 17:40:30 / cg"
  2258     "Modified: / 28.1.1998 / 17:40:30 / cg"
  2206 !
  2259 !
  2207 
  2260 
  2249      and return it. 
  2302      and return it. 
  2250      The read object must be a kind of myself if its not, an error is raised.
  2303      The read object must be a kind of myself if its not, an error is raised.
  2251      This is the reverse operation to 'storeOn:'.
  2304      This is the reverse operation to 'storeOn:'.
  2252 
  2305 
  2253      WARNING: storeOn: does not handle circular references and multiple 
  2306      WARNING: storeOn: does not handle circular references and multiple 
  2254               references to the same object.
  2307 	      references to the same object.
  2255               Use #storeBinary:/readBinaryFrom: for this."
  2308 	      Use #storeBinary:/readBinaryFrom: for this."
  2256 
  2309 
  2257     ^ self readFrom:aStream onError:[self error:'conversion error for: ' , self name]
  2310     ^ self readFrom:aStream onError:[self error:'conversion error for: ' , self name]
  2258 
  2311 
  2259     "
  2312     "
  2260      |s|
  2313      |s|
  2628 
  2681 
  2629     |coll|
  2682     |coll|
  2630 
  2683 
  2631     coll := self allInstances.
  2684     coll := self allInstances.
  2632     doWeakly ifTrue:[
  2685     doWeakly ifTrue:[
  2633         coll := WeakArray withAll:coll
  2686 	coll := WeakArray withAll:coll
  2634     ].
  2687     ].
  2635     ^ coll
  2688     ^ coll
  2636 
  2689 
  2637     "Created: / 19.6.1998 / 02:17:20 / cg"
  2690     "Created: / 19.6.1998 / 02:17:20 / cg"
  2638 !
  2691 !
  2865 
  2918 
  2866     |dict|
  2919     |dict|
  2867 
  2920 
  2868     dict := self methodDictionary.
  2921     dict := self methodDictionary.
  2869     dict isNil ifTrue:[
  2922     dict isNil ifTrue:[
  2870         ('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
  2923 	('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
  2871         ^ exceptionValue value
  2924 	^ exceptionValue value
  2872     ].
  2925     ].
  2873 
  2926 
  2874     ^ dict at:aSelector ifAbsent:exceptionValue
  2927     ^ dict at:aSelector ifAbsent:exceptionValue
  2875 
  2928 
  2876     "
  2929     "
  2893     ^ (dict keyAtValue:aMethod ifAbsent:[0]) ~~ 0
  2946     ^ (dict keyAtValue:aMethod ifAbsent:[0]) ~~ 0
  2894 
  2947 
  2895     "Modified: 12.6.1996 / 13:33:53 / stefan"
  2948     "Modified: 12.6.1996 / 13:33:53 / stefan"
  2896 !
  2949 !
  2897 
  2950 
       
  2951 firstDefinitionSelectorPart
       
  2952     "return the first part of the selector with which I was (can be) defined in my superclass"
       
  2953 
       
  2954     self isVariable ifFalse:[
       
  2955 	^ #'subclass:'
       
  2956     ].
       
  2957     self isBytes ifTrue:[
       
  2958 	^ #'variableByteSubclass:'
       
  2959     ].
       
  2960     self isLongs ifTrue:[
       
  2961 	^ #'variableLongSubclass:'
       
  2962     ].
       
  2963     self isFloats ifTrue:[
       
  2964 	^ #'variableFloatSubclass:'
       
  2965     ].
       
  2966     self isDoubles ifTrue:[
       
  2967 	^ #'variableDoubleSubclass:'
       
  2968     ].
       
  2969     self isWords ifTrue:[
       
  2970 	^ #'variableWordSubclass:'
       
  2971     ].
       
  2972     self isSignedWords ifTrue:[
       
  2973 	^ #'variableSignedWordSubclass:'
       
  2974     ].
       
  2975     self isSignedLongs ifTrue:[
       
  2976 	^ #'variableSignedLongSubclass:'
       
  2977     ].
       
  2978     self isSignedLongLongs ifTrue:[
       
  2979 	^ #'variableSignedLongLongSubclass:'
       
  2980     ].
       
  2981     self isLongLongs ifTrue:[
       
  2982 	^ #'variableLongLongSubclass:'
       
  2983     ].
       
  2984     ^ #'variableSubclass:'
       
  2985 !
       
  2986 
  2898 definitionSelector
  2987 definitionSelector
  2899     "return the selector with which I was (can be) defined in my superclass"
  2988     "return the selector with which I was (can be) defined in my superclass"
  2900 
  2989 
  2901     self isVariable ifFalse:[
  2990     ^ (self firstDefinitionSelectorPart
  2902 	^ #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
  2991       ,
  2903     ].
  2992       'instanceVariableNames:classVariableNames:poolDictionaries:category:') asSymbol
  2904     self isBytes ifTrue:[
       
  2905 	^ #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2906     ].
       
  2907     self isLongs ifTrue:[
       
  2908 	^ #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2909     ].
       
  2910     self isFloats ifTrue:[
       
  2911 	^ #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2912     ].
       
  2913     self isDoubles ifTrue:[
       
  2914 	^ #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2915     ].
       
  2916     self isWords ifTrue:[
       
  2917 	^ #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2918     ].
       
  2919     self isSignedWords ifTrue:[
       
  2920 	^ #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2921     ].
       
  2922     self isSignedLongs ifTrue:[
       
  2923 	^ #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2924     ].
       
  2925     ^ #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
       
  2926 
  2993 
  2927     "
  2994     "
  2928      Object definitionSelector
  2995      Object definitionSelector
  2929      Array definitionSelector  
  2996      Array definitionSelector  
  2930      ByteArray definitionSelector 
  2997      ByteArray definitionSelector 
  2936 
  3003 
  2937 definitionSelectorPrivate
  3004 definitionSelectorPrivate
  2938     "return the selector with which I was (can be) defined in my superclass
  3005     "return the selector with which I was (can be) defined in my superclass
  2939      as a private class"
  3006      as a private class"
  2940 
  3007 
  2941     self isVariable ifFalse:[
  3008     ^ (self firstDefinitionSelectorPart
  2942         ^ #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
  3009       ,
  2943     ].
  3010       'instanceVariableNames:classVariableNames:poolDictionaries:privateIn:') asSymbol
  2944     self isBytes ifTrue:[
       
  2945         ^ #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2946     ].
       
  2947     self isLongs ifTrue:[
       
  2948         ^ #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2949     ].
       
  2950     self isFloats ifTrue:[
       
  2951         ^ #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2952     ].
       
  2953     self isDoubles ifTrue:[
       
  2954         ^ #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2955     ].
       
  2956     self isWords ifTrue:[
       
  2957         ^ #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2958     ].
       
  2959     self isSignedWords ifTrue:[
       
  2960         ^ #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2961     ].
       
  2962     self isSignedLongs ifTrue:[
       
  2963         ^ #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2964     ].
       
  2965     ^ #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
       
  2966 
  3011 
  2967     "
  3012     "
  2968      Array definitionSelector      
  3013      Array definitionSelector      
  2969      Array definitionSelectorPrivate  
  3014      Array definitionSelectorPrivate  
  2970     "
  3015     "
  3123     "return true, if the methodDictionary of THIS class includes
  3168     "return true, if the methodDictionary of THIS class includes
  3124      a method for aSelector.
  3169      a method for aSelector.
  3125      (i.e. if aSelector is implemented in THIS class - NOT in a superclass).
  3170      (i.e. if aSelector is implemented in THIS class - NOT in a superclass).
  3126 
  3171 
  3127      Hint:
  3172      Hint:
  3128         Dont use this method to check if someone responds to a message -
  3173 	Dont use this method to check if someone responds to a message -
  3129         use #canUnderstand: on the class or #respondsTo: on the instance
  3174 	use #canUnderstand: on the class or #respondsTo: on the instance
  3130         to do this."
  3175 	to do this."
  3131 
  3176 
  3132     ^ (self methodDictionary at:aSelector ifAbsent:nil) notNil
  3177     ^ (self methodDictionary at:aSelector ifAbsent:nil) notNil
  3133 
  3178 
  3134     "
  3179     "
  3135         Object includesSelector:#==
  3180 	Object includesSelector:#==
  3136         Object includesSelector:#murks
  3181 	Object includesSelector:#murks
  3137     "
  3182     "
  3138 
  3183 
  3139     "Modified: / 7.6.1996 / 14:27:24 / stefan"
  3184     "Modified: / 7.6.1996 / 14:27:24 / stefan"
  3140     "Modified: / 16.10.1998 / 13:00:15 / cg"
  3185     "Modified: / 16.10.1998 / 13:00:15 / cg"
  3141 !
  3186 !
  3327 
  3372 
  3328     "Created: 17.3.1997 / 16:23:59 / cg"
  3373     "Created: 17.3.1997 / 16:23:59 / cg"
  3329 !
  3374 !
  3330 
  3375 
  3331 isLongs
  3376 isLongs
  3332     "return true, if instances have indexed long instance variables (4 byte ints)"
  3377     "return true, if instances have indexed long instance variables (4 byte uints)"
  3333 
  3378 
  3334 %{  /* NOCONTEXT */
  3379 %{  /* NOCONTEXT */
  3335 
  3380 
  3336     RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGARRAY)) ? true : false ); 
  3381     RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGARRAY)) ? true : false ); 
       
  3382 %}
       
  3383 !
       
  3384 
       
  3385 isLongLongs
       
  3386     "return true, if instances have indexed long-long instance variables (8 byte uints)"
       
  3387 
       
  3388 %{  /* NOCONTEXT */
       
  3389 
       
  3390     RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGLONGARRAY)) ? true : false );
  3337 %}
  3391 %}
  3338 !
  3392 !
  3339 
  3393 
  3340 isPointers
  3394 isPointers
  3341     "return true, if instances have pointer instance variables 
  3395     "return true, if instances have pointer instance variables 
  3356 	case BYTEARRAY:
  3410 	case BYTEARRAY:
  3357 	case WORDARRAY:
  3411 	case WORDARRAY:
  3358 	case LONGARRAY:
  3412 	case LONGARRAY:
  3359 	case SWORDARRAY:
  3413 	case SWORDARRAY:
  3360 	case SLONGARRAY:
  3414 	case SLONGARRAY:
       
  3415 	case SLONGLONGARRAY:
       
  3416 	case LONGLONGARRAY:
  3361 	case FLOATARRAY:
  3417 	case FLOATARRAY:
  3362 	case DOUBLEARRAY:
  3418 	case DOUBLEARRAY:
  3363 	    RETURN (false );
  3419 	    RETURN (false );
  3364 
  3420 
  3365 	case WKPOINTERARRAY:
  3421 	case WKPOINTERARRAY:
  3381     "return true, if instances have indexed signed long instance variables (4 byte ints)"
  3437     "return true, if instances have indexed signed long instance variables (4 byte ints)"
  3382 
  3438 
  3383 %{  /* NOCONTEXT */
  3439 %{  /* NOCONTEXT */
  3384 
  3440 
  3385     RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGARRAY)) ? true : false );
  3441     RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGARRAY)) ? true : false );
       
  3442 %}
       
  3443 !
       
  3444 
       
  3445 isSignedLongLongs
       
  3446     "return true, if instances have indexed signed long-long instance variables (8 byte ints)"
       
  3447 
       
  3448 %{  /* NOCONTEXT */
       
  3449 
       
  3450     RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGLONGARRAY)) ? true : false );
  3386 %}
  3451 %}
  3387 !
  3452 !
  3388 
  3453 
  3389 isSignedWords
  3454 isSignedWords
  3390     "return true, if instances have indexed signed short instance variables"
  3455     "return true, if instances have indexed signed short instance variables"
  3572 		}
  3637 		}
  3573 		break;
  3638 		break;
  3574 
  3639 
  3575 	    case WORDARRAY:
  3640 	    case WORDARRAY:
  3576 	    case SWORDARRAY:
  3641 	    case SWORDARRAY:
  3577 		nBytes += nIndex * sizeof(short);
  3642 		nBytes += nIndex * 2;
  3578 		if (nBytes & (__ALIGN__ - 1)) {
  3643 		if (nBytes & (__ALIGN__ - 1)) {
  3579 		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
  3644 		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
  3580 		}
  3645 		}
  3581 		break;
  3646 		break;
  3582 
  3647 
  3583 	    case LONGARRAY:
  3648 	    case LONGARRAY:
  3584 	    case SLONGARRAY:
  3649 	    case SLONGARRAY:
  3585 		nBytes += nIndex * sizeof(long);
  3650 		nBytes += nIndex * 4;
       
  3651 		break;
       
  3652 
       
  3653 	    case LONGLONGARRAY:
       
  3654 	    case SLONGLONGARRAY:
       
  3655 		nBytes += nIndex * 8;
  3586 		break;
  3656 		break;
  3587 
  3657 
  3588 	    case FLOATARRAY:
  3658 	    case FLOATARRAY:
  3589 		nBytes += nIndex * sizeof(float);
  3659 		nBytes += nIndex * sizeof(float);
  3590 		break;
  3660 		break;
  3750 
  3820 
  3751     |setOfSelectors|
  3821     |setOfSelectors|
  3752 
  3822 
  3753     setOfSelectors := IdentitySet new.
  3823     setOfSelectors := IdentitySet new.
  3754     methodDictionary keysAndValuesDo:[:sel :mthd |
  3824     methodDictionary keysAndValuesDo:[:sel :mthd |
  3755         (mthd referencesLiteral:someLiteralConstant) ifTrue:[
  3825 	(mthd referencesLiteral:someLiteralConstant) ifTrue:[
  3756             setOfSelectors add:sel
  3826 	    setOfSelectors add:sel
  3757         ].
  3827 	].
  3758     ].
  3828     ].
  3759 
  3829 
  3760     ^ setOfSelectors
  3830     ^ setOfSelectors
  3761 
  3831 
  3762     "
  3832     "
  3822 ! !
  3892 ! !
  3823 
  3893 
  3824 !Behavior class methodsFor:'documentation'!
  3894 !Behavior class methodsFor:'documentation'!
  3825 
  3895 
  3826 version
  3896 version
  3827     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.137 1998-10-16 13:44:22 cg Exp $'
  3897     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.138 1998-11-09 23:23:58 cg Exp $'
  3828 ! !
  3898 ! !