1281843Sdteske\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
2222417Sjulian\ All rights reserved.
3222417Sjulian\ 
4222417Sjulian\ Redistribution and use in source and binary forms, with or without
5222417Sjulian\ modification, are permitted provided that the following conditions
6222417Sjulian\ are met:
7222417Sjulian\ 1. Redistributions of source code must retain the above copyright
8222417Sjulian\    notice, this list of conditions and the following disclaimer.
9222417Sjulian\ 2. Redistributions in binary form must reproduce the above copyright
10222417Sjulian\    notice, this list of conditions and the following disclaimer in the
11222417Sjulian\    documentation and/or other materials provided with the distribution.
12222417Sjulian\ 
13222417Sjulian\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14222417Sjulian\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15222417Sjulian\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16222417Sjulian\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17222417Sjulian\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18222417Sjulian\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19222417Sjulian\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20222417Sjulian\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21222417Sjulian\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22222417Sjulian\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23222417Sjulian\ SUCH DAMAGE.
24222417Sjulian\ 
25222417Sjulian\ $FreeBSD: releng/10.2/sys/boot/forth/brand.4th 281843 2015-04-22 01:08:40Z dteske $
26222417Sjulian
27222417Sjulianmarker task-brand.4th
28222417Sjulian
29222417Sjulianvariable brandX
30222417Sjulianvariable brandY
31222417Sjulian
32281843Sdteske\ Initialize brand placement to defaults
33222417Sjulian2 brandX !
34222417Sjulian1 brandY !
35222417Sjulian
36281843Sdteske\ This function draws any number of company brands at (loader_brand_x,
37281843Sdteske\ loader_brand_y) if defined, or (2,1) (top-left). To choose your brand, set
38281843Sdteske\ the variable `loader_brand' to the respective brand name.
39222417Sjulian\ 
40281843Sdteske\ NOTE: Each is defined as a brand function in /boot/brand-${loader_brand}.4th
41281843Sdteske\ NOTE: If `/boot/brand-${loader_brand}.4th' does not exist or does not define
42281843Sdteske\       a `brand' function, no brand is drawn.
43222417Sjulian\ 
44281843Sdteske: draw-brand ( -- ) \ at (loader_brand_x,loader_brand_y), else (2,1)
45222417Sjulian
46222417Sjulian	s" loader_brand_x" getenv dup -1 <> if
47281843Sdteske		?number 1 = if brandX ! then
48281843Sdteske	else drop then
49281843Sdteske 	s" loader_brand_y" getenv dup -1 <> if
50281843Sdteske 		?number 1 = if brandY ! then
51281843Sdteske 	else drop then
52281843Sdteske
53281843Sdteske	\ If `brand' is defined, execute it
54281843Sdteske	s" brand" sfind ( -- xt|0 bool ) if
55281843Sdteske		brandX @ brandY @ rot execute
56222417Sjulian	else
57281843Sdteske		\ Not defined; try-include desired brand file
58281843Sdteske		drop ( xt = 0 ) \ cruft
59281843Sdteske		s" loader_brand" getenv dup -1 = over 0= or if
60281843Sdteske			dup 0= if 2drop else drop then \ getenv result unused
61281843Sdteske			s" try-include /boot/brand-fbsd.4th"
62281843Sdteske		else
63281843Sdteske			2drop ( c-addr/u -- ) \ getenv result unused
64281843Sdteske			s" try-include /boot/brand-${loader_brand}.4th"
65222417Sjulian		then
66281843Sdteske		evaluate
67281843Sdteske		1 spaces
68222417Sjulian
69281843Sdteske		\ Execute `brand' if defined now
70281843Sdteske		s" brand" sfind if
71281843Sdteske			brandX @ brandY @ rot execute
72281843Sdteske		else drop then
73222417Sjulian	then
74222417Sjulian;
75