version.4th revision 280974
1280924Sdteske\ 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: head/sys/boot/forth/version.4th 280974 2015-04-02 01:46:17Z dteske $ 26222417Sjulian 27222417Sjulianmarker task-version.4th 28222417Sjulian 29280937Sdteskevocabulary version-processing 30280937Sdteskeonly forth also version-processing definitions 31280937Sdteske 32222417Sjulianvariable versionX 33222417Sjulianvariable versionY 34222417Sjulian 35254942Sdteske\ Default $loader_version value if not overridden or using tribute screen 36254942Sdteske: str_loader_version ( -- C-ADDR/U|-1 ) -1 ; 37254942Sdteske 38222417Sjulian\ Initialize text placement to defaults 39222417Sjulian80 versionX ! \ NOTE: this is the ending column (text is right-justified) 40222417Sjulian24 versionY ! 41222417Sjulian 42280937Sdteskeonly forth definitions also version-processing 43280937Sdteske 44222417Sjulian: print_version ( -- ) 45222417Sjulian 46222417Sjulian \ Get the text placement position (if set) 47222417Sjulian s" loader_version_x" getenv dup -1 <> if 48222417Sjulian ?number drop versionX ! -1 49222417Sjulian then drop 50222417Sjulian s" loader_version_y" getenv dup -1 <> if 51222417Sjulian ?number drop versionY ! -1 52222417Sjulian then drop 53222417Sjulian 54254942Sdteske \ Default version if none was set 55222417Sjulian s" loader_version" getenv dup -1 = if 56254942Sdteske drop 57280924Sdteske \ Use above default if no logo is requested 58254942Sdteske s" loader_logo" getenv dup -1 = if 59254942Sdteske drop str_loader_version 60254942Sdteske else 61280933Sdteske \ For tributes, do nothing (defer to logo-*.4th) 62254942Sdteske 2dup s" tribute" compare-insensitive 0= if 63254942Sdteske 2drop 64280933Sdteske s" logo" sfind if 65280933Sdteske drop exit \ see logo-tribute.4th 66254942Sdteske else 67254942Sdteske drop str_loader_version 68254942Sdteske then 69254942Sdteske else 2dup s" tributebw" compare-insensitive 0= if 70254942Sdteske 2drop 71280933Sdteske s" logo" sfind if 72280933Sdteske drop exit \ see logo-tributebw.4th 73254942Sdteske else 74254942Sdteske drop str_loader_version 75254942Sdteske then 76254942Sdteske else 77254942Sdteske 2drop str_loader_version 78254942Sdteske then then 79254942Sdteske then 80254942Sdteske then dup -1 = if 81254942Sdteske drop exit \ default version (above) is disabled 82222417Sjulian then 83222417Sjulian 84222417Sjulian \ Right justify the text 85222417Sjulian dup versionX @ swap - versionY @ at-xy 86222417Sjulian 87222417Sjulian \ Print the version (optionally in cyan) 88280974Sdteske loader_color? dup ( -- bool bool ) 89280974Sdteske if 6 fg then 90280974Sdteske type 91280974Sdteske if me then 92222417Sjulian; 93280937Sdteske 94280937Sdteskeonly forth definitions 95