brand.4th revision 281843
155682Smarkm\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org> 2233294Sstas\ All rights reserved. 355682Smarkm\ 455682Smarkm\ Redistribution and use in source and binary forms, with or without 5233294Sstas\ modification, are permitted provided that the following conditions 655682Smarkm\ are met: 755682Smarkm\ 1. Redistributions of source code must retain the above copyright 855682Smarkm\ notice, this list of conditions and the following disclaimer. 9233294Sstas\ 2. Redistributions in binary form must reproduce the above copyright 1055682Smarkm\ notice, this list of conditions and the following disclaimer in the 1155682Smarkm\ documentation and/or other materials provided with the distribution. 12233294Sstas\ 1355682Smarkm\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1455682Smarkm\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1555682Smarkm\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16233294Sstas\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1755682Smarkm\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1855682Smarkm\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1955682Smarkm\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20233294Sstas\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2155682Smarkm\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2255682Smarkm\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2355682Smarkm\ SUCH DAMAGE. 2455682Smarkm\ 2555682Smarkm\ $FreeBSD: stable/10/sys/boot/forth/brand.4th 281843 2015-04-22 01:08:40Z dteske $ 2655682Smarkm 2755682Smarkmmarker task-brand.4th 2855682Smarkm 2955682Smarkmvariable brandX 3055682Smarkmvariable brandY 3155682Smarkm 3255682Smarkm\ Initialize brand placement to defaults 3355682Smarkm2 brandX ! 3455682Smarkm1 brandY ! 3555682Smarkm 36233294Sstas\ This function draws any number of company brands at (loader_brand_x, 3755682Smarkm\ loader_brand_y) if defined, or (2,1) (top-left). To choose your brand, set 3855682Smarkm\ the variable `loader_brand' to the respective brand name. 3955682Smarkm\ 4055682Smarkm\ NOTE: Each is defined as a brand function in /boot/brand-${loader_brand}.4th 4155682Smarkm\ NOTE: If `/boot/brand-${loader_brand}.4th' does not exist or does not define 4255682Smarkm\ a `brand' function, no brand is drawn. 4355682Smarkm\ 4455682Smarkm: draw-brand ( -- ) \ at (loader_brand_x,loader_brand_y), else (2,1) 4555682Smarkm 4655682Smarkm s" loader_brand_x" getenv dup -1 <> if 4755682Smarkm ?number 1 = if brandX ! then 4855682Smarkm else drop then 4955682Smarkm s" loader_brand_y" getenv dup -1 <> if 5055682Smarkm ?number 1 = if brandY ! then 5155682Smarkm else drop then 5255682Smarkm 5355682Smarkm \ If `brand' is defined, execute it 5455682Smarkm s" brand" sfind ( -- xt|0 bool ) if 5555682Smarkm brandX @ brandY @ rot execute 5655682Smarkm else 5755682Smarkm \ Not defined; try-include desired brand file 5855682Smarkm drop ( xt = 0 ) \ cruft 5955682Smarkm s" loader_brand" getenv dup -1 = over 0= or if 6055682Smarkm dup 0= if 2drop else drop then \ getenv result unused 6155682Smarkm s" try-include /boot/brand-fbsd.4th" 6255682Smarkm else 6355682Smarkm 2drop ( c-addr/u -- ) \ getenv result unused 6455682Smarkm s" try-include /boot/brand-${loader_brand}.4th" 6555682Smarkm then 6655682Smarkm evaluate 6755682Smarkm 1 spaces 6855682Smarkm 6955682Smarkm \ Execute `brand' if defined now 7055682Smarkm s" brand" sfind if 7155682Smarkm brandX @ brandY @ rot execute 7255682Smarkm else drop then 7355682Smarkm then 7455682Smarkm; 7555682Smarkm