PPCBenchmarkResource updated to work on Smalltalk/X
...as API of FileReference and Filename differ.
--- a/compiler/benchmarks/PPCBenchmarkResources.st Sun Apr 19 22:28:48 2015 +0100
+++ b/compiler/benchmarks/PPCBenchmarkResources.st Mon Apr 20 11:23:20 2015 +0100
@@ -9,6 +9,7 @@
category:'PetitCompiler-Benchmarks-Core'
!
+
!PPCBenchmarkResources methodsFor:'as yet unclassified'!
changesSized: size
@@ -24,14 +25,14 @@
files := self readDirectory: directory.
files := self files: files withExtension: 'java'.
- ^ files collect: [ :f | (FileStream fileNamed: f) contents ]
+ ^ files collect: [ :f | (FileStream fileNamed: f) contents asString ]
!
javaLangClass
!
javaLangMath
- ^ (FileStream fileNamed: '../java-src/java/lang/Math.java') contents
+ ^ (FileStream fileNamed: '../java-src/java/lang/Math.java') contents asString
!
javaSourcesBig
@@ -3963,7 +3964,7 @@
files := self readDirectory: directory.
files := self files: files withExtension: 'st'.
- ^ files collect: [ :f | (FileStream fileNamed: f) contents ]
+ ^ files collect: [ :f | (FileStream fileNamed: f) contents asString ]
!
smalltalkObjectMethods
@@ -3997,15 +3998,42 @@
!PPCBenchmarkResources methodsFor:'private utilities'!
files: files withExtension: extension
- ^ files select: [ :f | f extension = extension ]
+ ( (Smalltalk respondsTo: #isSmalltalkX) and:[ Smalltalk isSmalltalkX ] ) ifTrue:[
+ ^ files select: [ :f | f suffix = extension ]
+ ] ifFalse:[
+ "Assuming Pharo..."
+ ^ files select: [ :f | f extension = extension ]
+ ]
+
+ "Modified: / 20-04-2015 / 10:58:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readDirectory: directory
- | file |
- file := directory asFileReference.
- file exists ifTrue: [
- ^ file allFiles
- ].
- ^ #()
+ | file |
+
+ ( (Smalltalk respondsTo: #isSmalltalkX) and:[ Smalltalk isSmalltalkX ] ) ifTrue:[
+ file := directory asFilename.
+ file exists ifFalse:[
+ self error: 'Directory does not exist'.
+ ].
+ ^ file recursiveDirectoryContentsAsFilenames select:[:each | each isRegularFile ]
+ ] ifFalse:[
+ "Assuming Pharo..."
+
+ file := directory asFileReference.
+ file exists ifFalse: [
+ self error: 'Directory does not exist'.
+ ].
+ ^ file allFiles
+ ]
+
+ "Modified: / 20-04-2015 / 11:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!PPCBenchmarkResources class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+