home *** CD-ROM | disk | FTP | other *** search
/ Computer Music Interactif…cial Edition 1999 Winter / cd 3.iso / mac / Mac / Shares / Midishare™1.68 / Development Tools / Sources Examples / Other MidiShare Examples / MidiStat / MidiStat.c next >
Encoding:
C/C++ Source or Header  |  1992-05-16  |  1.3 KB  |  52 lines  |  [TEXT/MPS ]

  1. /*====================== A MIDI SHARE TOOL  (© GRAME 92) =====================
  2.  
  3. NAME
  4.       MidiStat -- a very simple MidiShare MPW tool
  5.  
  6. SYNOPSIS
  7.       MidiStat
  8.  
  9. DESCRIPTION
  10.     "MidiStat" give some informations about the MidiShare environment :  
  11.     the amount of free cells in the MidiShare memory and the list of all 
  12.     the MidiShare applications currently actives.
  13.  
  14. ===============================================================================*/
  15.  
  16.  
  17. #include <String.h>
  18. #include <StdLib.h>
  19. #include <Stdio.h>
  20. #include <MidiShare.h>
  21.  
  22.  
  23.  
  24. //----------------------------- utilities ---------------------------------
  25.  
  26. void PtoCstr( char *p, char *c)        
  27. {
  28.     int    l;
  29.     
  30.     for (l = *p++; l; l--) *c++ = *p++;
  31.     *c = 0;
  32. }
  33.  
  34.  
  35. //-------------------------------- main ------------------------------------
  36.  
  37. main( int, char **)
  38. {
  39.     short         n, i, r;
  40.     char        s[256];
  41.     
  42.     printf("Free space : %d (total space %d)\n", MidiFreeSpace(), MidiTotalSpace());
  43.     
  44.     n = MidiCountAppls();                    // count the MidiShare applications 
  45.     for (i = 1; i <= n; i++) {                // for each application
  46.         r = MidiGetIndAppl(i);                //      get its reference number from its order number
  47.         PtoCstr(MidiGetName(r), s);            //      get its name, convert-it to a C string
  48.         printf(" %d: %s (%d)\n", i, s, r);    //      print its order number, name, and reference number
  49.     }
  50. }
  51.  
  52.