Open ijc opened 3 years ago
The C library has a bunch of #defines for keys used in various maps. e.g. from nm-setting-wireless.h:
#define
nm-setting-wireless.h
#define NM_SETTING_WIRELESS_SETTING_NAME "802-11-wireless" ... #define NM_SETTING_WIRELESS_SSID "ssid" #define NM_SETTING_WIRELESS_MODE "mode" #define NM_SETTING_WIRELESS_BAND "band" #define NM_SETTING_WIRELESS_CHANNEL "channel" #define NM_SETTING_WIRELESS_BSSID "bssid"
Could these bindings define a similar set of Go consts to reduce the possibility of typos? Or would specific getter methods be more appropriate?
const
There are also various defines and enums etc for values, such as:
#define NM_SETTING_WIRELESS_MODE_ADHOC "adhoc" .... typedef enum { /*< flags >*/ NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE = 0, /*< skip >*/ NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY = 0x2, NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT = 0x4, NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC = 0x8, ... } NMSettingWirelessWakeOnWLan;
There are lots of nm-setting-*.h though and it would be a lot to maintain all of them, but perhaps ad-hoc/as needed coverage could be acceptable?
nm-setting-*.h
Something like this might ease the burden:
https://github.com/elliotchance/c2go
We have used it in the past to "import" some headers w/ defines.
The C library has a bunch of
#define
s for keys used in various maps. e.g. fromnm-setting-wireless.h
:Could these bindings define a similar set of Go
const
s to reduce the possibility of typos? Or would specific getter methods be more appropriate?There are also various defines and enums etc for values, such as:
There are lots of
nm-setting-*.h
though and it would be a lot to maintain all of them, but perhaps ad-hoc/as needed coverage could be acceptable?