Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
soc:2009:lynusvaz:journal:week11 [2009/08/03 20:01] lynusvaz created |
soc:2009:lynusvaz:journal:week11 [2009/08/06 11:51] (current) lynusvaz |
||
---|---|---|---|
Line 1: | Line 1: | ||
August 3: Stefan had a few radical suggestions on the quoting code: | August 3: Stefan had a few radical suggestions on the quoting code: | ||
* Having a sentinel to mark the end of each parsing table. This avoids passing in the length to the expand_string() function. | * Having a sentinel to mark the end of each parsing table. This avoids passing in the length to the expand_string() function. | ||
- | * Reducing the number of cases in the expand_string() function. This would reduce the number of fields in the parsing table. | + | * Reducing the number of cases in the expand_string() function. This would reduce the number of fields in the parsing table strcuture. |
- | The first one was pretty simple to do. Now, the second one needed some effort. I went through the code and realised that the four cases I had could be reduced to two: one to stop parsing at a given token, and the other to call another function. This could be done because only quotes are handled this way, and they have consistent behaviour. Since this represents a change from previous methods, I've put it in another branch: [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=shortlog;h=refs/heads/scripting_test_parse|scripting_test_parse]], and the commits are: | + | The first one was pretty simple to do. Now, the second one needed some effort. I went through the code and realised that the four cases I had could be reduced to two: one to stop parsing at a given token, and the other to call another function. This could be done because only quotes are handled using recursion, and they have consistent behaviour. Since this represents a change from previous methods, I've put it in another branch: [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=shortlog;h=refs/heads/scripting_test_parse|scripting_test_parse]], and the commits are: |
* [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=3782e478e0f1206b7abbde296d0c904e3dbc2768|Modified quoting]] | * [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=3782e478e0f1206b7abbde296d0c904e3dbc2768|Modified quoting]] | ||
* [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=ed727e23f17957886e7d03282732a95f1accebc2|Simplified expand_string()]] | * [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=ed727e23f17957886e7d03282732a95f1accebc2|Simplified expand_string()]] | ||
+ | August 5: Started on the documentation: [[http://etherboot.org/wiki/soc/2009/lynusvaz/notes/scripting_doc/features_added|Features added]] | ||
- | + | August 6: More changes to the expand_string function: | |
+ | * Remove the in_quotes parameter from the expand_string function. Since quotes are already handled by another function, there's no need to put it here. | ||
+ | * Change the sentinel from 127 to 0. This has the advantage that it will exit the function on end of the string. | ||
+ | As they say, perfection is achieved not when no more can be added, but when no more can be removed. So, I'm trying to reduce the code as much as possible. | ||