#
da9ab827 |
| 25-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Clean up menu handling a little bit
This is driven by an urge to separate out the bits that really only need to happen when the menu system starts up. Key points:
- menu.process now does
lualoader: Clean up menu handling a little bit
This is driven by an urge to separate out the bits that really only need to happen when the menu system starts up. Key points:
- menu.process now does the bulk of menu handling. It retains autoboot handling for dubious reasons, and it no longer accepts a 'nil' menu to process as 'the default'. Its return value is insignificant. - The MENU_SUBMENU handler now returns nothing. If menu.process has exited, then we continue processing menu items on the parent menu as expected. - menu.run is now the entry point of the menu system. It checks whether the menu should be skipped, processes the default menu, then returns.
show more ...
|
#
3cd5547b |
| 25-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: menu: Terminate final values in tables with a comma
|
#
322a2ddd |
| 24-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Clean up naming conventions a little bit
We mostly use camel case for function names, but some local functions got mixed in using internal underscores. Doubles down on camel case.
|
#
9ed6f9ef |
| 23-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Use "local function x()" instead of "local x = function()"
The latter is good, but the former is more elegant and clear about what 'x' is. Adopt it, preferably only using the latter kind
lualoader: Use "local function x()" instead of "local x = function()"
The latter is good, but the former is more elegant and clear about what 'x' is. Adopt it, preferably only using the latter kind of notation where needed as values for tables.
show more ...
|
#
ee4e69f1 |
| 23-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: shallowCopyTable => deepCopyTable
I called it a shallow copy, but it wasn't really a shallow copy at all.
|
#
72e39d71 |
| 23-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
Add SPDX tags to lua files
|
#
66964bbc |
| 22-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Attend to some 80-col issues, pointed out by luacheck
Graphics have a tendency to cause 80-col issues, so make an exception to our standard indentation guidelines for these graphics. This
lualoader: Attend to some 80-col issues, pointed out by luacheck
Graphics have a tendency to cause 80-col issues, so make an exception to our standard indentation guidelines for these graphics. This does not hamper readability too badly.
Two 40-column strings of spaces is trivially replaced with string.rep(" ", 80)
show more ...
|
#
e2df27e3 |
| 22-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Address some 'luacheck' concerns
luacheck pointed out an assortment of issues, ranging from non-standard globals being created as well as unused parameters, variables, and redundant assig
lualoader: Address some 'luacheck' concerns
luacheck pointed out an assortment of issues, ranging from non-standard globals being created as well as unused parameters, variables, and redundant assignments.
Using '_' as a placeholder for values unused (whether it be parameters unused or return values unused, assuming multiple return values) feels clean and gets the point across, so I've adopted it. It also helps flag candidates for cleanup later in some of the lambdas I've created, giving me an easy way to re-evaluate later if we're still not using some of these features.
show more ...
|
#
4ab039b5 |
| 22-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Eliminate some unused locals
|
#
7dcffa90 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Don't execute menu.autoboot() for every opened menu
Attempt to autoboot when we open the default menu, and only when we open the default menu. This alleviates the need for checking menu.a
lualoader: Don't execute menu.autoboot() for every opened menu
Attempt to autoboot when we open the default menu, and only when we open the default menu. This alleviates the need for checking menu.already_autoboot, because we're not trying to autoboot every time we open a submenu.
I note that escaping to loader prompt and going back to the menu (by running require('menu').run() at the loader prompt) will happily work and not re-initiate the autoboot sequence since "Escape to loader prompt" disables the autoboot_delay.
show more ...
|
#
7efc058f |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Add boot environment support
This looks a little bit differently than the forth version for the time being, just to get off the ground- rather than a paging system, it's implemented as a
lualoader: Add boot environment support
This looks a little bit differently than the forth version for the time being, just to get off the ground- rather than a paging system, it's implemented as a simple carousel like the kernel selector.
Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D14436
show more ...
|
#
12b95c84 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Use the key that interrupts autoboot as a menu choice
This matches forth behavior. Hitting "6" when autobooting at the welcome menu will now take you directly to the "Boot Options" menu.
lualoader: Use the key that interrupts autoboot as a menu choice
This matches forth behavior. Hitting "6" when autobooting at the welcome menu will now take you directly to the "Boot Options" menu.
We likely have some slight optimizations we should make, like not checking autoboot every time we open a new menu and things of this nature. Further work will go towards this end.
show more ...
|
#
4f437f9e |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Allow carousel 'items' to be a table as well as a function
We don't have any in-tree users of this, but for a static set of carousel options having to define a callback is excessive.
|
#
a51f9f0c |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Simplify menu definitions a little further
Allow "name" entries to be simple strings, instead of just functions. We know whether we support colors or not by the time any of this is setup,
lualoader: Simplify menu definitions a little further
Allow "name" entries to be simple strings, instead of just functions. We know whether we support colors or not by the time any of this is setup, so all menu names that are basically static with colors sprinkled in are good candidates for simplification.
Also simplify "func" in many cases where it's just invoking another function with no arguments. The downside to this simplification is that the functions called can no longer be trivially replaced by a local module. The upside is that it removes another layer of indirection that we likely don't need.
These can be re-evaluated later if a compelling argument is raised, on a case-by-case basis, for replacement.
show more ...
|
#
9a28f948 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Directly reference submenu definition with submenu key
|
#
dd65496a |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop name requirement for menu separators
|
#
20a81676 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Add "menu.default", initialized to menu.welcome
The intent here is to abstract away the name of the default menu. The default menu is still the welcome menu, but this detail doesn't need
lualoader: Add "menu.default", initialized to menu.welcome
The intent here is to abstract away the name of the default menu. The default menu is still the welcome menu, but this detail doesn't need to matter to things outside of the menu module. You may change the default menu, but one would need to modify a specific menu.
show more ...
|
#
49550489 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop explicit boolean tests; b or not b
|
#
9f71d421 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop excessive parenthesizing
This was also a convenience convention (for me) that is not very lua-tic. Drop it.
I've maintained some parentheses where I'd prefer them, for example, 'if
lualoader: Drop excessive parenthesizing
This was also a convenience convention (for me) that is not very lua-tic. Drop it.
I've maintained some parentheses where I'd prefer them, for example, 'if x or y or (z and w) then', but these situations are far and few between.
show more ...
|
#
aedd6be5 |
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop terminating semicolons
This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything
lualoader: Drop terminating semicolons
This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything over. It is not a very lua-nic convention, though, so drop it.
Excessive parenthesizing around conditionals is next on the chopping block.
show more ...
|
#
f0cb3b6b |
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Intercept boot cli command
This should be functional and roughly equivalent to the Forth version.
Stop doing a loadelf() on menu exit now that we can DTRT with boot invocations. autoboot
lualoader: Intercept boot cli command
This should be functional and roughly equivalent to the Forth version.
Stop doing a loadelf() on menu exit now that we can DTRT with boot invocations. autoboot interception will follow not long after.
show more ...
|
#
c1ab36f5 |
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Ignore ACPI bits on !i386
|
#
25c4c7a5 |
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Move carousel storage out into config
Carousel storage doesn't need to happen in the menu module, and indeed storing it there introduces a circular reference between drawer and menu that
lualoader: Move carousel storage out into config
Carousel storage doesn't need to happen in the menu module, and indeed storing it there introduces a circular reference between drawer and menu that only works because of global pollution in loader.lua.
Carousel choices generally map to config entries anyways, making it as good of place as any to store these. Move {get,set}CarouselIndex functionality out into config so that drawer and menu may both use it. If we had more carousel functionality, it might make sense to create a carousel module, but this is not the case.
show more ...
|
#
b5746545 |
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Consistently organize modules
We follow pretty closely the following structure of a module:
1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definition
stand/lua: Consistently organize modules
We follow pretty closely the following structure of a module:
1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definitions 5. Module exports 6. return
Re-organize the one-offs (config/drawer) and denote the start of module exports with a comment.
show more ...
|
#
e15abd1f |
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Consistently declare local functions at module scope
Declare these adjacent to the local definitions at the top of the module, and make sure they're actually declared local to pollute glo
stand/lua: Consistently declare local functions at module scope
Declare these adjacent to the local definitions at the top of the module, and make sure they're actually declared local to pollute global namespace a little bit less.
show more ...
|