]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
remove menuentry from GRUB script
authorBVK Chaitanya <bvk.groups@gmail.com>
Thu, 10 Jun 2010 12:45:38 +0000 (18:15 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Thu, 10 Jun 2010 12:45:38 +0000 (18:15 +0530)
include/grub/script_sh.h
script/execute.c
script/parser.y
script/script.c
script/yylex.l
util/grub-script-check.c

index a17dcca7028df5d3a03f70af7f2c6feeac105afd..88641300f7325e475dc10cbe383284a4765915c0 100644 (file)
@@ -139,21 +139,6 @@ struct grub_script_cmdwhile
   int until;
 };
 
-/* A menu entry generate statement.  */
-struct grub_script_cmd_menuentry
-{
-  struct grub_script_cmd cmd;
-
-  /* The arguments for this menu entry.  */
-  struct grub_script_arglist *arglist;
-
-  /* The sourcecode the entry will be generated from.  */
-  const char *sourcecode;
-
-  /* Options.  XXX: Not used yet.  */
-  int options;
-};
-
 /* State of the lexer as passed to the lexer.  */
 struct grub_lexer_param
 {
@@ -263,12 +248,6 @@ grub_script_create_cmdwhile (struct grub_parser_param *state,
                             struct grub_script_cmd *list,
                             int is_an_until_loop);
 
-struct grub_script_cmd *
-grub_script_create_cmdmenu (struct grub_parser_param *state,
-                           struct grub_script_arglist *arglist,
-                           char *sourcecode,
-                           int options);
-
 struct grub_script_cmd *
 grub_script_append_cmd (struct grub_parser_param *state,
                        struct grub_script_cmd *list,
@@ -313,7 +292,6 @@ grub_err_t grub_script_execute_cmdlist (struct grub_script_cmd *cmd);
 grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
 grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
 grub_err_t grub_script_execute_cmdwhile (struct grub_script_cmd *cmd);
-grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
 
 /* Execute any GRUB pre-parsed command or script.  */
 grub_err_t grub_script_execute (struct grub_script *script);
index 0ac42cf4ac6261a788ba803a51850d5285a02b8e..e7a809bd1235fca2aa0611cd461c0325348b0ea5 100644 (file)
@@ -424,31 +424,6 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd)
   return result;
 }
 
-/* Execute the menu entry generate statement.  */
-grub_err_t
-grub_script_execute_menuentry (struct grub_script_cmd *cmd)
-{
-  struct grub_script_cmd_menuentry *cmd_menuentry;
-  struct grub_script_argv argv = { 0, 0, 0 };
-
-  cmd_menuentry = (struct grub_script_cmd_menuentry *) cmd;
-
-  if (cmd_menuentry->arglist)
-    {
-      if (grub_script_arglist_to_argv (cmd_menuentry->arglist, &argv))
-       return grub_errno;
-    }
-
-  grub_normal_add_menu_entry (argv.argc, (const char **) argv.args,
-                             cmd_menuentry->sourcecode);
-
-  grub_script_argv_free (&argv);
-
-  return grub_errno;
-}
-
-
-
 /* Execute any GRUB pre-parsed command or script.  */
 grub_err_t
 grub_script_execute (struct grub_script *script)
index d774ca9189469a6fce22a0e38338edfec6da0d96..39cf675a1b2b117e92c05f7a2521fccd70aa0833 100644 (file)
@@ -73,7 +73,6 @@
 %token <arg> GRUB_PARSER_TOKEN_WHILE     "while"
 %token <arg> GRUB_PARSER_TOKEN_TIME      "time"
 %token <arg> GRUB_PARSER_TOKEN_FUNCTION  "function"
-%token <arg> GRUB_PARSER_TOKEN_MENUENTRY "menuentry"
 %token <arg> GRUB_PARSER_TOKEN_NAME      "name"
 %token <arg> GRUB_PARSER_TOKEN_WORD      "word"
 
@@ -81,7 +80,7 @@
 
 %type <cmd> script_init script
 %type <cmd> grubcmd ifclause ifcmd forcmd whilecmd untilcmd
-%type <cmd> command commands1 menuentry statement
+%type <cmd> command commands1 statement
 
 %pure-parser
 %lex-param   { struct grub_parser_param *state };
@@ -127,8 +126,7 @@ word: GRUB_PARSER_TOKEN_NAME { $$ = grub_script_add_arglist (state, 0, $1); }
 
 statement: command   { $$ = $1; }
          | function  { $$ = 0;  }
-         | menuentry { $$ = $1; }
-
+;
 argument : "case"      { $$ = grub_script_add_arglist (state, 0, $1); }
          | "do"        { $$ = grub_script_add_arglist (state, 0, $1); }
          | "done"      { $$ = grub_script_add_arglist (state, 0, $1); }
@@ -144,7 +142,6 @@ argument : "case"      { $$ = grub_script_add_arglist (state, 0, $1); }
          | "until"     { $$ = grub_script_add_arglist (state, 0, $1); }
          | "while"     { $$ = grub_script_add_arglist (state, 0, $1); }
          | "function"  { $$ = grub_script_add_arglist (state, 0, $1); }
-         | "menuentry" { $$ = grub_script_add_arglist (state, 0, $1); }
          | word { $$ = $1; }
 ;
 
@@ -263,25 +260,6 @@ function: "function" "name"
           }
 ;
 
-menuentry: "menuentry"
-           {
-             grub_script_lexer_ref (state->lexerstate);
-           }
-           arguments1
-           {
-             $<offset>$ = grub_script_lexer_record_start (state);
-           }
-           delimiters0 "{" commands1 delimiters1 "}"
-           {
-             char *def;
-             def = grub_script_lexer_record_stop (state, $<offset>4);
-            *grub_strrchr(def, '}') = '\0';
-
-             grub_script_lexer_deref (state->lexerstate);
-             $$ = grub_script_create_cmdmenu (state, $3, def, 0);
-           }
-;
-
 ifcmd: "if"
        {
          grub_script_lexer_ref (state->lexerstate);
index 9017a08e8dd0ae552d04529bba78e80c3292c489..847e4f077e949999252bbbc180b72c8d4c515531 100644 (file)
@@ -273,30 +273,6 @@ grub_script_create_cmdwhile (struct grub_parser_param *state,
   return (struct grub_script_cmd *) cmd;
 }
 
-/* Create a command that adds a menu entry to the menu.  Title is an
-   argument that is parsed to generate a string that can be used as
-   the title.  The sourcecode for this entry is passed in SOURCECODE.
-   The options for this entry are passed in OPTIONS.  */
-struct grub_script_cmd *
-grub_script_create_cmdmenu (struct grub_parser_param *state,
-                           struct grub_script_arglist *arglist,
-                           char *sourcecode, int options)
-{
-  struct grub_script_cmd_menuentry *cmd;
-
-  cmd = grub_script_malloc (state, sizeof (*cmd));
-  if (!cmd)
-    return 0;
-    
-  cmd->cmd.exec = grub_script_execute_menuentry;
-  cmd->cmd.next = 0;
-  cmd->sourcecode = sourcecode;
-  cmd->arglist = arglist;
-  cmd->options = options;
-
-  return (struct grub_script_cmd *) cmd;
-}
-
 /* Create a chain of commands.  LAST contains the command that should
    be added at the end of LIST's list.  If LIST is zero, a new list
    will be created.  */
index bfc53a6ff67ec0be9060aafcb2f1d7414114f281..a084ba1fcf24628f1349bdfadb68c867c1bc9e48 100644 (file)
@@ -169,7 +169,6 @@ WORD            ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
 "until"         { RECORD; return GRUB_PARSER_TOKEN_UNTIL;     }
 "while"         { RECORD; return GRUB_PARSER_TOKEN_WHILE;     }
 "function"      { RECORD; return GRUB_PARSER_TOKEN_FUNCTION;  }
-"menuentry"     { RECORD; return GRUB_PARSER_TOKEN_MENUENTRY; }
 
 {NAME}          { RECORD; return GRUB_PARSER_TOKEN_NAME; }
 {WORD}          {
index 8995520bbfd1123eac560c5e5052f72274bd0368..2469d5b069d50861ef185d794f6d932a01558872 100644 (file)
@@ -93,12 +93,6 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd __attribute__ ((unused
   return 0;
 }
 
-grub_err_t
-grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused)))
-{
-  return 0;
-}
-
 grub_err_t
 grub_script_execute (struct grub_script *script)
 {