From owner-svn-src-head@freebsd.org Mon Feb 26 04:08:56 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 1D7DDF2736F; Mon, 26 Feb 2018 04:08:56 +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 B510580B49; Mon, 26 Feb 2018 04:08:55 +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 ABAC816647; Mon, 26 Feb 2018 04:08:55 +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 w1Q48tma047689; Mon, 26 Feb 2018 04:08:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1Q48tVa047684; Mon, 26 Feb 2018 04:08:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802260408.w1Q48tVa047684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 26 Feb 2018 04:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330009 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 330009 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: Mon, 26 Feb 2018 04:08:56 -0000 Author: kevans Date: Mon Feb 26 04:08:54 2018 New Revision: 330009 URL: https://svnweb.freebsd.org/changeset/base/330009 Log: lualoader: More argument name expansion, part 2 screen also has some instances, but it also has other cleanup to go with it. Because of this, I will be committing the screen changes separately. Modified: head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Feb 26 03:46:17 2018 (r330008) +++ head/stand/lua/color.lua Mon Feb 26 04:08:54 2018 (r330009) @@ -58,30 +58,31 @@ end color.disabled = not color.isEnabled() -function color.escapef(c) +function color.escapef(color_value) if color.disabled then - return c + return color_value end - return "\027[3" .. c .. "m" + return "\027[3" .. color_value .. "m" end -function color.escapeb(c) +function color.escapeb(color_value) if color.disabled then - return c + return color_value end - return "\027[4" .. c .. "m" + return "\027[4" .. color_value .. "m" end -function color.escape(fg, bg, att) +function color.escape(fg_color, bg_color, attribute) if color.disabled then return "" end - if not att then - att = "" + if attribute == nil then + attribute = "" else - att = att .. ";" + attribute = attribute .. ";" end - return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m" + return "\027[" .. attribute .. + "3" .. fg_color .. ";4" .. bg_color .. "m" end function color.default() Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 26 03:46:17 2018 (r330008) +++ head/stand/lua/config.lua Mon Feb 26 04:08:54 2018 (r330009) @@ -228,22 +228,25 @@ function config.restoreEnv() config.env_restore = {} end -function config.setenv(k, v) +function config.setenv(key, value) -- Track the original value for this if we haven't already - if config.env_restore[k] == nil then - config.env_restore[k] = {value = loader.getenv(k)} + if config.env_restore[key] == nil then + config.env_restore[key] = {value = loader.getenv(key)} end - config.env_changed[k] = v + config.env_changed[key] = value - return loader.setenv(k, v) + return loader.setenv(key, value) end -function config.setKey(k, n, v) - if modules[k] == nil then - modules[k] = {} +-- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' +-- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where +-- ${key} is a module name. +function config.setKey(key, name, value) + if modules[key] == nil then + modules[key] = {} end - modules[k][n] = v + modules[key][name] = value end function config.lsModules() @@ -255,11 +258,11 @@ function config.lsModules() end -function config.isValidComment(c) - if c ~= nil then - local s = c:match("^%s*#.*") +function config.isValidComment(line) + if line ~= nil then + local s = line:match("^%s*#.*") if s == nil then - s = c:match("^%s*$") + s = line:match("^%s*$") end if s == nil then return false Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Mon Feb 26 03:46:17 2018 (r330008) +++ head/stand/lua/core.lua Mon Feb 26 04:08:54 2018 (r330009) @@ -54,37 +54,37 @@ 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 +function core.setVerbose(verbose) + if verbose == nil then + verbose = not core.verbose end - if b then + if verbose then loader.setenv("boot_verbose", "YES") else loader.unsetenv("boot_verbose") end - core.verbose = b + core.verbose = verbose end -function core.setSingleUser(b) - if b == nil then - b = not core.su +function core.setSingleUser(single_user) + if single_user == nil then + single_user = not core.su end - if b then + if single_user then loader.setenv("boot_single", "YES") else loader.unsetenv("boot_single") end - core.su = b + core.su = single_user end -function core.getACPIPresent(checkingSystemDefaults) +function core.getACPIPresent(checking_system_defaults) local c = loader.getenv("hint.acpi.0.rsdp") if c ~= nil then - if checkingSystemDefaults then + if checking_system_defaults then return true end -- Otherwise, respect disabled if it's set @@ -94,12 +94,12 @@ function core.getACPIPresent(checkingSystemDefaults) return false end -function core.setACPI(b) - if b == nil then - b = not core.acpi +function core.setACPI(acpi) + if acpi == nil then + acpi = not core.acpi end - if b then + if acpi then loader.setenv("acpi_load", "YES") loader.setenv("hint.acpi.0.disabled", "0") loader.unsetenv("loader.acpi_disabled_by_user") @@ -108,14 +108,14 @@ function core.setACPI(b) loader.setenv("hint.acpi.0.disabled", "1") loader.setenv("loader.acpi_disabled_by_user", "1") end - core.acpi = b + core.acpi = acpi end -function core.setSafeMode(b) - if b == nil then - b = not core.sm +function core.setSafeMode(safe_mode) + if safe_mode == nil then + safe_mode = not core.sm end - if b then + if safe_mode then loader.setenv("kern.smp.disabled", "1") loader.setenv("hw.ata.ata_dma", "0") loader.setenv("hw.ata.atapi_dma", "0") @@ -132,7 +132,7 @@ function core.setSafeMode(b) loader.unsetenv("kern.eventtimer.periodic") loader.unsetenv("kern.geom.part.check_integrity") end - core.sm = b + core.sm = safe_mode end function core.kernelList() Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 26 03:46:17 2018 (r330008) +++ head/stand/lua/drawer.lua Mon Feb 26 04:08:54 2018 (r330009) @@ -265,14 +265,14 @@ function drawer.drawscreen(menu_opts) return drawer.drawmenu(menu_opts) end -function drawer.drawmenu(m) +function drawer.drawmenu(menudef) local x = drawer.menu_position.x local y = drawer.menu_position.y -- print the menu and build the alias table local alias_table = {} local entry_num = 0 - local menu_entries = m.entries + local menu_entries = menudef.entries local effective_line_num = 0 if type(menu_entries) == "function" then menu_entries = menu_entries() @@ -288,7 +288,7 @@ function drawer.drawmenu(m) entry_num = entry_num + 1 screen.setcursor(x, y + effective_line_num) - print(entry_num .. ". " .. menuEntryName(m, e)) + print(entry_num .. ". " .. menuEntryName(menudef, e)) -- fill the alias table alias_table[tostring(entry_num)] = e @@ -299,7 +299,7 @@ function drawer.drawmenu(m) end else screen.setcursor(x, y + effective_line_num) - print(menuEntryName(m, e)) + print(menuEntryName(menudef, e)) end ::continue:: end Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 26 03:46:17 2018 (r330008) +++ head/stand/lua/menu.lua Mon Feb 26 04:08:54 2018 (r330009) @@ -40,8 +40,8 @@ local menu = {} local drawn_menu -local function OnOff(str, b) - if b then +local function OnOff(str, value) + if value then return str .. color.escapef(color.GREEN) .. "On" .. color.escapef(color.WHITE) else