[REBOL] Re: comlib by Anton.... thanks!
From: moliad::gmail at: 26-Oct-2007 9:41
Hi Robert,
actually, Anton's examples where pretty easy to understand directly.
Although they depended on having MS Office installed (which I don't right
now).
I used it with winGraphViz.
here is my test script, the structure is taken from one of Anton's examples.
to run:
-just download and register wingraphviz (
http://wingraphviz.sourceforge.net/wingraphviz/setup.htm).
-get anton's comlib, and save the following in the comlib dir.
-just run the script.
;------------------------------------------------------------
rebol [
Title: "graph nodes"
File: %graph.r
Date: 26-Jun-2006
Version: 1.0.0
Author: "Maxim Olivier-Adlhoch"
Purpose: {Integrate winGraphViz with REBOL on windows.}
Dependency: {Needs winGraphViz.dll to be installed (i.e. properly
registered)}
]
; change path to comlib if its installed elsewhere.
COMLib: do %COMLib.r
graph: {digraph G {
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf;
init -> make_string;
main -> printf;
execute -> compare;
}}
if error? set/any 'error try [ ; catch all errors so comlib/cleanup is
always done
COMLib/initialize
do bind [
; get lib ptr
grObj: CreateObject "Wingraphviz.neato"
; create the Graph as a PNG img
img: GetObject reduce [ grObj ".toPNG(%s)" graph ]
; convert the image as a base 64 string
img: GetString [ img ".ToBase64String()"]
release grObj
] COMLib/api
][
print mold disarm error
]
; decode base 64 and dump png to disk
write/binary %winGraphVizImg.png debase/base img 64
view layout [box %winGraphVizImg.png]
COMLib/cleanup
;-------------------------------------------------------------------------
On 10/26/07, Robert M. Münch <robert.muench-robertmuench.de> wrote: