909 ] |
909 ] |
910 ]. |
910 ]. |
911 self normalLabel. |
911 self normalLabel. |
912 |
912 |
913 "Created: / 11.10.1997 / 16:38:29 / cg" |
913 "Created: / 11.10.1997 / 16:38:29 / cg" |
914 "Modified: / 28.10.1997 / 14:35:50 / cg" |
914 "Modified: / 5.3.1998 / 02:45:17 / cg" |
915 ! |
915 ! |
916 |
916 |
917 classCategoryFileOutBinaryEach |
917 classCategoryFileOutBinaryEach |
918 "fileOut each class in the current category as binary bytecode." |
918 "fileOut each class in the current category as binary bytecode." |
919 |
919 |
920 |mode| |
920 |mode| |
921 |
921 |
922 (currentClassCategory startsWith:'*') ifTrue:[ |
922 (currentClassCategory startsWith:$*) ifTrue:[ |
923 self warn:(resources string:'try a real category'). |
923 self warn:(resources string:'try a real category'). |
924 ^ self |
924 ^ self |
925 ]. |
925 ]. |
926 |
926 |
927 mode := Dialog choose:(resources string:'save including sources ?') |
927 mode := Dialog choose:(resources string:'save including sources ?') |
928 labels:(resources array:#('cancel' 'discard' 'by file reference' 'include source')) |
928 labels:(resources array:#('cancel' 'discard' 'by file reference' 'include source')) |
929 values:#(nil #discard #reference #keep) |
929 values:#(nil #discard #reference #keep) |
930 default:#keep. |
930 default:#keep. |
931 |
931 |
932 mode isNil ifTrue:[^ self]. |
932 mode isNil ifTrue:[^ self]. |
933 |
933 |
934 self withBusyCursorDo:[ |
934 self withBusyCursorDo:[ |
935 self allClassesInCategory:currentClassCategory do:[:aClass | |
935 self allClassesInCategory:currentClassCategory do:[:aClass | |
936 aClass isPrivate ifFalse:[ |
936 aClass isPrivate ifFalse:[ |
937 (self listOfNamespaces includesIdentical:aClass nameSpace) |
937 (self listOfNamespaces includesIdentical:aClass nameSpace) |
938 ifTrue:[ |
938 ifTrue:[ |
939 self busyLabel:'saving binary of: %1' with:aClass name. |
939 self busyLabel:'saving binary of: %1' with:aClass name. |
940 Class fileOutErrorSignal handle:[:ex | |
940 Class fileOutErrorSignal handle:[:ex | |
941 self warn:'cannot create: %1' with:ex parameter. |
941 self warn:'cannot create: %1' with:ex parameter. |
942 ex return. |
942 ex return. |
943 ] do:[ |
943 ] do:[ |
944 aClass binaryFileOutWithSourceMode:mode. |
944 aClass binaryFileOutWithSourceMode:mode. |
945 ] |
945 ] |
946 ] |
946 ] |
947 ] |
947 ] |
948 ]. |
948 ]. |
949 self normalLabel. |
949 self normalLabel. |
950 ] |
950 ] |
951 |
951 |
952 "Created: 25.1.1996 / 17:27:45 / cg" |
952 "Created: / 25.1.1996 / 17:27:45 / cg" |
953 "Modified: 18.8.1997 / 15:42:30 / cg" |
953 "Modified: / 5.3.1998 / 02:45:30 / cg" |
954 ! |
954 ! |
955 |
955 |
956 classCategoryFileOutEach |
956 classCategoryFileOutEach |
957 (currentClassCategory startsWith:'*') ifTrue:[ |
957 (currentClassCategory startsWith:$*) ifTrue:[ |
958 self warn:(resources string:'try a real category'). |
958 self warn:(resources string:'try a real category'). |
959 ^ self |
959 ^ self |
960 ]. |
960 ]. |
961 |
961 |
962 self withBusyCursorDo:[ |
962 self withBusyCursorDo:[ |
963 self allClassesInCategory:currentClassCategory do:[:aClass | |
963 self allClassesInCategory:currentClassCategory do:[:aClass | |
964 aClass isPrivate ifFalse:[ |
964 aClass isPrivate ifFalse:[ |
965 (self listOfNamespaces includesIdentical:aClass nameSpace) |
965 (self listOfNamespaces includesIdentical:aClass nameSpace) |
966 ifTrue:[ |
966 ifTrue:[ |
967 self busyLabel:'saving: %1' with:aClass name. |
967 self busyLabel:'saving: %1' with:aClass name. |
968 Class fileOutErrorSignal handle:[:ex | |
968 Class fileOutErrorSignal handle:[:ex | |
969 self warn:'cannot fileOut: %1\(%2)' with:aClass name with:ex errorString. |
969 self warn:'cannot fileOut: %1\(%2)' with:aClass name with:ex errorString. |
970 ex return. |
970 ex return. |
971 ] do:[ |
971 ] do:[ |
972 aClass fileOut |
972 aClass fileOut |
973 ] |
973 ] |
974 ] |
974 ] |
975 ] |
975 ] |
976 ]. |
976 ]. |
977 self normalLabel. |
977 self normalLabel. |
978 ] |
978 ] |
979 |
979 |
980 "Modified: 18.8.1997 / 15:42:35 / cg" |
980 "Modified: / 5.3.1998 / 02:45:38 / cg" |
981 ! |
981 ! |
982 |
982 |
983 classCategoryFindClass |
983 classCategoryFindClass |
984 "find a class - and switch by default" |
984 "find a class - and switch by default" |
985 |
985 |
4573 className ownerName s| |
4574 className ownerName s| |
4574 |
4575 |
4575 s := TextStream on:''. |
4576 s := TextStream on:''. |
4576 |
4577 |
4577 isNameSpace ifTrue:[ |
4578 isNameSpace ifTrue:[ |
4578 s nextPutAll:'Namespace name:''NewNameSpace'''. |
4579 s nextPutAll:'Namespace name:''NewNameSpace'''. |
4579 s cr; cr. |
4580 s cr; cr. |
4580 s emphasis:(self commentEmphasis). |
4581 s emphasis:(self commentEmphasis). |
4581 s nextPutAll:'" |
4582 s nextPutAll:'" |
4582 Replace ''NewNameSpace'' by the desired name. |
4583 Replace ''NewNameSpace'' by the desired name. |
4583 |
4584 |
4584 Create the namespace by ''accepting'', |
4585 Create the namespace by ''accepting'', |
4585 either via the menu or the keyboard (usually CMD-A). |
4586 either via the menu or the keyboard (usually CMD-A). |
4586 " |
4587 " |
4587 '. |
4588 '. |
4588 ^ s contents. |
4589 ^ s contents. |
4589 ]. |
4590 ]. |
4590 |
4591 |
4591 withNameSpaceDirective := |
4592 withNameSpaceDirective := |
4592 currentNamespace notNil |
4593 currentNamespace notNil |
4593 and:[currentNamespace ~= '* all *' |
4594 and:[currentNamespace ~= '* all *' |
4594 and:[currentNamespace ~= Smalltalk]]. |
4595 and:[currentNamespace ~= Smalltalk]]. |
4595 |
4596 |
4596 withNameSpaceDirective ifTrue:[ |
4597 withNameSpaceDirective ifTrue:[ |
4597 className := aSuperClass nameWithoutNameSpacePrefix. |
4598 className := aSuperClass nameWithoutNameSpacePrefix. |
4598 s nextPutAll:('"{ Namespace: ''' , currentNamespace name , ''' }"'). |
4599 s nextPutAll:('"{ Namespace: ''' , currentNamespace name , ''' }"'). |
4599 s cr; cr. |
4600 s cr; cr. |
4600 ] ifFalse:[ |
4601 ] ifFalse:[ |
4601 className := aSuperClass name. |
4602 className := aSuperClass name. |
4602 ]. |
4603 ]. |
4603 |
4604 |
4604 cat := categoryString. |
4605 cat := categoryString. |
4605 (cat isNil or:[cat startsWith:'*']) ifTrue:[ |
4606 (cat isNil or:[cat startsWith:$*]) ifTrue:[ |
4606 cat := '* no category *' |
4607 cat := '* no category *' |
4607 ]. |
4608 ]. |
4608 |
4609 |
4609 nameProto := 'NewClass'. |
4610 nameProto := 'NewClass'. |
4610 i := 1. |
4611 i := 1. |
4611 isPrivate ifTrue:[ |
4612 isPrivate ifTrue:[ |
4612 namePrefix := currentClass name , '::'. |
4613 namePrefix := currentClass name , '::'. |
4613 existingNames := currentClass privateClasses. |
4614 existingNames := currentClass privateClasses. |
4614 existingNames size > 0 ifTrue:[ |
4615 existingNames size > 0 ifTrue:[ |
4615 existingNames := existingNames collect:[:cls | cls name]. |
4616 existingNames := existingNames collect:[:cls | cls name]. |
4616 ] |
4617 ] |
4617 ] ifFalse:[ |
4618 ] ifFalse:[ |
4618 namePrefix := ''. |
4619 namePrefix := ''. |
4619 existingNames := Smalltalk keys |
4620 existingNames := Smalltalk keys |
4620 ]. |
4621 ]. |
4621 |
4622 |
4622 name := 'NewClass' , i printString. |
4623 name := 'NewClass' , i printString. |
4623 existingNames notNil ifTrue:[ |
4624 existingNames notNil ifTrue:[ |
4624 nameProto := namePrefix , name. |
4625 nameProto := namePrefix , name. |
4625 [nameProto knownAsSymbol and:[existingNames includes:nameProto asSymbol]] whileTrue:[ |
4626 [nameProto knownAsSymbol and:[existingNames includes:nameProto asSymbol]] whileTrue:[ |
4626 i := i + 1. |
4627 i := i + 1. |
4627 name := 'NewClass' , i printString. |
4628 name := 'NewClass' , i printString. |
4628 nameProto := namePrefix , name |
4629 nameProto := namePrefix , name |
4629 ]. |
4630 ]. |
4630 ]. |
4631 ]. |
4631 |
4632 |
4632 s nextPutAll:className. |
4633 s nextPutAll:className. |
4633 |
4634 |
4634 isPrivate ifTrue:[ |
4635 isPrivate ifTrue:[ |
4635 withNameSpaceDirective ifTrue:[ |
4636 withNameSpaceDirective ifTrue:[ |
4636 ownerName := currentClass nameWithoutNameSpacePrefix |
4637 ownerName := currentClass nameWithoutNameSpacePrefix |
4637 ] ifFalse:[ |
4638 ] ifFalse:[ |
4638 ownerName := currentClass name |
4639 ownerName := currentClass name |
4639 ]. |
4640 ]. |
4640 s nextPutAll:(' subclass:#' , name , ' |
4641 s nextPutAll:(' subclass:#' , name , ' |
4641 ' , ' instanceVariableNames: '''' |
4642 ' , ' instanceVariableNames: '''' |
4642 ' , ' classVariableNames: '''' |
4643 ' , ' classVariableNames: '''' |
4643 ' , ' poolDictionaries: '''' |
4644 ' , ' poolDictionaries: '''' |
4644 ' , ' privateIn:' , ownerName) |
4645 ' , ' privateIn:' , ownerName) |
4645 ] ifFalse:[ |
4646 ] ifFalse:[ |
4646 s nextPutAll:(' subclass:#' , name , ' |
4647 s nextPutAll:(' subclass:#' , name , ' |
4647 ' , ' instanceVariableNames: '''' |
4648 ' , ' instanceVariableNames: '''' |
4648 ' , ' classVariableNames: '''' |
4649 ' , ' classVariableNames: '''' |
4649 ' , ' poolDictionaries: '''' |
4650 ' , ' poolDictionaries: '''' |
4650 ' , ' category: '''). |
4651 ' , ' category: '''). |
4651 cat notNil ifTrue:[ |
4652 cat notNil ifTrue:[ |
4652 s nextPutAll: cat |
4653 s nextPutAll: cat |
4653 ]. |
4654 ]. |
4654 s nextPutAll: '''' |
4655 s nextPutAll: '''' |
4655 ]. |
4656 ]. |
4656 |
4657 |
4657 s cr; cr. |
4658 s cr; cr. |
4658 s emphasis:(self commentEmphasis). |
4659 s emphasis:(self commentEmphasis). |
4659 s nextPutAll:' |
4660 s nextPutAll:' |