This is an old revision of the document!
July 27-28: Trying to improve the arith.c file: * Reducing number of global variables: in particular the err_val, tok and incomplete variables * Strategies for string management * Modify strtoul to handle a +/- sign (there are cases when I need to 'recognize' negative numbers) However, it's turning out to be a rather difficult task. The err_val and tok should have been easy to unify, but there seems to be a memory leak problem, when an error is encountered after a string token is found (and allocated). The string management is another problem. The parse_arith() function takes a struct string as input. The input() function goes along the same struct string to get the next token. But, the parsing functions dynamically allocate space for the result. I find this tree-like method of operation simpler to handle. But this can easily cause memory leak problems on parse errors, which is something I'm still trying to fix. July 29-31: Unified the err_val and tok variables. The tok variable now takes negative values on errors, and the 'forgotten' string token is freed before setting it. It's back to valgrind and gcov for testing. An interesting issue I didn't notice is using an int to store the difference between pointers. Apparently this will not work in a 64-bit environment, so I had to use longs at all these places. Size check: Before (official gPXE source): 321 16 4 341 155 bin/shell.o 548 88 0 636 27c bin/bios_console.o 629 8 0 637 27d bin/exec.o 2365 95 2 2462 99e bin/comboot_call.o 81784 11300 139774 232858 38d9a (TOTALS) After (quoting and arithmetic parser): 11 24 0 35 23 bin/serial_console.o 335 16 4 355 163 bin/shell.o 577 8 4 589 24d bin/exec.o 1322 0 0 1322 52a bin/parse.o 2232 0 20 2252 8cc bin/arith.o 2377 95 2 2474 9aa bin/comboot_call.o 84571 11236 139798 235605 39855 (TOTALS) And the bin/rtl8139.rom has grown from 55808 to 57344B. Latest commit in the [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=shortlog;h=refs/heads/scripting_test|scripting_test]] branch: [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=d6f7017ac5827009d21648b079538fb5eeaed002|Arithmetic parser]]