Ignore:
Timestamp:
Feb 14, 2000, 2:49:14 PM (26 years ago)
Author:
bird
Message:

Optimizations and a couple of fixes.

File:
1 edited

Legend:

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

    r2770 r2773  
    1 /* $Id: StateUpd.cpp,v 1.11 2000-02-12 23:54:29 bird Exp $
     1/* $Id: StateUpd.cpp,v 1.12 2000-02-14 13:49:13 bird Exp $
    22 *
    33 * StateUpd - Scans source files for API functions and imports data on them.
     
    608608    {
    609609        unsigned long ulRcTmp;
    610         char szErrorDesc[2113]; /* due to some limitation in the latest EMX release size is 2112 and not 4096 as initially implemented. */
     610        //char szErrorDesc[2113]; /* due to some limitation in the latest EMX release size is 2112 and not 4096 as initially implemented. */
     611        char  *pszErrorDesc = (char*)malloc(20480);
    611612
    612613        /* 2.*/
     
    632633
    633634        /* 4.*/
    634         ulRcTmp = dbUpdateFunction(&FnDesc, pOptions->lDllRefcode, &szErrorDesc[0]);
     635        ulRcTmp = dbUpdateFunction(&FnDesc, pOptions->lDllRefcode, pszErrorDesc);
    635636        if (ulRcTmp != 0)
    636637        {
    637             fprintf(phSignal, "%s,%s: %s\n", pszFilename, FnDesc.pszName, &szErrorDesc[0]);
     638            fprintf(phSignal, "%s,%s: %s\n", pszFilename, FnDesc.pszName, pszErrorDesc);
    638639            ulRc += ulRcTmp << 16;
    639640        }
     641        free(pszErrorDesc);
    640642    }
    641643
     
    914916        *pszEnd = '\0';
    915917        copy(pszEnd, pszReturn, iReturn, pszFn-1, iFn, papszLines);
    916         if (strlen(pszEnd) > 1024)
     918        if (strlen(pszEnd) > 128)
    917919        {
    918920            fprintf(phSignal,"Fatal error! return statement is too larget. len=%d", strlen(pszEnd));
     
    950952        {
    951953            if ((psz = strchr(apszArgs[j], ')')) == NULL)
    952             {
    953                 pFnDesc->apszParamName[j] = findStartOfWord(apszArgs[j] + strlen(apszArgs[j]) - 1,
     954            {   /* 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,
    954958                                                            apszArgs[j]);
    955                 pFnDesc->apszParamName[j][-1] = '\0';
     959                    pFnDesc->apszParamName[j][-1] = '\0';
     960                }
     961                else
     962                {   /* No argument name only type - make a dummy one: 'arg[1..n]' */
     963                    sprintf(pszEnd, "arg%i", j);
     964                    pFnDesc->apszParamName[j] = pszEnd;
     965                    pszEnd = strlen(pszEnd) + pszEnd + 1;
     966                    *pszEnd = '\0';
     967                }
    956968                pFnDesc->apszParamType[j] = trim(apszArgs[j]);
    957969            }
    958970            else
    959             {
     971            {   /* Function pointer argument... */
    960972                char *pszP2 = psz;
    961973                psz = findStartOfWord(psz-1, apszArgs[j]);
     
    16431655
    16441656
     1657/**
     1658 * Trims a string, ie. removing spaces (and tabs) from both ends of the string.
     1659 * @returns   Pointer to first not space or tab char in the string.
     1660 * @param     psz   Pointer to the string which is to be trimmed.
     1661 * @status    completely implmented.
     1662 * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     1663 */
    16451664static char *trim(char *psz)
    16461665{
     
    16611680 *       ensuring space after '*', ensuring no space before ',' and ')'.
    16621681 */
    1663 
    16641682static void copy(char *psz, char *pszFrom, int iFrom, char *pszTo, int iTo, char **papszLines)
    16651683{
     
    17181736
    17191737#else
     1738/**
     1739 * Copies a set of lines to a buffer (psz) removing precompiler lines and all comments.
     1740 * @param     psz
     1741 * @param     jFrom       Starting position, index into line iFrom.
     1742 * @param     iFrom       Starting position, index into papszLines.
     1743 * @param     jTo         Ending position, index into line iFrom.
     1744 * @param     iTo         Ending position, index into papszLines.
     1745 * @param     papszLines  Array of lines.
     1746 * @status    completely implemented.
     1747 * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     1748 */
    17201749static void copy(char *psz, int jFrom, int iFrom, int jTo, int iTo, char **papszLines)
    17211750{
     
    17811810 * @param     ch  Char to capitalize.
    17821811 */
     1812#if 0
    17831813inline char upcase(char ch)
    17841814{
    17851815    return ch >= 'a' && ch <= 'z' ?  (char)(ch - ('a' - 'A')) : ch;
    17861816}
     1817#else
     1818#define  upcase(ch) ((ch) >= 'a' && (ch) <= 'z' ?  (char)((ch) - ('a' - 'A')) : (ch))
     1819#endif
    17871820
    17881821
Note: See TracChangeset for help on using the changeset viewer.