From owner-svn-src-head@freebsd.org Fri Feb 16 14:57:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 826B9F1B1DE; Fri, 16 Feb 2018 14:57:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 371C67DDB5; Fri, 16 Feb 2018 14:57:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DC077291; Fri, 16 Feb 2018 14:57:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GEvhHf038130; Fri, 16 Feb 2018 14:57:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GEvgQs038127; Fri, 16 Feb 2018 14:57:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802161457.w1GEvgQs038127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 16 Feb 2018 14:57:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329368 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 14:57:43 -0000 Author: kevans Date: Fri Feb 16 14:57:42 2018 New Revision: 329368 URL: https://svnweb.freebsd.org/changeset/base/329368 Log: stand/lua: Create/use some MENU_ constants where applicable Modified: head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Fri Feb 16 14:39:41 2018 (r329367) +++ head/stand/lua/core.lua Fri Feb 16 14:57:42 2018 (r329368) @@ -29,11 +29,17 @@ local core = {}; -- Commonly appearing constants -core.KEY_ENTER = 13; -core.KEY_BACKSPACE = 127; +core.KEY_ENTER = 13; +core.KEY_BACKSPACE = 127; -core.KEYSTR_ESCAPE = "\027"; +core.KEYSTR_ESCAPE = "\027"; +core.MENU_RETURN = "return"; +core.MENU_ENTRY = "entry"; +core.MENU_SEPARATOR = "separator"; +core.MENU_SUBMENU = "submenu"; +core.MENU_CAROUSEL_ENTRY = "carousel_entry"; + function core.setVerbose(b) if (b == nil) then b = not core.verbose; @@ -119,6 +125,7 @@ function core.kernelList() local k = loader.getenv("kernel"); local v = loader.getenv("kernels") or ""; + v = "kernel;kernel.GENERIC" local kernels = {}; local i = 0; if k ~= nil then Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Fri Feb 16 14:39:41 2018 (r329367) +++ head/stand/lua/drawer.lua Fri Feb 16 14:57:42 2018 (r329368) @@ -29,6 +29,7 @@ local drawer = {}; local color = require("color"); +local core = require("core"); local screen = require("screen"); drawer.brand_position = {x = 2, y = 1}; @@ -166,12 +167,12 @@ function drawer.drawmenu(m) local alias_table = {}; local entry_num = 0; for line_num, e in ipairs(m) do - if (e.entry_type ~= "separator") then + if (e.entry_type ~= core.MENU_SEPARATOR) then entry_num = entry_num + 1; screen.setcursor(x, y + line_num); local name = ""; - if (e.entry_type == "carousel_entry") then + if (e.entry_type == core.MENU_CAROUSEL_ENTRY) then local carid = e.carousel_id; local caridx = menu.getCarouselIndex(carid); local choices = e.items(); Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Fri Feb 16 14:39:41 2018 (r329367) +++ head/stand/lua/menu.lua Fri Feb 16 14:57:42 2018 (r329368) @@ -50,7 +50,7 @@ local welcome; menu.boot_options = { -- return to welcome menu { - entry_type = "return", + entry_type = core.MENU_RETURN, name = function() return "Back to main menu"..color.highlight(" [Backspace]"); end @@ -58,7 +58,7 @@ menu.boot_options = { -- load defaults { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return "Load System "..color.highlight("D").."efaults"; end, @@ -69,14 +69,14 @@ menu.boot_options = { }, { - entry_type = "separator", + entry_type = core.MENU_SEPARATOR, name = function() return ""; end }, { - entry_type = "separator", + entry_type = core.MENU_SEPARATOR, name = function() return "Boot Options:"; end @@ -84,7 +84,7 @@ menu.boot_options = { -- acpi { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return OnOff(color.highlight("A").."CPI :", core.acpi); end, @@ -95,7 +95,7 @@ menu.boot_options = { }, -- safe mode { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return OnOff("Safe "..color.highlight("M").."ode :", core.sm); end, @@ -106,7 +106,7 @@ menu.boot_options = { }, -- single user { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return OnOff(color.highlight("S").."ingle user:", core.su); end, @@ -117,7 +117,7 @@ menu.boot_options = { }, -- verbose boot { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return OnOff(color.highlight("V").."erbose :", core.verbose); end, @@ -131,7 +131,7 @@ menu.boot_options = { menu.welcome = { -- boot multi user { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return color.highlight("B").."oot Multi user "..color.highlight("[Enter]"); end, @@ -144,7 +144,7 @@ menu.welcome = { -- boot single user { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return "Boot "..color.highlight("S").."ingle user"; end, @@ -157,7 +157,7 @@ menu.welcome = { -- escape to interpreter { - entry_type = "return", + entry_type = core.MENU_RETURN, name = function() return color.highlight("Esc").."ape to loader prompt"; end, @@ -166,7 +166,7 @@ menu.welcome = { -- reboot { - entry_type = "entry", + entry_type = core.MENU_ENTRY, name = function() return color.highlight("R").."eboot"; end, @@ -178,14 +178,14 @@ menu.welcome = { { - entry_type = "separator", + entry_type = core.MENU_SEPARATOR, name = function() return ""; end }, { - entry_type = "separator", + entry_type = core.MENU_SEPARATOR, name = function() return "Options:"; end @@ -193,7 +193,7 @@ menu.welcome = { -- kernel options { - entry_type = "carousel_entry", + entry_type = core.MENU_CAROUSEL_ENTRY, carousel_id = "kernel", items = core.kernelList, name = function(idx, choice, all_choices) @@ -218,7 +218,7 @@ menu.welcome = { -- boot options { - entry_type = "submenu", + entry_type = core.MENU_SUBMENU, name = function() return "Boot "..color.highlight("O").."ptions"; end, @@ -284,10 +284,10 @@ function menu.run(m) -- if we have an alias do the assigned action: if(sel_entry ~= nil) then - if (sel_entry.entry_type == "entry") then + if (sel_entry.entry_type == core.MENU_ENTRY) then -- run function sel_entry.func(); - elseif (sel_entry.entry_type == "carousel_entry") then + elseif (sel_entry.entry_type == core.MENU_CAROUSEL_ENTRY) then -- carousel (rotating) functionality local carid = sel_entry.carousel_id; local caridx = menu.getCarouselIndex(carid); @@ -296,10 +296,10 @@ function menu.run(m) caridx = (caridx % #choices) + 1; menu.setCarouselIndex(carid, caridx); sel_entry.func(choices[caridx]); - elseif (sel_entry.entry_type == "submenu") then + elseif (sel_entry.entry_type == core.MENU_SUBMENU) then -- recurse cont = menu.run(sel_entry.submenu()); - elseif (sel_entry.entry_type == "return") then + elseif (sel_entry.entry_type == core.MENU_RETURN) then -- break recurse cont = false; end