Exemple #1
0
//export go_CompletionEntryFunction
func go_CompletionEntryFunction(text *C.char, state int) *C.char {
	if _go_completion_entry_function != nil {
		ret := _go_completion_entry_function(C.GoString(text), state)
		if len(ret) > 0 {
			return C.CString(ret)
		}
	}

	return C.null_cstring()
}
Exemple #2
0
//export go_AttemptedCompletionFunction
func go_AttemptedCompletionFunction(text *C.char, start, end int) **C.char {
	if _go_attempted_completion_function != nil {
		ret := _go_attempted_completion_function(C.GoString(text), start, end)
		if ret != nil && len(ret) > 0 {
			size := len(ret)
			c_ret := C.cstring_array_new(C.int(size + 1))

			for i, s := range ret {
				C.cstring_array_set(c_ret, C.int(i), C.CString(s))
			}

			C.cstring_array_set(c_ret, C.int(size), C.null_cstring())
			return c_ret
		}
	}

	return C.null_cstring_array()
}