home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / SDUMP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  987 b   |  58 lines

  1. /*
  2.  * sdump.c
  3.  * contains: stackdump()
  4.  *
  5.  */
  6.  
  7. #include <stdio.h>
  8. #include "gfuncts.h"
  9.  
  10. /*
  11.  *  void
  12.  * stackdump(n,arg1,)
  13.  *
  14.  * ARGUMENT
  15.  *  (int)    n    -    number of words to dump
  16.  *  (unsigned)  args    -    variable number of arguments
  17.  *
  18.  * DESCRIPTION
  19.  *  The arguments passed on the stack are displayed from left to right in
  20.  *  hexadecimal format.  The n parameter specifies how many words to dump
  21.  *
  22.  * AUTHOR
  23.  *   Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  24.  */
  25. #ifndef    _MSC
  26. void GF_CDECL stackdump(n)
  27. #else
  28. #if    _MSC > 4
  29. void GF_CDECL stackdump(n,...)
  30. #else
  31. void stackdump(n)
  32. #endif
  33. #endif
  34.  
  35. int n;
  36. {
  37.     void GF_CONV puthexw();
  38.     int i,j;
  39.     unsigned *p;
  40.  
  41.     p=(unsigned *)&n;
  42.     ++p;
  43.     if((n<=0)||(n>34))
  44.         j=34;
  45.     else 
  46.         j=n;
  47.     printf("\n----------<stackdump>-----------\n" );
  48.     i=1;
  49.     while(j--) {
  50.         puthexw( *p++);
  51.         putchar(' ');
  52.         i++;
  53.         if(!i%8)
  54.             putchar('\n');
  55.     }
  56.     printf("--------------------------------\n");
  57. }
  58.