You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/03/19 01:09:26 UTC
[06/19] lucy-clownfish git commit: Provide Go access to CFCBindCore
and CFCC.
Provide Go access to CFCBindCore and CFCC.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/d70fa601
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/d70fa601
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/d70fa601
Branch: refs/heads/master
Commit: d70fa6012b734541a8413e1f0a71e256768a270b
Parents: 77d8294
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Nov 4 17:09:55 2014 -0800
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sun Mar 15 18:05:43 2015 -0700
----------------------------------------------------------------------
compiler/go/cfc/cfc.go | 72 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/d70fa601/compiler/go/cfc/cfc.go
----------------------------------------------------------------------
diff --git a/compiler/go/cfc/cfc.go b/compiler/go/cfc/cfc.go
index b46fafe..6533a0a 100644
--- a/compiler/go/cfc/cfc.go
+++ b/compiler/go/cfc/cfc.go
@@ -34,6 +34,14 @@ type Hierarchy struct {
ref *C.CFCHierarchy
}
+type BindCore struct {
+ ref *C.CFCBindCore
+}
+
+type BindC struct {
+ ref *C.CFCC
+}
+
func NewHierarchy(dest string) Hierarchy {
destCString := C.CString(dest)
defer C.free(unsafe.Pointer(destCString))
@@ -49,3 +57,67 @@ func (obj *Hierarchy) RunDecRef() {
func (obj *Hierarchy) Build() {
C.CFCHierarchy_build(obj.ref)
}
+
+func (obj Hierarchy) AddSourceDir(dir string) {
+ dirCString := C.CString(dir)
+ defer C.free(unsafe.Pointer(dirCString))
+ C.CFCHierarchy_add_source_dir(obj.ref, dirCString)
+}
+
+func (obj Hierarchy) AddIncludeDir(dir string) {
+ dirCString := C.CString(dir)
+ defer C.free(unsafe.Pointer(dirCString))
+ C.CFCHierarchy_add_include_dir(obj.ref, dirCString)
+}
+
+func (obj Hierarchy) WriteLog() {
+ C.CFCHierarchy_write_log(obj.ref)
+}
+
+func NewBindCore(hierarchy Hierarchy, header string, footer string) BindCore {
+ headerCString := C.CString(header)
+ footerCString := C.CString(footer)
+ defer C.free(unsafe.Pointer(headerCString))
+ defer C.free(unsafe.Pointer(footerCString))
+ obj := BindCore{
+ C.CFCBindCore_new(hierarchy.ref, headerCString, footerCString),
+ }
+ runtime.SetFinalizer(&obj, (*BindCore).RunDecRef)
+ return obj
+}
+
+func (obj BindCore) RunDecRef() {
+ C.CFCBase_decref((*C.CFCBase)(unsafe.Pointer(obj.ref)))
+}
+
+func (obj BindCore) WriteAllModified(modified bool) bool {
+ var mod C.int = 0
+ if modified {
+ mod = 1
+ }
+ return C.CFCBindCore_write_all_modified(obj.ref, mod) != 0
+}
+
+func NewBindC(hierarchy Hierarchy, header string, footer string) BindC {
+ headerCString := C.CString(header)
+ footerCString := C.CString(footer)
+ defer C.free(unsafe.Pointer(headerCString))
+ defer C.free(unsafe.Pointer(footerCString))
+ obj := BindC{
+ C.CFCC_new(hierarchy.ref, headerCString, footerCString),
+ }
+ runtime.SetFinalizer(&obj, (*BindC).RunDecRef)
+ return obj
+}
+
+func (obj BindC) RunDecRef() {
+ C.CFCBase_decref((*C.CFCBase)(unsafe.Pointer(obj.ref)))
+}
+
+func (obj BindC) WriteCallbacks() {
+ C.CFCC_write_callbacks(obj.ref)
+}
+
+func (obj BindC) WriteHostDefs() {
+ C.CFCC_write_hostdefs(obj.ref)
+}