Ignore:
Timestamp:
Jul 18, 2000, 7:56:51 PM (25 years ago)
Author:
bird
Message:

Added and updated authors.
Corrected dep rule in makefile
Corrections and improvements in stateupd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/StateUpd.cpp

    r3840 r3848  
    1 /* $Id: StateUpd.cpp,v 1.24 2000-07-18 07:33:13 bird Exp $
     1/* $Id: StateUpd.cpp,v 1.25 2000-07-18 17:56:50 bird Exp $
    22 *
    33 * StateUpd - Scans source files for API functions and imports data on them.
     
    6868static void  copy(char *psz, char *pszFrom, int iFrom, char *pszTo, int iTo, char **papszLines);
    6969static void  copy(char *psz, int jFrom, int iFrom, int jTo, int iTo, char **papszLines);
    70 static void  copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip);
    71 static void  copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip);
     70static void  copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML);
     71static void  copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML);
    7272static char *stristr(const char *pszStr, const char *pszSubStr);
    7373static char *skipBackwards(const char *pszStopAt, const char *pszFrom, int &iLine, char **papszLines);
     
    9494    char          *pszUser     = "root";
    9595    char          *pszPasswd   = "";
    96     ULONG          ul0, ul1, ul2;
     96    ULONG          ul1, ul2;
     97    ULONG          cUpdated, cAll, cNotAliased;
    9798
    9899    DosError(0x3);
     
    317318        if (!options.fIntegrityOnly)
    318319        {
    319             ul2 = dbGetNumberOfUpdatedFunction(options.lDllRefcode);
    320             ul1 = dbCountFunctionInDll(options.lDllRefcode, FALSE);
    321             ul0 = dbCountFunctionInDll(options.lDllRefcode, TRUE);
    322             if (ul0 > ul2)
    323             {
    324                 fprintf(phSignal, "%d functions where not found (found=%d, total=%d).\n", ul0 - ul2, ul2, ul0);
     320            cUpdated    = dbGetNumberOfUpdatedFunction(options.lDllRefcode);
     321            cAll        = dbCountFunctionInDll(options.lDllRefcode, FALSE);
     322            cNotAliased = dbCountFunctionInDll(options.lDllRefcode, TRUE);
     323            if (cNotAliased > cUpdated)
     324            {
     325                fprintf(phSignal, "%d functions where not found (found=%d, total=%d).\n",
     326                        cNotAliased- cUpdated, cUpdated, cNotAliased);
    325327                ulRc += 0x00010000;
    326328            }
     
    330332            fprintf(phLog, "-------------------------------------------------\n");
    331333            fprintf(phLog, "-------------------------------------------------\n\n");
    332             fprintf(phLog,"Number of function in this DLL:        %4ld (%ld)\n", ul1, ul0);
    333             fprintf(phLog,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), ul2);
     334            fprintf(phLog,"Number of function in this DLL:        %4ld (%ld)\n", cAll, cNotAliased);
     335            fprintf(phLog,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated);
    334336        }
    335337        fprintf(phLog,"Number of signals:                     %4ld\n", (long)(ulRc >> 16));
     
    344346        if (!options.fIntegrityOnly)
    345347        {
    346             fprintf(stdout,"Number of function in this DLL:        %4ld (%ld)\n", ul1, ul0);
    347             fprintf(stdout,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), ul2);
     348            fprintf(stdout,"Number of function in this DLL:        %4ld (%ld)\n", cAll, cNotAliased);
     349            fprintf(stdout,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated);
    348350        }
    349351        fprintf(stdout,"Number of signals:                     %4ld\n", (long)(ulRc >> 16));
     
    657659    char *  psz, *psz2;
    658660    const char *    pszDBFilename;
    659     char *          pszLastDateTime;
    660     char *          pszRevision;
    661     char *          pszAuthor;
    662     signed long     lLastAuthor;
     661    char *          pszLastDateTime = NULL;
     662    char *          pszRevision     = NULL;
     663    char *          pszAuthor       = NULL;
     664    signed long     lLastAuthor     = 0;
     665    unsigned long   ulRc            = 0;
    663666
    664667    /*
     
    689692    {   /* found $Id: */
    690693        psz2 = strchr(psz+3, '$');
    691         strncpy(&szId[0], psz, psz2 - psz);
    692         szId[psz2 - psz] = '\0';
    693         iRet = i;
    694 
    695         /* parse it! */
    696         psz = strstr(szId+4, ",v ");
    697         if (psz == NULL)
    698         {
    699             fprintf(phSignal, "%s, module header: $Id keyword is incorrect (or the parsing code is broken).\n", pszFilename);
    700             return 0x00010000;
    701         }
    702         pszRevision = trim(psz + 3);
    703         psz = strchr(pszRevision, ' ');
    704         *psz++ = '\0';
    705         trimR(pszRevision);
    706 
    707         pszLastDateTime = trim(psz);
    708         psz = strchr(strchr(pszLastDateTime, ' ') + 1, ' ');
    709         *psz++ = '\0';
    710         pszLastDateTime[4] = pszLastDateTime[7] = '-';
    711         trimR(pszLastDateTime);
    712 
    713         pszAuthor = trim(psz);
    714         psz = strchr(pszAuthor, ' ');
    715         *psz = '\0';
    716         lLastAuthor = dbFindAuthor(pszAuthor, NULL);
    717 
    718         /*
    719          * Is there more stuff here, in this comment?
    720          * Skip to end of the current comment and copy the contents to szDescription.
    721          * if szDescription suddenly contains nothing.
    722          */
    723         psz = &szDescription[0];
    724         copyComment(psz, psz2+1, i, papszLines, TRUE);
    725         while (*psz == '\n' && *psz == ' ')
    726             psz++;
    727         if (*psz == '\0')
    728         {   /*
    729              * No description in the first comment. (The one with $Id.)
    730              * Is there a comment following the first one?
     694        if (psz2 != NULL && psz2 - psz > 39 && psz2 - psz < 256)
     695        {
     696            strncpy(&szId[0], psz, psz2 - psz);
     697            szId[psz2 - psz] = '\0';
     698            iRet = i;
     699   
     700            /* parse it! */
     701            psz = strstr(szId+4, ",v ");
     702            if (psz != NULL)
     703            {
     704                pszRevision = trim(psz + 3);
     705                psz = strchr(pszRevision, ' ');
     706                *psz++ = '\0';
     707                trimR(pszRevision);
     708
     709                pszLastDateTime = trim(psz);
     710                psz = strchr(strchr(pszLastDateTime, ' ') + 1, ' ');
     711                *psz++ = '\0';
     712                pszLastDateTime[4] = pszLastDateTime[7] = '-';
     713                trimR(pszLastDateTime);
     714
     715                pszAuthor = trim(psz);
     716                psz = strchr(pszAuthor, ' ');
     717                *psz = '\0';
     718                lLastAuthor = dbFindAuthor(pszAuthor, NULL);
     719            }
     720            else
     721            {
     722                fprintf(phSignal, "%s, module header: $Id keyword is incorrect (2).\n", pszFilename);
     723                ulRc += 0x00010000;
     724            }
     725
     726
     727            /*
     728             * Is there more stuff here, in this comment?
     729             * Skip to end of the current comment and copy the contents to szDescription.
     730             * if szDescription suddenly contains nothing.
    731731             */
    732             while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL)
    733                 i = i;
    734             while (papszLines[i] != NULL)
    735             {
    736                 psz2 = papszLines[i];
    737                 while (*psz2 == ' ')
    738                     psz2++;
    739                 if (*psz2 != '\0')
    740                     break;
    741                 i++;
    742             }
    743             if (psz2 != NULL && strncmp(psz2, "/*", 2) == 0)
    744             {
    745                 psz = &szDescription[0];
    746                 copyComment(psz, psz2+1, i, papszLines, TRUE);
    747                 while (*psz == '\n' && *psz == ' ')
    748                     psz++;
    749                 if (psz == '\0')
    750                     szDescription[0] = '\0';
    751 
     732            psz = &szDescription[0];
     733            copyComment(psz, psz2+1, i, papszLines, TRUE, TRUE);
     734            if (*psz == '\0')
     735            {   /*
     736                 * No description in the first comment. (The one with $Id.)
     737                 * Is there a comment following the first one?
     738                 */
     739                while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL)
     740                    i = i;
     741                while (papszLines[i] != NULL)
     742                {
     743                    psz2 = papszLines[i];
     744                    while (*psz2 == ' ')
     745                        psz2++;
     746                    if (*psz2 != '\0')
     747                        break;
     748                    i++;
     749                }
     750                if (psz2 != NULL && strncmp(psz2, "/*", 2) == 0)
     751                {
     752                    psz = &szDescription[0];
     753                    copyComment(psz, psz2+1, i, papszLines, TRUE, TRUE);
     754                    while (*psz == '\n' && *psz == ' ')
     755                        psz++;
     756                    if (psz == '\0')
     757                        szDescription[0] = '\0';
     758
     759                    /* Skip to line after comment end. */
     760                    while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL)
     761                        i = i;
     762                }
     763            }
     764            else
     765            {
    752766                /* Skip to line after comment end. */
    753767                while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL)
     
    757771        else
    758772        {
    759             /* Skip to line after comment end. */
    760             while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL)
    761                 i = i;
     773            fprintf(phSignal, "%s, module header: $Id keyword is incorrect (1).\n", pszFilename);
     774            ulRc += 0x00010000;
    762775        }
    763776        iRet = i;
     777
    764778
    765779        /*
     
    774788             */
    775789            pOptions->lFileRefcode = dbFindFile(pOptions->lDllRefcode, pszDBFilename);
    776             if (pOptions->lFileRefcode <= 0)
     790            if (pOptions->lFileRefcode < 0)
    777791            {
    778792                fprintf(phSignal, "%s, module header: failed to find file in DB. %s\n",
     
    836850        }
    837851        else
    838             copyComment(&szBuffer[0], 0, i+1, papszLines, TRUE);
     852            copyComment(&szBuffer[0], 0, i+1, papszLines, TRUE, TRUE);
    839853
    840854        /* Update database */
     
    15641578                /* find parameter */
    15651579                for (j = 0; j < pFnDesc->cParams; j++)
    1566                     if (strcmp(pFnDesc->apszParamName[j], pszParam) != 0)
     1580                    if (strcmp(pFnDesc->apszParamName[j], pszParam) == 0)
    15671581                        break;
    15681582                if (j < pFnDesc->cParams)
     
    25322546 *
    25332547 */
    2534 static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip)
    2535 {
    2536     copyComment(psz, pszFrom - papszLines[iFrom], iFrom, papszLines, fStrip);
     2548static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML)
     2549{
     2550    copyComment(psz, pszFrom - papszLines[iFrom], iFrom, papszLines, fStrip, fHTML);
    25372551}
    25382552
     
    25492563 * @param       papszLines  Array of lines.
    25502564 * @param       fStrip      Strip blank lines at start and end + LICENCE notice (at end).
     2565 * @param       fHTML       Convert to HTML while copying.
    25512566 * @status      completely implemented.
    25522567 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    25532568 */
    2554 static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip)
     2569static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML)
    25552570{
    25562571    char *  pszStartBuffer = psz;       /* Start of the target buffer. */
     
    25872602                psz = pszStart;
    25882603            if (psz > pszStartBuffer || !fStrip)
     2604            {
     2605                if (fHTML)
     2606                {
     2607                    *psz++ = '<';
     2608                    *psz++ = 'B';
     2609                    *psz++ = 'R';
     2610                    *psz++ = '>';
     2611                }
    25892612                *psz++ = '\n';
     2613            }
    25902614
    25912615            /* next */
     
    26032627    if (fStrip)
    26042628    {
     2629        if (fHTML)
     2630        {
     2631            while (psz >= pszStartBuffer)
     2632            {
     2633                if (*psz == ' ' || *psz == '\n' || *psz == '\0')
     2634                    *psz-- = '\0';
     2635                else if (psz - 4 >= pszStartBuffer && strncmp(psz - 4, "<BR>", 4) == 0)
     2636                    *(psz -= 4) = '\0';
     2637                else
     2638                    break;
     2639            }
     2640        }
    26052641        while (psz >= pszStartBuffer && (*psz == ' ' || *psz == '\n' || *psz == '\0'))
    26062642            *psz-- = '\0';
    26072643
     2644
    26082645        if (psz - 20 > pszStartBuffer && strstr(psz - 20, "LICENSE.TXT") != NULL)
    26092646        {
     
    26122649        }
    26132650
     2651        if (fHTML)
     2652        {
     2653            while (psz >= pszStartBuffer)
     2654            {
     2655                if (*psz == ' ' || *psz == '\n' || *psz == '\0')
     2656                    *psz-- = '\0';
     2657                else if (psz - 4 >= pszStartBuffer && strncmp(psz - 4, "<BR>", 4) == 0)
     2658                    *(psz -= 4) = '\0';
     2659                else
     2660                    break;
     2661            }
     2662        }
    26142663        while (psz >= pszStartBuffer && (*psz == ' ' || *psz == '\n' || *psz == '\0'))
    26152664            *psz-- = '\0';
Note: See TracChangeset for help on using the changeset viewer.