NameSpace.st
author Claus Gittinger <cg@exept.de>
Fri, 08 Nov 1996 15:11:11 +0100
changeset 1934 f21f70387dc4
parent 1933 74a0bff1ad19
child 1943 0ec17e4627ae
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     1
"
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     2
 COPYRIGHT (c) 1996 by Claus Gittinger
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     3
              All Rights Reserved
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     4
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     5
 This software is furnished under a license and may be used
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     6
 only in accordance with the terms of that license and with the
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     8
 be provided or otherwise made available to, or used by, any
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
     9
 other person.  No title to or ownership of the software is
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    10
 hereby transferred.
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    11
"
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    12
1933
74a0bff1ad19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
    13
Object subclass:#Namespace
74a0bff1ad19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
    14
       instanceVariableNames:''
74a0bff1ad19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
    15
       classVariableNames:''
74a0bff1ad19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
    16
       poolDictionaries:''
74a0bff1ad19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
    17
       category:'Kernel-Classes'
74a0bff1ad19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
    18
!
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    19
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    20
!Namespace class methodsFor:'documentation'!
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    21
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    22
copyright
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    23
"
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    24
 COPYRIGHT (c) 1996 by Claus Gittinger
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    25
              All Rights Reserved
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    26
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    27
 This software is furnished under a license and may be used
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    28
 only in accordance with the terms of that license and with the
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    30
 be provided or otherwise made available to, or used by, any
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    31
 other person.  No title to or ownership of the software is
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    32
 hereby transferred.
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    33
"
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    34
1816
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    37
documentation
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    38
"
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    39
    A Namespace is actually a dummy class, providing a home
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    40
    for its private classes. This has two advantages:
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    41
        - we only need one mechanism for both namespaces
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    42
          and private classes
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    43
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    44
        - there are no possible conflicts between a class
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    45
          and a namespace named alike.
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    46
1816
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    48
    [author:]
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    49
        Claus Gittinger
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    50
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    51
    [see also:]
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    52
        Behavior ClassDescription Class Metaclass
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    53
        PrivateMetaclass
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    54
"
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    55
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    56
! !
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
    57
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    58
!Namespace class methodsFor:'instance creation'!
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    59
1931
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    60
fullName:aFullNameSpacePathName
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    61
    "given a pissibly nested name of a namespace, create all required
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    62
     intermediate spaces (if not already existing) and return the
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    63
     bottom-level space."
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    64
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    65
    "/ break it up, check for all intermediate spaces to exist
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    66
    "/ create them as required.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    67
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    68
    |list idx0 idx superSpace done thisNamespace|
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    69
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    70
    list := OrderedCollection new.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    71
    idx0 := 1.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    72
    done := false.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    73
    [done] whileFalse:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    74
        idx := aFullNameSpacePathName indexOf:$: startingAt:idx0.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    75
        (idx ~~ 0) ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    76
            (idx < aFullNameSpacePathName size and:[(aFullNameSpacePathName at:(idx+1)) == $:]) ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    77
                superSpace := aFullNameSpacePathName copyFrom:idx0 to:(idx-1).
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    78
                list add:superSpace.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    79
                idx0 := idx +2.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    80
            ] ifFalse:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    81
                done := true
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    82
            ]
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    83
        ] ifFalse:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    84
            done := true.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    85
        ]
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    86
    ].
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    87
    list add:(aFullNameSpacePathName copyFrom:idx0).
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    88
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    89
    "/ now, look and create 'em
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    90
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    91
    thisNamespace := nil.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    92
    list do:[:aName |
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    93
        |key x|
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    94
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    95
        key := aName asSymbol.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    96
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    97
        thisNamespace isNil ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    98
            (Smalltalk includesKey:key) ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
    99
                thisNamespace := Smalltalk at:key.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   100
                (thisNamespace notNil
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   101
                and:[thisNamespace isBehavior not]) ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   102
                    ^ self error:'name conflict: namespace ' , aName , ' vs. global'.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   103
                ]
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   104
            ].
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   105
            thisNamespace isNil ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   106
                thisNamespace := self name:key
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   107
            ]
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   108
        ] ifFalse:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   109
            x := thisNamespace privateClassesAt:key.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   110
            x notNil ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   111
                thisNamespace := x
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   112
            ] ifFalse:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   113
                thisNamespace :=
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   114
                    self subclass:key
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   115
                       instanceVariableNames:''
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   116
                       classVariableNames:''
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   117
                       poolDictionaries:''
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   118
                       privateIn:thisNamespace
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   119
            ]    
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   120
        ]
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   121
    ].
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   122
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   123
    ^ thisNamespace
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   124
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   125
    "Created: 8.11.1996 / 13:41:59 / cg"
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   126
!
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   127
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   128
name:aSymbol
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   129
    "create a new nameSpace, named aSymbol"
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   130
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   131
    |newNamespace|
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   132
1931
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   133
    (aSymbol includes:$:) ifTrue:[
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   134
        self error:'invalid namespace name'.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   135
        ^ nil.
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   136
    ].
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   137
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   138
    newNamespace := self subclass:aSymbol
1931
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   139
                         instanceVariableNames:''
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   140
                         classVariableNames:''
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   141
                         poolDictionaries:''
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   142
                         category:'uncategorized namespace'.
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   143
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   144
    ^ newNamespace
1901
8eebbd3c7232 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1828
diff changeset
   145
8eebbd3c7232 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1828
diff changeset
   146
    "
8eebbd3c7232 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1828
diff changeset
   147
     Namespace name:'foo'
8eebbd3c7232 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1828
diff changeset
   148
     (Namespace name:'foo') category:'my name space'
8eebbd3c7232 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1828
diff changeset
   149
    "
1931
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   150
5f60d3e5ba6e moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
   151
    "Modified: 8.11.1996 / 13:40:03 / cg"
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   152
!
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   153
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   154
new
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   155
    self error:'namespaces are not to be created with new'
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   156
! !
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   157
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   158
!Namespace class methodsFor:'accessing'!
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   159
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   160
at:classNameSymbol
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   161
    ^ self privateClassesAt:classNameSymbol
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   162
!
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   163
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   164
at:classNameSymbol ifAbsent:exceptionBlock
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   165
    |cls|
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   166
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   167
    cls := self privateClassesAt:classNameSymbol.
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   168
    cls isNil ifTrue:[
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   169
        ^ exceptionBlock value
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   170
    ].
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   171
    ^ cls
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   172
!
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   173
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   174
at:classNameSymbol put:aClass
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   175
    ^ self privateClassesAt:classNameSymbol put:aClass
1827
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   176
! !
fa0017393e3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
   177
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   178
!Namespace class methodsFor:'enumerating'!
1816
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
allBehaviorsDo:aBlock
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   181
    self privateClassesDo:aBlock
1816
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    "Created: 26.10.1996 / 12:29:01 / cg"
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
! !
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   186
!Namespace class methodsFor:'fileOut'!
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   187
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   188
basicFileOutDefinitionOn:aStream
1934
f21f70387dc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1933
diff changeset
   189
    self == Namespace ifTrue:[
f21f70387dc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1933
diff changeset
   190
	super basicFileOutDefinitionOn:aStream
f21f70387dc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1933
diff changeset
   191
    ] ifFalse:[
f21f70387dc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1933
diff changeset
   192
        aStream nextPutAll:('Namespace name:' , self name storeString)
f21f70387dc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1933
diff changeset
   193
    ]
1828
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   194
! !
92e8ede212e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   195
1908
aff3d44e4399 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   196
!Namespace class methodsFor:'queries'!
1816
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
isNamespace
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    ^ true
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    "Created: 26.10.1996 / 11:13:36 / cg"
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
! !
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
!Namespace class methodsFor:'documentation'!
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
version
1934
f21f70387dc4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1933
diff changeset
   207
    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.8 1996-11-08 14:11:11 cg Exp $'
1816
b063c5b47433 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
! !