From 5427a199aac32acf3c99f4381c694db5ab88e9f2 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 20 Dec 2006 16:24:29 +0000 Subject: fixed sloppy global variable declarations so that things compile properly with full compiler optimizations svn path=/trunk/externals/hcs/hid/; revision=7038 --- hid.c | 15 +++++++++++++ hid.h | 14 ++++++------ hid_darwin.c | 2 -- input_arrays.h | 68 +++++++++++++++++++++++++++++----------------------------- 4 files changed, 56 insertions(+), 43 deletions(-) diff --git a/hid.c b/hid.c index 5711ea3..d8598b1 100644 --- a/hid.c +++ b/hid.c @@ -53,6 +53,21 @@ static void hid_open(t_hid *x, t_symbol *s, int argc, t_atom *argv); //static void hid_float(t_hid* x, t_floatarg f); +/*------------------------------------------------------------------------------ + * GLOBAL VARIABLES DECLARED extern IN hid.h + */ +t_int hid_instance_count; +unsigned short device_count; + +/* this is used to test for the first instance to execute */ +double last_execute_time[MAX_DEVICES]; + +/* store element structs to eliminate symbol table lookups, etc. */ +t_hid_element *element[MAX_DEVICES][MAX_ELEMENTS]; +/* number of active elements per device */ +unsigned short element_count[MAX_DEVICES]; + + /*------------------------------------------------------------------------------ * SUPPORT FUNCTIONS */ diff --git a/hid.h b/hid.h index c4c0acd..236c14e 100644 --- a/hid.h +++ b/hid.h @@ -19,7 +19,7 @@ #define HID_MAJOR_VERSION 0 #define HID_MINOR_VERSION 7 -/* static char *version = "$Revision: 1.28 $"; */ +/* static char *version = "$Revision: 1.29 $"; */ /*------------------------------------------------------------------------------ * GLOBAL DEFINES @@ -65,12 +65,12 @@ typedef struct _hid /* count the number of instances of this object so that certain free() * functions can be called only after the final instance is detroyed. */ -t_int hid_instance_count; +EXTERN t_int hid_instance_count; /* this is used to test for the first instance to execute */ -double last_execute_time[MAX_DEVICES]; +EXTERN double last_execute_time[MAX_DEVICES]; -extern unsigned short global_debug_level; +EXTERN unsigned short global_debug_level; /* built up when the elements of an open device are enumerated */ typedef struct _hid_element @@ -94,12 +94,12 @@ typedef struct _hid_element } t_hid_element; /* mostly for status querying */ -unsigned short device_count; +EXTERN unsigned short device_count; /* store element structs to eliminate symbol table lookups, etc. */ -t_hid_element *element[MAX_DEVICES][MAX_ELEMENTS]; +EXTERN t_hid_element *element[MAX_DEVICES][MAX_ELEMENTS]; /* number of active elements per device */ -unsigned short element_count[MAX_DEVICES]; +EXTERN unsigned short element_count[MAX_DEVICES]; /*------------------------------------------------------------------------------ * FUNCTION PROTOTYPES FOR DIFFERENT PLATFORMS diff --git a/hid_darwin.c b/hid_darwin.c index d406054..c03042a 100644 --- a/hid_darwin.c +++ b/hid_darwin.c @@ -60,8 +60,6 @@ * GLOBAL VARS *======================================================================== */ -extern t_int hid_instance_count; // in hid.h - /* store device pointers so I don't have to query them all the time */ pRecDevice device_pointer[MAX_DEVICES]; diff --git a/input_arrays.h b/input_arrays.h index ea3ce75..87a30a7 100644 --- a/input_arrays.h +++ b/input_arrays.h @@ -2,40 +2,40 @@ #define _INPUT_ARRAYS_H -char *ev[32]; -char *ev_syn[512]; -char *ev_key[512]; -char *ev_rel[16]; -char *ev_abs[64]; -char *ev_msc[8]; -char *ev_led[16]; -char *ev_snd[8]; -char *ev_rep[2]; -char *ev_ff[128]; -char *ev_pwr[1]; -char *ev_ff_status[2]; -char *ev_5[16]; -char *ev_6[16]; -char *ev_7[16]; -char *ev_8[16]; -char *ev_9[16]; -char *ev_10[16]; -char *ev_11[16]; -char *ev_12[16]; -char *ev_13[16]; -char *ev_14[16]; -char *ev_15[16]; -char *ev_16[16]; -char *ev_19[16]; -char *ev_24[16]; -char *ev_25[16]; -char *ev_26[16]; -char *ev_27[16]; -char *ev_28[16]; -char *ev_29[16]; -char *ev_30[16]; -char *ev_31[16]; -char **event_names[32]; +extern char *ev[32]; +extern char *ev_syn[512]; +extern char *ev_key[512]; +extern char *ev_rel[16]; +extern char *ev_abs[64]; +extern char *ev_msc[8]; +extern char *ev_led[16]; +extern char *ev_snd[8]; +extern char *ev_rep[2]; +extern char *ev_ff[128]; +extern char *ev_pwr[1]; +extern char *ev_ff_status[2]; +extern char *ev_5[16]; +extern char *ev_6[16]; +extern char *ev_7[16]; +extern char *ev_8[16]; +extern char *ev_9[16]; +extern char *ev_10[16]; +extern char *ev_11[16]; +extern char *ev_12[16]; +extern char *ev_13[16]; +extern char *ev_14[16]; +extern char *ev_15[16]; +extern char *ev_16[16]; +extern char *ev_19[16]; +extern char *ev_24[16]; +extern char *ev_25[16]; +extern char *ev_26[16]; +extern char *ev_27[16]; +extern char *ev_28[16]; +extern char *ev_29[16]; +extern char *ev_30[16]; +extern char *ev_31[16]; +extern char **event_names[32]; -- cgit v1.2.1