File: AnsiInit.st

package info (click to toggle)
gnu-smalltalk 3.2.4-2.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,688 kB
  • ctags: 14,104
  • sloc: ansic: 87,424; sh: 22,729; asm: 8,465; perl: 4,513; cpp: 3,548; xml: 1,669; awk: 1,581; yacc: 1,357; makefile: 1,237; lisp: 855; lex: 843; sed: 258; objc: 124
file content (149 lines) | stat: -rw-r--r-- 6,251 bytes parent folder | download | duplicates (7)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
"======================================================================
|
|   Attribute protocols to existing Smalltalk classes
|
|   This file is in the public domain.
|
 ======================================================================"

| dict |

dict := Dictionary new.

dict at: 'Fundamental' put: #(
	('ANY'				('Object') 'inst' 'NoTst')
	('Object'			('Object') 'inst' 'UT')
	('nil'				('UndefinedObject') 'inst' 'UT')
	('boolean'			('Boolean') 'inst' 'UT')
	('Character'			('Character') 'inst' 'UT')	"StdGbl"
	('Character factory'		('Character') 'class' 'UT')
	('failedMessage'		('Message') 'inst' 'UT')
	('selector'			('Symbol') 'inst' 'UT')
	('classDescription'		('ClassDescription') 'inst' 'NoTst')
	('instantiator'			('Object') 'class' 'NoTst')
	('Object class'			('Object') 'class' 'UT')	"StdGbl"
).

dict at: 'Valuable' put: #(
	('valuable'			('BlockClosure') 'inst' 'NoTst')
	('niladicValuable'		('BlockClosure') 'inst' 'NoTst')
	('niladicBlock'			('BlockClosure') 'inst' 'UT')
	('monadicValuable'		('BlockClosure') 'inst' 'NoTst')
	('monadicBlock'			('BlockClosure') 'inst' 'UT')
	('dyadicValuable'		('BlockClosure') 'inst' 'UT')
).

dict at: 'Exception' put: #(
	('exceptionDescription'		('Exception') 'inst' 'NoTst')
	('exceptionSignaler'		('Exception') 'inst' 'NoTst')
	('exceptionBuilder'		('Exception') 'inst' 'NoTst')
	('signaledException'		('Exception') 'inst' 'NoTst')
	('exceptionSelector'		('Exception') 'class' 'NoTst')
	('exceptionInstantiator'	('Exception') 'class' 'NoTst')
	('Exception class'		('Exception') 'class' 'UT')	"StdGbl"
	('Exception'			('Exception') 'inst' 'UT')
	('Notification class'		('Notification') 'class' 'UT')	"StdGbl"
	('Notification'			('Notification') 'inst' 'UT')
	('Warning class'		('Warning') 'class' 'UT')	"StdGbl"
	('Warning'			('Warning') 'inst' 'UT')
	('Error class'			('Error') 'class' 'UT')	"StdGbl"
	('Error'			('Error') 'inst' 'UT')
	('ZeroDivide factory'		('ZeroDivide') 'class' 'UT')	"StdGbl"
	('ZeroDivide'			('ZeroDivide') 'inst' 'UT')
	('MessageNotUnderstoodSelector'	('MessageNotUnderstood') 'class' 'UT')
	('MessageNotUnderstood'		('MessageNotUnderstood') 'inst' 'UT')	"StdGbl"
	('exceptionSet'			('ExceptionSet') 'inst' 'UT')
).

dict at: 'Numeric' put: #(
	('magnitude'			('Magnitude') 'inst' 'NoTst')
	('number'			('Number') 'inst' 'NoTst')	"StdGbl"
	('rational'			('Fraction' 'Integer') 'inst' 'NoTst')
	('Fraction'			('Fraction') 'inst' 'UT')
	('integer'			('Integer') 'inst' 'UT')	"StdGbl"
	('scaledDecimal'		('ScaledDecimal') 'inst' 'UT')		"StdGbl"
	('Float'			('Float') 'inst' 'UT')
	('floatCharacterization'	('Float') 'class' 'UT')	"StdGbl"
	('Fraction factory'		('Fraction') 'class' 'UT')	"StdGbl"
).

dict at: 'Collection' put: #(
	('collection'			('Collection') 'inst' 'NoTst')
	('abstractDictionary'		('Dictionary') 'inst' 'NoTst')
	('Dictionary'			('Dictionary') 'inst' 'UT')
	('IdentityDictionary'		('IdentityDictionary') 'inst' 'UT')
	('extensibleCollection' 	('Bag' 'OrderedCollection' 'Set' 'String') 'inst' 'NoTst')
	('Bag'				('Bag')  'inst' 'UT')
	('Set'				('Set')  'inst' 'UT')
	('sequencedReadableCollection'	('SequenceableCollection') 'inst' 'NoTst')
	('Interval'			('Interval')  'inst' 'UT')
	('readableString'		('String') 'inst' 'NoTst')
	('symbol'			('Symbol') 'inst' 'UT')	"StdGbl"
	('sequencedCollection'		('SequenceableCollection') 'inst' 'NoTst')
	('String'			('String') 'inst' 'UT')
	('Array'			('Array') 'inst' 'UT')
	('ByteArray'			('ByteArray') 'inst' 'UT')
	('sequencedContractibleCollection' ('SequenceableCollection') 'inst' 'NoTst')
	('SortedCollection'		('SortedCollection') 'inst' 'UT')
	('OrderedCollection'		('OrderedCollection') 'inst' 'UT')
	('Interval factory'		('Interval') 'class' 'UT')		"StdGbl"
	('collection factory'		('Collection') 'class' 'NoTst')
	('Dictionary factory'		('Dictionary') 'class' 'UT')	"StdGbl"
	('IdentityDictionary factory'	('IdentityDictionary') 'class' 'UT')	"StdGbl"
	('initializableCollection factory' ('ArrayedCollection' 'Bag' 'OrderedCollection' 'Set') 'class' 'NoTst')
	('Array factory'		('Array') 'class' 'UT')	"StdGbl"
	('Bag factory'			('Bag') 'class' 'UT')		"StdGbl"
	('ByteArray factory'		('ByteArray') 'class' 'UT')	"StdGbl"
	('OrderedCollection factory'	('OrderedCollection') 'class' 'UT')	"StdGbl"
	('Set factory'			('Set') 'class' 'UT')	"StdGbl"
	('SortedCollection factory' 	('SortedCollection') 'class' 'UT')	"StdGbl"
	('String factory'		('String') 'class' 'UT')	"StdGbl"
).

dict at: 'Date and Time' put: #(
	('DateAndTime'			('DateTime') 'inst' 'UT')
	('Duration'			('Duration') 'inst' 'UT')
	('Duration factory'		('Duration') 'class' 'UT')	"StdGbl"
	('DateAndTime factory' 		('DateTime') 'class' 'UT')	"StdGbl"
).

dict at: 'Stream' put: #(
	('sequencedStream'		('PositionableStream') 'inst' 'NoTst')
	('gettableStream'		('PositionableStream') 'inst' 'NoTst')
	('collectionStream'		('PositionableStream') 'inst' 'NoTst')
	('puttableStream'		('WriteStream') 'inst' 'NoTst')
	('ReadStream'			('ReadStream') 'inst' 'UT')
	('WriteStream'			('WriteStream') 'inst' 'UT')
	('ReadWriteStream'		('ReadWriteStream') 'inst' 'UT')
	"('Transcript'			('Transcript') 'class' 'UT')	???StdGbl??
		?? ??? Transcript is instance of TranscriptStream ???"
	('ReadStream factory'		('ReadStream') 'class' 'UT')	"StdGbl"
	('ReadWriteStream factory'	('ReadWriteStream') 'class' 'UT')	"StdGbl"
	('WriteStream factory'		('WriteStream') 'class' 'UT')	"StdGbl"
).

dict at: 'File Stream' put: #(
	('FileStream'			('FileStream') 'inst' 'NoTst')
	('readFileStream'		('FileStream') 'inst' 'UT')
	('writeFileStream'		('FileStream') 'inst' 'UT')
	('FileStream factory'		('FileStream') 'class' 'UT')	"StdGbl"
).

dict keysAndValuesDo: [ :protocolGroupName :groupProtocols |
    groupProtocols do: [ :protocolClassesIsCls || protocol class side |
	protocol := protocolClassesIsCls at: 1.
	class := protocolClassesIsCls at: 2.
	side := protocolClassesIsCls at: 3.

	"Gosh, how awful a test is this!"
	class := class select: [ :each || symbol |
	    (Symbol hasInterned: each ifTrue: [ :sym | symbol := sym ])
		and: [ (Smalltalk classAt: symbol ifAbsent: [ nil ]) notNil ]
	].

	1 protocolManager
	    wrkAssocProtocolNamed: protocol asSymbol
	    toClassesNamed: class
	    isClassSideProtocol: side = 'class'
    ]
]!