changeset 20588:984557463fd0

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>
author Andy Fiddaman <omnios@citrus-it.co.uk>
date Wed, 09 Jan 2019 14:00:14 +0000
parents 3ca5d7fa0f0e
children aa25cce74feb df98494a0c23
files usr/src/boot/sys/boot/forth/frames.4th usr/src/boot/sys/boot/forth/support.4th
diffstat 2 files changed, 24 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/boot/sys/boot/forth/frames.4th	Tue May 02 21:43:54 2017 +0300
+++ b/usr/src/boot/sys/boot/forth/frames.4th	Wed Jan 09 14:00:14 2019 +0000
@@ -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 @@
 ;
 
 : 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
--- a/usr/src/boot/sys/boot/forth/support.4th	Tue May 02 21:43:54 2017 +0300
+++ b/usr/src/boot/sys/boot/forth/support.4th	Wed Jan 09 14:00:14 2019 +0000
@@ -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 @@
 
 : 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 @@
   line_buffer .addr !
   r>
 ;
-    
+
 : append_to_line_buffer  ( addr len -- )
   line_buffer strget
   2swap strcat
@@ -586,7 +593,7 @@
       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 @@
   fd @ fclose
   swap throw throw
 ;
-  
+
 only forth also support-functions definitions
 
 \ Interface to loading conf files
@@ -977,7 +984,7 @@
 
 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 @@
 \ 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 @@
 ;
 
 : entries	(  -- n )	\ count directory entries
-  ['] opendir catch 		( n array )
+  ['] opendir catch		( n array )
   throw
 
   0		( i )
@@ -1132,7 +1139,7 @@
 \ 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 @@
   \ 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 @@
   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 @@
   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 @@
 
 \ 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 @@
     ['] 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 @@
   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