Branch: Tag:

2015-10-11

2015-10-11 08:28:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

string_builder_sprintf: Added support for %T.

This adds a simple way to render a pike_type to a string_buffer.

17:   #include "interpret.h"   #include "operators.h"   #include "pike_float.h" + #include "pike_types.h"   #include "block_allocator.h"      #include <errno.h>
2934:    flags = (flags & ~APPEND_WIDTH_MASK) | APPEND_WIDTH_PTR;    continue;    +  case 'T': /* struct pike_type */ +  { +  /* FIXME: Doesn't care about field or integer widths yet. */ +  dynamic_buffer old_buf; +  init_buf(&old_buf); +  my_describe_type(va_arg(args, struct pike_type *)); +  string_builder_binary_strcat(s, pike_global_buffer.s.str, +  pike_global_buffer.s.len); +  toss_buffer(&pike_global_buffer); +  restore_buffer(&old_buf); +  } +  break; +     case 'O':    {    /* FIXME: Doesn't care about field or integer widths yet. */