From b4779ab963ad0d5d286f14ff4eb9282d38b347c5 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 22 May 2007 22:58:57 -0700 Subject: [PATCH] Add "include" command to the core syslinux parser --- keywords | 1 + keywords.inc | 3 ++- parsecmd.inc | 2 +- parseconfig.inc | 22 ++++++++++++++++++---- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/keywords b/keywords index 72a880d..d7d8fa6 100644 --- a/keywords +++ b/keywords @@ -1,5 +1,6 @@ menu text +include append config default diff --git a/keywords.inc b/keywords.inc index ab202b5..a97d360 100644 --- a/keywords.inc +++ b/keywords.inc @@ -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 diff --git a/parsecmd.inc b/parsecmd.inc index 564b592..ea7d0fc 100644 --- a/parsecmd.inc +++ b/parsecmd.inc @@ -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 diff --git a/parseconfig.inc b/parseconfig.inc index 090aa9a..2b6031f 100644 --- a/parseconfig.inc +++ b/parseconfig.inc @@ -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? -- 2.7.4