home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / monitors / rsys / source.lha / src / RSysFlush.c < prev    next >
C/C++ Source or Header  |  1995-01-09  |  2KB  |  110 lines

  1. /*
  2. ***************************************************************************
  3. *
  4. * Datei:
  5. *    RSysFlush.c
  6. *
  7. * Inhalt:
  8. *    void RSysFlushAllLibraries(void);
  9. *    void RSysFlushAllFonts(void);
  10. *    void RSysFlushAll(void);
  11. *
  12. * Bemerkungen:
  13. *    Speicherfreigabe durch Beseitigen von nicht benutzten
  14. *    Fonts und Libraries.
  15. *
  16. * Erstellungsdatum:
  17. *    07-Jul-93    Rolf Böhme
  18. *
  19. * Änderungen:
  20. *    07-Jul-93    Rolf Böhme    Erstellung
  21. *
  22. ***************************************************************************
  23. */
  24.  
  25. #include "RSysDebug.h"
  26. #include "RSysFunc.h"
  27.  
  28.    /*
  29.     * FlushAllLibraries() entfernt alle geschlossenen Libraries aus
  30.     * dem System
  31.     */
  32. void
  33. RSysFlushAllLibraries(void)
  34. {
  35.    struct Library *result;
  36.    struct Node *node;
  37.  
  38.    if (Question(SysWnd, "Do you really want to remove all unused  Libraries?", YES))
  39.    {
  40.       Forbid();
  41.  
  42.       for (node = SysBase->LibList.lh_Head; node->ln_Succ;
  43.            node = node->ln_Succ)
  44.       {
  45.          result = (struct Library *) node;
  46.  
  47.          if (result->lib_OpenCnt == 0)
  48.             RemLibrary(result);
  49.       }
  50.  
  51.       Permit();
  52.  
  53.       PrintInfo("All libraries flushed", SPEAK, SEC);
  54.  
  55.       RefreshList(LastID);
  56.  
  57.       PrintStatistics();
  58.    }
  59.  
  60.    return;
  61. }
  62.  
  63.  
  64.    /*
  65.     * RSysFlushAllFonts() entfernt alle unbenutzten Diskfonts aus
  66.     * dem System
  67.     */
  68. void
  69. RSysFlushAllFonts(void)
  70. {
  71.    struct TextFont *tf;
  72.    struct Node *node;
  73.  
  74.    if (Question(SysWnd, "Do you really want to remove all unused Not-ROM-Fonts?", YES))
  75.    {
  76.       Forbid();
  77.  
  78.       for (node = GfxBase->TextFonts.lh_Head; node->ln_Succ;
  79.            node = node->ln_Succ)
  80.       {
  81.          tf = (struct TextFont *) node;
  82.  
  83.          if ((tf->tf_Accessors == 0) && (tf->tf_Flags & FPF_DISKFONT))
  84.          {
  85.             RemFont(tf);
  86.             Remove(node);
  87.          }
  88.       }
  89.  
  90.       Permit();
  91.  
  92.       PrintInfo("All disk fonts in RAM flushed", SPEAK, SEC);
  93.  
  94.       RefreshList(LastID);
  95.  
  96.       PrintStatistics();
  97.    }
  98.  
  99.    return;
  100. }
  101.  
  102. void
  103. RSysFlushAll(void)
  104. {
  105.    RSysFlushAllLibraries();
  106.    RSysFlushAllFonts();
  107.  
  108.    return;
  109. }
  110.