Class.st
changeset 1843 15df4adc5b70
parent 1824 71889773b28b
child 1846 b7042a82eee6
equal deleted inserted replaced
1842:b28609c73839 1843:15df4adc5b70
   306 ! !
   306 ! !
   307 
   307 
   308 !Class class methodsFor:'helpers'!
   308 !Class class methodsFor:'helpers'!
   309 
   309 
   310 revisionInfoFromString:aString
   310 revisionInfoFromString:aString
       
   311     "{ Pragma: +optSpace }"
       
   312 
   311     "return a dictionary filled with revision info.
   313     "return a dictionary filled with revision info.
   312      This extracts the relevant info from aString.
   314      This extracts the relevant info from aString.
   313      For now, this is a bad design - should always ask the
   315      For now, this is a bad design - should always ask the
   314      SCM to extract the parts (knowing about the details of RCS headers
   316      SCM to extract the parts (knowing about the details of RCS headers
   315      here is a bad design ...)"
   317      here is a bad design ...)"
   370     "Created: 15.11.1995 / 14:58:35 / cg"
   372     "Created: 15.11.1995 / 14:58:35 / cg"
   371     "Modified: 13.12.1995 / 17:11:28 / cg"
   373     "Modified: 13.12.1995 / 17:11:28 / cg"
   372 !
   374 !
   373 
   375 
   374 revisionStringFromSource:aMethodSourceString
   376 revisionStringFromSource:aMethodSourceString
       
   377     "{ Pragma: +optSpace }"
       
   378 
   375     "extract a revision string from a methods source string"
   379     "extract a revision string from a methods source string"
   376 
   380 
   377     |lines line|
   381     |lines line|
   378 
   382 
   379     lines := aMethodSourceString asCollectionOfLines.
   383     lines := aMethodSourceString asCollectionOfLines.
   597      Object comment 
   601      Object comment 
   598     "
   602     "
   599 !
   603 !
   600 
   604 
   601 comment:aString
   605 comment:aString
       
   606     "{ Pragma: +optSpace }"
       
   607 
   602     "set the comment of the class to be the argument, aString;
   608     "set the comment of the class to be the argument, aString;
   603      create a change record and notify dependents."
   609      create a change record and notify dependents."
   604 
   610 
   605     |oldComment newComment|
   611     |oldComment newComment|
   606 
   612 
   651 
   657 
   652     package := aStringOrSymbol
   658     package := aStringOrSymbol
   653 !
   659 !
   654 
   660 
   655 primitiveDefinitions:aString
   661 primitiveDefinitions:aString
       
   662     "{ Pragma: +optSpace }"
       
   663 
   656     "set the primitiveDefinition string"
   664     "set the primitiveDefinition string"
   657 
   665 
   658     self setPrimitiveSpecsAt:1 to:aString.
   666     self setPrimitiveSpecsAt:1 to:aString.
   659     self addChangeRecordForPrimitiveDefinitions:self.
   667     self addChangeRecordForPrimitiveDefinitions:self.
   660 
   668 
   661     "Created: 29.10.1995 / 19:41:39 / cg"
   669     "Created: 29.10.1995 / 19:41:39 / cg"
   662 !
   670 !
   663 
   671 
   664 primitiveDefinitionsString
   672 primitiveDefinitionsString
       
   673     "{ Pragma: +optSpace }"
       
   674 
   665     "return the primitiveDefinition string or nil"
   675     "return the primitiveDefinition string or nil"
   666 
   676 
   667     ^ self getPrimitiveSpecsAt:1
   677     ^ self getPrimitiveSpecsAt:1
   668 
   678 
   669     "
   679     "
   671      String primitiveDefinitionsString
   681      String primitiveDefinitionsString
   672     "
   682     "
   673 !
   683 !
   674 
   684 
   675 primitiveFunctions:aString
   685 primitiveFunctions:aString
       
   686     "{ Pragma: +optSpace }"
       
   687 
   676     "set the primitiveFunction string"
   688     "set the primitiveFunction string"
   677 
   689 
   678     self setPrimitiveSpecsAt:3 to:aString.
   690     self setPrimitiveSpecsAt:3 to:aString.
   679     self addChangeRecordForPrimitiveFunctions:self.
   691     self addChangeRecordForPrimitiveFunctions:self.
   680 
   692 
   681     "Created: 29.10.1995 / 19:41:48 / cg"
   693     "Created: 29.10.1995 / 19:41:48 / cg"
   682 !
   694 !
   683 
   695 
   684 primitiveFunctionsString
   696 primitiveFunctionsString
       
   697     "{ Pragma: +optSpace }"
       
   698 
   685     "return the primitiveFunctions string or nil"
   699     "return the primitiveFunctions string or nil"
   686 
   700 
   687     ^ self getPrimitiveSpecsAt:3 
   701     ^ self getPrimitiveSpecsAt:3 
   688 !
   702 !
   689 
   703 
   690 primitiveSpec
   704 primitiveSpec
       
   705     "{ Pragma: +optSpace }"
       
   706 
   691     "return the primitiveSpec or nil"
   707     "return the primitiveSpec or nil"
   692 
   708 
   693     ^  primitiveSpec
   709     ^  primitiveSpec
   694 !
   710 !
   695 
   711 
   696 primitiveSpec:anArrayOf3ElementsOrNil
   712 primitiveSpec:anArrayOf3ElementsOrNil
       
   713     "{ Pragma: +optSpace }"
       
   714 
   697     "set the primitiveSpec or nil"
   715     "set the primitiveSpec or nil"
   698 
   716 
   699     primitiveSpec := anArrayOf3ElementsOrNil
   717     primitiveSpec := anArrayOf3ElementsOrNil
   700 !
   718 !
   701 
   719 
   702 primitiveVariables:aString
   720 primitiveVariables:aString
       
   721     "{ Pragma: +optSpace }"
       
   722 
   703     "set the primitiveVariable string"
   723     "set the primitiveVariable string"
   704 
   724 
   705     self setPrimitiveSpecsAt:2 to:aString.
   725     self setPrimitiveSpecsAt:2 to:aString.
   706     self addChangeRecordForPrimitiveVariables:self.
   726     self addChangeRecordForPrimitiveVariables:self.
   707 
   727 
   708     "Created: 29.10.1995 / 19:41:58 / cg"
   728     "Created: 29.10.1995 / 19:41:58 / cg"
   709 !
   729 !
   710 
   730 
   711 primitiveVariablesString
   731 primitiveVariablesString
       
   732     "{ Pragma: +optSpace }"
       
   733 
   712     "return the primitiveVariables string or nil"
   734     "return the primitiveVariables string or nil"
   713 
   735 
   714     ^ self getPrimitiveSpecsAt:2 
   736     ^ self getPrimitiveSpecsAt:2 
   715 !
   737 !
   716 
   738 
   717 privateClasses
   739 privateClasses
       
   740     "{ Pragma: +optSpace }"
       
   741 
   718     "return a collection of my private classes (if any); nil otherwise"
   742     "return a collection of my private classes (if any); nil otherwise"
   719 
   743 
   720     |classes myName|
   744     |classes myName|
   721 
   745 
   722     classes := IdentitySet new.
   746     classes := IdentitySet new.
   740 
   764 
   741     "Modified: 15.10.1996 / 11:08:01 / cg"
   765     "Modified: 15.10.1996 / 11:08:01 / cg"
   742 !
   766 !
   743 
   767 
   744 privateClassesAt:aClassNameSymbol
   768 privateClassesAt:aClassNameSymbol
       
   769     "{ Pragma: +optSpace }"
       
   770 
   745     "return a private class if present; nil otherwise"
   771     "return a private class if present; nil otherwise"
   746 
   772 
   747     |class|
   773     |class|
   748 
   774 
   749     class := self classVarAt:(':' , aClassNameSymbol) asSymbol.
   775     class := self classVarAt:(':' , aClassNameSymbol) asSymbol.
   752     "Created: 11.10.1996 / 19:05:39 / cg"
   778     "Created: 11.10.1996 / 19:05:39 / cg"
   753     "Modified: 14.10.1996 / 17:23:30 / cg"
   779     "Modified: 14.10.1996 / 17:23:30 / cg"
   754 !
   780 !
   755 
   781 
   756 privateClassesAt:aClassNameSymbol put:aClass
   782 privateClassesAt:aClassNameSymbol put:aClass
       
   783     "{ Pragma: +optSpace }"
       
   784 
   757     "return a private class if present"
   785     "return a private class if present"
   758 
   786 
   759     self classVarAt:(':' , aClassNameSymbol) asSymbol put:aClass
   787     self classVarAt:(':' , aClassNameSymbol) asSymbol put:aClass
   760 
   788 
   761     "Created: 11.10.1996 / 17:53:06 / cg"
   789     "Created: 11.10.1996 / 17:53:06 / cg"
   762     "Modified: 14.10.1996 / 17:23:36 / cg"
   790     "Modified: 14.10.1996 / 17:23:36 / cg"
   763 !
   791 !
   764 
   792 
   765 removeClassVarName:aString
   793 removeClassVarName:aString
       
   794     "{ Pragma: +optSpace }"
       
   795 
   766     "remove a class variable if not already there.
   796     "remove a class variable if not already there.
   767      Also writes a change record and notifies dependents.
   797      Also writes a change record and notifies dependents.
   768      BUG: Currently, no recompilation is done - this will change."
   798      BUG: Currently, no recompilation is done - this will change."
   769 
   799 
   770     |names newNames|
   800     |names newNames|
   780 
   810 
   781     "Created: 29.10.1995 / 19:42:08 / cg"
   811     "Created: 29.10.1995 / 19:42:08 / cg"
   782 !
   812 !
   783 
   813 
   784 renameCategory:oldCategory to:newCategory
   814 renameCategory:oldCategory to:newCategory
       
   815     "{ Pragma: +optSpace }"
       
   816 
   785     "rename a category (changes category of those methods).
   817     "rename a category (changes category of those methods).
   786      Appends a change record and notifies dependents."
   818      Appends a change record and notifies dependents."
   787 
   819 
   788     |any|
   820     |any|
   789 
   821 
   957 
   989 
   958     "Created: 29.10.1995 / 19:42:47 / cg"
   990     "Created: 29.10.1995 / 19:42:47 / cg"
   959 !
   991 !
   960 
   992 
   961 unload
   993 unload
       
   994     "{ Pragma: +optSpace }"
       
   995 
   962     "if the receiver was autoloaded, unload and reinstall it as
   996     "if the receiver was autoloaded, unload and reinstall it as
   963      autoloaded. Can be used to get rid of no longer needed autoloaded
   997      autoloaded. Can be used to get rid of no longer needed autoloaded
   964      classes. 
   998      classes. 
   965      (maybe, autoloaded classes should unload themselfes when no
   999      (maybe, autoloaded classes should unload themselfes when no
   966       longer needed - for example, after some delay when the last instance 
  1000       longer needed - for example, after some delay when the last instance 
  1422 ! !
  1456 ! !
  1423 
  1457 
  1424 !Class methodsFor:'changes management'!
  1458 !Class methodsFor:'changes management'!
  1425 
  1459 
  1426 addChangeRecordForChangeCategory
  1460 addChangeRecordForChangeCategory
       
  1461     "{ Pragma: +optSpace }"
       
  1462 
  1427     "add a category change record to the changes file"
  1463     "add a category change record to the changes file"
  1428 
  1464 
  1429     self writingChangePerform:#addChangeRecordForChangeCategory:to: with:category.
  1465     self writingChangePerform:#addChangeRecordForChangeCategory:to: with:category.
  1430 !
  1466 !
  1431 
  1467 
  1432 addChangeRecordForClass:aClass
  1468 addChangeRecordForClass:aClass
       
  1469     "{ Pragma: +optSpace }"
       
  1470 
  1433     "add a class-definition-record to the changes file"
  1471     "add a class-definition-record to the changes file"
  1434 
  1472 
  1435     self writingChangePerform:#addChangeRecordForClass:to: with:aClass.
  1473     self writingChangePerform:#addChangeRecordForClass:to: with:aClass.
  1436 !
  1474 !
  1437 
  1475 
  1438 addChangeRecordForClassCheckIn:aClass
  1476 addChangeRecordForClassCheckIn:aClass
       
  1477     "{ Pragma: +optSpace }"
       
  1478 
  1439     "append a class-was-checkedIn-record to the changes file"
  1479     "append a class-was-checkedIn-record to the changes file"
  1440 
  1480 
  1441     self addInfoRecord:('checkin ' , aClass name , ' (' , aClass revision , ')')
  1481     self addInfoRecord:('checkin ' , aClass name , ' (' , aClass revision , ')')
  1442 
  1482 
  1443     "Created: 18.11.1995 / 17:04:58 / cg"
  1483     "Created: 18.11.1995 / 17:04:58 / cg"
  1444     "Modified: 7.12.1995 / 23:45:01 / cg"
  1484     "Modified: 7.12.1995 / 23:45:01 / cg"
  1445 !
  1485 !
  1446 
  1486 
  1447 addChangeRecordForClassComment:aClass
  1487 addChangeRecordForClassComment:aClass
       
  1488     "{ Pragma: +optSpace }"
       
  1489 
  1448     "add a class-comment-record to the changes file"
  1490     "add a class-comment-record to the changes file"
  1449 
  1491 
  1450     self writingChangePerform:#addChangeRecordForClassComment:to: with:aClass.
  1492     self writingChangePerform:#addChangeRecordForClassComment:to: with:aClass.
  1451 !
  1493 !
  1452 
  1494 
  1453 addChangeRecordForClassContainerRemove:aClass
  1495 addChangeRecordForClassContainerRemove:aClass
       
  1496     "{ Pragma: +optSpace }"
       
  1497 
  1454     "append a container-was-removed-record to the changes file"
  1498     "append a container-was-removed-record to the changes file"
  1455 
  1499 
  1456     self addInfoRecord:('removed source container of ' , aClass name)
  1500     self addInfoRecord:('removed source container of ' , aClass name)
  1457 
  1501 
  1458     "Modified: 7.12.1995 / 23:45:01 / cg"
  1502     "Modified: 7.12.1995 / 23:45:01 / cg"
  1459     "Created: 11.9.1996 / 15:37:19 / cg"
  1503     "Created: 11.9.1996 / 15:37:19 / cg"
  1460 !
  1504 !
  1461 
  1505 
  1462 addChangeRecordForClassFileOut:aClass
  1506 addChangeRecordForClassFileOut:aClass
       
  1507     "{ Pragma: +optSpace }"
       
  1508 
  1463     "append a class-was-filedOut-record to the changes file"
  1509     "append a class-was-filedOut-record to the changes file"
  1464 
  1510 
  1465     self addInfoRecord:('fileOut ' , aClass name) 
  1511     self addInfoRecord:('fileOut ' , aClass name) 
  1466 !
  1512 !
  1467 
  1513 
  1468 addChangeRecordForClassInstvars:aClass
  1514 addChangeRecordForClassInstvars:aClass
       
  1515     "{ Pragma: +optSpace }"
       
  1516 
  1469     "add a class-instvars-record to the changes file"
  1517     "add a class-instvars-record to the changes file"
  1470 
  1518 
  1471     self writingChangePerform:#addChangeRecordForClassInstvars:to: with:aClass.
  1519     self writingChangePerform:#addChangeRecordForClassInstvars:to: with:aClass.
  1472 !
  1520 !
  1473 
  1521 
  1474 addChangeRecordForClassRemove:oldName
  1522 addChangeRecordForClassRemove:oldName
       
  1523     "{ Pragma: +optSpace }"
       
  1524 
  1475     "add a class-remove-record to the changes file"
  1525     "add a class-remove-record to the changes file"
  1476 
  1526 
  1477     self writingChangePerform:#addChangeRecordForClassRemove:to: with:oldName.
  1527     self writingChangePerform:#addChangeRecordForClassRemove:to: with:oldName.
  1478 !
  1528 !
  1479 
  1529 
  1480 addChangeRecordForClassRename:oldName to:newName
  1530 addChangeRecordForClassRename:oldName to:newName
       
  1531     "{ Pragma: +optSpace }"
       
  1532 
  1481     "add a class-rename-record to the changes file"
  1533     "add a class-rename-record to the changes file"
  1482 
  1534 
  1483     self writingChangeDo:[:aStream |
  1535     self writingChangeDo:[:aStream |
  1484 	self addChangeRecordForClassRename:oldName to:newName to:aStream
  1536 	self addChangeRecordForClassRename:oldName to:newName to:aStream
  1485     ]
  1537     ]
  1486 !
  1538 !
  1487 
  1539 
  1488 addChangeRecordForMethod:aMethod
  1540 addChangeRecordForMethod:aMethod
       
  1541     "{ Pragma: +optSpace }"
       
  1542 
  1489     "add a method-change-record to the changes file"
  1543     "add a method-change-record to the changes file"
  1490 
  1544 
  1491     self askIfUpdatingChanges ifTrue:[
  1545     self askIfUpdatingChanges ifTrue:[
  1492 	self writingChangePerform:#addChangeRecordForMethod:to: with:aMethod.
  1546 	self writingChangePerform:#addChangeRecordForMethod:to: with:aMethod.
  1493 	"this test allows a smalltalk without Projects/ChangeSets"
  1547 	"this test allows a smalltalk without Projects/ChangeSets"
  1496 	]
  1550 	]
  1497     ]
  1551     ]
  1498 !
  1552 !
  1499 
  1553 
  1500 addChangeRecordForMethodCategory:aMethod category:aString
  1554 addChangeRecordForMethodCategory:aMethod category:aString
       
  1555     "{ Pragma: +optSpace }"
       
  1556 
  1501     "add a methodCategory-change-record to the changes file"
  1557     "add a methodCategory-change-record to the changes file"
  1502 
  1558 
  1503     self askIfUpdatingChanges ifTrue:[
  1559     self askIfUpdatingChanges ifTrue:[
  1504 	self writingChangeDo:[:aStream |
  1560 	self writingChangeDo:[:aStream |
  1505 	    self addChangeRecordForMethodCategory:aMethod category:aString to:aStream.
  1561 	    self addChangeRecordForMethodCategory:aMethod category:aString to:aStream.
  1511 	]
  1567 	]
  1512     ]
  1568     ]
  1513 !
  1569 !
  1514 
  1570 
  1515 addChangeRecordForMethodPrivacy:aMethod
  1571 addChangeRecordForMethodPrivacy:aMethod
       
  1572     "{ Pragma: +optSpace }"
       
  1573 
  1516     "add a method-privacy-change-record to the changes file"
  1574     "add a method-privacy-change-record to the changes file"
  1517 
  1575 
  1518     self askIfUpdatingChanges ifTrue:[
  1576     self askIfUpdatingChanges ifTrue:[
  1519 	self writingChangePerform:#addChangeRecordForMethodPrivacy:to: with:aMethod.
  1577 	self writingChangePerform:#addChangeRecordForMethodPrivacy:to: with:aMethod.
  1520 	"this test allows a smalltalk without Projects/ChangeSets"
  1578 	"this test allows a smalltalk without Projects/ChangeSets"
  1525 
  1583 
  1526     "Modified: 27.8.1995 / 22:47:32 / claus"
  1584     "Modified: 27.8.1995 / 22:47:32 / claus"
  1527 !
  1585 !
  1528 
  1586 
  1529 addChangeRecordForPrimitiveDefinitions:aClass
  1587 addChangeRecordForPrimitiveDefinitions:aClass
       
  1588     "{ Pragma: +optSpace }"
       
  1589 
  1530     "add a primitiveDefinitions-record to the changes file"
  1590     "add a primitiveDefinitions-record to the changes file"
  1531 
  1591 
  1532     self askIfUpdatingChanges ifTrue:[
  1592     self askIfUpdatingChanges ifTrue:[
  1533 	self writingChangePerform:#addChangeRecordForPrimitiveDefinitions:to: with:aClass.
  1593 	self writingChangePerform:#addChangeRecordForPrimitiveDefinitions:to: with:aClass.
  1534 	Project notNil ifTrue:[
  1594 	Project notNil ifTrue:[
  1536 	]
  1596 	]
  1537     ]
  1597     ]
  1538 !
  1598 !
  1539 
  1599 
  1540 addChangeRecordForPrimitiveFunctions:aClass
  1600 addChangeRecordForPrimitiveFunctions:aClass
       
  1601     "{ Pragma: +optSpace }"
       
  1602 
  1541     "add a primitiveFunctions-record to the changes file"
  1603     "add a primitiveFunctions-record to the changes file"
  1542 
  1604 
  1543     self askIfUpdatingChanges ifTrue:[
  1605     self askIfUpdatingChanges ifTrue:[
  1544 	self writingChangePerform:#addChangeRecordForPrimitiveFunctions:to: with:aClass.
  1606 	self writingChangePerform:#addChangeRecordForPrimitiveFunctions:to: with:aClass.
  1545 	Project notNil ifTrue:[
  1607 	Project notNil ifTrue:[
  1547 	]
  1609 	]
  1548     ]
  1610     ]
  1549 !
  1611 !
  1550 
  1612 
  1551 addChangeRecordForPrimitiveVariables:aClass
  1613 addChangeRecordForPrimitiveVariables:aClass
       
  1614     "{ Pragma: +optSpace }"
       
  1615 
  1552     "add a primitiveVariables-record to the changes file"
  1616     "add a primitiveVariables-record to the changes file"
  1553 
  1617 
  1554     self askIfUpdatingChanges ifTrue:[
  1618     self askIfUpdatingChanges ifTrue:[
  1555 	self writingChangePerform:#addChangeRecordForPrimitiveVariables:to: with:aClass.
  1619 	self writingChangePerform:#addChangeRecordForPrimitiveVariables:to: with:aClass.
  1556 	Project notNil ifTrue:[
  1620 	Project notNil ifTrue:[
  1558 	]
  1622 	]
  1559     ]
  1623     ]
  1560 !
  1624 !
  1561 
  1625 
  1562 addChangeRecordForRemoveSelector:aSelector
  1626 addChangeRecordForRemoveSelector:aSelector
       
  1627     "{ Pragma: +optSpace }"
       
  1628 
  1563     "add a method-remove-record to the changes file"
  1629     "add a method-remove-record to the changes file"
  1564 
  1630 
  1565     self writingChangePerform:#addChangeRecordForRemoveSelector:to: with:aSelector.
  1631     self writingChangePerform:#addChangeRecordForRemoveSelector:to: with:aSelector.
  1566 !
  1632 !
  1567 
  1633 
  1568 addChangeRecordForRenameCategory:oldCategory to:newCategory
  1634 addChangeRecordForRenameCategory:oldCategory to:newCategory
       
  1635     "{ Pragma: +optSpace }"
       
  1636 
  1569     "add a category-rename record to the changes file"
  1637     "add a category-rename record to the changes file"
  1570 
  1638 
  1571     self writingChangeDo:[:aStream |
  1639     self writingChangeDo:[:aStream |
  1572 	self addChangeRecordForRenameCategory:oldCategory to:newCategory to:aStream.
  1640 	self addChangeRecordForRenameCategory:oldCategory to:newCategory to:aStream.
  1573     ]
  1641     ]
  1574 !
  1642 !
  1575 
  1643 
  1576 addChangeRecordForSnapshot:aFileName
  1644 addChangeRecordForSnapshot:aFileName
       
  1645     "{ Pragma: +optSpace }"
       
  1646 
  1577     "add a snapshot-record to the changes file"
  1647     "add a snapshot-record to the changes file"
  1578 
  1648 
  1579     self addInfoRecord:('snapshot ' , aFileName) 
  1649     self addInfoRecord:('snapshot ' , aFileName) 
  1580 !
  1650 !
  1581 
  1651 
  1582 addChangeRecordForSnapshot:aFileName to:aStream
  1652 addChangeRecordForSnapshot:aFileName to:aStream
       
  1653     "{ Pragma: +optSpace }"
       
  1654 
  1583     "add a snapshot-record to aStream"
  1655     "add a snapshot-record to aStream"
  1584 
  1656 
  1585     self addInfoRecord:('snapshot ' , aFileName) to:aStream
  1657     self addInfoRecord:('snapshot ' , aFileName) to:aStream
  1586 !
  1658 !
  1587 
  1659 
  1588 addChangeTimeStampTo:aStream
  1660 addChangeTimeStampTo:aStream
       
  1661     "{ Pragma: +optSpace }"
       
  1662 
  1589     "a timestamp - prepended to any change, except infoRecords"
  1663     "a timestamp - prepended to any change, except infoRecords"
  1590 
  1664 
  1591     |info|
  1665     |info|
  1592 
  1666 
  1593     info := 'timestamp ' , OperatingSystem getLoginName , '@' , OperatingSystem getHostName.
  1667     info := 'timestamp ' , OperatingSystem getLoginName , '@' , OperatingSystem getHostName.
  3046 ! !
  3120 ! !
  3047 
  3121 
  3048 !Class methodsFor:'private changes management'!
  3122 !Class methodsFor:'private changes management'!
  3049 
  3123 
  3050 addChangeRecordForChangeCategory:category to:aStream
  3124 addChangeRecordForChangeCategory:category to:aStream
       
  3125     "{ Pragma: +optSpace }"
       
  3126 
  3051     "append a category change record to aStream"
  3127     "append a category change record to aStream"
  3052 
  3128 
  3053     self printClassNameOn:aStream.
  3129     self printClassNameOn:aStream.
  3054     aStream nextPutAll:(' category:' , category storeString).
  3130     aStream nextPutAll:(' category:' , category storeString).
  3055     aStream nextPutChunkSeparator.
  3131     aStream nextPutChunkSeparator.
  3062     "Created: 3.12.1995 / 13:43:33 / cg"
  3138     "Created: 3.12.1995 / 13:43:33 / cg"
  3063     "Modified: 3.12.1995 / 14:10:34 / cg"
  3139     "Modified: 3.12.1995 / 14:10:34 / cg"
  3064 !
  3140 !
  3065 
  3141 
  3066 addChangeRecordForClass:aClass to:aStream
  3142 addChangeRecordForClass:aClass to:aStream
       
  3143     "{ Pragma: +optSpace }"
       
  3144 
  3067     "append a class-definition-record to aStream"
  3145     "append a class-definition-record to aStream"
  3068 
  3146 
  3069     aClass isLoaded ifTrue:[
  3147     aClass isLoaded ifTrue:[
  3070 	aClass fileOutDefinitionOn:aStream.
  3148 	aClass fileOutDefinitionOn:aStream.
  3071 	aStream nextPutChunkSeparator.
  3149 	aStream nextPutChunkSeparator.
  3077     "Created: 3.12.1995 / 13:57:44 / cg"
  3155     "Created: 3.12.1995 / 13:57:44 / cg"
  3078     "Modified: 3.12.1995 / 14:11:26 / cg"
  3156     "Modified: 3.12.1995 / 14:11:26 / cg"
  3079 !
  3157 !
  3080 
  3158 
  3081 addChangeRecordForClassComment:aClass to:aStream
  3159 addChangeRecordForClassComment:aClass to:aStream
       
  3160     "{ Pragma: +optSpace }"
       
  3161 
  3082     "append a class-comment-record to aStream"
  3162     "append a class-comment-record to aStream"
  3083 
  3163 
  3084     aClass fileOutCommentOn:aStream.
  3164     aClass fileOutCommentOn:aStream.
  3085 
  3165 
  3086     "Modified: 4.3.1996 / 16:49:08 / cg"
  3166     "Modified: 4.3.1996 / 16:49:08 / cg"
  3087 !
  3167 !
  3088 
  3168 
  3089 addChangeRecordForClassInstvars:aClass to:aStream
  3169 addChangeRecordForClassInstvars:aClass to:aStream
       
  3170     "{ Pragma: +optSpace }"
       
  3171 
  3090     "append a class-instvars-record to aStream"
  3172     "append a class-instvars-record to aStream"
  3091 
  3173 
  3092     aClass fileOutClassInstVarDefinitionOn:aStream.
  3174     aClass fileOutClassInstVarDefinitionOn:aStream.
  3093     aStream nextPutChunkSeparator.
  3175     aStream nextPutChunkSeparator.
  3094 !
  3176 !
  3095 
  3177 
  3096 addChangeRecordForClassRemove:oldName to:aStream
  3178 addChangeRecordForClassRemove:oldName to:aStream
       
  3179     "{ Pragma: +optSpace }"
       
  3180 
  3097     "append a class-remove-record to aStream"
  3181     "append a class-remove-record to aStream"
  3098 
  3182 
  3099     aStream nextPutAll:('Smalltalk removeClass:' , oldName).
  3183     aStream nextPutAll:('Smalltalk removeClass:' , oldName).
  3100     aStream nextPutChunkSeparator.
  3184     aStream nextPutChunkSeparator.
  3101 !
  3185 !
  3102 
  3186 
  3103 addChangeRecordForClassRename:oldName to:newName to:aStream
  3187 addChangeRecordForClassRename:oldName to:newName to:aStream
       
  3188     "{ Pragma: +optSpace }"
       
  3189 
  3104     "append a class-rename-record to aStream"
  3190     "append a class-rename-record to aStream"
  3105 
  3191 
  3106     aStream nextPutAll:('Smalltalk renameClass:' , oldName , ' to:''' , newName , '''').
  3192     aStream nextPutAll:('Smalltalk renameClass:' , oldName , ' to:''' , newName , '''').
  3107     aStream nextPutChunkSeparator.
  3193     aStream nextPutChunkSeparator.
  3108 !
  3194 !
  3109 
  3195 
  3110 addChangeRecordForMethod:aMethod to:aStream
  3196 addChangeRecordForMethod:aMethod to:aStream
       
  3197     "{ Pragma: +optSpace }"
       
  3198 
  3111     "append a method-change-record to aStream"
  3199     "append a method-change-record to aStream"
  3112 
  3200 
  3113     self fileOutMethod:aMethod on:aStream.
  3201     self fileOutMethod:aMethod on:aStream.
  3114 !
  3202 !
  3115 
  3203 
  3116 addChangeRecordForMethodCategory:aMethod category:newCategory to:aStream
  3204 addChangeRecordForMethodCategory:aMethod category:newCategory to:aStream
       
  3205     "{ Pragma: +optSpace }"
       
  3206 
  3117     "append a methodCategory-change-record to aStream"
  3207     "append a methodCategory-change-record to aStream"
  3118 
  3208 
  3119     |selector|
  3209     |selector|
  3120 
  3210 
  3121     selector := aMethod selector.
  3211     selector := aMethod selector.
  3127 	aStream nextPutChunkSeparator.
  3217 	aStream nextPutChunkSeparator.
  3128     ]
  3218     ]
  3129 !
  3219 !
  3130 
  3220 
  3131 addChangeRecordForMethodPrivacy:aMethod to:aStream
  3221 addChangeRecordForMethodPrivacy:aMethod to:aStream
       
  3222     "{ Pragma: +optSpace }"
       
  3223 
  3132     "append a method-privacy-change-record to aStream"
  3224     "append a method-privacy-change-record to aStream"
  3133 
  3225 
  3134     |selector|
  3226     |selector|
  3135 
  3227 
  3136     selector := aMethod selector.
  3228     selector := aMethod selector.
  3144 
  3236 
  3145     "Modified: 27.8.1995 / 22:59:56 / claus"
  3237     "Modified: 27.8.1995 / 22:59:56 / claus"
  3146 !
  3238 !
  3147 
  3239 
  3148 addChangeRecordForPrimitiveDefinitions:aClass to:aStream
  3240 addChangeRecordForPrimitiveDefinitions:aClass to:aStream
       
  3241     "{ Pragma: +optSpace }"
       
  3242 
  3149     "append a primitiveDefinitions-record to aStream"
  3243     "append a primitiveDefinitions-record to aStream"
  3150 
  3244 
  3151     aStream nextPutAll:aClass name; nextPutAll:' primitiveDefinitions:'''; cr; 
  3245     aStream nextPutAll:aClass name; nextPutAll:' primitiveDefinitions:'''; cr; 
  3152 	    nextPutAll:(aClass primitiveDefinitionsString storeString copyFrom:2).
  3246 	    nextPutAll:(aClass primitiveDefinitionsString storeString copyFrom:2).
  3153     aStream nextPutChunkSeparator.
  3247     aStream nextPutChunkSeparator.
  3154 !
  3248 !
  3155 
  3249 
  3156 addChangeRecordForPrimitiveFunctions:aClass to:aStream
  3250 addChangeRecordForPrimitiveFunctions:aClass to:aStream
       
  3251     "{ Pragma: +optSpace }"
       
  3252 
  3157     "append a primitiveFunctions-record to aStream"
  3253     "append a primitiveFunctions-record to aStream"
  3158 
  3254 
  3159     aStream nextPutAll:aClass name; nextPutAll:' primitiveFunctions:'''; cr; 
  3255     aStream nextPutAll:aClass name; nextPutAll:' primitiveFunctions:'''; cr; 
  3160 	    nextPutAll:(aClass primitiveFunctionsString storeString copyFrom:2).
  3256 	    nextPutAll:(aClass primitiveFunctionsString storeString copyFrom:2).
  3161     aStream nextPutChunkSeparator.
  3257     aStream nextPutChunkSeparator.
  3162 !
  3258 !
  3163 
  3259 
  3164 addChangeRecordForPrimitiveVariables:aClass to:aStream
  3260 addChangeRecordForPrimitiveVariables:aClass to:aStream
       
  3261     "{ Pragma: +optSpace }"
       
  3262 
  3165     "append a primitiveVariables-record to aStream"
  3263     "append a primitiveVariables-record to aStream"
  3166 
  3264 
  3167     aStream nextPutAll:aClass name; nextPutAll:' primitiveVariables:'''; cr; 
  3265     aStream nextPutAll:aClass name; nextPutAll:' primitiveVariables:'''; cr; 
  3168 	    nextPutAll:(aClass primitiveVariablesString storeString copyFrom:2).
  3266 	    nextPutAll:(aClass primitiveVariablesString storeString copyFrom:2).
  3169     aStream nextPutChunkSeparator.
  3267     aStream nextPutChunkSeparator.
  3170 !
  3268 !
  3171 
  3269 
  3172 addChangeRecordForRemoveSelector:aSelector to:aStream
  3270 addChangeRecordForRemoveSelector:aSelector to:aStream
       
  3271     "{ Pragma: +optSpace }"
       
  3272 
  3173     "append a method-remove-record to aStream"
  3273     "append a method-remove-record to aStream"
  3174 
  3274 
  3175     self printClassNameOn:aStream.
  3275     self printClassNameOn:aStream.
  3176     aStream nextPutAll:(' removeSelector:' , aSelector asSymbol storeString).
  3276     aStream nextPutAll:(' removeSelector:' , aSelector asSymbol storeString).
  3177     aStream nextPutChunkSeparator.
  3277     aStream nextPutChunkSeparator.
  3178 
  3278 
  3179     "Modified: 1.7.1996 / 21:27:55 / cg"
  3279     "Modified: 1.7.1996 / 21:27:55 / cg"
  3180 !
  3280 !
  3181 
  3281 
  3182 addChangeRecordForRenameCategory:oldCategory to:newCategory to:aStream
  3282 addChangeRecordForRenameCategory:oldCategory to:newCategory to:aStream
       
  3283     "{ Pragma: +optSpace }"
       
  3284 
  3183     "append a category-rename record to aStream"
  3285     "append a category-rename record to aStream"
  3184 
  3286 
  3185     self printClassNameOn:aStream.
  3287     self printClassNameOn:aStream.
  3186     aStream nextPutAll:(' renameCategory:' , oldCategory storeString).
  3288     aStream nextPutAll:(' renameCategory:' , oldCategory storeString).
  3187     aStream nextPutAll:(' to:' , newCategory storeString).
  3289     aStream nextPutAll:(' to:' , newCategory storeString).
  3188     aStream nextPutChunkSeparator.
  3290     aStream nextPutChunkSeparator.
  3189 !
  3291 !
  3190 
  3292 
  3191 addInfoRecord:aMessage to:aStream
  3293 addInfoRecord:aMessage to:aStream
       
  3294     "{ Pragma: +optSpace }"
       
  3295 
  3192     "append an info-record (snapshot, class fileOut etc.) to aStream"
  3296     "append an info-record (snapshot, class fileOut etc.) to aStream"
  3193 
  3297 
  3194     aStream nextPutAll:('''---- ' , aMessage , ' ',
  3298     aStream nextPutAll:('''---- ' , aMessage , ' ',
  3195 			Date today printString , ' ' ,
  3299 			Date today printString , ' ' ,
  3196 			Time now printString ,
  3300 			Time now printString ,
  3197 			' ----''').
  3301 			' ----''').
  3198     aStream nextPutChunkSeparator.
  3302     aStream nextPutChunkSeparator.
  3199 !
  3303 !
  3200 
  3304 
  3201 writingChangeDo:aBlock
  3305 writingChangeDo:aBlock
       
  3306     "{ Pragma: +optSpace }"
       
  3307 
  3202     "common helper to write a change record.
  3308     "common helper to write a change record.
  3203      Opens the changefile and executes aBlock passing the stream
  3309      Opens the changefile and executes aBlock passing the stream
  3204      as argument. WriteErrors are cought and will lead to a warning.
  3310      as argument. WriteErrors are cought and will lead to a warning.
  3205      The changefile is not kept open, to force the change to go to disk
  3311      The changefile is not kept open, to force the change to go to disk
  3206      as soon as possible - thus, in case of a crash, no changes should
  3312      as soon as possible - thus, in case of a crash, no changes should
  3210 
  3316 
  3211     "Modified: 18.11.1995 / 15:43:36 / cg"
  3317     "Modified: 18.11.1995 / 15:43:36 / cg"
  3212 !
  3318 !
  3213 
  3319 
  3214 writingChangePerform:aSelector with:anArgument
  3320 writingChangePerform:aSelector with:anArgument
       
  3321     "{ Pragma: +optSpace }"
       
  3322 
  3215     self writingChangeWithTimeStamp:true perform:aSelector with:anArgument
  3323     self writingChangeWithTimeStamp:true perform:aSelector with:anArgument
  3216 
  3324 
  3217     "Created: 28.10.1995 / 16:50:48 / cg"
  3325     "Created: 28.10.1995 / 16:50:48 / cg"
  3218     "Modified: 18.11.1995 / 15:44:53 / cg"
  3326     "Modified: 18.11.1995 / 15:44:53 / cg"
  3219 !
  3327 !
  3220 
  3328 
  3221 writingChangeWithTimeStamp:doStampIt do:aBlock
  3329 writingChangeWithTimeStamp:doStampIt do:aBlock
       
  3330     "{ Pragma: +optSpace }"
       
  3331 
  3222     "common helper to write a change record.
  3332     "common helper to write a change record.
  3223      Opens the changefile and executes aBlock passing the stream
  3333      Opens the changefile and executes aBlock passing the stream
  3224      as argument. WriteErrors are cought and will lead to a warning.
  3334      as argument. WriteErrors are cought and will lead to a warning.
  3225      The changefile is not kept open, to force the change to go to disk
  3335      The changefile is not kept open, to force the change to go to disk
  3226      as soon as possible - thus, in case of a crash, no changes should
  3336      as soon as possible - thus, in case of a crash, no changes should
  3246     "Created: 18.11.1995 / 15:36:02 / cg"
  3356     "Created: 18.11.1995 / 15:36:02 / cg"
  3247     "Modified: 21.3.1996 / 16:32:30 / cg"
  3357     "Modified: 21.3.1996 / 16:32:30 / cg"
  3248 !
  3358 !
  3249 
  3359 
  3250 writingChangeWithTimeStamp:stampIt perform:aSelector with:anArgument
  3360 writingChangeWithTimeStamp:stampIt perform:aSelector with:anArgument
       
  3361     "{ Pragma: +optSpace }"
       
  3362 
  3251     self writingChangeWithTimeStamp:stampIt do:[:stream |
  3363     self writingChangeWithTimeStamp:stampIt do:[:stream |
  3252 	self perform:aSelector with:anArgument with:stream.
  3364 	self perform:aSelector with:anArgument with:stream.
  3253     ]
  3365     ]
  3254 
  3366 
  3255     "Created: 18.11.1995 / 15:44:28 / cg"
  3367     "Created: 18.11.1995 / 15:44:28 / cg"
  3286     UpdateChangeFileQuerySignal isHandled ifFalse:[^ UpdatingChanges].
  3398     UpdateChangeFileQuerySignal isHandled ifFalse:[^ UpdatingChanges].
  3287     ^ UpdateChangeFileQuerySignal raise
  3399     ^ UpdateChangeFileQuerySignal raise
  3288 !
  3400 !
  3289 
  3401 
  3290 getPrimitiveSpecsAt:index
  3402 getPrimitiveSpecsAt:index
       
  3403     "{ Pragma: +optSpace }"
       
  3404 
  3291     "return a primitiveSpecification component as string or nil"
  3405     "return a primitiveSpecification component as string or nil"
  3292 
  3406 
  3293     |pos stream string|
  3407     |pos stream string|
  3294 
  3408 
  3295     primitiveSpec isNil ifTrue:[^ nil].
  3409     primitiveSpec isNil ifTrue:[^ nil].
  3313     ].
  3427     ].
  3314     ^ pos
  3428     ^ pos
  3315 !
  3429 !
  3316 
  3430 
  3317 setPrimitiveSpecsAt:index to:aString
  3431 setPrimitiveSpecsAt:index to:aString
       
  3432     "{ Pragma: +optSpace }"
       
  3433 
  3318     "set a primitiveSpecification component to aString"
  3434     "set a primitiveSpecification component to aString"
  3319 
  3435 
  3320     primitiveSpec isNil ifTrue:[
  3436     primitiveSpec isNil ifTrue:[
  3321 	primitiveSpec := Array new:3
  3437 	primitiveSpec := Array new:3
  3322     ].
  3438     ].
  3324 ! !
  3440 ! !
  3325 
  3441 
  3326 !Class methodsFor:'protocol printOut'!
  3442 !Class methodsFor:'protocol printOut'!
  3327 
  3443 
  3328 printOutCategoryProtocol:aCategory on:aPrintStream
  3444 printOutCategoryProtocol:aCategory on:aPrintStream
       
  3445     "{ Pragma: +optSpace }"
       
  3446 
  3329     |dict any|
  3447     |dict any|
  3330 
  3448 
  3331     dict := self methodDictionary.
  3449     dict := self methodDictionary.
  3332     dict notNil ifTrue:[
  3450     dict notNil ifTrue:[
  3333         any := false.
  3451         any := false.
  3354     "Modified: 20.4.1996 / 18:20:26 / cg"
  3472     "Modified: 20.4.1996 / 18:20:26 / cg"
  3355     "Modified: 12.6.1996 / 11:48:46 / stefan"
  3473     "Modified: 12.6.1996 / 11:48:46 / stefan"
  3356 !
  3474 !
  3357 
  3475 
  3358 printOutMethodProtocol:aMethod on:aPrintStream
  3476 printOutMethodProtocol:aMethod on:aPrintStream
       
  3477     "{ Pragma: +optSpace }"
       
  3478 
  3359     "given the source in aString, print the methods message specification
  3479     "given the source in aString, print the methods message specification
  3360      and any method comments - without source; used to generate documentation
  3480      and any method comments - without source; used to generate documentation
  3361      pages"
  3481      pages"
  3362 
  3482 
  3363     |text comment|
  3483     |text comment|
  3384     "Modified: 20.4.1996 / 17:54:50 / cg"
  3504     "Modified: 20.4.1996 / 17:54:50 / cg"
  3385     "Created: 20.4.1996 / 18:20:31 / cg"
  3505     "Created: 20.4.1996 / 18:20:31 / cg"
  3386 !
  3506 !
  3387 
  3507 
  3388 printOutProtocolOn:aPrintStream
  3508 printOutProtocolOn:aPrintStream
       
  3509     "{ Pragma: +optSpace }"
       
  3510 
  3389     |collectionOfCategories|
  3511     |collectionOfCategories|
  3390 
  3512 
  3391     self printOutDefinitionOn:aPrintStream.
  3513     self printOutDefinitionOn:aPrintStream.
  3392     aPrintStream cr.
  3514     aPrintStream cr.
  3393     collectionOfCategories := self class categories.
  3515     collectionOfCategories := self class categories.
  3563     "Created: 7.12.1995 / 10:58:47 / cg"
  3685     "Created: 7.12.1995 / 10:58:47 / cg"
  3564     "Modified: 15.10.1996 / 18:55:28 / cg"
  3686     "Modified: 15.10.1996 / 18:55:28 / cg"
  3565 !
  3687 !
  3566 
  3688 
  3567 packageSourceCodeInfo
  3689 packageSourceCodeInfo
       
  3690     "{ Pragma: +optSpace }"
       
  3691 
  3568     "return the sourceCodeInfo, which defines the module and the subdirectory
  3692     "return the sourceCodeInfo, which defines the module and the subdirectory
  3569      in which the receiver class was built. 
  3693      in which the receiver class was built. 
  3570      This info is extracted from the package id (which is added to stc-compiled classes).
  3694      This info is extracted from the package id (which is added to stc-compiled classes).
  3571      This method is to be obsoleted soon, since the same info is now found
  3695      This method is to be obsoleted soon, since the same info is now found
  3572      in the versionString.
  3696      in the versionString.
  3750     "Created: 11.11.1995 / 14:27:20 / cg"
  3874     "Created: 11.11.1995 / 14:27:20 / cg"
  3751     "Modified: 15.10.1996 / 18:56:44 / cg"
  3875     "Modified: 15.10.1996 / 18:56:44 / cg"
  3752 !
  3876 !
  3753 
  3877 
  3754 revisionString
  3878 revisionString
       
  3879     "{ Pragma: +optSpace }"
       
  3880 
  3755     "return my revision string; that one is extracted from the
  3881     "return my revision string; that one is extracted from the
  3756      classes #version method. Either this is a method returning that string,
  3882      classes #version method. Either this is a method returning that string,
  3757      or its a comment-only method and the comment defines the version.
  3883      or its a comment-only method and the comment defines the version.
  3758      If the source is not accessable or no such method exists,
  3884      If the source is not accessable or no such method exists,
  3759      nil is returned."
  3885      nil is returned."
  3819 
  3945 
  3820     "Created: 9.12.1995 / 17:05:17 / cg"
  3946     "Created: 9.12.1995 / 17:05:17 / cg"
  3821 !
  3947 !
  3822 
  3948 
  3823 setPackageFromRevision
  3949 setPackageFromRevision
       
  3950     "{ Pragma: +optSpace }"
       
  3951 
  3824     "set my package from the info found in the revisionString if present.
  3952     "set my package from the info found in the revisionString if present.
  3825      This is used to set some useful packageInfo after autoloading
  3953      This is used to set some useful packageInfo after autoloading
  3826      (otherwise, autoloaded classes/methods would go into your current
  3954      (otherwise, autoloaded classes/methods would go into your current
  3827       package - which is probably not a good idea)"
  3955       package - which is probably not a good idea)"
  3828 
  3956 
  4002     "Created: 10.11.1995 / 21:05:13 / cg"
  4130     "Created: 10.11.1995 / 21:05:13 / cg"
  4003     "Modified: 18.10.1996 / 13:28:29 / cg"
  4131     "Modified: 18.10.1996 / 13:28:29 / cg"
  4004 !
  4132 !
  4005 
  4133 
  4006 updateVersionMethodFor:newRevisionString
  4134 updateVersionMethodFor:newRevisionString
       
  4135     "{ Pragma: +optSpace }"
       
  4136 
  4007     "helper for the checkin procedure.
  4137     "helper for the checkin procedure.
  4008      Update my #version method, to now return newRevisionString."
  4138      Update my #version method, to now return newRevisionString."
  4009 
  4139 
  4010     |cls "vs m mgr"|
  4140     |cls "vs m mgr"|
  4011 
  4141 
  4123 ! !
  4253 ! !
  4124 
  4254 
  4125 !Class class methodsFor:'documentation'!
  4255 !Class class methodsFor:'documentation'!
  4126 
  4256 
  4127 version
  4257 version
  4128     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.198 1996-10-27 11:37:00 cg Exp $'
  4258     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.199 1996-10-29 23:37:41 cg Exp $'
  4129 ! !
  4259 ! !
  4130 Class initialize!
  4260 Class initialize!