Changeset 164 for trunk/src/helpers


Ignore:
Timestamp:
May 13, 2002, 7:49:28 AM (23 years ago)
Author:
umoeller
Message:

Massive pager rework.

Location:
trunk/src/helpers
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/except.c

    r158 r164  
    887887 *@@changed V0.9.0 [umoeller]: added support for thread termination
    888888 *@@changed V0.9.2 (2000-03-10) [umoeller]: switched date format to ISO
     889 *@@changed V0.9.19 (2002-05-07) [umoeller]: added EXCEPTIONREPORTRECORD info so that catch block can check that
    889890 */
    890891
     
    917918    switch (pReportRec->ExceptionNum)
    918919    {
    919         /* case XCPT_PROCESS_TERMINATE:
    920         case XCPT_ASYNC_PROCESS_TERMINATE:
    921             // thread terminated:
    922             // if the handler has been registered to catch
    923             // these exceptions, continue;
    924             if (pRegRec2->pfnOnKill)
    925                 // call the "OnKill" function
    926                 pRegRec2->pfnOnKill(pRegRec2);
    927             // get outta here, which will kill the thread
    928         break; */
    929 
    930920        case XCPT_ACCESS_VIOLATION:
    931921        case XCPT_INTEGER_DIVIDE_BY_ZERO:
     
    971961            fclose(file);
    972962
     963            // copy report rec to user buffer
     964            // V0.9.19 (2002-05-07) [umoeller]
     965            memcpy(&pRegRec2->err,
     966                   pReportRec,
     967                   sizeof(EXCEPTIONREPORTRECORD));
     968
    973969            // jump back to failing routine
    974             /* DosSetPriority(PRTYS_THREAD,
    975                            PRTYC_REGULAR,
    976                            0,       // delta
    977                            0);      // current thread
    978                            */
    979970            longjmp(pRegRec2->jmpThread, pReportRec->ExceptionNum);
    980971        break; }
     
    1003994 *
    1004995 *@@changed V0.9.0 [umoeller]: added support for thread termination
     996 *@@changed V0.9.19 (2002-05-07) [umoeller]: added EXCEPTIONREPORTRECORD info so that catch block can check that
    1005997 */
    1006998
     
    10191011    switch (pReportRec->ExceptionNum)
    10201012    {
    1021         /* case XCPT_PROCESS_TERMINATE:
    1022         case XCPT_ASYNC_PROCESS_TERMINATE:
    1023             // thread terminated:
    1024             // if the handler has been registered to catch
    1025             // these exceptions, continue;
    1026             if (pRegRec2->pfnOnKill)
    1027                 // call the "OnKill" function
    1028                 pRegRec2->pfnOnKill(pRegRec2);
    1029             // get outta here, which will kill the thread
    1030         break; */
    1031 
    10321013        case XCPT_ACCESS_VIOLATION:
    10331014        case XCPT_INTEGER_DIVIDE_BY_ZERO:
     
    10491030            #endif
    10501031
     1032            // copy report rec to user buffer
     1033            // V0.9.19 (2002-05-07) [umoeller]
     1034            memcpy(&pRegRec2->err,
     1035                   pReportRec,
     1036                   sizeof(EXCEPTIONREPORTRECORD));
     1037
    10511038            // jump back to failing routine
    10521039            longjmp(pRegRec2->jmpThread, pReportRec->ExceptionNum);
  • trunk/src/helpers/gpih.c

    r161 r164  
    546546
    547547    return (lHits);
     548}
     549
     550/*
     551 *@@ gpihFillBackground:
     552 *      fills the specified rectangle in the way
     553 *      that is specified by the given BKGNDINFO
     554 *      structure. This way one can either use
     555 *      a solid color, a color fade, a bitmap,
     556 *      or a combination of those.
     557 *
     558 *      See BKGNDINFO for the various parameters.
     559 *
     560 *      Since this can potentially be expensive,
     561 *      it is strongly recommended to use a buffer
     562 *      bitmap for painting with the size of the
     563 *      window and bitblt that bitmap into the
     564 *      window on repaints. This way the background
     565 *      only has to be recreated on window resize.
     566 *
     567 *@@added V0.9.19 (2002-05-07) [umoeller]
     568 */
     569
     570VOID gpihFillBackground(HPS hps,            // in: PS to paint into
     571                        PRECTL prcl,        // in: rectangle (inclusive!)
     572                        PBKGNDINFO pInfo)   // in: background into
     573{
     574    LONG    l;
     575    POINTL  ptl;
     576
     577    switch (pInfo->flPaintMode & PMOD_COLORMASK)
     578    {
     579        case PMOD_SOLID:
     580            // fill with background color
     581            GpiSetColor(hps,
     582                        pInfo->lcol1);
     583            ptl.x = prcl->xLeft;
     584            ptl.y = prcl->yBottom;
     585            GpiMove(hps,
     586                    &ptl);
     587            ptl.x = prcl->xRight;
     588            ptl.y = prcl->yTop;
     589            GpiBox(hps,
     590                   DRO_FILL,
     591                   &ptl,
     592                   0,
     593                   0);
     594        break;
     595
     596        case PMOD_TOPBOTTOM:
     597        {
     598            LONG lDiffRed   = (LONG)GET_RED(pInfo->lcol2) - (LONG)GET_RED(pInfo->lcol1);
     599            LONG lDiffGreen = (LONG)GET_GREEN(pInfo->lcol2) - (LONG)GET_GREEN(pInfo->lcol1);
     600            LONG lDiffBlue  = (LONG)GET_BLUE(pInfo->lcol2) - (LONG)GET_BLUE(pInfo->lcol1);
     601
     602            LONG lMax = prcl->yTop - prcl->yBottom;
     603
     604            // start at top
     605            ptl.y = prcl->yTop;
     606
     607            for (l = 0;
     608                 l <= lMax;
     609                 ++l)
     610            {
     611                // compose RGB color for this line;
     612                // lcol1 is top, lcol2 is bottom
     613                LONG lRed   =   GET_RED(pInfo->lcol1)
     614                              + (   lDiffRed
     615                                  * l
     616                                  / lMax
     617                                );
     618                LONG lGreen =   GET_GREEN(pInfo->lcol1)
     619                              + (   lDiffGreen
     620                                  * l
     621                                  / lMax
     622                                );
     623                LONG lBlue  =   GET_BLUE(pInfo->lcol1)
     624                              + (   lDiffBlue
     625                                  * l
     626                                  / lMax
     627                                );
     628
     629                GpiSetColor(hps, MAKE_RGB(lRed, lGreen, lBlue));
     630                ptl.x = prcl->xLeft;
     631                GpiMove(hps, &ptl);
     632                ptl.x = prcl->xRight;
     633                GpiLine(hps, &ptl);
     634
     635                // next line below
     636                --(ptl.y);
     637            }
     638        }
     639        break;
     640
     641        case PMOD_LEFTRIGHT:
     642        {
     643            LONG lDiffRed   = (LONG)GET_RED(pInfo->lcol2) - (LONG)GET_RED(pInfo->lcol1);
     644            LONG lDiffGreen = (LONG)GET_GREEN(pInfo->lcol2) - (LONG)GET_GREEN(pInfo->lcol1);
     645            LONG lDiffBlue  = (LONG)GET_BLUE(pInfo->lcol2) - (LONG)GET_BLUE(pInfo->lcol1);
     646
     647            LONG lMax = prcl->xRight - prcl->xLeft;
     648
     649            // start at left
     650            ptl.x = prcl->xLeft;
     651
     652            for (l = 0;
     653                 l <= lMax;
     654                 ++l)
     655            {
     656                // compose RGB color for this line;
     657                // lcol1 is top, lcol2 is bottom
     658                LONG lRed   =   GET_RED(pInfo->lcol1)
     659                              + (   lDiffRed
     660                                  * l
     661                                  / lMax
     662                                );
     663                LONG lGreen =   GET_GREEN(pInfo->lcol1)
     664                              + (   lDiffGreen
     665                                  * l
     666                                  / lMax
     667                                );
     668                LONG lBlue  =   GET_BLUE(pInfo->lcol1)
     669                              + (   lDiffBlue
     670                                  * l
     671                                  / lMax
     672                                );
     673
     674                GpiSetColor(hps, MAKE_RGB(lRed, lGreen, lBlue));
     675                ptl.y = prcl->yBottom;
     676                GpiMove(hps, &ptl);
     677                ptl.y = prcl->yTop;
     678                GpiLine(hps, &ptl);
     679
     680                // next line to the right
     681                ++(ptl.x);
     682            }
     683        }
     684        break;
     685    }
    548686}
    549687
     
    15231661        // set up the BITMAPINFOHEADER2 and BITMAPINFO2 structures
    15241662        bih2.cbFix = (ULONG)sizeof(BITMAPINFOHEADER2);
    1525         bih2.cx = cx; // (prcl->xRight - prcl->xLeft);       changed V0.9.0
    1526         bih2.cy = cy; // (prcl->yTop - prcl->yBottom);       changed V0.9.0
     1663        bih2.cx = cx;
     1664        bih2.cy = cy;
    15271665        bih2.cPlanes = (cPlanes) ? cPlanes : alData[0];
    15281666        bih2.cBitCount = (cBitCount) ? cBitCount : alData[1];
    1529             // _Pmpf((__FUNCTION__ ": cPlanes %d, cBitCount %d",
    1530                //          bih2.cPlanes, bih2.cBitCount));
    15311667        bih2.ulCompression = BCA_UNCOMP;
    15321668        bih2.cbImage = (    (   (bih2.cx
  • trunk/src/helpers/linklist.c

    r147 r164  
    260260                                               line,
    261261                                               function);
     262
    262263    lstInit(pNewList, fItemsFreeable);
    263264    return (pNewList);
  • trunk/src/helpers/memdebug.c

    r149 r164  
    488488                CheckMagics(__FUNCTION__,
    489489                            pHeapItem,
    490                             p,
     490                            (PBYTE)p,
    491491                            pcszSourceFile,
    492492                            ulLine,
     
    581581                CheckMagics(__FUNCTION__,
    582582                            pHeapItem,
    583                             p,
     583                            (PBYTE)p,
    584584                            pcszSourceFile,
    585585                            ulLine,
     
    748748     */
    749749
     750    /*
    750751    void memdDumpMemoryBlock(PBYTE pb,       // in: start address
    751752                             ULONG ulSize,   // in: size of block
     
    766767        } END_CATCH();
    767768    }
     769    */
    768770#endif
    769771
    770 #else
    771 void memdDummy(void)
    772 {
    773     int i = 0;
    774     i++;
    775 }
    776772#endif
    777773
  • trunk/src/helpers/memdebug_win.c

    r142 r164  
    512512 */
    513513
    514 static MRESULT EXPENTRY memd_fnwpMemDebug(HWND hwndClient, ULONG msg, MPARAM mp1, MPARAM mp2)
     514MRESULT EXPENTRY memd_fnwpMemDebug(HWND hwndClient, ULONG msg, MPARAM mp1, MPARAM mp2)
    515515{
    516516    MRESULT mrc = 0;
  • trunk/src/helpers/prfh.c

    r155 r164  
    138138 */
    139139
    140 PSZ prfhQueryProfileDataDebug(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
     140PSZ (prfhQueryProfileDataDebug)(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    141141                              const char *pcszApp,      // in: application to query
    142142                              const char *pcszKey,      // in: key to query
     
    189189 */
    190190
    191 PSZ prfhQueryProfileData(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
     191PSZ (prfhQueryProfileData)(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    192192                         const char *pcszApp,     // in: application to query
    193193                         const char *pcszKey,     // in: key to query
  • trunk/src/helpers/stringh.c

    r161 r164  
    7878 */
    7979
    80 APIRET strhStoreDebug(PSZ *ppszTarget,
    81                       PCSZ pcszSource,
    82                       PULONG pulLength,        // out: length of new string (ptr can be NULL)
    83                       PCSZ pcszSourceFile,
    84                       unsigned long ulLine,
    85                       PCSZ pcszFunction)
     80APIRET (strhStoreDebug)(PSZ *ppszTarget,
     81                        PCSZ pcszSource,
     82                        PULONG pulLength,        // out: length of new string (ptr can be NULL)
     83                        PCSZ pcszSourceFile,
     84                        unsigned long ulLine,
     85                        PCSZ pcszFunction)
    8686{
    8787    ULONG ulLength = 0;
     88
     89
    8890
    8991    if (ppszTarget)
  • trunk/src/helpers/textview.c

    r142 r164  
    30733073            lstClear(&ptxvd->xfd.llRectangles);
    30743074            lstClear(&ptxvd->xfd.llWords);
     3075            GpiDestroyPS(ptxvd->hps);
    30753076            free(ptxvd);
    3076             GpiDestroyPS(ptxvd->hps);
    30773077            mrc = WinDefWindowProc(hwndTextView, msg, mp1, mp2);
    30783078        break;
  • trunk/src/helpers/timer.c

    r163 r164  
    111111#include "helpers\timer.h"
    112112
    113 #define DEBUG_XTIMERS
     113// #define DEBUG_XTIMERS
    114114
    115115/*
Note: See TracChangeset for help on using the changeset viewer.