class AdLint::Cc1::PrintfFormat::Conversion_d
Public Class Methods
suitable_conversion_specifier_character()
click to toggle source
# File lib/adlint/cc1/format.rb, line 871 def self.suitable_conversion_specifier_character "d" end
Private Instance Methods
argument_types()
click to toggle source
# File lib/adlint/cc1/format.rb, line 902 def argument_types # NOTE: The ISO C99 standard says; # # 7.19.6.1 The fprintf function # # 7 The length modifiers and their meanings are: # # hh Specifies that a following d, i, o, u, x, or X conversion # specifier applies to a signed char or unsigned char argument # (the argument will have been promoted according to the integer # promotions, but its value shall be converted to signed char or # unsigned char before printing); or that a following n # conversion specifier applies to a pointer to a signed char # argument. # h Specifies that a following d, i, o, u, x, or X conversion # specifier applies to a short int or unsigned short int # argument (the argument will have been promoted according to # the integer promotions, but its value shall be converted to # short int or unsigned short int before printing); or that a # following n conversion specifier applies to a pointer to a # short int argument. # l Specifies that a following d, i, o, u, x, or X conversion # specifier applies to a long int or unsigned long int argument; # that a following n conversion specifier applies to a pointer # to a long int argument; that a following c conversion # specifier applies to a wint_t argument; that a following s # conversion specifier applies to a pointer to a wchar_t # argument; or has no effect on a following a, A, e, E, f, F, g, # or G conversion specifier. # ll Specifies that a following d, i, o, u, x, or X conversion # specifier applies to a long long int or unsigned long long int # argument; or that a following n conversion specifier applies # to a pointer to a long long int argument. # j Specifies that a following d, i, o, u, x, or X conversion # specifier applies to an intmax_t or uintmax_t argument; or # that a following n conversion specifier applies to a pointer # to an intmax_t argument. # z Specifies that a following d, i, o, u, x, or X conversion # specifier applies to a size_t or the corresponding signed # integer type argument; or that a following n conversion # specifier applies to a pointer to a signed integer type # corresponding to size_t argument. # t Specifies that a following d, i, o, u, x, or X conversion # specifier applies to a ptrdiff_t or the corresponding unsigned # integer type argument; or that a following n conversion # specifier applies to a pointer to a ptrdiff_t argument. case length_modifier when "hh" [signed_char_t, unsigned_char_t] when "h" [signed_short_t, unsigned_short_t] when "l" [signed_long_t, unsigned_long_t] when "ll" [signed_long_long_t, unsigned_long_long_t] when "j" # FIXME: `intmax_t' and `uintmax_t' are not supported yet. [signed_long_long_t, unsigned_long_long_t] when "z" # FIXME: `size_t' is not supported yet. [unsigned_long_t] when "t" # FIXME: `ptrdiff_t' is not supported yet. [signed_int_t] else [signed_int_t, unsigned_int_t] end end
conversion_type()
click to toggle source
# File lib/adlint/cc1/format.rb, line 975 def conversion_type case length_modifier when "hh" if conversion_argument && conversion_argument.type.signed? signed_char_t else unsigned_char_t end when "h" if conversion_argument && conversion_argument.type.signed? signed_short_t else unsigned_short_t end when "l" if conversion_argument && conversion_argument.type.signed? signed_long_t else unsigned_long_t end when "ll" if conversion_argument && conversion_argument.type.signed? signed_long_long_t else unsigned_long_long_t end when "j" # FIXME: `intmax_t' and `uintmax_t' are not supported yet. if conversion_argument && conversion_argument.type.signed? signed_long_long_t else unsigned_long_long_t end when "z" # FIXME: `size_t' is not supported yet. unsigned_long_t when "t" # FIXME: `ptrdiff_t' is not supported yet. signed_int_t else default_conversion_type end end
default_conversion_type()
click to toggle source
# File lib/adlint/cc1/format.rb, line 1019 def default_conversion_type signed_int_t end
default_precision_value()
click to toggle source
# File lib/adlint/cc1/format.rb, line 876 def default_precision_value # NOTE: The ISO C99 standard says; # # 7.19.6.1 The fprintf function # # 8 The conversion specifiers and their meanings are: # # d,i The int argument is converted to signed decimal in the # style [-]dddd. The precision specifies the minimum number # of digits to appear; if the value being converted can be # represented in fewer digits, it is expanded with leading # zeros. The default precision is 1. The result of # converting a zero value with a precision of zero is no # characters. # o,u,x,X The unsigned int argument is converted to unsigned octal # (o), unsigned decimal (u), or unsigned hexadecimal notation # (x or X) in the style dddd; the letters abcdef are used for # x conversion and the letters ABCDEF for X conversion. The # precision specifies the minimum number of digits to appear; # if the value being converted can be represented in fewer # digits, it is expanded with leading zeros. The default # precision in 1. The result of converting a zero value with # a precision of zero is no characters. 1 end
suitable_length_modifiers()
click to toggle source
# File lib/adlint/cc1/format.rb, line 971 def suitable_length_modifiers ["hh", "h", "l", "ll", "j", "z", "t"] end