svn commit: r330009 - head/stand/lua

Kyle Evans kevans at FreeBSD.org
Mon Feb 26 04:08:56 UTC 2018


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


More information about the svn-src-all mailing list