Commit bec84bcb18d2b689a52331ae016ea6f44110f376

Authored by Perry Werneck
1 parent dc87c478

Changing toggle id type name.

src/core/toggles/getset.c
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 41
42 /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ 42 /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/
43 43
44 -LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_TOGGLE ix) 44 +LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_TOGGLE_ID ix)
45 { 45 {
46 46
47 if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) { 47 if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) {
@@ -55,7 +55,7 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_T @@ -55,7 +55,7 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_T
55 /** 55 /**
56 * @brief Call the internal update routine and listeners. 56 * @brief Call the internal update routine and listeners.
57 */ 57 */
58 -static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE ix) 58 +static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_ID ix)
59 { 59 {
60 struct lib3270_toggle_callback * st; 60 struct lib3270_toggle_callback * st;
61 61
@@ -81,7 +81,7 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG @@ -81,7 +81,7 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG
81 * 81 *
82 * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on error (sets errno). 82 * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on error (sets errno).
83 */ 83 */
84 -LIB3270_EXPORT int lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value) 84 +LIB3270_EXPORT int lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE_ID ix, int value)
85 { 85 {
86 char v = value ? True : False; 86 char v = value ? True : False;
87 struct lib3270_toggle * t; 87 struct lib3270_toggle * t;
@@ -102,7 +102,7 @@ LIB3270_EXPORT int lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int val @@ -102,7 +102,7 @@ LIB3270_EXPORT int lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int val
102 return 1; 102 return 1;
103 } 103 }
104 104
105 -LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) 105 +LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE_ID ix)
106 { 106 {
107 struct lib3270_toggle *t; 107 struct lib3270_toggle *t;
108 108
src/core/toggles/init.c
@@ -127,7 +127,7 @@ void initialize_toggles(H3270 *session) @@ -127,7 +127,7 @@ void initialize_toggles(H3270 *session)
127 void shutdown_toggles(H3270 *session) 127 void shutdown_toggles(H3270 *session)
128 { 128 {
129 #if defined(X3270_TRACE) 129 #if defined(X3270_TRACE)
130 - static const LIB3270_TOGGLE disable_on_shutdown[] = {LIB3270_TOGGLE_DS_TRACE, LIB3270_TOGGLE_EVENT_TRACE, LIB3270_TOGGLE_SCREEN_TRACE}; 130 + static const LIB3270_TOGGLE_ID disable_on_shutdown[] = {LIB3270_TOGGLE_DS_TRACE, LIB3270_TOGGLE_EVENT_TRACE, LIB3270_TOGGLE_SCREEN_TRACE};
131 131
132 size_t f; 132 size_t f;
133 133
src/core/toggles/listener.c
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 44
45 /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ 45 /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/
46 46
47 -LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LIB3270_TOGGLE tx, void (*func)(H3270 *, LIB3270_TOGGLE, char, void *),void *data) 47 +LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LIB3270_TOGGLE_ID tx, void (*func)(H3270 *, LIB3270_TOGGLE_ID, char, void *),void *data)
48 { 48 {
49 struct lib3270_toggle_callback *st; 49 struct lib3270_toggle_callback *st;
50 50
@@ -65,7 +65,7 @@ LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LI @@ -65,7 +65,7 @@ LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LI
65 65
66 } 66 }
67 67
68 -LIB3270_EXPORT int lib3270_unregister_toggle_listener(H3270 *hSession, LIB3270_TOGGLE tx, const void *id) 68 +LIB3270_EXPORT int lib3270_unregister_toggle_listener(H3270 *hSession, LIB3270_TOGGLE_ID tx, const void *id)
69 { 69 {
70 struct lib3270_toggle_callback *st; 70 struct lib3270_toggle_callback *st;
71 struct lib3270_toggle_callback *prev = (struct lib3270_toggle_callback *) NULL; 71 struct lib3270_toggle_callback *prev = (struct lib3270_toggle_callback *) NULL;
src/core/toggles/table.c
@@ -333,14 +333,14 @@ LIB3270_EXPORT const LIB3270_TOGGLE_ENTRY * lib3270_get_toggle_list() @@ -333,14 +333,14 @@ LIB3270_EXPORT const LIB3270_TOGGLE_ENTRY * lib3270_get_toggle_list()
333 return toggle_descriptor; 333 return toggle_descriptor;
334 } 334 }
335 335
336 -LIB3270_EXPORT const char * lib3270_get_toggle_summary(LIB3270_TOGGLE ix) 336 +LIB3270_EXPORT const char * lib3270_get_toggle_summary(LIB3270_TOGGLE_ID ix)
337 { 337 {
338 if(ix < LIB3270_TOGGLE_COUNT) 338 if(ix < LIB3270_TOGGLE_COUNT)
339 return toggle_descriptor[ix].summary; 339 return toggle_descriptor[ix].summary;
340 return ""; 340 return "";
341 } 341 }
342 342
343 -LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix) 343 +LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE_ID ix)
344 { 344 {
345 if(ix < LIB3270_TOGGLE_COUNT) 345 if(ix < LIB3270_TOGGLE_COUNT)
346 return toggle_descriptor[ix].label; 346 return toggle_descriptor[ix].label;
@@ -348,21 +348,21 @@ LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix) @@ -348,21 +348,21 @@ LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix)
348 } 348 }
349 349
350 350
351 -LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix) 351 +LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix)
352 { 352 {
353 if(ix < LIB3270_TOGGLE_COUNT) 353 if(ix < LIB3270_TOGGLE_COUNT)
354 return toggle_descriptor[ix].description; 354 return toggle_descriptor[ix].description;
355 return ""; 355 return "";
356 } 356 }
357 357
358 -LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix) 358 +LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix)
359 { 359 {
360 if(ix < LIB3270_TOGGLE_COUNT) 360 if(ix < LIB3270_TOGGLE_COUNT)
361 return toggle_descriptor[ix].name; 361 return toggle_descriptor[ix].name;
362 return ""; 362 return "";
363 } 363 }
364 364
365 -LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name) 365 +LIB3270_EXPORT LIB3270_TOGGLE_ID lib3270_get_toggle_id(const char *name)
366 { 366 {
367 if(name) 367 if(name)
368 { 368 {
src/include/lib3270-internals.h
@@ -332,7 +332,7 @@ struct lib3270_toggle_callback @@ -332,7 +332,7 @@ struct lib3270_toggle_callback
332 { 332 {
333 struct lib3270_toggle_callback * next; /**< @brief Next callback in chain */ 333 struct lib3270_toggle_callback * next; /**< @brief Next callback in chain */
334 void * data; /**< @brief User data */ 334 void * data; /**< @brief User data */
335 - void (*func)(H3270 *, LIB3270_TOGGLE, char, void *); /**< @brief Function to call */ 335 + void (*func)(H3270 *, LIB3270_TOGGLE_ID, char, void *); /**< @brief Function to call */
336 }; 336 };
337 337
338 /** 338 /**
src/include/lib3270/session.h
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 59
60 void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); 60 void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
61 void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on); 61 void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on);
62 - void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name); 62 + void (*update_toggle)(H3270 *session, LIB3270_TOGGLE_ID ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name);
63 void (*update_luname)(H3270 *session, const char *name); 63 void (*update_luname)(H3270 *session, const char *name);
64 void (*update_status)(H3270 *session, LIB3270_MESSAGE id); 64 void (*update_status)(H3270 *session, LIB3270_MESSAGE id);
65 void (*update_connect)(H3270 *session, unsigned char connected); 65 void (*update_connect)(H3270 *session, unsigned char connected);
src/include/lib3270/toggle.h
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 /** 40 /**
41 * @brief Toogles. 41 * @brief Toogles.
42 */ 42 */
43 - typedef enum _lib3270_toggle 43 + typedef enum _lib3270_toggle_id
44 { 44 {
45 LIB3270_TOGGLE_MONOCASE, 45 LIB3270_TOGGLE_MONOCASE,
46 LIB3270_TOGGLE_CURSOR_BLINK, 46 LIB3270_TOGGLE_CURSOR_BLINK,
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 72
73 LIB3270_TOGGLE_COUNT 73 LIB3270_TOGGLE_COUNT
74 74
75 - } LIB3270_TOGGLE; 75 + } LIB3270_TOGGLE_ID;
76 76
77 /** 77 /**
78 * @brief Toggle types. 78 * @brief Toggle types.
@@ -95,11 +95,11 @@ @@ -95,11 +95,11 @@
95 { 95 {
96 LIB3270_PROPERTY_HEAD 96 LIB3270_PROPERTY_HEAD
97 97
98 - LIB3270_TOGGLE id; ///< @brief Toggle ID.  
99 - const char def; ///< @brief Default value.  
100 - const char * key; ///< @brief Default key (or NULL if no default).  
101 - const char * icon; ///< @brief Icon name (from https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html)  
102 - const char * label; ///< @brief Button label (or NULL). 98 + LIB3270_TOGGLE_ID id; ///< @brief Toggle ID.
  99 + const char def; ///< @brief Default value.
  100 + const char * key; ///< @brief Default key (or NULL if no default).
  101 + const char * icon; ///< @brief Icon name (from https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html)
  102 + const char * label; ///< @brief Button label (or NULL).
103 103
104 } LIB3270_TOGGLE_ENTRY; 104 } LIB3270_TOGGLE_ENTRY;
105 105
@@ -118,7 +118,7 @@ @@ -118,7 +118,7 @@
118 * @return 0 if the toggle is disabled, non zero if enabled. 118 * @return 0 if the toggle is disabled, non zero if enabled.
119 * 119 *
120 */ 120 */
121 - LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_TOGGLE ix); 121 + LIB3270_EXPORT unsigned char lib3270_get_toggle(const H3270 *hSession, LIB3270_TOGGLE_ID ix);
122 122
123 /** 123 /**
124 * @brief Set toggle state. 124 * @brief Set toggle state.
@@ -132,7 +132,7 @@ @@ -132,7 +132,7 @@
132 * @retval -EINVAL Invalid toggle id. 132 * @retval -EINVAL Invalid toggle id.
133 * 133 *
134 */ 134 */
135 - LIB3270_EXPORT int lib3270_set_toggle(H3270 *hSession, LIB3270_TOGGLE ix, int value); 135 + LIB3270_EXPORT int lib3270_set_toggle(H3270 *hSession, LIB3270_TOGGLE_ID ix, int value);
136 136
137 /** 137 /**
138 * @brief Translate a string toggle name to the corresponding value. 138 * @brief Translate a string toggle name to the corresponding value.
@@ -142,7 +142,7 @@ @@ -142,7 +142,7 @@
142 * @return Toggle ID or negative if it's invalid. 142 * @return Toggle ID or negative if it's invalid.
143 * 143 *
144 */ 144 */
145 - LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name); 145 + LIB3270_EXPORT LIB3270_TOGGLE_ID lib3270_get_toggle_id(const char *name);
146 146
147 /** 147 /**
148 * @brief Get the toggle name as string. 148 * @brief Get the toggle name as string.
@@ -152,7 +152,7 @@ @@ -152,7 +152,7 @@
152 * @return Constant string with the toggle name or "" if invalid. 152 * @return Constant string with the toggle name or "" if invalid.
153 * 153 *
154 */ 154 */
155 - LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix); 155 + LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix);
156 156
157 /** 157 /**
158 * @brief Get a long description of the toggle. 158 * @brief Get a long description of the toggle.
@@ -160,7 +160,7 @@ @@ -160,7 +160,7 @@
160 * @return Constant string with the toggle description. 160 * @return Constant string with the toggle description.
161 * 161 *
162 */ 162 */
163 - LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix); 163 + LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix);
164 164
165 /** 165 /**
166 * @brief Get a summary description of the toggle (for menus). 166 * @brief Get a summary description of the toggle (for menus).
@@ -168,7 +168,7 @@ @@ -168,7 +168,7 @@
168 * @return Constant string with the toggle summary. 168 * @return Constant string with the toggle summary.
169 * 169 *
170 */ 170 */
171 - LIB3270_EXPORT const char * lib3270_get_toggle_summary(LIB3270_TOGGLE ix); 171 + LIB3270_EXPORT const char * lib3270_get_toggle_summary(LIB3270_TOGGLE_ID ix);
172 172
173 /** 173 /**
174 * @brief Get a short description of the toggle (for buttons). 174 * @brief Get a short description of the toggle (for buttons).
@@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
176 * @return Constant string with the toggle label. 176 * @return Constant string with the toggle label.
177 * 177 *
178 */ 178 */
179 - LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix); 179 + LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE_ID ix);
180 180
181 /** 181 /**
182 * @brief Revert toggle status. 182 * @brief Revert toggle status.
@@ -188,10 +188,10 @@ @@ -188,10 +188,10 @@
188 * 188 *
189 * @retval -EINVAL Invalid toggle id. 189 * @retval -EINVAL Invalid toggle id.
190 */ 190 */
191 - LIB3270_EXPORT int lib3270_toggle(H3270 *hSession, LIB3270_TOGGLE ix); 191 + LIB3270_EXPORT int lib3270_toggle(H3270 *hSession, LIB3270_TOGGLE_ID ix);
192 192
193 - LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LIB3270_TOGGLE tx, void (*func)(H3270 *, LIB3270_TOGGLE, char, void *),void *data);  
194 - LIB3270_EXPORT int lib3270_unregister_toggle_listener(H3270 *hSession, LIB3270_TOGGLE tx, const void *id); 193 + LIB3270_EXPORT const void * lib3270_register_toggle_listener(H3270 *hSession, LIB3270_TOGGLE_ID tx, void (*func)(H3270 *, LIB3270_TOGGLE_ID, char, void *),void *data);
  194 + LIB3270_EXPORT int lib3270_unregister_toggle_listener(H3270 *hSession, LIB3270_TOGGLE_ID tx, const void *id);
195 195
196 #ifdef __cplusplus 196 #ifdef __cplusplus
197 } 197 }
src/include/screenc.h
@@ -47,7 +47,7 @@ LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_POINTER m); @@ -47,7 +47,7 @@ LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_POINTER m);
47 #define mcursor_normal(x) mcursor_set(x,LIB3270_POINTER_UNLOCKED) 47 #define mcursor_normal(x) mcursor_set(x,LIB3270_POINTER_UNLOCKED)
48 #define mcursor_waiting(x) mcursor_set(x,LIB3270_POINTER_WAITING) 48 #define mcursor_waiting(x) mcursor_set(x,LIB3270_POINTER_WAITING)
49 49
50 -LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason); 50 +LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE_ID ix, unsigned char value, LIB3270_TOGGLE_TYPE reason);
51 LIB3270_INTERNAL void set_viewsize(H3270 *session, unsigned int rows, unsigned int cols); 51 LIB3270_INTERNAL void set_viewsize(H3270 *session, unsigned int rows, unsigned int cols);
52 52
53 // LIB3270_INTERNAL Boolean escaped; 53 // LIB3270_INTERNAL Boolean escaped;