comparison th_config.c @ 773:4744e64ffa3a

Whoops. s/ITEM_bool/ITEM_BOOL/g; s/PM_bool/PM_BOOL/g.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Jul 2023 20:33:45 +0300
parents c17eadc60c3d
children 08bbfb5239fc
comparison
equal deleted inserted replaced
772:1959ba53e9dc 773:4744e64ffa3a
125 /* Add boolean type setting into given configuration 125 /* Add boolean type setting into given configuration
126 */ 126 */
127 int th_cfg_add_bool(th_cfgitem_t **cfg, const char *name, 127 int th_cfg_add_bool(th_cfgitem_t **cfg, const char *name,
128 bool *itemData, bool defValue) 128 bool *itemData, bool defValue)
129 { 129 {
130 th_cfgitem_t *node = th_cfg_add(cfg, name, ITEM_bool, (void *) itemData); 130 th_cfgitem_t *node = th_cfg_add(cfg, name, ITEM_BOOL, (void *) itemData);
131 if (node == NULL) 131 if (node == NULL)
132 return THERR_MALLOC; 132 return THERR_MALLOC;
133 133
134 *itemData = defValue; 134 *itemData = defValue;
135 135
187 PM_NEXT, 187 PM_NEXT,
188 PM_KEYNAME, 188 PM_KEYNAME,
189 PM_KEYSET, 189 PM_KEYSET,
190 PM_STRING, 190 PM_STRING,
191 PM_NUMERIC, 191 PM_NUMERIC,
192 PM_bool, 192 PM_BOOL,
193 PM_SECTION, 193 PM_SECTION,
194 PM_LIST, 194 PM_LIST,
195 195
196 PM_LAST 196 PM_LAST
197 }; 197 };
245 case ITEM_INT: 245 case ITEM_INT:
246 case ITEM_UINT: 246 case ITEM_UINT:
247 case ITEM_FLOAT: 247 case ITEM_FLOAT:
248 return PM_NUMERIC; 248 return PM_NUMERIC;
249 249
250 case ITEM_bool: 250 case ITEM_BOOL:
251 return PM_bool; 251 return PM_BOOL;
252 252
253 case ITEM_SECTION: 253 case ITEM_SECTION:
254 return PM_SECTION; 254 return PM_SECTION;
255 255
256 case ITEM_STRING_LIST: 256 case ITEM_STRING_LIST:
302 302
303 case ITEM_FLOAT: 303 case ITEM_FLOAT:
304 *(item->v.val_float) = atof(str); 304 *(item->v.val_float) = atof(str);
305 break; 305 break;
306 306
307 case ITEM_bool: 307 case ITEM_BOOL:
308 res = th_get_boolean(str, item->v.val_bool); 308 res = th_get_boolean(str, item->v.val_bool);
309 break; 309 break;
310 310
311 default: 311 default:
312 res = false; 312 res = false;
679 679
680 isStart = false; 680 isStart = false;
681 ctx.ch = -1; 681 ctx.ch = -1;
682 break; 682 break;
683 683
684 case PM_bool: 684 case PM_BOOL:
685 // Boolean parsing mode 685 // Boolean parsing mode
686 if (isStart) 686 if (isStart)
687 { 687 {
688 isStart = false; 688 isStart = false;
689 strPos = 0; 689 strPos = 0;
773 return true; 773 return true;
774 774
775 case ITEM_INT: 775 case ITEM_INT:
776 case ITEM_UINT: 776 case ITEM_UINT:
777 case ITEM_FLOAT: 777 case ITEM_FLOAT:
778 case ITEM_bool: 778 case ITEM_BOOL:
779 case ITEM_HEX_TRIPLET: 779 case ITEM_HEX_TRIPLET:
780 return true; 780 return true;
781 781
782 default: 782 default:
783 return false; 783 return false;
825 return thfprintf(fh, "%u", *(item->v.val_uint)); 825 return thfprintf(fh, "%u", *(item->v.val_uint));
826 826
827 case ITEM_FLOAT: 827 case ITEM_FLOAT:
828 return thfprintf(fh, "%1.5f", *(item->v.val_float)); 828 return thfprintf(fh, "%1.5f", *(item->v.val_float));
829 829
830 case ITEM_bool: 830 case ITEM_BOOL:
831 return thfprintf(fh, "%s", *(item->v.val_bool) ? "yes" : "no"); 831 return thfprintf(fh, "%s", *(item->v.val_bool) ? "yes" : "no");
832 832
833 case ITEM_HEX_TRIPLET: 833 case ITEM_HEX_TRIPLET:
834 return thfprintf(fh, "\"%06x\"", *(item->v.val_int)); 834 return thfprintf(fh, "\"%06x\"", *(item->v.val_int));
835 835