Changeset 1551


Ignore:
Timestamp:
Nov 15, 2010, 4:33:25 AM (15 years ago)
Author:
Gregg Young
Message:

This code adds the semaphores to prevent a rescan from starting before the current one is finished; it fixes the double directory listing in the tree container and streamlines scanning. It update mapsym.pl to the latest version. Some code cleanup is included

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/debugtools/mapsymw.pl

    r1342 r1551  
    11#!perl -w
    2 # mapsymw - mapsym Watcom map files
    3 
    4 # Copyright (c) 2007, 2008 Steven Levine and Associates, Inc.
     2# mapsymw - mapsym wrapper Watcom map files
     3# $Id: $
     4# Copyright (c) 2007, 2010 Steven Levine and Associates, Inc.
    55# All rights reserved.
    6 
    7 # $TLIB$: $ &(#) %n - Ver %v, %f $
    8 # TLIB: $ $
    96
    107# This program is free software licensed under the terms of the GNU
     
    1916# 08 Nov 07 SHL Drop leading keywords from function definitions
    2017# 14 Dec 08 SHL Ensure symbols sorted by value - some apps care
     18# 03 May 10 SHL Comments
     19# 14 Jun 10 SHL Avoid missing C++ symbols
    2120
    2221# mapsym requires each segment to have at least 1 symbol
     
    165164      # Address        Symbol
    166165      # 0002:0004ae46+ ArcTextProc
     166      # 0002:0d11+     void near IoctlAudioCapability( __2bd9g9REQPACKET far *, short unsigned )
    167167      # Out
    168168      # 0        1         2         3         4         5         6
     
    171171      #  0000:00000000  Imp  WinEmptyClipbrd      (PMWIN.733)
    172172      #  0002:0001ED40       __towlower_dummy
    173       if (/^([[:xdigit:]]+):([[:xdigit:]]+)[+*]?\s+(\w+)$/) {
     173      if (/^([[:xdigit:]]+):([[:xdigit:]]+)[+*]?\s+(.+)$/) {
    174174        $segnum = $1;
    175175        $offset = $2;
     
    195195
    196196        # Convert C++ symbols to something mapsym will accept
     197        # warn "$sym\n";
    197198
    198199        $_ = $sym;
    199200
    200         # s/\bIdle\b/    /;     # Drop Idle keyword
    201         s/\(.*\).*$//;          # Drop (... tails
    202 
    203         s/::~/_x/;              # Replace ::~ with _x
    204         s/::/_/;                # Replace :: with _
     201        # s/\bIdle\b/    /;     # Drop Idle keyword - obsolete done later
     202        s/\(.*\).*$//;          # Drop (...) tails
     203
     204        s/::~/__x/;             # Replace ::~ with __x
     205        s/::/__/;               # Replace :: with __
    205206
    206207        s/[<,]/_/g;             # Replace < and , with _
    207208        s/[>]//g;               # Replace > with nothing
    208209        s/[\[\]]//g;            # Replace [] with nothing
    209         s/_*$//;                # Drop trailing _
    210         s/\W+\w//;              # Drop leading keywords (including Idle)
     210        # s/_*$//;              # Drop trailing _
     211        # s/\W+\w//;            # Drop leading keywords (including Idle)
     212        s/\b.*\b\s+//g;         # Drop leading keywords (including Idle)
    211213
    212214        # Drop leading and trailing _ to match source code
     
    214216        s/^_//;                 # Drop leading _ (cdecl)
    215217        s/_$//;                 # Drop trailing _ (watcall)
     218
     219        # warn "$_\n";
    216220
    217221        # Prune some libc symbols to avoid mapsym overflows
     
    242246  close MAPFILE;
    243247
    244   # Generate dummy symbols as needed
     248  # Sort segments
    245249
    246250  my @keys = sort keys %segsinfo;
     
    249253    @keys = '0000'..$maxseg;
    250254  }
     255
     256  # Generate dummy symbols for 32-bit segments smaller than 64KB
    251257
    252258  foreach $segnum (@keys) {
     
    280286  } # foreach
    281287
     288  # Generate symbols by value listing
     289
     290  my $lastsym = '';
     291  my $seq = 0;
    282292  @keys = sort keys %syms;
    283293  foreach $segaddr (@keys) {
    284294    my $sym = $syms{$segaddr};
    285295    my $imp = substr($segaddr, 0, 4) eq '0000' ? 'Imp' : '';
     296    if ($sym ne $lastsym) {
     297      $lastsym = $sym;
     298      $seq = 0;
     299    } else {
     300      $seq++;
     301      $sym = "${sym}_$seq";
     302    }
    286303    printf WRKFILE $symfmt, $segaddr, $imp, $sym;
    287304  }
  • trunk/dll/dircnrs.c

    r1549 r1551  
    13861386      LastDir = hwnd;
    13871387      PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    1388       if (!fInitialDriveScan && fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory) {
    1389         PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
    1390         if (pszTempDir) {
     1388      if (fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory) {
     1389        PSZ pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
     1390        if (pszTempDir) {
    13911391          if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTempDir), MPVOID))
    13921392            free(pszTempDir);           // Failed
  • trunk/dll/filldir.c

    r1550 r1551  
    261261  DbgMsg(pszSrcFile, __LINE__, "ProcessDirCount %i FixedVolume %i",
    262262         ProcessDirCount, FixedVolume);
    263   if (fInitialDriveScan && ProcessDirCount >= FixedVolume) {
    264     fInitialDriveScan = FALSE;
    265     DosPostEventSem(hevInitialCnrScanComplete);
    266     DosCloseEventSem(hevInitialCnrScanComplete);
    267     if (fSwitchTree && hwndTree && fSaveState && pszFocusDir) {
     263  if (ProcessDirCount >= FixedVolume) {
     264    DosPostEventSem(hevTreeCnrScanComplete);
     265    if (fInitialDriveScan && fSwitchTree && hwndTree && fSaveState && pszFocusDir) {
    268266       // Keep drive tree in sync with directory container
    269267      if (hwndMain) {
     
    277275      }
    278276    }
     277    fInitialDriveScan = FALSE;
    279278  }
    280279# ifdef FORTIFY
     
    17091708  fDummy = FALSE;
    17101709  DosPostEventSem(CompactSem);
    1711   DosReleaseMutexSem(hmtFillingTreeCnr);
    17121710
    17131711  if (!fDontSuggestAgain) {
  • trunk/dll/flesh.c

    r1550 r1551  
    279279 * Fill in drive tree subtree
    280280 * @return TRUE if OK, else FALSE
     281 * This only scans the root directory and adds the first level directories
     282 * Flesh does a recursive scan and should be used on fast hardware.
    281283 */
    282284
  • trunk/dll/init.c

    r1546 r1551  
    196196HMTX hmtxFM2Delete;
    197197HMTX hmtxFM2Globals;
    198 HMTX hmtFillingTreeCnr;
    199 HEV  hevInitialCnrScanComplete;
     198HEV  hevTreeCnrScanComplete;
    200199ULONG OS2ver[2];
    201200PFNWP PFNWPCnr;
     
    206205ULONG ulTimeFmt;
    207206ULONG ulDateFmt;
     207ULONG ulScanPostCnt;
    208208BOOL fDontSuggestAgain;
    209209BOOL fInitialDriveScan;
     
    11121112    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    11131113              PCSZ_DOSCREATEMUTEXSEM);
    1114   if (DosCreateMutexSem(NULL, &hmtFillingTreeCnr, 0L, FALSE))
    1115     Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1116               PCSZ_DOSCREATEMUTEXSEM);
    1117   if (DosCreateEventSem(NULL, &hevInitialCnrScanComplete, 0L, FALSE))
     1114  if (DosCreateEventSem(NULL, &hevTreeCnrScanComplete, 0L, TRUE))
    11181115    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    11191116              PCSZ_DOSCREATEEVENTSEM);
  • trunk/dll/init.h

    r1498 r1551  
    8686extern ULONG ulTimeFmt;
    8787extern ULONG ulDateFmt;
     88extern ULONG ulScanPostCnt;
    8889extern PCSZ FNT_HELVETICA;
    8990extern PCSZ FNT_6HELVETICA;
     
    206207extern HMTX hmtxFM2Globals;
    207208extern HMTX hmtxFM2Delete;
    208 extern HMTX hmtFillingTreeCnr;
    209 extern HEV  hevInitialCnrScanComplete;
     209extern HEV  hevTreeCnrScanComplete;
    210210#endif
    211211
  • trunk/dll/mainwnd.c

    r1550 r1551  
    18621862
    18631863  case WM_COMMAND:
    1864     if (fInitialDriveScan)
    1865       DosWaitEventSem(hevInitialCnrScanComplete, SEM_INDEFINITE_WAIT);
     1864    DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    18661865    switch(SHORT1FROMMP(mp1)) {
    18671866    case IDM_RESCAN:
  • trunk/dll/treecnr.c

    r1550 r1551  
    646646        BOOL tempsusp, tempfollow, temptop;
    647647
     648        DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    648649        tempsusp = dcd->suspendview;
    649650        dcd->suspendview = TRUE;
     
    857858     * populate container
    858859     */
     860    DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     861    DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    859862    dcd = WinQueryWindowPtr(hwnd, QWL_USER);
    860863    if (!dcd)
     
    867870                 CM_SCROLLWINDOW,
    868871                 MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
    869       DosRequestMutexSem(hmtFillingTreeCnr, SEM_INDEFINITE_WAIT);
    870872      FillTreeCnr(dcd->hwndCnr, dcd->hwndParent);
    871873      if (fOkayMinimize) {
     
    12161218        else
    12171219          WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
    1218                                            MAIN_STATUS), pci->pszFileName);
     1220                                           MAIN_STATUS), pci->pszFileName);
    12191221        if (fMoreButtons && hwndName) {
    12201222          CHAR szDate[DATE_BUF_BYTES];
     
    19021904      INT x;
    19031905
    1904       DosRequestMutexSem(hmtFillingTreeCnr, SEM_INDEFINITE_WAIT);
     1906      DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     1907      DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    19051908      if (fFollowTree)
    19061909        fl = 0;
     
    19171920          if (hwndStatus)
    19181921            WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_RESCANSUGTEXT));
    1919           DosReleaseMutexSem(hmtFillingTreeCnr);
     1922          DosPostEventSem(hevTreeCnrScanComplete);
    19201923          return 0;
    19211924        }
     
    19371940            } // for
    19381941            RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
    1939             DosReleaseMutexSem(hmtFillingTreeCnr);
     1942            DosPostEventSem(hevTreeCnrScanComplete);
    19401943            return 0;
    19411944          }
     
    20092012            PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    20102013            PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(status));
    2011             DosReleaseMutexSem(hmtFillingTreeCnr);
     2014            DosPostEventSem(hevTreeCnrScanComplete);
    20122015            return 0;
    20132016          }
     
    20322035              PostMsg(hwnd,
    20332036                      WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
    2034               DosReleaseMutexSem(hmtFillingTreeCnr);
     2037              DosPostEventSem(hevTreeCnrScanComplete);
    20352038              return 0;
    20362039            }
    20372040            if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) {
    20382041              OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
    2039               DosReleaseMutexSem(hmtFillingTreeCnr);
     2042              DosPostEventSem(hevTreeCnrScanComplete);
    20402043              return 0;
    20412044            }
     
    20432046              if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
    20442047                if (FindDirCnrByName(pci->pszFileName, TRUE)) {
    2045                   DosReleaseMutexSem(hmtFillingTreeCnr);
     2048                  DosPostEventSem(hevTreeCnrScanComplete);
    20462049                  return 0;
    20472050                }
     
    20672070              }
    20682071              OpenObject(pci->pszFileName, s, dcd->hwndFrame);
    2069               DosReleaseMutexSem(hmtFillingTreeCnr);
     2072              DosPostEventSem(hevTreeCnrScanComplete);
    20702073              return 0;
    20712074            }
     
    21112114      if (fFollowTree)
    21122115        WinSetFocus(HWND_DESKTOP, hwnd);
    2113       DosReleaseMutexSem(hmtFillingTreeCnr);
     2116      DosPostEventSem(hevTreeCnrScanComplete);
    21142117    }
    21152118    return 0;
     
    27852788            if (pci->attrFile & FILE_DIRECTORY) {
    27862789              if (pci->flags & RECFLAGS_UNDERENV)
    2787                 break;
    2788               DosRequestMutexSem(hmtFillingTreeCnr, SEM_INDEFINITE_WAIT);
     2790                break;
     2791              DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     2792              DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    27892793              UnFlesh(hwnd, pci);
    27902794              // Check if drive type might need update
     
    28162820              if (~driveflag & DRIVE_INVALID)
    28172821                Flesh(hwnd, pci);
    2818               DosReleaseMutexSem(hmtFillingTreeCnr);
     2822              DosPostEventSem(hevTreeCnrScanComplete);
    28192823            }
    28202824          }
Note: See TracChangeset for help on using the changeset viewer.