1ca987d46SWarner Losh\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org> 2ca987d46SWarner Losh\ Copyright (c) 2012-2015 Devin Teske <dteske@FreeBSD.org> 3ca987d46SWarner Losh\ All rights reserved. 4ca987d46SWarner Losh\ 5ca987d46SWarner Losh\ Redistribution and use in source and binary forms, with or without 6ca987d46SWarner Losh\ modification, are permitted provided that the following conditions 7ca987d46SWarner Losh\ are met: 8ca987d46SWarner Losh\ 1. Redistributions of source code must retain the above copyright 9ca987d46SWarner Losh\ notice, this list of conditions and the following disclaimer. 10ca987d46SWarner Losh\ 2. Redistributions in binary form must reproduce the above copyright 11ca987d46SWarner Losh\ notice, this list of conditions and the following disclaimer in the 12ca987d46SWarner Losh\ documentation and/or other materials provided with the distribution. 13ca987d46SWarner Losh\ 14ca987d46SWarner Losh\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15ca987d46SWarner Losh\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16ca987d46SWarner Losh\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17ca987d46SWarner Losh\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18ca987d46SWarner Losh\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19ca987d46SWarner Losh\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20ca987d46SWarner Losh\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21ca987d46SWarner Losh\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22ca987d46SWarner Losh\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23ca987d46SWarner Losh\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24ca987d46SWarner Losh\ SUCH DAMAGE. 25ca987d46SWarner Losh\ 26ca987d46SWarner Losh\ $FreeBSD$ 27ca987d46SWarner Losh 28ca987d46SWarner Loshmarker task-frames.4th 29ca987d46SWarner Losh 30ca987d46SWarner Loshvocabulary frame-drawing 31ca987d46SWarner Loshonly forth also frame-drawing definitions 32ca987d46SWarner Losh 33ca987d46SWarner Losh\ XXX Filled boxes are left as an exercise for the reader... ;-/ 34ca987d46SWarner Losh 35ca987d46SWarner Loshvariable h_el 36ca987d46SWarner Loshvariable v_el 37ca987d46SWarner Loshvariable lt_el 38ca987d46SWarner Loshvariable lb_el 39ca987d46SWarner Loshvariable rt_el 40ca987d46SWarner Loshvariable rb_el 41ca987d46SWarner Loshvariable fill 42ca987d46SWarner Losh 43ca987d46SWarner Losh\ ASCII frames (used when serial console is detected) 44ca987d46SWarner Losh 45 constant ascii_dash 45ca987d46SWarner Losh 61 constant ascii_equal 46ca987d46SWarner Losh124 constant ascii_pipe 47ca987d46SWarner Losh 43 constant ascii_plus 48ca987d46SWarner Losh 49ca987d46SWarner Losh\ Single frames 5056758831SToomas Soome0x2500 constant sh_el 5156758831SToomas Soome0x2502 constant sv_el 5256758831SToomas Soome0x250c constant slt_el 5356758831SToomas Soome0x2514 constant slb_el 5456758831SToomas Soome0x2510 constant srt_el 5556758831SToomas Soome0x2518 constant srb_el 56ca987d46SWarner Losh\ Double frames 5756758831SToomas Soome0x2550 constant dh_el 5856758831SToomas Soome0x2551 constant dv_el 5956758831SToomas Soome0x2554 constant dlt_el 6056758831SToomas Soome0x255a constant dlb_el 6156758831SToomas Soome0x2557 constant drt_el 6256758831SToomas Soome0x255d constant drb_el 63ca987d46SWarner Losh\ Fillings 64ca987d46SWarner Losh0 constant fill_none 65ca987d46SWarner Losh32 constant fill_blank 6656758831SToomas Soome0x2591 constant fill_dark 6756758831SToomas Soome0x2592 constant fill_med 6856758831SToomas Soome0x2593 constant fill_bright 69ca987d46SWarner Losh 70ca987d46SWarner Loshonly forth definitions also frame-drawing 71ca987d46SWarner Losh 72ca987d46SWarner Losh: hline ( len x y -- ) \ Draw horizontal single line 73ca987d46SWarner Losh at-xy \ move cursor 74ca987d46SWarner Losh 0 do 7556758831SToomas Soome h_el @ xemit 76ca987d46SWarner Losh loop 77ca987d46SWarner Losh; 78ca987d46SWarner Losh 79ca987d46SWarner Losh: f_ascii ( -- ) ( -- ) \ set frames to ascii 80ca987d46SWarner Losh ascii_dash h_el ! 81ca987d46SWarner Losh ascii_pipe v_el ! 82ca987d46SWarner Losh ascii_plus lt_el ! 83ca987d46SWarner Losh ascii_plus lb_el ! 84ca987d46SWarner Losh ascii_plus rt_el ! 85ca987d46SWarner Losh ascii_plus rb_el ! 86ca987d46SWarner Losh; 87ca987d46SWarner Losh 88ca987d46SWarner Losh: f_single ( -- ) \ set frames to single 89ca987d46SWarner Losh boot_serial? if f_ascii exit then 90ca987d46SWarner Losh sh_el h_el ! 91ca987d46SWarner Losh sv_el v_el ! 92ca987d46SWarner Losh slt_el lt_el ! 93ca987d46SWarner Losh slb_el lb_el ! 94ca987d46SWarner Losh srt_el rt_el ! 95ca987d46SWarner Losh srb_el rb_el ! 96ca987d46SWarner Losh; 97ca987d46SWarner Losh 98ca987d46SWarner Losh: f_double ( -- ) \ set frames to double 99ca987d46SWarner Losh boot_serial? if 100ca987d46SWarner Losh f_ascii 101ca987d46SWarner Losh ascii_equal h_el ! 102ca987d46SWarner Losh exit 103ca987d46SWarner Losh then 104ca987d46SWarner Losh dh_el h_el ! 105ca987d46SWarner Losh dv_el v_el ! 106ca987d46SWarner Losh dlt_el lt_el ! 107ca987d46SWarner Losh dlb_el lb_el ! 108ca987d46SWarner Losh drt_el rt_el ! 109ca987d46SWarner Losh drb_el rb_el ! 110ca987d46SWarner Losh; 111ca987d46SWarner Losh 112ca987d46SWarner Losh: vline ( len x y -- ) \ Draw vertical single line 113ca987d46SWarner Losh 2dup 4 pick 114ca987d46SWarner Losh 0 do 115ca987d46SWarner Losh at-xy 11656758831SToomas Soome v_el @ xemit 117ca987d46SWarner Losh 1+ 118ca987d46SWarner Losh 2dup 119ca987d46SWarner Losh loop 120ca987d46SWarner Losh 2drop 2drop drop 121ca987d46SWarner Losh; 122ca987d46SWarner Losh 123ca987d46SWarner Losh: box ( w h x y -- ) \ Draw a box 124*3630506bSToomas Soome framebuffer? if 125*3630506bSToomas Soome s" term-drawrect" sfind if 126*3630506bSToomas Soome >R 127*3630506bSToomas Soome rot ( w x y h ) 128*3630506bSToomas Soome over + >R ( w x y -- R: y+h ) 129*3630506bSToomas Soome swap rot ( y x w -- R: y+h ) 130*3630506bSToomas Soome over + >R ( y x -- R: y+h x+w ) 131*3630506bSToomas Soome swap R> R> R> execute 132*3630506bSToomas Soome exit 133*3630506bSToomas Soome else 134*3630506bSToomas Soome drop 135*3630506bSToomas Soome then 136*3630506bSToomas Soome then 137*3630506bSToomas Soome \ Non-framebuffer version 138ca987d46SWarner Losh 2dup 1+ 4 pick 1- -rot 139ca987d46SWarner Losh vline \ Draw left vert line 140ca987d46SWarner Losh 2dup 1+ swap 5 pick + swap 4 pick 1- -rot 141ca987d46SWarner Losh vline \ Draw right vert line 142ca987d46SWarner Losh 2dup swap 1+ swap 5 pick 1- -rot 143ca987d46SWarner Losh hline \ Draw top horiz line 144ca987d46SWarner Losh 2dup swap 1+ swap 4 pick + 5 pick 1- -rot 145ca987d46SWarner Losh hline \ Draw bottom horiz line 14656758831SToomas Soome 2dup at-xy lt_el @ xemit \ Draw left-top corner 14756758831SToomas Soome 2dup 4 pick + at-xy lb_el @ xemit \ Draw left bottom corner 14856758831SToomas Soome 2dup swap 5 pick + swap at-xy rt_el @ xemit \ Draw right top corner 14956758831SToomas Soome 2 pick + swap 3 pick + swap at-xy rb_el @ xemit 150ca987d46SWarner Losh 2drop 151ca987d46SWarner Losh; 152ca987d46SWarner Losh 153ca987d46SWarner Loshf_single 154ca987d46SWarner Loshfill_none fill ! 155ca987d46SWarner Losh 156ca987d46SWarner Loshonly forth definitions 157