Unfortunately I haven't had a lot of time to work with GRUB2. I'll have some more when my holidays begin in mid October.
Yoshinori K. Okuji wrote: > >I'd like to see a kind of "design document", since it is a bit hard for others >to understand. > > Ok. I send one with this mail. Perhaps it would be good to add a folder for developpement docs and standartisize the format. What about /devdocs and html? >We must wait until your assignment is finished. How is it going? > > > It's strange. It's already a month that I sent my assignment and I've still nothing received. Vladimir ------------------------------------------------------------------ The scripting engine is separated into 2 parts: parser and executer. Parser is wirtten with bison using hand-written yylex. It transforms one command into grub_script_commandlist. This structure represents a chain of commands in the form of linked list. Every single command is represented by grub_script_command. Which has the following fields: enum grub_script_command_type type which indicates what command it is: GRUB_SCRIPT_COMMAND_NORMAL - just a non-scripting command GRUB_SCRIPT_COMMAND_FORIN - used for for..in.. GRUB_SCRIPT_COMMAND_LOOKUP - used for block-end keyword like done, fi indicating to interpreter to relaunch or end the loop enum grub_script_command_chain which indicates how this command is linked with previous: independent, with && or with ||. flags: command flags. Now only GRUB_SCRIPT_COMMAND_FLAG_NOT (command was with !) is defined. non-scripting command: struct grub_script_superchars *normal - a non-scripting command to execute. for...in: struct grub_script_superchars *var - a variable to set struct grub_script_superchars *vals - the values to set to var struct grub_script_commandlist *lookup - where the end of loop is. grub_script_sueprchar is used to store the strings. char * is unappropriated because value of the string is unknown at parsing time. it's separated in chunks which are represented in linked list. There are 4 types of chunks: plain (just a string), variable ($var), arithmethic ($((expression))) and command (`cmd` or $(cmd)) to transform to char* superchartostring is used. grub_script_superchars is used to store array of strings like command with arguments a variable list. supercharstostrings is used to transform to char** terminal tokens: ENTER: '\n' FOR: "for" keyword SEMICOLON: ';' IN: "in" keyword DO: "do" keyword DONE: "done" keyword NOP: not used WORD: any word, that is not a keyword. Represented like superchars OR: "||" keyword AND: "&&" keyword NOT: '!' keyword other symbols out: output commandlist : list of commands arglist : list of words (like not scripting command with arguments or vallist for for..in) command : execlist : list of inter-linked (by || or &&) commands pre_command : solitary command that waits for ||, &&, ; or newline cmdend: end of execlist (; or newline) I hope that this small design document will help. All propositions and questions are welcome. _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel