Example #1
0
// This function returns information about libpcre configuration.
// Function passed flag f to C.pcre_config() func, and convert returned
// vaule to string type.
// http://www.pcre.org/original/doc/html/pcre_config.html
func Config(f int) (r string) {
	if f == C.PCRE_CONFIG_JITTARGET {
		var jittarget *C.char
		C.pcre_config(C.PCRE_CONFIG_JITTARGET, unsafe.Pointer(&jittarget))
		r = C.GoString(jittarget)
	} else {
		var i C.int
		C.pcre_config(C.int(f), unsafe.Pointer(&i))
		r = fmt.Sprint(int32(i))
	}
	return
}
Example #2
0
// This function returns string, which contains  all information
// you can access by pcre_config() function
func ConfigAll() (ret string) {
	var i C.int
	C.pcre_config(C.PCRE_CONFIG_JIT, unsafe.Pointer(&i))
	ret += fmt.Sprintf("jit: %d\n", int32(i))
	var jittarget *C.char
	C.pcre_config(C.PCRE_CONFIG_JITTARGET, unsafe.Pointer(&jittarget))
	ret += fmt.Sprintf("jittarget: %s\n", C.GoString(jittarget))
	C.pcre_config(C.PCRE_CONFIG_LINK_SIZE, unsafe.Pointer(&i))
	ret += fmt.Sprintf("link_size: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_MATCH_LIMIT, unsafe.Pointer(&i))
	ret += fmt.Sprintf("match_limit: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_MATCH_LIMIT_RECURSION, unsafe.Pointer(&i))
	ret += fmt.Sprintf("match_limit_recursion: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_NEWLINE, unsafe.Pointer(&i))
	ret += fmt.Sprintf("newline: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_BSR, unsafe.Pointer(&i))
	ret += fmt.Sprintf("bsr: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_POSIX_MALLOC_THRESHOLD, unsafe.Pointer(&i))
	ret += fmt.Sprintf("posix_malloc_threshold: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_STACKRECURSE, unsafe.Pointer(&i))
	ret += fmt.Sprintf("stackrecurse: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_UTF16, unsafe.Pointer(&i))
	ret += fmt.Sprintf("utf16: %d\n", int32(i))
	C.pcre_config(C.PCRE_CONFIG_UTF8, unsafe.Pointer(&i))
	ret += fmt.Sprintf("utf8: %d", int32(i))
	C.pcre_config(C.PCRE_CONFIG_UNICODE_PROPERTIES, unsafe.Pointer(&i))
	ret += fmt.Sprintf("unicode_properties: %d\n", int32(i))

	return
}