2021-12-07 16:09:17 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-02-11 15:46:47 +01:00
|
|
|
module RplLang
|
2022-02-10 14:50:59 +01:00
|
|
|
module Core
|
2022-02-11 15:46:47 +01:00
|
|
|
module Mode
|
|
|
|
def populate_dictionary
|
|
|
|
super
|
2021-11-18 15:44:09 +01:00
|
|
|
|
2022-02-11 15:46:47 +01:00
|
|
|
@dictionary.add_word( ['prec'],
|
|
|
|
'Mode',
|
|
|
|
'( a -- ) set precision to a',
|
|
|
|
proc do
|
|
|
|
args = stack_extract( [%i[numeric]] )
|
2021-11-18 15:44:09 +01:00
|
|
|
|
2022-02-11 15:46:47 +01:00
|
|
|
@precision = args[0][:value]
|
|
|
|
end )
|
|
|
|
@dictionary.add_word( ['default'],
|
|
|
|
'Mode',
|
|
|
|
'( -- ) set default precision',
|
|
|
|
proc do
|
|
|
|
@precision = default_precision
|
|
|
|
end )
|
|
|
|
@dictionary.add_word( ['type'],
|
|
|
|
'Mode',
|
|
|
|
'( a -- s ) type of a as a string',
|
|
|
|
proc do
|
|
|
|
args = stack_extract( [:any] )
|
2021-11-18 15:44:09 +01:00
|
|
|
|
2022-02-11 15:46:47 +01:00
|
|
|
@stack << { type: :string,
|
|
|
|
value: args[0][:type].to_s }
|
|
|
|
end )
|
2021-12-07 16:46:33 +01:00
|
|
|
|
2022-02-11 15:46:47 +01:00
|
|
|
# @dictionary.add_word( ['std'],
|
|
|
|
# proc { __todo } ) # standard floating numbers representation. ex: std
|
|
|
|
# @dictionary.add_word( ['fix'],
|
|
|
|
# proc { __todo } ) # fixed point representation. ex: 6 fix
|
|
|
|
# @dictionary.add_word( ['sci'],
|
|
|
|
# proc { __todo } ) # scientific floating point representation. ex: 20 sci
|
|
|
|
# @dictionary.add_word( ['round'],
|
|
|
|
# proc { __todo } ) # set float rounding mode. ex: ["nearest", "toward zero", "toward +inf", "toward -inf", "away from zero"] round
|
|
|
|
end
|
2021-11-18 15:44:09 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|