home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / clibs / HeapGraph / !HeapDisp / c / StartApp < prev    next >
Encoding:
Text File  |  1994-08-30  |  2.0 KB  |  85 lines

  1. #include <string.h>
  2.  
  3. #include "DeskLib:Event.h"
  4.  
  5. #include "Shell.TextRect.h"
  6. #include "Shell.SafeAlloc.h"
  7. #include "Shell.Printf.h"
  8. #include "Shell.Label.h"
  9. #include "Shell.PlainRect.h"
  10.  
  11. #include "StartApp.h"
  12. #include "Redraw.h"
  13. #include "AddsRedraw.h"
  14. #include "AppMenu.h"
  15. #include "AddStep.h"
  16.  
  17.  
  18. #define ADDRESSESXSIZE        (12*Shell_TEXTXSIZE)
  19. #define    HEAP_WIDTH        128
  20. #define    INIT_WORDS_PER_OS    8
  21.  
  22.  
  23.  
  24.  
  25. app_block    *StartApp( const char *filename, apps_anchorblock *apps)
  26. {
  27. app_block    *app;
  28. int        y = 0;
  29.  
  30.  
  31.  
  32. app = Shell_SafeMalloc( sizeof( app_block));
  33. LinkList_AddToTail( &apps->anchor, &app->header);
  34.  
  35. app->filename = Shell_SafeMalloc( 1+strlen( filename));
  36. strcpy( app->filename, filename);
  37.  
  38. app->wind = Shell_OpenWindow();
  39.  
  40. app->heaprect
  41.     = Shell_AddRectangle3( app->wind, ADDRESSESXSIZE, 0, HEAP_WIDTH, 0, HeapRedrawer, app);
  42.  
  43. app->addressesrect
  44.     = Shell_AddRectangle3( app->wind, 0, 0, ADDRESSESXSIZE, 0, AddsRedrawer, app);
  45.  
  46. app->plainrect
  47.     = Shell_AddPlainRect( app->wind, 0 , 0, ADDRESSESXSIZE + HEAP_WIDTH, 0);
  48.  
  49.  
  50. y-=Shell_TEXTYSIZE;
  51. app->numblocks        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  52. y-=Shell_TEXTYSIZE*3/2;
  53. app->total        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  54. y-=Shell_TEXTYSIZE*3/2;
  55. app->totalmem        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  56. y-=Shell_TEXTYSIZE*3/2;
  57. app->percentageused    = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  58. y-=Shell_TEXTYSIZE*3/2;
  59. app->minmaxrect        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  60. y-=2*Shell_TEXTYSIZE;
  61.  
  62. app->textrect        = Shell_AddTextRect( app->wind, 0, y, colour_BLACK, colour_GREY1);
  63.  
  64.  
  65.  
  66. Shell_TextRectPrintf( app->textrect, "PipeFS filename '%s'\n", app->filename);
  67.  
  68. app->num_blocksalloced = app->num_blocks = 0;
  69. app->blocks= NULL;
  70.  
  71. app->max_mem = 0;
  72. app->min_mem = 0x7fffffff;
  73.  
  74. app->stats.total = 0;
  75.  
  76. app->words_per_os = INIT_WORDS_PER_OS;
  77. GetBestAddressStep( app);
  78.  
  79. Event_Claim( event_CLICK, app->wind->window, event_ANY, AppWindowClickHandler, app);
  80.  
  81.  
  82.  
  83. return app;
  84. }
  85.