- fixed makefile, the new proto.o file was missing from the objects list

- make sure all global symbols have spnav_ prefixes to avoid namespace
  pollution.
pull/15/head
John Tsiombikas 2022-03-24 17:53:20 +02:00
rodzic 2c0bee29ce
commit b1cf3f7bad
4 zmienionych plików z 20 dodań i 20 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
obj = spnav.o $(magellan_obj)
obj = spnav.o proto.o $(magellan_obj)
hdr = spnav.h spnav_magellan.h spnav_config.h
name = spnav

Wyświetl plik

@ -5,7 +5,7 @@
#include "proto.h"
int proto_send_str(int fd, int req, const char *str)
int spnav_send_str(int fd, int req, const char *str)
{
int len;
struct reqresp rr = {0};
@ -28,7 +28,7 @@ int proto_send_str(int fd, int req, const char *str)
return 0;
}
int proto_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr)
int spnav_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr)
{
int len;

28
proto.h
Wyświetl plik

@ -125,18 +125,18 @@ enum {
#define REQSTR_FIRST(rr) (((rr)->data[6] & REQSTR_CONT_BIT) == 0)
#define REQSTR_REMLEN(rr) ((rr)->data[6] & 0xffff)
int proto_send_str(int fd, int req, const char *str);
int proto_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr);
int spnav_send_str(int fd, int req, const char *str);
int spnav_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr);
#ifdef DEF_PROTO_REQ_NAMES
const char *reqnames_1000[] = {
const char *spnav_reqnames_1000[] = {
"SET_NAME",
"SET_SENS",
"GET_SENS",
"SET_EVMASK",
"GET_EVMASK"
};
const char *reqnames_2000[] = {
const char *spnav_reqnames_2000[] = {
"DEV_NAME",
"DEV_PATH",
"DEV_NAXES",
@ -144,7 +144,7 @@ const char *reqnames_2000[] = {
"DEV_USBID",
"DEV_TYPE"
};
const char *reqnames_3000[] = {
const char *spnav_reqnames_3000[] = {
"SCFG_SENS",
"GCFG_SENS",
"SCFG_SENS_AXIS",
@ -171,16 +171,16 @@ const char *reqnames_3000[] = {
"GCFG_SERDEV"
};
const int reqnames_1000_size = sizeof reqnames_1000 / sizeof *reqnames_1000;
const int reqnames_2000_size = sizeof reqnames_2000 / sizeof *reqnames_2000;
const int reqnames_3000_size = sizeof reqnames_3000 / sizeof *reqnames_3000;
const int spnav_reqnames_1000_size = sizeof spnav_reqnames_1000 / sizeof *spnav_reqnames_1000;
const int spnav_reqnames_2000_size = sizeof spnav_reqnames_2000 / sizeof *spnav_reqnames_2000;
const int spnav_reqnames_3000_size = sizeof spnav_reqnames_3000 / sizeof *spnav_reqnames_3000;
#else
extern const char *reqnames_1000[];
extern const char *reqnames_2000[];
extern const char *reqnames_3000[];
extern const int reqnames_1000_size;
extern const int reqnames_2000_size;
extern const int reqnames_3000_size;
extern const char *spnav_reqnames_1000[];
extern const char *spnav_reqnames_2000[];
extern const char *spnav_reqnames_3000[];
extern const int spnav_reqnames_1000_size;
extern const int spnav_reqnames_2000_size;
extern const int spnav_reqnames_3000_size;
#endif /* DEF_PROTO_REQ_NAMES */
#endif /* PROTO_H_ */

Wyświetl plik

@ -730,7 +730,7 @@ static int request_str(int req, char *buf, int bufsz, int timeout_ms)
return -1;
}
while((res = proto_recv_str(&sbuf, &rr)) == 0) {
while((res = spnav_recv_str(&sbuf, &rr)) == 0) {
if(wait_resp(&rr, sizeof rr, timeout_ms) == -1) {
free(sbuf.buf);
return -1;
@ -759,7 +759,7 @@ int spnav_protocol(void)
int spnav_client_name(const char *name)
{
return proto_send_str(sock, REQ_SET_NAME, name);
return spnav_send_str(sock, REQ_SET_NAME, name);
}
int spnav_dev_name(char *buf, int bufsz)
@ -1046,7 +1046,7 @@ int spnav_cfg_get_grab(void)
int spnav_cfg_set_serial(const char *devpath)
{
return proto_send_str(sock, REQ_SCFG_SERDEV, devpath);
return spnav_send_str(sock, REQ_SCFG_SERDEV, devpath);
}
int spnav_cfg_get_serial(char *buf, int bufsz)