]> git.ozlabs.org Git - petitboot/blobdiff - discover/grub2/grub2.h
discover/grub2: Remove debug printfs
[petitboot] / discover / grub2 / grub2.h
index f3ad2e5b48491e30eb5d15c025d8c617e3b13284..07a1e6c7fe3517deb46e4786472cab0312a82f64 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef GRUB2_H
 #define GRUB2_H
 
+#include <regex.h>
 #include <stdbool.h>
 #include <list/list.h>
 
-struct grub2_parser;
+struct grub2_script;
 
 struct grub2_word {
        const char              *text;
@@ -30,6 +31,8 @@ struct grub2_statement {
                STMT_TYPE_IF,
                STMT_TYPE_BLOCK,
        } type;
+       int                     (*exec)(struct grub2_script *,
+                                       struct grub2_statement *);
 };
 
 struct grub2_statement_simple {
@@ -57,6 +60,8 @@ struct grub2_statement_block {
 
 struct grub2_script {
        struct grub2_statements *statements;
+       struct list             environment;
+       regex_t                 var_re;
 };
 
 struct grub2_parser {
@@ -93,6 +98,12 @@ void argv_append(struct grub2_argv *argv, struct grub2_word *word);
 void word_append(struct grub2_word *w1, struct grub2_word *w2);
 
 /* script interface */
+void script_execute(struct grub2_script *script);
+
+int statement_simple_execute(struct grub2_script *script,
+               struct grub2_statement *statement);
+int statement_if_execute(struct grub2_script *script,
+               struct grub2_statement *statement);
 
 struct grub2_script *create_script(void *ctx);