debug.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
  3. * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
  4. * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
  5. */
  6. /* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/debug.c,v 1.2 1993/01/29 18:22:20 jutta Exp $ */
  7. #include "private.h"
  8. #ifndef NDEBUG
  9. /* If NDEBUG _is_ defined and no debugging should be performed,
  10. * calls to functions in this module are #defined to nothing
  11. * in private.h.
  12. */
  13. #include <stdio.h>
  14. #include "proto.h"
  15. void gsm_debug_words P4( (name, from, to, ptr),
  16. char * name,
  17. int from,
  18. int to,
  19. word * ptr)
  20. {
  21. int nprinted = 0;
  22. fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
  23. while (from <= to) {
  24. fprintf(stderr, "%d ", ptr[ from ] );
  25. from++;
  26. if (nprinted++ >= 7) {
  27. nprinted = 0;
  28. if (from < to) putc('\n', stderr);
  29. }
  30. }
  31. putc('\n', stderr);
  32. }
  33. void gsm_debug_longwords P4( (name, from, to, ptr),
  34. char * name,
  35. int from,
  36. int to,
  37. longword * ptr)
  38. {
  39. int nprinted = 0;
  40. fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
  41. while (from <= to) {
  42. fprintf(stderr, "%d ", ptr[ from ] );
  43. from++;
  44. if (nprinted++ >= 7) {
  45. nprinted = 0;
  46. if (from < to) putc('\n', stderr);
  47. }
  48. }
  49. putc('\n', stderr);
  50. }
  51. void gsm_debug_longword P2( (name, value),
  52. char * name,
  53. longword value )
  54. {
  55. fprintf(stderr, "%s: %d\n", name, (long)value );
  56. }
  57. void gsm_debug_word P2( (name, value),
  58. char * name,
  59. word value )
  60. {
  61. fprintf(stderr, "%s: %d\n", name, (long)value);
  62. }
  63. #endif