go-print.c 890 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* go-print.c -- support for the go print statement.
  2. Copyright 2009 The Go Authors. All rights reserved.
  3. Use of this source code is governed by a BSD-style
  4. license that can be found in the LICENSE file. */
  5. #include <math.h>
  6. #include <stdint.h>
  7. #include <stdio.h>
  8. #include "runtime.h"
  9. #include "array.h"
  10. #include "go-panic.h"
  11. #include "interface.h"
  12. /* This implements the various little functions which are called by
  13. the predeclared functions print/println/panic/panicln. */
  14. void
  15. __go_print_empty_interface (struct __go_empty_interface e)
  16. {
  17. runtime_printf ("(%p,%p)", e.__type_descriptor, e.__object);
  18. }
  19. void
  20. __go_print_interface (struct __go_interface i)
  21. {
  22. runtime_printf ("(%p,%p)", i.__methods, i.__object);
  23. }
  24. void
  25. __go_print_slice (struct __go_open_array val)
  26. {
  27. runtime_printf ("[%d/%d]", val.__count, val.__capacity);
  28. runtime_printpointer (val.__values);
  29. }