August 10: Still trying to reduce the code. Tried to remove the int *success parameter of the expand_string() function. This parameter tells the calling function whether a new word was recognised. However, I had some problems in case of the line-continuation \.

for i in 1 2 3 \
  4 5 6    # the space at the beginning of this line causes the problem
do
    echo ${i}
done

seems to require some way to see that the \<newline> is not a new word.

August 11: Decided to try using the gen_stack for the arithmetic parser code. The benefits should include a simpler memory allocation strategy. The idea is to use an explicit stack to store the operands. When an operator is found, the top of the stack should contain the (evaluated) left operator. Then the right operator is evaluated, and pushed on the stack by recursive calls to the parsing function. Then the top two elements of the stack are popped, evaluated, and the result is pushed back. If at any time an error is found, the top-level function frees the stack. This frees up the other functions from having to free the temporary values.

August 13: Finally used the gen_stack for arith.c. Size check: After:

 2276	      8	     16	   2300	    8fc	bin/arith.o

Before

 2172	      0	     16	   2188	    88c	bin/arith.o

However, I had some problems with the branches and loops, so that doesn't work just yet. Have to fix it next. Also split the gen_stack commit out of the quoting patch.

August 14: Fixed up the branching and loop code. Using the new gen_stack code made me change a lot of things in the offset branch. Since I was focussing mostly on the arith.c changes, I just tried to make this part compile properly. So, today, I worked on fixing it up.

August 16: Okay, so it's the end of GSoC, and it's been an enjoyable time. To summarise the work done so far:

Features implemented:

  • Quoting
  • Arithmetic parser
  • If-else branches
  • Looping
  • Return code

'Supporting' additions:

  • Generic stack
  • Simple automated testing of scripts, using qemu

Documentation of the features can be found here. The code can be found in the expt branch of my git repository. I'll be sending in the changes in a series of patches to the etherboot-developers mailing list. Size check: After:

159	      0	      0	    159	     9f	bin/gen_stack.o
602	     24	      4	    630	    276	bin/shell.o
639	     12	      4	    655	    28f	bin/exec.o
1079	      0	      0	   1079	    437	bin/parse.o
1855	    160	     24	   2039	    7f7	bin/if_cmd.o
2308	      8	     16	   2332	    91c	bin/arith.o
87732	  11528	 139822	 239082	  3a5ea	(TOTALS)

Compressed size: 59392

Before:

321	     16	      4	    341	    155	bin/shell.o
629	      8	      0	    637	    27d	bin/exec.o
81979	  11308	 139774	 233061	  38e65	(TOTALS)

Compressed size: 55808


Navigation

* [[:start|Home]] * [[:about|About our Project]] * [[:download|Download]] * [[:screenshots|Screenshots]] * Documentation * [[:howtos|HowTo Guides]] * [[:appnotes|Application Notes]] * [[:faq:|FAQs]] * [[:doc|General Doc]] * [[:talks|Videos, Talks, and Papers]] * [[:hardwareissues|Hardware Issues]] * [[:mailinglists|Mailing lists]] * [[http://support.etherboot.org/|Bugtracker]] * [[:contributing|Contributing]] * [[:editing_permission|Wiki Edit Permission]] * [[:wiki:syntax|Wiki Syntax]] * [[:contact|Contact]] * [[:relatedlinks|Related Links]] * [[:commerciallinks|Commercial Links]] * [[:acknowledgements|Acknowledgements]] * [[:logos|Logo Art]]

QR Code
QR Code soc:2009:lynusvaz:journal:week12 (generated for current page)