Add "include" command to the core syslinux parser
authorH. Peter Anvin <hpa@zytor.com>
Wed, 23 May 2007 05:58:57 +0000 (22:58 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 23 May 2007 05:58:57 +0000 (22:58 -0700)
keywords
keywords.inc
parsecmd.inc
parseconfig.inc

index 72a880d..d7d8fa6 100644 (file)
--- a/keywords
+++ b/keywords
@@ -1,5 +1,6 @@
 menu
 text
+include
 append
 config
 default
index ab202b5..a97d360 100644 (file)
@@ -1,6 +1,6 @@
 ;; -----------------------------------------------------------------------
 ;;
-;;   Copyright 1994-2006 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2007 H. Peter Anvin - All Rights Reserved
 ;;
 ;;   This program is free software; you can redistribute it and/or modify
 ;;   it under the terms of the GNU General Public License as published by
@@ -47,6 +47,7 @@ keywd_size    equ 8   ; Bytes per keyword
 keywd_table:
                keyword menu,           pc_comment
                keyword text,           pc_text
+               keyword include,        pc_filecmd,     pc_include
                keyword append,         pc_append
                keyword default,        pc_default
                keyword display,        pc_filecmd,     get_msg_file
index 564b592..ea7d0fc 100644 (file)
@@ -1,6 +1,6 @@
 ;; -----------------------------------------------------------------------
 ;;
-;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2007 H. Peter Anvin - All Rights Reserved
 ;;
 ;;   This program is free software; you can redistribute it and/or modify
 ;;   it under the terms of the GNU General Public License as published by
index 090aa9a..2b6031f 100644 (file)
@@ -1,6 +1,6 @@
 ;; -----------------------------------------------------------------------
 ;;
-;;   Copyright 1994-2006 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2007 H. Peter Anvin - All Rights Reserved
 ;;
 ;;   This program is free software; you can redistribute it and/or modify
 ;;   it under the terms of the GNU General Public License as published by
@@ -145,7 +145,7 @@ pc_setint16:
 
 ;
 ; Generic file-processing commands:
-; "display", "font", "kbdmap"
+; "display", "font", "kbdmap", "include"
 ;
 pc_filecmd:    push ax                         ; Function to tailcall
                call pc_getline
@@ -157,6 +157,14 @@ pc_filecmd:        push ax                         ; Function to tailcall
 .ok:           ret                             ; Tailcall if OK, error return
 
 ;
+; "include" command (invoked from pc_filecmd)
+;
+pc_include:    call openfd
+               jz .err
+               inc word [IncludeLevel]
+.err:          ret
+
+;
 ; "serial" command
 ;
 pc_serial:     call getint
@@ -355,9 +363,14 @@ parse_config:
                xor ax,ax
                mov cx,vk_size
                rep stosb
+
 .again:
-               call getcommand
-                jnc .again                     ; If not EOF do it again
+               call getcommand                 ; Parse one command
+                jnc .again                     ; If not EOF...
+               call close
+               dec word [IncludeLevel]         ; Still parsing?
+               jnz .again
+
                ;
                ; The fall through to commit_vk to commit any final
                ; VKernel being read
@@ -414,6 +427,7 @@ ForcePrompt dw 0                    ; Force prompt
 NoEscape       dw 0                    ; No escape
 AllowImplicit   dw 1                    ; Allow implicit kernels
 AllowOptions   dw 1                    ; User-specified options allowed
+IncludeLevel   dw 1                    ; Nesting level
 SerialPort     dw 0                    ; Serial port base (or 0 for no serial port)
 VKernelBytes   dw 0                    ; Number of bytes used by vkernels
 VKernel                db 0                    ; Have we seen any "label" statements?