1088b4f5fSWarner Losh-- 2088b4f5fSWarner Losh-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3df74a61fSKyle Evans-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 4088b4f5fSWarner Losh-- All rights reserved. 5088b4f5fSWarner Losh-- 6088b4f5fSWarner Losh-- Redistribution and use in source and binary forms, with or without 7088b4f5fSWarner Losh-- modification, are permitted provided that the following conditions 8088b4f5fSWarner Losh-- are met: 9088b4f5fSWarner Losh-- 1. Redistributions of source code must retain the above copyright 10088b4f5fSWarner Losh-- notice, this list of conditions and the following disclaimer. 11088b4f5fSWarner Losh-- 2. Redistributions in binary form must reproduce the above copyright 12088b4f5fSWarner Losh-- notice, this list of conditions and the following disclaimer in the 13088b4f5fSWarner Losh-- documentation and/or other materials provided with the distribution. 14088b4f5fSWarner Losh-- 15088b4f5fSWarner Losh-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16088b4f5fSWarner Losh-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17088b4f5fSWarner Losh-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18088b4f5fSWarner Losh-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19088b4f5fSWarner Losh-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20088b4f5fSWarner Losh-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21088b4f5fSWarner Losh-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22088b4f5fSWarner Losh-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23088b4f5fSWarner Losh-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24088b4f5fSWarner Losh-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25088b4f5fSWarner Losh-- SUCH DAMAGE. 26088b4f5fSWarner Losh-- 27088b4f5fSWarner Losh-- $FreeBSD$ 28088b4f5fSWarner Losh-- 29088b4f5fSWarner Losh 30088b4f5fSWarner Loshlocal color = require("color"); 31a7cf0562SKyle Evanslocal core = require("core"); 32088b4f5fSWarner Loshlocal screen = require("screen"); 33088b4f5fSWarner Losh 34c8518398SKyle Evanslocal drawer = {}; 35c8518398SKyle Evans 3602122e53SKyle Evanslocal fbsd_logo; 3702122e53SKyle Evanslocal beastie_color; 3802122e53SKyle Evanslocal beastie; 3902122e53SKyle Evanslocal fbsd_logo_v; 4002122e53SKyle Evanslocal orb; 4102122e53SKyle Evanslocal none; 42bb26c57dSKyle Evanslocal none_shifted = false; 4302122e53SKyle Evans 44da56fe38SKyle Evansdrawer.menu_name_handlers = { 45da56fe38SKyle Evans -- Menu name handlers should take the menu being drawn and entry being 46da56fe38SKyle Evans -- drawn as parameters, and return the name of the item. 47da56fe38SKyle Evans -- This is designed so that everything, including menu separators, may 48da56fe38SKyle Evans -- have their names derived differently. The default action for entry 49da56fe38SKyle Evans -- types not specified here is to call and use entry.name(). 50da56fe38SKyle Evans [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) 51da56fe38SKyle Evans local carid = entry.carousel_id; 52da56fe38SKyle Evans local caridx = menu.getCarouselIndex(carid); 53da56fe38SKyle Evans local choices = entry.items(); 54da56fe38SKyle Evans 55da56fe38SKyle Evans if (#choices < caridx) then 56da56fe38SKyle Evans caridx = 1; 57da56fe38SKyle Evans end 58da56fe38SKyle Evans return entry.name(caridx, choices[caridx], choices); 59da56fe38SKyle Evans end, 60da56fe38SKyle Evans}; 61da56fe38SKyle Evans 62088b4f5fSWarner Loshdrawer.brand_position = {x = 2, y = 1}; 6302122e53SKyle Evansdrawer.logo_position = {x = 46, y = 1}; 6402122e53SKyle Evansdrawer.menu_position = {x = 6, y = 11}; 6502122e53SKyle Evansdrawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; 6602122e53SKyle Evans 6702122e53SKyle Evansfbsd_logo = { 68088b4f5fSWarner Losh " ______ ____ _____ _____ ", 69088b4f5fSWarner Losh " | ____| | _ \\ / ____| __ \\ ", 70088b4f5fSWarner Losh " | |___ _ __ ___ ___ | |_) | (___ | | | |", 71088b4f5fSWarner Losh " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", 72088b4f5fSWarner Losh " | | | | | __/ __/| |_) |____) | |__| |", 73088b4f5fSWarner Losh " | | | | | | || | | |", 74088b4f5fSWarner Losh " |_| |_| \\___|\\___||____/|_____/|_____/ " 75088b4f5fSWarner Losh}; 76088b4f5fSWarner Losh 7702122e53SKyle Evansbeastie_color = { 78088b4f5fSWarner Losh " \027[31m, ,", 79088b4f5fSWarner Losh " /( )`", 80088b4f5fSWarner Losh " \\ \\___ / |", 81088b4f5fSWarner Losh " /- \027[37m_\027[31m `-/ '", 82088b4f5fSWarner Losh " (\027[37m/\\/ \\\027[31m \\ /\\", 83088b4f5fSWarner Losh " \027[37m/ / |\027[31m ` \\", 84088b4f5fSWarner Losh " \027[34mO O \027[37m) \027[31m/ |", 85088b4f5fSWarner Losh " \027[37m`-^--'\027[31m`< '", 86088b4f5fSWarner Losh " (_.) _ ) /", 87088b4f5fSWarner Losh " `.___/` /", 88088b4f5fSWarner Losh " `-----' /", 89088b4f5fSWarner Losh " \027[33m<----.\027[31m __ / __ \\", 90088b4f5fSWarner Losh " \027[33m<----|====\027[31mO)))\027[33m==\027[31m) \\) /\027[33m====|", 91088b4f5fSWarner Losh " \027[33m<----'\027[31m `--' `.__,' \\", 92088b4f5fSWarner Losh " | |", 93088b4f5fSWarner Losh " \\ / /\\", 94088b4f5fSWarner Losh " \027[36m______\027[31m( (_ / \\______/", 95088b4f5fSWarner Losh " \027[36m,' ,-----' |", 96088b4f5fSWarner Losh " `--{__________)\027[37m" 97088b4f5fSWarner Losh}; 98088b4f5fSWarner Losh 9902122e53SKyle Evansbeastie = { 100088b4f5fSWarner Losh " , ,", 101088b4f5fSWarner Losh " /( )`", 102088b4f5fSWarner Losh " \\ \\___ / |", 103088b4f5fSWarner Losh " /- _ `-/ '", 104088b4f5fSWarner Losh " (/\\/ \\ \\ /\\", 105088b4f5fSWarner Losh " / / | ` \\", 106088b4f5fSWarner Losh " O O ) / |", 107088b4f5fSWarner Losh " `-^--'`< '", 108088b4f5fSWarner Losh " (_.) _ ) /", 109088b4f5fSWarner Losh " `.___/` /", 110088b4f5fSWarner Losh " `-----' /", 111088b4f5fSWarner Losh " <----. __ / __ \\", 112088b4f5fSWarner Losh " <----|====O)))==) \\) /====|", 113088b4f5fSWarner Losh " <----' `--' `.__,' \\", 114088b4f5fSWarner Losh " | |", 115088b4f5fSWarner Losh " \\ / /\\", 116088b4f5fSWarner Losh " ______( (_ / \\______/", 117088b4f5fSWarner Losh " ,' ,-----' |", 118088b4f5fSWarner Losh " `--{__________)" 119088b4f5fSWarner Losh}; 120088b4f5fSWarner Losh 12102122e53SKyle Evansfbsd_logo_v = { 122088b4f5fSWarner Losh " ______", 123088b4f5fSWarner Losh " | ____| __ ___ ___ ", 124088b4f5fSWarner Losh " | |__ | '__/ _ \\/ _ \\", 125088b4f5fSWarner Losh " | __|| | | __/ __/", 126088b4f5fSWarner Losh " | | | | | | |", 127088b4f5fSWarner Losh " |_| |_| \\___|\\___|", 128088b4f5fSWarner Losh " ____ _____ _____", 129088b4f5fSWarner Losh " | _ \\ / ____| __ \\", 130088b4f5fSWarner Losh " | |_) | (___ | | | |", 131088b4f5fSWarner Losh " | _ < \\___ \\| | | |", 132088b4f5fSWarner Losh " | |_) |____) | |__| |", 133088b4f5fSWarner Losh " | | | |", 134088b4f5fSWarner Losh " |____/|_____/|_____/" 135088b4f5fSWarner Losh}; 136088b4f5fSWarner Losh 13702122e53SKyle Evansorb_color = { 138088b4f5fSWarner Losh " \027[31m``` \027[31;1m`\027[31m", 139088b4f5fSWarner Losh " s` `.....---...\027[31;1m....--.``` -/\027[31m", 140088b4f5fSWarner Losh " +o .--` \027[31;1m/y:` +.\027[31m", 141088b4f5fSWarner Losh " yo`:. \027[31;1m:o `+-\027[31m", 142088b4f5fSWarner Losh " y/ \027[31;1m-/` -o/\027[31m", 143088b4f5fSWarner Losh " .- \027[31;1m::/sy+:.\027[31m", 144088b4f5fSWarner Losh " / \027[31;1m`-- /\027[31m", 145088b4f5fSWarner Losh " `: \027[31;1m:`\027[31m", 146088b4f5fSWarner Losh " `: \027[31;1m:`\027[31m", 147088b4f5fSWarner Losh " / \027[31;1m/\027[31m", 148088b4f5fSWarner Losh " .- \027[31;1m-.\027[31m", 149088b4f5fSWarner Losh " -- \027[31;1m-.\027[31m", 150088b4f5fSWarner Losh " `:` \027[31;1m`:`", 151088b4f5fSWarner Losh " \027[31;1m.-- `--.", 152088b4f5fSWarner Losh " .---.....----.\027[37m" 153088b4f5fSWarner Losh}; 154088b4f5fSWarner Losh 15502122e53SKyle Evansorb = { 156088b4f5fSWarner Losh " ``` `", 157088b4f5fSWarner Losh " s` `.....---.......--.``` -/", 158088b4f5fSWarner Losh " +o .--` /y:` +.", 159088b4f5fSWarner Losh " yo`:. :o `+-", 160088b4f5fSWarner Losh " y/ -/` -o/", 161088b4f5fSWarner Losh " .- ::/sy+:.", 162088b4f5fSWarner Losh " / `-- /", 163088b4f5fSWarner Losh " `: :`", 164088b4f5fSWarner Losh " `: :`", 165088b4f5fSWarner Losh " / /", 166088b4f5fSWarner Losh " .- -.", 167088b4f5fSWarner Losh " -- -.", 168088b4f5fSWarner Losh " `:` `:`", 169088b4f5fSWarner Losh " .-- `--.", 170088b4f5fSWarner Losh " .---.....----." 171088b4f5fSWarner Losh}; 172088b4f5fSWarner Losh 17302122e53SKyle Evansnone = {""}; 174088b4f5fSWarner Losh 17529aa5794SKyle Evansdrawer.branddefs = { 176*699578a6SKyle Evans -- Indexed by valid values for loader_brand in loader.conf(5). Valid 177*699578a6SKyle Evans -- keys are: graphic (table depicting graphic) 17829aa5794SKyle Evans ["fbsd"] = { 17929aa5794SKyle Evans graphic = fbsd_logo, 18029aa5794SKyle Evans }, 18129aa5794SKyle Evans ["none"] = { 18229aa5794SKyle Evans graphic = none, 18329aa5794SKyle Evans }, 18429aa5794SKyle Evans}; 18529aa5794SKyle Evans 186bb26c57dSKyle Evansdrawer.logodefs = { 187bb26c57dSKyle Evans -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys 188752b2d40SKyle Evans -- are: requires_color (boolean), graphic (table depicting graphic), and 189bb26c57dSKyle Evans -- shift (table containing x and y). 190bb26c57dSKyle Evans ["beastie"] = { 191bb26c57dSKyle Evans requires_color = true, 192752b2d40SKyle Evans graphic = beastie_color, 193bb26c57dSKyle Evans }, 194bb26c57dSKyle Evans ["beastiebw"] = { 195752b2d40SKyle Evans graphic = beastie, 196bb26c57dSKyle Evans }, 197bb26c57dSKyle Evans ["fbsdbw"] = { 198752b2d40SKyle Evans graphic = fbsd_logo_v, 199bb26c57dSKyle Evans shift = {x = 5, y = 4}, 200bb26c57dSKyle Evans }, 201bb26c57dSKyle Evans ["orb"] = { 202bb26c57dSKyle Evans requires_color = true, 203752b2d40SKyle Evans graphic = orb_color, 204bb26c57dSKyle Evans shift = {x = 2, y = 4}, 205bb26c57dSKyle Evans }, 206bb26c57dSKyle Evans ["orbbw"] = { 207752b2d40SKyle Evans graphic = orb, 208bb26c57dSKyle Evans shift = {x = 2, y = 4}, 209bb26c57dSKyle Evans }, 210bb26c57dSKyle Evans ["tribute"] = { 211752b2d40SKyle Evans graphic = fbsd_logo, 212bb26c57dSKyle Evans }, 213bb26c57dSKyle Evans ["tributebw"] = { 214752b2d40SKyle Evans graphic = fbsd_logo, 215bb26c57dSKyle Evans }, 216bb26c57dSKyle Evans ["none"] = { 217752b2d40SKyle Evans graphic = none, 218bb26c57dSKyle Evans shift = {x = 17, y = 0}, 219bb26c57dSKyle Evans }, 220bb26c57dSKyle Evans}; 221bb26c57dSKyle Evans 222088b4f5fSWarner Loshfunction drawer.drawscreen(menu_opts) 223088b4f5fSWarner Losh -- drawlogo() must go first. 224088b4f5fSWarner Losh -- it determines the positions of other elements 225088b4f5fSWarner Losh drawer.drawlogo(); 226088b4f5fSWarner Losh drawer.drawbrand(); 227088b4f5fSWarner Losh drawer.drawbox(); 228088b4f5fSWarner Losh return drawer.drawmenu(menu_opts); 229088b4f5fSWarner Loshend 230088b4f5fSWarner Losh 2312413c411SKyle Evansfunction menu_entry_name(drawing_menu, entry) 2322413c411SKyle Evans local name_handler = drawer.menu_name_handlers[entry.entry_type]; 2332413c411SKyle Evans 2342413c411SKyle Evans if (name_handler ~= nil) then 2352413c411SKyle Evans return name_handler(drawing_menu, entry); 2362413c411SKyle Evans end 2372413c411SKyle Evans return entry.name(); 2382413c411SKyle Evansend 2392413c411SKyle Evans 240088b4f5fSWarner Loshfunction drawer.drawmenu(m) 241088b4f5fSWarner Losh x = drawer.menu_position.x; 242088b4f5fSWarner Losh y = drawer.menu_position.y; 243088b4f5fSWarner Losh 244088b4f5fSWarner Losh -- print the menu and build the alias table 245088b4f5fSWarner Losh local alias_table = {}; 246088b4f5fSWarner Losh local entry_num = 0; 247d8757746SKyle Evans local menu_entries = m.entries; 2482e716cecSKyle Evans if (type(menu_entries) == "function") then 2492e716cecSKyle Evans menu_entries = menu_entries(); 2502e716cecSKyle Evans end 251d8757746SKyle Evans for line_num, e in ipairs(menu_entries) do 2524a4fb4f8SKyle Evans -- Allow menu items to be conditionally visible by specifying 2534a4fb4f8SKyle Evans -- a visible function. 2544a4fb4f8SKyle Evans if (e.visible ~= nil) and (not e.visible()) then 255ddb76e07SKyle Evans goto continue; 2564a4fb4f8SKyle Evans end 257a7cf0562SKyle Evans if (e.entry_type ~= core.MENU_SEPARATOR) then 258088b4f5fSWarner Losh entry_num = entry_num + 1; 259088b4f5fSWarner Losh screen.setcursor(x, y + line_num); 260ada26c4aSKyle Evans 2612413c411SKyle Evans print(entry_num .. ". " .. menu_entry_name(m, e)); 262088b4f5fSWarner Losh 263088b4f5fSWarner Losh -- fill the alias table 264088b4f5fSWarner Losh alias_table[tostring(entry_num)] = e; 265196ba166SKyle Evans if (e.alias ~= nil) then 266088b4f5fSWarner Losh for n, a in ipairs(e.alias) do 267088b4f5fSWarner Losh alias_table[a] = e; 268088b4f5fSWarner Losh end 269196ba166SKyle Evans end 270088b4f5fSWarner Losh else 271088b4f5fSWarner Losh screen.setcursor(x, y + line_num); 2722413c411SKyle Evans print(menu_entry_name(m, e)); 273088b4f5fSWarner Losh end 2744a4fb4f8SKyle Evans ::continue:: 275088b4f5fSWarner Losh end 276088b4f5fSWarner Losh return alias_table; 277088b4f5fSWarner Loshend 278088b4f5fSWarner Losh 279088b4f5fSWarner Losh 280088b4f5fSWarner Loshfunction drawer.drawbox() 281088b4f5fSWarner Losh x = drawer.box_pos_dim.x; 282088b4f5fSWarner Losh y = drawer.box_pos_dim.y; 283088b4f5fSWarner Losh w = drawer.box_pos_dim.w; 284088b4f5fSWarner Losh h = drawer.box_pos_dim.h; 285088b4f5fSWarner Losh 286088b4f5fSWarner Losh local hl = string.char(0xCD); 287088b4f5fSWarner Losh local vl = string.char(0xBA); 288088b4f5fSWarner Losh 289088b4f5fSWarner Losh local tl = string.char(0xC9); 290088b4f5fSWarner Losh local bl = string.char(0xC8); 291088b4f5fSWarner Losh local tr = string.char(0xBB); 292088b4f5fSWarner Losh local br = string.char(0xBC); 293088b4f5fSWarner Losh 294088b4f5fSWarner Losh screen.setcursor(x, y); print(tl); 295088b4f5fSWarner Losh screen.setcursor(x, y+h); print(bl); 296088b4f5fSWarner Losh screen.setcursor(x+w, y); print(tr); 297088b4f5fSWarner Losh screen.setcursor(x+w, y+h); print(br); 298088b4f5fSWarner Losh 299088b4f5fSWarner Losh for i = 1, w-1 do 300088b4f5fSWarner Losh screen.setcursor(x+i, y); 301088b4f5fSWarner Losh print(hl); 302088b4f5fSWarner Losh screen.setcursor(x+i, y+h); 303088b4f5fSWarner Losh print(hl); 304088b4f5fSWarner Losh end 305088b4f5fSWarner Losh 306088b4f5fSWarner Losh for i = 1, h-1 do 307088b4f5fSWarner Losh screen.setcursor(x, y+i); 308088b4f5fSWarner Losh print(vl); 309088b4f5fSWarner Losh screen.setcursor(x+w, y+i); 310088b4f5fSWarner Losh print(vl); 311088b4f5fSWarner Losh end 312088b4f5fSWarner Losh 313088b4f5fSWarner Losh screen.setcursor(x+(w/2)-9, y); 314088b4f5fSWarner Losh print("Welcome to FreeBSD"); 315088b4f5fSWarner Loshend 316088b4f5fSWarner Losh 317088b4f5fSWarner Loshfunction drawer.draw(x, y, logo) 318088b4f5fSWarner Losh for i = 1, #logo do 319088b4f5fSWarner Losh screen.setcursor(x, y + i); 320088b4f5fSWarner Losh print(logo[i]); 321088b4f5fSWarner Losh end 322088b4f5fSWarner Loshend 323088b4f5fSWarner Losh 324088b4f5fSWarner Loshfunction drawer.drawbrand() 32524a1bd54SKyle Evans local x = tonumber(loader.getenv("loader_brand_x")) or 32624a1bd54SKyle Evans drawer.brand_position.x; 32724a1bd54SKyle Evans local y = tonumber(loader.getenv("loader_brand_y")) or 32824a1bd54SKyle Evans drawer.brand_position.y; 329088b4f5fSWarner Losh 33029aa5794SKyle Evans local graphic = drawer.branddefs[loader.getenv("loader_brand")]; 33129aa5794SKyle Evans if (graphic == nil) then 33229aa5794SKyle Evans graphic = fbsd_logo; 33329aa5794SKyle Evans end 33429aa5794SKyle Evans drawer.draw(x, y, graphic); 335088b4f5fSWarner Loshend 336088b4f5fSWarner Losh 337bb26c57dSKyle Evansfunction shift_brand_text(shift) 338bb26c57dSKyle Evans drawer.brand_position.x = drawer.brand_position.x + shift.x; 339bb26c57dSKyle Evans drawer.brand_position.y = drawer.brand_position.y + shift.y; 340bb26c57dSKyle Evans drawer.menu_position.x = drawer.menu_position.x + shift.x; 341bb26c57dSKyle Evans drawer.menu_position.y = drawer.menu_position.y + shift.y; 342bb26c57dSKyle Evans drawer.box_pos_dim.x = drawer.box_pos_dim.x + shift.x; 343bb26c57dSKyle Evans drawer.box_pos_dim.y = drawer.box_pos_dim.y + shift.y; 344bb26c57dSKyle Evansend 345bb26c57dSKyle Evans 346088b4f5fSWarner Loshfunction drawer.drawlogo() 34724a1bd54SKyle Evans local x = tonumber(loader.getenv("loader_logo_x")) or 34824a1bd54SKyle Evans drawer.logo_position.x; 34924a1bd54SKyle Evans local y = tonumber(loader.getenv("loader_logo_y")) or 35024a1bd54SKyle Evans drawer.logo_position.y; 351088b4f5fSWarner Losh 352088b4f5fSWarner Losh local logo = loader.getenv("loader_logo"); 353088b4f5fSWarner Losh local colored = color.isEnabled(); 354088b4f5fSWarner Losh 355bb26c57dSKyle Evans -- Lookup 356bb26c57dSKyle Evans local logodef = drawer.logodefs[logo]; 357bb26c57dSKyle Evans 358752b2d40SKyle Evans if (logodef ~= nil) and (logodef.graphic == none) then 359088b4f5fSWarner Losh -- centre brand and text if no logo 360bb26c57dSKyle Evans if (not none_shifted) then 361bb26c57dSKyle Evans shift_brand_text(logodef.shift); 362bb26c57dSKyle Evans none_shifted = true; 363088b4f5fSWarner Losh end 364752b2d40SKyle Evans elseif (logodef == nil) or (logodef.graphic == nil) or 365bb26c57dSKyle Evans ((not colored) and logodef.requires_color) then 366bb26c57dSKyle Evans -- Choose a sensible default 36724a1bd54SKyle Evans if (colored) then 368bb26c57dSKyle Evans logodef = drawer.logodefs["orb"]; 369088b4f5fSWarner Losh else 370bb26c57dSKyle Evans logodef = drawer.logodefs["orbbw"]; 371088b4f5fSWarner Losh end 372088b4f5fSWarner Losh end 373bb26c57dSKyle Evans if (logodef.shift ~= nil) then 374bb26c57dSKyle Evans x = x + logodef.shift.x; 375bb26c57dSKyle Evans y = y + logodef.shift.y; 376bb26c57dSKyle Evans end 377752b2d40SKyle Evans drawer.draw(x, y, logodef.graphic); 378088b4f5fSWarner Loshend 379088b4f5fSWarner Losh 38024a1bd54SKyle Evansreturn drawer; 381