Windows

From VpriWiki

Jump to: navigation, search

Idst and jolt-burg can be compiled on Windows with MinGW+MSYS. Here are a couple of tips. This page describes about revision 376 of http://piumarta.com/svn2/idst.

Contents

Tips

  • If you build Revision 510, you have to copy object/id/libid.c to object/boot/src/libid.c.

Prerequire

Jolt (function/jolt-burg)

Some tricks are needed to run jolt on Windows.

  • Jolt-burg only works on cmd.exe or Cygwin terminal. not MSYS terminal.
  • To run jolt, you have to specify the library path explicitly like ../../jolt-burg/main -L../../jolt-burg/main
  • Some examples use library functions which are not supported by Windows. You may rewrite to use similar function like (define fdopen (dlsym "_fdopen")).

This is a patch for jolt and boot.k

Index: function/jolt-burg/debug.k
===================================================================
--- function/jolt-burg/debug.k  (revision 376)
+++ function/jolt-burg/debug.k  (working copy)
@@ -75,7 +75,7 @@
    ((== 0 (strcmp %sysarch "arm"))     (lambda (fp) (long@ (get-caller-fp fp) -2)))
    (1                                  (error "architecture not supported"))))
 
-(define dladdr (dlsym "dladdr"))
+(define dladdr (lambda (addr info) (0)))
 
 (define %dlinfo (malloc 32))
 (syntax dli-sname (lambda (node) `(long@ ,[node second] 2)))
Index: function/jolt-burg/boot.k
===================================================================
--- function/jolt-burg/boot.k   (revision 376)
+++ function/jolt-burg/boot.k   (working copy)
@@ -40,7 +40,7 @@
 (define realloc                        (dlsym "realloc"))
 (define free                   (dlsym "free"))
 (define strcmp                 (dlsym "strcmp"))
-(define usleep                 (dlsym "usleep"))
+; (define usleep                       (dlsym "usleep"))
 
 (define _dlopen                        (dlsym "dlopen"))
 (define dlclose                        (dlsym "dlclose"))
Index: function/objects/ProfiledMethod.st
===================================================================
--- function/objects/ProfiledMethod.st  (revision 376)
+++ function/objects/ProfiledMethod.st  (working copy)
@@ -1,7 +1,11 @@
 { import: Object }
 
 { include <signal.h> }
-{ include "sigalrm.h" }
+{
+#if !defined(WIN32)
+    include "sigalrm.h"
+#endif
+}
 
 ProfiledMethod : Object ( _method count next )

Canvas Demo - Hello (function/canvas)

  • Read the documentation at function/canvas/00-README.win32.
cd function/canvas/
cp cairo/*.dll
make
unset DISPLAY
./hello.exe

Canvas Demo - World (function/canvas)

You can build the canvas world demo (to compile, make world). But There is keyboard issue, so it doesn't work well. Here is a dirty hack for the workaround.

Index: WinWindow.st
===================================================================
--- WinWindow.st        (revision 376)
+++ WinWindow.st        (working copy)
@@ -149,6 +149,11 @@
     ^self perform: name with: a with: b with: c with: d
 ]
 
+WinWindow keyDownEvent         :char  :unused :x :y
+[
+    ^KeyDownEvent new position: x,y; state: 0; ucs4: char; yourself
+]
+
 WinWindow pollEvent
 [
     | event |
Index: winWindow.h
===================================================================
--- winWindow.h (revision 376)
+++ winWindow.h (working copy)
@@ -13,8 +13,9 @@
     case WM_MBUTTONUP:    enqueue(s_pointerUpEvent,    wParam, 2, x= LOWORD(lParam), y= HIWORD(lParam));  break;
     case WM_RBUTTONUP:    enqueue(s_pointerUpEvent,    wParam, 3, x= LOWORD(lParam), y= HIWORD(lParam));  break;
     case WM_MOUSEMOVE:    enqueue(s_pointerMotionEvent, wParam, 0, x= LOWORD(lParam), y= HIWORD(lParam));  break;
-    case WM_KEYDOWN:     enqueue(s_keyDownEvent,       wParam, 0, x,                y                 );  break;
-    case WM_CHAR:        enqueue(s_keyRepeatEvent,     wParam, 0, x,                y                 );  break;
+    case WM_CHAR:        enqueue(s_keyDownEvent,       wParam, lParam, x,           y                 );  break;
+      //    case WM_KEYDOWN:     enqueue(s_keyDownEvent,       wParam, 0, x,        y                 );  break;
+      //    case WM_CHAR:        enqueue(s_keyRepeatEvent,     wParam, 0, x,        y                 );  break;
     case WM_KEYUP:       enqueue(s_keyUpEvent,         wParam, 0, x,                y                 );  break;
     case WM_CLOSE:       DestroyWindow(hWnd);                                    return 0;
     case WM_DESTROY:     PostQuitMessage(0);                                     return 0;
Personal tools