This file is indexed.

/usr/share/gnu-smalltalk/kernel/RootNamespc.st is in gnu-smalltalk-common 3.2.5-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
"======================================================================
|
|   RootNamespace Method Definitions
|
|
 ======================================================================"

"======================================================================
|
| Copyright 1999, 2000, 2001, 2002, 2007
| Free Software Foundation, Inc.
| Written by Paolo Bonzini.
|
| This file is part of the GNU Smalltalk class library.
|
| The GNU Smalltalk class library is free software; you can redistribute it
| and/or modify it under the terms of the GNU Lesser General Public License
| as published by the Free Software Foundation; either version 2.1, or (at
| your option) any later version.
| 
| The GNU Smalltalk class library is distributed in the hope that it will be
| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
| General Public License for more details.
| 
| You should have received a copy of the GNU Lesser General Public License
| along with the GNU Smalltalk class library; see the file COPYING.LIB.
| If not, write to the Free Software Foundation, 59 Temple Place - Suite
| 330, Boston, MA 02110-1301, USA.  
|
 ======================================================================"



AbstractNamespace subclass: RootNamespace [
    
    <shape: #pointer>
    <category: 'Language-Implementation'>
    <comment: 'I am a special form of dictionary.  Classes hold on
an instance of me; it is called their `environment''. '>

    RootNamespace class >> new: spaceName [
	"Create a new root namespace with the given name, and add to Smalltalk
	 a key that references it."

	<category: 'instance creation'>
	^Smalltalk at: spaceName asGlobalKey
	    put: ((super new: 24) name: spaceName asSymbol; yourself)
    ]

    inheritedKeys [
	"Answer a Set of all the keys in the receiver and its superspaces"

	<category: 'overrides for superspaces'>
	^Set new
    ]

    set: key to: newValue ifAbsent: aBlock [
	"Assign newValue to the variable named as specified by `key'.
	 This method won't define a new variable; instead if the key
	 is not found it will search in superspaces and evaluate
	 aBlock if it is not found. Answer newValue."

	<category: 'overrides for superspaces'>
	| index |
	index := self findIndexOrNil: key.
	index isNil ifTrue: [^aBlock value].
	(self primAt: index) value: newValue.
	^newValue
    ]

    siblings [
	"Answer all the other root namespaces"

	<category: 'namespace hierarchy'>
	^(RootNamespace allInstances asSet)
	    remove: self;
	    yourself
    ]

    siblingsDo: aBlock [
	"Evaluate aBlock once for each of the other root namespaces,
	 passing the namespace as a parameter."

	<category: 'namespace hierarchy'>
	RootNamespace allInstances asSet 
	    do: [:space | space == self ifFalse: [aBlock value: space]]
    ]

    printOn: aStream in: aNamespace [
	"Print on aStream some Smalltalk code compiling to the receiver
	 when the current namespace is aNamespace"

	<category: 'printing'>
	| reference |
	reference := aNamespace at: self name asGlobalKey ifAbsent: [nil].
	reference == self ifFalse: [aStream nextPutAll: 'Smalltalk.'].
	aStream nextPutAll: self name
    ]

    nameIn: aNamespace [
	"Answer Smalltalk code compiling to the receiver when the current
	 namespace is aNamespace"

	<category: 'printing'>
	| reference |
	reference := aNamespace at: self name asGlobalKey ifAbsent: [nil].
	^reference == self 
	    ifTrue: [self name asString]
	    ifFalse: ['Smalltalk.' , self name]
    ]

    storeOn: aStream [
	"Store Smalltalk code compiling to the receiver"

	<category: 'printing'>
	self name isNil ifTrue: [self error: 'cannot print unnamed namespace'].
	aStream
	    nextPutAll: 'Smalltalk.';
	    nextPutAll: self name
    ]
]