main/recipes.c

changeset 93
24cb415af787
parent 89
fa44bd094e01
child 114
1413c4c5cd8c
equal deleted inserted replaced
92:bac0a860f5dd 93:24cb415af787
148 if ((_xml_depth == 3) && (strcmp("NAME", _xml_element[2]) == 0)) { 148 if ((_xml_depth == 3) && (strcmp("NAME", _xml_element[2]) == 0)) {
149 recipe.Name[0] = '\0'; 149 recipe.Name[0] = '\0';
150 strncat(recipe.Name, char_data_buffer, 127); 150 strncat(recipe.Name, char_data_buffer, 127);
151 } else if ((_xml_depth == 3) && (strcmp("BOIL_TIME", _xml_element[2]) == 0)) { 151 } else if ((_xml_depth == 3) && (strcmp("BOIL_TIME", _xml_element[2]) == 0)) {
152 recipe.BoilTime = atoi(char_data_buffer); 152 recipe.BoilTime = atoi(char_data_buffer);
153 } else if ((_xml_depth == 3) && (strcmp("BMS_COOLING_TO", _xml_element[2]) == 0)) {
154 recipe.CoolTemp = atoi(char_data_buffer);
153 } else if ((_xml_depth == 5) && (strcmp("HOPS", _xml_element[2]) == 0) && (strcmp("HOP", _xml_element[3]) == 0)) { 155 } else if ((_xml_depth == 5) && (strcmp("HOPS", _xml_element[2]) == 0) && (strcmp("HOP", _xml_element[3]) == 0)) {
154 /* 156 /*
155 * Hops that are added during the boil. 157 * Hops that are added during the boil.
156 * But check for whirlpool hops too. 158 * But check for whirlpool hops too.
157 */ 159 */
331 XML_Parser parser = XML_ParserCreate(NULL); 333 XML_Parser parser = XML_ParserCreate(NULL);
332 334
333 int done; 335 int done;
334 _xml_depth = 0; 336 _xml_depth = 0;
335 _xml_tun_temp = 0.0; 337 _xml_tun_temp = 0.0;
338 recipe.CoolTemp = 20.0;
336 339
337 XML_SetElementHandler(parser, startElement, endElement); 340 XML_SetElementHandler(parser, startElement, endElement);
338 XML_SetCharacterDataHandler(parser, char_data); 341 XML_SetCharacterDataHandler(parser, char_data);
339 342
340 FILE *fp = fopen(fn, "r"); 343 FILE *fp = fopen(fn, "r");
361 if ((recipe.Code[i] == ' ') || (recipe.Code[i] == '.')) { 364 if ((recipe.Code[i] == ' ') || (recipe.Code[i] == '.')) {
362 recipe.Code[i] = '\0'; 365 recipe.Code[i] = '\0';
363 break; 366 break;
364 } 367 }
365 } 368 }
366 recipe.CoolTemp = 20.0;
367 369
368 #if 0 370 #if 0
369 printf("Recipe: %s\n", recipe.Name); 371 printf("Recipe: %s\n", recipe.Name);
370 printf("Code : %s\n", recipe.Code); 372 printf("Code : %s\n", recipe.Code);
371 printf("Boil time %d minutes\n", recipe.BoilTime); 373 printf("Boil time %d minutes\n", recipe.BoilTime);

mercurial