From 7e4aa6f67f067a1a6528d19ebce5e4a9dc15526f Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 16 Sep 2011 01:23:52 -0500 Subject: [PATCH] Graphviz's gvc.dll doesn't export gvplugin_list() on Windows, so call gvPluginList() instead. This bug has been reported to the Windows Graphviz maintainer, so we can potentially go back to calling gvplugin_list() someday. --- extra/graphviz/ffi/ffi.factor | 36 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/extra/graphviz/ffi/ffi.factor b/extra/graphviz/ffi/ffi.factor index 794640ab4b..f6d84aef42 100644 --- a/extra/graphviz/ffi/ffi.factor +++ b/extra/graphviz/ffi/ffi.factor @@ -1,9 +1,11 @@ ! Copyright (C) 2011 Alex Vondrak. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors alien alien.c-types alien.destructors -alien.libraries alien.syntax combinators debugger destructors -fry io kernel literals math prettyprint sequences splitting -system memoize graphviz ; +USING: accessors alien alien.c-types alien.data +alien.destructors alien.libraries alien.strings alien.syntax +combinators debugger destructors fry graphviz io +io.encodings.ascii kernel libc literals locals math memoize +prettyprint sequences specialized-arrays splitting system ; +SPECIALIZED-ARRAY: void* IN: graphviz.ffi << @@ -132,17 +134,25 @@ API_textlayout API_device API_loadimage ; -FUNCTION: c-string - gvplugin_list - ( GVC_t* gvc, api_t api, c-string str ) ; +FUNCTION: char** + gvPluginList + ( GVC_t* gvc, c-string kind, int* size, c-string str ) ; -: plugin-list ( API_t -- seq ) - '[ - gvContext &gvFreeContext _ "" gvplugin_list - " " split harvest +:: plugin-list ( kind-string -- seq ) + [ + gvContext &gvFreeContext + kind-string + 0 int dup :> size* + f + gvPluginList &(free) :> ret + size* int deref :> size + ret size [ + &(free) ascii alien>string + ] { } map-as ] with-destructors ; PRIVATE> -MEMO: supported-engines ( -- seq ) API_layout plugin-list ; -MEMO: supported-formats ( -- seq ) API_device plugin-list ; +MEMO: supported-engines ( -- seq ) "layout" plugin-list ; +MEMO: supported-formats ( -- seq ) "device" plugin-list ; +