From 1b0ecffea4aa533de762bf90787e52ad5c90bd34 Mon Sep 17 00:00:00 2001 From: John Ellson <ellson@research.att.com> Date: Wed, 20 Nov 2013 17:32:36 -0500 Subject: [PATCH] more go bits --- tclpkg/gv/go/src/example/example.c | 20 -------------------- tclpkg/gv/go/src/example/example.go | 1 - tclpkg/gv/go/src/example/example.swig | 13 ------------- tclpkg/gv/go/src/makefile | 11 +++-------- tclpkg/gv/go/src/test.go | 17 +++++++++-------- 5 files changed, 12 insertions(+), 50 deletions(-) delete mode 100644 tclpkg/gv/go/src/example/example.c delete mode 100644 tclpkg/gv/go/src/example/example.go delete mode 100644 tclpkg/gv/go/src/example/example.swig diff --git a/tclpkg/gv/go/src/example/example.c b/tclpkg/gv/go/src/example/example.c deleted file mode 100644 index 65b76aed8..000000000 --- a/tclpkg/gv/go/src/example/example.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <time.h> - -double My_variable = 3.0; - -int fact(int n) { - if (n <= 1) - return 1; - else - return n*fact(n-1); -} - -int my_mod(int x, int y) { - return (x%y); -} - -char *get_time() { - time_t ltime; - time(<ime); - return ctime(<ime); -} diff --git a/tclpkg/gv/go/src/example/example.go b/tclpkg/gv/go/src/example/example.go deleted file mode 100644 index f7ec3726a..000000000 --- a/tclpkg/gv/go/src/example/example.go +++ /dev/null @@ -1 +0,0 @@ -package example diff --git a/tclpkg/gv/go/src/example/example.swig b/tclpkg/gv/go/src/example/example.swig deleted file mode 100644 index aaf1862a8..000000000 --- a/tclpkg/gv/go/src/example/example.swig +++ /dev/null @@ -1,13 +0,0 @@ -%module example -%{ -/* Put header files here or function declarations like below */ -extern double My_variable; -extern int fact(int n); -extern int my_mod(int x, int y); -extern char *get_time(); -%} -extern double My_variable; -extern int fact(int n); -extern int my_mod(int x, int y); -extern char *get_time(); - diff --git a/tclpkg/gv/go/src/makefile b/tclpkg/gv/go/src/makefile index 4e3e31c94..97d89b3dd 100644 --- a/tclpkg/gv/go/src/makefile +++ b/tclpkg/gv/go/src/makefile @@ -1,20 +1,15 @@ GO=$(GOROOT)/bin/go -LDFLAGS="-r `pwd`/gv -r `pwd`/example" test: test.go prep - $(GO) build -x -ldflags=$(LDFLAGS) test.go + $(GO) build -x -work -ldflags='-extldflags=/usr/lib64/libgvc.so' test.go .PHONY: prep prep: mkdir -p gv -# swig -c++ -go -intgosize 32 -o gv/gv_go.cpp ../../gv.i -# sed -e 's/#include "gvc.h"/#include <graphviz\/gvc.h>/' <../../gv.cpp >gv/gv.cpp -# sed -e 's/#include "gvc.h"/#include <graphviz\/gvc.h>/' <gv/gv_go.cpp >gv/gv_go.cpp2 -# mv gv/gv_go.cpp2 gv/gv_go.cpp - sed -e 's/#include "gvc.h"/#include <graphviz\/gvc.h>/' <../../gv.i >gv/gv.swig + sed -e 's/#include "gvc.h"/#include <graphviz\/gvc.h>/' <../../gv.i >gv/gv.swigcxx sed -e 's/#include "gvc.h"/#include <graphviz\/gvc.h>/' \ -e 's/DEMAND_LOADING/1/' <../../gv.cpp >gv/gv.cpp echo "package gv" >gv/gv.go clean: - rm -rf test gv */*.so + rm -rf test gv diff --git a/tclpkg/gv/go/src/test.go b/tclpkg/gv/go/src/test.go index bfc288e1a..d162d3788 100644 --- a/tclpkg/gv/go/src/test.go +++ b/tclpkg/gv/go/src/test.go @@ -1,11 +1,12 @@ package main -import ( - "fmt" - "example" - "gv" -) - +import ( "gv" ) func main() { - fmt.Printf("Hello, world. fact(2) = %v\n", example.Fact(2)) - G = gv.Digraph() + var g gv.Agraph_t + var n, m gv.Agnode_t +// var e gv.Agedge_t + g = gv.Digraph("G") + n = gv.Node(g, "hello") + m = gv.Node(g, "world") + gv.Edge(n, m) + gv.Write(g, "hello.out") } -- 2.40.0