Changeset 2776 for trunk/tools/database


Ignore:
Timestamp:
Feb 14, 2000, 6:18:31 PM (26 years ago)
Author:
bird
Message:

Bugfixes. Nearly there now!

Location:
trunk/tools/database
Files:
2 edited

Legend:

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

    r2773 r2776  
    1 /* $Id: StateUpd.cpp,v 1.12 2000-02-14 13:49:13 bird Exp $
     1/* $Id: StateUpd.cpp,v 1.13 2000-02-14 17:18:31 bird Exp $
    22 *
    33 * StateUpd - Scans source files for API functions and imports data on them.
     
    7070    unsigned long  ulRc = 0;
    7171    char           szDLLName[64];
    72     OPTIONS        options = {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, &szDLLName[0], -1};
     72    OPTIONS        options = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, &szDLLName[0], -1};
    7373    unsigned long  ulRc2;
    7474    char          *pszErrorDesc = NULL;
     
    233233
    234234        /* check db integrity */
    235         if (options.fIntegrityBefore)
     235        if (options.fIntegrityBefore || options.fIntegrityOnly)
    236236        {
    237237            pszErrorDesc = (char*)malloc(1048768); assert(pszErrorDesc != NULL);
     
    331331           "\n"
    332332           "    -h or -?      Syntax help. (this)\n"
    333            "    -ib<[+]|->    Integrity check at start.     default: enabled\n"
    334            "    -ie<[+]|->    Integrity check at end.       default: enabled\n"
     333           "    -ib<[+]|->    Integrity check at start.     default: disabled\n"
     334           "    -ie<[+]|->    Integrity check at end.       default: disabled\n"
    335335           "    -io           Integrity check only.         default: disabled\n"
    336336           "    -s            Scan subdirectories.          default: disabled\n"
     
    918918        if (strlen(pszEnd) > 128)
    919919        {
    920             fprintf(phSignal,"Fatal error! return statement is too larget. len=%d", strlen(pszEnd));
    921             fprintf(phLog,   "Fatal error! return statement is too larget. len=%d", strlen(pszEnd));
    922             fprintf(stderr,  "Fatal error! return statement is too larget. len=%d", strlen(pszEnd));
     920            /* FIXME LATER! Some constructors calling baseclass constructors "breaks" this rule. Win32MDIChildWindow in /src/user32/win32wmdichild.cpp for example. */
     921            fprintf(phSignal,"Fatal error? return statement is too larget. len=%d", strlen(pszEnd));
     922            fprintf(phLog,   "Fatal error? return statement is too larget. len=%d", strlen(pszEnd));
     923            if (strlen(pszEnd) > 512)
     924                fprintf(stderr,  "Fatal error? return statement is too larget. len=%d", strlen(pszEnd));
    923925            fflush(phLog);
    924926            fflush(phSignal);
     
    930932        *pszEnd = '\0';
    931933
     934        /* !BugFix! some function occur more than once, usually as inline functions */
     935        if (pFnDesc->pszReturnType != NULL
     936            && strstr(pFnDesc->pszReturnType, "inline ") != NULL)
     937        {
     938            fprintf(phLog, "Not an API. Inlined functions can't be exported!\n");
     939            return 0;
     940        }
     941
    932942        /* function name */
    933943        if (pFnDesc->pszReturnType != NULL
    934             && stristr(pFnDesc->pszReturnType, "cdecl") != NULL)
     944            && (stristr(pFnDesc->pszReturnType, "cdecl") != NULL
     945                || strstr(pFnDesc->pszReturnType, "VFWAPIV") != NULL
     946                || strstr(pFnDesc->pszReturnType, "WINAPIV") != NULL
     947                )
     948            )
    935949        {   /* cdecl function is prefixed with an '_' */
    936950            strcpy(pszEnd, "_");
     
    951965        for (j = 0; j < cArgs; j++)
    952966        {
     967            int cch = strlen(apszArgs[j]);
    953968            if ((psz = strchr(apszArgs[j], ')')) == NULL)
    954969            {   /* Common argument */
    955                 if (apszArgs[j][strlen(apszArgs[j]-1)] != '*')
    956                 {   /* Normal case, Type [moretype] Name.*/
    957                     pFnDesc->apszParamName[j] = findStartOfWord(apszArgs[j] + strlen(apszArgs[j]) - 1,
    958                                                             apszArgs[j]);
    959                     pFnDesc->apszParamName[j][-1] = '\0';
     970                if (apszArgs[j][cch-1] != '*' || (apszArgs[j][cch - 1] == ']' && cch < 5))
     971                {   /* nearly Normal case, Type [moretype] Name.*/
     972                    if (apszArgs[j][cch - 1] != ']')
     973                    {   /* Normal case! */
     974                        pFnDesc->apszParamName[j] = findStartOfWord(apszArgs[j] + cch - 1,
     975                                                                    apszArgs[j]);
     976                        pFnDesc->apszParamName[j][-1] = '\0';
     977                    }
     978                    else
     979                    {   /* arg yet another special case! 'fn(int argc, char *argv[])' */
     980                        char *pszP2;
     981                        cch = strlen(apszArgs[j]);
     982                        psz = &apszArgs[j][cch-2];
     983                        while (psz > apszArgs[j] && ((*psz >= '0' && *psz <= '9') || *psz == ' '))
     984                            psz--;
     985
     986                        if (psz > apszArgs[j] && *psz == '[')
     987                        {
     988                            pszP2 = psz--;
     989                            while (psz >= apszArgs[j] && *psz == ' ')
     990                                psz--;
     991                        }
     992
     993                        if (psz <= apszArgs[j])
     994                        {   /* funny case - no name? */
     995                            sprintf(pszEnd, "arg%i", j);
     996                            pFnDesc->apszParamName[j] = pszEnd;
     997                            pszEnd = strlen(pszEnd) + pszEnd + 1;
     998                            *pszEnd = '\0';
     999                        }
     1000                        else
     1001                        {   /* *pszP2 = '[' and psz = end of name */
     1002                            psz = findStartOfWord(psz, apszArgs[j]);
     1003                            strncat(pszEnd, psz, pszP2 - psz);
     1004                            pFnDesc->apszParamName[j] = pszEnd;
     1005                            pszEnd = strlen(pszEnd) + pszEnd + 1;
     1006                            *pszEnd = '\0';
     1007                            memset(psz, ' ', pszP2 - psz);
     1008                        }
     1009                    }
    9601010                }
    9611011                else
     
    10461096        j -= 2;
    10471097    fFound = 0;
    1048     while (iStart >= 0 &&
    1049            !(fFound = (papszLines[iStart][j] == '/' && papszLines[iStart][j+1] == '*')))
    1050         if (j-- == 0)
     1098    while (iStart >= 0
     1099           && (j < 0
     1100               || !(fFound = (papszLines[iStart][j] == '/' && papszLines[iStart][j+1] == '*'))
     1101               )
     1102           )
     1103        if (j-- <= 0)
    10511104            if (iStart-- > 0)
    10521105            {
     
    12891342
    12901343        while (*pszP1 != '\0' && *pszP1 == ' ')
    1291             pszP1--;
    1292         if (*pszP1 != '\0' && *pszP1 != '\\' && pszP1[1] != '\\'
     1344            pszP1++;
     1345        if (*pszP1 != '\0' && *pszP1 != '/' && pszP1[1] != '/'
    12931346            && *pszP1 != '{' && *pszP1 != '}')
    12941347        {
     
    15701623/**
    15711624 * Creates an array of lines from a "memory" file. The last entry in the array contains NULL.
     1625 * It also replaces '\t' with ' '.
    15721626 * @returns   Pointer to the array of lines.
    15731627 * @param     pszFile  Pointer to "memory" file.
     
    15991653        while (*psz != '\0')
    16001654        {
     1655            if (*psz == '\t')
     1656                *psz = ' ';
    16011657            if (*psz == '\r')
    16021658            {
     
    16381694
    16391695
    1640 /** staring char of word */
     1696/** starting char of word */
    16411697static char *findStartOfWord(char *psz, const char *pszStart)
    16421698{
  • trunk/tools/database/db.cpp

    r2773 r2776  
    1 /* $Id: db.cpp,v 1.9 2000-02-14 13:49:13 bird Exp $ *
     1/* $Id: db.cpp,v 1.10 2000-02-14 17:18:31 bird Exp $ *
    22 *
    33 * DB - contains all database routines.
     
    412412    MYSQL_ROW    row;
    413413    int          rc;
    414     char         szQuery[256];
     414    char         szQuery[1024];
    415415
    416416    /*
     
    449449            if (lDll >= 0 && pFnFindBuf->cFns != 0)
    450450            {
    451                 int cFnsThisDll, cFnsAliasesAndThisDll, i;
     451                int cFnsThisDll, cFnsAliasesAndThisDll, i, f;
    452452
    453453                /*
     
    547547                                         */
    548548                                        sprintf(&szQuery[0], "UPDATE function SET aliasfn = (-2) "
    549                                                              "WHERE (",
     549                                                             "WHERE refcode IN (",
    550550                                                lDll, pszFunctionName);
    551                                         for (i = 0; i < cFnsThisDll; i++)
    552                                         {
    553                                             if (i != 0) strcat(&szQuery[0], " OR");
    554                                             sprintf(&szQuery[strlen(szQuery)], " refcode = %ld", pFnFindBuf->alRefCode[i]);
    555                                         }
     551                                        for (f = 0, i = 0; i < cFnsThisDll; i++)
     552                                            if (pFnFindBuf->alAliasFn[i] != ALIAS_DONTMIND)
     553                                                sprintf(&szQuery[strlen(&szQuery[0])],
     554                                                        f++ != 0 ? ", %ld" : "%ld", pFnFindBuf->alRefCode[i]);
    556555                                        strcat(&szQuery[0], ") AND aliasfn <> (-2)");
    557 
    558                                         rc = mysql_query5(pmysql, &szQuery[0]);
     556                                        if (f > 0)
     557                                            rc = mysql_query5(pmysql, &szQuery[0]);
     558                                        else
     559                                            rc = 0;
    559560                                        if (rc >= 0 && cFnsAliasesAndThisDll < pFnFindBuf->cFns)
    560561                                        {
     
    566567                                                    pFnFindBuf->alRefCode[0]);
    567568                                            for (i = cFnsAliasesAndThisDll; i < pFnFindBuf->cFns; i++)
     569                                            {
    568570                                                sprintf(&szQuery[strlen(&szQuery[0])],
    569                                                         i > 0 ? ", %ld" : "%ld", pFnFindBuf->alRefCode[i]);
     571                                                        i > cFnsAliasesAndThisDll ? ", %ld" : "%ld", pFnFindBuf->alRefCode[i]);
     572                                            }
    570573                                            strcat(&szQuery[0], ")");
    571574                                            rc = mysql_query6(pmysql, &szQuery[0]);
     
    780783                    {
    781784                        sprintf(pszQuery, "UPDATE parameter SET type = '%s', name = '%s' "
    782                                 "WHERE function = (%ld) AND sequencenbr == (%ld)",
     785                                "WHERE function = (%ld) AND sequencenbr = (%ld)",
    783786                                pFnDesc->apszParamType[i] != NULL ? pFnDesc->apszParamType[i] : "",
    784787                                pFnDesc->apszParamName[i] != NULL ? pFnDesc->apszParamName[i] : "",
Note: See TracChangeset for help on using the changeset viewer.