=============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory | - newCategory := catString asSymbol. + newCategory := (self sanitizeName: catString) asSymbol. (categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default] - ifFalse: [heading asSymbol]. + ifFalse: [(self sanitizeName: heading) asSymbol]. (catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) <= (categoryStops at: catIndex) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default]. self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i | - i := categoryArray indexOf: categoryName ifAbsent: [^Array new]. + i := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new]. ^self listAtCategoryNumber: i
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop | - index := categoryArray indexOf: cat ifAbsent: [^self]. + index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self]. lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory | - oldCategory := oldCatString asSymbol. - newCategory := newCatString asSymbol. + oldCategory := (self sanitizeName: oldCatString) asSymbol. + newCategory := (self sanitizeName: newCatString) asSymbol. (categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategory
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13 + sanitizeName: aString + + ^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory]; - protocolAdded: catString inClass: self subject + protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat]; - protocolRemoved: cat inClass: self subject + protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString]; - protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject. - self logSelectorsInChangedCategory: newCatString. + protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject. + self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse: - [PackageInfo registerPackageName: name. + [name := (PackageInfo registerPackageName: name) name. workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0]. self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString - ^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register] + ^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24 + sanitizeName: aString + ^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString - packageName := aString + packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock - ^ packages at: aString ifAbsent: errorBlock + ^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock - ^ packages at: aString ifPresent: aBlock + ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock - ^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock + ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames. + ^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
--- Sent from Squeak Inbox Talk ["sanitize-cat-names.1.cs"]
Hmm... where does the term "sanitize" come from? I would use "normalize" for that... Am 15.08.2023 12:30:44 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: =============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory | - newCategory := catString asSymbol. + newCategory := (self sanitizeName: catString) asSymbol. (categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default] - ifFalse: [heading asSymbol]. + ifFalse: [(self sanitizeName: heading) asSymbol]. (catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) <= (categoryStops at: catIndex) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default]. self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i | - i := categoryArray indexOf: categoryName ifAbsent: [^Array new]. + i := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new]. ^self listAtCategoryNumber: i
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop | - index := categoryArray indexOf: cat ifAbsent: [^self]. + index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self]. lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory | - oldCategory := oldCatString asSymbol. - newCategory := newCatString asSymbol. + oldCategory := (self sanitizeName: oldCatString) asSymbol. + newCategory := (self sanitizeName: newCatString) asSymbol. (categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategory
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13 + sanitizeName: aString + + ^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory]; - protocolAdded: catString inClass: self subject + protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat]; - protocolRemoved: cat inClass: self subject + protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString]; - protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject. - self logSelectorsInChangedCategory: newCatString. + protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject. + self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse: - [PackageInfo registerPackageName: name. + [name := (PackageInfo registerPackageName: name) name. workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0]. self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString - ^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register] + ^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24 + sanitizeName: aString + ^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString - packageName := aString + packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock - ^ packages at: aString ifAbsent: errorBlock + ^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock - ^ packages at: aString ifPresent: aBlock + ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock - ^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock + ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames. + ^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] ["sanitize-cat-names.1.cs"]
Sanitize is typically used to remove "dangerous" items (ie, characters). The term is commonly used in string processing. Normalization suggests there is a "normal form" (eg, "all login names shall be lowercase") as opposed to "error avoidance" (eg, "no login name shall use underscores").
(thus, sanitation would turn "hans_wurst" into, maybe "hans.wurst", normalization would turn "HansWurst" into "hanswurst")
yes, there's an overlap.
-t
On 15. Aug 2023, at 14:36, Marcel Taeumel via Squeak-dev squeak-dev@lists.squeakfoundation.org wrote:
Hmm... where does the term "sanitize" come from? I would use "normalize" for that...
Am 15.08.2023 12:30:44 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: =============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory |
newCategory := catString asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]newCategory := (self sanitizeName: catString) asSymbol.
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default]
ifFalse: [heading asSymbol].
ifFalse: [(self sanitizeName: heading) asSymbol].
(catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) <= (categoryStops at: catIndex) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default].
self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i |
i := categoryArray indexOf: categoryName ifAbsent: [^Array new].
^self listAtCategoryNumber: ii := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new].
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop |
index := categoryArray indexOf: cat ifAbsent: [^self].
lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self].
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory |
oldCategory := oldCatString asSymbol.
newCategory := newCatString asSymbol.
oldCategory := (self sanitizeName: oldCatString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategorynewCategory := (self sanitizeName: newCatString) asSymbol.
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13
- sanitizeName: aString
^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory];
protocolAdded: catString inClass: self subject
protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat];
protocolRemoved: cat inClass: self subject
protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString];
protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject.
self logSelectorsInChangedCategory: newCatString.
protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject.
self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse:
[PackageInfo registerPackageName: name.
self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.[name := (PackageInfo registerPackageName: name) name. workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0].
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString
^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register]
^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24
- sanitizeName: aString
^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString
packageName := aString
packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock
^ packages at: aString ifAbsent: errorBlock
^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock
^ packages at: aString ifPresent: aBlock
^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock
^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock
^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames.
^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
Sent from Squeak Inbox Talk ["sanitize-cat-names.1.cs"]
On 2023-08-15, at 7:01 AM, Tobias Pape Das.Linux@gmx.de wrote:
Sanitize is typically used to remove "dangerous" items (ie, characters). The term is commonly used in string processing. Normalization suggests there is a "normal form" (eg, "all login names shall be lowercase") as opposed to "error avoidance" (eg, "no login name shall use underscores").
(thus, sanitation would turn "hans_wurst" into, maybe "hans.wurst", normalization would turn "HansWurst" into "hanswurst")
yes, there's an overlap.
Just what I was about to say. I +1 the proposal
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Life would be much easier if I had the source code.
Ah, nice. +1 then :-)
Best, Marcel Am 15.08.2023 16:01:47 schrieb Tobias Pape das.linux@gmx.de: Sanitize is typically used to remove "dangerous" items (ie, characters). The term is commonly used in string processing. Normalization suggests there is a "normal form" (eg, "all login names shall be lowercase") as opposed to "error avoidance" (eg, "no login name shall use underscores").
(thus, sanitation would turn "hans_wurst" into, maybe "hans.wurst", normalization would turn "HansWurst" into "hanswurst")
yes, there's an overlap.
-t
On 15. Aug 2023, at 14:36, Marcel Taeumel via Squeak-dev wrote:
Hmm... where does the term "sanitize" come from? I would use "normalize" for that...
Am 15.08.2023 12:30:44 schrieb christoph.thiede@student.hpi.uni-potsdam.de : =============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory |
- newCategory := catString asSymbol.
- newCategory := (self sanitizeName: catString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default]
- ifFalse: [heading asSymbol].
- ifFalse: [(self sanitizeName: heading) asSymbol].
(catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default].
self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i |
- i := categoryArray indexOf: categoryName ifAbsent: [^Array new].
- i := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new].
^self listAtCategoryNumber: i
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop |
- index := categoryArray indexOf: cat ifAbsent: [^self].
- index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self].
lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory |
- oldCategory := oldCatString asSymbol.
- newCategory := newCatString asSymbol.
- oldCategory := (self sanitizeName: oldCatString) asSymbol.
- newCategory := (self sanitizeName: newCatString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategory
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13
- sanitizeName: aString
- ^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory];
- protocolAdded: catString inClass: self subject
- protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat];
- protocolRemoved: cat inClass: self subject
- protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString];
- protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: newCatString.
- protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse:
- [PackageInfo registerPackageName: name.
- [name := (PackageInfo registerPackageName: name) name.
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0]. self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString
- ^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register]
- ^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24
- sanitizeName: aString
- ^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString
- packageName := aString
- packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock
- ^ packages at: aString ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock
- ^ packages at: aString ifPresent: aBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames.
- ^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
Sent from Squeak Inbox Talk ["sanitize-cat-names.1.cs"]
Thanks! Merged via Kernel-ct.1521 & Kernel-ct.1522 et al. (with a new configuration in between to avoid using #sanitizeName: before it is installed). Hope I did not do anything wrong with the update map! :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2023-08-17T12:44:55+02:00, marcel.taeumel@hpi.de wrote:
Ah, nice. +1 then :-)
Best, Marcel Am 15.08.2023 16:01:47 schrieb Tobias Pape <das.linux(a)gmx.de>: Sanitize is typically used to remove "dangerous" items (ie, characters). The term is commonly used in string processing. Normalization suggests there is a "normal form" (eg, "all login names shall be lowercase") as opposed to "error avoidance" (eg, "no login name shall use underscores").
(thus, sanitation would turn "hans_wurst" into, maybe "hans.wurst", normalization would turn "HansWurst" into "hanswurst")
yes, there's an overlap.
-t
On 15. Aug 2023, at 14:36, Marcel Taeumel via Squeak-dev wrote:
Hmm... where does the term "sanitize" come from? I would use "normalize" for that...
Am 15.08.2023 12:30:44 schrieb christoph.thiede(a)student.hpi.uni-potsdam.de : =============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory |
- newCategory := catString asSymbol.
- newCategory := (self sanitizeName: catString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default]
- ifFalse: [heading asSymbol].
- ifFalse: [(self sanitizeName: heading) asSymbol].
(catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default].
self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i |
- i := categoryArray indexOf: categoryName ifAbsent: [^Array new].
- i := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new].
^self listAtCategoryNumber: i
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop |
- index := categoryArray indexOf: cat ifAbsent: [^self].
- index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self].
lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory |
- oldCategory := oldCatString asSymbol.
- newCategory := newCatString asSymbol.
- oldCategory := (self sanitizeName: oldCatString) asSymbol.
- newCategory := (self sanitizeName: newCatString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategory
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13
- sanitizeName: aString
- ^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory];
- protocolAdded: catString inClass: self subject
- protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat];
- protocolRemoved: cat inClass: self subject
- protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString];
- protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: newCatString.
- protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse:
- [PackageInfo registerPackageName: name.
- [name := (PackageInfo registerPackageName: name) name.
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0]. self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString
- ^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register]
- ^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24
- sanitizeName: aString
- ^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString
- packageName := aString
- packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock
- ^ packages at: aString ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock
- ^ packages at: aString ifPresent: aBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames.
- ^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
Sent from Squeak Inbox Talk ["sanitize-cat-names.1.cs"]
Hope I did not do anything wrong with the update map! :-)
As long as you hit "update from repositories" before uploading that new version of the update map, we should be fine.
Best, Marcel Am 17.08.2023 13:54:29 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Thanks! Merged via Kernel-ct.1521 & Kernel-ct.1522 et al. (with a new configuration in between to avoid using #sanitizeName: before it is installed). Hope I did not do anything wrong with the update map! :-)
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2023-08-17T12:44:55+02:00, marcel.taeumel@hpi.de wrote:
Ah, nice. +1 then :-)
Best, Marcel Am 15.08.2023 16:01:47 schrieb Tobias Pape <das.linux(a)gmx.de>: Sanitize is typically used to remove "dangerous" items (ie, characters). The term is commonly used in string processing. Normalization suggests there is a "normal form" (eg, "all login names shall be lowercase") as opposed to "error avoidance" (eg, "no login name shall use underscores").
(thus, sanitation would turn "hans_wurst" into, maybe "hans.wurst", normalization would turn "HansWurst" into "hanswurst")
yes, there's an overlap.
-t
On 15. Aug 2023, at 14:36, Marcel Taeumel via Squeak-dev wrote:
Hmm... where does the term "sanitize" come from? I would use "normalize" for that...
Am 15.08.2023 12:30:44 schrieb christoph.thiede(a)student.hpi.uni-potsdam.de : =============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory |
- newCategory := catString asSymbol.
- newCategory := (self sanitizeName: catString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default]
- ifFalse: [heading asSymbol].
- ifFalse: [(self sanitizeName: heading) asSymbol].
(catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default].
self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i |
- i := categoryArray indexOf: categoryName ifAbsent: [^Array new].
- i := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new].
^self listAtCategoryNumber: i
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop |
- index := categoryArray indexOf: cat ifAbsent: [^self].
- index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self].
lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory |
- oldCategory := oldCatString asSymbol.
- newCategory := newCatString asSymbol.
- oldCategory := (self sanitizeName: oldCatString) asSymbol.
- newCategory := (self sanitizeName: newCatString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategory
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13
- sanitizeName: aString
- ^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory];
- protocolAdded: catString inClass: self subject
- protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat];
- protocolRemoved: cat inClass: self subject
- protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString];
- protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: newCatString.
- protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse:
- [PackageInfo registerPackageName: name.
- [name := (PackageInfo registerPackageName: name) name.
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0]. self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString
- ^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register]
- ^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24
- sanitizeName: aString
- ^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString
- packageName := aString
- packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock
- ^ packages at: aString ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock
- ^ packages at: aString ifPresent: aBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames.
- ^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
Sent from Squeak Inbox Talk ["sanitize-cat-names.1.cs"]
As long as you hit "update from repositories" before uploading that new version of the update map, we should be fine.
Oh no! I forgot that! But updating an older image for me worked anyway ... Maybe Monticello loads the changes differently than changeset file-ins. Or should I edit the existing configuration?
Best, Christoph
________________________________ Von: Marcel Taeumel via Squeak-dev squeak-dev@lists.squeakfoundation.org Gesendet: Donnerstag, 17. August 2023 16:22:33 An: gettimothy via Squeak-dev Cc: Taeumel, Marcel Betreff: [squeak-dev] Re: Review Request: sanitize-cat-names.1.cs
Hope I did not do anything wrong with the update map! :-)
As long as you hit "update from repositories" before uploading that new version of the update map, we should be fine.
Best, Marcel
Am 17.08.2023 13:54:29 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de:
Thanks! Merged via Kernel-ct.1521 & Kernel-ct.1522 et al. (with a new configuration in between to avoid using #sanitizeName: before it is installed). Hope I did not do anything wrong with the update map! :-)
Best, Christoph
--- Sent from Squeak Inbox Talkhttps://github.com/hpi-swa-lab/squeak-inbox-talk
On 2023-08-17T12:44:55+02:00, marcel.taeumel@hpi.de wrote:
Ah, nice. +1 then :-)
Best, Marcel Am 15.08.2023 16:01:47 schrieb Tobias Pape <das.linux(a)gmx.de>: Sanitize is typically used to remove "dangerous" items (ie, characters). The term is commonly used in string processing. Normalization suggests there is a "normal form" (eg, "all login names shall be lowercase") as opposed to "error avoidance" (eg, "no login name shall use underscores").
(thus, sanitation would turn "hans_wurst" into, maybe "hans.wurst", normalization would turn "HansWurst" into "hanswurst")
yes, there's an overlap.
-t
On 15. Aug 2023, at 14:36, Marcel Taeumel via Squeak-dev wrote:
Hmm... where does the term "sanitize" come from? I would use "normalize" for that...
Am 15.08.2023 12:30:44 schrieb christoph.thiede(a)student.hpi.uni-potsdam.de : =============== Summary ===============
Change Set: sanitize-cat-names Date: 15 August 2023 Author: Christoph Thiede
Sanitizes names of categories and packages by removing leading/trailing blanks before construction/lookup. This fixes a bug with invisible categories in the tree browser. Answer new package from PackageOrganizer>>#registerPackage*. Recategorize PackageServices.
=============== Postscript ===============
PackageServices initialize
=============== Diff ===============
Categorizer>>addCategory:before: {accessing} · ct 8/15/2023 12:14 (changed) addCategory: catString before: nextCategory "Add a new category named heading. If default category exists and is empty, remove it. If nextCategory is nil, then add the new one at the end, otherwise, insert it before nextCategory." | index newCategory |
- newCategory := catString asSymbol.
- newCategory := (self sanitizeName: catString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^self]. "heading already exists, so done" (self isSpecialCategoryName: newCategory) ifTrue: [^self inform: 'This category name is system reserved' translated]. index := categoryArray indexOf: nextCategory ifAbsent: [categoryArray size + 1]. categoryArray := categoryArray copyReplaceFrom: index to: index-1 with: (Array with: newCategory). categoryStops := categoryStops copyReplaceFrom: index to: index-1 with: (Array with: (index = 1 ifTrue: [0] ifFalse: [categoryStops at: index-1])). "remove empty default category" (newCategory ~= Default and: [(self listAtCategoryNamed: Default) isEmpty]) ifTrue: [self removeCategory: Default]
Categorizer>>classify:under:suppressIfDefault: {classifying} · ct 8/15/2023 12:15 (changed) classify: element under: heading suppressIfDefault: aBoolean "Store the argument, element, in the category named heading. If aBoolean is true, then invoke special logic such that the classification is NOT done if the new heading is the Default and the element already had a non-Default classification -- useful for filein"
| catName catIndex elemIndex realHeading | realHeading := (heading isEmptyOrNil or: [self isSpecialCategoryName: heading]) ifTrue: [Default]
- ifFalse: [heading asSymbol].
- ifFalse: [(self sanitizeName: heading) asSymbol].
(catName := self categoryOfElement: element) = realHeading ifTrue: [^ self]. "done if already under that category"
catName ifNotNil: [ (aBoolean and: [realHeading = Default]) ifTrue: [^ self]. "return if non-Default category already assigned in memory" self basicRemoveElement: element]. "remove if in another category"
(categoryArray indexOf: realHeading) = 0 ifTrue: [self addCategory: realHeading].
catIndex := categoryArray indexOf: realHeading. elemIndex := catIndex > 1 ifTrue: [categoryStops at: catIndex - 1] ifFalse: [0]. [(elemIndex := elemIndex + 1) and: [element >= (elementArray at: elemIndex)]] whileTrue.
"elemIndex is now the index for inserting the element. Do the insertion before it." elementArray := elementArray copyReplaceFrom: elemIndex to: elemIndex-1 with: (Array with: element).
"add one to stops for this and later categories" catIndex to: categoryArray size do: [:i | categoryStops at: i put: (categoryStops at: i) + 1].
((categoryArray includes: Default) and: [(self listAtCategoryNamed: Default) size = 0]) ifTrue: [self removeCategory: Default].
self assertInvariant.
Categorizer>>listAtCategoryNamed: {accessing} · ct 8/15/2023 12:14 (changed) listAtCategoryNamed: categoryName "Answer the array of elements associated with the name, categoryName."
| i |
- i := categoryArray indexOf: categoryName ifAbsent: [^Array new].
- i := categoryArray indexOf: (self sanitizeName: categoryName) ifAbsent: [^Array new].
^self listAtCategoryNumber: i
Categorizer>>removeCategory: {accessing} · ct 8/15/2023 12:14 (changed) removeCategory: cat "Remove the category named, cat. Create an error notificiation if the category has any elements in it."
| index lastStop |
- index := categoryArray indexOf: cat ifAbsent: [^self].
- index := categoryArray indexOf: (self sanitizeName: cat) ifAbsent: [^self].
lastStop := index = 1 ifTrue: [0] ifFalse: [categoryStops at: index - 1]. (categoryStops at: index) - lastStop > 0 ifTrue: [^self error: 'cannot remove non-empty category']. categoryArray := categoryArray copyReplaceFrom: index to: index with: Array new. categoryStops := categoryStops copyReplaceFrom: index to: index with: Array new. categoryArray size = 0 ifTrue: [categoryArray := Array with: Default. categoryStops := Array with: 0]
Categorizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:14 (changed) renameCategory: oldCatString toBe: newCatString "Rename a category. No action if new name already exists, or if old name does not exist." | index oldCategory newCategory |
- oldCategory := oldCatString asSymbol.
- newCategory := newCatString asSymbol.
- oldCategory := (self sanitizeName: oldCatString) asSymbol.
- newCategory := (self sanitizeName: newCatString) asSymbol.
(categoryArray indexOf: newCategory) > 0 ifTrue: [^ self]. "new name exists, so no action" (index := categoryArray indexOf: oldCategory) = 0 ifTrue: [^ self]. "old name not found, so no action" categoryArray := categoryArray copy. "need to change identity so smart list update will notice the change" categoryArray at: index put: newCategory
Categorizer>>sanitizeName: {private} · ct 8/15/2023 12:13
- sanitizeName: aString
- ^ aString withBlanksTrimmed
ClassOrganizer>>addCategory:before: {accessing} · ct 8/15/2023 12:21 (changed) addCategory: catString before: nextCategory SystemChangeNotifier uniqueInstance doSilently: [super addCategory: catString before: nextCategory];
- protocolAdded: catString inClass: self subject
- protocolAdded: (self sanitizeName: catString) inClass: self subject
ClassOrganizer>>removeCategory: {accessing} · ct 8/15/2023 12:20 (changed) removeCategory: cat SystemChangeNotifier uniqueInstance doSilently: [super removeCategory: cat];
- protocolRemoved: cat inClass: self subject
- protocolRemoved: (self sanitizeName: cat) inClass: self subject
ClassOrganizer>>renameCategory:toBe: {accessing} · ct 8/15/2023 12:20 (changed) renameCategory: oldCatString toBe: newCatString SystemChangeNotifier uniqueInstance doSilently: [super renameCategory: oldCatString toBe: newCatString];
- protocolRenamedFrom: oldCatString asSymbol to: newCatString asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: newCatString.
- protocolRenamedFrom: (self sanitizeName: oldCatString) asSymbol to: (self sanitizeName: newCatString) asSymbol inClass: self subject.
- self logSelectorsInChangedCategory: (self sanitizeName: newCatString).
MCWorkingCopyBrowser>>addWorkingCopy {actions} · ct 8/15/2023 12:11 (changed) addWorkingCopy |name| name := Project uiManager request: 'Name of package:' translated. name isEmptyOrNil ifFalse:
- [PackageInfo registerPackageName: name.
- [name := (PackageInfo registerPackageName: name) name.
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: name). workingCopyWrapper := nil. self repositorySelection: 0]. self workingCopyListChanged; changed: #workingCopySelection; changed: #repositoryList. self changedButtons.
PackageInfo class>>named: {packages access} · ct 8/15/2023 12:25 (changed) named: aString
- ^ Environment current packageOrganizer packageNamed: aString ifAbsent: [(self new packageName: aString) register]
- ^ Environment current packageOrganizer packageNamed: (self sanitizeName: aString) ifAbsent: [(self new packageName: aString) register]
PackageInfo class>>sanitizeName: {private} · ct 8/15/2023 12:24
- sanitizeName: aString
- ^ aString withBlanksTrimmed
PackageInfo>>packageName: {naming} · ct 8/15/2023 12:24 (changed) packageName: aString
- packageName := aString
- packageName := (self class sanitizeName: aString)
PackageOrganizer>>packageNamed:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifAbsent: errorBlock
- ^ packages at: aString ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifAbsent: errorBlock
PackageOrganizer>>packageNamed:ifPresent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock
- ^ packages at: aString ifPresent: aBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock
PackageOrganizer>>packageNamed:ifPresent:ifAbsent: {searching} · ct 8/15/2023 12:24 (changed) packageNamed: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: aString ifPresent: aBlock ifAbsent: errorBlock
- ^ packages at: (PackageInfo sanitizeName: aString) ifPresent: aBlock ifAbsent: errorBlock
PackageOrganizer>>registerPackage: {registering} · ct 8/15/2023 12:11 (changed) registerPackage: aPackageInfo packages at: aPackageInfo packageName put: aPackageInfo. self changed: #packages; changed: #packageNames.
- ^ aPackageInfo
PackageServices class>>allServices {services} · avi 10/11/2003 13:01 (changed and recategorized) allServices ^ ServiceClasses gather: [:ea | ea services]
PackageServices class>>initialize {class initialization} · avi 10/11/2003 12:59 (changed and recategorized) initialize ServiceClasses := Set new
PackageServices class>>register: {services} · avi 10/11/2003 12:59 (changed and recategorized) register: aClass ServiceClasses add: aClass
PackageServices class>>unregister: {services} · avi 10/11/2003 12:59 (changed and recategorized) unregister: aClass ServiceClasses remove: aClass
Sent from Squeak Inbox Talk ["sanitize-cat-names.1.cs"]
squeak-dev@lists.squeakfoundation.org