diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2019-01-09 14:00:14 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2019-01-11 16:26:42 +0000 |
commit | 33d05bc1b89915cf87dec3f6f9f2d5743fc9ea70 (patch) | |
tree | 90a5c9b9002d2d1aa30d124d61f836634e333626 /usr/src | |
parent | fe4e42e2947308b70ca67636d033b989c8ab5450 (diff) | |
download | illumos-joyent-33d05bc1b89915cf87dec3f6f9f2d5743fc9ea70.tar.gz |
10196 Add 'framebuffer?' command to loader
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/boot/sys/boot/forth/frames.4th | 9 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/forth/support.4th | 35 |
2 files changed, 24 insertions, 20 deletions
diff --git a/usr/src/boot/sys/boot/forth/frames.4th b/usr/src/boot/sys/boot/forth/frames.4th index a1d170f0e9..4976e4e8e3 100644 --- a/usr/src/boot/sys/boot/forth/frames.4th +++ b/usr/src/boot/sys/boot/forth/frames.4th @@ -1,5 +1,6 @@ \ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org> \ Copyright (c) 2012-2015 Devin Teske <dteske@FreeBSD.org> +\ Copyright 2019 OmniOS Community Edition (OmniOSce) Association. \ All rights reserved. \ \ Redistribution and use in source and binary forms, with or without @@ -120,19 +121,15 @@ only forth definitions also frame-drawing ; : box ( w h x y -- ) \ Draw a box - \ Do we have frame buffer? - s" screen-height" getenv - dup -1 <> if - 2drop + framebuffer? if rot ( w x y h ) over + >R ( w x y -- R: y+h ) swap rot ( y x w -- R: y+h ) over + >R ( y x -- R: y+h x+w ) swap R> R> term-drawrect exit - else - drop then + \ Non-framebuffer version 2dup 1+ 4 pick 1- -rot vline \ Draw left vert line 2dup 1+ swap 5 pick + swap 4 pick 1- -rot diff --git a/usr/src/boot/sys/boot/forth/support.4th b/usr/src/boot/sys/boot/forth/support.4th index 17c4ac0573..7a3164ee99 100644 --- a/usr/src/boot/sys/boot/forth/support.4th +++ b/usr/src/boot/sys/boot/forth/support.4th @@ -1,6 +1,7 @@ \ Copyright (c) 1999 Daniel C. Sobral <dcs@FreeBSD.org> +\ Copyright 2019 OmniOS Community Edition (OmniOSce) Association. \ All rights reserved. -\ +\ \ Redistribution and use in source and binary forms, with or without \ modification, are permitted provided that the following conditions \ are met: @@ -202,6 +203,12 @@ create last_module_option sizeof module.next allot 0 last_module_option ! : getenv? getenv -1 = if false else drop true then ; +\ Returns TRUE if the framebuffer is active, FALSE otherwise +: framebuffer? ( -- flag ) + \ Use the screen-height variable as a proxy for framebuffer + s" screen-height" getenv? +; + \ determine if a word appears in a string, case-insensitive : contains? ( addr1 len1 addr2 len2 -- 0 | -1 ) 2 pick 0= if 2drop 2drop true exit then @@ -384,7 +391,7 @@ variable fd line_buffer .addr ! r> ; - + : append_to_line_buffer ( addr len -- ) line_buffer strget 2swap strcat @@ -586,7 +593,7 @@ also parser definitions end_of_line? if ESYNTAX throw then then skip_character - end_of_line? if ESYNTAX throw then + end_of_line? if ESYNTAX throw then repeat r> drop skip_character @@ -934,7 +941,7 @@ get-current ( -- wid ) previous definitions >search ( wid -- ) fd @ fclose swap throw throw ; - + only forth also support-functions definitions \ Interface to loading conf files @@ -977,7 +984,7 @@ only forth also support-functions definitions only forth definitions also support-functions -: test-file +: test-file ['] load_conf catch dup . ESYNTAX = if cr print_syntax_error then ; @@ -1071,7 +1078,7 @@ string current_file_name_ref \ used to print the file name \ true if string in addr1 is smaller than in addr2 : compar ( addr1 addr2 -- flag ) swap ( addr2 addr1 ) - dup cell+ ( addr2 addr1 addr ) + dup cell+ ( addr2 addr1 addr ) swap @ ( addr2 addr len ) rot ( addr len addr2 ) dup cell+ ( addr len addr2 addr' ) @@ -1113,7 +1120,7 @@ string current_file_name_ref \ used to print the file name ; : entries ( -- n ) \ count directory entries - ['] opendir catch ( n array ) + ['] opendir catch ( n array ) throw 0 ( i ) @@ -1132,7 +1139,7 @@ string current_file_name_ref \ used to print the file name \ need to check and insert it. : make_cstring ( addr len -- addr' ) dup ( addr len len ) - s" /boot/conf.d/" ( addr len len addr' len' ) + s" /boot/conf.d/" ( addr len len addr' len' ) rot ( addr len addr' len' len ) over + ( addr len addr' len' total ) \ space for prefix+str dup cell+ 1+ \ 1+ for '\0' @@ -1185,7 +1192,7 @@ string current_file_name_ref \ used to print the file name \ we have now array of strings with directory entry names. \ calculate size of concatenated string over 0 swap 0 do ( n array 0 ) - over I cells + @ ( n array total array[I] ) + over I cells + @ ( n array total array[I] ) @ + 1+ ( n array total' ) loop dup allocate if drop free 2drop 0 exit then @@ -1195,7 +1202,7 @@ string current_file_name_ref \ used to print the file name over 0 swap 0 do ( len addr n array 0 ) over I cells + @ ( len addr n array total array[I] ) dup @ swap cell+ ( len addr n array total len addr' ) - over ( len addr n array total len addr' len ) + over ( len addr n array total len addr' len ) 6 pick ( len addr n array total len addr' len addr ) 4 pick + ( len addr n array total len addr' len addr+total ) swap move + ( len addr n array total+len ) @@ -1213,7 +1220,7 @@ string current_file_name_ref \ used to print the file name scan_conf_dir if \ concatenate with conf_files ( addr len ) dup conf_files .len @ + 2 + allocate abort" out of memory" ( addr len addr' ) - dup conf_files strget ( addr len addr' caddr clen ) + dup conf_files strget ( addr len addr' caddr clen ) rot swap move ( addr len addr' ) \ add space dup conf_files .len @ + ( addr len addr' addr'+clen ) @@ -1240,7 +1247,7 @@ string current_file_name_ref \ used to print the file name \ return the file name at pos, or free the string if nothing left : get_file_name { addr len pos -- addr len pos' addr' len' || 0 } - pos len = if + pos len = if addr free abort" Fatal error freeing memory" 0 exit then @@ -1460,7 +1467,7 @@ string current_file_name_ref \ used to print the file name ['] load_module catch if dup module.loaderror .len @ if load_error \ Command should return a flag! - else + else load_error_message true \ Do not retry then else @@ -1677,7 +1684,7 @@ also builtins modulepath getenv saveenv to oldmodulepath \ Try prepending /boot/ first - bootpath nip path nip + \ total length + bootpath nip path nip + \ total length oldmodulepath nip dup -1 = if drop else |