ResourcePack.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Mar 2004 18:52:10 +0100
changeset 4084 09fce0933fe3
parent 4078 467a07009140
child 4085 2a6903a7feff
permissions -rw-r--r--
lazy init packs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
claus
parents: 2
diff changeset
     1
"
claus
parents: 2
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
5
claus
parents: 2
diff changeset
     4
claus
parents: 2
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 2
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 2
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 2
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 2
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 2
diff changeset
    10
 hereby transferred.
claus
parents: 2
diff changeset
    11
"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3184
diff changeset
    13
"{ Package: 'stx:libview' }"
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3184
diff changeset
    14
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    15
Dictionary subclass:#ResourcePack
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
    16
	instanceVariableNames:'superPack packsClassName fileReadFailed'
308
54fa63d274fa also allow "/ for comment lines
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    17
	classVariableNames:'Packs'
54fa63d274fa also allow "/ for comment lines
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    18
	poolDictionaries:''
3484
d21aad9e7db9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3422
diff changeset
    19
	category:'Interface-Internationalization'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    20
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    21
1173
86a212598655 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
    22
!ResourcePack class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    23
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    24
copyright
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    25
"
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    26
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
    27
	      All Rights Reserved
5
claus
parents: 2
diff changeset
    28
46
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    29
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    30
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    32
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    33
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    34
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    35
"
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    36
!
5
claus
parents: 2
diff changeset
    37
46
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    38
documentation
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
    39
"
1942
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    40
    This class supports easy customization of smalltalk code (i.e. internationalization
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    41
    and viewStyle adaption).
145
claus
parents: 144
diff changeset
    42
    ResourcePacks are class specific, meaning that every subclass of View
1942
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    43
    and ApplicationModel has an instance of ResourcePack (instVar called 'resources') 
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    44
    which is created when the first instance of the view/app is created,
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    45
    and cached in a class-instVar (so the file is only read once).
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
    46
50
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    47
    The resourcePack consists of a mapping from strings to values, which are
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    48
    then used in labels, buttons, menus etc.
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    49
    The resourcePack initializes itself from a file found in 'resources/<className>.rs',
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    50
    where 'className' is built by the usual abbreviation mechanism (see abbrev-files).
1942
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    51
50
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    52
    Conditional mappings are possible, by including lines as:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    53
	#if <expression>
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    54
	#endif
50
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    55
    in the resourcefile. Example:
2faa1f522096 *** empty log message ***
claus
parents: 46
diff changeset
    56
    file 'foo.rs':
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    57
	#if Language == #de
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    58
	'abort' 'Abbruch'
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    59
	#endif
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    60
	#if Language == #fr
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    61
	'abort' 'canceller'
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    62
	#endif
145
claus
parents: 144
diff changeset
    63
claus
parents: 144
diff changeset
    64
    the corresponding resource-strings are accessed (from methods within the class)
claus
parents: 144
diff changeset
    65
    using:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    66
	resources string:'abort'
145
claus
parents: 144
diff changeset
    67
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
    68
    returning the mapped string (i.e. 'Abbruch' if the global Language is set
3422
f00c788fa81f Comment only
Stefan Vogel <sv@exept.de>
parents: 3407
diff changeset
    69
    to #de)..
145
claus
parents: 144
diff changeset
    70
1942
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    71
    If no corresponding entry is found in the resources, the key is returned;
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    72
    alternatively, use:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    73
	resources string:'foo' default:'bar'
1942
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    74
    which returns 'bar', if no resource definition for 'foo' is found.
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    75
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
    76
    Translations can also include arguments, such as:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
    77
	resources string:'really delete %1' with:fileName
145
claus
parents: 144
diff changeset
    78
claus
parents: 144
diff changeset
    79
    This scheme has the advantage, that you can write your programs using your
claus
parents: 144
diff changeset
    80
    native language strings. Later, when new languages are to be supported,
claus
parents: 144
diff changeset
    81
    simply create a resource file for the class and add translations for
claus
parents: 144
diff changeset
    82
    all those strings. (find the keys by looking at users of resource or senders
1942
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    83
    of 'string:*').
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    84
    Notice, that the grammar of different languages may imply a reordering,
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    85
    so the above string becomes the german 'wollen Sie %1 wirklich löschen';
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    86
    so using percent-placeholders is much better than simple concatenations of
1dd0aedfed03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1936
diff changeset
    87
    arguments to the question.
145
claus
parents: 144
diff changeset
    88
claus
parents: 144
diff changeset
    89
    More languages can be added later without any change in the code,
claus
parents: 144
diff changeset
    90
    recompilation or the like. 
claus
parents: 144
diff changeset
    91
    Even by people without access to the source code i.e. which only have the 
claus
parents: 144
diff changeset
    92
    applications binary.
claus
parents: 144
diff changeset
    93
claus
parents: 144
diff changeset
    94
    Also, unsupported languages' strings are simply left unchanged - if you
claus
parents: 144
diff changeset
    95
    write your application in (say) english, and only plan to use it in english,
claus
parents: 144
diff changeset
    96
    no additional work is required (i.e you dont need a resource file then).
claus
parents: 144
diff changeset
    97
    Strings for unknown languages will come in english 
claus
parents: 144
diff changeset
    98
    (which is better than nothing or empty button labels ;-)
claus
parents: 144
diff changeset
    99
claus
parents: 144
diff changeset
   100
    Summary:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   101
	in subclasses of View and ApplicationModel,
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   102
	instead of writing:
145
claus
parents: 144
diff changeset
   103
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   104
		...
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   105
		b := Button label:'press me'
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   106
		...
145
claus
parents: 144
diff changeset
   107
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   108
	always write:
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   109
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   110
		...
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   111
		b := Button label:(resources string:'press me')
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   112
		...
145
claus
parents: 144
diff changeset
   113
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   114
	if your class is not a subclass of one of the above, AND you need
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   115
	resource translations, you wont inherit the resources variable
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   116
	(which is automatically initialized).
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   117
	In this case, you have to ask the ResourcePack class explicitely for
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   118
	a corresponding package:
145
claus
parents: 144
diff changeset
   119
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   120
		ResourcePack for:aClassName
145
claus
parents: 144
diff changeset
   121
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   122
	as an example, see how the Date class gets the national names of
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   123
	week & monthnames.
145
claus
parents: 144
diff changeset
   124
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   125
    [author:]
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   126
	Claus Gittinger
145
claus
parents: 144
diff changeset
   127
"
claus
parents: 144
diff changeset
   128
!
claus
parents: 144
diff changeset
   129
claus
parents: 144
diff changeset
   130
examples
claus
parents: 144
diff changeset
   131
"
claus
parents: 144
diff changeset
   132
    normally, resources are found in files named after their classes sourcefile
claus
parents: 144
diff changeset
   133
    For example, the FileBrowsers resources are found in 'FBrowser.rs'.
claus
parents: 144
diff changeset
   134
    For the examples below, we process resources from a constant string;
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   135
	this is NOT representative.
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   136
									[exBegin]
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   137
	|stream res|
145
claus
parents: 144
diff changeset
   138
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   139
	stream := ReadStream on:'
145
claus
parents: 144
diff changeset
   140
foo  ''the translation for foo''
3422
f00c788fa81f Comment only
Stefan Vogel <sv@exept.de>
parents: 3407
diff changeset
   141
#if Language == #de
145
claus
parents: 144
diff changeset
   142
bar  ''die deutsche uebersetzung von bar''
claus
parents: 144
diff changeset
   143
baz  ''baz hat den Wert %1''
claus
parents: 144
diff changeset
   144
#endif
3422
f00c788fa81f Comment only
Stefan Vogel <sv@exept.de>
parents: 3407
diff changeset
   145
#if Language == #fr
145
claus
parents: 144
diff changeset
   146
bar  ''bar en francaise''
claus
parents: 144
diff changeset
   147
baz  ''%1, c''''est baz''
claus
parents: 144
diff changeset
   148
#endif
claus
parents: 144
diff changeset
   149
claus
parents: 144
diff changeset
   150
'.
claus
parents: 144
diff changeset
   151
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   152
	res := ResourcePack new readFromResourceStream:stream in:nil.
145
claus
parents: 144
diff changeset
   153
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   154
	Transcript showCR:'baz is translated to: ' , (res string:'baz' with:'1234').
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   155
	Transcript showCR:'bar is translated to: ' , (res string:'bar').
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   156
	Transcript showCR:'foo is translated to: ' , (res string:'foo').
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   157
	Transcript showCR:'fooBar is translated to: ' , (res string:'fooBar').
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   158
									[exEnd]
145
claus
parents: 144
diff changeset
   159
    set the Language to french:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   160
									[exBegin]
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   161
	Language := #fr
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   162
									[exEnd]
145
claus
parents: 144
diff changeset
   163
    and repeat the above.
620
c840b7106a64 examples
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   164
    back to english:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   165
									[exBegin]
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   166
	Language := #en 
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   167
									[exEnd]
620
c840b7106a64 examples
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   168
    back to german:
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   169
									[exBegin]
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   170
	Language := #de 
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   171
									[exEnd]
46
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
   172
"
7b331e9012fd *** empty log message ***
claus
parents: 24
diff changeset
   173
! !
5
claus
parents: 2
diff changeset
   174
1173
86a212598655 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   175
!ResourcePack class methodsFor:'initialization'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   176
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   177
flushCachedResourcePacks
24
e810b1be068b *** empty log message ***
claus
parents: 12
diff changeset
   178
    "forget all cached resources - needed after a style change"
e810b1be068b *** empty log message ***
claus
parents: 12
diff changeset
   179
e810b1be068b *** empty log message ***
claus
parents: 12
diff changeset
   180
    Packs := nil.
e810b1be068b *** empty log message ***
claus
parents: 12
diff changeset
   181
    self initialize
e810b1be068b *** empty log message ***
claus
parents: 12
diff changeset
   182
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   183
    "ResourcePack flushCachedResourcePacks"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   184
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   185
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   186
initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   187
    Packs isNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   188
	Packs := WeakArray new:30
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   189
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   190
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   191
    "ResourcePack initialize"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   192
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   193
1173
86a212598655 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   194
!ResourcePack class methodsFor:'instance creation'!
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   195
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   196
for:aClass
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   197
    "get the full resource definitions for aClass (i.e. with super packs).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   198
     Also leave the resulting pack in the cache for faster access next time."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   199
4030
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   200
    ^ self for:aClass cached:true
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   201
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   202
    "
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   203
     ResourcePack for:TextView     
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   204
     ResourcePack for:CodeView
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   205
     ResourcePack for:Workspace  
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   206
     ResourcePack for:View      
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   207
     ResourcePack for:ErrorLogger 
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   208
     ResourcePack for:NewLauncher 
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   209
     Workspace classResources
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   210
    "
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   211
!
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   212
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   213
for:aClass cached:cached
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   214
    "get the full resource definitions for aClass (i.e. with super packs).
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   215
     Also leave the resulting pack in the cache for faster access next time."
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   216
3980
443283639aed resourceDirectory asked from class
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
   217
    |nm pack rsrcDir baseName|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   218
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   219
    nm := aClass resourcePackName.
4030
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   220
    cached ifTrue:[
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   221
        pack := self searchCacheFor:nm.
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   222
        pack notNil ifTrue:[^ pack].
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   223
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   224
3049
d5f2b3f66e37 load resources from package directory, if present
Claus Gittinger <cg@exept.de>
parents: 3047
diff changeset
   225
    baseName := (Smalltalk fileNameForClass:nm) , '.rs'.
3980
443283639aed resourceDirectory asked from class
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
   226
    rsrcDir := aClass resourceDirectory.
2970
928387584c9c for non-base system classes (i.e. package not stx:),
Claus Gittinger <cg@exept.de>
parents: 2608
diff changeset
   227
3980
443283639aed resourceDirectory asked from class
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
   228
    (rsrcDir notNil 
443283639aed resourceDirectory asked from class
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
   229
    and:[rsrcDir exists 
443283639aed resourceDirectory asked from class
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
   230
    and:[(rsrcDir construct:baseName) exists]]) ifTrue:[
443283639aed resourceDirectory asked from class
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
   231
        pack := self fromFile:baseName directory:rsrcDir pathName.
2970
928387584c9c for non-base system classes (i.e. package not stx:),
Claus Gittinger <cg@exept.de>
parents: 2608
diff changeset
   232
    ] ifFalse:[
3808
b2e08ce8e918 unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
   233
        pack := self fromFile:baseName.
2970
928387584c9c for non-base system classes (i.e. package not stx:),
Claus Gittinger <cg@exept.de>
parents: 2608
diff changeset
   234
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   235
    aClass == Object ifFalse:[
3808
b2e08ce8e918 unused methodLocals removed
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
   236
        pack superPack:(self for:(aClass superclass)).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   237
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   238
    pack packsClassName:nm.
4030
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   239
    cached ifTrue:[
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   240
        self addToCache:pack.
34cdc7a25687 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
   241
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   242
    ^ pack
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   243
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   244
    "
3046
a8ba36b04c26 search in package directory
Claus Gittinger <cg@exept.de>
parents: 3003
diff changeset
   245
     ResourcePack for:TextView     
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   246
     ResourcePack for:CodeView
3046
a8ba36b04c26 search in package directory
Claus Gittinger <cg@exept.de>
parents: 3003
diff changeset
   247
     ResourcePack for:Workspace  
3049
d5f2b3f66e37 load resources from package directory, if present
Claus Gittinger <cg@exept.de>
parents: 3047
diff changeset
   248
     ResourcePack for:View      
2970
928387584c9c for non-base system classes (i.e. package not stx:),
Claus Gittinger <cg@exept.de>
parents: 2608
diff changeset
   249
     ResourcePack for:ErrorLogger 
3101
38cc69894380 fix to avoid loosing the directory with #includes
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   250
     ResourcePack for:NewLauncher 
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   251
     Workspace classResources
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   252
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   253
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   254
4078
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   255
forPackage:package 
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   256
    "get the full resource definitions given a package id (such as stx:libbasic').
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   257
     Also leave the resulting pack in the cache for faster access next time."
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   258
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   259
    ^ self forPackage:package cached:true
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   260
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   261
    "
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   262
     ResourcePack forPackage:'stx:libbasic'   
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   263
    "
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   264
!
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   265
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   266
forPackage:package cached:cached
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   267
    "get the full resource definitions given a package id (such as stx:libbasic').
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   268
     Also optionally leave the resulting pack in the cache for faster access next time."
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   269
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   270
    |fullName pack rsrcDir|
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   271
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   272
    fullName := package , '/resources/resources.rs'.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   273
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   274
    cached ifTrue:[
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   275
        pack := self searchCacheFor:fullName.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   276
        pack notNil ifTrue:[^ pack].
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   277
    ].
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   278
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   279
    rsrcDir := Smalltalk projectDirectoryForPackage:package.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   280
    rsrcDir isNil ifTrue:[^ nil].
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   281
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   282
    rsrcDir := rsrcDir asFilename construct:'resources'.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   283
    rsrcDir exists ifFalse:[^ nil].
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   284
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   285
    pack := self fromFile:'resources.rs' directory:rsrcDir.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   286
    pack packsClassName:fullName.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   287
    cached ifTrue:[
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   288
        self addToCache:pack.
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   289
    ].
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   290
    ^ pack
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   291
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   292
    "
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   293
     ResourcePack forPackage:'stx:libbasic' cached:false     
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   294
    "
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   295
!
467a07009140 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   296
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   297
fromFile:aFileName
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   298
    "get the resource definitions from a file in the default directory.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   299
     Uncached low-level entry."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   300
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   301
    ^ self fromFile:aFileName directory:'resources'
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   302
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   303
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   304
     ResourcePack fromFile:'SBrowser.rs'
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   305
     ResourcePack fromFile:'FBrowser.rs'
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   306
     ResourcePack fromFile:'Smalltalk.rs'
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3567
diff changeset
   307
     ResourcePack fromFile:'Smalltalk.rs' asFilename
3983
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   308
     ResourcePack fromFile:'../../libtool/resources/AboutBox_ru.rs' asFilename
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   309
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   310
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   311
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   312
fromFile:aFileName directory:dirName
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   313
    "get the resource definitions from a file in a directory.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   314
     Uncached low-level entry."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   315
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   316
    |newPack|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   317
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   318
    newPack := self new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   319
    newPack readFromFile:aFileName directory:dirName.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   320
    ^ newPack
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   321
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   322
1173
86a212598655 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   323
!ResourcePack class methodsFor:'private'!
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   324
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   325
addToCache:aPack
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   326
    |idx|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   327
4084
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   328
    Packs isNil ifTrue:[
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   329
        self initialize.
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   330
    ].
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   331
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   332
    idx := Packs identityIndexOf:nil.
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   333
    idx == 0 ifTrue:[
4084
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   334
        idx := Packs identityIndexOf:0
1078
f7b6f15899ab changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   335
    ].
f7b6f15899ab changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   336
    idx == 0 ifTrue:[
4084
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   337
        "
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   338
         throw away oldest
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   339
        "
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   340
        idx := Packs size.
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
   341
        Packs replaceFrom:1 to:idx-1 with:Packs startingAt:2.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   342
    ].
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   343
    Packs at:idx put:aPack
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   344
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   345
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   346
searchCacheFor:aClassname
998
f3d624613a74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   347
    |sz "{ Class: SmallInteger }" |
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   348
24
e810b1be068b *** empty log message ***
claus
parents: 12
diff changeset
   349
    Packs isNil ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   350
	self initialize.
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   351
	^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   352
    ].
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   353
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   354
    sz := Packs size.
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   355
    1 to:sz do:[:idx |
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   356
	|aPack|
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   357
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   358
	aPack := Packs at:idx.
1078
f7b6f15899ab changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   359
	(aPack notNil 
f7b6f15899ab changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   360
	and:[aPack ~~ 0]) ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   361
	    aClassname = aPack packsClassName ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   362
		"
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   363
		 bring to end for LRU
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   364
		"
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   365
		Packs replaceFrom:idx to:sz-1 with:Packs startingAt:idx+1.
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   366
		Packs at:sz put:aPack.
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   367
		^ aPack
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   368
	    ]
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   369
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   370
    ].
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   371
    ^ nil
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   372
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   373
    "
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   374
     ResourcePack searchCacheFor:'TextView' 
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   375
    "
54
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   376
! !
29a6b2f8e042 *** empty log message ***
claus
parents: 50
diff changeset
   377
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   378
!ResourcePack methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   379
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   380
array:anArray
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   381
    "translate a collection of strings"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   382
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   383
    ^ anArray collect:[:r | self at:r default:r]
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   384
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   385
    "
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   386
     Launcher classResources array:#('file' 'classes') 
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   387
    "
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   388
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   389
    "Modified: / 29.1.1998 / 22:44:22 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   390
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   391
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   392
at:aKey
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   393
    "translate a string"
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   394
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   395
    ^ self at:aKey ifAbsent:aKey
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   396
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   397
48194c26a46c Initial revision
claus
parents:
diff changeset
   398
at:aKey default:default
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   399
    "translate a string"
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   400
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   401
    ^ self at:aKey ifAbsent:default
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   402
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   403
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   404
at:aKey ifAbsent:defaultValue
4035
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   405
    "translate a string.
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   406
     Some special 'intelligence' has been added:
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   407
        if no value for aKey is found,
4036
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   408
          lookup aKey with first character caseChanged and change the results first characters case.
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   409
          or aKey ends with a ':', then lookup aKey without ':' and append ':' to the result.
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   410
          or aKey ends with a '=', then lookup aKey without '=' and append '=' to the result.
4037
63eda0e11dca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
   411
          or aKey ends with a '.', then lookup aKey without '.' and append '.' to the result.
4036
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   412
          or aKey ends with a ' ', then lookup aKey without ' '.
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   413
          or aKey ends with a ' ...', then lookup aKey without ' ...' and append '...' to the result.
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   414
          or aKey ends with a '...', then lookup aKey without '...' and append '...' to the result.
4978ac9fbe27 comment
Claus Gittinger <cg@exept.de>
parents: 4035
diff changeset
   415
          or aKey includes '&', then lookup aKey without '&'.
4035
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   416
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   417
     This means, that only a single translation is required to provide local translations for
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   418
     things like 
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   419
        'search'
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   420
        'search:'
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   421
        'search...'
a785efbbc5c9 comment
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
   422
    "
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   423
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   424
    |val alternativeKey rest usedKey idx|
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   425
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   426
    aKey notNil ifTrue:[
3979
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   427
        val := super at:aKey ifAbsent:nil.
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   428
        val notNil ifTrue:[^ val].
3549
8c924bf310ed lower case first <-> upper case first
Claus Gittinger <cg@exept.de>
parents: 3484
diff changeset
   429
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   430
        (aKey isString and:[aKey size > 0]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   431
            "/ try with case-first swapped...
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   432
            (aKey first isLetter) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   433
                alternativeKey := aKey first isUppercase 
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   434
                                    ifTrue:[aKey asLowercaseFirst]
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   435
                                    ifFalse:[aKey asUppercaseFirst].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   436
                val := super at:alternativeKey ifAbsent:nil.
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   437
                val notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   438
                    aKey first isUppercase ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   439
                        ^ val asUppercaseFirst
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   440
                    ].
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   441
                    ^ val asLowercaseFirst.                
3979
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   442
                ].
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   443
            ].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   444
4037
63eda0e11dca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
   445
            (':=.' includes:aKey last) ifTrue:[
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   446
                rest := aKey last.
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   447
                usedKey := aKey copyWithoutLast:1.
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   448
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   449
                val := self at:usedKey ifAbsent:nil.        "/ recursion
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   450
                val notNil ifTrue:[^ val , rest].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   451
            ].
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   452
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   453
            (aKey endsWith:' ') ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   454
                usedKey := aKey withoutSeparators.
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   455
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   456
                val := self at:usedKey ifAbsent:nil.        "/ recursion
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   457
                val notNil ifTrue:[^ val].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   458
            ].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   459
            (aKey endsWith:' ...') ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   460
                usedKey := aKey copyWithoutLast:4.
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   461
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   462
                val := self at:usedKey ifAbsent:nil.        "/ recursion
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   463
                val notNil ifTrue:[^ val , '...'].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   464
            ].
3549
8c924bf310ed lower case first <-> upper case first
Claus Gittinger <cg@exept.de>
parents: 3484
diff changeset
   465
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   466
            (aKey endsWith:'...') ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   467
                usedKey := aKey copyWithoutLast:3.
3979
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   468
4028
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   469
                val := self at:usedKey ifAbsent:nil.        "/ recursion
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   470
                val notNil ifTrue:[^ val , '...'].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   471
            ].
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   472
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   473
            (idx := aKey indexOf:$&) ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   474
                (aKey at:idx+1 ifAbsent:nil) ~~ $& ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   475
                    usedKey := (aKey copyTo:idx-1) , (aKey copyFrom:idx+1).
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   476
                    val := self at:usedKey ifAbsent:nil.    "/ recursion
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   477
                    val notNil ifTrue:[^ val].
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   478
                ].
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   479
            ].
3979
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   480
        ].
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   481
        
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   482
        superPack notNil ifTrue:[
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   483
            ^ superPack at:aKey ifAbsent:defaultValue.
75850ede052c if no xlation is found, look for string folowed by ':' or '='
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   484
        ].
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   485
    ].
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   486
    ^ defaultValue value
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   487
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   488
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   489
name:aKey default:default
2461
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   490
    "translate a string.
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   491
     Obsolete - use #string:default:"
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   492
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   493
    ^ self at:aKey ifAbsent:default
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   494
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   495
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   496
string:s
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   497
    "translate (retrieve) a string - if not present, return s"
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   498
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   499
    ^ self at:s ifAbsent:s
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   500
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   501
    "
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   502
     NewLauncher classResources
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   503
	string:'LICENCEFILE' 
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   504
    "
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   505
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   506
2461
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   507
string:s default:defaultString
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   508
    "translate (retrieve) a string - if not present, return defaultString"
2461
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   509
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   510
    ^ self at:s ifAbsent:defaultString
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   511
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   512
    "
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   513
     NewLauncher classResources
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   514
	string:'fooBar' default:'Hello world'  
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   515
    "
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   516
2461
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   517
!
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   518
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   519
string:s default:defaultString with:arg
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   520
    "translate and expand arg"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   521
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   522
    ^ self string:s default:defaultString withArgs:(Array with:arg)
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   523
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   524
    "
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   525
     NewLauncher classResources
3762
968432b99c48 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   526
	string:'%1 fooBar' default:'Hello %1' with:'foo' 
3097
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   527
    "
b2cca70d5d55 examples
Claus Gittinger <cg@exept.de>
parents: 3082
diff changeset
   528
2461
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   529
!
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   530
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   531
string:s default:defaultString with:arg1 with:arg2
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   532
    "translate and expand args"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   533
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   534
    ^ self string:s default:defaultString withArgs:(Array with:arg1 with:arg2)
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   535
!
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   536
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   537
string:s default:defaultString with:arg1 with:arg2 with:arg3
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   538
    "translate and expand args"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   539
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   540
    ^ self string:s default:defaultString withArgs:(Array with:arg1 with:arg2 with:arg3)
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   541
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   542
    "Created: 9.12.1995 / 19:08:50 / cg"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   543
!
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   544
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   545
string:s default:defaultString with:arg1 with:arg2 with:arg3 with:arg4
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   546
    "translate and expand args"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   547
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   548
    ^ self string:s default:defaultString withArgs:(Array with:arg1 with:arg2 with:arg3 with:arg4)
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   549
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   550
    "Created: 9.9.1996 / 18:52:14 / cg"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   551
!
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   552
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   553
string:s default:defaultString withArgs:argArray
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   554
    "translate and expand args"
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   555
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   556
    |template|
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   557
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   558
    template := self at:s ifAbsent:defaultString.
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   559
    ^ template expandPlaceholdersWith:argArray
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   560
!
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   561
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   562
string:s with:arg
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   563
    "translate and expand arg"
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   564
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   565
    ^ self string:s withArgs:(Array with:arg)
48194c26a46c Initial revision
claus
parents:
diff changeset
   566
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   567
48194c26a46c Initial revision
claus
parents:
diff changeset
   568
string:s with:arg1 with:arg2
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   569
    "translate and expand args"
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   570
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   571
    ^ self string:s withArgs:(Array with:arg1 with:arg2)
48194c26a46c Initial revision
claus
parents:
diff changeset
   572
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   573
292
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   574
string:s with:arg1 with:arg2 with:arg3
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   575
    "translate and expand args"
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   576
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   577
    ^ self string:s withArgs:(Array with:arg1 with:arg2 with:arg3)
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   578
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   579
    "Created: 9.12.1995 / 19:08:50 / cg"
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   580
!
62799b2ab9ae new method: string:with:with:with:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   581
1042
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   582
string:s with:arg1 with:arg2 with:arg3 with:arg4
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   583
    "translate and expand args"
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   584
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   585
    ^ self string:s withArgs:(Array with:arg1 with:arg2 with:arg3 with:arg4)
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   586
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   587
    "Created: 9.9.1996 / 18:52:14 / cg"
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   588
!
ddb262303ccd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   589
3184
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   590
string:s with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   591
    "translate and expand args"
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   592
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   593
    ^ self string:s withArgs:(Array with:arg1 with:arg2 with:arg3 with:arg4 with:arg5)
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   594
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   595
!
b8f6c186fff5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3102
diff changeset
   596
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   597
string:s withArgs:argArray
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   598
    "translate and expand args"
9f8c7f20fdb2 *** empty log message ***
claus
parents: 118
diff changeset
   599
135
claus
parents: 123
diff changeset
   600
    |template|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   601
2461
3c212ae910ec added #string:default:with* methods.
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
   602
    template := self at:s ifAbsent:s.
135
claus
parents: 123
diff changeset
   603
    ^ template expandPlaceholdersWith:argArray
3823
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   604
!
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   605
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   606
stringWithCRs:s with:arg
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   607
    "translate, replace \'s with CRs and finally expand arg.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   608
     CR-replacement is donw before args are inserted 
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   609
     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   610
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   611
    ^ self stringWithCRs:s withArgs:(Array with:arg)
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   612
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   613
    "Modified: / 21.3.2003 / 14:22:09 / cg"
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   614
!
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   615
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   616
stringWithCRs:s with:arg1 with:arg2
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   617
    "translate, replace \'s with CRs and finally expand args.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   618
     CR-replacement is donw before args are inserted 
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   619
     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   620
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   621
    ^ self stringWithCRs:s withArgs:(Array with:arg1 with:arg2)
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   622
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   623
    "Modified: / 21.3.2003 / 14:22:06 / cg"
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   624
!
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   625
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   626
stringWithCRs:s with:arg1 with:arg2 with:arg3
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   627
    "translate, replace \'s with CRs and finally expand args.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   628
     CR-replacement is donw before args are inserted 
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   629
     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   630
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   631
    ^ self stringWithCRs:s withArgs:(Array with:arg1 with:arg2 with:arg3)
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   632
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   633
    "Created: 9.12.1995 / 19:08:50 / cg"
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   634
!
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   635
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   636
stringWithCRs:s with:arg1 with:arg2 with:arg3 with:arg4
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   637
    "translate, replace \'s with CRs and finally expand args.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   638
     CR-replacement is donw before args are inserted 
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   639
     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   640
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   641
    ^ self stringWithCRs:s withArgs:(Array with:arg1 with:arg2 with:arg3 with:arg4)
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   642
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   643
    "Modified: / 21.3.2003 / 14:21:48 / cg"
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   644
!
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   645
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   646
stringWithCRs:s with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   647
    "translate, replace \'s with CRs and finally expand args.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   648
     CR-replacement is donw before args are inserted 
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   649
     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   650
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   651
    ^ self stringWithCRs:s withArgs:(Array with:arg1 with:arg2 with:arg3 with:arg4 with:arg5)
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   652
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   653
    "Modified: / 21.3.2003 / 14:21:55 / cg"
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   654
!
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   655
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   656
stringWithCRs:s withArgs:argArray
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   657
    "translate, replace \'s with CRs and finally expand args.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   658
     CR-replacement is donw before args are inserted 
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   659
     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   660
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   661
    |template|
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   662
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   663
    template := self at:s ifAbsent:s.
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   664
    ^ template withCRs expandPlaceholdersWith:argArray
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   665
e76715148cb3 +stringWithCRs
Claus Gittinger <cg@exept.de>
parents: 3817
diff changeset
   666
    "Modified: / 21.3.2003 / 14:21:59 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   667
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   668
3317
fbad8f950059 Spelling
Stefan Vogel <sv@exept.de>
parents: 3263
diff changeset
   669
!ResourcePack methodsFor:'accessing-internals'!
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   670
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   671
name:aKey
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   672
    "translate a string"
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   673
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   674
    ^ self at:aKey ifAbsent:aKey
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   675
!
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   676
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   677
packsClassName
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   678
    ^ packsClassName
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   679
!
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   680
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   681
packsClassName:aString
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   682
    packsClassName := aString
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   683
!
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   684
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   685
superPack:anotherResourcePack
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   686
    superPack := anotherResourcePack
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   687
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   688
    "Created: / 29.1.1998 / 22:43:09 / cg"
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   689
! !
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   690
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   691
!ResourcePack methodsFor:'file reading'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   692
684
4c7efce60043 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   693
fileReadFailed
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   694
    "return true, if the pack does not really contain
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   695
     valid translations, since the fileRead failed.
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   696
     However, all inherited translations are still available
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   697
     through the receiver"
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   698
687
d2cf3cd18f65 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   699
    ^ fileReadFailed ~~ false
684
4c7efce60043 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   700
2033
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   701
    "Created: / 14.5.1996 / 10:19:26 / cg"
dad8f0ee02f4 do not merge superPacks data;
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   702
    "Modified: / 29.1.1998 / 22:46:38 / cg"
684
4c7efce60043 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   703
!
4c7efce60043 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   704
1894
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   705
nonexistingFileRead
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   706
    "asked to read definitions for a non-existing file.
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   707
     Here, this is legal and ignored (typically using inherited resources).
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   708
     However, subclasses (such as styleSheet) may flag it as an error."
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   709
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   710
    ^ nil
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   711
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   712
    "Created: 6.9.1997 / 11:38:53 / cg"
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   713
!
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1803
diff changeset
   714
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   715
processLine:aLine encoding:encodingSymbolOrEncoder file:fileName printErrorWith:printError
145
claus
parents: 144
diff changeset
   716
    "process a single valid line (i.e. #ifdef & #include has already been processed)"
claus
parents: 144
diff changeset
   717
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   718
    |lineString name lineStream idx rest macroName value 
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   719
     conditional hasError decoder oldValue|
144
claus
parents: 135
diff changeset
   720
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   721
    lineStream := ReadStream on:aLine.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   722
    lineStream signalAtEnd:false.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   723
    lineStream skipSeparators.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   724
    lineStream peek == $' ifTrue:[
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   725
        name := String 
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   726
                    readFrom:lineStream 
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   727
                    onError:[
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   728
                                printError value:('invalid line <' , lineString , '>').
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   729
                                nil
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   730
                            ].
144
claus
parents: 135
diff changeset
   731
    ] ifFalse:[
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   732
        name := lineStream upToSeparator.
144
claus
parents: 135
diff changeset
   733
    ].
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   734
144
claus
parents: 135
diff changeset
   735
    name notNil ifTrue:[
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   736
        hasError := false.
2153
eb2d1caa5dfd added ? construct.
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   737
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   738
        lineStream skipSeparators.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   739
        idx := lineStream position1Based + 1.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   740
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   741
        lineStream peek == $< ifTrue:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   742
            "
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   743
             skip <type> if present
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   744
            "
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   745
            lineStream skipThrough:$>.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   746
            lineStream skipSeparators.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   747
            idx := lineStream position1Based + 1.
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   748
        ].
2153
eb2d1caa5dfd added ? construct.
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   749
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   750
        conditional := false.
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   751
        lineStream peek == $? ifTrue:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   752
            lineStream next.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   753
            lineStream skipSeparators.
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   754
            conditional := true.
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   755
        ].
2153
eb2d1caa5dfd added ? construct.
Claus Gittinger <cg@exept.de>
parents: 2111
diff changeset
   756
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   757
        lineStream peek == $= ifTrue:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   758
            lineStream next.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   759
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   760
            macroName := lineStream nextAlphaNumericWord.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   761
            [lineStream peek == $.] whileTrue:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   762
                lineStream next.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   763
                lineStream peek notNil ifTrue:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   764
                    macroName := macroName , '.' , (lineStream nextAlphaNumericWord)
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   765
                ]
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   766
            ].
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   767
            rest := lineStream upToEnd.
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   768
            value := self at:macroName ifAbsent:nil.
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   769
            (value isNil) ifTrue:[
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   770
                hasError := true.
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   771
                printError value:('bad (nil-valued) macro: ' , macroName).
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   772
            ].
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   773
            value isBlock ifTrue:[
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   774
                value := value value
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   775
            ].
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   776
            value := Compiler evaluate:('self ' , rest)
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   777
                              receiver:value
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   778
                              notifying:nil
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   779
                              compile:false.
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   780
            (value == #Error) ifTrue:[
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   781
                hasError := true.
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   782
                printError value:('error in: "self ' , rest , '"').
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   783
            ]
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   784
        ] ifFalse:[
4062
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   785
            lineStream peek == $' ifTrue:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   786
                value := String 
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   787
                            readFrom:lineStream 
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   788
                            onError:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   789
                                        printError value:('invalid line <' , lineString , '>').
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   790
                                        nil
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   791
                                    ].
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   792
            ] ifFalse:[
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   793
                rest := lineStream upToEnd.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   794
                value := Compiler evaluate:rest compile:false.
838a58308021 tuned resource-pack reading
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   795
            ].
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   796
            (value == #Error) ifTrue:[
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   797
                hasError := true.
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   798
                printError value:('error in: "' , rest , '"').
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   799
            ] ifFalse:[
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   800
                value isString ifTrue:[
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   801
                    encodingSymbolOrEncoder notNil ifTrue:[
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   802
                        encodingSymbolOrEncoder isSymbol ifTrue:[
4019
f843f59a3c74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
   803
                            decoder := CharacterEncoder encoderFor:encodingSymbolOrEncoder ifAbsent:nil.
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   804
                            decoder isNil ifTrue:[ decoder := CharacterEncoder::NullEncoder ].
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   805
                        ] ifFalse:[
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   806
                            decoder := encodingSymbolOrEncoder
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   807
                        ].
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   808
                        value := decoder decodeString:value
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   809
                    ]
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   810
                ]
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   811
            ]
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   812
        ].
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   813
        hasError ifFalse:[
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   814
            (conditional not
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   815
            or:[(self includesKey:name) not]) ifTrue:[
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   816
                name = value ifTrue:[
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   817
                    printError value:('useless resource: "' , name , '"').
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   818
                ] ifFalse:[
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   819
                    oldValue := self at:name ifAbsent:nil.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   820
                    oldValue notNil ifTrue:[
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   821
                        oldValue ~= value ifTrue:[
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   822
                            printError value:('conflicting resource: "' , name , '"').
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   823
                            printError value:('oldValue: ' , oldValue printString).
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   824
                            printError value:('newValue: ' , value printString).
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   825
                        ] ifFalse:[
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   826
                            printError value:('duplicate resource: "' , name , '"').
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   827
                        ].
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   828
                    ].
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   829
                    self at:name put:value.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   830
                ]
3807
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   831
            ]
ddb031431ff6 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   832
        ]
144
claus
parents: 135
diff changeset
   833
    ]
462
423f8426fefc added #encoding directive (I am lazy)
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   834
2291
eaac1c5f2a61 show fileName if a line has error.
Claus Gittinger <cg@exept.de>
parents: 2153
diff changeset
   835
    "Created: / 30.8.1998 / 12:35:37 / cg"
2608
a36fad717685 allow block-values in =xxx
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   836
    "Modified: / 28.4.1999 / 22:23:14 / cg"
144
claus
parents: 135
diff changeset
   837
!
claus
parents: 135
diff changeset
   838
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   839
readFromFile:fileName directory:dirName
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   840
    "read definitions from a file in a directory"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   841
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   842
    |inStream ok|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   843
686
152d8437af35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   844
    fileReadFailed := false.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   845
    dirName = 'resources' ifTrue:[
3769
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   846
        inStream := Smalltalk resourceFileStreamFor:fileName
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   847
    ] ifFalse:[
3769
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   848
        inStream := Smalltalk 
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   849
                        systemFileStreamFor:(dirName 
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   850
                                                isNil ifTrue:[fileName]
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   851
                                                ifFalse:[dirName asFilename construct:fileName]).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   852
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   853
    inStream isNil ifTrue:[
3769
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   854
        "
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   855
         an empty pack
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   856
        "
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   857
        ^ self nonexistingFileRead
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   858
    ].
2996
59278dabe9a6 catch errors when reading #if
Stefan Vogel <sv@exept.de>
parents: 2971
diff changeset
   859
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   860
    ok := self readFromResourceStream:inStream in:dirName.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   861
    inStream close.
686
152d8437af35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   862
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   863
    ok ifFalse:[
3769
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   864
        fileReadFailed := true.
684
4c7efce60043 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   865
3769
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
   866
        ('ResourcePack [warning]: ''' , inStream pathName , ''' contains error(s) - data may be incomplete.') errorPrintCR.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   867
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   868
1173
86a212598655 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   869
    "Modified: 10.1.1997 / 18:05:17 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   870
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   871
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   872
readFromResourceStream:inStream in:dirName
145
claus
parents: 144
diff changeset
   873
    "read definitions from a stream. THe dirName argument is required to
210
0f942dafc85a gracefully handle errors when reading resource files
Claus Gittinger <cg@exept.de>
parents: 177
diff changeset
   874
     specify where #include files are searched for.
0f942dafc85a gracefully handle errors when reading resource files
Claus Gittinger <cg@exept.de>
parents: 177
diff changeset
   875
     Return true, if the style sheet could be read without errors, false otherwise."
145
claus
parents: 144
diff changeset
   876
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   877
    |lineString l lineNumber rest value ifLevel skipping first ok encoding decoder pack errorHandler 
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   878
     printError fileName|
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   879
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   880
    fileName := (inStream isFileStream 
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   881
                    ifTrue:[inStream pathName asFilename baseName]
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   882
                    ifFalse:['---']).
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   883
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   884
    printError := [:message |
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   885
                    'ResourcePack [warning]: ' errorPrint.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   886
                    message errorPrint.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   887
                    ' in file:' errorPrint.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   888
                    fileName errorPrint.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   889
                    ' line: ' errorPrint.
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   890
                    lineNumber errorPrintCR
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   891
                  ].
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   892
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   893
    printError := [:message | ].
462
423f8426fefc added #encoding directive (I am lazy)
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   894
423f8426fefc added #encoding directive (I am lazy)
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   895
    encoding := nil.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   896
210
0f942dafc85a gracefully handle errors when reading resource files
Claus Gittinger <cg@exept.de>
parents: 177
diff changeset
   897
    ok := true.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   898
    ifLevel := 0.
48194c26a46c Initial revision
claus
parents:
diff changeset
   899
    skipping := false.
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   900
    lineNumber := 0.
3567
f85c170f14e8 allow expression evaluation in styleSheet
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   901
f85c170f14e8 allow expression evaluation in styleSheet
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   902
    errorHandler := [:ex | 
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   903
                        |con|
4019
f843f59a3c74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
   904
3854
4547dd93dbfd #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
   905
                        ('ResourcePack [warning]: ''' , ex description , '''') errorPrintCR.
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   906
                        ('ResourcePack [info]: file: ' , inStream pathName printString , ' line: ' , lineNumber printString , ': ''' , lineString , '''') errorPrintCR.
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   907
                        con := ex suspendedContext.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   908
                        ('ResourcePack [info]: in: ' , con fullPrintString) errorPrintCR.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   909
                        con := con sender.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   910
                        ('ResourcePack [info]:   : ' , con fullPrintString) errorPrintCR.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   911
                        con := con sender.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   912
                        ('ResourcePack [info]:   : ' , con fullPrintString) errorPrintCR.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   913
                        value := nil.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   914
                        ok := false.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   915
                    ].
3567
f85c170f14e8 allow expression evaluation in styleSheet
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   916
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   917
    [inStream atEnd] whileFalse:[
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   918
        lineString := inStream nextLine. lineNumber := lineNumber + 1.
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   919
        [lineString notNil and:[lineString endsWith:$\]] whileTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   920
            lineString := lineString copyWithoutLast:1.
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   921
            l := inStream nextLine. lineNumber := lineNumber + 1.
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   922
            l notNil ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   923
                lineString := lineString , l.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   924
            ].
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   925
        ].
177
claus
parents: 158
diff changeset
   926
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   927
        (lineString size > 0) ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   928
            first := lineString at:1.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   929
            "/
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   930
            "/ for your convenience: treat ; AND "/ as comment-line
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   931
            "/
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   932
            ((first == $;) or:[lineString startsWith:'"/']) ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   933
                first == $# ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   934
                    "/ a directive
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   935
                    lineString := (lineString copyFrom:2) withoutSpaces.
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   936
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   937
                    (lineString startsWith:'if') ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   938
                        skipping ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   939
                            rest := lineString copyFrom:3.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   940
                            Error
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   941
                                handle:errorHandler 
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   942
                                do:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   943
                                    value := Compiler evaluate:rest compile:false].
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   944
                            (value == #Error) ifTrue:[
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   945
                                printError value:('error in resource:' , lineString).
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   946
                            ].
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   947
                            (value == false) ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   948
                                skipping := true
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   949
                            ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   950
                        ].
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   951
                        ifLevel := ifLevel + 1
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   952
                    ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   953
                        (lineString startsWith:'endif') ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   954
                            ifLevel := ifLevel - 1.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   955
                            ifLevel == 0 ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   956
                                skipping := false
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   957
                            ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   958
                        ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   959
                            (lineString startsWith:'else') ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   960
                                skipping := skipping not
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   961
                            ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   962
                                skipping ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   963
                                    (lineString startsWith:'include') ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   964
                                        (lineString startsWith:'includeResourcesFor') ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   965
                                            "/ include those resources ...
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   966
                                            rest := lineString copyFrom:('includeResourcesFor' size + 1).
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   967
                                            value := Compiler evaluate:rest compile:false.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   968
                                            value isBehavior ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   969
                                                pack := self class for:value.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   970
                                                pack notNil ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   971
                                                    self declareAllFrom:pack.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   972
                                                ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   973
                                            ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   974
                                        ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   975
                                            rest := lineString copyFrom:('include' size + 1).
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   976
                                            value := Compiler evaluate:rest compile:false.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   977
                                            value isString ifFalse:[
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   978
                                                printError value:('bad include filename: ' , value printString, ' "',lineString,'"').
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   979
                                            ] ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   980
                                                self readFromFile:value directory:dirName
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   981
                                            ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   982
                                        ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   983
                                    ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   984
                                        (lineString startsWith:'encoding') ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   985
                                            rest := lineString copyFrom:9.
3983
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   986
                                            rest := rest withoutSeparators.
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   987
                                            (rest startsWith:'#') ifTrue:[
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   988
                                                rest := rest copyFrom:2.
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   989
                                            ].
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   990
                                            (rest startsWith:'''') ifTrue:[
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   991
                                                rest := rest copyFrom:2.
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   992
                                                (rest endsWith:'''') ifTrue:[
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   993
                                                    rest := rest copyWithoutLast:1.
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   994
                                                ].
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   995
                                            ].
5c4422ca05c8 encoding: allow symbol
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   996
                                            encoding := rest asSymbol.
4019
f843f59a3c74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
   997
                                            decoder := CharacterEncoder encoderFor:encoding ifAbsent:nil.
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   998
                                        ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
   999
                                    ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1000
                                ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1001
                            ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1002
                        ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1003
                    ].
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1004
                ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1005
                    skipping ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1006
                        Error
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1007
                            handle:errorHandler 
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1008
                            do:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1009
                                (lineString at:1) == $!! ifTrue:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1010
                                    "/ evaluate the rest
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1011
                                    Compiler evaluate:(lineString copyFrom:2)
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1012
                                                      receiver:nil
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1013
                                                      notifying:nil
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1014
                                                      compile:false.
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1015
                                ] ifFalse:[
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1016
                                    "/ process as resource
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1017
                                    self 
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1018
                                        processLine:lineString 
4017
b0bbac385c4f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  1019
                                        encoding:decoder 
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1020
                                        file:(inStream isFileStream 
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1021
                                                ifTrue:[inStream pathName]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1022
                                                ifFalse:['---'])
4058
d57a236e56f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1023
                                        printErrorWith:printError
3817
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1024
                                ]]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1025
                    ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1026
                ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1027
            ]
34deab81bfe2 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 3808
diff changeset
  1028
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1029
    ].
210
0f942dafc85a gracefully handle errors when reading resource files
Claus Gittinger <cg@exept.de>
parents: 177
diff changeset
  1030
    ^ ok
177
claus
parents: 158
diff changeset
  1031
2291
eaac1c5f2a61 show fileName if a line has error.
Claus Gittinger <cg@exept.de>
parents: 2153
diff changeset
  1032
    "Modified: / 31.8.1995 / 02:33:45 / claus"
eaac1c5f2a61 show fileName if a line has error.
Claus Gittinger <cg@exept.de>
parents: 2153
diff changeset
  1033
    "Modified: / 30.8.1998 / 12:35:24 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1034
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1035
1173
86a212598655 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1036
!ResourcePack class methodsFor:'documentation'!
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1037
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1038
version
4084
09fce0933fe3 lazy init packs
Claus Gittinger <cg@exept.de>
parents: 4078
diff changeset
  1039
    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.94 2004-03-09 17:52:10 cg Exp $'
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1040
! !
3769
4b0f188d7f5c ifNotNil eliminated
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  1041
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1042
ResourcePack initialize!