- live browsing of Self object memory -

lobby traitscachedSlotAnnotation

CopyDowns: vector

CreatorPath: traits cachedSlotAnnotation

Module: annotation

parent* = traits slotAnnotation
canonize =
( 
    "preserve hashes by making cached ones immutable"
        canonicalSlotAnnotations 
          if: self IsPresentDo: [|:a| a] 
                   IfAbsentPut: [self] AndDo: [self])
canonizeAll =
( 
    "called before GC, canonize all slot annotations"
    browse all do: [|:m. new | 
      new: m.
      m do: [|:s| 
        new: (
          (new at: s name) copyHolderForAnnotation: s annotation IfFail: [s]
        ) holder.
      ].
      m frozenDefine: new IfFail: [].
    ].  
    self)
parse: = ( (resend.parse: aStringOrSlotAnnotation) canonize)
releaseObjects =
( 
    parseCache removeAll. 
    canonicalSlotAnnotations removeAll.
    self)
canonicalSlotAnnotations = a set
parseCache = a dictionary
parseString:IfFail: =
( 
     "see if string is in parse cache"
    [
    " cannot use following because resend of parseString side-effects
      parseCache -- dmu"

      parseCache if: s
          IsPresentDo: [|:a| a] "yes, return parsed anno"
          IfAbsentPut: [resend.parseString: s       
                                    IfFail: [|:e| ^ fb value: e]
        ] AndDo:       [|:a| a] "return new anno".
    ].
    parseCache if: s
        IsPresentDo: [|:a| a] "yes, return parsed anno"
         IfAbsentDo: [| a | 
            a: resend.parseString: s IfFail: [|:e| ^ fb value: e].
            parseCache at: s Put: a.
            a ])

accessing protected slots

categories = ( convertCategoryStringToList: category)
category = ( protectedCategory)
comment = ( protectedComment)
file = ( protectedFile)
moduleInfo = ( protectedModuleInfo)
visibility = ( protectedVisibility)

category lists and strings

convertCategoryListToString: =
( | r <- '' |
    "for adding new categories, be carefull about vector with empty string"
    c    doFirst: [|:e| r: e isEmpty ifTrue: [annotationSeparator] False: [e]]
      MiddleLast: [|:e| r: r, annotationSeparator, e].
    r)
convertCategoryStringToList: =
( | index. l |
    index: 0.
    l: list copyRemoveAll.
    cat isEmpty ifTrue: [ ^ l ].
    cat do: [|:c. :position |
      annotationSeparator = c ifTrue: [
        l add: cat copyFrom: index UpTo: position.
        index: position succ.
    ]].
    l add: cat copyFrom: index UpTo: cat size.
    l)
isCategoryString:PrefixOf: =
( 
    "optimizes outliners"
    s1 isEmpty ifTrue: [^ true].
    (s1 isPrefixOf: s2) ifFalse: [^ false].
    (s2 at: s1 size IfAbsent: [^ true])  =  annotationSeparator)

changing protected slots

copyForCategories: = ( copyForCategory: convertCategoryListToString: c)
copyForCategory: = ( (copy protectedCategory: (x value: category) canonicalize) setHash)
copyForComment: = ( (copy protectedComment: x value: comment) setHash)
copyForFile: = ( (copy protectedFile: x value: file) setHash)
copyForModuleInfo: = ( (copy protectedModuleInfo: x value: moduleInfo) setHash)
copyForVisibility: = ( (copy protectedVisibility: v value: visibility) setHash)