author | Jan Vrany <jan.vrany@labware.com> |
Tue, 11 Jul 2023 12:13:27 +0100 | |
branch | jv |
changeset 1173 | e3dd2050492e |
parent 1095 | 87f223484bc3 |
permissions | -rw-r--r-- |
1095
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
1 |
"{ Package: 'stx:goodies/monticello' }" |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
2 |
|
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
3 |
"{ NameSpace: Smalltalk }" |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
4 |
|
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
5 |
Object subclass:#MCReader |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
6 |
instanceVariableNames:'stream' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
7 |
classVariableNames:'' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
8 |
poolDictionaries:'' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
9 |
category:'SCM-Monticello-Storing' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
966
diff
changeset
|
10 |
! |
34 | 11 |
|
12 |
||
13 |
!MCReader class methodsFor:'instance creation'! |
|
14 |
||
523 | 15 |
on: aStringOrStream |
16 |
^ self new stream: aStringOrStream readStream |
|
17 |
||
18 |
"Modified: / 25-11-2011 / 16:57:41 / cg" |
|
34 | 19 |
! |
20 |
||
21 |
on: aStream name: aFileName |
|
22 |
| class | |
|
237 | 23 |
class := self readerClassForFileNamed: aFileName. |
34 | 24 |
^ class |
25 |
ifNil: [self error: 'Unsupported format: ', aFileName] |
|
26 |
ifNotNil: [class on: aStream] |
|
27 |
! ! |
|
28 |
||
29 |
!MCReader class methodsFor:'testing'! |
|
30 |
||
31 |
canReadFileNamed: fileName |
|
32 |
^ (fileName endsWith: self extension) |
|
33 |
! |
|
34 |
||
35 |
concreteSubclasses |
|
966 | 36 |
"must make sure that the package is fully loaded; |
37 |
otherwise, subclasses are not found" |
|
38 |
||
39 |
self projectDefinitionClass ensureFullyLoaded. |
|
40 |
^ self allSubclasses reject: [:c | c isAbstract] |
|
34 | 41 |
! |
42 |
||
43 |
isAbstract |
|
44 |
^ (self respondsTo: #extension) not |
|
45 |
! |
|
46 |
||
47 |
readerClassForFileNamed: fileName |
|
48 |
^ self concreteSubclasses |
|
49 |
detect: [:c | c canReadFileNamed: fileName] |
|
50 |
ifNone: [nil] |
|
51 |
! ! |
|
52 |
||
53 |
!MCReader methodsFor:'accessing'! |
|
54 |
||
55 |
stream: aStream |
|
237 | 56 |
stream := aStream |
34 | 57 |
! ! |
58 |
||
59 |
!MCReader class methodsFor:'documentation'! |
|
60 |
||
61 |
version |
|
966 | 62 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCReader.st,v 1.6 2015-02-07 11:09:03 cg Exp $' |
237 | 63 |
! |
64 |
||
65 |
version_CVS |
|
966 | 66 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCReader.st,v 1.6 2015-02-07 11:09:03 cg Exp $' |
237 | 67 |
! |
68 |
||
69 |
version_SVN |
|
966 | 70 |
^ '$Id: MCReader.st,v 1.6 2015-02-07 11:09:03 cg Exp $' |
34 | 71 |
! ! |
966 | 72 |