Changeset View
Changeset View
Standalone View
Standalone View
stand/forth/color.4th
Show All 21 Lines | |||||
\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
\ SUCH DAMAGE. | \ SUCH DAMAGE. | ||||
\ | \ | ||||
\ $FreeBSD$ | \ $FreeBSD$ | ||||
marker task-color.4th | marker task-color.4th | ||||
\ This function returns FALSE if the `loader_color' environment variable is set | \ This function returns FALSE if the `loader_color' environment variable is set | ||||
\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial). | \ to NO, no, or 0. It returns TRUE if `loader_color' is set to any other value. | ||||
\ If `loader_color' is unset, TRUE is returned (unless booting serial). | |||||
\ | \ | ||||
: loader_color? ( -- N ) | : loader_color? ( -- N ) | ||||
tsoome: this is not your code, but could you swap N to t there, since we leave true or false on stack… | |||||
s" loader_color" getenv dup -1 <> if | s" loader_color" getenv dup -1 <> if | ||||
\ `loader_color' is set. | |||||
\ Check if it is explicitly disabled. | |||||
2dup s" NO" compare-insensitive 0= if | 2dup s" NO" compare-insensitive 0= if | ||||
2drop | 2drop | ||||
FALSE exit | FALSE exit | ||||
then | then | ||||
2dup s" 0" compare 0= if | 2dup s" 0" compare 0= if | ||||
2drop | 2drop | ||||
FALSE exit | FALSE exit | ||||
then | then | ||||
drop | drop | ||||
then | \ It is enabled. | ||||
TRUE | |||||
else | |||||
\ `loader_color' is unset. | |||||
\ Default to using color unless serial boot is active. | |||||
drop | drop | ||||
boot_serial? if FALSE else TRUE then | boot_serial? if FALSE else TRUE then | ||||
tsoomeUnsubmitted Done Inline Actionsyou can use: tsoome: you can use:
boot_serial? 0= -- this will leave proper value on stack and you can save 4 words… | |||||
then | |||||
; | ; |
this is not your code, but could you swap N to t there, since we leave true or false on stack, it is traditionally denoted by char 't''. (N is for signed int).