diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-01-24 14:40:46 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-30 21:59:10 +0800 |
commit | 1b272c7d47390077eee0a0638329b1a7df521329 (patch) | |
tree | 43b348731a7db7585050ebc8140790f91232b01a /discover/grub2/grub2.h | |
parent | e1b713b0c862a93cd3e8cea59070f469510d3c39 (diff) | |
download | talos-petitboot-1b272c7d47390077eee0a0638329b1a7df521329.tar.gz talos-petitboot-1b272c7d47390077eee0a0638329b1a7df521329.zip |
discover/grub2: Add support for for-loops
GRUB2 syntax allows for for-loops; this change adds supoprt in the
parser grammar and script execution code to implement them. In the
execution code, we simply update the for-loop variable and re-execute
the body statements.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2/grub2.h')
-rw-r--r-- | discover/grub2/grub2.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h index 6166289..e79bf41 100644 --- a/discover/grub2/grub2.h +++ b/discover/grub2/grub2.h @@ -83,6 +83,13 @@ struct grub2_statement_function { struct grub2_statements *body; }; +struct grub2_statement_for { + struct grub2_statement st; + struct grub2_word *var; + struct grub2_argv *list; + struct grub2_statements *body; +}; + struct grub2_script { struct grub2_statements *statements; struct list environment; @@ -125,6 +132,10 @@ struct grub2_statement *create_statement_block(struct grub2_parser *parser, struct grub2_statement *create_statement_function(struct grub2_parser *parser, struct grub2_word *name, struct grub2_statements *body); +struct grub2_statement *create_statement_for(struct grub2_parser *parser, + struct grub2_word *var, struct grub2_argv *list, + struct grub2_statements *body); + struct grub2_word *create_word_text(struct grub2_parser *parser, const char *text); @@ -153,6 +164,8 @@ int statement_menuentry_execute(struct grub2_script *script, struct grub2_statement *statement); int statement_function_execute(struct grub2_script *script, struct grub2_statement *statement); +int statement_for_execute(struct grub2_script *script, + struct grub2_statement *statement); struct grub2_script *create_script(struct grub2_parser *parser, struct discover_context *ctx); |