Esempio n. 1
0
func (c *Config) GetFirstEntry(section string) (string, **ConfigEntry) {
	ce := new((*C.ALLEGRO_CONFIG_ENTRY))
	s := C.CString(section)
	defer C.free(unsafe.Pointer(s))
	r := C.al_get_first_config_entry((*C.ALLEGRO_CONFIG)(unsafe.Pointer(c)), s, ce)
	return C.GoString(r), (**ConfigEntry)(unsafe.Pointer(ce))
}
Esempio n. 2
0
func (c *Config) IterKeys(sec string) chan string {
	channel := make(chan string)
	go func() {
		var iter *C.ALLEGRO_CONFIG_ENTRY
		ss := C.CString(sec)
		defer C.free(unsafe.Pointer(ss))

		var key_ptr *C.char

		key_ptr = C.al_get_first_config_entry((*C.ALLEGRO_CONFIG)(c), ss, &iter)

		for key_ptr != nil {
			key := C.GoString(key_ptr)
			channel <- key

			key_ptr = C.al_get_next_config_entry(&iter)

		}
		close(channel)
	}()
	return channel
}