From 74bb9e1bc2544784d470be3375ef84c664e37fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 16 Sep 2016 06:42:50 +0200 Subject: [PATCH] opengl.gl.extensions: simpler definition of gl-calling-convention --- basis/opengl/gl/extensions/extensions-tests.factor | 7 +++++++ basis/opengl/gl/extensions/extensions.factor | 3 +++ basis/opengl/gl/gtk/gtk.factor | 2 -- basis/opengl/gl/macosx/macosx.factor | 1 - basis/opengl/gl/windows/windows.factor | 1 - basis/opengl/gl/x11/x11.factor | 1 - 6 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 basis/opengl/gl/extensions/extensions-tests.factor diff --git a/basis/opengl/gl/extensions/extensions-tests.factor b/basis/opengl/gl/extensions/extensions-tests.factor new file mode 100644 index 0000000000..4e87d9da86 --- /dev/null +++ b/basis/opengl/gl/extensions/extensions-tests.factor @@ -0,0 +1,7 @@ +USING: alien kernel opengl.gl.extensions system tools.test ; +IN: opengl.gl.extensions.tests + +{ t } [ + gl-function-calling-convention + os windows? [ stdcall ] [ cdecl ] if = +] unit-test diff --git a/basis/opengl/gl/extensions/extensions.factor b/basis/opengl/gl/extensions/extensions.factor index 7944ed1455..4fbf78bac2 100644 --- a/basis/opengl/gl/extensions/extensions.factor +++ b/basis/opengl/gl/extensions/extensions.factor @@ -46,6 +46,9 @@ reset-gl-function-number-counter names return function-effect define-declared ; +: gl-function-calling-convention ( -- symbol ) + os windows? [ stdcall ] [ cdecl ] if ; + SYNTAX: GL-FUNCTION: gl-function-calling-convention scan-function-name diff --git a/basis/opengl/gl/gtk/gtk.factor b/basis/opengl/gl/gtk/gtk.factor index c5fbdeebb3..850f60edc4 100644 --- a/basis/opengl/gl/gtk/gtk.factor +++ b/basis/opengl/gl/gtk/gtk.factor @@ -9,5 +9,3 @@ IN: opengl.gl.gtk : gl-function-address ( name -- address ) ascii string>alien gdk_gl_get_proc_address ; inline - -: gl-function-calling-convention ( -- str ) cdecl ; inline diff --git a/basis/opengl/gl/macosx/macosx.factor b/basis/opengl/gl/macosx/macosx.factor index aeaa5da4eb..56696c6bac 100644 --- a/basis/opengl/gl/macosx/macosx.factor +++ b/basis/opengl/gl/macosx/macosx.factor @@ -3,4 +3,3 @@ IN: opengl.gl.macosx : gl-function-context ( -- context ) 0 ; inline : gl-function-address ( name -- address ) f dlsym ; inline -: gl-function-calling-convention ( -- str ) cdecl ; inline diff --git a/basis/opengl/gl/windows/windows.factor b/basis/opengl/gl/windows/windows.factor index ba3f102652..f27d20815d 100644 --- a/basis/opengl/gl/windows/windows.factor +++ b/basis/opengl/gl/windows/windows.factor @@ -8,4 +8,3 @@ FUNCTION: void* wglGetProcAddress ( c-string name ) : gl-function-context ( -- context ) wglGetCurrentContext ; inline : gl-function-address ( name -- address ) wglGetProcAddress ; inline -: gl-function-calling-convention ( -- str ) stdcall ; inline diff --git a/basis/opengl/gl/x11/x11.factor b/basis/opengl/gl/x11/x11.factor index 2d752757bb..f96cc9901a 100644 --- a/basis/opengl/gl/x11/x11.factor +++ b/basis/opengl/gl/x11/x11.factor @@ -3,4 +3,3 @@ IN: opengl.gl.x11 : gl-function-context ( -- context ) glXGetCurrentContext ; inline : gl-function-address ( name -- address ) glXGetProcAddressARB ; inline -: gl-function-calling-convention ( -- str ) cdecl ; inline