Changeset 15


Ignore:
Timestamp:
Dec 11, 2000, 8:54:20 AM (25 years ago)
Author:
umoeller
Message:

Coupla bugfixes.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/cnrh.h

    r14 r15  
    347347     *
    348348     *      <B>Target emphasis:</B>
     349     *
    349350     *      For Name, Text, and Details view, per default target emphasis
    350351     *      during d'n'd is only displayed _around_ the record core.
     352     *      This allows users to drop records onto each other.
    351353     *      If you add CA_ORDEREDTARGETEMPH, target emphasis is only
    352      *      displayed _below_ the record core. If you add CA_MIXEDTARGETEMPH,
    353      *      both emphasis types are possible.
     354     *      displayed _between_ records (to reorder records).
     355     *      If you add CA_MIXEDTARGETEMPH, both emphasis types are possible.
    354356     *
    355357     *      Additional flags for _all_ views:
  • trunk/include/helpers/dosh.h

    r14 r15  
    4646
    4747    BOOL doshIsWarp4(VOID);
    48 
    49     APIRET doshQueryAvailPhysMem(PULONG pulMem,
    50                                  ULONG ulLogicalSwapDrive);
    5148
    5249    PSZ doshQuerySysErrorMsg(APIRET arc);
  • trunk/include/helpers/undoc.h

    r14 r15  
    7373
    7474    /*
     75     *  WPS object styles
     76     *      V0.9.7 (2000-12-10) [umoeller]
     77     */
     78
     79    #ifndef OBJSTYLE_LOCKEDINPLACE
     80        #define OBJSTYLE_LOCKEDINPLACE  0x00020000
     81    #endif
     82
     83    /*
    7584     * Some more OS/2 default menu items:
    7685     *
  • trunk/include/helpers/xstring.h

    r14 r15  
    5555
    5656    void XWPENTRY xstrInitSet(PXSTRING pxstr, PSZ pszNew);
     57    typedef void XWPENTRY XSTRINITSET(PXSTRING pxstr, PSZ pszNew);
     58    typedef XSTRINITSET *PXSTRINITSET;
    5759
    5860    void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource);
     61    typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource);
     62    typedef XSTRINITCOPY *PXSTRINITCOPY;
    5963
    6064    void XWPENTRY xstrClear(PXSTRING pxstr);
     
    6367
    6468    PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate);
     69    typedef PXSTRING XWPENTRY XSTRCREATE(ULONG ulPreAllocate);
     70    typedef XSTRCREATE *PXSTRCREATE;
    6571
    6672    VOID XWPENTRY xstrFree(PXSTRING pxstr);
     73    typedef VOID XWPENTRY XSTRFREE(PXSTRING pxstr);
     74    typedef XSTRFREE *PXSTRFREE;
    6775
    6876    ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew);
     77    typedef ULONG XWPENTRY XSTRSET(PXSTRING pxstr, PSZ pszNew);
     78    typedef XSTRSET *PXSTRSET;
    6979
    7080    ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource);
     81    typedef ULONG XWPENTRY XSTRCPY(PXSTRING pxstr, const char *pcszSource);
     82    typedef XSTRCPY *PXSTRCPY;
    7183
    7284    ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource);
    7385    typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource);
    7486    typedef XSTRCAT *PXSTRCAT;
     87
     88    ULONG XWPENTRY xstrcatc(PXSTRING pxstr, CHAR c);
     89    typedef ULONG XWPENTRY XSTRCATC(PXSTRING pxstr, CHAR c);
     90    typedef XSTRCATC *PXSTRCATC;
    7591
    7692    /*
     
    90106                              const char *pcszBeginChars,
    91107                              const char *pcszEndChars);
     108    typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
     109                                      ULONG ulOfs,
     110                                      const XSTRING *pstrFind,
     111                                      size_t *pShiftTable,
     112                                      PBOOL pfRepeatFind,
     113                                      const char *pcszBeginChars,
     114                                      const char *pcszEndChars);
     115    typedef XSTRFINDWORD *PXSTRFINDWORD;
    92116
    93117    ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
     
    97121                           size_t *pShiftTable,
    98122                           PBOOL pfRepeatFind);
     123    typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
     124                                   PULONG pulOfs,
     125                                   const XSTRING *pstrSearch,
     126                                   const XSTRING *pstrReplace,
     127                                   size_t *pShiftTable,
     128                                   PBOOL pfRepeatFind);
     129    typedef XSTRRPL *PXSTRRPL;
    99130
    100131    ULONG XWPENTRY xstrcrpl(PXSTRING pxstr,
     
    102133                            const char *pcszSearch,
    103134                            const char *pcszReplace);
     135    typedef ULONG XWPENTRY XSTRCRPL(PXSTRING pxstr,
     136                                    PULONG pulOfs,
     137                                    const char *pcszSearch,
     138                                    const char *pcszReplace);
     139    typedef XSTRCRPL *PXSTRCRPL;
    104140#endif
    105141
  • trunk/include/setup.h

    r7 r15  
    88#ifndef SETUP_HEADER_INCLUDED
    99    #define SETUP_HEADER_INCLUDED
     10
     11    // XWPEXPORT defines the standard linkage for the
     12    // XWorkplace helpers.
     13    #ifdef __EMX__
     14        #define XWPENTRY
     15    #elif defined (__IBMCPP__) || defined (__IBMC__)
     16        #define XWPENTRY _Optlink
     17    #endif
    1018
    1119    /*************************************************************
  • trunk/src/helpers/animate.c

    r14 r15  
    4141#define INCL_DOSDEVICES
    4242#define INCL_DOSDEVIOCTL
     43#define INCL_DOSMISC
    4344#define INCL_DOSERRORS
    4445
     
    5859#include "helpers\animate.h"
    5960
    60 #include "helpers\datetime.h"
    6161#include "helpers\winh.h"
    6262#include "helpers\gpih.h"
     
    8585 *      Returns the count of animation steps that were drawn.
    8686 *      This is dependent on the speed of the system.
     87 *
     88 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime
    8789 */
    8890
     
    122124        // 2) since large bitmaps take more time to calculate,
    123125        //    the animation won't appear to slow down then
    124         ulInitialTime = dtGetULongTime();
     126        DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     127                        &ulInitialTime,
     128                        sizeof(ulInitialTime));
    125129        ul = 1;
    126130        ulSteps = 1000;
     
    137141                    DBM_STRETCH);
    138142
    139             ulNowTime = dtGetULongTime();
     143            DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     144                            &ulNowTime,
     145                            sizeof(ulNowTime));
    140146
    141147            // recalculate ul: rule of three based on the
     
    175181 *      been acquired using WinGetScreenPS,
    176182 *      ulSteps should be around 40-50.
     183 *
     184 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime
    177185 */
    178186
     
    195203    ulPhase = 1;
    196204
    197     do {
    198         ULONG ulFromTime = dtGetULongTime();
     205    do
     206    {
     207        ULONG ulFromTime, ulTime2;
     208        DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     209                        &ulFromTime,
     210                        sizeof(ulFromTime));
    199211
    200212        if (ulPhase == 1)
     
    225237            rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom;
    226238
    227             if (rclNow.yBottom > (rclNow.yTop - LAST_WIDTH) ) {
     239            if (rclNow.yBottom > (rclNow.yTop - LAST_WIDTH) )
     240            {
    228241                rclNow.yBottom = (rclScreen.yTop / 2) - LAST_WIDTH;
    229242                rclNow.yTop = (rclScreen.yTop / 2) + LAST_WIDTH;
     
    262275
    263276            // done with "shrinking"?
    264             if ( rclNow.xRight < ((rclScreen.xRight / 2) + LAST_WIDTH) ) {
     277            if ( rclNow.xRight < ((rclScreen.xRight / 2) + LAST_WIDTH) )
    265278                ulPhase = 2; // exit
    266             }
    267 
    268         } else if (ulPhase == 2) {
     279        }
     280        else if (ulPhase == 2)
     281        {
    269282            // Phase 2: draw a horizontal white line about
    270283            // where the last rclNow was. This is only
     
    290303            ul = 0;
    291304
    292         } else if (ulPhase == 3) {
     305        }
     306        else if (ulPhase == 3)
     307        {
    293308            // Phase 3: make the white line shorter with
    294309            // every iteration by drawing black rectangles
     
    324339
    325340            ul++;
    326             if (ul > LAST_STEPS) {
     341            if (ul > LAST_STEPS)
    327342                ulPhase = 99;
    328             }
    329343        }
    330344
    331345        ul++;
    332346
    333         while (dtGetULongTime() < ulFromTime + WAIT_TIME) {
    334             // PSZ p = NULL; // keep compiler happy
    335         }
     347        DosSleep(WAIT_TIME);
     348
     349        /* do
     350        {
     351            DosSleep(0);
     352            DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     353                            &ulTime2,
     354                            sizeof(ulTime2));
     355        }  while (ulTime2 < ulFromTime + WAIT_TIME); */
    336356    } while (ulPhase != 99);
    337357
  • trunk/src/helpers/cnrh.c

    r14 r15  
    16441644 *
    16451645 *      --  the container sends CN_INITDRAG ("real" d'n'd desired by user);
     1646 *
    16461647 *      --  the container sends us CN_PICKUP (Alt+MB2 pressed);
     1648 *
    16471649 *      --  the user has selected "Pickup" from a record core's
    16481650 *          context menu (ID_XSMI_FILETYPES_PICKUP command).
     
    16741676 *      --  ulItemID will be set to the preccDrag so that the target
    16751677 *          window can access the dragged record.
     1678 *
    16761679 *      --  hstrSourceName == hstrTargetName gets the RECORDCORE.pszIcon.
    16771680 *
    16781681 *      The drag icon will be a default system file icon.
     1682 *
     1683 *      Preconditions:
     1684 *
     1685 *      --  pszIcon must be set in the RECORDCORE. This is used for
     1686 *          the item source name. This must not be NULL.
    16791687 */
    16801688
  • trunk/src/helpers/datetime.c

    r14 r15  
    4141    // as unsigned char
    4242
     43#define INCL_DOSMISC
    4344#include <os2.h>
    4445
     
    7374 *      time in milliseconds.
    7475 *
    75  *      Even though this does handle date information (i.e.
    76  *      will still return an increasing number when the
    77  *      clock switches from 23:59:59:9999 to 0:00:00:0000),
    78  *      this will not work forver after the first call.
    79  *      Here's the calculation:
    80  *
    81  +          1000 ms per second
    82  +            * 60 secs per minute
    83  +                * 60 minutes per hour
    84  +                    * 24 hours per day
    85  +                      = 86'400'000       after 23:59:59:9999
    86  *
    8776 *      A ULONG can hold a max value of 4'294'967'295.
    8877 *      So this overflows after 49.71... days.
    8978 *
    90  *@@changed V0.9.7 (2000-12-05) [umoeller]: now handling date also
     79 *@@V0.9.7 (2000-12-08) [umoeller]: replaced, now using DosQuerySysInfo(QSV_MS_COUNT)
    9180 */
    9281
    9382ULONG dtGetULongTime(VOID)
    9483{
    95     DATETIME    dt;
    96     ULONG       ulTime,
    97                 ulDateScalarPassed = 1;
    98     DosGetDateTime(&dt);
    99     ulTime = (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(dt.hours)))));
     84    ULONG ulTimeNow;
     85    DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     86                    &ulTimeNow,
     87                    sizeof(ulTimeNow));
     88    return (ulTimeNow);
     89
     90    /* DATETIME    dt;
     91    ULONG       ulHours,
     92                ulDaysPassed = 0;
    10093
    10194    if (G_ulDateScalarFirstCalled == 0)
     
    112105                                              dt.month,
    113106                                              dt.day);
    114         // calculate days passed since first call;
    115         // this should be 1 if the date hasn't changed
    116         ulDateScalarPassed = (G_ulDateScalarFirstCalled - ulDateScalarNow) + 1;
     107        ulDaysPassed = (ulDateScalarNow - G_ulDateScalarFirstCalled);
     108        _Pmpf((__FUNCTION__ ": days passed = %d", ulDaysPassed));
    117109    }
    118110
    119     return (ulTime * ulDateScalarPassed);
     111    DosGetDateTime(&dt);
     112    ulHours = dt.hours;     // this is UCHAR in DATETIME
     113    // get the hours; for every day passed, add 24 hours...
     114    ulHours += (24 * ulDaysPassed);
     115            // 0 if we're still on the first date
     116
     117    return (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(ulHours))))); */
    120118}
    121119
  • trunk/src/helpers/dosh.c

    r14 r15  
    178178
    179179    return (s_brc);
    180 }
    181 
    182 /*
    183  *@@ doshQueryAvailPhysMem:
    184  *      returns the amount of physical memory which
    185  *      is presently available (before the swapper
    186  *      would have to be expanded).
    187  *
    188  *      This number is calculated by getting the
    189  *      total available memory (QSV_TOTRESMEM)
    190  *      and subtracting the free space on the
    191  *      drive with the swap file from it.
    192  *
    193  *      As a result, you also need to specify
    194  *      the logical drive on which the swapper
    195  *      resides (3 = C, 4 = D, and so on).
    196  *
    197  *@@added V0.9.7 (2000-12-01) [umoeller]
    198  */
    199 
    200 APIRET doshQueryAvailPhysMem(PULONG pulMem,
    201                              ULONG ulLogicalSwapDrive)
    202 {
    203     APIRET arc = DosQuerySysInfo(QSV_TOTAVAILMEM,
    204                                  QSV_TOTAVAILMEM,
    205                                  pulMem,
    206                                  sizeof(*pulMem));
    207     if (arc == NO_ERROR)
    208     {
    209         double dFree = 0;
    210         arc = doshQueryDiskFree(ulLogicalSwapDrive,
    211                                 &dFree);
    212         *pulMem -= (ULONG)dFree;
    213     }
    214 
    215     return (arc);
    216180}
    217181
     
    895859 *
    896860 *@@added V0.9.6 (2000-10-16) [umoeller]
     861 *@@changed V0.9.7 (2000-12-10) [umoeller]: fixed "F:filename.ext" case
    897862 */
    898863
    899864PSZ doshGetExtension(const char *pcszFilename)
    900865{
    901     PSZ pszExtension = 0;
     866    PSZ pReturn = NULL;
    902867
    903868    if (pcszFilename)
    904869    {
    905870        // find filename
    906         PSZ p2 = strrchr(pcszFilename + 2, '\\'),
    907                     // works on "C:\blah" or "\\unc\blah"
    908             p3 = NULL;
    909 
    910         if (!p2)
    911             // no backslash found: then this is not qualified...
    912             // use start of filename
    913             p2 = (PSZ)pcszFilename;
     871        const char *p2 = strrchr(pcszFilename + 2, '\\'),
     872                            // works on "C:\blah" or "\\unc\blah"
     873                   *pStartOfName = NULL,
     874                   *pExtension = NULL;
     875
     876        if (p2)
     877            pStartOfName = p2 + 1;
     878        else
     879        {
     880            // no backslash found:
     881            // maybe only a drive letter was specified:
     882            if (*(pcszFilename + 1) == ':')
     883                // yes:
     884                pStartOfName = pcszFilename + 2;
     885            else
     886                // then this is not qualified at all...
     887                // use start of filename
     888                pStartOfName = (PSZ)pcszFilename;
     889        }
    914890
    915891        // find last dot in filename
    916         p3 = strrchr(p2 + 1, '.');
    917         if (p3)
    918             pszExtension = p3 + 1;
    919     }
    920 
    921     return (pszExtension);
     892        pExtension = strrchr(pStartOfName, '.');
     893        if (pExtension)
     894            pReturn = (PSZ)pExtension + 1;
     895    }
     896
     897    return (pReturn);
    922898}
    923899
  • trunk/src/helpers/except.c

    r14 r15  
    516516    {
    517517        case XCPT_ACCESS_VIOLATION:
    518         {
    519518            fprintf(file, "\nXCPT_ACCESS_VIOLATION: ");
    520519            if (pReportRec->ExceptionInfo[0] & XCPT_READ_ACCESS)
     
    538537                    "             confusion with administering memory or error conditions \n"
    539538                    "             were not properly checked for.\n");
    540             break;
    541         }
     539        break;
    542540
    543541        case XCPT_INTEGER_DIVIDE_BY_ZERO:
    544         {
    545542            fprintf(file, "\nXCPT_INTEGER_DIVIDE_BY_ZERO.\n");
    546543            fprintf(file,
    547544                    "Explanation: An attempt was made to divide an integer value by zero,\n"
    548545                    "             which is not defined.\n");
    549             break;
    550         }
     546        break;
    551547
    552548        case XCPT_ILLEGAL_INSTRUCTION:
    553         {
    554549            fprintf(file, "\nXCPT_ILLEGAL_INSTRUCTION.\n");
    555550            fprintf(file,
    556551                    "Explanation: An attempt was made to execute an instruction that\n"
    557552                    "             is not defined on this machine's architecture.\n");
    558             break;
    559         }
     553        break;
    560554
    561555        case XCPT_PRIVILEGED_INSTRUCTION:
    562         {
    563556            fprintf(file, "\nXCPT_PRIVILEGED_INSTRUCTION.\n");
    564557            fprintf(file,
     
    566559                    "             is not permitted in the current machine mode or that\n"
    567560                    "             XFolder had no permission to execute.\n");
    568             break;
    569         }
     561        break;
    570562
    571563        case XCPT_INTEGER_OVERFLOW:
     
    575567                    "             significant bit. This is a sign of an attempt to store\n"
    576568                    "             a value which does not fit into an integer variable.\n");
     569        break;
    577570
    578571        default:
    579572            fprintf(file, "\nUnknown OS/2 exception number %d.\n", pReportRec->ExceptionNum);
    580573            fprintf(file, "Look this up in the OS/2 header files.\n");
     574        break;
    581575    }
    582576
  • trunk/src/helpers/helpers_post.in

    r14 r15  
    4545$(OUTPUTDIR)\animate.obj:   $(@B).c $(HLPINC)\$(@B).h \
    4646               $(PROJECTINC)\setup.h \
    47                $(HLPINC)\datetime.h $(HLPINC)\winh.h $(HLPINC)\gpih.h \
     47               $(HLPINC)\winh.h $(HLPINC)\gpih.h \
    4848
    4949$(OUTPUTDIR)\cnrh.obj:     $(@B).c $(HLPINC)\$(@B).h \
  • trunk/src/helpers/timer.c

    r14 r15  
    7171#define INCL_DOSPROCESS
    7272#define INCL_DOSSEMAPHORES
     73#define INCL_DOSMISC
    7374#define INCL_DOSERRORS
    7475#include <os2.h>
     
    190191 *      is stopped thru tmrStopTimer, which then
    191192 *      sets the thread's fExit flag to TRUE.
     193 *
     194 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime
    192195 */
    193196
     
    244247                    {
    245248                        PXTIMER pTimer = (PXTIMER)pTimerNode->pItemData;
    246                         ULONG ulTimeNow = dtGetULongTime();
     249                        ULONG ulTimeNow;
     250                        DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     251                                        &ulTimeNow, sizeof(ulTimeNow));
    247252
    248253                        if (pTimer->ulNextFire < ulTimeNow)
     
    357362 *
    358363 *      -- The caller must call LockTimers() first.
    359  *
    360  *@@added V0.9.7 (2000-12-04) [umoeller]
    361364 */
    362365
     
    385388 *
    386389 *      The timer is _not_ stopped automatically
    387  *      when the widget is destroyed.
    388  *
    389  *@@added V0.9.7 (2000-12-04) [umoeller]
     390 *      when the window is destroyed.
     391 *
     392 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime
    390393 */
    391394
     
    432435                {
    433436                    // exists already: reset only
    434                     pTimer->ulNextFire = dtGetULongTime() + ulTimeout;
     437                    ULONG ulTimeNow;
     438                    DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     439                                    &ulTimeNow, sizeof(ulTimeNow));
     440                    pTimer->ulNextFire = ulTimeNow + ulTimeout;
    435441                    usrc = pTimer->usTimerID;
    436442                }
     
    441447                    if (pTimer)
    442448                    {
     449                        ULONG ulTimeNow;
     450                        DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     451                                        &ulTimeNow, sizeof(ulTimeNow));
    443452                        pTimer->usTimerID = usTimerID;
    444453                        pTimer->hwndTarget = hwnd;
    445454                        pTimer->ulTimeout = ulTimeout;
    446                         pTimer->ulNextFire = dtGetULongTime() + ulTimeout;
     455                        pTimer->ulNextFire = ulTimeNow + ulTimeout;
    447456
    448457                        lstAppendItem(&G_llTimers,
     
    476485 *
    477486 *      Returns TRUE if the timer was stopped.
    478  *
    479  *@@added V0.9.7 (2000-12-04) [umoeller]
    480487 */
    481488
     
    523530 *      that you should call during WM_DESTROY of
    524531 *      a window that has started timers.
    525  *
    526  *@@added V0.9.7 (2000-12-04) [umoeller]
    527532 */
    528533
  • trunk/src/helpers/winh.c

    r14 r15  
    24802480 *          object.
    24812481 *
     2482 *      Even though this isn't clearly said in PMREF,
     2483 *      PROGDETAILS.swpInitial is important:
     2484 *
     2485 *      -- To start a session minimized, set SWP_MINIMIZE.
     2486 *
     2487 *      -- To start a VIO session without auto-close, set
     2488 *         the half-documented SWP_NOAUTOCLOSE flag (0x8000)
     2489 *         This flag is now in the newer toolkit headers.
     2490 *
    24822491 *      Since this calls WinStartApp in turn, this
    24832492 *      requires a message queue on the calling thread.
    24842493 *
    24852494 *@@added V0.9.6 (2000-10-16) [umoeller]
     2495 *@@changed V0.9.7 (2000-12-10) [umoeller]: PROGDETAILS.swpInitial no longer zeroed... this broke VIOs
    24862496 */
    24872497
     
    25002510    ProgDetails.Length = sizeof(PROGDETAILS);
    25012511    ProgDetails.progt.fbVisible = SHE_VISIBLE;
    2502     ProgDetails.pszEnvironment = 0; // "WORKPLACE\0\0";
    2503     memset(&ProgDetails.swpInitial, 0, sizeof(SWP));
     2512    ProgDetails.pszEnvironment = 0;
     2513
     2514    // memset(&ProgDetails.swpInitial, 0, sizeof(SWP));
     2515            // this wasn't a good idea... WPProgram stores stuff
     2516            // in here, such as the "minimize on startup" -> SWP_MINIMIZE
    25042517
    25052518    // duplicate parameters...
     
    25132526
    25142527    // program type fixups
    2515     switch (ProgDetails.progt.progc)
     2528    switch (ProgDetails.progt.progc)        // that's a ULONG
    25162529    {
    25172530        case ((ULONG)-1):       // we get that sometimes...
     
    25242537    switch (ProgDetails.progt.progc)
    25252538    {
    2526         case PROG_31_ENH:
    2527         case PROG_31_ENHSEAMLESSCOMMON:
    2528         case PROG_31_ENHSEAMLESSVDM:
     2539        case PROG_31_ENHSEAMLESSVDM:        // 17
     2540        case PROG_31_ENHSEAMLESSCOMMON:     // 18
     2541        case PROG_31_ENH:                   // 19
    25292542            fIsWindowsApp = TRUE;
    25302543            fIsWindowsEnhApp = TRUE;
    25312544        break;
    25322545
    2533         case PROG_WINDOW_AUTO:
    2534 #ifdef PROG_30_STD
    2535         case PROG_30_STD:
     2546#ifndef PROG_30_STD
     2547    #define PROG_30_STD (PROGCATEGORY)11
    25362548#endif
    2537         case PROG_31_STD:
    2538         case PROG_WINDOW_REAL:
    2539 #ifdef PROG_30_STDSEAMLESSVDM
    2540         case PROG_30_STDSEAMLESSVDM:
     2549
     2550#ifndef PROG_30_STDSEAMLESSVDM
     2551    #define PROG_30_STDSEAMLESSVDM (PROGCATEGORY)13
    25412552#endif
    2542         case PROG_31_STDSEAMLESSVDM:
    2543         case PROG_30_STDSEAMLESSCOMMON:
    2544         case PROG_31_STDSEAMLESSCOMMON:
     2553
     2554        case PROG_WINDOW_REAL:              // 10
     2555        case PROG_30_STD:                   // 11
     2556        case PROG_WINDOW_AUTO:              // 12
     2557        case PROG_30_STDSEAMLESSVDM:        // 13
     2558        case PROG_30_STDSEAMLESSCOMMON:     // 14
     2559        case PROG_31_STDSEAMLESSVDM:        // 15
     2560        case PROG_31_STDSEAMLESSCOMMON:     // 16
     2561        case PROG_31_STD:                   // 20
    25452562            fIsWindowsApp = TRUE;
    25462563        break;
     
    27052722                            // do not use SAF_STARTCHILDAPP, or the
    27062723                            // app will be terminated automatically
     2724                            // when the WPS terminates!
    27072725
    27082726    // _Pmpf((__FUNCTION__ ": got happ 0x%lX", happ));
  • trunk/src/helpers/xstring.c

    r14 r15  
    186186 *      this can be used instead of xstrInit if you
    187187 *      want to initialize an XSTRING with a copy
    188  *      of an existing string.
     188 *      of an existing string. This is a shortcut
     189 *      for xstrInit() and then xstrcpy().
    189190 *
    190191 *      As opposed to xstrInitSet, this does create
     
    382383 *
    383384 *      Returns the length of the new string (excluding the null
    384  *      terminator), or null upon errors.
     385 *      terminator) if the string was changed, or 0 if nothing
     386 *      happened.
     387 *
     388 *      Note: To append a single character, xstrcatc is faster
     389 *      than xstrcat.
    385390 *
    386391 *      Example:
     
    391396 +          xstrcat(&str, "blup");
    392397 *
    393  *      After this, psz points to a new string containing
     398 *      After this, str.psz points to a new string containing
    394399 *      "blahblup".
    395400 *
     
    399404 *@@changed V0.9.3 (2000-05-11) [umoeller]: returned 0 if pszString was initially empty; fixed
    400405 *@@changed V0.9.6 (2000-11-01) [umoeller]: rewritten
     406 *@@changed V0.9.7 (2000-12-10) [umoeller]: return value was wrong
    401407 */
    402408
     
    452458            // in all cases, set new length
    453459            pxstr->ulLength += ulSourceLength;
    454             ulrc = ulSourceLength;
     460            ulrc = pxstr->ulLength;     // V0.9.7 (2000-12-10) [umoeller]
    455461
    456462        } // end if (ulSourceLength)
     
    458464        // do nothing
    459465    }
     466
     467    return (ulrc);
     468}
     469
     470/*
     471 *@@ xstrcatc:
     472 *      this is similar to xstrcat, except that this is
     473 *      for a single character. This is a bit faster than
     474 *      xstrcat.
     475 *
     476 *      If "c" is \0, nothing happens.
     477 *
     478 *      If pxstr is empty, this behaves just like xstrcpy.
     479 *
     480 *      Returns the length of the new string (excluding the null
     481 *      terminator) if the string was changed, or 0 if nothing
     482 *      happened.
     483 *
     484 *      Example:
     485 *
     486 +          XSTRING str;
     487 +          xstrInit(&str, 0);
     488 +          xstrcpy(&str, "blu");
     489 +          xstrcatc(&str, 'p');
     490 *
     491 *      After this, str.psz points to a new string containing
     492 *      "blup".
     493 *
     494 *@@added V0.9.7 (2000-12-10) [umoeller]
     495 */
     496
     497ULONG xstrcatc(PXSTRING pxstr,     // in/out: string
     498               CHAR c)             // in: character to append, can be \0
     499{
     500    ULONG   ulrc = 0;
     501
     502    if ((pxstr) && (c))
     503    {
     504        // ULONG   ulSourceLength = 1;
     505        // 1) memory management
     506        ULONG   cbNeeded = pxstr->ulLength  // existing length, without null terminator
     507                           + 1      // new character
     508                           + 1;     // null terminator
     509        if (cbNeeded > pxstr->cbAllocated)
     510        {
     511            // we need more memory than we have previously
     512            // allocated:
     513            if (pxstr->cbAllocated)
     514                // appendee already had memory:
     515                // reallocate
     516                pxstr->psz = (PSZ)realloc(pxstr->psz,
     517                                          cbNeeded);
     518            else
     519                // appendee has no memory:
     520                pxstr->psz = (PSZ)malloc(cbNeeded);
     521
     522            pxstr->cbAllocated = cbNeeded;
     523                    // ulLength is unchanged yet
     524        }
     525        // else: we have enough memory, both if appendee
     526        //       is empty or not empty
     527
     528        // now we have:
     529        // -- if appendee (pxstr) had enough memory, no problem
     530        // -- if appendee (pxstr) needed more memory
     531        //      -- and was not empty: pxstr->psz now points to a
     532        //         reallocated copy of the old string
     533        //      -- and was empty: pxstr->psz now points to a
     534        //         new (unitialized) buffer
     535
     536        // 2) append character:
     537        pxstr->psz[pxstr->ulLength] = c;
     538        pxstr->psz[pxstr->ulLength + 1] = '\0';
     539
     540        // in all cases, set new length
     541        pxstr->ulLength++;
     542        ulrc = pxstr->ulLength;
     543
     544    } // end if ((pxstr) && (c))
    460545
    461546    return (ulrc);
Note: See TracChangeset for help on using the changeset viewer.