home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / code / stubshack / HeapGraph / !HeapDisp / c / StartApp < prev    next >
Encoding:
Text File  |  1994-11-23  |  2.1 KB  |  94 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. #include "StatDispl.h"
  17.  
  18.  
  19. #define ADDRESSESXSIZE        (12*Shell_TEXTXSIZE)
  20. #define    HEAP_WIDTH        128
  21. #define    INIT_WORDS_PER_OS    8
  22.  
  23.  
  24.  
  25.  
  26. app_block    *StartApp( const char *filename, apps_anchorblock *apps)
  27. {
  28. app_block    *app;
  29. int        y = 0;
  30.  
  31.  
  32.  
  33. app = Shell_SafeMalloc( sizeof( app_block));
  34. LinkList_AddToTail( &apps->anchor, &app->header);
  35.  
  36. app->filename = Shell_SafeMalloc( 1+strlen( filename));
  37. strcpy( app->filename, filename);
  38.  
  39. app->wind = Shell_OpenWindow();
  40.  
  41. app->heaprect
  42.     = Shell_AddRectangle3( app->wind, ADDRESSESXSIZE, 0, HEAP_WIDTH, 0, HeapRedrawer, app);
  43.  
  44. app->addressesrect
  45.     = Shell_AddRectangle3( app->wind, 0, 0, ADDRESSESXSIZE, 0, AddsRedrawer, app);
  46.  
  47. app->plainrect
  48.     = Shell_AddPlainRect( app->wind, 0 , 0, ADDRESSESXSIZE + HEAP_WIDTH, 0);
  49.  
  50.  
  51. y-=Shell_TEXTYSIZE;
  52.  
  53. app->numblocks        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  54. y-=Shell_TEXTYSIZE*3/2;
  55.  
  56. app->total        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  57. y-=Shell_TEXTYSIZE*3/2;
  58.  
  59. app->totalmem        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  60. y-=Shell_TEXTYSIZE*3/2;
  61.  
  62. app->percentageused    = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  63. y-=Shell_TEXTYSIZE*3/2;
  64.  
  65. app->maxrect        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  66. y-=Shell_TEXTYSIZE*3/2;
  67.  
  68. app->minrect        = Shell_Label( app->wind, 0, y, colour_BLACK, colour_GREY1, "");
  69. y-=2*Shell_TEXTYSIZE;
  70.  
  71. app->textrect        = Shell_AddTextRect( app->wind, 0, y, colour_BLACK, colour_GREY1);
  72.  
  73.  
  74.  
  75. Shell_TextRectPrintf( app->textrect, "PipeFS filename '%s'\n", app->filename);
  76.  
  77. app->num_blocksalloced = app->num_blocks = 0;
  78. app->blocks= NULL;
  79.  
  80. app->max_mem = 0;
  81. app->min_mem = 0;
  82.  
  83. app->stats.total = 0;
  84.  
  85. app->words_per_os = INIT_WORDS_PER_OS;
  86. GetBestAddressStep( app);
  87.  
  88. Event_Claim( event_CLICK, app->wind->window, event_ANY, AppWindowClickHandler, app);
  89.  
  90. UpdateAppStatsDisplay( app);
  91.  
  92. return app;
  93. }
  94.