Changeset 6677 for trunk/tools/database


Ignore:
Timestamp:
Sep 7, 2001, 12:26:42 PM (24 years ago)
Author:
bird
Message:

dll to module conversion.

Location:
trunk/tools/database
Files:
10 edited

Legend:

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

    r6065 r6677  
    1 /* $Id: APIImport.cpp,v 1.10 2001-06-22 17:07:18 bird Exp $ */
     1/* $Id: APIImport.cpp,v 1.11 2001-09-07 10:24:05 bird Exp $ */
    22/*
    33 *
     
    9292                    break;
    9393
     94                case '-':
    9495                case 'h':
    9596                case 'H':
     
    257258            char    achDataBuffer[0x200];
    258259            char   *pszModuleName = &achDataBuffer[0];
    259             signed long  lDll;
     260            signed long  lModule;
    260261
    261262            /* try create file objects */
     
    286287
    287288                /* find or insert module name */
    288                 if ((lDll = dbCheckInsertDll(pszModuleName, DLL_ODIN32_API)) >= 0)
     289                if ((lModule = dbCheckInsertModule(pszModuleName, DLL_ODIN32_API)) >= 0)
    289290                {
    290291                    BOOL    fClearUpdateOk = FALSE;
     
    294295                    /* Clear the update flag for all functions in this DLL. */
    295296                    if (pOptions->fErase)
    296                         fClearUpdateOk = dbClearUpdateFlagFunction(lDll, FALSE);
     297                        fClearUpdateOk = dbClearUpdateFlagFunction(lModule, FALSE);
    297298
    298299                    lRc = 0;
     
    334335                            else
    335336                            {   /* Update Database */
    336                                 fOk = dbInsertUpdateFunction(lDll,
     337                                fOk = dbInsertUpdateFunction(lModule,
    337338                                                             &szName[0],
    338339                                                             &szIntName[0],
     
    358359                    /* Clear the update flag for all functions in this DLL. */
    359360                    if (fClearUpdateOk && pOptions->fErase)
    360                         if (!dbDeleteNotUpdatedFunctions(lDll, FALSE))
     361                        if (!dbDeleteNotUpdatedFunctions(lModule, FALSE))
    361362                        {
    362363                            fprintf(phLog, "%s: error - dbDeleteNotUpdatedFunctions failed.\n\terror description: %s\n",
  • trunk/tools/database/Codes.sql

    r3900 r6677  
    1 -- $Id: Codes.sql,v 1.1 2000-07-29 21:19:33 bird Exp $
     1-- $Id: Codes.sql,v 1.2 2001-09-07 10:24:05 bird Exp $
    22--
    33-- Codes.
     
    2828    VALUES ('FTYP', 'I   ', 'Internal Odin32 API');
    2929INSERT INTO code
    30     VALUES ('FTYP', 'O   ', 'Other function');
     30    VALUES ('FTYP', 'F   ', 'Some Function');
    3131
     32INSERT INTO code
     33    VALUES ('FTYP', 'M   ', 'Class public method');
     34INSERT INTO code
     35    VALUES ('FTYP', 'O   ', 'Class operator');
     36INSERT INTO code
     37    VALUES ('FTYP', 'C   ', 'Class constructor');
     38INSERT INTO code
     39    VALUES ('FTYP', 'D   ', 'Class donstructor');
    3240
  • trunk/tools/database/CreateTables.sql

    r6663 r6677  
    1 -- $Id: CreateTables.sql,v 1.18 2001-09-06 03:07:31 bird Exp $
     1-- $Id: CreateTables.sql,v 1.19 2001-09-07 10:24:06 bird Exp $
    22--
    33-- Create all tables.
     
    5555--
    5656CREATE TABLE state (
    57     refcode TINYINT NOT NULL PRIMARY KEY,
    58     color   CHAR(7) NOT NULL,
    59     weight  TINYINT NOT NULL,
    60     name    VARCHAR(32) NOT NULL,
     57    refcode     TINYINT NOT NULL PRIMARY KEY,
     58    color       CHAR(7) NOT NULL,
     59    weight      TINYINT NOT NULL,
     60    name        VARCHAR(32) NOT NULL,
    6161    description TEXT NOT NULL,
    6262    UNIQUE u1(refcode),
     
    6767
    6868--
    69 -- This table holds the dll names.
     69-- This table holds the module names.
    7070--    Type has these known types:
    7171--       'A' for Odin32 API dll
     
    7474--       'T' for tools (executables and dlls)
    7575--
    76 CREATE TABLE dll (
    77     refcode     TINYINT       NOT NULL AUTO_INCREMENT PRIMARY KEY,
     76CREATE TABLE module (
     77    refcode     SMALLINT      NOT NULL AUTO_INCREMENT PRIMARY KEY,
    7878    name        VARCHAR(32)   NOT NULL,
    7979    type        CHAR          NOT NULL DEFAULT 'A',
     
    8585
    8686--
    87 -- This table holds fileinformation (per dll).
     87-- This table holds fileinformation (per module).
    8888--
    8989CREATE TABLE file (
    9090    refcode         INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    91     dll             TINYINT NOT NULL,
     91    module          SMALLINT NOT NULL,
    9292    name            VARCHAR(128) NOT NULL,
    9393    lastdatetime    DATETIME NOT NULL,
     
    9797    description     TEXT,
    9898    UNIQUE u1(refcode),
    99     UNIQUE u2(dll, name),
     99    UNIQUE u2(module, name),
    100100    INDEX  i1(name)
    101101);
     
    112112CREATE TABLE designnote (
    113113    refcode     INTEGER NOT NULL AUTO_INCREMENT,
    114     dll         TINYINT NOT NULL,
     114    module      SMALLINT NOT NULL,
    115115    file        INTEGER NOT NULL,
    116116    line        INTEGER  NOT NULL DEFAULT -1,
     
    123123    UNIQUE      u1(refcode, seqnbrnote),
    124124    UNIQUE      u2(refcode, seqnbrnote, level),
    125     UNIQUE      u3(dll, seqnbr, level, seqnbrnote, refcode),
     125    UNIQUE      u3(module, seqnbr, level, seqnbrnote, refcode),
    126126    INDEX       i1(file, refcode)
    127127);
     
    129129
    130130--
    131 -- This table holds API information (per dll / file).
     131-- This table holds API information (per module / file).
    132132--
    133133-- Type has these known values:
    134134--       'A' for API
    135135--       'I' for Internal Odin32 API
     136--       'F' for All other functions.
     137---
     138--       'M' for Class method (?)
     139--       'O' for Class operator (?)
     140--       'C' for Class constructor (?)
     141--       'D' for Class destructor (?)
    136142--
    137143CREATE TABLE function (
    138144    refcode  INTEGER  NOT NULL AUTO_INCREMENT PRIMARY KEY,
    139     dll      TINYINT NOT NULL,
     145    module   SMALLINT NOT NULL,
    140146    aliasfn  INTEGER  NOT NULL DEFAULT -1,
    141147    file     INTEGER  NOT NULL DEFAULT -1,
     
    156162    time        TEXT,
    157163    UNIQUE i1(refcode, aliasfn),
    158     UNIQUE i1a(dll, aliasfn, refcode),
    159     UNIQUE i1b(aliasfn, name, dll),
    160     UNIQUE i1c(aliasfn, intname, dll, refcode),
    161     UNIQUE i2(name, dll, refcode),
    162     UNIQUE i3(intname, dll, refcode),
    163     INDEX  i4(dll, file),
     164    UNIQUE i1a(module, aliasfn, refcode),
     165    UNIQUE i1b(aliasfn, name, module, refcode),
     166    UNIQUE i1c(aliasfn, intname, module, refcode),
     167    UNIQUE i2(name, module, refcode),
     168    UNIQUE i3(intname, module, refcode),
     169    INDEX  i4(module, file),
    164170    INDEX  i5(file, refcode),
    165171    INDEX  i6(state, file),
    166172    UNIQUE i7(state, refcode),
    167173    UNIQUE i8(refcode, state),
    168     UNIQUE i9(dll, state, refcode),
    169     UNIQUE u1(refcode),
    170     UNIQUE u2(name, dll),
     174    UNIQUE i9(module, state, refcode),
     175    UNIQUE u1(refcode),
     176    UNIQUE u2(name, module, refcode),
    171177    UNIQUE u3(type, refcode)
    172178);
     
    177183--
    178184CREATE TABLE parameter (
    179     function INTEGER NOT NULL,
     185    function    INTEGER NOT NULL,
    180186    sequencenbr TINYINT NOT NULL,
    181     name     VARCHAR(64) NOT NULL,
    182     type     VARCHAR(64) NOT NULL,
     187    name        VARCHAR(64) NOT NULL,
     188    type        VARCHAR(64) NOT NULL,
    183189    description TEXT,
    184190    INDEX  i1(function, name),
     
    191197--
    192198CREATE TABLE fnauthor (
    193     author   SMALLINT NOT NULL,
    194     function INTEGER NOT NULL,
     199    author      SMALLINT NOT NULL,
     200    function    INTEGER NOT NULL,
    195201    UNIQUE u1(author, function),
    196202    UNIQUE u2(function, author)
     
    202208--
    203209CREATE TABLE apigroup (
    204     refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    205     dll     TINYINT NOT NULL,
    206     name    VARCHAR(64) NOT NULL,
     210    refcode     SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     211    module      SMALLINT NOT NULL,
     212    name        VARCHAR(64) NOT NULL,
    207213    description VARCHAR(128),
    208214    UNIQUE u1(refcode),
     
    219225
    220226--
    221 -- Status history for dlls.
    222 --
    223 CREATE TABLE historydll (
    224     dll TINYINT NOT NULL,
    225     state SMALLINT NOT NULL,
    226     date  DATE NOT NULL,
    227     count SMALLINT NOT NULL,
    228     UNIQUE u1(dll, state, date)
     227-- Status history for modules.
     228--
     229CREATE TABLE historymodule (
     230    module      SMALLINT NOT NULL,
     231    state       SMALLINT NOT NULL,
     232    date        DATE     NOT NULL,
     233    count       SMALLINT NOT NULL,
     234    TYPE        CHAR     NOT NULL DEFAULT 'A',
     235    UNIQUE u1(module, state, date)
    229236);
    230237
     
    234241--
    235242CREATE TABLE historyapigroup (
    236     apigroup SMALLINT NOT NULL,
    237     state SMALLINT NOT NULL,
    238     date  DATE NOT NULL,
    239     count SMALLINT NOT NULL,
     243    apigroup    SMALLINT NOT NULL,
     244    state       SMALLINT NOT NULL,
     245    date        DATE    NOT NULL,
     246    count       SMALLINT NOT NULL,
    240247    UNIQUE u1(apigroup, state, date)
    241248);
     
    243250
    244251--
    245 -- Dll API count history.
    246 --
    247 CREATE TABLE historydlltotal (
    248     dll SMALLINT NOT NULL,
    249     date DATE NOT NULL,
    250     totalcount SMALLINT NOT NULL,
    251     UNIQUE u1(dll, DATE)
     252-- Module API count history.
     253--
     254CREATE TABLE historymoduletotal (
     255    module      SMALLINT NOT NULL,
     256    date        DATE     NOT NULL,
     257    totalcount  SMALLINT NOT NULL,
     258    type        CHAR     NOT NULL DEFAULT 'A',
     259    UNIQUE u1(module, DATE)
    252260);
    253261
     
    257265--
    258266CREATE TABLE historyapigrouptotal (
    259     apigroup SMALLINT NOT NULL,
    260     date DATE NOT NULL,
    261     totalcount SMALLINT NOT NULL,
     267    apigroup    SMALLINT NOT NULL,
     268    date        DATE    NOT NULL,
     269    totalcount  SMALLINT NOT NULL,
    262270    UNIQUE u1(apigroup, date)
    263271);
     
    314322
    315323--
    316 -- This table relates a tgroup with a dll.
    317 --
    318 CREATE TABLE tgroupdll (
     324-- This table relates a tgroup with a module.
     325--
     326CREATE TABLE tgroupmodule (
    319327    tgroup      SMALLINT NOT NULL,
    320     dll         TINYINT NOT NULL,
    321     UNIQUE u1(tgroup, dll)
     328    module      SMALLINT NOT NULL,
     329    UNIQUE u1(tgroup, module)
    322330);
    323331
  • trunk/tools/database/Makefile

    r5530 r6677  
    1 # $Id: Makefile,v 1.17 2001-04-17 00:24:09 bird Exp $
     1# $Id: Makefile,v 1.18 2001-09-07 10:24:06 bird Exp $
    22
    33#
     
    3535   mysqladmin DROP Odin32
    3636   mysql < CreateTables.sql
    37    mysql < States.sql
    38    mysql < Authors.sql
     37   mysql $@ < States.sql
     38   mysql $@ < Authors.sql
     39   mysql $@ < Codes.sql
    3940   -mysqladmin refresh
    4041
  • trunk/tools/database/StateUpd.cpp

    r6665 r6677  
    1 /* $Id: StateUpd.cpp,v 1.37 2001-09-06 03:17:37 bird Exp $
     1/* $Id: StateUpd.cpp,v 1.38 2001-09-07 10:24:06 bird Exp $
    22 *
    33 * StateUpd - Scans source files for API functions and imports data on them.
     
    88
    99/*******************************************************************************
    10 *   Header Files                                                               *
     10*   Defined Constants And Macros                                               *
    1111*******************************************************************************/
     12#define DEBUGLOG    1                   /* enables debug logging. */
     13#ifdef DEBUGLOG
     14#define logprintf(a) fprintf a
     15#else
     16#define logprintf(a) ((int)0)
     17#endif
     18
    1219#define INCL_DOSFILEMGR
    1320#define INCL_DOSERRORS
    1421#define INCL_DOSMISC
    1522#define INCL_DOSPROCESS
     23
     24
     25/*******************************************************************************
     26*   Header Files                                                               *
     27*******************************************************************************/
    1628#include <os2.h>
    1729#include <malloc.h>
     
    2436#include "db.h"
    2537
    26 
    27 
    2838/*******************************************************************************
    2939*   Global Variables                                                           *
    3040*******************************************************************************/
     41#ifdef DEBUGLOG
    3142static FILE  *phLog = NULL;
     43#endif
    3244static FILE  *phSignal = NULL;
    3345
     
    4658static void closeLogs(void);
    4759static unsigned long processDir(const char *pszDirOrFile, POPTIONS pOptions);
    48 static unsigned long processFile(const char *pszFilename, POPTIONS pOptions);
    49 static unsigned long processModuleHeader(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
     60static unsigned long processFile(const char *pszFilename, POPTIONS pOptions, BOOL fHeader);
     61static unsigned long processFileHeader(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
    5062static unsigned long processDesignNote(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
    51 static unsigned long processAPI(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
     63static unsigned long processFunction(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
    5264static unsigned long analyseFnHdr(PFNDESC pFnDesc, char **papszLines, int i, const char *pszFilename, POPTIONS pOptions);
    5365static unsigned long analyseFnDcl(PFNDESC pFnDesc, char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
    5466static unsigned long analyseFnDcl2(PFNDESC pFnDesc, char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
     67static void  logFunction(PFNDESC pFnDesc);
     68static char *ResolvSourceFile(char *pszFileObj, char **papszDirs);
    5569static char *SDSCopyTextUntilNextTag(char *pszTarget, BOOL fHTML, int iStart, int iEnd, char **papszLines, const char *pszStart = NULL);
    5670static char *CommonCopyTextUntilNextTag(char *pszTarget, BOOL fHTML, int iStart, int iEnd, char **papszLines, const char *pszStart = NULL);
    5771static BOOL  isFunction(char **papszLines, int i, POPTIONS pOptions);
    5872static BOOL  isDesignNote(char **papszLines, int i, POPTIONS pOptions);
     73static BOOL  isClass(char **papszLines, int i, POPTIONS pOptions);
    5974static long _System dbNotUpdatedCallBack(const char *pszValue, const char *pszFieldName, void *pvUser);
    6075static char *skipInsignificantChars(char **papszLines, int &i, char *psz);
     
    7489static char *skipBackwards(const char *pszStopAt, const char *pszFrom, int &iLine, char **papszLines);
    7590static int   findStrLine(const char *psz, int iStart, int iEnd, char **papszLines);
     91static void *textbufferCreate(const char *pszFilename);
     92static char *textbufferGetNextLine(void *pvBuffer, void **ppv, char *pszLineBuffer, int cchLineBuffer);
     93static char *textbufferNextLine(void *pvBuffer, register char *psz);
     94static void  textbufferDestroy(void *pvBuffer);
     95static signed long fsize(FILE *phFile);
     96static char *fileNameNoExt(const char *pszFilename, char *pszBuffer);
    7697
    7798
     
    87108    BOOL           fFatal = FALSE;
    88109    unsigned long  ulRc = 0;
    89     char           szDLLName[64];
    90     OPTIONS        options = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, &szDLLName[0], -1};
     110    char           szModName[64];
     111    char *         apszDirs[2] = {".", NULL};
     112    OPTIONS        options =
     113    {   FALSE,                          /* fIntegrityBefore  */
     114        FALSE,                          /* fIntegrityAfter;  */
     115        FALSE,                          /* fIntegrityOnly;   */
     116        FALSE,                          /* fRecursive;       */
     117        FALSE,                          /* fOld;             */
     118        FALSE,                          /* fOS2;             */
     119        FALSE,                          /* fCOMCTL32;        */
     120        FALSE,                          /* fVERSION;         */
     121        &szModName[0],                  /* pszModName;       */
     122        ' ',                            /* chModType;        */
     123        -1,                             /* lModRefcode;      */
     124        -1,                             /* lFileRefcode;     */
     125        &apszDirs[0]                    /* apszDirs;         */
     126    };
    91127    unsigned long  ulRc2;
    92128    char          *pszErrorDesc = NULL;
     
    101137    /*DosSetPriority(PRTYS_PROCESSTREE, PRTYC_REGULAR, 1, 0);*/
    102138
    103     /* get dll name from directory */
     139    /* get module name from directory */
    104140    ul1 = ul2 = 0;
    105141    DosQueryCurrentDisk(&ul1, &ul2);
    106     ul2 = sizeof(szDLLName);
    107     DosQueryCurrentDir(ul1, &szDLLName[0], &ul2);
     142    ul2 = sizeof(szModName);
     143    DosQueryCurrentDir(ul1, &szModName[0], &ul2);
    108144    if (ul2 != 0)
    109145    {
    110         if (szDLLName[ul2-1] == '\\' || szDLLName[ul2-1] == '/')
    111             szDLLName[--ul2] = '\0';
     146        if (szModName[ul2-1] == '\\' || szModName[ul2-1] == '/')
     147            szModName[--ul2] = '\0';
    112148        ul1 = ul2;
    113         while (ul1 != 0 && szDLLName[ul1-1] != '\\' && szDLLName[ul1-1] != '/')
     149        while (ul1 != 0 && szModName[ul1-1] != '\\' && szModName[ul1-1] != '/')
    114150            ul1--;
    115151        if (ul1 != 0)
    116             options.pszDLLName = &szDLLName[ul1];
     152            options.pszModName = &szModName[ul1];
    117153    }
    118154    else
    119         szDLLName[0] = '\0';
     155        szModName[0] = '\0';
    120156
    121157
     
    127163    *           -io              Integrity check only.
    128164    *           -s               Scan subdirectories.
    129     *           -Old <[+]|->     Old API Style.
    130165    *           -OS2<[+]|->      Removes 'OS2'-prefix from function name.
    131166    *           -COMCTL32<[+]|-> Removes 'COMCTL32'-prefix from function name.
    132167    *           -VERSION<[+]|->  Removes 'VERSION'-prefix from function name.
    133     *           -Dll:<dllname>   Name of the dll being processed.
     168    *           -Mod:<modname>   Name of the module being processed.
     169    *           -Type:<modtype>  Module type. default API or whatever is in DB.
    134170    *           -d:<dbname>      Database name
    135171    *           -p:<passwd>      Password
     
    147183                case 'D':
    148184                    if (strnicmp(&argv[argi][1], "dll:", 4) == 0 )
    149                         options.pszDLLName = &argv[argi][5];
     185                        options.pszModName = &argv[argi][5];
    150186                    else
    151187                    {
     
    157193                    break;
    158194
     195                case '-':
    159196                case 'h':
    160197                case 'H':
     
    192229                    }
    193230                    break;
     231
     232                case 'm':
     233                case 'M':
     234                    if (strchr(&argv[argi][1], ':'))
     235                        options.pszModName = strchr(&argv[argi][1], ':') + 1;
     236                    else
     237                    {
     238                        fFatal = TRUE;
     239                        fprintf(stderr, "warning: option '-mod:' requires a module name.\n");
     240                    }
     241                    break;
     242
    194243
    195244                case 'o':
     
    217266                case 'S':
    218267                    options.fRecursive = TRUE;
    219                     fprintf(stderr, "Warning: -s processes subdirs of source for one DLL\n");
     268                    fprintf(stderr, "Warning: -s processes subdirs of source for one module\n");
    220269                    break;
    221270
     
    228277                    break;
    229278
     279                case 't':
     280                case 'T':
     281                    if (strchr(&argv[argi][1], ':'))
     282                    {
     283                        char ch = *(strchr(&argv[argi][1], ':') + 1);
     284                        if (strchr("AIST", ch))
     285                            options.chModType = ch;
     286                        else
     287                        {
     288                            fFatal = TRUE;
     289                            fprintf(stderr, "warning: option '-type:' requires type char.\n");
     290                        }
     291                    }
     292                    else
     293                    {
     294                        fFatal = TRUE;
     295                        fprintf(stderr, "warning: option '-type:' requires type char.\n");
     296                    }
     297                    break;
     298
    230299                default:
    231300                    fprintf(stderr, "incorrect parameter. (argi=%d, argv[argi]=%s)\n", argi, argv[argi]);
     
    234303            }
    235304        }
     305        else if (argv[argi][0] == '@')
     306        {   /*
     307             * Parameter file (debugger parameter length restrictions led to this):
     308             *    Create a textbuffer.
     309             *    Parse the file and create a new parameter vector.
     310             *    Set argv to the new parameter vector, argi to 0 and argc to
     311             *    the parameter count.
     312             *    Restrictions: Parameters enclosed in "" is not implemented.
     313             *                  No commandline parameters are processed after the @file
     314             */
     315            char *pszBuffer = (char*)textbufferCreate(&argv[argi][1]); /* !ASSUMS! that pvBuffer is the file string! */
     316            if (pszBuffer != NULL)
     317            {
     318                char **apszArgs = NULL;
     319                char *psz = pszBuffer;
     320                int  i = 0;
     321
     322                while (*psz != '\0')
     323                {
     324                    /* find end of parameter word */
     325                    char *pszEnd = psz + 1;
     326                    char  ch = *pszEnd;
     327                    while (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != '\0')
     328                        ch = *++pszEnd;
     329
     330                    /* allocate more arg array space? */
     331                    if ((i % 512) == 0)
     332                    {
     333                        apszArgs = (char**)realloc(apszArgs, sizeof(char*) * (514 + i));
     334                        if (apszArgs == NULL)
     335                        {
     336                            fprintf(stderr, "error: out of memory. (line=%d)\n", __LINE__);
     337                            return -8;
     338                        }
     339                    }
     340                    *pszEnd = '\0';
     341                    apszArgs[i++] = psz;
     342
     343                    /* next */
     344                    psz = pszEnd + 1;
     345                    ch = *psz;
     346                    while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
     347                        ch = *++psz;
     348                }
     349
     350                argc = i;
     351                argi = 0;
     352                argv = apszArgs;
     353                apszArgs[argc] = NULL;
     354                continue;
     355            }
     356            else
     357            {
     358                fprintf(stderr, "error: could not open parameter file\n");
     359                return -1;
     360            }
     361            break;
     362        }
    236363        else
    237364            break; /* files has started */
     
    266393        }
    267394
     395
    268396        if (!options.fIntegrityOnly)
    269397        {
    270             /* find dll */
    271             options.lDllRefcode = dbGetDll(options.pszDLLName);
    272             fprintf(phLog, "DLL: refcode=%d, name=%s\n", options.lDllRefcode, options.pszDLLName);
    273             if (options.lDllRefcode >= 0)
     398            /* add/update module */
     399            if (options.chModType != ' ' && options.pszModName)
     400                dbCheckInsertModule(options.pszModName, options.chModType);
     401
     402            /* find module */
     403            options.lModRefcode = dbGetModule(options.pszModName);
     404            logprintf((phLog, "Module: refcode=%d, name=%s\n", options.lModRefcode, options.pszModName));
     405            if (options.lModRefcode >= 0)
    274406            {
    275407                /* processing */
     
    277409                    ulRc = processDir(".", &options);
    278410                else
    279                     while (argv[argi] != NULL)
     411                    while (argi < argc)
    280412                    {
    281                         ulRc += processDir(argv[argi], &options);
     413                        char *  pszDirOrFile = argv[argi];
     414                        int     cchDirOrFile = strlen(pszDirOrFile);
     415
     416                        if (cchDirOrFile > 4 && !stricmp(pszDirOrFile + cchDirOrFile - 4, ".obj") ) /* check for .obj */
     417                        {
     418                            pszDirOrFile = ResolvSourceFile(pszDirOrFile, options.papszDirs);
     419                            if (!pszDirOrFile)
     420                            {
     421                                /*
     422                                 * Ignore dllentry.
     423                                 */
     424                                if (!stristr(argv[argi], "dllentry"))
     425                                {
     426                                    fprintf(phSignal, "%s: Failed to resolve source file\n", argv[argi]);
     427                                    ulRc += 0x00010000;
     428                                }
     429                                argi++;
     430                                break;
     431                            }
     432                        }
     433                        ulRc += processDir(pszDirOrFile, &options);
    282434                        argi++;
    283435                    }
     
    309461            }
    310462            else
    311             {   /* failed to find dll - concidered nearly fatal. */
    312                 fprintf(phSignal, "-,-: failed to find dll (%s)!\n\t%s\n",
    313                         options.pszDLLName ? options.pszDLLName : "<NULL>",
     463            {   /* failed to find module - concidered nearly fatal. */
     464                fprintf(phSignal, "-,-: failed to find module (%s)!\n\t%s\n",
     465                        options.pszModName ? options.pszModName : "<NULL>",
    314466                        dbGetLastErrorDesc());
    315467                ulRc++;
     
    320472        if (!options.fIntegrityOnly)
    321473        {
    322             cUpdated    = dbGetNumberOfUpdatedFunction(options.lDllRefcode);
    323             cAll        = dbCountFunctionInDll(options.lDllRefcode, FALSE);
    324             cNotAliased = dbCountFunctionInDll(options.lDllRefcode, TRUE);
     474            cUpdated    = dbGetNumberOfUpdatedFunction(options.lModRefcode);
     475            cAll        = dbCountFunctionInModule(options.lModRefcode, FALSE);
     476            cNotAliased = dbCountFunctionInModule(options.lModRefcode, TRUE);
    325477            if (cNotAliased > cUpdated)
    326478            {
     
    329481                ulRc += 0x00010000;
    330482            }
    331             fprintf(phLog, "-------------------------------------------------\n");
    332             fprintf(phLog, "-------- Functions which was not updated --------\n");
    333             dbGetNotUpdatedFunction(options.lDllRefcode, dbNotUpdatedCallBack);
    334             fprintf(phLog, "-------------------------------------------------\n");
    335             fprintf(phLog, "-------------------------------------------------\n\n");
    336             fprintf(phLog,"Number of function in this DLL:        %4ld (%ld)\n", cAll, cNotAliased);
    337             fprintf(phLog,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated);
    338         }
    339         fprintf(phLog,"Number of signals:                     %4ld\n", (long)(ulRc >> 16));
     483            logprintf((phLog, "------------------------------------------------------\n"));
     484            logprintf((phLog, "-------- Functions which was not updated -------------\n"));
     485            dbGetNotUpdatedFunction(options.lModRefcode, dbNotUpdatedCallBack);
     486            logprintf((phLog, "------------------------------------------------------\n"));
     487            logprintf((phLog, "------------------------------------------------------\n\n"));
     488            logprintf((phLog,"Number of function in this module:          %4ld (%ld)\n", cAll, cNotAliased));
     489            logprintf((phLog,"Number of successfully processed functions: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated));
     490        }
     491        logprintf((phLog,    "Number of signals:                          %4ld\n", (long)(ulRc >> 16)));
    340492
    341493        /* close the logs */
     
    348500        if (!options.fIntegrityOnly)
    349501        {
    350             fprintf(stdout,"Number of function in this DLL:        %4ld (%ld)\n", cAll, cNotAliased);
    351             fprintf(stdout,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated);
    352         }
    353         fprintf(stdout,"Number of signals:                     %4ld\n", (long)(ulRc >> 16));
     502            fprintf(stdout,"Number of function in this module:          %4ld (%ld)\n", cAll, cNotAliased);
     503            fprintf(stdout,"Number of successfully processed functions: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated);
     504        }
     505        fprintf(stdout,    "Number of signals:                          %4ld\n", (long)(ulRc >> 16));
    354506        if ((int)(ulRc >> 16) > 0)
    355507            fprintf(stderr, "Check signal file 'Signals.Log'.\n");
     
    376528           "    -io           Integrity check only.         default: disabled\n"
    377529           "    -s            Scan subdirectories.          default: disabled\n"
    378            "    -Old          Use old API style.            default: disabled\n"
    379530           "    -OS2          Ignore 'OS2'-prefix on APIs.  default: disabled\n"
    380            "    -Dll:<dllname> Name of the dll.             default: currentdirname\n"
     531           "    -Mod:<modname> Name of the module.          default: currentdirname\n"
     532           "    -Type:<type>  Module type. AIST.            default: read database\n"
    381533           "    -h:<hostname> Database server hostname.     default: localhost\n"
    382534           "    -u:<username> Username on the server.       default: root\n"
     
    402554static void openLogs(void)
    403555{
     556    #ifdef DEBUGLOG
    404557    if (phLog == NULL)
    405558    {
     
    411564        }
    412565    }
     566    #endif
    413567
    414568    if (phSignal == NULL)
     
    429583static void closeLogs(void)
    430584{
     585    #ifdef DEBUGLOG
    431586    if (phLog != stderr && phLog != NULL)
    432587        fclose(phLog);
     588    #endif
    433589    if (phSignal != stdout && phSignal != NULL)
    434590    {
     
    473629    rc = DosQueryPathInfo(pszDirOrFile, FIL_STANDARD, &fs , sizeof(fs));
    474630    fFile = rc == NO_ERROR && (fs.attrFile & FILE_DIRECTORY) != FILE_DIRECTORY;
     631    if (!fFile)
     632        fFile = strpbrk(pszDirOrFile, "*?") != NULL;
    475633
    476634    /* 0. */
     
    510668        char *psz = strrchr(&ffb.achName[0], '.');
    511669        if (psz != NULL && (!stricmp(psz, ".cpp") || !stricmp(psz, ".c")))
    512             ulRc += processFile(strcat(strcat(strcpy(&szFileSpec[0], pszDir), "\\"), &ffb.achName[0]), pOptions);
     670            ulRc += processFile(strcat(strcat(strcpy(&szFileSpec[0], pszDir), "\\"), &ffb.achName[0]), pOptions, FALSE);
     671        else if (psz != NULL && (!stricmp(psz, ".h") || !stricmp(psz, ".hpp")))
     672            ulRc += processFile(strcat(strcat(strcpy(&szFileSpec[0], pszDir), "\\"), &ffb.achName[0]), pOptions, TRUE);
    513673
    514674        /* next */
     
    551711/**
    552712 * Processes a file.
    553  * @returns   high word = number of signals
    554  *            low  word = number of APIs processed. (1 or 0).
    555  * @param     pszFilename  Filename
    556  * @param     pOptions  Pointer to options.
     713 * @returns high word = number of signals
     714 *          low  word = number of APIs processed. (1 or 0).
     715 * @param   pszFilename Filename
     716 * @param   pOptions    Pointer to options.
     717 * @param   fHeader     Flags if we're processing a header file or not.
    557718 * @sketch     1. read file into memory.
    558719 *             2. create line array.
    559720 *            (3. simple preprocessing - TODO)
    560  *             4. process module header.
     721 *             4. process file header.
    561722 *             5. scan thru the line array, looking for APIs and designnotes.
    562723 *                5b. when API is found, process it.
    563724 *                5c. when designnote found, process it.
    564725 */
    565 static unsigned long processFile(const char *pszFilename, POPTIONS pOptions)
     726static unsigned long processFile(const char *pszFilename, POPTIONS pOptions, BOOL fHeader)
    566727{
    567728    unsigned long  cSignals = 0;
     
    569730    char          *pszFile;
    570731
    571     fprintf(phLog, "Processing '%s':\n", pszFilename);
    572     /* 1.*/
     732    logprintf((phLog, "Processing '%s':\n", pszFilename));
     733
     734    /*
     735     * (1) Read file into memory
     736     */
    573737    pszFile = readFileIntoMemory(pszFilename);
    574738    if (pszFile != NULL)
     
    576740        char **papszLines;
    577741
    578         /* 2.*/
     742        /*
     743         * (2) Create line array.
     744         */
    579745        papszLines = createLineArray(pszFile);
    580746        if (papszLines != NULL)
     
    583749            int i = 0;
    584750
    585             /* 3. - TODO */
    586 
    587             /* 4. */
    588             ulRc = processModuleHeader(papszLines, i, i, pszFilename, pOptions);
     751            /*
     752             * 3. Simple preprocessing - TODO
     753             */
     754
     755
     756            /*
     757             * (4) Process the file header.
     758             */
     759            ulRc = processFileHeader(papszLines, i, i, pszFilename, pOptions);
    589760            cSignals += ulRc >> 16;
    590761            if (ulRc & 0x0000ffff)
    591762            {
    592                 /* 4b.
    593                  * Remove Design notes.
     763                /*
     764                 * (4b) Remove Design notes.
    594765                 */
    595                 pOptions->lSeqFile = 0;
    596766                if (!dbRemoveDesignNotes(pOptions->lFileRefcode))
    597767                {
     
    602772
    603773
    604                 /* 5.*/
     774                /*
     775                 * (5) The scan loop.
     776                 */
    605777                while (papszLines[i] != NULL)
    606778                {
     779                    /*
     780                     * (5b) Function.
     781                     */
    607782                    if (isFunction(papszLines, i, pOptions))
    608783                    {
    609                         ulRc = processAPI(papszLines, i, i, pszFilename, pOptions);
     784                        ulRc = processFunction(papszLines, i, i, pszFilename, pOptions);
    610785                        cAPIs += 0x0000ffff & ulRc;
    611786                        cSignals += ulRc >> 16;
    612787                    }
    613                     else
     788                    /*
     789                     * (5c) Design note.
     790                     */
     791                    else if (isDesignNote(papszLines, i, pOptions))
    614792                    {
    615                         if (isDesignNote(papszLines, i, pOptions))
    616                         {
    617                             ulRc = processDesignNote(papszLines, i, i, pszFilename, pOptions);
    618                             cSignals += ulRc >> 16;
    619                         }
     793                        ulRc = processDesignNote(papszLines, i, i, pszFilename, pOptions);
     794                        cSignals += ulRc >> 16;
     795                    }
     796                    /*
     797                     * (5d) Class detection (experimental)
     798                     */
     799                    #ifdef DEBUGLOG
     800                    else if (isClass(papszLines, i, pOptions))
     801                    {
     802                        logprintf((phLog, "Found class at line %d. %s\n", i, papszLines[i]));
    620803                        i++;
    621804                    }
    622                 }
    623             }
    624 
     805                    #endif
     806                    /*
     807                     * Nothing.
     808                     */
     809                    else
     810                        i++;
     811                } /* while - scan loop */
     812            }
     813
     814            /*
     815             * Cleanup.
     816             */
    625817            free(papszLines);
    626818        }
     
    637829        cSignals++;
    638830    }
    639     fprintf(phLog, "Processing of '%s' is completed.\n\n", pszFilename);
    640 
     831    logprintf((phLog, "Processing of '%s' is completed.\n\n", pszFilename));
     832
     833    fHeader = fHeader;
    641834
    642835    return (unsigned long)((cSignals << 16) | cAPIs);
     
    645838
    646839/**
    647  * Processes an module header and other file information.
     840 * Processes an file header and other file information.
    648841 * @returns     high word = number of signals.
    649842 *              low  word = Success indicator (TRUE / FALSE).
     
    655848 * @sketch      Extract module information if any....
    656849 */
    657 static unsigned long processModuleHeader(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions)
    658 {
    659     char    szDescription[10240];       /* File description buffer. */
    660     char    szId[128];                  /* CVS Id keyword buffer. */
    661     char *  psz, *psz2;
     850static unsigned long processFileHeader(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions)
     851{
     852    char            szDescription[10240];       /* File description buffer. */
     853    char            szId[128];                  /* CVS Id keyword buffer. */
     854    char *          psz, *psz2;
    662855    const char *    pszDBFilename;
    663856    char *          pszLastDateTime = NULL;
     
    783976         * Insert or update the database.
    784977         */
    785         if (dbInsertUpdateFile((unsigned short)pOptions->lDllRefcode, pszDBFilename,
     978        if (dbInsertUpdateFile((unsigned short)pOptions->lModRefcode, pszDBFilename,
    786979                               &szDescription[0], pszLastDateTime, lLastAuthor, pszRevision))
    787980        {
     
    789982             * Get file refcode.
    790983             */
    791             pOptions->lFileRefcode = dbFindFile(pOptions->lDllRefcode, pszDBFilename);
     984            pOptions->lFileRefcode = dbFindFile(pOptions->lModRefcode, pszDBFilename);
    792985            if (pOptions->lFileRefcode < 0)
    793986            {
     
    9331126             * Add the note.
    9341127             */
    935             if (!dbAddDesignNote(pOptions->lDllRefcode, pOptions->lFileRefcode,
     1128            if (!dbAddDesignNote(pOptions->lModRefcode, pOptions->lFileRefcode,
    9361129                                 pszTitle, psz,
    9371130                                 lLevel, lSeqNbr, lSeqNbrNote++, i + 1, lLevel > 0, &lRefCode))
     
    9701163
    9711164/**
    972  * Processes an API function.
     1165 * Processes an function.
    9731166 * @returns   high word = number of signals
    9741167 *            low  word = number of APIs processed. (1 or 0).
     
    9791172 * @param     pOptions  Pointer to options.
    9801173 */
    981 static unsigned long processAPI(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions)
     1174static unsigned long processFunction(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions)
    9821175{
    9831176    unsigned long ulRc;
     
    9991192     */
    10001193
    1001     /* 1.*/
     1194    /*
     1195     * (1) Analyse function declaration.
     1196     */
    10021197    ulRc = analyseFnDcl(&FnDesc, papszLines, i, iRet, pszFilename, pOptions);
    10031198    if (0x0000ffff & ulRc) /* if low word is 0 the fatal */
    10041199    {
    1005         unsigned long ulRcTmp;
    1006         //char szErrorDesc[2113]; /* due to some limitation in the latest EMX release size is 2112 and not 4096 as initially implemented. */
    1007         char  *pszErrorDesc = (char*)malloc(20480);
    1008 
    1009         /* 2.*/
     1200        unsigned long   ulRcTmp;
     1201        char  *         pszErrorDesc = (char*)malloc(20480);
     1202
     1203        /*
     1204         * (2) Analyse function header.
     1205         */
    10101206        ulRcTmp = analyseFnHdr(&FnDesc, papszLines, i, pszFilename, pOptions);
    10111207        if (ulRcTmp == ~0UL) /* check for fatal error */
     1208        {
     1209            free(pszErrorDesc);
    10121210            return (0xffff0000UL & ulRc) + 0x00010000UL;
     1211        }
    10131212        ulRc += 0xffff0000UL & ulRcTmp;
    10141213
    1015         /* 3.*/
    1016         fprintf(phLog, "Name:      '%s'  (refcodes=", FnDesc.pszName);
    1017         for (j = 0; j < FnDesc.cRefCodes; j++)
    1018             fprintf(phLog, j > 0 ? ", %ld" : "%ld", FnDesc.alRefCode[j]);
    1019         fprintf(phLog, ")\n");
    1020         fprintf(phLog, "  Returns: '%s'\n", FnDesc.pszReturnType != NULL ? FnDesc.pszReturnType : "<missing>");
    1021         fprintf(phLog, "  cParams: %2d\n", FnDesc.cParams);
    1022         for (j = 0; j < FnDesc.cParams; j++)
    1023             fprintf(phLog, "  Param %2d: type '%s' %*s name '%s' description: %s\n", j, FnDesc.apszParamType[j],
    1024                     max((int)(15 - strlen(FnDesc.apszParamType[j])), 0), "", FnDesc.apszParamName[j],
    1025                     FnDesc.apszParamDesc[j] != NULL ?  FnDesc.apszParamDesc[j] : "(null)");
    1026         fprintf(phLog, "  Status:   %ld - '%s'\n", FnDesc.lStatus, FnDesc.pszStatus != NULL ? FnDesc.pszStatus : "<missing>");
    1027         fprintf(phLog, "  cAuthors: %2d\n", FnDesc.cAuthors);
    1028         for (j = 0; j < FnDesc.cAuthors; j++)
    1029             fprintf(phLog, "  Author %d: '%s'  (refcode=%ld)\n", j, FnDesc.apszAuthor[j], FnDesc.alAuthorRefCode[j]);
    1030 
    1031         fprintf(phLog, "  Description: %s\n", FnDesc.pszDescription != NULL ? FnDesc.pszDescription : "(null)");
    1032         fprintf(phLog, "  Remark:      %s\n", FnDesc.pszRemark != NULL ? FnDesc.pszRemark : "(null)");
    1033         fprintf(phLog, "  Return Desc: %s\n", FnDesc.pszReturnDesc != NULL ? FnDesc.pszReturnDesc : "(null)");
    1034         fprintf(phLog, "  Sketch:      %s\n", FnDesc.pszSketch != NULL ? FnDesc.pszSketch : "(null)");
    1035         fprintf(phLog, "  Equiv:       %s\n", FnDesc.pszEquiv != NULL ? FnDesc.pszEquiv : "(null)");
    1036         fprintf(phLog, "  Time:        %s\n", FnDesc.pszTime != NULL ? FnDesc.pszTime : "(null)");
    1037         fprintf(phLog, "------------\n");
    1038 
    1039         /* 4.*/
    1040         ulRcTmp = dbUpdateFunction(&FnDesc, pOptions->lDllRefcode, pszErrorDesc);
     1214        /*
     1215         * (3) Log data (for debug purpose).
     1216         */
     1217        logFunction(&FnDesc);
     1218
     1219        /*
     1220         * (4) Update database.
     1221         */
     1222        ulRcTmp = dbUpdateFunction(&FnDesc, pOptions->lModRefcode, pszErrorDesc);
    10411223        if (ulRcTmp != 0)
    10421224        {
     
    10641246                                  const char *pszFilename, POPTIONS pOptions)
    10651247{
    1066     static long     lPrevFnDll = -1L; /* fix for duplicate dlls */
    10671248    unsigned long   ulRc;
    10681249    FNFINDBUF       FnFindBuf;
     
    10701251
    10711252    /* brief algorithm:
    1072      * 1. read function declaration using analyseFnDcl2.
    1073      * 2. apply name rules.
    1074      * 3. do a database lookup on the name.
    1075      *  3b. if more that one match, write a signal. (TODO: a simple fix is done, but there are holes.)
     1253     * 1. Read function declaration using analyseFnDcl2.
     1254     * 2. Apply name rules.
     1255     * 3. Do a database lookup on the name.
     1256     *  3b. If more that one match, write a signal. (TODO: a simple fix is done, but there are holes.)
     1257     * 4. if not found then add the function as other (type=O). Only do this if we know which module we're in.
     1258     *  4b. do 3.
    10761259     */
    10771260
    1078     /* 1. */
     1261    /*
     1262     * (1) Read function declaration using analyseFnDcl2.
     1263     */
    10791264    ulRc = analyseFnDcl2(pFnDesc, papszLines, i, iRet, pszFilename, pOptions);
    10801265    if (ulRc != 1)
    10811266        return ulRc;
    10821267
    1083     /* 2. */
     1268    /*
     1269     * (2) Apply name rules (if api only?).
     1270     */
    10841271    if (pOptions->fOS2 && strncmp(pFnDesc->pszName, "OS2", 3) == 0)
    10851272        pFnDesc->pszName += 3;
     
    10911278        pFnDesc->pszName += 3;
    10921279
    1093     /* 3. */
    1094     if (!dbFindFunction(pFnDesc->pszName, &FnFindBuf, pOptions->lDllRefcode))
     1280    /*
     1281     * (3) Do a database lookup on the name.
     1282     */
     1283    if (!dbFindFunction(pFnDesc->pszName, &FnFindBuf, pOptions->lModRefcode))
    10951284    {
    10961285        fprintf(phSignal, "%s, %s: error occured while reading from database, %s\n",
     
    11021291    if (FnFindBuf.cFns != 0)
    11031292    {
    1104         if (pOptions->lDllRefcode < 0)
     1293        if (pOptions->lModRefcode < 0)
    11051294        {
    11061295            if (FnFindBuf.cFns > 1)
    11071296            {
    1108                 fprintf(phSignal, "%s: unknown dll and more than two occurences of this function!\n", pszFilename);
     1297                fprintf(phSignal, "%s: unknown module and more than two occurences of this function!\n", pszFilename);
    11091298                return 0x00010000;
    11101299            }
    1111             pOptions->lDllRefcode = FnFindBuf.alDllRefCode[0];
    1112             fprintf(phLog, "DllRef = %d\n", pOptions->lDllRefcode);
     1300            pOptions->lModRefcode = FnFindBuf.alModRefCode[0];
     1301            logprintf((phLog, "ModRef = %d\n", pOptions->lModRefcode));
    11131302        }
    11141303
     
    11171306
    11181307        if (pFnDesc->cRefCodes == 0)
    1119             fprintf(phLog, "%s was not an API in this dll(%d)!\n", pFnDesc->pszName, pOptions->lDllRefcode);
     1308            logprintf((phLog, "%s was not an API in this module(%d)!\n", pFnDesc->pszName, pOptions->lModRefcode));
    11201309    }
    11211310    else
    1122         fprintf(phLog, "%s was not an API\n", pFnDesc->pszName);
     1311        logprintf((phLog, "%s was not an API\n", pFnDesc->pszName));
     1312
     1313    /*
     1314     * (4) If not found then add the function as other (type=O).
     1315     *     Only do this if we know which module we're in.
     1316     */
     1317    if (FnFindBuf.cFns == 0 || pFnDesc->cRefCodes == 0 && pOptions->lModRefcode >= 0)
     1318    {
     1319        if (!dbInsertUpdateFunction(pOptions->lModRefcode,
     1320                                    pFnDesc->pszName, pFnDesc->pszName,
     1321                                    -1, TRUE, FUNCTION_OTHER))
     1322        {
     1323            fprintf(phSignal, "%s, %s: error occured inserting new function, %s\n",
     1324                    pszFilename, pFnDesc->pszName, dbGetLastErrorDesc());
     1325            return 0x00010000;
     1326        }
     1327
     1328        if (!dbFindFunction(pFnDesc->pszName, &FnFindBuf, pOptions->lModRefcode))
     1329        {
     1330            fprintf(phSignal, "%s, %s: error occured while reading from database, %s\n",
     1331                    pszFilename, pFnDesc->pszName, dbGetLastErrorDesc());
     1332            return 0x00010000;
     1333        }
     1334
     1335        for (lFn = 0; lFn < FnFindBuf.cFns; lFn++)
     1336            pFnDesc->alRefCode[pFnDesc->cRefCodes++] = FnFindBuf.alRefCode[lFn];
     1337
     1338        if (pFnDesc->cRefCodes == 0)
     1339        {
     1340            fprintf(phSignal, "%s, %s: Function was not found even though it was just added.\n",
     1341                    pszFilename, pFnDesc->pszName);
     1342            return 0x00010000;
     1343        }
     1344    }
    11231345
    11241346    ulRc = pFnDesc->cRefCodes;
     
    11431365{
    11441366    /** @sketch
    1145      * 1. find the '('
    1146      * 2. find the word ahead of the '(', this is the function name.
    1147      * 2a. class test.
    1148      * 3. find the closing ')'
    1149      * 4. copy the parameters, which is between the two '()'
    1150      * 5. format the parameters
     1367     * 1. Find the '('
     1368     * 2. Find the word ahead of the '(', this is the function name.
     1369     * 2a. Class test.
     1370     * 3. Find the closing ')'
     1371     * 4. Copy the parameters, which is between the two '()'
     1372     * 5. Format the parameters
     1373     * 6. Return type, function name and arguments.
     1374     *    Check for the ODINFUNCTION macro.
    11511375     */
    11521376
     
    11711395    }
    11721396
    1173     /* 2. */
     1397    /*
     1398     * (2) find the word ahead of the '(', this is the function name.
     1399     */
    11741400    iFn = iP1;
    11751401    if (papszLines[iFn] != pszP1)
     
    11991425    pszFn = findStartOfWord(pszFn, papszLines[iFn]);
    12001426
    1201     /* 2a. */
     1427    /*
     1428     * (2a) class test.
     1429     */
    12021430    /* operators are not supported (BOOL kTime::operator > (const kTime &time) const) */
    12031431    if (pszFn > papszLines[iFn])
     
    12251453        pszClass = pszClassEnd = NULL;
    12261454
    1227     /* 3. */
     1455    /*
     1456     * (3) find the closing ')'
     1457     */
    12281458    c = 1;
    12291459    iP2 = iP1;
     
    12431473    iRet = iP2 + 1; //assumes: only one function on a single line!
    12441474
    1245     /* 4. */
     1475    /*
     1476     * (4) Copy the parameters, which is between the two '()'
     1477     */
    12461478    psz = pFnDesc->szFnDclBuffer;
    12471479    copy(pFnDesc->szFnDclBuffer, pszP1, iP1, pszP2, iP2, papszLines);
    12481480    pszEnd = psz + strlen(psz) + 1;
    12491481
    1250     /* 5.*/
     1482    /*
     1483     * (5) Format the parameters.
     1484     */
    12511485    cArgs = 0;
    12521486    if (stricmp(psz, "(void)") != 0 && strcmp(psz, "()") != 0 && strcmp(psz, "( )"))
     
    12751509    }
    12761510
    1277     /* 6. */
     1511    /*
     1512     * (6) Return type, function name and arguments.
     1513     *     Check for the ODINFUNCTION macro.
     1514     */
    12781515    if (strnicmp(pszFn, "ODINFUNCTION", 12) == 0 || strnicmp(pszFn, "ODINPROCEDURE", 13) == 0)
    12791516    {
     
    13251562            /* FIXME LATER! Some constructors calling baseclass constructors "breaks" this rule. Win32MDIChildWindow in /src/user32/win32wmdichild.cpp for example. */
    13261563            fprintf(phSignal,"Fatal error? return statement is too larget. len=%d\n", strlen(pszEnd));
    1327             fprintf(phLog,   "Fatal error? return statement is too larget. len=%d\n", strlen(pszEnd));
     1564            logprintf((phLog,   "Fatal error? return statement is too larget. len=%d\n", strlen(pszEnd)));
    13281565            if (strlen(pszEnd) > 512)
    13291566                fprintf(stderr,  "Fatal error? return statement is too larget. len=%d\n", strlen(pszEnd));
     1567            #ifdef DEBUGLOG
    13301568            fflush(phLog);
     1569            #endif
    13311570            fflush(phSignal);
    13321571            fflush(stderr);
     
    13391578        /* !BugFix! some function occur more than once, usually as inline functions */
    13401579        if (pFnDesc->pszReturnType != NULL
    1341             && strstr(pFnDesc->pszReturnType, "inline ") != NULL)
    1342         {
    1343             fprintf(phLog, "Not an API. Inlined functions can't be exported!\n");
     1580            && (pFnDesc->fchType == FUNCTION_ODIN32_API || pFnDesc->fchType == FUNCTION_INTERNAL_ODIN32_API)
     1581            && stristr(pFnDesc->pszReturnType, "inline ") != NULL)
     1582        {
     1583            logprintf((phLog, "Not an API. Inlined functions can't be exported!\n"));
    13441584            return 0;
    13451585        }
     
    13531593            )
    13541594        {   /* cdecl function is prefixed with an '_' */
    1355             strcpy(pszEnd, "_");
     1595            strcpy(pszEnd, "_"); /* BUGBUG */
    13561596        }
    13571597        if (pszClass != NULL)
     
    13651605        *pszEnd = '\0';
    13661606
     1607        /* class name and type */
     1608        if (pszClass != NULL)
     1609        {
     1610            pFnDesc->pszClass = pszEnd;
     1611            strncat(pszEnd,pszClass, pszClassEnd - pszClass + 1);
     1612            if (!pFnDesc->pszReturnType || !*pFnDesc->pszReturnType)
     1613                pFnDesc->fchType =  *pszFn != '~' ? FUNCTION_CONSTRUCTOR : FUNCTION_DESTRUCTOR;
     1614            else
     1615                pFnDesc->fchType = FUNCTION_METHOD; /* BUGBUG operator. */
     1616            pszEnd = strlen(pszEnd) + pszEnd + 1;
     1617            *pszEnd = '\0';
     1618        }
    13671619
    13681620        /* arguments */
     
    14071659                    else
    14081660                    {   /* arg yet another special case! 'fn(int argc, char *argv[])' */
    1409                         char *pszP2;
     1661                        char *pszP2 = NULL;
    14101662                        cch = strlen(apszArgs[j]);
    14111663                        psz = &apszArgs[j][cch-2];
     
    14371689                                memset(psz, ' ', pszP2 - psz);
    14381690                            else
    1439                                 fprintf(phLog, "assert: line %d\n", __LINE__);
     1691                                logprintf((phLog, "assert: line %d\n", __LINE__));
    14401692                        }
    14411693                        pFnDesc->apszParamType[j] = trim(apszArgs[j]);
     
    15841836        /* 2c.*/
    15851837        if (iName <= iEnd && strstr(papszLines[iName], pFnDesc->pszName) == NULL)
    1586             fprintf(phLog, "Warning: a matching function name is not found in the name Field\n");
     1838            logprintf((phLog, "Warning: a matching function name is not found in the name Field\n"));
    15871839    }
    15881840
     
    18152067}
    18162068
     2069
     2070/**
     2071 * Writes debug log data on a function.
     2072 * @param   pFnDesc     Pointer to function description block.
     2073 */
     2074void logFunction(PFNDESC pFnDesc)
     2075{
     2076    #ifdef DEBUGLOG
     2077    int j;
     2078
     2079    fprintf(phLog, "Name:      '%s'  (refcodes=", pFnDesc->pszName);
     2080    for (j = 0; j < pFnDesc->cRefCodes; j++)
     2081        fprintf(phLog, j > 0 ? ", %ld" : "%ld", pFnDesc->alRefCode[j]);
     2082    fprintf(phLog, ")\n");
     2083    fprintf(phLog, "  Returns: '%s'\n", pFnDesc->pszReturnType != NULL ? pFnDesc->pszReturnType : "<missing>");
     2084    fprintf(phLog, "  cParams: %2d\n", pFnDesc->cParams);
     2085    for (j = 0; j < pFnDesc->cParams; j++)
     2086        fprintf(phLog, "  Param %2d: type '%s' %*s name '%s' description: %s\n", j, pFnDesc->apszParamType[j],
     2087                max((int)(15 - strlen(pFnDesc->apszParamType[j])), 0), "", pFnDesc->apszParamName[j],
     2088                pFnDesc->apszParamDesc[j] != NULL ?  pFnDesc->apszParamDesc[j] : "(null)");
     2089    fprintf(phLog, "  Status:   %ld - '%s'\n", pFnDesc->lStatus, pFnDesc->pszStatus != NULL ? pFnDesc->pszStatus : "<missing>");
     2090    fprintf(phLog, "  cAuthors: %2d\n", pFnDesc->cAuthors);
     2091    for (j = 0; j < pFnDesc->cAuthors; j++)
     2092        fprintf(phLog, "  Author %d: '%s'  (refcode=%ld)\n", j, pFnDesc->apszAuthor[j], pFnDesc->alAuthorRefCode[j]);
     2093
     2094    fprintf(phLog, "  Description: %s\n", pFnDesc->pszDescription != NULL ? pFnDesc->pszDescription : "(null)");
     2095    fprintf(phLog, "  Remark:      %s\n", pFnDesc->pszRemark != NULL ? pFnDesc->pszRemark : "(null)");
     2096    fprintf(phLog, "  Return Desc: %s\n", pFnDesc->pszReturnDesc != NULL ? pFnDesc->pszReturnDesc : "(null)");
     2097    fprintf(phLog, "  Sketch:      %s\n", pFnDesc->pszSketch != NULL ? pFnDesc->pszSketch : "(null)");
     2098    fprintf(phLog, "  Equiv:       %s\n", pFnDesc->pszEquiv != NULL ? pFnDesc->pszEquiv : "(null)");
     2099    fprintf(phLog, "  Time:        %s\n", pFnDesc->pszTime != NULL ? pFnDesc->pszTime : "(null)");
     2100    fprintf(phLog, "------------\n");
     2101    #else
     2102    pFnDesc = pFnDesc;
     2103    #endif
     2104}
     2105
     2106
     2107/**
     2108 * Resolves the source filename of an .obj file.
     2109 * @returns Pointer to static filename buffer.
     2110 * @param   pszFileObj  Name of object file.
     2111 * @param   papszDirs   Array of directories to search. NULL terminated.
     2112 * @remark  The string returned is in _static_ memory.
     2113 */
     2114char *ResolvSourceFile(char *pszFileObj, char **papszDirs)
     2115{
     2116    static char     szFile[CCHMAXPATH];
     2117    static char *   aszSuffixes[] = { ".cpp", ".c", ".orc", NULL };
     2118    char *  aszDirs[] = { ".;", NULL };
     2119    char *  pszDir;
     2120    int     i;
     2121    char    szFileTmp[CCHMAXPATH];
     2122
     2123    /*
     2124     * Extract file name.
     2125     */
     2126    fileNameNoExt(pszFileObj, szFileTmp);
     2127
     2128
     2129    /*
     2130     * Loop dirs.
     2131     */
     2132    for (i = 0; papszDirs[i]; i++)
     2133    {
     2134        int j;
     2135
     2136        for (j = 0; aszSuffixes[j]; j++)
     2137        {
     2138            APIRET       rc;
     2139            FILESTATUS3  fs;
     2140
     2141            strcat(strcat(strcat(strcpy(szFile, papszDirs[i]), "\\"), szFileTmp), aszSuffixes[j]);
     2142            rc = DosQueryPathInfo(szFile, FIL_STANDARD, &fs , sizeof(fs));
     2143            if (rc == NO_ERROR && (fs.attrFile & FILE_DIRECTORY) != FILE_DIRECTORY)
     2144            {
     2145                logprintf((phLog, "ResolveSourceFile(%s,..) -> %s\n", pszFileObj, szFile));
     2146                return szFile;
     2147            }
     2148        }
     2149    }
     2150
     2151    logprintf((phLog, "ResolveSourceFile(%s,..) -> NULL\n", pszFileObj));
     2152    return NULL;
     2153}
    18172154
    18182155
     
    21612498                                if (pszB != NULL && *pszB == '{')
    21622499                                {
    2163                                     fprintf(phLog, "Function found: %.*s\n", cchFnName, pszFnName);
     2500                                    logprintf((phLog, "Function found: %.*s\n", cchFnName, pszFnName));
    21642501                                    return TRUE;
    21652502                                }
     
    22242561                        if (pszB != NULL && *pszB == '{')
    22252562                        {
    2226                             fprintf(phLog, "Possible API: %.*s\n", cchFnName, pszOS2);
     2563                            logprintf((phLog, "Possible API: %.*s\n", cchFnName, pszOS2));
    22272564                            return TRUE;
    22282565                        }
     
    22662603
    22672604
     2605/**
     2606 * Checks if there is a class declaration starting at the current line.
     2607 * @returns   TRUE if design note found, else FALSE.
     2608 * @param     papszLines   Array of lines in the file.
     2609 * @param     i            Index into papszLines.
     2610 * @param     pOptions     Pointer to options.
     2611 */
     2612BOOL isClass(char **papszLines, int i, POPTIONS pOptions)
     2613{
     2614    char *psz = papszLines[i];
     2615
     2616    if (psz == NULL)
     2617        return FALSE;
     2618
     2619    // look for class
     2620    while (*psz == ' ')
     2621        psz++;
     2622
     2623    pOptions = pOptions;
     2624    return !strncmp(psz, "class", 5)
     2625           && (psz[5] == '\t' || psz[5] == ' ' || psz[5] == '\n' || psz[5] == '\r' || psz[5] == '\0');
     2626}
     2627
    22682628
    22692629
     
    22782638    {
    22792639        case 0:
    2280             fprintf(phLog, "%s", pszValue);
     2640            logprintf((phLog, "%s", pszValue));
    22812641            break;
    22822642        case 1:
    2283             fprintf(phLog, "(%s)", pszValue);
     2643            logprintf((phLog, "(%s)", pszValue));
    22842644            break;
    22852645        case 2: /* updated */
    2286             fprintf(phLog, " %s=%s", pszFieldName, pszValue);
     2646            logprintf((phLog, " %s=%s", pszFieldName, pszValue));
    22872647            break;
    22882648        case 3: /* aliasfn */
    2289             fprintf(phLog, " %s=%s", pszFieldName, pszValue);
     2649            logprintf((phLog, " %s=%s", pszFieldName, pszValue));
    22902650            break;
    22912651        case 4:
    22922652            if (pszValue != NULL)
    2293                 fprintf(phLog, " --> %s.", pszValue);
     2653                logprintf((phLog, " --> %s.", pszValue));
    22942654            break;
    22952655        case 5:
    22962656            if (pszValue != NULL)
    2297                 fprintf(phLog, "%s", pszValue);
     2657                logprintf((phLog, "%s", pszValue));
    22982658            break;
    22992659        case 6:
    23002660            if (pszValue != NULL)
    2301                 fprintf(phLog, "(%s)", pszValue);
     2661                logprintf((phLog, "(%s)", pszValue));
    23022662            break;
    23032663
    23042664        default:
    23052665            i = 0;
    2306             fprintf(phLog, "\n");
     2666            logprintf((phLog, "\n"));
    23072667    }
    23082668
     
    23102670    {
    23112671        i = 0;
    2312         fprintf(phLog, "\n");
     2672        logprintf((phLog, "\n"));
    23132673    }
    23142674
     
    24412801        psz++;
    24422802    }
    2443     fprintf(phLog, "%d lines\n", cLines);
     2803    logprintf((phLog, "%d lines\n", cLines));
    24442804
    24452805    papszLines = (char**)calloc(cLines + 1, sizeof(char *));
     
    29943354
    29953355
    2996 
    2997 
     3356/**
     3357 * Creates a memory buffer for a text file.
     3358 * @returns   Pointer to file memoryblock. NULL on error.
     3359 * @param     pszFilename  Pointer to filename string.
     3360 * @remark    This function is the one using most of the execution
     3361 *            time (DosRead + DosOpen) - about 70% of the execution time!
     3362 */
     3363void *textbufferCreate(const char *pszFilename)
     3364{
     3365    void *pvFile = NULL;
     3366    FILE *phFile;
     3367
     3368    phFile = fopen(pszFilename, "rb");
     3369    if (phFile != NULL)
     3370    {
     3371        signed long cbFile = fsize(phFile);
     3372        if (cbFile >= 0)
     3373        {
     3374            pvFile = malloc(cbFile + 1);
     3375            if (pvFile != NULL)
     3376            {
     3377                memset(pvFile, 0, cbFile + 1);
     3378                if (cbFile > 0 && fread(pvFile, 1, cbFile, phFile) == 0)
     3379                {   /* failed! */
     3380                    free(pvFile);
     3381                    pvFile = NULL;
     3382                }
     3383            }
     3384            else
     3385                fprintf(stderr, "warning/error: failed to open file %s\n", pszFilename);
     3386        }
     3387        fclose(phFile);
     3388    }
     3389    return pvFile;
     3390}
     3391
     3392
     3393/**
     3394 * Destroys a text textbuffer.
     3395 * @param     pvBuffer   Buffer handle.
     3396 */
     3397void textbufferDestroy(void *pvBuffer)
     3398{
     3399    free(pvBuffer);
     3400}
     3401
     3402
     3403/**
     3404 * Gets the next line from an textbuffer.
     3405 * @returns   Pointer to the next line.
     3406 * @param     pvBuffer  Buffer handle.
     3407 * @param     psz       Pointer to current line.
     3408 *                      NULL is passed in to get the first line.
     3409 */
     3410char *textbufferNextLine(void *pvBuffer, register char *psz)
     3411{
     3412    register char ch;
     3413
     3414    /* if first line psz is NULL. */
     3415    if (psz == NULL)
     3416        return (char*)pvBuffer;
     3417
     3418    /* skip till end of file or end of line. */
     3419    ch = *psz;
     3420    while (ch != '\0' && ch != '\n' && ch != '\r')
     3421        ch = *++psz;
     3422
     3423    /* skip line end */
     3424    if (ch == '\r')
     3425        ch = *++psz;
     3426    if (ch == '\n')
     3427        psz++;
     3428
     3429    return psz;
     3430}
     3431
     3432
     3433/**
     3434 * Gets the next line from an textbuffer.
     3435 * (fgets for textbuffer)
     3436 * @returns   Pointer to pszOutBuffer. NULL when end of file.
     3437 * @param     pvBuffer  Buffer handle.
     3438 * @param     ppv       Pointer to a buffer index pointer. (holds the current buffer index)
     3439 *                      Pointer to a null pointer is passed in to get the first line.
     3440 * @param     pszLineBuffer  Output line buffer. (!= NULL)
     3441 * @param     cchLineBuffer  Size of the output line buffer. (> 0)
     3442 * @remark    '\n' and '\r' are removed!
     3443 */
     3444char *textbufferGetNextLine(void *pvBuffer, void **ppv, char *pszLineBuffer, int cchLineBuffer)
     3445{
     3446    char *          pszLine = pszLineBuffer;
     3447    char *          psz = *(char**)(void*)ppv;
     3448    register char   ch;
     3449
     3450    /* first line? */
     3451    if (psz == NULL)
     3452        psz = (char*)pvBuffer;
     3453
     3454    /* Copy to end of the line or end of the linebuffer. */
     3455    ch = *psz;
     3456    cchLineBuffer--; /* reserve space for '\0' */
     3457    while (cchLineBuffer > 0 && ch != '\0' && ch != '\n' && ch != '\r')
     3458    {
     3459        *pszLine++ = ch;
     3460        ch = *++psz;
     3461    }
     3462    *pszLine = '\0';
     3463
     3464    /* skip line end */
     3465    if (ch == '\r')
     3466        ch = *++psz;
     3467    if (ch == '\n')
     3468        psz++;
     3469
     3470    /* check if position has changed - if unchanged it's the end of file! */
     3471    if (*ppv == (void*)psz)
     3472        pszLineBuffer = NULL;
     3473
     3474    /* store current position */
     3475    *ppv = (void*)psz;
     3476
     3477    return pszLineBuffer;
     3478}
     3479
     3480
     3481/**
     3482 * Find the size of a file.
     3483 * @returns   Size of file. -1 on error.
     3484 * @param     phFile  File handle.
     3485 */
     3486signed long fsize(FILE *phFile)
     3487{
     3488    int ipos;
     3489    signed long cb;
     3490
     3491    if ((ipos = ftell(phFile)) < 0
     3492        ||
     3493        fseek(phFile, 0, SEEK_END) != 0
     3494        ||
     3495        (cb = ftell(phFile)) < 0
     3496        ||
     3497        fseek(phFile, ipos, SEEK_SET) != 0
     3498        )
     3499        cb = -1;
     3500    return cb;
     3501}
     3502
     3503
     3504/**
     3505 * Copies the name part with out extention into pszBuffer and returns
     3506 * a pointer to the buffer.
     3507 * If no name is found "" is returned.
     3508 * @returns   Pointer to pszBuffer with path.
     3509 * @param     pszFilename  Pointer to readonly filename.
     3510 * @param     pszBuffer    Pointer to output Buffer.
     3511 * @status    completely implemented.
     3512 * @author    knut st. osmundsen
     3513 */
     3514char *fileNameNoExt(const char *pszFilename, char *pszBuffer)
     3515{
     3516    char *psz = strrchr(pszFilename, '\\');
     3517    if (psz == NULL)
     3518        psz = strrchr(pszFilename, '/');
     3519
     3520    strcpy(pszBuffer, psz == NULL ? pszFilename : psz + 1);
     3521
     3522    psz = strrchr(pszBuffer, '.');
     3523    if (psz > pszBuffer) /* an extetion on it's own (.depend) is a filename not an extetion! */
     3524        *psz = '\0';
     3525
     3526    return pszBuffer;
     3527}
     3528
  • trunk/tools/database/StateUpd.h

    r3841 r6677  
    1 /* $Id: StateUpd.h,v 1.5 2000-07-18 07:34:08 bird Exp $ */
     1/* $Id: StateUpd.h,v 1.6 2001-09-07 10:24:06 bird Exp $ */
    22/*
    33 * StateUpd - Scans source files for API functions and imports data on them.
     
    1919    BOOL        fIntegrityAfter;        /* ie  */
    2020    BOOL        fIntegrityOnly;         /* io  */
    21     BOOL        fRecursive;             /* s   */
     21    BOOL        fRecursive;             /* s  */
    2222    BOOL        fOld;                   /* Old */
    23     BOOL        fOS2;                   /* Ignore OS2 prefixes */
    24     BOOL        fCOMCTL32;              /* Ignore COMCTL32 prefixes */
    25     BOOL        fVERSION;               /* Ignore VERSION prefixes */
    26     char *      pszDLLName;             /* Name of the dll being processed */
    27     signed long lDllRefcode;            /* Database reference code of the dll */
     23    BOOL        fOS2;                   /* Ignore OS2 prefixes. */
     24    BOOL        fCOMCTL32;              /* Ignore COMCTL32 prefixes. */
     25    BOOL        fVERSION;               /* Ignore VERSION prefixes. */
     26    char *      pszModName;             /* Name of the module being processed. */
     27    char        chModType;              /* Type of module being processed. */
     28    signed long lModRefcode;            /* Database reference code of the module. */
    2829    signed long lFileRefcode;           /* File reference code. */
    29     signed long lSeqFile;               /* Design note file sequence number. */
     30    char **     papszDirs;              /* Pointer to NULL terminated array of directories*/
     31                                        /* to be searched when .obj files are specified. */
    3032} OPTIONS, *POPTIONS;
    3133
  • trunk/tools/database/db.cpp

    r6663 r6677  
    1 /* $Id: db.cpp,v 1.25 2001-09-06 03:07:32 bird Exp $ *
     1/* $Id: db.cpp,v 1.26 2001-09-07 10:24:07 bird Exp $ *
    22 *
    33 * DB - contains all database routines.
     
    154154
    155155/**
    156  * Gets the refid for the give dll name.
    157  * @returns   Dll refid. -1 on error.
    158  * @param     pszDllName  Dll name.
    159  */
    160 signed long _System dbGetDll(const char *pszDllName)
     156 * Gets the refid for the give mod name.
     157 * @returns Module refid. -1 on error.
     158 * @param   pszModName      Module name.
     159 */
     160signed long _System dbGetModule(const char *pszModName)
    161161{
    162162    int         rc;
     
    164164    MYSQL_RES * pres;
    165165
    166     sprintf(&szQuery[0], "SELECT refcode FROM dll WHERE name = '%s'\n", pszDllName);
     166    sprintf(&szQuery[0], "SELECT refcode FROM module WHERE name = '%s'\n", pszModName);
    167167    rc   = mysql_query(pmysql, &szQuery[0]);
    168168    pres = mysql_store_result(pmysql);
     
    178178
    179179/**
    180  * Count the function in a given dll.
    181  * @returns  Number of functions. -1 on error.
    182  * @param    lDll         Dll refcode.
    183  * @param    fNotAliases  TRUE: don't count aliased functions.
    184  */
    185 signed long     _System dbCountFunctionInDll(signed long lDll, BOOL fNotAliases)
     180 * Count the function in a given module.
     181 * @returns Number of functions. -1 on error.
     182 * @param   lModule         Module refcode.
     183 * @param   fNotAliases     TRUE: don't count aliased functions.
     184 */
     185signed long     _System dbCountFunctionInModule(signed long lModule, BOOL fNotAliases)
    186186{
    187187    signed long rc;
     
    189189    MYSQL_RES * pres;
    190190
    191     if (lDll >= 0)
    192     {
    193         sprintf(&szQuery[0], "SELECT count(refcode) FROM function WHERE dll = %ld\n", lDll);
     191    if (lModule >= 0)
     192    {
     193        sprintf(&szQuery[0], "SELECT count(refcode) FROM function WHERE module = %ld\n", lModule);
    194194        if (fNotAliases)
    195195            strcat(&szQuery[0], " AND aliasfn < 0");
     
    211211
    212212/**
    213  * Checks if dll exists. If not exists the dll is inserted.
    214  * @returns   Dll refcode. -1 on errors.
    215  * @param     pszDll  Dll name.
    216  * @remark    This search must be case insensitive.
    217  *            (In the mysql-world everything is case insensitive!)
    218  */
    219 signed long _System dbCheckInsertDll(const char *pszDll, char fchType)
     213 * Checks if module exists. If not exists the module is inserted.
     214 * @returns Module refcode. -1 on errors.
     215 * @param   pszModule   Module name.
     216 * @param   fchType     Module type.
     217 * @remark  This search must be case insensitive.
     218 *          (In the mysql-world everything is case insensitive!)
     219 */
     220signed long _System dbCheckInsertModule(const char *pszModule, char fchType)
    220221{
    221222    int         rc;
     
    224225
    225226    /* try find match */
    226     sprintf(&szQuery[0], "SELECT refcode, name FROM dll WHERE name = '%s'\n", pszDll);
     227    sprintf(&szQuery[0], "SELECT refcode, name FROM module WHERE name = '%s'\n", pszModule);
    227228    rc   = mysql_query(pmysql, &szQuery[0]);
    228229    pres = mysql_store_result(pmysql);
    229230
    230     /* not found? - insert dll */
     231    /* not found? - insert module */
    231232    if (rc < 0 || pres == NULL || mysql_num_rows(pres) == 0)
    232233    {
    233234        mysql_free_result(pres);
    234235
    235         sprintf(&szQuery[0], "INSERT INTO dll(name, type) VALUES('%s', '%c')\n", pszDll, fchType);
     236        sprintf(&szQuery[0], "INSERT INTO module(name, type) VALUES('%s', '%c')\n", pszModule, fchType);
    236237        rc = mysql_query(pmysql, &szQuery[0]);
    237238        if (rc < 0)
     
    239240
    240241        /* select row to get refcode */
    241         sprintf(&szQuery[0], "SELECT refcode, name FROM dll WHERE name = '%s'\n", pszDll);
     242        sprintf(&szQuery[0], "SELECT refcode, name FROM module WHERE name = '%s'\n", pszModule);
    242243        rc   = mysql_query(pmysql, &szQuery[0]);
    243244        pres = mysql_store_result(pmysql);
     
    290291 * The update flags is always updated.
    291292 * @returns     Success indicator. TRUE / FALSE.
    292  * @param       lDll                Dll refcode.
     293 * @param       lModule             Module refcode.
    293294 * @param       pszFunction         Function name.
    294295 * @param       pszIntFunction      Internal function name. (required!)
     
    297298 * @param       fchType             Function type flag. One of the FUNCTION_* defines.
    298299 */
    299 BOOL _System dbInsertUpdateFunction(signed long lDll,
     300BOOL _System dbInsertUpdateFunction(signed long lModule,
    300301                                    const char *pszFunction, const char *pszIntFunction,
    301302                                    unsigned long ulOrdinal, BOOL fIgnoreOrdinal, char fchType)
     
    312313
    313314    /* try find function */
    314     sprintf(pszQuery, "SELECT refcode, intname FROM function WHERE dll = %d AND name = '%s'", lDll, pszFunction);
     315    sprintf(pszQuery, "SELECT refcode, intname FROM function WHERE module = %d AND name = '%s'", lModule, pszFunction);
    315316    rc = mysql_query(pmysql, pszQuery);
    316317    pres = mysql_store_result(pmysql);
     
    322323        if (mysql_num_rows(pres) > 1)
    323324        {
    324             fprintf(stderr, "internal database integrity error(%s): More function by the same name for the same dll. "
    325                     "lDll = %d, pszFunction = %s\n", __FUNCTION__, lDll, pszFunction);
     325            fprintf(stderr, "internal database integrity error(%s): More function by the same name for the same module. "
     326                    "lModule = %d, pszFunction = %s\n", __FUNCTION__, lModule, pszFunction);
    326327            return FALSE;
    327328        }
     
    347348         * Insert it.
    348349         */
    349         sprintf(&szQuery[0], "INSERT INTO function(dll, name, intname, ordinal, updated, type) VALUES(%d, '%s', '%s', %ld, 1, '%c')",
    350                 lDll, pszFunction, pszIntFunction, ulOrdinal, fchType);
     350        sprintf(&szQuery[0], "INSERT INTO function(module, name, intname, ordinal, updated, type) VALUES(%d, '%s', '%s', %ld, 1, '%c')",
     351                lModule, pszFunction, pszIntFunction, ulOrdinal, fchType);
    351352        rc = mysql_query(pmysql, &szQuery[0]);
    352353    }
     
    360361 * Inserts or updates (existing) file information.
    361362 * @returns     Success indicator (TRUE / FALSE).
    362  * @param       lDll           Dll reference code.
     363 * @param       lModule         Module reference code.
    363364 * @param       pszFilename     Filename.
    364365 * @param       pszDescription  Pointer to file description.
     
    369370 * @remark
    370371 */
    371 BOOL            _System dbInsertUpdateFile(signed long lDll,
     372BOOL            _System dbInsertUpdateFile(signed long lModule,
    372373                                           const char *pszFilename,
    373374                                           const char *pszDescription,
     
    382383
    383384    /* parameter assertions */
    384     assert(lDll != 0);
     385    assert(lModule != 0);
    385386    assert(pszFilename != NULL);
    386387    assert(*pszFilename != '\0');
    387388
    388389    /* try find file */
    389     sprintf(&szQuery[0], "SELECT refcode, name FROM file WHERE dll = %d AND name = '%s'", lDll, pszFilename);
     390    sprintf(&szQuery[0], "SELECT refcode, name FROM file WHERE module = %d AND name = '%s'", lModule, pszFilename);
    390391    rc = mysql_query(pmysql, &szQuery[0]);
    391392    pres = mysql_store_result(pmysql);
     
    395396        if (mysql_num_rows(pres) > 1)
    396397        {
    397             fprintf(stderr, "internal database integrity error(%s): More files by the same name in the same dll. "
    398                     "lDll = %d, pszFilename = %s\n", __FUNCTION__, lDll, pszFilename);
     398            fprintf(stderr, "internal database integrity error(%s): More files by the same name in the same module. "
     399                    "lModule = %d, pszFilename = %s\n", __FUNCTION__, lModule, pszFilename);
    399400            return FALSE;
    400401        }
     
    450451    else
    451452    {   /* insert */
    452         sprintf(&szQuery[0], "INSERT INTO file(dll, name, lastauthor, description, lastdatetime, revision) VALUES(%d, '%s', %ld, ",
    453                 lDll, pszFilename, lLastAuthor);
     453        sprintf(&szQuery[0], "INSERT INTO file(module, name, lastauthor, description, lastdatetime, revision) VALUES(%d, '%s', %ld, ",
     454                lModule, pszFilename, lLastAuthor);
    454455        if (pszDescription != NULL && *pszDescription != '\0')
    455456            sqlstrcat(&szQuery[0], NULL, pszDescription);
     
    524525 * @param     pszFunctionName   Pointer to a function name string. (input)
    525526 * @param     pFnFindBuf        Pointer to a find buffer. (output)
    526  * @param     lDll              Dll refcode (optional). If given the search is limited to
    527  *                              the given dll and aliasing functions is updated (slow!).
    528  * @sketch    1) Get functions for this dll(if given).
     527 * @param     lModule           Module refcode (optional). If given the search is limited to
     528 *                              the given module and aliasing functions is updated (slow!).
     529 * @sketch    1) Get functions for this module(if given).
    529530 *            2) Get functions which aliases the functions found in (1).
    530531 *            3) Get new aliases by intname
     
    533534 *            6) Update all functions from (3) and (4) to alias the first function from 1.
    534535 */
    535 BOOL _System dbFindFunction(const char *pszFunctionName, PFNFINDBUF pFnFindBuf, signed long lDll)
     536BOOL _System dbFindFunction(const char *pszFunctionName, PFNFINDBUF pFnFindBuf, signed long lModule)
    536537{
    537538    MYSQL_RES   *pres;
     
    541542
    542543    /*
    543      * 1) Get functions for this dll(if given).
     544     * 1) Get functions for this module(if given).
    544545     */
    545     if (lDll < 0)
    546         sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file, name FROM function WHERE intname = '%s'",
     546    if (lModule < 0)
     547        sprintf(&szQuery[0], "SELECT refcode, module, aliasfn, file, name, type FROM function WHERE intname = '%s'",
    547548                pszFunctionName);
    548549    else
    549         sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file, name FROM function "
    550                 "WHERE intname = '%s' AND dll = %ld",
    551                 pszFunctionName, lDll);
     550        sprintf(&szQuery[0], "SELECT refcode, module, aliasfn, file, name, type FROM function "
     551                "WHERE intname = '%s' AND module = %ld",
     552                pszFunctionName, lModule);
    552553
    553554    rc = mysql_query1(pmysql, &szQuery[0]);
     
    558559        {
    559560            char szFnName[NBR_FUNCTIONS][80];
     561            BOOL fAPI = FALSE;
    560562
    561563            pFnFindBuf->cFns = 0;
     
    563565            {
    564566                pFnFindBuf->alRefCode[pFnFindBuf->cFns] = atol(row[0]);
    565                 pFnFindBuf->alDllRefCode[pFnFindBuf->cFns] = atol(row[1]);
     567                pFnFindBuf->alModRefCode[pFnFindBuf->cFns] = atol(row[1]);
    566568                pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = atol(row[2]);
    567569                pFnFindBuf->alFileRefCode[pFnFindBuf->cFns] = atol(row[3]);
    568570                strcpy(szFnName[pFnFindBuf->cFns], row[4]);
     571                pFnFindBuf->achType[pFnFindBuf->cFns] = *row[5];
     572                if (pFnFindBuf->achType[pFnFindBuf->cFns] == FUNCTION_ODIN32_API ||
     573                    pFnFindBuf->achType[pFnFindBuf->cFns] == FUNCTION_INTERNAL_ODIN32_API)
     574                    fAPI = TRUE;
    569575
    570576                /* next */
     
    573579            mysql_free_result(pres);
    574580
    575             /* alias check and fix */
    576             if (lDll >= 0 && pFnFindBuf->cFns != 0)
     581            /* alias check and fix for apis. */
     582            if (fAPI && lModule >= 0 && pFnFindBuf->cFns != 0)
    577583            {
    578                 int cFnsThisDll, cFnsAliasesAndThisDll, i, f;
     584                int cFnsThisModule, cFnsAliasesAndThisModule, i, f;
    579585
    580586                /*
    581587                 * 2) Get functions which aliases the functions found in (1).
    582588                 */
    583                 cFnsThisDll = (int)pFnFindBuf->cFns;
    584                 strcpy(&szQuery[0], "SELECT refcode, dll, aliasfn, file, name FROM function WHERE aliasfn IN (");
    585                 for (i = 0; i < cFnsThisDll; i++)
     589                cFnsThisModule = (int)pFnFindBuf->cFns;
     590                strcpy(&szQuery[0], "SELECT refcode, module, aliasfn, file, name FROM function WHERE aliasfn IN (");
     591                for (i = 0; i < cFnsThisModule; i++)
    586592                {
    587593                    if (i > 0)  strcat(&szQuery[0], " OR ");
     
    599605                        {
    600606                            pFnFindBuf->alRefCode[pFnFindBuf->cFns] = atol(row[0]);
    601                             pFnFindBuf->alDllRefCode[pFnFindBuf->cFns] = atol(row[1]);
     607                            pFnFindBuf->alModRefCode[pFnFindBuf->cFns] = atol(row[1]);
    602608                            pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = atol(row[2]);
    603609                            pFnFindBuf->alFileRefCode[pFnFindBuf->cFns] = atol(row[3]);
     
    612618                         * 3) Get new aliases by intname
    613619                         */
    614                         cFnsAliasesAndThisDll = (int)pFnFindBuf->cFns;
    615                         sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file FROM function "
    616                                              "WHERE aliasfn = (-1) AND dll <> %ld AND (intname = '%s'",
    617                                 lDll, pszFunctionName);
    618                         for (i = 0; i < cFnsAliasesAndThisDll; i++)
     620                        cFnsAliasesAndThisModule = (int)pFnFindBuf->cFns;
     621                        sprintf(&szQuery[0], "SELECT refcode, module, aliasfn, file FROM function "
     622                                             "WHERE aliasfn = (-1) AND module <> %ld AND (intname = '%s'",
     623                                lModule, pszFunctionName);
     624                        for (i = 0; i < cFnsAliasesAndThisModule; i++)
    619625                            sprintf(&szQuery[strlen(&szQuery[0])], " OR intname = '%s'", szFnName[i]);
    620626                        strcat(&szQuery[0], ")");
     
    629635                                {
    630636                                    pFnFindBuf->alRefCode[pFnFindBuf->cFns] = atol(row[0]);
    631                                     pFnFindBuf->alDllRefCode[pFnFindBuf->cFns] = atol(row[1]);
     637                                    pFnFindBuf->alModRefCode[pFnFindBuf->cFns] = atol(row[1]);
    632638                                    if (row[2] != NULL)
    633639                                        pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = atol(row[2]);
     
    645651                                 * 4) Get new aliases by name
    646652                                 */
    647                                 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file FROM function "
    648                                                      "WHERE aliasfn = (-1) AND dll <> %ld AND (name = '%s'",
    649                                         lDll, pszFunctionName);
    650                                 for (i = 0; i < cFnsAliasesAndThisDll; i++)
     653                                sprintf(&szQuery[0], "SELECT refcode, module, aliasfn, file FROM function "
     654                                                     "WHERE aliasfn = (-1) AND module <> %ld AND (name = '%s'",
     655                                        lModule, pszFunctionName);
     656                                for (i = 0; i < cFnsAliasesAndThisModule; i++)
    651657                                    sprintf(&szQuery[strlen(&szQuery[0])], " OR name = '%s'", szFnName[i]);
    652658                                strcat(&szQuery[0], ")");
     
    661667                                        {
    662668                                            pFnFindBuf->alRefCode[pFnFindBuf->cFns] = atol(row[0]);
    663                                             pFnFindBuf->alDllRefCode[pFnFindBuf->cFns] = atol(row[1]);
     669                                            pFnFindBuf->alModRefCode[pFnFindBuf->cFns] = atol(row[1]);
    664670                                            if (row[2] != NULL)
    665671                                                pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = atol(row[2]);
     
    678684                                        sprintf(&szQuery[0], "UPDATE function SET aliasfn = (-2) "
    679685                                                             "WHERE refcode IN (",
    680                                                 lDll, pszFunctionName);
    681                                         for (f = 0, i = 0; i < cFnsThisDll; i++)
     686                                                lModule, pszFunctionName);
     687                                        for (f = 0, i = 0; i < cFnsThisModule; i++)
    682688                                            if (pFnFindBuf->alAliasFn[i] != ALIAS_DONTMIND)
    683689                                                sprintf(&szQuery[strlen(&szQuery[0])],
     
    688694                                        else
    689695                                            rc = 0;
    690                                         if (rc >= 0 && cFnsAliasesAndThisDll < pFnFindBuf->cFns)
     696                                        if (rc >= 0 && cFnsAliasesAndThisModule < pFnFindBuf->cFns)
    691697                                        {
    692698                                            /*
     
    696702                                                                 "WHERE aliasfn = (-1) AND refcode IN (",
    697703                                                    pFnFindBuf->alRefCode[0], pFnFindBuf->alFileRefCode[0]);
    698                                             for (i = cFnsAliasesAndThisDll; i < pFnFindBuf->cFns; i++)
     704                                            for (i = cFnsAliasesAndThisModule; i < pFnFindBuf->cFns; i++)
    699705                                            {
    700706                                                sprintf(&szQuery[strlen(&szQuery[0])],
    701                                                         i > cFnsAliasesAndThisDll ? ", %ld" : "%ld", pFnFindBuf->alRefCode[i]);
     707                                                        i > cFnsAliasesAndThisModule ? ", %ld" : "%ld", pFnFindBuf->alRefCode[i]);
    702708                                            }
    703709                                            strcat(&szQuery[0], ")");
     
    722728/**
    723729 * Finds the refcode for a file (if it exists).
    724  * @returns     File 'refcode'.
    725  *              -1 on error or not found.
    726  * @param       lDll            Refcode of the dll which this file belongs to.
    727  * @param       pszFilename     The filename to search for.
    728  */
    729 signed long     _System dbFindFile(signed long lDll, const char *pszFilename)
     730 * @returns File 'refcode'.
     731 *          -1 on error or not found.
     732 * @param   lModule         Refcode of the module which this file belongs to.
     733 * @param   pszFilename     The filename to search for.
     734 */
     735signed long     _System dbFindFile(signed long lModule, const char *pszFilename)
    730736{
    731737    char        szQuery[256];
     
    733739    signed long lRefCode = -1;
    734740
    735     assert(lDll >= 0);
     741    assert(lModule >= 0);
    736742    assert(pszFilename != NULL);
    737743    assert(*pszFilename != '\0');
    738744
    739     sprintf(&szQuery[0], "SELECT refcode FROM file WHERE dll = %ld AND name = '%s'",
    740             lDll, pszFilename);
     745    sprintf(&szQuery[0], "SELECT refcode FROM file WHERE module = %ld AND name = '%s'",
     746            lModule, pszFilename);
    741747    if (mysql_query(pmysql, &szQuery[0]) >= 0)
    742748    {
     
    878884 * @returns   number of errors.
    879885 * @param     pFnDesc   Function description struct.
    880  * @param     lDll      Dll which we are working at.
     886 * @param     lModule   Module which we are working at.
    881887 * @param     pszError  Buffer for error messages
    882888 * @result    on error(s) pszError will hold information about the error(s).
    883889 */
    884 unsigned long _System dbUpdateFunction(PFNDESC pFnDesc, signed long lDll, char *pszError)
     890unsigned long _System dbUpdateFunction(PFNDESC pFnDesc, signed long lModule, char *pszError)
    885891{
    886892    MYSQL_RES *     pres;
     
    11401146    } /* for */
    11411147
    1142     lDll = lDll;
     1148    lModule = lModule;
    11431149    free(pszQuery2);
    11441150    return ulRc;
     
    11481154/**
    11491155 * Removes all the existing design notes in the specified file.
    1150  * @returns     Success indicator.
    1151  * @param       lFile       File refcode of the file to remove all design notes for.
    1152  * @sketch
    1153  * @status
    1154  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
    1155  * @remark
     1156 * @returns Success indicator.
     1157 * @param   lFile       File refcode of the file to remove all design notes for.
     1158 * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
    11561159 */
    11571160BOOL            _System dbRemoveDesignNotes(signed long lFile)
     
    11681171 * Adds a design note.
    11691172 * @returns     Success indicator.
    1170  * @param       lDll            Dll refcode.
     1173 * @param       lModule         Module refcode.
    11711174 * @param       lFile           File refcode.
    11721175 * @param       pszTitle        Design note title.
    11731176 * @param       pszText         Design note text.
    11741177 * @param       lLevel          Level of the note section. 0 is the design note it self.
    1175  * @param       lSeqNbr         Sequence number (in dll). If 0 the use next available number.
     1178 * @param       lSeqNbr         Sequence number (in module). If 0 the use next available number.
    11761179 * @param       lSeqNbrNote     Sequence number in note.
    11771180 * @param       lLine           Line number (1 - based!).
     
    11811184 * @param       plRefCode       Pointer to reference id of the design note. see fSubSection for more info.
    11821185 */
    1183 BOOL            _System dbAddDesignNote(signed long lDll,
     1186BOOL            _System dbAddDesignNote(signed long lModule,
    11841187                                        signed long lFile,
    11851188                                        const char *pszTitle,
     
    11971200
    11981201
    1199     assert(lDll >= 0 && lFile >= 0);
     1202    assert(lModule >= 0 && lFile >= 0);
    12001203    assert(lSeqNbrNote >= 0);
    12011204
     
    12051208    if (lSeqNbr == 0 && !fSubSection)
    12061209    {
    1207         sprintf(&szQuery[0], "SELECT MAX(seqnbr) + 1 FROM designnote WHERE dll = %ld AND level = 0", lDll);
     1210        sprintf(&szQuery[0], "SELECT MAX(seqnbr) + 1 FROM designnote WHERE module = %ld AND level = 0", lModule);
    12081211        if (mysql_query(pmysql, &szQuery[0]) >= 0)
    12091212        {
     
    12291232     */
    12301233    if (!fSubSection)
    1231         sprintf(&szQuery[0], "INSERT INTO designnote(dll, file, level, seqnbrnote, seqnbr, line, name, note) "
     1234        sprintf(&szQuery[0], "INSERT INTO designnote(module, file, level, seqnbrnote, seqnbr, line, name, note) "
    12321235                             "VALUES (%ld, %ld, %ld, %ld, %ld, %ld, ",
    1233                 lDll, lFile, lLevel, lSeqNbrNote, lSeqNbr, lLine);
     1236                lModule, lFile, lLevel, lSeqNbrNote, lSeqNbr, lLine);
    12341237    else
    1235         sprintf(&szQuery[0], "INSERT INTO designnote(refcode, dll, file, level, seqnbrnote, seqnbr, line, name, note) "
     1238        sprintf(&szQuery[0], "INSERT INTO designnote(refcode, module, file, level, seqnbrnote, seqnbr, line, name, note) "
    12361239                             "VALUES (%ld, %ld, %ld, %ld, %ld, %ld, %ld, ",
    1237                 *plRefCode, lDll, lFile, lLevel, lSeqNbrNote, lSeqNbr, lLine);
     1240                *plRefCode, lModule, lFile, lLevel, lSeqNbrNote, lSeqNbr, lLine);
    12381241
    12391242    if (pszTitle != NULL && *pszTitle != '\0')
     
    12861289
    12871290            /* delete - all rows on this date in the history tables */
    1288             sprintf(pszQuery, "DELETE FROM historydll WHERE date = '%s'", &szCurDt[0]);
     1291            sprintf(pszQuery, "DELETE FROM historymodule WHERE date = '%s'", &szCurDt[0]);
    12891292            rc = mysql_query(pmysql, pszQuery);
    12901293            CheckLogContinue((pszError, "error removing old history rows: %s - (sql=%s) ", dbGetLastErrorDesc(), pszQuery));
     
    12941297            CheckLogContinue((pszError, "error removing old history rows: %s - (sql=%s) ", dbGetLastErrorDesc(), pszQuery));
    12951298
    1296             sprintf(pszQuery, "DELETE FROM historydlltotal WHERE date = '%s'", &szCurDt[0]);
     1299            sprintf(pszQuery, "DELETE FROM historymoduletotal WHERE date = '%s'", &szCurDt[0]);
    12971300            rc = mysql_query(pmysql, pszQuery);
    12981301            CheckLogContinue((pszError, "error removing old history rows: %s - (sql=%s) ", dbGetLastErrorDesc(), pszQuery));
     
    13021305
    13031306            /* insert new stats */
    1304             sprintf(pszQuery, "INSERT INTO historydll(dll, state, date, count) "
    1305                     "SELECT dll, state, '%s', count(*) FROM function GROUP BY dll, state",
     1307            sprintf(pszQuery, "INSERT INTO historymodule(module, state, date, count, type) "
     1308                    "SELECT module, state, '%s', count(*), type FROM function GROUP BY module, state, type",
    13061309                    &szCurDt[0]);
    13071310            rc = mysql_query(pmysql, pszQuery);
     
    13161319
    13171320            /* inserting new totals */
    1318             sprintf(pszQuery, "INSERT INTO historydlltotal(dll, date, totalcount) "
    1319                     "SELECT dll, '%s', count(*) FROM function GROUP BY dll",
     1321            sprintf(pszQuery, "INSERT INTO historymoduletotal(module, date, totalcount, type) "
     1322                    "SELECT module, '%s', count(*), type FROM function GROUP BY module, type",
    13201323                    &szCurDt[0]);
    13211324            rc = mysql_query(pmysql, pszQuery);
     
    13231326
    13241327            sprintf(pszQuery, "INSERT INTO historyapigrouptotal(apigroup, date, totalcount) "
    1325                     "SELECT apigroup, '%s', count(*) FROM function WHERE apigroup IS NOT NULL "
     1328                    "SELECT apigroup, '%s', count(*) FROM function WHERE apigroup IS NOT NULL AND type = 'A' "
    13261329                    "GROUP BY apigroup",
    13271330                    &szCurDt[0]);
     
    13691372
    13701373    /* foreign keys in function table */
    1371     strcpy(pszQuery, "SELECT refcode, dll, state, apigroup, file FROM function");
     1374    strcpy(pszQuery, "SELECT refcode, module, state, apigroup, file FROM function");
    13721375    rc = mysql_query(pmysql, pszQuery);
    13731376    if (rc >= 0)
     
    13781381            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    13791382            {
    1380                 /* check dll */
    1381                 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]);
     1383                /* check module */
     1384                sprintf(pszQuery, "SELECT refcode FROM module WHERE refcode = %s", row1[1]);
    13821385                rc = mysql_query(pmysql, pszQuery);
    1383                 CheckFKError("function/dll", "Foreign key 'dll' not found in the dll table");
     1386                CheckFKError("function/module", "Foreign key 'module' not found in the module table");
    13841387
    13851388                /* check state */
     
    14111414
    14121415    /* foreign keys in file */
    1413     strcpy(pszQuery, "SELECT refcode, dll FROM file");
     1416    strcpy(pszQuery, "SELECT refcode, module FROM file");
    14141417    rc = mysql_query(pmysql, pszQuery);
    14151418    if (rc >= 0)
     
    14201423            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    14211424            {
    1422                 /* check dll */
    1423                 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]);
     1425                /* check module */
     1426                sprintf(pszQuery, "SELECT refcode FROM module WHERE refcode = %s", row1[1]);
    14241427                rc = mysql_query(pmysql, pszQuery);
    1425                 CheckFKError("apigroup/dll", "Foreign key 'dll' not found in the dll table");
     1428                CheckFKError("apigroup/module", "Foreign key 'module' not found in the module table");
    14261429            }
    14271430            mysql_free_result(pres1);
     
    14321435
    14331436    /* foreign keys in apigroup */
    1434     strcpy(pszQuery, "SELECT refcode, dll FROM apigroup");
     1437    strcpy(pszQuery, "SELECT refcode, module FROM apigroup");
    14351438    rc = mysql_query(pmysql, pszQuery);
    14361439    if (rc >= 0)
     
    14411444            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    14421445            {
    1443                 /* check dll */
    1444                 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]);
     1446                /* check module */
     1447                sprintf(pszQuery, "SELECT refcode FROM module WHERE refcode = %s", row1[1]);
    14451448                rc = mysql_query(pmysql, pszQuery);
    1446                 CheckFKError("file/dll", "Foreign key 'dll' not found in the dll table");
     1449                CheckFKError("file/module", "Foreign key 'module' not found in the module table");
    14471450            }
    14481451            mysql_free_result(pres1);
     
    14781481        ulRc += logDbError(pszError, pszQuery);
    14791482
    1480     /* foreign keys in historydll table */
    1481     strcpy(pszQuery, "SELECT date, dll, state FROM historydll");
     1483    /* foreign keys in historymodule table */
     1484    strcpy(pszQuery, "SELECT date, module, state FROM historymodule");
    14821485    rc = mysql_query(pmysql, pszQuery);
    14831486    if (rc >= 0)
     
    14881491            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    14891492            {
    1490                 /* check dll */
    1491                 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]);
     1493                /* check module */
     1494                sprintf(pszQuery, "SELECT refcode FROM module WHERE refcode = %s", row1[1]);
    14921495                rc = mysql_query(pmysql, pszQuery);
    1493                 CheckFKError("historydll/dll", "Foreign key 'dll' not found in the dll table");
     1496                CheckFKError("historymodule/module", "Foreign key 'module' not found in the module table");
    14941497
    14951498                /* check state */
    14961499                sprintf(pszQuery, "SELECT refcode FROM state WHERE refcode = %s", row1[2]);
    14971500                rc = mysql_query(pmysql, pszQuery);
    1498                 CheckFKError("historydll/state", "Foreign key 'state' not found in the state table");
     1501                CheckFKError("historymodule/state", "Foreign key 'state' not found in the state table");
    14991502            }
    15001503            mysql_free_result(pres1);
     
    15141517            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    15151518            {
    1516                 /* check dll */
     1519                /* check module */
    15171520                sprintf(pszQuery, "SELECT refcode FROM apigroup WHERE refcode = %s", row1[1]);
    15181521                rc = mysql_query(pmysql, pszQuery);
     
    15301533        ulRc += logDbError(pszError, pszQuery);
    15311534
    1532     /* foreign keys in historydlltotal table */
    1533     strcpy(pszQuery, "SELECT date, dll FROM historydlltotal");
     1535    /* foreign keys in historymoduletotal table */
     1536    strcpy(pszQuery, "SELECT date, module FROM historymoduletotal");
    15341537    rc = mysql_query(pmysql, pszQuery);
    15351538    if (rc >= 0)
     
    15401543            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    15411544            {
    1542                 /* check dll */
    1543                 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]);
     1545                /* check module */
     1546                sprintf(pszQuery, "SELECT refcode FROM module WHERE refcode = %s", row1[1]);
    15441547                rc = mysql_query(pmysql, pszQuery);
    1545                 CheckFKError("historydlltotal/dll", "Foreign key 'dll' not found in the dll table");
     1548                CheckFKError("historymoduletotal/module", "Foreign key 'module' not found in the module table");
    15461549            }
    15471550            mysql_free_result(pres1);
     
    15611564            while ((row1 = mysql_fetch_row(pres1)) != NULL)
    15621565            {
    1563                 /* check dll */
     1566                /* check module */
    15641567                sprintf(pszQuery, "SELECT refcode FROM apigroup WHERE refcode = %s", row1[1]);
    15651568                rc = mysql_query(pmysql, pszQuery);
     
    18551858
    18561859/**
    1857  * Display all functions for, the given dll, that is not updated.
     1860 * Display all functions for, the given module, that is not updated.
    18581861 * @returns   TRUE / FALSE.
    1859  * @param     lDll         Dll reference number.
     1862 * @param     lModule      Module reference number.
    18601863 * @param     dbFetchCall  Callback function which will be called once for each
    18611864 *                         field for all the functions not updated.
    18621865 *                         pvUser is NULL, pszValue field value, pszFieldName the field name.
    18631866 */
    1864 BOOL _System dbGetNotUpdatedFunction(signed long lDll, DBCALLBACKFETCH dbFetchCallBack)
     1867BOOL _System dbGetNotUpdatedFunction(signed long lModule, DBCALLBACKFETCH dbFetchCallBack)
    18651868{
    18661869    BOOL        fRet = FALSE;
     
    18711874    sprintf(&szQuery[0], "SELECT f1.name, f1.intname, f1.updated, f1.aliasfn, d.name, f2.name, f2.intname AS last "
    18721875                         "FROM function f1 LEFT OUTER JOIN function f2 ON f1.aliasfn = f2.refcode "
    1873                          "     LEFT JOIN dll d ON f2.dll = d.refcode "
    1874                          "WHERE f1.dll = %ld AND f1.updated = 0",
    1875             lDll);
     1876                         "     LEFT JOIN module d ON f2.module = d.refcode "
     1877                         "WHERE f1.module = %ld AND f1.updated = 0",
     1878            lModule);
    18761879    pres = dbExecuteQuery(szQuery);
    18771880    if (pres != NULL)
     
    18891892    sprintf(&szQuery[0], "SELECT f1.name, f1.intname, f1.updated, f1.aliasfn, d.name, f2.name, f2.intname AS last "
    18901893                         "FROM function f1 LEFT OUTER JOIN function f2 ON f1.aliasfn = f2.refcode "
    1891                          "     LEFT JOIN dll d ON f2.dll = d.refcode "
    1892                          "WHERE f1.dll = %ld AND f1.updated > 1",
    1893             lDll);
     1894                         "     LEFT JOIN module d ON f2.module = d.refcode "
     1895                         "WHERE f1.module = %ld AND f1.updated > 1",
     1896            lModule);
    18941897    pres = dbExecuteQuery(szQuery);
    18951898    if (pres != NULL)
     
    19121915
    19131916/**
    1914  * Counts the function for the given DLL which has been updated.
    1915  * @returns   -1 on error, number of updated function on success.
    1916  * @param     lDll         Dll reference number.
    1917  */
    1918 signed long _System dbGetNumberOfUpdatedFunction(signed long lDll)
     1917 * Counts the function for the given MODULE which has been updated.
     1918 * @returns -1 on error, number of updated function on success.
     1919 * @param   lModule     Module reference number.
     1920 */
     1921signed long _System dbGetNumberOfUpdatedFunction(signed long lModule)
    19191922{
    19201923    int         rc;
     
    19221925    MYSQL_RES * pres;
    19231926
    1924     sprintf(&szQuery[0], "SELECT count(*) FROM function WHERE dll = (%ld) AND updated > 0\n", lDll);
     1927    sprintf(&szQuery[0], "SELECT count(*) FROM function WHERE module = (%ld) AND updated > 0\n", lModule);
    19251928    rc   = mysql_query(pmysql, &szQuery[0]);
    19261929    pres = mysql_store_result(pmysql);
     
    19361939
    19371940/**
    1938  * Clear the update flags for all file in a dll/module.
    1939  * @returns     Success indicator. (TRUE / FALSE)
    1940  * @param       lDll    Dll refcode.
    1941  * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    1942  * @remark      Intended for use by APIImport.
    1943  */
    1944 BOOL             _System dbClearUpdateFlagFile(signed long lDll)
     1941 * Clear the update flags for all file in a module/module.
     1942 * @returns Success indicator. (TRUE / FALSE)
     1943 * @param   lModule     Module refcode.
     1944 * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     1945 * @remark  Intended for use by APIImport.
     1946 */
     1947BOOL             _System dbClearUpdateFlagFile(signed long lModule)
    19451948{
    19461949    int         rc;
     
    19481951
    19491952    sprintf(&szQuery[0],
    1950             "UPDATE file SET updated = 0 WHERE dll = (%ld)",
    1951             lDll);
     1953            "UPDATE file SET updated = 0 WHERE module = (%ld)",
     1954            lModule);
    19521955    rc = mysql_query(pmysql, &szQuery[0]);
    19531956    return rc == 0;
     
    19571960/**
    19581961 * Clear update flag
    1959  * @returns     Success indicator.
    1960  * @param       lDll    Dll refcode.
    1961  * @param       fAll    All dll. If false only APIs and Internal APIs are cleared
    1962  * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    1963  * @remark      Intended for use by APIImport.
    1964  */
    1965 BOOL             _System dbClearUpdateFlagFunction(signed long lDll, BOOL fAll)
     1962 * @returns Success indicator.
     1963 * @param   lModule Module refcode.
     1964 * @param   fAll    All module. If false only APIs and Internal APIs are cleared
     1965 * @author  knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     1966 * @remark  Intended for use by APIImport.
     1967 */
     1968BOOL             _System dbClearUpdateFlagFunction(signed long lModule, BOOL fAll)
    19661969{
    19671970    int         rc;
     
    19691972
    19701973    sprintf(&szQuery[0],
    1971             "UPDATE function SET updated = 0 WHERE dll = (%ld)",
    1972             lDll);
     1974            "UPDATE function SET updated = 0 WHERE module = (%ld)",
     1975            lModule);
    19731976    if (!fAll)
    19741977        strcat(&szQuery[0], " AND type IN ('A', 'I')");
     
    19801983
    19811984/**
    1982  * Deletes all the files in a dll/module which was not found/updated.
     1985 * Deletes all the files in a module/module which was not found/updated.
    19831986 * @returns     Success indicator.
    1984  * @param       lDll    Dll refcode.
     1987 * @param       lModule    Module refcode.
    19851988 * @sketch      Select all files which is to be deleted.
    19861989 *                  Set all references to each file in function to -1.
     
    19891992 * @remark      Use with GRATE CARE!
    19901993 */
    1991 BOOL             _System dbDeleteNotUpdatedFiles(signed long lDll)
     1994BOOL             _System dbDeleteNotUpdatedFiles(signed long lModule)
    19921995{
    19931996    MYSQL_RES * pres;
     
    19972000
    19982001    sprintf(&szQuery[0],
    1999             "SELECT refcode FROM file WHERE dll = (%ld) AND updated = 0",
    2000             lDll);
     2002            "SELECT refcode FROM file WHERE module = (%ld) AND updated = 0",
     2003            lModule);
    20012004    rc = mysql_query(pmysql, &szQuery[0]);
    20022005    pres = mysql_store_result(pmysql);
     
    20152018
    20162019    sprintf(&szQuery[0],
    2017             "DELETE FROM file WHERE dll = %ld AND updated = 0",
    2018             lDll);
     2020            "DELETE FROM file WHERE module = %ld AND updated = 0",
     2021            lModule);
    20192022    rc = mysql_query(pmysql, &szQuery[0]);
    20202023    if (rc) fRc = FALSE;
     
    20302033 *
    20312034 * @returns     Success indicator. (TRUE / FALSE)
    2032  * @param       lDll    The refcode of the dll owning the functions.
    2033  * @param       fAll    All function. If FALSE then only APIs and Internal APIs.
    2034  * @sketch      Select all functions which wan't updated (ie. updated = 0 and dll = lDll).
     2035 * @param       lModule     The refcode of the module owning the functions.
     2036 * @param       fAll        All function. If FALSE then only APIs and Internal APIs.
     2037 * @sketch      Select all functions which wan't updated (ie. updated = 0 and module = lModule).
    20352038 *              If anyone Then
    20362039 *                  Delete the referenced to the functions in:
     
    20412044 * @remark      Use with GREATE CARE!
    20422045 */
    2043 BOOL             _System dbDeleteNotUpdatedFunctions(signed long lDll, BOOL fAll)
     2046BOOL             _System dbDeleteNotUpdatedFunctions(signed long lModule, BOOL fAll)
    20442047{
    20452048    MYSQL_RES * pres;
     
    20492052
    20502053    sprintf(&szQuery[0],
    2051             "SELECT refcode FROM function WHERE dll = %ld AND updated = 0",
    2052             lDll);
     2054            "SELECT refcode FROM function WHERE module = %ld AND updated = 0",
     2055            lModule);
    20532056    if (!fAll)
    20542057        strcat(&szQuery[0], " AND type IN ('A', 'I')");
     
    20812084        {
    20822085            sprintf(&szQuery[0],
    2083                     "DELETE FROM function WHERE dll = %ld AND updated = 0",
    2084                     lDll);
     2086                    "DELETE FROM function WHERE module = %ld AND updated = 0",
     2087                    lModule);
    20852088            if (!fAll)
    20862089                strcat(&szQuery[0], " AND type IN ('A', 'I')");
  • trunk/tools/database/db.h

    r6663 r6677  
    1 /* $Id: db.h,v 1.14 2001-09-06 03:07:32 bird Exp $ */
     1/* $Id: db.h,v 1.15 2001-09-07 10:24:07 bird Exp $ */
    22/*
    33 * DB - contains all database routines
     
    2929#define FUNCTION_ODIN32_API             'A' /* for Odin32 APIs (ie. LoadLibrary) */
    3030#define FUNCTION_INTERNAL_ODIN32_API    'I' /* for Internal/Additional Odin32 APIs (ie. RegisterLxExe) */
    31 #define FUNCTION_OTHER                  'O' /* for all other functions (ie. OSLibInitWSeBFileIO) */
     31#define FUNCTION_OTHER                  'F' /* for all other functions (ie. OSLibInitWSeBFileIO) */
     32#define FUNCTION_METHOD                 'M'
     33#define FUNCTION_OPERATOR               'O'
     34#define FUNCTION_CONSTRUCTOR            'C'
     35#define FUNCTION_DESTRUCTOR             'D'
    3236
    3337/* type flags of dll */
     
    4953        /* function name and type */
    5054        char *      pszName;
     55        char *      pszClass;
     56        char        fchType;            /* function type. */
    5157        char *      pszReturnType;
    5258        long        cRefCodes;
     
    8995        unsigned long   cFns;
    9096        signed long     alRefCode[NBR_FUNCTIONS];
    91         signed long     alDllRefCode[NBR_FUNCTIONS];
     97        signed long     alModRefCode[NBR_FUNCTIONS];
    9298        signed long     alAliasFn[NBR_FUNCTIONS];     /* -1 is SQL-NULL, -2 is "do not mind", >= 0 ref to function. */
    9399        signed long     alFileRefCode[NBR_FUNCTIONS]; /* -1 is SQL-NULL, -2 is "do not mind", >= 0 ref to file. */
     100        char            achType[NBR_FUNCTIONS];
    94101    } FNFINDBUF, *PFNFINDBUF;
    95102
     
    106113                                       const char *pszDatabase);
    107114    BOOL             _System dbDisconnect();
    108     signed long      _System dbGetDll(const char *pszDllName);
    109     signed long      _System dbCountFunctionInDll(signed long ulDll,
    110                                                   BOOL fNotAliases);
    111     signed long      _System dbCheckInsertDll(const char *pszDll, char fchType);
     115    signed long      _System dbGetModule(const char *pszModName);
     116    signed long      _System dbCountFunctionInModule(signed long lModule,
     117                                                     BOOL fNotAliases);
     118    //signed long      _System dbCheckInsertDll(const char *pszDll, char fchType);
     119    signed long      _System dbCheckInsertModule(const char *pszModule, char fchType);
    112120    unsigned short   _System dbGet(const char *pszTable,
    113121                                   const char *pszGetColumn,
    114122                                   const char *pszMatch1,
    115123                                   const char *pszMatchValue1);
    116     BOOL             _System dbInsertUpdateFunction(signed long lDll,
     124    BOOL             _System dbInsertUpdateFunction(signed long lModule,
    117125                                                    const char *pszFunction,
    118126                                                    const char *pszIntFunction,
     
    120128                                                    BOOL fIgnoreOrdinal,
    121129                                                    char fchType);
    122     BOOL             _System dbInsertUpdateFile(signed long lDll,
     130    BOOL             _System dbInsertUpdateFile(signed long lModule,
    123131                                                const char *pszFilename,
    124132                                                const char *pszDescription,
     
    128136    BOOL             _System dbFindFunction(const char *pszFunctionName,
    129137                                            PFNFINDBUF pFnFindBuf,
    130                                             signed long lDll);
    131     signed long      _System dbFindFile(signed long lDll, const char *pszFilename);
     138                                            signed long lModule);
     139    signed long      _System dbFindFile(signed long lModule, const char *pszFilename);
    132140    signed long      _System dbFindAuthor(const char *pszAuthor, const char *pszEmail);
    133141    signed long      _System dbGetFunctionState(signed long lRefCode);
    134142    unsigned long    _System dbUpdateFunction(PFNDESC pFnDesc,
    135                                               signed long lDll,
     143                                              signed long lModule,
    136144                                              char *pszError);
    137145    BOOL             _System dbRemoveDesignNotes(signed long lFile);
    138     BOOL             _System dbAddDesignNote(signed long lDll,
     146    BOOL             _System dbAddDesignNote(signed long lModule,
    139147                                             signed long lFile,
    140148                                             const char *pszTitle,
     
    160168                                                    char *pszDate);
    161169    /* StateUpd stuff */
    162     BOOL             _System dbGetNotUpdatedFunction(signed long lDll,
     170    BOOL             _System dbGetNotUpdatedFunction(signed long lModule,
    163171                                                     DBCALLBACKFETCH dbFetchCallBack);
    164     signed long      _System dbGetNumberOfUpdatedFunction(signed long lDll);
     172    signed long      _System dbGetNumberOfUpdatedFunction(signed long lModule);
    165173
    166174    /* APIImport stuff */
    167     BOOL             _System dbClearUpdateFlagFile(signed long lDll);
    168     BOOL             _System dbClearUpdateFlagFunction(signed long lDll, BOOL fAll);
    169     BOOL             _System dbDeleteNotUpdatedFiles(signed long lDll);
    170     BOOL             _System dbDeleteNotUpdatedFunctions(signed long lDll, BOOL fAll);
     175    BOOL             _System dbClearUpdateFlagFile(signed long lModule);
     176    BOOL             _System dbClearUpdateFlagFunction(signed long lModule, BOOL fAll);
     177    BOOL             _System dbDeleteNotUpdatedFiles(signed long lModule);
     178    BOOL             _System dbDeleteNotUpdatedFunctions(signed long lModule, BOOL fAll);
    171179
    172180#ifdef __cplusplus
  • trunk/tools/database/www/Odin32DB.phtml

    r6662 r6677  
    3131 * What are we up to? We'll parse the input parameter (if any) to find out.
    3232 */
    33 if (isset($dllrefcode))
    34 {   /* DLLs by refcode */
    35     $sCategory      = "dll";
    36     $sCategoryName  = "Dll";
    37     if ($dllrefcode != "")
    38         $iRefcode = (int)$dllrefcode;
     33if (isset($modrefcode))
     34{   /* Modules by refcode */
     35    $sCategory      = "module";
     36    $sCategoryName  = "Module";
     37    if ($modrefcode != "")
     38        $iRefcode = (int)$modrefcode;
    3939    $fFunctions = (isset($fFunctions)   && $fFunctions  != '0');
    4040    $fFiles     = (isset($fFiles)       && $fFiles      != '0');
     
    7878    if ($authorrefcode != "")
    7979        $iRefcode = (int)$authorrefcode;
    80     $fDlls      = (isset($fDlls)        && $fDlls  != '0');
     80    $fModules   = (isset($fModules)     && $fModules    != '0');
    8181    $fFunctions = (isset($fFunctions)   && $fFunctions  != '0');
    8282    $fFiles     = (isset($fFiles)       && $fFiles      != '0');
    8383    $fAPIGroups = (isset($fAPIGroups)   && $fAPIGroups  != '0');
    8484    $fSortByState=(isset($fSortByState) && $fSortByState!= '0');
    85     if (!(isset($authordll) && $authordll != "" && @(int)$authordll >= 0))
    86         $authordll = -1;
     85    if (!(isset($authormod) && $authormod != "" && @(int)$authormod >= 0))
     86        $authormod = -1;
    8787}
    8888else if (isset($designnoterefcode))
     
    9595else if (isset($dlls))
    9696{   /* All dlls */
    97     $sCategory      = "dlls";
     97    $sCategory      = "modules";
    9898    $sCategoryName  = "All Dlls";
    99     $sDllType = 'A';
     99    $sModType = 'A';
    100100}
    101101else if (isset($internal))
    102 {   /* All Internal Dlls */
    103     $sCategory      = "dlls";
     102{   /* All Internal Modules */
     103    $sCategory      = "modules";
    104104    $sCategoryName  = "Internal Dlls";
    105     $sDllType = 'I';
     105    $sModType = 'I';
    106106}
    107107else if (isset($support))
    108 {   /* All dlls */
    109     $sCategory      = "dlls";
     108{   /* All Suppors Stuff */
     109    $sCategory      = "modules";
    110110    $sCategoryName  = "Support Stuff";
    111     $sDllType = 'S';
     111    $sModType = 'S';
    112112}
    113113else if (isset($tools))
    114114{   /* Tools */
    115     $sCategory      = "dlls";
     115    $sCategory      = "modules";
    116116    $sCategoryName  = "Tools";
    117     $sDllType = 'T';
     117    $sModType = 'T';
    118118}
    119119else if (isset($apigroups))
     
    179179    switch ($sCategory)
    180180    {
    181         case "dll":
    182         {
    183             Odin32DBDllInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState);
     181        case "module":
     182        {
     183            Odin32DBModuleInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState);
    184184            break;
    185185        }
     
    205205        case "author":
    206206        {
    207             Odin32DBAuthorInfo($db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $authordll);
     207            Odin32DBAuthorInfo($db, $iRefcode, $fModules, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $authormod);
    208208            break;
    209209        }
     
    249249        }
    250250
    251         case "dlls":
     251        case "modules":
    252252        {
    253253            /*
    254              * List all dlls.
     254             * List all modules.
    255255             */
    256256            Odin32DBNavigationTop("","");
     
    269269                   "    COUNT(f.refcode)    AS functions\n".
    270270                   "FROM\n".
    271                    "    dll d\n".
     271                   "    module d\n".
    272272                   "    LEFT OUTER JOIN function f\n".
    273                    "    ON f.dll = d.refcode\n".
     273                   "    ON f.module = d.refcode\n".
    274274                   "WHERE\n".
    275                    "    d.type = '".$sDllType."'\n".
     275                   "    d.type = '".$sModuleType."'\n".
    276276                   "GROUP BY d.refcode\n".
    277277                   "ORDER BY d.name\n";
     
    283283                {
    284284                    echo "\n<font size=-1><ul><b>";
    285                     while ($aDll = mysql_fetch_array($result))
     285                    while ($aModule = mysql_fetch_array($result))
    286286                    {
    287                         echo "<li><a href=\"Odin32DB.phtml?dllrefcode=".$aDll["refcode"].
    288                              "\">".$aDll["name"]."</a> (".$aDll["functions"].")\n";
     287                        echo "<li><a href=\"Odin32DB.phtml?modrefcode=".$aModule["refcode"].
     288                             "\">".$aModule["name"]."</a> (".$aModule["functions"].")\n";
    289289                    }
    290290                    echo "</b></ul></font>\n";
     
    324324            {
    325325                if (mysql_num_rows($result) <= 0)
    326                     echo "<i>No dlls!</i>\n";
     326                    echo "<i>No Authors!</i>\n";
    327327                else
    328328                {
     
    371371            {
    372372                if (mysql_num_rows($result) <= 0)
    373                     echo "<i>No dlls!</i>\n";
     373                    echo "<i>No Apigroups!</i>\n";
    374374                else
    375375                {
     
    409409                   "    dn.seqnbr           AS seqnbr,\n".
    410410                   "    dn.level            AS level,\n".
    411                    "    d.name              AS dllname,\n".
     411                   "    m.name              AS modname,\n".
    412412                   "    f.name              AS filename\n".
    413413                   "FROM\n".
    414414                   "    designnote dn,\n".
    415                    "    dll d,\n".
     415                   "    module m,\n".
    416416                   "    file f\n".
    417                    "WHERE   dn.dll = d.refcode\n".
     417                   "WHERE   dn.module = d.refcode\n".
    418418                   "    AND dn.file = f.refcode\n".
    419419                   "    AND dn.level <= 1\n".
    420                    "ORDER BY d.name, dn.seqnbr, dn.seqnbrnote\n";
     420                   "ORDER BY m.name, dn.seqnbr, dn.seqnbrnote\n";
    421421            if ($result = mysql_query($sql, $db))
    422422            {
  • trunk/tools/database/www/Odin32DBHelpers.php3

    r6664 r6677  
    113113
    114114/**
    115  * Compute completion percentage for a dll.
     115 * Compute completion percentage for a module.
    116116 * @returns     Completion percentage. Range 0-100.
    117117 *              On error -1 or -2 is returned.
    118  * @param       $iDll  Dll reference code.
    119  * @param       $db     Database connection variable.
    120  * @sketch      Get total number of function in the dll.
    121  *              Get number of completed functions in the dll.
     118 * @param       $iModule    Module reference code.
     119 * @param       $db         Database connection variable.
     120 * @sketch      Get total number of function in the module.
     121 *              Get number of completed functions in the module.
    122122 *              return complete*100 / total
    123123 * @status      Completely implemented
     
    125125 * @remark
    126126 */
    127 function Odin32DBComputeCompletion($iDll, $db)
    128 {
    129     /*
    130      * Count the total number of functions in the DLL.
     127function Odin32DBComputeCompletion($iModule, $db)
     128{
     129    /*
     130     * Count the total number of functions in the module.
    131131     */
    132132    $sql = sprintf("SELECT  SUM(s.weight)/COUNT(f.state)
     
    136136                        WHERE
    137137                            f.state = s.refcode
    138                             AND dll = %d",
    139                         $iDll);
     138                            AND module = %d",
     139                        $iModule);
    140140    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
    141141    {
     
    165165
    166166/**
    167  * Draws a completion bar for a dll (or all dlls).
    168  * @param       $iDll       Dll reference code.
     167 * Draws a completion bar for a module (or all modules.).
     168 * @param       $iModule    Module reference code.
    169169 *                          If < 0 then for the entire project.
    170  * @param       $iDllName   Dll name.
     170 * @param       $iModName   Module name.
    171171 * @param       $db         Database connection variable.
    172172 * @sketch      Call Odin32DBCompletionBar2 with an appropriate condition.
     
    174174 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    175175 */
    176 function Odin32DBCompletionBarDll($iDll, $sDllName, $db)
    177 {
    178     if ($iDll < 0)
    179         return Odin32DBcompletionBar2("", $sDllName, $db);
    180     return Odin32DBcompletionBar2("dll = ".$iDll, $sDllName, $db);
     176function Odin32DBCompletionBarModule($iModule, $sModName, $db)
     177{
     178    if ($iModule < 0)
     179        return Odin32DBcompletionBar2("", $sModName, $db);
     180    return Odin32DBcompletionBar2("module = ".$iModule." AND f.type IN ('A', 'I')", $sModName, $db);
    181181}
    182182
     
    221221{
    222222    /*
    223      * Count the total number of functions in the DLL.
     223     * Count the total number of functions for the author.
    224224     */
    225225    $sql = "SELECT COUNT(*) FROM fnauthor fa JOIN function f\n".
    226            "WHERE fa.function = f.refcode AND fa.author = ".$iAuthor;
     226           "WHERE fa.function = f.refcode AND fa.author = ".$iAuthor." AND f.type IN ('A', 'I')";
    227227    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
    228228    {
     
    260260           "    fa.author = ".$iAuthor." AND\n".
    261261           "    fa.function = f.refcode AND\n".
    262            "    f.state = s.refcode\n".
     262           "    f.state = s.refcode AND\n".
     263           "    f.type IN ('A', 'I')\n".
    263264           "GROUP BY s.refcode\n".
    264265           "ORDER BY state\n";
     
    295296/**
    296297 * Draws a completion bar.
    297  * @param       $iDll   Dll reference code.
    298  *                      If < 0 then for the entire project.
    299  * @param       $db     Database connection variable.
    300  * @sketch      Get total number of function in the dll.
     298 * @param       $sCondition Where conditions.
     299 * @param       $sName      Name...
     300 * @param       $db         Database connection variable.
     301 * @sketch      Get total number of function in the selection.
    301302 *              Get the number of function per status. (+state color)
    302303 *              Draw bar.
     
    307308{
    308309    /*
    309      * Count the total number of functions in the DLL.
     310     * Count the total number of functions in selection.
    310311     */
    311312    $sql = "SELECT COUNT(*) FROM function f";
     
    391392{
    392393    /*
    393      * Count the total number of functions in the DLL.
    394      */
    395     $sql = "SELECT
    396                     name,
    397                     color
    398                 FROM
    399                     state
    400                 ORDER BY refcode";
     394     * Select the states.
     395     */
     396    $sql = "SELECT name,
     397                   color
     398            FROM   state
     399            ORDER BY refcode";
    401400    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
    402401    {
     
    668667/**
    669668 * Writes the a function listing base sqlstatement with these columns (ordered):
    670  *      0. dll refcode
    671  *      1. dll name
     669 *      0. Module refcode
     670 *      1. Module name
    672671 *      2. number of functions
    673672 *
     
    677676 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    678677 */
    679 function Odin32DBWriteDlls($sql, $db)
     678function Odin32DBWriteModules($sql, $db)
    680679{
    681680    if ($result2 = mysql_query($sql, $db))
     
    685684            echo "\n<table width=100% border=0 cellpadding=0>\n".
    686685                 "<tr>\n".
    687                  "  <td width=75%><font size=-1><b>Dlls</b></font></td>\n".
     686                 "  <td width=75%><font size=-1><b>Modules</b></font></td>\n".
    688687                 "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    689688                 "</tr>\n";
    690689            while ($aFunction = mysql_fetch_array($result2))
    691690                printf("<tr>".
    692                        "<td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=%s\">%s</a></font></td>".
     691                       "<td><font size=-1><a href=\"Odin32DB.phtml?modrefcode=%s\">%s</a></font></td>".
    693692                       "<td align=right><font size=-1>%s</font></td>".
    694693                       "</tr>\n",
     
    762761/**
    763762 * Writes the a function listing base sqlstatement with these columns (ordered):
    764  *      0. dll refcode
    765  *      1. dll name
     763 *      0. module refcode
     764 *      1. module name
    766765 *      2. function refcode
    767766 *      3. function name
     
    775774 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    776775 */
    777 function Odin32DBWriteFunctionsWithDlls($sql, $db, $sURLArgs)
     776function Odin32DBWriteFunctionsWithModules($sql, $db, $sURLArgs)
    778777{
    779778    if ($result2 = mysql_query($sql, $db))
     
    783782            echo "\n<table width=100% border=0 cellpadding=0>\n".
    784783                 "<tr>\n".
    785                  "  <td width=30%><font size=-1><b>Dll Name</b></font></td>\n".
     784                 "  <td width=30%><font size=-1><b>Module Name</b></font></td>\n".
    786785                 "  <td width=45%><font size=-1><b>Function Name</b></font></td>\n".
    787786                 "  <td><font size=-1><b>State</b></font></td>\n".
     
    789788            while ($aFunction = mysql_fetch_row($result2))
    790789                printf("<tr>".
    791                        "<td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=%s\">%s</a></font></td>".
     790                       "<td><font size=-1><a href=\"Odin32DB.phtml?modrefcode=%s\">%s</a></font></td>".
    792791                       "<td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=%s\">%s</a></font></td>".
    793792                       "<td><font size=-1 color=%s>%s</font></td>".
     
    809808
    810809            echo "<p>Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."\">here</a> to view functions sorted ".
    811                  ($fSortByState  ? "alphabetical by dll" : "by state"). ".<br>";
     810                 ($fSortByState  ? "alphabetical by module" : "by state"). ".<br>";
    812811        }
    813812        else
     
    953952
    954953    echo "<a href=\"Odin32DB.phtml\">Root</a>\n".
    955          " - <a href=\"Odin32DB.phtml?dlls=1\">Dlls</a>\n".
     954         " - <a href=\"Odin32DB.phtml?modules=1\">Moduless</a>\n".
    956955         " - <a href=\"Odin32DB.phtml?authors=1\">Authors</a>\n".
    957956         " - <a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a>\n";
     
    986985    echo
    987986         "<a href=\"Odin32DB.phtml\">Root</a>\n".
    988          " - <a href=\"Odin32DB.phtml?dlls=1\">Dlls</a>\n".
     987         " - <a href=\"Odin32DB.phtml?moduless=1\">Modules</a>\n".
    989988         " - <a href=\"Odin32DB.phtml?authors=1\">Authors</a>\n".
    990989         " - <a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a>\n";
     
    10291028                   "    a.name          AS aliasname,\n".
    10301029                   "    a.refcode       AS aliasrefcode,\n".
    1031                    "    ad.name         AS aliasdllname,\n".
    1032                    "    ad.refcode      AS aliasdllrefcode,\n".
    1033                    "    d.name          AS dllname,\n".
    1034                    "    d.refcode       AS dllrefcode,\n".
     1030                   "    ad.name         AS aliasnmodname,\n".
     1031                   "    ad.refcode      AS aliasmodrefcode,\n".
     1032                   "    d.name          AS modname,\n".
     1033                   "    d.refcode       AS modrefcode,\n".
    10351034                   "    i.name          AS filename,\n".
    10361035                   "    i.refcode       AS filerefcode,\n".
     
    10401039                   "    function f\n".
    10411040                   "    LEFT OUTER JOIN function a ON f.aliasfn  = a.refcode\n".
    1042                    "    LEFT OUTER JOIN dll ad     ON a.dll      = ad.refcode\n".
     1041                   "    LEFT OUTER JOIN module ad  ON a.module   = ad.refcode\n".
    10431042                   "    LEFT OUTER JOIN apigroup g ON f.apigroup = g.refcode\n".
    1044                    "    LEFT       JOIN dll d      ON f.dll      = d.refcode\n".
     1043                   "    LEFT       JOIN module d   ON f.module   = d.refcode\n".
    10451044                   "    LEFT       JOIN state s    ON f.state    = s.refcode\n".
    10461045                   "    LEFT OUTER JOIN file i     ON f.file     = i.refcode\n".
     
    10641063        Odin32DBInfoRow1("Type", $array, "type", "", "","invalid","");
    10651064        Odin32DBInfoRow1("State", $array, "state", "", "","invalid","");
    1066         Odin32DBInfoRow1("Dll", $array, "dllname", "dllrefcode", "dllrefcode","","");
     1065        Odin32DBInfoRow1("Module", $array, "modname", "modrefcode", "modrefcode","","");
    10671066        Odin32DBInfoRow1("Ordinal", $array, "ordinal","","","not available","");
    10681067        if (isset($array["apigroupname"]))
    10691068            Odin32DBInfoRow1("API Group", $array, "apigroupname", "apigrouprefcode", "apigrouprefcode","","");
    10701069        Odin32DBInfoRow1("File", $array, "filename", "filerefcode", "filerefcode", "not available",
    1071                          " (<a href=\"cvs.phtml#".$array["line"]."?sFile=./src/".$array["dllname"]."/".$array["filename"].",v&sRevision=\">cvs</a>)");
     1070                         " (<a href=\"cvs.phtml#".$array["line"]."?sFile=./src/".$array["modname"]."/".$array["filename"].",v&sRevision=\">cvs</a>)");
    10721071        if ($array["line"] > 0)
    10731072            Odin32DBInfoRow1("Line", $array, "line", "", "","","");
     
    10751074            Odin32DBInfoRow1("Line", $array, "unavailable", "", "","not available","");
    10761075        if (isset($array["aliasrefcode"]))
    1077             Odin32DBInfoRow2("Forwards", $array, "aliasdllname", "aliasdllrefcode", "dllrefcode","",".",
     1076            Odin32DBInfoRow2("Forwards", $array, "aliasmodname", "aliasmodrefcode", "modrefcode","",".",
    10781077                                                 "aliasname", "aliasrefcode", "functionrefcode");
    10791078        else
    10801079        {
    10811080            $sql = sprintf("SELECT\n".
    1082                            "    d.name      AS dllname,\n".
    1083                            "    d.refcode   AS dllrefcode,\n".
     1081                           "    m.name      AS modname,\n".
     1082                           "    m.refcode   AS modrefcode,\n".
    10841083                           "    f.name      AS fnname,\n".
    10851084                           "    f.refcode   AS fnrefcode\n".
    10861085                           "FROM\n".
    10871086                           "    function f,\n".
    1088                            "    dll d\n".
     1087                           "    module m\n".
    10891088                           "WHERE\n".
    10901089                           "    f.aliasfn = %d AND\n".
    1091                            "    f.dll = d.refcode\n".
    1092                            "ORDER BY d.name, f.name\n",
     1090                           "    f.module = m.refcode\n".
     1091                           "ORDER BY m.name, f.name\n",
    10931092                           $iRefcode);
    10941093            if (($result2 = mysql_query($sql, $db)))
     
    11021101                        if ($f) $sValue = $sValue."<br>";
    11031102                        else    $f = 1;
    1104                         $sValue = $sValue."<a href=\"Odin32DB.phtml?dllrefcode=".
    1105                                           $aAlias["dllrefcode"]."\">".$aAlias["dllname"]."</a>.".
     1103                        $sValue = $sValue."<a href=\"Odin32DB.phtml?modrefcode=".
     1104                                          $aAlias["modrefcode"]."\">".$aAlias["modname"]."</a>.".
    11061105                                          "<a href=\"Odin32DB.phtml?functionrefcode=".
    11071106                                          $aAlias["fnrefcode"]."\">".$aAlias["fnname"]."</a>";
     
    12451244
    12461245/**
    1247  * Writes standard dll info.
     1246 * Writes standard module info.
    12481247 *
    12491248 * @returns     void
    12501249 * @param       $db             Database handle.
    1251  * @param       $iRefcode       Dll reference code.
     1250 * @param       $iRefcode       Module reference code.
    12521251 * @param       $fFunctions     Flags which tells wether to list all functions or not.
    12531252 * @param       $fFiles         Flags which tells wether to list all files or not.
     
    12601259 * @remark
    12611260 */
    1262 function Odin32DBDllInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
    1263 {
    1264     $sURLArgs = "dllrefcode=".$iRefcode.
     1261function Odin32DBModuleInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
     1262{
     1263    $sURLArgs = "modrefcode=".$iRefcode.
    12651264                ($fFunctions   ? "&fFunctions=1"   : "").
    12661265                ($fFiles       ? "&fFiles=1"       : "").
     
    12721271     * Navigation - TOP
    12731272     */
    1274     $sExpand    = "dllrefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1";
     1273    $sExpand    = "modrefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1";
    12751274    if ($fSortByState)  $sExpand = $sExpand."&fSortByState=".$fSortByState;
    1276     $sCollapse  = "dllrefcode=".$iRefcode;
     1275    $sCollapse  = "modrefcode=".$iRefcode;
    12771276    Odin32DBNavigationTop($sExpand, $sCollapse);
    12781277
     
    12811280     */
    12821281    $sql = sprintf("SELECT\n".
    1283                    "    d.name          AS name,\n".
    1284                    "    d.description   AS description,\n".
     1282                   "    m.name          AS name,\n".
     1283                   "    m.description   AS description,\n".
    12851284                   "    c.description   AS type\n".
    12861285                   "FROM\n".
    1287                    "    dll d,\n".
     1286                   "    module d,\n".
    12881287                   "    code c\n".
    12891288                   "WHERE\n".
    12901289                   "    c.codegroup = 'DTYP' AND\n".
    1291                    "    d.type = c.code AND\n".
    1292                    "    d.refcode = %d",
     1290                   "    m.type = c.code AND\n".
     1291                   "    m.refcode = %d",
    12931292                    $iRefcode);
    12941293    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
     
    13071306                       "    function\n".
    13081307                       "WHERE\n".
    1309                        "    dll = %d",
     1308                       "    module = %d",
    13101309                       $iRefcode);
    13111310        $cFunctions = 0;
     
    13211320                       "    file\n".
    13221321                       "WHERE\n".
    1323                        "    dll = %d",
     1322                       "    module = %d",
    13241323                       $iRefcode);
    13251324        $cFiles = 0;
     
    13351334                       "    apigroup\n".
    13361335                       "WHERE\n".
    1337                        "    dll = %d",
     1336                       "    module = %d",
    13381337                       $iRefcode);
    13391338        $cAPIGroups = 0;
     
    13511350         */
    13521351        Odin32DBNaslov("Completion", "completion");
    1353         Odin32DBCompletionBarDll($iRefcode, "", $db);
     1352        Odin32DBCompletionBarModule($iRefcode, "", $db);
    13541353
    13551354        /*
     
    13621361                       "    function\n".
    13631362                       "WHERE\n".
    1364                        "    dll = %d\n".
     1363                       "    module = %d\n".
    13651364                       "GROUP BY state\n".
    13661365                       "ORDER BY state",
     
    13831382                           "    LEFT JOIN state s ON f.state = s.refcode\n".
    13841383                           "WHERE\n".
    1385                            "    f.dll = %d\n",
     1384                           "    f.module = %d\n",
    13861385                           $iRefcode);
    13871386            if ($fSortByState)
     
    14101409                           "    LEFT OUTER JOIN function fn ON fn.file = f.refcode\n".
    14111410                           "WHERE\n".
    1412                            "    f.dll = %d\n".
     1411                           "    f.module = %d\n".
    14131412                           "GROUP BY f.refcode\n".
    14141413                           "ORDER BY f.name\n",
     
    14371436                               "    JOIN function f\n".
    14381437                               "WHERE\n".
    1439                                "    g.dll = %d AND\n".
    1440                                "    f.dll = %d AND\n".
     1438                               "    g.module = %d AND\n".
     1439                               "    f.module = %d AND\n".
    14411440                               "    f.apigroup = g.refcode\n".
    14421441                               "GROUP BY f.apigroup\n".
     
    14671466                           "    JOIN author a\n".
    14681467                           "WHERE\n".
    1469                            "    f.dll       = %d AND\n".
     1468                           "    f.module    = %d AND\n".
    14701469                           "    fa.function = f.refcode AND\n".
    14711470                           "    fa.author   = a.refcode\n".
     
    15351534                   "    f.revision      AS revision,\n".
    15361535                   "    f.description   AS description,\n".
    1537                    "    f.dll           AS dllrefcode,\n".
    1538                    "    d.name          AS dllname\n".
     1536                   "    f.module        AS modrefcode,\n".
     1537                   "    m.name          AS modname\n".
    15391538                   "FROM\n".
    15401539                   "    file f,\n".
    1541                    "    dll d,\n".
     1540                   "    module m,\n".
    15421541                   "    author a\n".
    15431542                   "WHERE\n".
    15441543                   "    f.refcode   = %d AND\n".
    1545                    "    f.dll       = d.refcode AND\n".
     1544                   "    f.module    = m.refcode AND\n".
    15461545                   "    f.lastauthor= a.refcode",
    15471546                    $iRefcode);
     
    15541553        echo "\n<table width=100% border=3 cellpadding=0>\n";
    15551554        Odin32DBInfoRow1("Name", $array, "name","","","",
    1556                          " (<a href=\"cvs.phtml?sFile=./src/".$array["dllname"]."/".$array["name"].",v&sRevision=\">cvs</a>)");
     1555                         " (<a href=\"cvs.phtml?sFile=./src/".$array["modname"]."/".$array["name"].",v&sRevision=\">cvs</a>)");
    15571556        Odin32DBInfoRow1("Revision", $array, "revision","","","","");
    15581557        Odin32DBInfoRow1("Changed", $array, "lastdatetime","","","","");
    15591558        Odin32DBInfoRow1("Last Author", $array, "lastauthorname","lastauthorrefcode","authorrefcode","","");
    1560         Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","","");
     1559        Odin32DBInfoRow1("Module", $array, "modname","modrefcode","modrefcode","","");
    15611560        $sql = sprintf("SELECT\n".
    15621561                       "    COUNT(*) as functions\n".
     
    17221721 * @param       $db             Database handle.
    17231722 * @param       $iRefcode       Author reference code.
    1724  * @param       $fDlls          Flags which tells wether to list all dlls or not.
     1723 * @param       $fModules       Flags which tells wether to list all modules or not.
    17251724 * @param       $fFunctions     Flags which tells wether to list all functions or not.
    17261725 * @param       $fFiles         Flags which tells wether to list all files or not.
     
    17281727 * @param       $fSortByState   Flags which tells wether to sort functions by
    17291728 *                              state and function name or just by function name.
    1730  * @param       $iDllRefcode    Dll refcode. All Dll if < 0.
     1729 * @param       $iModRefcode    Module refcode. All modules if < 0.
    17311730 *                              (not implemented yet)
    17321731 * @sketch
     
    17341733 * @remark
    17351734 */
    1736 function Odin32DBAuthorInfo($db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode)
     1735function Odin32DBAuthorInfo($db, $iRefcode, $fModules, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iModRefcode)
    17371736{
    17381737    $sURLArgs = "authorrefcode=".$iRefcode.
    1739                 ($fDlls        ? "&fDlls=1"        : "").
     1738                ($fModules     ? "&fModules=1"        : "").
    17401739                ($fFunctions   ? "&fFunctions=1"   : "").
    17411740                ($fFiles       ? "&fFiles=1"       : "").
     
    17461745     * Navigation - TOP
    17471746     */
    1748     $sExpand    = "authorrefcode=".$iRefcode."&fDlls=1&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1&dll=".$iDllRefcode;
     1747    $sExpand    = "authorrefcode=".$iRefcode."&fModules=1&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1&mod=".$iModRefcode;
    17491748    if ($fSortByState)  $sExpand = $sExpand."&fSortByState=".$fSortByState;
    17501749    $sCollapse  = "authorrefcode=".$iRefcode;
     
    17961795            }
    17971796        $sql = sprintf("SELECT\n".
    1798                        "    COUNT(f.dll) as functions
     1797                       "    COUNT(f.module) as functions
    17991798                       \n".
    18001799                       "FROM\n".
     
    18041803                       "    fa.author = %d AND".
    18051804                       "    f.refcode = fa.function\n".
    1806                        "GROUP BY f.dll",
     1805                       "GROUP BY f.module",
    18071806                       $iRefcode);
    1808         $cDlls = 0;
    1809         if (($result2 = mysql_query($sql, $db)) && ($cDlls = mysql_num_rows($result2)) > 0)
    1810             Odin32DBInfoRow1NoArray("# Dlls", $cDlls, "","","","");
     1807        $cModules = 0;
     1808        if (($result2 = mysql_query($sql, $db)) && ($cModules = mysql_num_rows($result2)) > 0)
     1809            Odin32DBInfoRow1NoArray("# Moduless", $cModules, "","","","");
    18111810        $sql = sprintf("SELECT\n".
    1812                        "    COUNT(f.dll) as functions
     1811                       "    COUNT(f.module) as functions
    18131812                       \n".
    18141813                       "FROM\n".
     
    18251824            Odin32DBInfoRow1NoArray("# Files", $cFiles, "","","","");
    18261825        $sql = sprintf("SELECT\n".
    1827                        "    COUNT(f.dll) as functions
     1826                       "    COUNT(f.module) as functions
    18281827                       \n".
    18291828                       "FROM\n".
     
    18671866
    18681867        /*
    1869          * Dlls
    1870          */
    1871         Odin32DBNaslov("Dlls", "dlls");
    1872         if ($fDlls)
     1868         * Modules
     1869         */
     1870        Odin32DBNaslov("Modules", "Modules");
     1871        if ($fModules)
    18731872        {
    18741873            $sql = sprintf("SELECT\n".
    1875                            "    d.refcode,\n".
    1876                            "    d.name,\n".
     1874                           "    m.refcode,\n".
     1875                           "    m.name,\n".
    18771876                           "    COUNT(f.refcode)\n".
    18781877                           "FROM\n".
    18791878                           "    fnauthor fa,\n".
    1880                            "    dll d,\n".
     1879                           "    module m,\n".
    18811880                           "    function f\n".
    18821881                           "WHERE\n".
    18831882                           "    fa.author = %d AND\n".
    18841883                           "    fa.function = f.refcode AND\n".
    1885                            "    f.dll = d.refcode\n".
    1886                            "GROUP BY d.refcode\n".
    1887                            "ORDER BY d.name\n",
     1884                           "    f.module = m.refcode\n".
     1885                           "GROUP BY m.refcode\n".
     1886                           "ORDER BY m.name\n",
    18881887                            $iRefcode);
    1889             Odin32DBWriteDlls($sql, $db, $sURLArgs);
     1888            Odin32DBWriteModules($sql, $db, $sURLArgs);
    18901889        }
    18911890        else
    1892             echo "Click <a href=\"Odin32DB.phtml#dlls?".$sURLArgs."&fDlls=1".
     1891            echo "Click <a href=\"Odin32DB.phtml#modules?".$sURLArgs."&fModules=1".
    18931892                 "\">here</a> to see all files.\n";
    18941893
     
    19031902                           "    f.refcode,\n".
    19041903                           "    f.name,\n".
    1905                            "    d.refcode,\n".
    1906                            "    d.name,\n".
     1904                           "    m.refcode,\n".
     1905                           "    m.name,\n".
    19071906                           "    s.color,\n".
    19081907                           "    s.name\n".
     
    19101909                           "    fnauthor fa\n".
    19111910                           "    JOIN function f\n".
    1912                            "    JOIN dll d\n".
     1911                           "    JOIN module m\n".
    19131912                           "    LEFT JOIN state s ON f.state = s.refcode\n".
    19141913                           "WHERE\n".
    19151914                           "    fa.author = %d AND\n".
    19161915                           "    fa.function = f.refcode AND \n".
    1917                            "    f.dll = d.refcode\n",
     1916                           "    f.module = m.refcode\n",
    19181917                           $iRefcode);
    19191918            if ($fSortByState)
     
    19211920            else
    19221921                $sql = $sql."ORDER BY d.name, f.name";
    1923             Odin32DBWriteFunctionsWithDlls($sql, $db, $sURLArgs);
     1922            Odin32DBWriteFunctionsWithModules($sql, $db, $sURLArgs);
    19241923        }
    19251924        else
     
    20382037                   "    g.refcode       AS refcode,\n".
    20392038                   "    g.description   AS description,\n".
    2040                    "    d.name          AS dllname,\n".
    2041                    "    d.refcode       AS dllrefcode\n".
     2039                   "    m.name          AS modname,\n".
     2040                   "    m.refcode       AS modrefcode\n".
    20422041                   "FROM\n".
    20432042                   "    apigroup g\n".
    2044                    "    JOIN dll d\n".
     2043                   "    JOIN module m\n".
    20452044                   "WHERE\n".
    20462045                   "    g.refcode = %d AND".
    2047                    "    g.dll = d.refcode\n",
     2046                   "    g.module = m.refcode\n",
    20482047                   $iRefcode);
    20492048    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
     
    20552054        echo "\n<table width=100% border=3 cellpadding=0>\n";
    20562055        Odin32DBInfoRow1("Name", $array, "name","","","","");
    2057         Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","bad configuration","");
     2056        Odin32DBInfoRow1("Module", $array, "modname","modrefcode","modrefcode","bad configuration","");
    20582057        if (isset($array["description"]))
    20592058            Odin32DBInfoRow1("Description", $array, "description","","","","");
     
    20852084
    20862085        $sql = sprintf("SELECT\n".
    2087                        "    COUNT(f.dll) as functions\n".
     2086                       "    COUNT(f.module) as functions\n".
    20882087                       "FROM\n".
    20892088                       "    fnauthor fa,\n".
     
    22312230     * Navigation - TOP
    22322231     */
    2233     $sExpand    = "authorrefcode=".$iRefcode."&fDlls=1&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1&dll=".$iDllRefcode;
     2232    $sExpand    = "authorrefcode=".$iRefcode."&fModules=1&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1&module=".$iModRefcode;
    22342233    if ($fSortByState)  $sExpand = $sExpand."&fSortByState=".$fSortByState;
    22352234    $sCollapse  = "authorrefcode=".$iRefcode;
     
    22432242                   "    dn.note          AS note,\n".
    22442243                   "    dn.refcode       AS refcode,\n".
    2245                    "    dn.dll           AS dllrefcode,\n".
     2244                   "    dn.module        AS modrefcode,\n".
    22462245                   "    dn.file          AS filerefcode,\n".
    22472246                   "    dn.seqnbrnote    AS seqnbnote,\n".
     
    22492248                   "    dn.seqnbr        AS seqnbr,\n".
    22502249                   "    dn.line          AS line,\n".
    2251                    "    d.name           AS dll,\n".
     2250                   "    m.name           AS modname,\n".
    22522251                   "    f.name           AS file\n".
    22532252                   "FROM\n".
    22542253                   "    designnote dn,\n".
    2255                    "    dll d,\n".
     2254                   "    module m,\n".
    22562255                   "    file f\n".
    22572256                   "WHERE   dn.refcode = %d\n".
    2258                    "    AND dn.dll = d.refcode\n".
     2257                   "    AND dn.module = m.refcode\n".
    22592258                   "    AND dn.file = f.refcode\n".
    22602259                   "ORDER BY dn.seqnbrnote\n",
     
    22682267        echo "\n<table width=100% border=3 cellpadding=0>\n";
    22692268        Odin32DBInfoRow1("Title", $array, "name","","","","");
    2270         Odin32DBInfoRow1("Module", $array, "dll","","","","");
     2269        Odin32DBInfoRow1("Module", $array, "modname","","","","");
    22712270        Odin32DBInfoRow1("File", $array, "file","","","","");
    22722271        Odin32DBInfoRow1("Line", $array, "line","","","","");
Note: See TracChangeset for help on using the changeset viewer.