GRUB2_WORD_VAR,
} type;
union {
- char *text;
- struct {
- const char *name;
- bool split;
- } var;
+ char *text;
+ const char *name;
};
+ bool split;
struct grub2_word *next;
struct grub2_word *last;
struct list_item argv_list;
struct grub2_argv {
struct list words;
+
+ /* postprocessing (with process_expansions) populates these to hand to
+ * the grub2_command callbacks */
+ char **argv;
+ int argc;
};
struct grub2_statements {
struct grub2_statements *statements;
};
+struct grub2_command {
+ const char *name;
+ int (*exec)(struct grub2_script *script,
+ int argc, char *argv[]);
+ struct list_item list;
+};
+
struct grub2_script {
struct grub2_statements *statements;
struct list environment;
+ struct list commands;
+ struct list symtab;
};
struct grub2_parser {
struct grub2_statement *statement);
int statement_if_execute(struct grub2_script *script,
struct grub2_statement *statement);
+int statement_menuentry_execute(struct grub2_script *script,
+ struct grub2_statement *statement);
struct grub2_script *create_script(void *ctx);
+const char *script_env_get(struct grub2_script *script, const char *name);
+
+void script_env_set(struct grub2_script *script,
+ const char *name, const char *value);
+
+void script_register_command(struct grub2_script *script,
+ struct grub2_command *command);
+
+struct grub2_command *script_lookup_command(struct grub2_script *script,
+ const char *name);
+
+void register_builtins(struct grub2_script *script);
#endif /* GRUB2_H */