Cairo__Path.st
changeset 12 e5f0c18af8a9
parent 11 fdc697f4f190
child 20 18a3e6b5f310
--- a/Cairo__Path.st	Wed May 30 20:06:35 2012 +0000
+++ b/Cairo__Path.st	Thu Jun 14 09:18:25 2012 +0000
@@ -6,12 +6,50 @@
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
-	category:'Cairo - Objects'
+	category:'Cairo-Objects'
 !
 
 
 !Path class methodsFor:'accessing'!
 
+dllPath
+
+    OperatingSystem isMSWINDOWSlike ifTrue:[
+        ^ #( 'C:\Windows' 'C:\Windows\System32' "Wild guess, should not harm" )
+    ].
+
+    OperatingSystem isUNIXlike ifTrue:[
+        OperatingSystem getSystemType == #linux ifTrue:[
+            | path |
+
+            path := #( '/lib' '/usr/lib' '/usr/local/lib' ).
+            (OperatingSystem getSystemInfo at:#machine) = 'x86_64' ifTrue:[
+                "If the machine is 64bit, prepend standard path for 32bit libs.
+                 Leave standard paths at the end, as the system might be completely 
+                 32bit but running on 64bit-capable CPU.
+
+                CAVEAT: This is bit dangerous, as on 64bit OS, if ia32 libs are
+                not installed byt 64bit sqlite libs are, then 64bit libs are found
+                and when a function is called, segfault will occur!!
+
+                Q: Is there a way how to figure out if the OS itself is 32bit,
+                regardles on CPU?"
+                path := #( '/lib32' '/usr/lib32' '/usr/local/lib32' ) , path.
+            ].
+            ^path
+
+        ].
+    ].
+
+    self error:'Unsupported operating system'
+
+    "
+        SqliteLibrary dllPath
+    "
+
+    "Created: / 31-08-2011 / 18:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 libraryName
 
 	OperatingSystem isUNIXlike ifTrue:[^'libcairo.so.2'].
@@ -19,11 +57,15 @@
 	OperatingSystem isMSWINDOWSlike ifTrue:[^'cairo.dll'].
 
 	self error:'Library name for host OS is not known'
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 structSize
 
 	^96
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 ! !
 
 !Path class methodsFor:'primitives'!
@@ -34,44 +76,50 @@
 	self primitiveFailed
 
     "Modified: / 10-09-2008 / 18:19:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
-primPathDestroy: path 
-
-	<cdecl: void "cairo_path_destroy" ( Cairo::Path ) >
-	self primitiveFailed
 ! !
 
 !Path methodsFor:'accessing'!
 
 data
 
-	^self pointerAt:1 + 4
+	^self doubleWordAt:1 + 4
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 data: value
 
 	self pointerAt:1 + 4 put:value
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 numData
 
-	^self longAt:1 + 8
+	^self doubleWordAt:1 + 8
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 numData: value
 
-	self longAt:1 + 8 put:value
+	self doubleWordAt:1 + 8 put:value
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 status
 
 	^self doubleWordAt:1 + 0
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 status: value
 
 	self doubleWordAt:1 + 0 put:value
+
+    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 ! !
 
 !Path class methodsFor:'documentation'!