PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/stand/forth/beastie.4th

https://bitbucket.org/freebsd/freebsd-base
Forth | 110 lines | 97 code | 13 blank | 0 comment | 12 complexity | 0745f1625b7b3d40da090b78597eadc1 MD5 | raw file
  1. \ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
  2. \ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
  3. \ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
  4. \ All rights reserved.
  5. \
  6. \ Redistribution and use in source and binary forms, with or without
  7. \ modification, are permitted provided that the following conditions
  8. \ are met:
  9. \ 1. Redistributions of source code must retain the above copyright
  10. \ notice, this list of conditions and the following disclaimer.
  11. \ 2. Redistributions in binary form must reproduce the above copyright
  12. \ notice, this list of conditions and the following disclaimer in the
  13. \ documentation and/or other materials provided with the distribution.
  14. \
  15. \ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  16. \ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. \ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. \ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  19. \ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. \ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  21. \ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22. \ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  23. \ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  24. \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25. \ SUCH DAMAGE.
  26. \
  27. \ $FreeBSD$
  28. marker task-beastie.4th
  29. only forth definitions
  30. variable logoX
  31. variable logoY
  32. \ Initialize logo placement to defaults
  33. 46 logoX !
  34. 4 logoY !
  35. \ This function draws any number of beastie logos at (loader_logo_x,
  36. \ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
  37. \ your beastie, set the variable `loader_logo' to the respective logo name.
  38. \
  39. \ NOTE: Each is defined as a logo function in /boot/logo-${loader_logo}.4th
  40. \ NOTE: If `/boot/logo-${loader_logo}.4th' does not exist or does not define
  41. \ a `logo' function, no beastie is drawn.
  42. \
  43. : draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
  44. s" loader_logo_x" getenv dup -1 <> if
  45. ?number 1 = if logoX ! then
  46. else drop then
  47. s" loader_logo_y" getenv dup -1 <> if
  48. ?number 1 = if logoY ! then
  49. else drop then
  50. \ If `logo' is defined, execute it
  51. s" logo" sfind ( -- xt|0 bool ) if
  52. logoX @ logoY @ rot execute
  53. else
  54. \ Not defined; try-include desired logo file
  55. drop ( xt = 0 ) \ cruft
  56. s" loader_logo" getenv dup -1 = over 0= or if
  57. dup 0= if 2drop else drop then \ getenv result unused
  58. loader_color? if
  59. s" try-include /boot/logo-orb.4th"
  60. else
  61. s" try-include /boot/logo-orbbw.4th"
  62. then
  63. else
  64. 2drop ( c-addr/u -- ) \ getenv result unused
  65. s" try-include /boot/logo-${loader_logo}.4th"
  66. then
  67. evaluate
  68. 1 spaces
  69. \ Execute `logo' if defined now
  70. s" logo" sfind if
  71. logoX @ logoY @ rot execute
  72. else drop then
  73. then
  74. ;
  75. also support-functions
  76. : beastie-start ( -- ) \ starts the menu
  77. s" beastie_disable" getenv dup -1 <> if
  78. s" YES" compare-insensitive 0= if
  79. any_conf_read? if
  80. load_xen_throw
  81. load_kernel
  82. load_modules
  83. then
  84. exit \ to autoboot (default)
  85. then
  86. else drop then
  87. s" loader_delay" getenv -1 = if
  88. s" include /boot/menu.rc" evaluate
  89. else
  90. drop
  91. ." Loading Menu (Ctrl-C to Abort)" cr
  92. s" set delay_command='include /boot/menu.rc'" evaluate
  93. s" set delay_showdots" evaluate
  94. delay_execute
  95. then
  96. ;
  97. only forth definitions