1*ca987d46SWarner Losh\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org> 2*ca987d46SWarner Losh\ All rights reserved. 3*ca987d46SWarner Losh\ 4*ca987d46SWarner Losh\ Redistribution and use in source and binary forms, with or without 5*ca987d46SWarner Losh\ modification, are permitted provided that the following conditions 6*ca987d46SWarner Losh\ are met: 7*ca987d46SWarner Losh\ 1. Redistributions of source code must retain the above copyright 8*ca987d46SWarner Losh\ notice, this list of conditions and the following disclaimer. 9*ca987d46SWarner Losh\ 2. Redistributions in binary form must reproduce the above copyright 10*ca987d46SWarner Losh\ notice, this list of conditions and the following disclaimer in the 11*ca987d46SWarner Losh\ documentation and/or other materials provided with the distribution. 12*ca987d46SWarner Losh\ 13*ca987d46SWarner Losh\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14*ca987d46SWarner Losh\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15*ca987d46SWarner Losh\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16*ca987d46SWarner Losh\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17*ca987d46SWarner Losh\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18*ca987d46SWarner Losh\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19*ca987d46SWarner Losh\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20*ca987d46SWarner Losh\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21*ca987d46SWarner Losh\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22*ca987d46SWarner Losh\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23*ca987d46SWarner Losh\ SUCH DAMAGE. 24*ca987d46SWarner Losh\ 25*ca987d46SWarner Losh 26*ca987d46SWarner Loshmarker task-version.4th 27*ca987d46SWarner Losh 28*ca987d46SWarner Loshvocabulary version-processing 29*ca987d46SWarner Loshonly forth also version-processing definitions 30*ca987d46SWarner Losh 31*ca987d46SWarner Loshvariable versionX 32*ca987d46SWarner Loshvariable versionY 33*ca987d46SWarner Losh 34*ca987d46SWarner Losh\ Default $loader_version value if not overridden or using tribute screen 35*ca987d46SWarner Losh: str_loader_version ( -- C-ADDR/U|-1 ) -1 ; 36*ca987d46SWarner Losh 37*ca987d46SWarner Losh\ Initialize text placement to defaults 38*ca987d46SWarner Losh80 versionX ! \ NOTE: this is the ending column (text is right-justified) 39*ca987d46SWarner Losh24 versionY ! 40*ca987d46SWarner Losh 41*ca987d46SWarner Loshonly forth definitions also version-processing 42*ca987d46SWarner Losh 43*ca987d46SWarner Losh: print_version ( -- ) 44*ca987d46SWarner Losh 45*ca987d46SWarner Losh \ Get the text placement position (if set) 46*ca987d46SWarner Losh s" loader_version_x" getenv dup -1 <> if 47*ca987d46SWarner Losh ?number drop versionX ! -1 48*ca987d46SWarner Losh then drop 49*ca987d46SWarner Losh s" loader_version_y" getenv dup -1 <> if 50*ca987d46SWarner Losh ?number drop versionY ! -1 51*ca987d46SWarner Losh then drop 52*ca987d46SWarner Losh 53*ca987d46SWarner Losh \ Default version if none was set 54*ca987d46SWarner Losh s" loader_version" getenv dup -1 = if 55*ca987d46SWarner Losh drop 56*ca987d46SWarner Losh \ Use above default if no logo is requested 57*ca987d46SWarner Losh s" loader_logo" getenv dup -1 = if 58*ca987d46SWarner Losh drop str_loader_version 59*ca987d46SWarner Losh else 60*ca987d46SWarner Losh \ For tributes, do nothing (defer to logo-*.4th) 61*ca987d46SWarner Losh 2dup s" tribute" compare-insensitive 0= if 62*ca987d46SWarner Losh 2drop 63*ca987d46SWarner Losh s" logo" sfind if 64*ca987d46SWarner Losh drop exit \ see logo-tribute.4th 65*ca987d46SWarner Losh else 66*ca987d46SWarner Losh drop str_loader_version 67*ca987d46SWarner Losh then 68*ca987d46SWarner Losh else 2dup s" tributebw" compare-insensitive 0= if 69*ca987d46SWarner Losh 2drop 70*ca987d46SWarner Losh s" logo" sfind if 71*ca987d46SWarner Losh drop exit \ see logo-tributebw.4th 72*ca987d46SWarner Losh else 73*ca987d46SWarner Losh drop str_loader_version 74*ca987d46SWarner Losh then 75*ca987d46SWarner Losh else 76*ca987d46SWarner Losh 2drop str_loader_version 77*ca987d46SWarner Losh then then 78*ca987d46SWarner Losh then 79*ca987d46SWarner Losh then dup -1 = if 80*ca987d46SWarner Losh drop exit \ default version (above) is disabled 81*ca987d46SWarner Losh then 82*ca987d46SWarner Losh 83*ca987d46SWarner Losh \ Right justify the text 84*ca987d46SWarner Losh dup versionX @ swap - versionY @ at-xy 85*ca987d46SWarner Losh 86*ca987d46SWarner Losh \ Print the version (optionally in cyan) 87*ca987d46SWarner Losh loader_color? dup ( c-addr/u -- c-addr/u bool bool ) 88*ca987d46SWarner Losh if 6 fg then 89*ca987d46SWarner Losh -rot type 90*ca987d46SWarner Losh if me then 91*ca987d46SWarner Losh 92*ca987d46SWarner Losh 0 25 at-xy 93*ca987d46SWarner Losh; 94*ca987d46SWarner Losh 95*ca987d46SWarner Loshonly forth definitions 96