1280923Sdteske\ 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/11.0/sys/boot/forth/brand.4th 280933 2015-04-01 01:14:19Z dteske $
26222417Sjulian
27222417Sjulianmarker task-brand.4th
28222417Sjulian
29222417Sjulianvariable brandX
30222417Sjulianvariable brandY
31222417Sjulian
32280924Sdteske\ Initialize brand placement to defaults
33222417Sjulian2 brandX !
34222417Sjulian1 brandY !
35222417Sjulian
36280933Sdteske\ This function draws any number of company brands at (loader_brand_x,
37280933Sdteske\ loader_brand_y) if defined, or (2,1) (top-left). To choose your brand, set
38280933Sdteske\ the variable `loader_brand' to the respective brand name.
39222417Sjulian\ 
40280933Sdteske\ NOTE: Each is defined as a brand function in /boot/brand-${loader_brand}.4th
41280933Sdteske\ NOTE: If `/boot/brand-${loader_brand}.4th' does not exist or does not define
42280933Sdteske\       a `brand' function, no brand is drawn.
43222417Sjulian\ 
44280924Sdteske: draw-brand ( -- ) \ at (loader_brand_x,loader_brand_y), else (2,1)
45222417Sjulian
46222417Sjulian	s" loader_brand_x" getenv dup -1 <> if
47280923Sdteske		?number 1 = if brandX ! then
48280923Sdteske	else drop then
49222417Sjulian 	s" loader_brand_y" getenv dup -1 <> if
50280923Sdteske 		?number 1 = if brandY ! then
51280923Sdteske 	else drop then
52222417Sjulian
53280933Sdteske	\ If `brand' is defined, execute it
54280933Sdteske	s" brand" sfind ( -- xt|0 bool ) if
55280933Sdteske		brandX @ brandY @ rot execute
56280933Sdteske	else
57280933Sdteske		\ Not defined; try-include desired brand file
58280933Sdteske		drop ( xt = 0 ) \ cruft
59280933Sdteske		s" loader_brand" getenv dup -1 = over 0= or if
60280933Sdteske			dup 0= if 2drop else drop then \ getenv result unused
61280933Sdteske			s" try-include /boot/brand-fbsd.4th"
62280933Sdteske		else
63280933Sdteske			2drop ( c-addr/u -- ) \ getenv result unused
64280933Sdteske			s" try-include /boot/brand-${loader_brand}.4th"
65280933Sdteske		then
66280933Sdteske		evaluate
67280933Sdteske		1 spaces
68222417Sjulian
69280933Sdteske		\ Execute `brand' if defined now
70280933Sdteske		s" brand" sfind if
71280933Sdteske			brandX @ brandY @ rot execute
72280933Sdteske		else drop then
73222417Sjulian	then
74222417Sjulian;
75