]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
block params are grub_script with independent memory
authorBVK Chaitanya <bvk.groups@gmail.com>
Wed, 9 Jun 2010 05:59:11 +0000 (11:29 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Wed, 9 Jun 2010 05:59:11 +0000 (11:29 +0530)
include/grub/script_sh.h
script/parser.y

index e1bf6f22e054f9341ffccd18aa0b64deba6a76ab..9eccb9028ac2dbe0e33f8a577bf9fd7adfa27435 100644 (file)
@@ -61,7 +61,7 @@ struct grub_script_arg
   char *str;
 
   /* Parsed block argument.  */
-  struct grub_script_cmd *block;
+  struct grub_script block;
 
   /* Next argument part.  */
   struct grub_script_arg *next;
index 9d256a15342ba9ad2d87206267af0c86c9d9012b..6669b783c356e1179d9c679b270acdc11922e5a2 100644 (file)
   struct grub_script_arglist *arglist;
   struct grub_script_arg *arg;
   char *string;
-  unsigned offset;
+  struct {
+    unsigned offset;
+    struct grub_script_mem *memory;
+  };
 }
 
 %token GRUB_PARSER_TOKEN_BAD
@@ -147,24 +150,30 @@ argument : "case"      { $$ = grub_script_add_arglist (state, 0, $1); }
          | word { $$ = $1; }
 ;
 
-block: "{" 
+block: "{"
        {
          grub_script_lexer_ref (state->lexerstate);
          $<offset>$ = grub_script_lexer_record_start (state);
+        $<memory>$ = grub_script_mem_record (state);
        }
        commands1 delimiters0 "}"
        {
          char *p;
          struct grub_script_arg *arg;
+        struct grub_script_mem *memory;
 
-         grub_script_lexer_deref (state->lexerstate);
-         if (p = grub_script_lexer_record_stop (state, $<offset>2))
+        memory = grub_script_mem_record_stop (state, $<memory>2);
+         if ((p = grub_script_lexer_record_stop (state, $<offset>2)))
           *grub_strrchr (p, '}') = '\0';
 
          if (arg = grub_script_arg_add (state, 0, GRUB_SCRIPT_ARG_TYPE_BLOCK, p))
-          arg->block = $3;
+          {
+            arg->block.cmd = $3;
+            arg->block.mem = memory;
+          }
 
          $$ = grub_script_add_arglist (state, 0, arg);
+         grub_script_lexer_deref (state->lexerstate);
        }
 ;