more resource stuff (VW compatibility)
authorClaus Gittinger <cg@exept.de>
Tue, 28 Oct 1997 19:31:50 +0100
changeset 3052 f384e7082ee9
parent 3051 29d10c26d6a3
child 3053 d6aad366397f
more resource stuff (VW compatibility)
Method.st
--- a/Method.st	Tue Oct 28 19:23:02 1997 +0100
+++ b/Method.st	Tue Oct 28 19:31:50 1997 +0100
@@ -2075,6 +2075,57 @@
     "Modified: 7.11.1996 / 19:06:22 / cg"
 !
 
+resourceType
+    "ST-80 compatibility:
+     return the methods first resource specs key; either nil, 
+     or a single symbol such as #canvas, #menu etc.
+     Since VW programs do not expect the additional ST/X resources,
+     these are ignored here - therefore only one of
+     #canvas, #menu, #image or nil are returned (for now)"
+
+    self hasResource ifFalse:[^ nil].
+    self resources keysAndValuesDo:[:key :val |
+                                        (#(
+                                            canvas
+                                            image
+                                            menu
+                                        ) includes:key) ifTrue:[
+                                            ^ key
+                                        ]
+                                   ].
+    ^ nil
+
+    "Created: / 27.10.1997 / 14:10:58 / cg"
+    "Modified: / 28.10.1997 / 13:24:18 / cg"
+!
+
+resources
+    "return the methods resource spec; either nil, a single symbol
+     or a collection of symbols."
+
+    |src parser|
+
+    self hasResource ifFalse:[^ nil].
+
+    src := self source.
+    src isNil ifTrue:[
+        ^ nil "/ actually: dont know
+    ].
+
+    (src findString:'resource:') == 0 ifTrue:[
+        ^ nil "/ actually: error
+    ].
+    parser := Parser
+                    parseMethod:src 
+                    in:nil 
+                    ignoreErrors:true 
+                    ignoreWarnings:true.
+
+    ^ parser primitiveResources.
+
+    "Created: / 26.10.1997 / 16:23:18 / cg"
+!
+
 selector
     "return the selector under which I am found in my containingClasses
      method-table. 
@@ -2440,6 +2491,6 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.142 1997-10-15 12:32:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.143 1997-10-28 18:31:50 cg Exp $'
 ! !
 Method initialize!