From 34201621cc07339371c8d74ce0fe609d967771d4 Mon Sep 17 00:00:00 2001 From: brolley Date: Wed, 27 Feb 2008 16:42:35 +0000 Subject: 2008-02-21 Dave Brolley PR5189 * staptree.h (print_format::conv_memory): New enumerator. (print_format::width_type): New enumeration. (print_format::precision_type): New enumeration. (format_component::widthtype): New member. (format_component::prectype): New member. (format_component::is_empty): Test widthtype and prectype. (format_component::clear): Clear widthtype and prectype. * staptree.cxx (print_format::components_to_string): Handle dynamic width and precision. Handle conv_memory. (print_format::string_to_components): Parse dynamic width and precision specifiers. Set widthtype and prectype. Parse %m format specifier. * elaborate.h (typeresolution_info::check_arg_type): New method. * elaborate.cxx (typeresolution_info::visit_print_format): Account for dynamic width and precision when computing the expected number of arguments. Check the types of arguments for dynamic width and precision. Use check_arg_type to check the types of all arguments. Handle print_format::conv_memory. (typeresolution_info::check_arg_type): New method. * NEWS: Describe the enhancements above. --- NEWS | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index df7e27b4..cd9c72db 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,34 @@ * What's new in version 0.6 / 0.6.1 +- There is a new format specifier, %m, for the printf family of + functions. It functions like %s, except that it does not stop when + a nul ('\0') byte is encountered. The number of bytes output is + determined by the precision specifier. The default precision is 1. + For example: + + printf ("%m", "My String") // prints one character: M + printf ("%.5", myString) // prints 5 bytes beginning at the start + // of myString + +- The %b format specifier for the printf family of functions has been enhanced + as follows: + + 1) When the width and precision are both unspecified, the default is %8.8b. + 2) When only one of the width or precision is specified, the other defaults + to the same value. For example, %4b == %.4b == %4.4b + 3) Nul ('\0') bytes are used for field width padding. For example, + + printf ("%b", 0x1111deadbeef2222) // prints all eight bytes + printf ("%4.2b", 0xdeadbeef) // prints \0\0\xbe\xef + +- Dynamic width and precision are now supported for all printf family format + specifiers. For example: + + four = 4 + two = 2 + printf ("%*.*b", four, two, 0xdeadbbeef) // prints \0\0\xbe\xef + printf ("%*d", four, two) // prints 2 + - Preprocessor conditional expressions can now include wildcard style matches on kernel versions. %( kernel_vr != "*xen" %? foo %: bar %) -- cgit