This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

June 29: Implemented while-done loops and for-done loops. The current idea is: * I have a global variable prog_ctr, that is the program counter * A stack (not as a stack, but just for storage space) is used to store the commands * Another stack is used to store the information for a loop. * In the system() function (I'm using this because it is the common point for both scripts and typed commands), a command is stored if the prog_ctr >= size of the command list. This means that it is a new line, that has not been stored before * while, for, do (not yet implemented), done, break and continue are defined as commands. * The while and for commands will push the required information onto the loop stack, and the evaluated condition onto the if stack. In addition, the for command has to check whether this is the first iteration. If so, it will set the loop variable to the first word in the list, else it will set it to the next one. Similar to the if command, the while and for commands will push a 0 onto the if stack if the top of the stack is 0 (meaning that the commands in the loop should not be executed). * The done command will check whether the top of the if stack is true. While it is true, all the commands inside the loop will be executed. This will run through all loops exactly one extra time, without executing it. * break and continue will set the values in the if stack, from the while/for condition to the top of the stack to 0. Now, since continue means to continue from the next iteration onwards, this fact needs to be stored as part of loop information, and considered by the done command. * The do command will need some thought. Hence, the following fields are needed for each loop: * program counter for start of the loop * the position of the loop condition on the if stack (required for break and continue) * whether we have encountered a continue * the current argument in a for loop Today's commits: * [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=d4463f3200f62c7a6da7e61dc1f85ea96d1c100d|while with break and continue]] * [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=917fa47074045e186f23209b11e833fdffc275d3|for loops]] June 30: Implemented the do command as just a no-op. This was done just for the sake of familiarity with the shell syntax. Another decision was to allow recursive expansion of variables. This will allow the use of 'references', where a variable can hold the name of another. For example: set cur-iface net0 echo ${${cur-iface}/ip} will print out the IP address associated with the net0 interface. Today's commits: * [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=438a1ea821f0e9c6585b6824a5dd8878a84a6eaf|done command]] * [[http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=d0f2570a3bf10aef1c5ba57abea104d205ac35d1|recursive variable expansion]]


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:week6 (generated for current page)