Changeset 14


Ignore:
Timestamp:
Dec 9, 2000, 8:19:42 PM (25 years ago)
Author:
umoeller
Message:

Major updates; timers, LVM, miscellaneous.

Location:
trunk
Files:
3 added
63 edited

Legend:

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

    r7 r14  
    1515
    1616/*      Copyright (C) 1997-2000 Ulrich M”ller.
    17  *      This file is part of the XWorkplace source package.
    18  *      XWorkplace is free software; you can redistribute it and/or modify
     17 *      This file is part of the "XWorkplace helpers" source package.
     18 *      This is free software; you can redistribute it and/or modify
    1919 *      it under the terms of the GNU General Public License as published
    2020 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/cnrh.h

    r7 r14  
    1717
    1818/*      Copyright (C) 1997-2000 Ulrich M”ller.
    19  *      This file is part of the XWorkplace source package.
    20  *      XWorkplace is free software; you can redistribute it and/or modify
     19 *      This file is part of the "XWorkplace helpers" source package.
     20 *      This is free software; you can redistribute it and/or modify
    2121 *      it under the terms of the GNU General Public License as published
    2222 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4040
    4141    /* ******************************************************************
    42      *                                                                  *
    43      *   Details view field infos                                       *
    44      *                                                                  *
     42     *
     43     *   Details view field infos
     44     *
    4545     ********************************************************************/
    4646
     
    108108
    109109    /* ******************************************************************
    110      *                                                                  *
    111      *   Record core management                                         *
    112      *                                                                  *
     110     *
     111     *   Record core management
     112     *
    113113     ********************************************************************/
    114114
     
    175175
    176176    /* ******************************************************************
    177      *                                                                  *
    178      *   CNRINFO management                                             *
    179      *                                                                  *
     177     *
     178     *   CNRINFO management
     179     *
    180180     ********************************************************************/
    181181
     
    403403
    404404    /* ******************************************************************
    405      *                                                                  *
    406      *   View management                                                *
    407      *                                                                  *
     405     *
     406     *   View management
     407     *
    408408     ********************************************************************/
    409409
     
    472472
    473473    /* ******************************************************************
    474      *                                                                  *
    475      *   Record relations/iteration                                     *
    476      *                                                                  *
     474     *
     475     *   Record relations/iteration
     476     *
    477477     ********************************************************************/
    478478
     
    480480                              PRECORDCORE precc);
    481481
    482     typedef ULONG (EXPENTRY FNCBRECC)(HWND, PRECORDCORE, ULONG, ULONG);
     482    typedef ULONG EXPENTRY FNCBRECC(HWND, PRECORDCORE, ULONG, ULONG);
    483483    typedef FNCBRECC *PFNCBRECC;
    484484
     
    539539
    540540    /* ******************************************************************
    541      *                                                                  *
    542      *   Miscellaneous                                                  *
    543      *                                                                  *
     541     *
     542     *   Miscellaneous
     543     *
    544544     ********************************************************************/
    545545
  • trunk/include/helpers/comctl.h

    r7 r14  
    1111
    1212/*      Copyright (C) 1997-2000 Ulrich M”ller.
    13  *      This file is part of the XWorkplace source package.
    14  *      XWorkplace is free software; you can redistribute it and/or modify
     13 *      This file is part of the "XWorkplace helpers" source package.
     14 *      This is free software; you can redistribute it and/or modify
    1515 *      it under the terms of the GNU General Public License as published
    1616 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4040
    4141    /* ******************************************************************
    42      *                                                                  *
    43      *   "Menu button" control                                          *
    44      *                                                                  *
     42     *
     43     *   "Menu button" control
     44     *
    4545     ********************************************************************/
    4646
    47      BOOL ctlMakeMenuButton(HWND hwndButton,
    48                             HMODULE hmodMenu,
    49                             ULONG idMenu);
     47    VOID ctlDisplayButtonMenu(HWND hwndButton,
     48                              HWND hwndMenu);
     49
     50    BOOL ctlMakeMenuButton(HWND hwndButton,
     51                           HMODULE hmodMenu,
     52                           ULONG idMenu);
    5053
    5154    /* ******************************************************************
    52      *                                                                  *
    53      *   Progress bars                                                  *
    54      *                                                                  *
     55     *
     56     *   Progress bars
     57     *
    5558     ********************************************************************/
    5659
     
    8588
    8689    /* ******************************************************************
    87      *                                                                  *
    88      *   Chart Control                                                  *
    89      *                                                                  *
     90     *
     91     *   Chart Control
     92     *
    9093     ********************************************************************/
    9194
     
    236239
    237240    /* ******************************************************************
    238      *                                                                  *
    239      *   Split bars                                                     *
    240      *                                                                  *
     241     *
     242     *   Split bars
     243     *
    241244     ********************************************************************/
    242245
     
    358361
    359362    /* ******************************************************************
    360      *                                                                  *
    361      *   Subclassed Static Bitmap Control                               *
    362      *                                                                  *
     363     *
     364     *   Subclassed Static Bitmap Control
     365     *
    363366     ********************************************************************/
    364367
     
    424427
    425428    /* ******************************************************************
    426      *                                                                  *
    427      *   "Tooltip" control                                              *
    428      *                                                                  *
     429     *
     430     *   "Tooltip" control
     431     *
    429432     ********************************************************************/
    430433
     
    701704
    702705    /* ******************************************************************
    703      *                                                                  *
    704      *   Checkbox container record cores                                *
    705      *                                                                  *
     706     *
     707     *   Checkbox container record cores
     708     *
    706709     ********************************************************************/
    707710
     
    777780
    778781    /* ******************************************************************
    779      *                                                                  *
    780      *   Hotkey entry field                                             *
    781      *                                                                  *
     782     *
     783     *   Hotkey entry field
     784     *
    782785     ********************************************************************/
    783786
  • trunk/include/helpers/datetime.h

    r7 r14  
    1414
    1515/*      Copyright (C) 1997-2000 Ulrich M”ller.
    16  *      This file is part of the XWorkplace source package.
    17  *      XWorkplace is free software; you can redistribute it and/or modify
     16 *      This file is part of the "XWorkplace helpers" source package.
     17 *      This is free software; you can redistribute it and/or modify
    1818 *      it under the terms of the GNU General Public License as published
    1919 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4141                             DATETIME* pdt);
    4242
     43    ULONG dtDayOfWeek(ULONG day,
     44                      ULONG mon,
     45                      ULONG yr);
     46
    4347    int dtIsLeapYear(unsigned yr);
    4448
     
    5660                       unsigned *pday);
    5761
     62    BOOL dtIsValidDate(LONG day,
     63                       LONG month,
     64                       ULONG year);
    5865#if __cplusplus
    5966}
  • trunk/include/helpers/debug.h

    r7 r14  
    4343
    4444    /********************************************************************
    45      *                                                                  *
    46      *   SYM file declarations                                          *
    47      *                                                                  *
     45     *
     46     *   SYM file declarations
     47     *
    4848     ********************************************************************/
    4949
     
    135135
    136136    /********************************************************************
    137      *                                                                  *
    138      *   EXE declarations taken from exe.h                              *
    139      *                                                                  *
     137     *
     138     *   EXE declarations taken from exe.h
     139     *
    140140     ********************************************************************/
    141141
     
    185185
    186186    /********************************************************************
    187      *                                                                  *
    188      *   Object Module Format (OMF) declarations                        *
    189      *                                                                  *
     187     *
     188     *   Object Module Format (OMF) declarations
     189     *
    190190     ********************************************************************/
    191191
     
    631631
    632632    /********************************************************************
    633      *                                                                  *
    634      *   Prototypes                                                     *
    635      *                                                                  *
     633     *
     634     *   Prototypes
     635     *
    636636     ********************************************************************/
    637637
     
    674674
    675675    /********************************************************************
    676      *                                                                  *
    677      *   Executable definitions                                         *
    678      *                                                                  *
     676     *
     677     *   Executable definitions
     678     *
    679679     ********************************************************************/
    680680
  • trunk/include/helpers/dosh.h

    r7 r14  
    1717/*      This file Copyright (C) 1997-2000 Ulrich M”ller,
    1818 *                                        Dmitry A. Steklenev.
    19  *      This file is part of the XWorkplace source package.
    20  *      XWorkplace is free software; you can redistribute it and/or modify
     19 *      This file is part of the "XWorkplace helpers" source package.
     20 *      This is free software; you can redistribute it and/or modify
    2121 *      it under the terms of the GNU General Public License as published
    2222 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3636
    3737    /* ******************************************************************
    38      *                                                                  *
    39      *   Miscellaneous                                                  *
    40      *                                                                  *
     38     *
     39     *   Miscellaneous
     40     *
    4141     ********************************************************************/
    4242
     
    4747    BOOL doshIsWarp4(VOID);
    4848
     49    APIRET doshQueryAvailPhysMem(PULONG pulMem,
     50                                 ULONG ulLogicalSwapDrive);
     51
    4952    PSZ doshQuerySysErrorMsg(APIRET arc);
    5053
    5154    /* ******************************************************************
    52      *                                                                  *
    53      *   Memory helpers                                                 *
    54      *                                                                  *
     55     *
     56     *   Memory helpers
     57     *
    5558     ********************************************************************/
    5659
     
    6164
    6265    /* ******************************************************************
    63      *                                                                  *
    64      *   Drive helpers                                                  *
    65      *                                                                  *
     66     *
     67     *   Drive helpers
     68     *
    6669     ********************************************************************/
    6770
     
    7477    APIRET doshAssertDrive(ULONG ulLogicalDrive);
    7578
    76     double doshQueryDiskFree(ULONG ulLogicalDrive);
     79    APIRET doshSetLogicalMap(ULONG ulLogicalDrive);
     80
     81    APIRET doshQueryDiskFree(ULONG ulLogicalDrive,
     82                             double *pdFree);
    7783
    7884    APIRET doshQueryDiskFSType(ULONG ulLogicalDrive,
     
    174180
    175181    /* ******************************************************************
    176      *                                                                  *
    177      *   File helpers                                                   *
    178      *                                                                  *
     182     *
     183     *   File helpers
     184     *
    179185     ********************************************************************/
    180186
     
    213219
    214220    /* ******************************************************************
    215      *                                                                  *
    216      *   Directory helpers                                              *
    217      *                                                                  *
     221     *
     222     *   Directory helpers
     223     *
    218224     ********************************************************************/
    219225
     
    236242
    237243    /* ******************************************************************
    238      *                                                                  *
    239      *   Process helpers                                                *
    240      *                                                                  *
     244     *
     245     *   Performance Counters (CPU Load)
     246     *
     247     ********************************************************************/
     248
     249    #define CMD_PERF_INFO           0x41
     250    #define CMD_KI_ENABLE           0x60
     251    #define CMD_KI_DISABLE          0x61
     252    #ifndef CMD_KI_RDCNT
     253        #define CMD_KI_RDCNT            0x63
     254        typedef APIRET APIENTRY FNDOSPERFSYSCALL(ULONG ulCommand,
     255                                                 ULONG ulParm1,
     256                                                 ULONG ulParm2,
     257                                                 ULONG ulParm3);
     258        typedef FNDOSPERFSYSCALL *PFNDOSPERFSYSCALL;
     259    #endif
     260
     261    typedef struct _CPUUTIL
     262    {
     263        ULONG ulTimeLow;     // low 32 bits of time stamp
     264        ULONG ulTimeHigh;    // high 32 bits of time stamp
     265        ULONG ulIdleLow;     // low 32 bits of idle time
     266        ULONG ulIdleHigh;    // high 32 bits of idle time
     267        ULONG ulBusyLow;     // low 32 bits of busy time
     268        ULONG ulBusyHigh;    // high 32 bits of busy time
     269        ULONG ulIntrLow;     // low 32 bits of interrupt time
     270        ULONG ulIntrHigh;    // high 32 bits of interrupt time
     271    } CPUUTIL, *PCPUUTIL;
     272
     273    // macro to convert 8-byte (low, high) time value to double
     274    #define LL2F(high, low) (4294967296.0*(high)+(low))
     275
     276    /*
     277     *@@ DOSHPERFSYS:
     278     *      structure used with doshPerfOpen.
     279     *
     280     *@@added V0.9.7 (2000-12-02) [umoeller]
     281     */
     282
     283    typedef struct _DOSHPERFSYS
     284    {
     285        // output: no. of processors on the system
     286        ULONG       cProcessors;
     287        // output: one CPU load for each CPU
     288        PLONG       palLoads;
     289
     290        // each of the following ptrs points to an array of cProcessors items
     291        PCPUUTIL    paCPUUtils;     // CPUUTIL structures
     292        double      *padBusyPrev;   // previous "busy" calculations
     293        double      *padTimePrev;   // previous "time" calculations
     294
     295        // private stuff
     296        HMODULE     hmod;
     297        BOOL        fInitialized;
     298        PFNDOSPERFSYSCALL pDosPerfSysCall;
     299    } DOSHPERFSYS, *PDOSHPERFSYS;
     300
     301    APIRET doshPerfOpen(PDOSHPERFSYS *ppPerfSys);
     302
     303    APIRET doshPerfGet(PDOSHPERFSYS pPerfSys);
     304
     305    APIRET doshPerfClose(PDOSHPERFSYS *ppPerfSys);
     306
     307    /* ******************************************************************
     308     *
     309     *   Process helpers
     310     *
    241311     ********************************************************************/
    242312
     
    253323
    254324    /* ******************************************************************
    255      *                                                                  *
    256      *   Environment helpers                                            *
    257      *                                                                  *
     325     *
     326     *   Environment helpers
     327     *
    258328     ********************************************************************/
    259329
     
    291361
    292362    /* ******************************************************************
    293      *                                                                  *
    294      *   Module handling helpers                                        *
    295      *                                                                  *
     363     *
     364     *   Module handling helpers
     365     *
    296366     ********************************************************************/
    297367
     
    316386
    317387    /********************************************************************
    318      *                                                                  *
    319      *   Executable helpers                                             *
    320      *                                                                  *
     388     *
     389     *   Executable helpers
     390     *
    321391     ********************************************************************/
    322392
     
    548618
    549619    /********************************************************************
    550      *                                                                  *
    551      *   Partition functions                                            *
    552      *                                                                  *
     620     *
     621     *   Partition functions
     622     *
    553623     ********************************************************************/
    554624
  • trunk/include/helpers/eah.h

    r7 r14  
    4949 *      This file Copyright (C) 1997-2000 Ulrich M”ller,
    5050 *                                        Massachusetts Institute of Technology.
    51  *      This file is part of the XWorkplace source package.
    52  *      XWorkplace is free software; you can redistribute it and/or modify
     51 *      This file is part of the "XWorkplace helpers" source package.
     52 *      This is free software; you can redistribute it and/or modify
    5353 *      it under the terms of the GNU General Public License as published
    5454 *      by the Free Software Foundation, in version 2 as it comes in the
     
    115115
    116116    /* ******************************************************************
    117      *                                                                  *
    118      *   Read-EA functions                                              *
    119      *                                                                  *
     117     *
     118     *   Read-EA functions
     119     *
    120120     ********************************************************************/
    121121
    122122    ULONG eaHFileQueryTotalSize(HFILE hFile);
    123123
    124     ULONG eaPathQueryTotalSize(PSZ path);
     124    ULONG eaPathQueryTotalSize(const char *pcszPath);
    125125
    126126    PEALIST eaHFileReadAll(HFILE hfile);
    127127
    128     PEALIST eaPathReadAll(PSZ path);
     128    PEALIST eaPathReadAll(const char *pcszPath);
    129129
    130130    PEABINDING eaHFileReadOneByIndex(HFILE hfile, ULONG index);
    131131
    132     PEABINDING eaPathReadOneByIndex(PSZ path, ULONG index);
    133 
    134     PEABINDING eaHFileReadOneByName(HFILE hfile, PSZ name);
    135 
    136     PEABINDING eaPathReadOneByName(PSZ path, PSZ name);
     132    PEABINDING eaPathReadOneByIndex(const char *pcszPath, ULONG index);
     133
     134    PEABINDING eaHFileReadOneByName(HFILE hfile, const char *pcszEAName);
     135
     136    PEABINDING eaPathReadOneByName(const char *pcszPath, const char *pcszEAName);
    137137
    138138    /* ******************************************************************
    139      *                                                                  *
    140      *   Write-EA functions                                             *
    141      *                                                                  *
    142      ********************************************************************/
    143 
    144     void eaHFileWriteAll(HFILE hfile, PEALIST list);
    145 
    146     void eaPathWriteAll(PSZ path, PEALIST list);
    147 
    148     void eaHFileWriteOne(HFILE hfile, PEABINDING peab);
    149 
    150     void eaPathWriteOne(PSZ path, PEABINDING peab);
    151 
    152     void eaPathDeleteOne(PSZ path, PSZ pszEAName);
     139     *
     140     *   Write-EA functions
     141     *
     142     ********************************************************************/
     143
     144    APIRET eaHFileWriteAll(HFILE hfile, PEALIST list);
     145
     146    APIRET eaPathWriteAll(const char *pcszPath, PEALIST list);
     147
     148    APIRET eaHFileWriteOne(HFILE hfile, PEABINDING peab);
     149
     150    APIRET eaPathWriteOne(const char *pcszPath, PEABINDING peab);
     151
     152    APIRET eaPathDeleteOne(const char *pcszPath, const char *pcszEAName);
    153153
    154154    /********************************************************************
    155      *                                                                  *
    156      *   Translation funcs                                              *
    157      *                                                                  *
     155     *
     156     *   Translation funcs
     157     *
    158158     ********************************************************************/
    159159
     
    162162    PSZ eaCreatePSZFromBinding(PEABINDING peab);
    163163
    164     PEABINDING eaCreateBindingFromPSZ(PSZ pszEAName,
    165                              PSZ pszString);
     164    PEABINDING eaCreateBindingFromPSZ(const char *pcszEAName,
     165                                      const char *pcszInput);
    166166
    167167    USHORT eaQueryMVCount(PEABINDING peab,
     
    170170
    171171    PSZ eaQueryMVItem(PEABINDING peab,
    172                                 USHORT usIndex,
    173                                 PUSHORT pusEAType,
    174                                 PUSHORT pusCodepage,
    175                                 PUSHORT pusDataLength);
     172                      USHORT usIndex,
     173                      PUSHORT pusEAType,
     174                      PUSHORT pusCodepage,
     175                      PUSHORT pusDataLength);
    176176
    177177    PSZ eaCreatePSZFromMVBinding(PEABINDING peab,
    178                                  PSZ     pszSeparator,
     178                                 const char *pcszSeparator,
    179179                                 PUSHORT pusCodepage);
    180180
    181     PEABINDING eaCreateMVBindingFromPSZ(PSZ pszEAName,
    182                                         PSZ pszInput,
    183                                         PSZ pszSeparator,
     181    PEABINDING eaCreateMVBindingFromPSZ(const char *pcszEAName,
     182                                        const char *pcszInput,
     183                                        const char *pcszSeparator,
    184184                                        USHORT usCodepage);
    185185
    186186    /* ******************************************************************
    187      *                                                                  *
    188      *   Direct plain-string EA handling                                *
    189      *                                                                  *
     187     *
     188     *   Direct plain-string EA handling
     189     *
    190190     ********************************************************************/
    191191
  • trunk/include/helpers/except.h

    r7 r14  
    5353
    5454    /********************************************************************
    55      *                                                                  *
    56      *   Declarations                                                   *
    57      *                                                                  *
     55     *
     56     *   Declarations
     57     *
    5858     ********************************************************************/
     59
     60    // forward declaration
     61    typedef struct _EXCEPTIONREGISTRATIONRECORD2 *PEXCEPTIONREGISTRATIONRECORD2;
    5962
    6063    // "OnKill" function prototype for EXCEPTIONREGISTRATIONRECORD2
    6164    // added V0.9.0 (99-10-22) [umoeller]
    62     typedef VOID APIENTRY FNEXCONKILL(VOID);
    63     typedef FNEXCONKILL *PFNEXCONKILL;
     65    // removed V0.9.7 (2000-12-08) [umoeller]
     66    // typedef VOID APIENTRY FNEXCONKILL(PEXCEPTIONREGISTRATIONRECORD2);
     67    // typedef FNEXCONKILL *PFNEXCONKILL;
    6468
    6569    /*
     
    7781        PFN             pfnHandler;         // as in EXCEPTIONREGISTRATIONRECORD
    7882        jmp_buf         jmpThread;          // additional buffer for setjmp
    79         PFNEXCONKILL    pfnOnKill;          // subroutine to call upon process/thread termination
    80     } EXCEPTIONREGISTRATIONRECORD2, *PEXCEPTIONREGISTRATIONRECORD2;
     83        // PFNEXCONKILL    pfnOnKill;          // subroutine to call upon process/thread termination
     84        PVOID           pvUser;             // user ptr
     85    } EXCEPTIONREGISTRATIONRECORD2;
    8186
    8287    /*
     
    110115
    111116    /********************************************************************
    112      *                                                                  *
    113      *   Prototypes                                                     *
    114      *                                                                  *
     117     *
     118     *   Prototypes
     119     *
    115120     ********************************************************************/
    116121
     
    133138
    134139    /********************************************************************
    135      *                                                                  *
    136      *   Macros                                                         *
    137      *                                                                  *
     140     *
     141     *   Macros
     142     *
    138143     ********************************************************************/
    139144
     
    142147    #ifdef __NO_EXCEPTION_HANDLERS__
    143148        // exception handlers can completely be disabled
    144         #define TRY_LOUD(excptstruct, _pfnOnKill)
    145     #else
    146         #define TRY_LOUD(excptstruct, _pfnOnKill)                               \
     149        #define TRY_LOUD(excptstruct)
     150    #else
     151        #define TRY_LOUD(excptstruct)                                           \
    147152                {                                                               \
    148153                    EXCEPTSTRUCT          excptstruct = {0};                    \
    149154                    excptstruct.RegRec2.pfnHandler = (PFN)excHandlerLoud;       \
    150                     excptstruct.RegRec2.pfnOnKill = _pfnOnKill;                 \
    151155                    excptstruct.arc = DosSetExceptionHandler(                   \
    152156                                (PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2)); \
     
    159163                    if (excptstruct.ulExcpt == 0)                               \
    160164                    {
    161     #endif
    162 
    163     #ifdef __NO_EXCEPTION_HANDLERS__
    164         // exception handlers can completely be disabled
    165         #define TRY_QUIET(excptstruct, _pfnOnKill)
    166     #else
    167         #define TRY_QUIET(excptstruct, _pfnOnKill)                              \
     165
     166    #endif
     167
     168    #ifdef __NO_EXCEPTION_HANDLERS__
     169        // exception handlers can completely be disabled
     170        #define TRY_QUIET(excptstruct)
     171    #else
     172        #define TRY_QUIET(excptstruct)                                          \
    168173                {                                                               \
    169174                    EXCEPTSTRUCT          excptstruct = {0};                    \
    170175                    excptstruct.RegRec2.pfnHandler = (PFN)excHandlerQuiet;      \
    171                     excptstruct.RegRec2.pfnOnKill = _pfnOnKill;                 \
    172176                    excptstruct.arc = DosSetExceptionHandler(                   \
    173177                                (PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2)); \
     
    180184                    if (excptstruct.ulExcpt == 0)                               \
    181185                    {
     186
    182187    #endif
    183188
     
    192197                    else                                                        \
    193198                    { /* exception occured: */                                  \
    194                         DosUnsetExceptionHandler(                               \
    195                                 (PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2));
     199                        DosUnsetExceptionHandler((PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2));
    196200    #endif
    197201
  • trunk/include/helpers/gpih.h

    r7 r14  
    99 *            numbering.
    1010 *
    11  *@@include #define INCL_GPILOGCOLORTABLE
     11 *@@include #define INCL_GPILOGCOLORTABLE       // for some funcs
    1212 *@@include #include <os2.h>
    1313 *@@include #include "gpih.h"
     
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3535
    3636    /* ******************************************************************
    37      *                                                                  *
    38      *   Device helpers                                                 *
    39      *                                                                  *
     37     *
     38     *   Device helpers
     39     *
    4040     ********************************************************************/
    4141
     
    4343
    4444    /* ******************************************************************
    45      *                                                                  *
    46      *   Color helpers                                                  *
    47      *                                                                  *
     45     *
     46     *   Color helpers
     47     *
    4848     ********************************************************************/
    4949
     
    7272                           BYTE bDivisor);
    7373
    74     /*
    75      *@@ gpihSwitchToRGB:
    76      *      this switches the given HPS into RGB mode.
    77      *      Requires INCL_GPILOGCOLORTABLE.
    78      */
    79 
    80     #define gpihSwitchToRGB(hps)                \
    81         GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
    82 
    83     /* ******************************************************************
    84      *                                                                  *
    85      *   Drawing primitives helpers                                     *
    86      *                                                                  *
     74    #ifdef INCL_GPILOGCOLORTABLE
     75
     76        /*
     77         *@@ gpihSwitchToRGB:
     78         *      this switches the given HPS into RGB mode.
     79         *      Requires INCL_GPILOGCOLORTABLE.
     80         */
     81
     82        #define gpihSwitchToRGB(hps)                \
     83            GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
     84
     85    #endif
     86
     87    /* ******************************************************************
     88     *
     89     *   Drawing primitives helpers
     90     *
    8791     ********************************************************************/
    8892
     
    100104                    LONG lColor);
    101105
    102     VOID gpihDraw3DFrame(HPS hps,
    103                          PRECTL prcl,
    104                          USHORT usWidth,
    105                          LONG lColorLeft,
    106                          LONG lColorRight);
     106    VOID gpihDrawThickFrame(HPS hps,
     107                            PRECTL prcl,
     108                            ULONG ulWidth);
     109
     110    VOID APIENTRY gpihDraw3DFrame(HPS hps,
     111                                  PRECTL prcl,
     112                                  USHORT usWidth,
     113                                  LONG lColorLeft,
     114                                  LONG lColorRight);
     115    typedef VOID APIENTRY GPIHDRAW3DFRAME(HPS hps,
     116                                          PRECTL prcl,
     117                                          USHORT usWidth,
     118                                          LONG lColorLeft,
     119                                          LONG lColorRight);
     120    typedef GPIHDRAW3DFRAME *PGPIHDRAW3DFRAME;
    107121
    108122    LONG gpihCharStringPosAt(HPS hps,
     
    114128
    115129    /* ******************************************************************
    116      *                                                                  *
    117      *   Font helpers                                                   *
    118      *                                                                  *
     130     *
     131     *   Font helpers
     132     *
    119133     ********************************************************************/
    120134
     
    144158
    145159    /* ******************************************************************
    146      *                                                                  *
    147      *   Bitmap helpers                                                 *
    148      *                                                                  *
     160     *
     161     *   Bitmap helpers
     162     *
    149163     ********************************************************************/
    150164
  • trunk/include/helpers/level.h

    r7 r14  
    1010 *      Copyright (C) 2000 Ulrich M”ller.
    1111 *      Copyright (C) 1994 Martin Lafaix (EDM/2 2-05).
    12  *      This file is part of the XWorkplace source package.
    13  *      XWorkplace is free software; you can redistribute it and/or modify
     12 *      This file is part of the "XWorkplace helpers" source package.
     13 *      This is free software; you can redistribute it and/or modify
    1414 *      it under the terms of the GNU General Public License as published
    1515 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/linklist.h

    r10 r14  
    1313
    1414/*      Copyright (C) 1997-2000 Ulrich M”ller.
    15  *      This file is part of the XWorkplace source package.
    16  *      XWorkplace is free software; you can redistribute it and/or modify
     15 *      This file is part of the "XWorkplace helpers" source package.
     16 *      This is free software; you can redistribute it and/or modify
    1717 *      it under the terms of the GNU General Public License as published
    1818 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3131    #define LINKLIST_HEADER_INCLUDED
    3232
     33    #ifndef XWPENTRY
     34        #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
     35    #endif
     36
    3337    // define some basic things to make this work even with standard C
    3438    #if (!defined OS2_INCLUDED) && (!defined _OS2_H) && (!defined __SIMPLES_DEFINED)   // changed V0.9.0 (99-10-22) [umoeller]
     
    9296
    9397    /* ******************************************************************
    94      *                                                                  *
    95      *   List base functions                                            *
    96      *                                                                  *
     98     *
     99     *   List base functions
     100     *
    97101     ********************************************************************/
    98102
    99     void lstInit(PLINKLIST pList, BOOL fItemsFreeable);
     103    void* XWPENTRY lstMalloc(size_t size);
     104    typedef void* XWPENTRY LSTMALLOC(size_t size);
     105    typedef LSTMALLOC *PLSTMALLOC;
     106
     107    void* XWPENTRY lstStrDup(const char *pcsz);
     108    typedef void* XWPENTRY LSTSTRDUP(const char *pcsz);
     109    typedef LSTSTRDUP *PLSTSTRDUP;
     110
     111    void XWPENTRY lstInit(PLINKLIST pList, BOOL fItemsFreeable);
     112    typedef void XWPENTRY LSTINIT(PLINKLIST pList, BOOL fItemsFreeable);
     113    typedef LSTINIT *PLSTINIT;
    100114
    101115    #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c
    102         PLINKLIST lstCreateDebug(BOOL fItemsFreeable,
    103                                  const char *file,
    104                                  unsigned long line,
    105                                  const char *function);
     116        PLINKLIST XWPENTRY lstCreateDebug(BOOL fItemsFreeable,
     117                                          const char *file,
     118                                          unsigned long line,
     119                                          const char *function);
     120        typedef PLINKLIST XWPENTRY LSTCREATEDEBUG(BOOL fItemsFreeable,
     121                                          const char *file,
     122                                          unsigned long line,
     123                                          const char *function);
     124        typedef LSTCREATEDEBUG *PLSTCREATEDEBUG;
    106125
    107126        #define lstCreate(b) lstCreateDebug((b), __FILE__, __LINE__, __FUNCTION__)
    108127    #else
    109         PLINKLIST lstCreate(BOOL fItemsFreeable);
    110     #endif
    111 
    112     BOOL lstFree(PLINKLIST pList);
    113 
    114     BOOL lstClear(PLINKLIST pList);
    115 
    116     long lstCountItems(PLINKLIST pList);
    117 
    118     PLISTNODE lstQueryFirstNode(PLINKLIST pList);
    119 
    120     PLISTNODE lstNodeFromIndex(PLINKLIST pList, unsigned long ulIndex);
    121 
    122     PLISTNODE lstNodeFromItem(PLINKLIST pList, void* pItemData);
    123 
    124     void* lstItemFromIndex(PLINKLIST pList, unsigned long ulIndex);
     128        PLINKLIST XWPENTRY lstCreate(BOOL fItemsFreeable);
     129        typedef PLINKLIST XWPENTRY LSTCREATE(BOOL fItemsFreeable);
     130        typedef LSTCREATE *PLSTCREATE;
     131    #endif
     132
     133    BOOL XWPENTRY lstFree(PLINKLIST pList);
     134    typedef BOOL XWPENTRY LSTFREE(PLINKLIST pList);
     135    typedef LSTFREE *PLSTFREE;
     136
     137    BOOL XWPENTRY lstClear(PLINKLIST pList);
     138    typedef BOOL XWPENTRY LSTCLEAR(PLINKLIST pList);
     139    typedef LSTCLEAR *PLSTCLEAR;
     140
     141    long XWPENTRY lstCountItems(PLINKLIST pList);
     142    typedef long XWPENTRY LSTCOUNTITEMS(PLINKLIST pList);
     143    typedef LSTCOUNTITEMS *PLSTCOUNTITEMS;
     144
     145    PLISTNODE XWPENTRY lstQueryFirstNode(PLINKLIST pList);
     146    typedef PLISTNODE XWPENTRY LSTQUERYFIRSTNODE(PLINKLIST pList);
     147    typedef LSTQUERYFIRSTNODE *PLSTQUERYFIRSTNODE;
     148
     149    PLISTNODE XWPENTRY lstNodeFromIndex(PLINKLIST pList, unsigned long ulIndex);
     150    typedef PLISTNODE XWPENTRY LSTNODEFROMINDEX(PLINKLIST pList, unsigned long ulIndex);
     151    typedef LSTNODEFROMINDEX *PLSTNODEFROMINDEX;
     152
     153    PLISTNODE XWPENTRY lstNodeFromItem(PLINKLIST pList, void* pItemData);
     154    typedef PLISTNODE XWPENTRY LSTNODEFROMITEM(PLINKLIST pList, void* pItemData);
     155    typedef LSTNODEFROMITEM *PLSTNODEFROMITEM;
     156
     157    void* XWPENTRY lstItemFromIndex(PLINKLIST pList, unsigned long ulIndex);
     158    typedef void* XWPENTRY LSTITEMFROMINDEX(PLINKLIST pList, unsigned long ulIndex);
     159    typedef LSTITEMFROMINDEX *PLSTITEMFROMINDEX;
    125160
    126161    #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c
    127         PLISTNODE lstAppendItemDebug(PLINKLIST pList,
    128                                      void* pNewItemData,
    129                                      const char *file,
    130                                      unsigned long line,
    131                                      const char *function);
     162        PLISTNODE XWPENTRY lstAppendItemDebug(PLINKLIST pList,
     163                                              void* pNewItemData,
     164                                              const char *file,
     165                                              unsigned long line,
     166                                              const char *function);
    132167        #define lstAppendItem(pl, pd) lstAppendItemDebug((pl), (pd), __FILE__, __LINE__, __FUNCTION__)
    133168    #else
    134         PLISTNODE lstAppendItem(PLINKLIST pList, void* pNewItemData);
    135     #endif
    136 
    137     PLISTNODE lstInsertItemBefore(PLINKLIST pList,
    138                                   void* pNewItemData,
    139                                   unsigned long ulIndex);
    140 
    141     BOOL lstRemoveNode(PLINKLIST pList, PLISTNODE pRemoveNode);
    142 
    143     BOOL lstRemoveItem(PLINKLIST pList, void* pRemoveItem);
    144 
    145     BOOL lstSwapNodes(PLISTNODE pNode1,
    146                       PLISTNODE pNode2);
     169        PLISTNODE XWPENTRY lstAppendItem(PLINKLIST pList, void* pNewItemData);
     170        typedef PLISTNODE XWPENTRY LSTAPPENDITEM(PLINKLIST pList, void* pNewItemData);
     171        typedef LSTAPPENDITEM *PLSTAPPENDITEM;
     172    #endif
     173
     174    PLISTNODE XWPENTRY lstInsertItemBefore(PLINKLIST pList,
     175                                           void* pNewItemData,
     176                                           unsigned long ulIndex);
     177    typedef PLISTNODE XWPENTRY LSTINSERTITEMBEFORE(PLINKLIST pList,
     178                                           void* pNewItemData,
     179                                           unsigned long ulIndex);
     180    typedef LSTINSERTITEMBEFORE *PLSTINSERTITEMBEFORE;
     181
     182    BOOL XWPENTRY lstRemoveNode(PLINKLIST pList, PLISTNODE pRemoveNode);
     183    typedef BOOL XWPENTRY LSTREMOVENODE(PLINKLIST pList, PLISTNODE pRemoveNode);
     184    typedef LSTREMOVENODE *PLSTREMOVENODE;
     185
     186    BOOL XWPENTRY lstRemoveItem(PLINKLIST pList, void* pRemoveItem);
     187    typedef BOOL XWPENTRY LSTREMOVEITEM(PLINKLIST pList, void* pRemoveItem);
     188    typedef LSTREMOVEITEM *PLSTREMOVEITEM;
     189
     190    BOOL XWPENTRY lstSwapNodes(PLISTNODE pNode1, PLISTNODE pNode2);
     191    typedef BOOL XWPENTRY LSTSWAPNODES(PLISTNODE pNode1, PLISTNODE pNode2);
     192    typedef LSTSWAPNODES *PLSTSWAPNODES;
    147193
    148194    /* ******************************************************************
    149      *                                                                  *
    150      *   List sorting                                                   *
    151      *                                                                  *
     195     *
     196     *   List sorting
     197     *
    152198     ********************************************************************/
    153199
    154     BOOL lstQuickSort(PLINKLIST pList,
    155                       PFNSORTLIST pfnSort,
    156                       void* pStorage);
    157 
    158     BOOL lstBubbleSort(PLINKLIST pList,
    159                        PFNSORTLIST pfnSort,
    160                        void* pStorage);
     200    BOOL XWPENTRY lstQuickSort(PLINKLIST pList,
     201                               PFNSORTLIST pfnSort,
     202                               void* pStorage);
     203
     204    BOOL XWPENTRY lstBubbleSort(PLINKLIST pList,
     205                                PFNSORTLIST pfnSort,
     206                                void* pStorage);
    161207
    162208#endif
  • trunk/include/helpers/memdebug.h

    r13 r14  
    1313
    1414/*      Copyright (C) 2000 Ulrich M”ller.
    15  *      This file is part of the XWorkplace source package.
    16  *      XWorkplace is free software; you can redistribute it and/or modify
     15 *      This file is part of the "XWorkplace helpers" source package.
     16 *      This is free software; you can redistribute it and/or modify
    1717 *      it under the terms of the GNU General Public License as published
    1818 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/prfh.h

    r7 r14  
    1919
    2020/*      Copyright (C) 1997-2000 Ulrich M”ller.
    21  *      This file is part of the XWorkplace source package.
    22  *      XWorkplace is free software; you can redistribute it and/or modify
     21 *      This file is part of the "XWorkplace helpers" source package.
     22 *      This is free software; you can redistribute it and/or modify
    2323 *      it under the terms of the GNU General Public License as published
    2424 *      by the Free Software Foundation, in version 2 as it comes in the
     
    9696                cTimeSep,
    9797                        // time separator (e.g. ':')
     98                cDecimal,
     99                        // decimal separator (e.g. '.')
    98100                cThousands;
    99101                        // thousands separator (e.g. ',')
  • trunk/include/helpers/procstat.h

    r7 r14  
    1717 *      This file Copyright (C) 1992-99 Ulrich M”ller,
    1818 *                                      Kai Uwe Rommel.
    19  *      This file is part of the XWorkplace source package.
    20  *      XWorkplace is free software; you can redistribute it and/or modify
     19 *      This file is part of the "XWorkplace helpers" source package.
     20 *      This is free software; you can redistribute it and/or modify
    2121 *      it under the terms of the GNU General Public License as published
    2222 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838
    3939    /********************************************************************
    40      *                                                                  *
    41      *   DosQProcStatus declarations (16-bit)                           *
    42      *                                                                  *
     40     *
     41     *   DosQProcStatus declarations (16-bit)
     42     *
    4343     ********************************************************************/
    4444
     
    230230
    231231    /********************************************************************
    232      *                                                                  *
    233      *   DosQuerySysState declarations (32-bit)                         *
    234      *                                                                  *
     232     *
     233     *   DosQuerySysState declarations (32-bit)
     234     *
    235235     ********************************************************************/
    236236
     
    596596
    597597    /********************************************************************
    598      *                                                                  *
    599      *   New procstat.c declarations                                    *
    600      *                                                                  *
     598     *
     599     *   New procstat.c declarations
     600     *
    601601     ********************************************************************/
    602602
     
    639639
    640640   /********************************************************************
    641     *                                                                  *
    642     *   DosQProcStat (16-bit) interface                                *
    643     *                                                                  *
     641    *
     642    *   DosQProcStat (16-bit) interface
     643    *
    644644    ********************************************************************/
    645645
     
    655655
    656656    /********************************************************************
    657      *                                                                  *
    658      *   DosQProcStat (16-bit) helpers                                  *
    659      *                                                                  *
     657     *
     658     *   DosQProcStat (16-bit) helpers
     659     *
    660660     ********************************************************************/
    661661
     
    671671
    672672    /********************************************************************
    673      *                                                                  *
    674      *   DosQuerySysState (32-bit) interface                            *
    675      *                                                                  *
     673     *
     674     *   DosQuerySysState (32-bit) interface
     675     *
    676676     ********************************************************************/
    677677
  • trunk/include/helpers/shapewin.h

    r7 r14  
    1818 *                  Akira Hatakeyama,
    1919 *                  Takayuki Suwa.
    20  *      This file is part of the XWorkplace source package.
    21  *      XWorkplace is free software; you can redistribute it and/or modify
     20 *      This file is part of the "XWorkplace helpers" source package.
     21 *      This is free software; you can redistribute it and/or modify
    2222 *      it under the terms of the GNU General Public License as published
    2323 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/stringh.h

    r13 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    7070    ULONG strhWords(PSZ psz);
    7171
    72     PSZ strhThousandsULong(PSZ pszTarget, ULONG ul, CHAR cThousands);
     72    PSZ APIENTRY strhThousandsULong(PSZ pszTarget, ULONG ul, CHAR cThousands);
     73    typedef PSZ APIENTRY STRHTHOUSANDSULONG(PSZ pszTarget, ULONG ul, CHAR cThousands);
     74    typedef STRHTHOUSANDSULONG *PSTRHTHOUSANDSULONG;
    7375
    7476    PSZ strhThousandsDouble(PSZ pszTarget, double dbl, CHAR cThousands);
     
    8789                      CHAR cTimeSep);
    8890
    89     VOID strhDateTime(PSZ pszDate,
    90                       PSZ pszTime,
    91                       DATETIME *pDateTime,
    92                       ULONG ulDateFormat,
    93                       CHAR cDateSep,
    94                       ULONG ulTimeFormat,
    95                       CHAR cTimeSep);
     91    VOID APIENTRY strhDateTime(PSZ pszDate,
     92                               PSZ pszTime,
     93                               DATETIME *pDateTime,
     94                               ULONG ulDateFormat,
     95                               CHAR cDateSep,
     96                               ULONG ulTimeFormat,
     97                               CHAR cTimeSep);
     98    typedef VOID APIENTRY STRHDATETIME(PSZ pszDate,
     99                               PSZ pszTime,
     100                               DATETIME *pDateTime,
     101                               ULONG ulDateFormat,
     102                               CHAR cDateSep,
     103                               ULONG ulTimeFormat,
     104                               CHAR cTimeSep);
     105    typedef STRHDATETIME *PSTRHDATETIME;
    96106
    97107    #define STRH_BEGIN_CHARS    "\x0d\x0a "
     
    156166
    157167    /* ******************************************************************
    158      *                                                                  *
    159      *   Miscellaneous                                                  *
    160      *                                                                  *
     168     *
     169     *   Miscellaneous
     170     *
    161171     ********************************************************************/
    162172
    163173    VOID strhArrayAppend(PSZ *ppszRoot,
    164                          PSZ pszNew,
     174                         const char *pcszNew,
    165175                         PULONG pcbRoot);
    166176
     
    170180
    171181    /* ******************************************************************
    172      *                                                                  *
    173      *   Wildcard matching                                              *
    174      *                                                                  *
     182     *
     183     *   Wildcard matching
     184     *
    175185     ********************************************************************/
    176186
     
    195205
    196206    /* ******************************************************************
    197      *                                                                  *
    198      *   Fast string searches                                           *
    199      *                                                                  *
     207     *
     208     *   Fast string searches
     209     *
    200210     ********************************************************************/
    201211
  • trunk/include/helpers/syssound.h

    r7 r14  
    1515
    1616/*      Copyright (C) 1999-2000 Ulrich M”ller.
    17  *      This file is part of the XWorkplace source package.
    18  *      XWorkplace is free software; you can redistribute it and/or modify
     17 *      This file is part of the "XWorkplace helpers" source package.
     18 *      This is free software; you can redistribute it and/or modify
    1919 *      it under the terms of the GNU General Public License as published
    2020 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3535
    3636    /********************************************************************
    37      *                                                                  *
    38      *   Declarations                                                   *
    39      *                                                                  *
     37     *
     38     *   Declarations
     39     *
    4040     ********************************************************************/
    4141
     
    6363
    6464    /********************************************************************
    65      *                                                                  *
    66      *   Function prototypes                                            *
    67      *                                                                  *
     65     *
     66     *   Function prototypes
     67     *
    6868     ********************************************************************/
    6969
  • trunk/include/helpers/textv_html.h

    r7 r14  
    99
    1010/*      Copyright (C) 2000 Ulrich M”ller.
    11  *      This file is part of the XWorkplace source package.
    12  *      XWorkplace is free software; you can redistribute it and/or modify
     11 *      This file is part of the "XWorkplace helpers" source package.
     12 *      This is free software; you can redistribute it and/or modify
    1313 *      it under the terms of the GNU General Public License as published
    1414 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3232
    3333    /* ******************************************************************
    34      *                                                                  *
    35      *   HTML converter                                                 *
    36      *                                                                  *
     34     *
     35     *   HTML converter
     36     *
    3737     ********************************************************************/
    3838
  • trunk/include/helpers/textview.h

    r12 r14  
    99
    1010/*      Copyright (C) 2000 Ulrich M”ller.
    11  *      This file is part of the XWorkplace source package.
    12  *      XWorkplace is free software; you can redistribute it and/or modify
     11 *      This file is part of the "XWorkplace helpers" source package.
     12 *      This is free software; you can redistribute it and/or modify
    1313 *      it under the terms of the GNU General Public License as published
    1414 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3434
    3535    /* ******************************************************************
    36      *                                                                  *
    37      *   Escape sequences                                               *
    38      *                                                                  *
     36     *
     37     *   Escape sequences
     38     *
    3939     ********************************************************************/
    4040
     
    151151
    152152    /* ******************************************************************
    153      *                                                                  *
    154      *   Device-independent functions                                   *
    155      *                                                                  *
     153     *
     154     *   Device-independent functions
     155     *
    156156     ********************************************************************/
    157157
     
    380380
    381381    /* ******************************************************************
    382      *                                                                  *
    383      *   Window-dependent functions                                     *
    384      *                                                                  *
     382     *
     383     *   Window-dependent functions
     384     *
    385385     ********************************************************************/
    386386
     
    474474
    475475    /* ******************************************************************
    476      *                                                                  *
    477      *   Printer-dependent functions                                    *
    478      *                                                                  *
     476     *
     477     *   Printer-dependent functions
     478     *
    479479     ********************************************************************/
    480480
  • trunk/include/helpers/threads.h

    r7 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/tree.h

    r13 r14  
    1212 *      Copyright (C) 1991-99 iMatix Corporation.
    1313 *      Copyright (C) 2000 Ulrich M”ller.
    14  *      This file is part of the XWorkplace source package.
    15  *      XWorkplace is free software; you can redistribute it and/or modify
     14 *      This file is part of the "XWorkplace helpers" source package.
     15 *      This is free software; you can redistribute it and/or modify
    1616 *      it under the terms of the GNU General Public License as published
    1717 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/undoc.h

    r7 r14  
    1515
    1616/*      Copyright (C) 1997-2000 Ulrich M”ller.
    17  *      This file is part of the XWorkplace source package.
    18  *      XWorkplace is free software; you can redistribute it and/or modify
     17 *      This file is part of the "XWorkplace helpers" source package.
     18 *      This is free software; you can redistribute it and/or modify
    1919 *      it under the terms of the GNU General Public License as published
    2020 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/include/helpers/winh.h

    r7 r14  
    1111
    1212/*      Copyright (C) 1997-2000 Ulrich M”ller.
    13  *      This file is part of the XWorkplace source package.
    14  *      XWorkplace is free software; you can redistribute it and/or modify
     13 *      This file is part of the "XWorkplace helpers" source package.
     14 *      This is free software; you can redistribute it and/or modify
    1515 *      it under the terms of the GNU General Public License as published
    1616 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3434 *@@include #define INCL_WINSYS
    3535 *@@include #define INCL_WINSHELLDATA
     36 *@@include #define INCL_WINSWITCHLIST      // for winhQuerySwitchList
    3637 *@@include #define INCL_WINPROGRAMLIST     // for winhStartApp
    3738 *@@include #define INCL_WINHELP            // for help manager helpers
     
    4748    #define WINH_HEADER_INCLUDED
    4849
    49     /* ******************************************************************
    50      *                                                                  *
    51      *   Declarations                                                   *
    52      *                                                                  *
     50    #ifndef XWPENTRY
     51        #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
     52    #endif
     53
     54    /* ******************************************************************
     55     *
     56     *   Declarations
     57     *
    5358     ********************************************************************/
    5459
     
    6267
    6368    /* ******************************************************************
    64      *                                                                  *
    65      *   Macros                                                         *
    66      *                                                                  *
     69     *
     70     *   Macros
     71     *
    6772     ********************************************************************/
    6873
     
    101106
    102107    /* ******************************************************************
    103      *                                                                  *
    104      *   Menu helpers                                                   *
    105      *                                                                  *
     108     *
     109     *   Menu helpers
     110     *
    106111     ********************************************************************/
    107112
     
    121126                    HWND_DESKTOP, HWND_TOP, 0, 0, 0)
    122127
    123     SHORT winhInsertMenuItem(HWND hwndMenu,
    124                              SHORT iPosition,
    125                              SHORT sItemId,
    126                              PSZ pszItemTitle,
    127                              SHORT afStyle,
    128                              SHORT afAttr);
    129 
    130     HWND winhInsertSubmenu(HWND hwndMenu,
    131                            ULONG iPosition,
    132                            SHORT sMenuId,
    133                            PSZ pszSubmenuTitle,
    134                            USHORT afMenuStyle,
    135                            SHORT sItemId,
    136                            PSZ pszItemTitle,
    137                            USHORT afItemStyle,
    138                            USHORT afAttribute);
     128    SHORT XWPENTRY winhInsertMenuItem(HWND hwndMenu,
     129                                      SHORT iPosition,
     130                                      SHORT sItemId,
     131                                      PSZ pszItemTitle,
     132                                      SHORT afStyle,
     133                                      SHORT afAttr);
     134
     135    HWND XWPENTRY winhInsertSubmenu(HWND hwndMenu,
     136                                    ULONG iPosition,
     137                                    SHORT sMenuId,
     138                                    PSZ pszSubmenuTitle,
     139                                    USHORT afMenuStyle,
     140                                    SHORT sItemId,
     141                                    PSZ pszItemTitle,
     142                                    USHORT afItemStyle,
     143                                    USHORT afAttribute);
    139144
    140145    /*
     
    165170            (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
    166171
    167     SHORT winhInsertMenuSeparator(HWND hMenu,
    168                                   SHORT iPosition,
    169                                   SHORT sId);
    170 
    171     PSZ winhQueryMenuItemText(HWND hwndMenu,
    172                               USHORT usItemID);
    173 
    174     BOOL winhAppend2MenuItemText(HWND hwndMenu,
    175                                  USHORT usItemID,
    176                                  const char *pcszAppend,
    177                                  BOOL fTab);
    178 
    179     VOID winhMenuRemoveEllipse(HWND hwndMenu,
    180                                USHORT usItemId);
    181 
    182     SHORT winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
    183 
    184     /* ******************************************************************
    185      *                                                                  *
    186      *   Slider helpers                                                 *
    187      *                                                                  *
    188      ********************************************************************/
    189 
    190     HWND winhReplaceWithLinearSlider(HWND hwndParent,
    191                                      HWND hwndOwner,
    192                                      HWND hwndInsertAfter,
    193                                      ULONG ulID,
    194                                      ULONG ulSliderStyle,
    195                                      ULONG ulTickCount);
    196 
    197     BOOL winhSetSliderTicks(HWND hwndSlider,
    198                             MPARAM mpEveryOther,
    199                             ULONG ulPixels);
     172    SHORT XWPENTRY winhInsertMenuSeparator(HWND hMenu,
     173                                           SHORT iPosition,
     174                                           SHORT sId);
     175
     176    PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
     177                                       USHORT usItemID);
     178
     179    BOOL XWPENTRY winhAppend2MenuItemText(HWND hwndMenu,
     180                                          USHORT usItemID,
     181                                          const char *pcszAppend,
     182                                          BOOL fTab);
     183
     184    VOID XWPENTRY winhMenuRemoveEllipse(HWND hwndMenu,
     185                                        USHORT usItemId);
     186
     187    SHORT XWPENTRY winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
     188
     189    /* ******************************************************************
     190     *
     191     *   Slider helpers
     192     *
     193     ********************************************************************/
     194
     195    HWND XWPENTRY winhReplaceWithLinearSlider(HWND hwndParent,
     196                                              HWND hwndOwner,
     197                                              HWND hwndInsertAfter,
     198                                              ULONG ulID,
     199                                              ULONG ulSliderStyle,
     200                                              ULONG ulTickCount);
     201
     202    BOOL XWPENTRY winhSetSliderTicks(HWND hwndSlider, MPARAM mpEveryOther, ULONG ulPixels);
    200203
    201204    /*
     
    230233                              0))
    231234
    232     HWND winhReplaceWithCircularSlider(HWND hwndParent,
    233                            HWND hwndOwner,
    234                            HWND hwndInsertAfter,
    235                            ULONG ulID,
    236                            ULONG ulSliderStyle,
    237                            SHORT sMin,
    238                            SHORT sMax,
    239                            USHORT usIncrement,
    240                            USHORT usTicksEvery);
    241 
    242     /* ******************************************************************
    243      *                                                                  *
    244      *   Spin button helpers                                            *
    245      *                                                                  *
    246      ********************************************************************/
    247 
    248     VOID winhSetDlgItemSpinData(HWND hwndDlg,
    249                                ULONG idSpinButton,
    250                                ULONG min,
    251                                ULONG max,
    252                                ULONG current);
    253 
    254     LONG winhAdjustDlgItemSpinData(HWND hwndDlg,
    255                                    USHORT usItemID,
    256                                    LONG lGrid,
    257                                    USHORT usNotifyCode);
    258 
    259     /* ******************************************************************
    260      *                                                                  *
    261      *   Entry field helpers                                            *
    262      *                                                                  *
     235    HWND XWPENTRY winhReplaceWithCircularSlider(HWND hwndParent,
     236                                                HWND hwndOwner,
     237                                                HWND hwndInsertAfter,
     238                                                ULONG ulID,
     239                                                ULONG ulSliderStyle,
     240                                                SHORT sMin,
     241                                                SHORT sMax,
     242                                                USHORT usIncrement,
     243                                                USHORT usTicksEvery);
     244
     245    /* ******************************************************************
     246     *
     247     *   Spin button helpers
     248     *
     249     ********************************************************************/
     250
     251    VOID XWPENTRY winhSetDlgItemSpinData(HWND hwndDlg,
     252                                         ULONG idSpinButton,
     253                                         ULONG min,
     254                                         ULONG max,
     255                                         ULONG current);
     256
     257    LONG XWPENTRY winhAdjustDlgItemSpinData(HWND hwndDlg,
     258                                            USHORT usItemID,
     259                                            LONG lGrid,
     260                                            USHORT usNotifyCode);
     261
     262    /* ******************************************************************
     263     *
     264     *   Entry field helpers
     265     *
    263266     ********************************************************************/
    264267
     
    302305
    303306    /* ******************************************************************
    304      *                                                                  *
    305      *   List box helpers                                               *
    306      *                                                                  *
    307      ********************************************************************/
    308 
    309     /*
    310      *@@ winhQueryLboxItemCount:
     307     *
     308     *   List box helpers
     309     *
     310     ********************************************************************/
     311
     312    /*  The following macros are defined in the OS/2 headers for
     313        list boxes:
     314
     315        LONG WinQueryLboxCount(HWND hwndLbox);
     316                    // wrapper around LM_QUERYITEMCOUNT;
     317                    // list box item count
     318
     319        SHORT WinQueryLboxItemTextLength(HWND hwndLbox,
     320                                         SHORT index); // item index, starting from 0
     321                    // wrapper around LM_QUERYITEMTEXTLENGTH;
     322                    // returns length of item text, excluding NULL character
     323
     324        LONG WinQueryLboxItemText(HWND hwndLbox,
     325                                  SHORT index,      // item index, starting from 0
     326                                  PSZ psz,          // buffer
     327                                  PSZ cchMax);      // size of buffer, incl. null
     328                    // wrapper around LM_QUERYITEMTEXT;
     329                    // returns length of item text, excluding NULL character
     330
     331        BOOL WinSetLboxItemText(HWND hwndLbox,
     332                                LONG index,
     333                                PSZ psz);
     334                    // wrapper around LM_SETITEMTEXT
     335
     336        LONG WinInsertLboxItem(HWND hwndLbox,
     337                               LONG index,          // new item index, starting from 0
     338                                                    // or LIT_END
     339                                                    // or LIT_SORTASCENDING
     340                                                    // or LIT_SORTDESCENDING
     341                               PSZ psz)
     342                    // wrapper around LM_INSERTITEM;
     343                    // returns LIT_MEMERROR, LIT_ERROR, or zero-based index
     344
     345        LONG WinDeleteLboxItem(HWND hwndLbox,
     346                               LONG index);         // item index, starting from 0
     347
     348        LONG WinQueryLboxSelectedItem(HWND hwndLbox);
     349                    // wrapper around LM_QUERYSELECTION;
     350                    // works with single selection only,
     351                    // use winhQueryLboxSelectedItem instead
     352    */
     353
     354    /*
     355     * winhQueryLboxItemCount:
    311356     *      returns the no. of items in the listbox
    312357     *      as a SHORT.
    313358     *
    314      *@@added V0.9.1 (99-12-14) [umoeller]
    315      */
    316 
    317     #define winhQueryLboxItemCount(hwndListBox)                 \
    318         (SHORT)WinSendMsg(hwndListBox, LM_QUERYITEMCOUNT, 0, 0)
     359     *added V0.9.1 (99-12-14) [umoeller]
     360     */
     361
     362    // #define winhQueryLboxItemCount(hwndListBox)
     363    // (SHORT)WinSendMsg(hwndListBox, LM_QUERYITEMCOUNT, 0, 0)
     364
     365    // removed, use WinQueryLboxCount
    319366
    320367    /*
     
    349396     *
    350397     *      To have the cursored item returned, use LIT_CURSOR.
     398     *
     399     *      For single selection, you can also use
     400     *      WinQueryLboxSelectedItem from the OS/2 PM headers.
    351401     */
    352402
     
    375425                            (MPARAM)(fSelect)))
    376426
    377     ULONG winhLboxSelectAll(HWND hwndListBox,
    378                             BOOL fSelect);
     427    ULONG XWPENTRY winhLboxSelectAll(HWND hwndListBox, BOOL fSelect);
    379428
    380429    /*
     
    398447                              MPFROMSHORT(sItemIndex), (MPARAM)NULL)
    399448
    400     PSZ winhQueryLboxItemText(HWND hwndListbox,
    401                               SHORT sIndex);
    402 
    403     BOOL winhMoveLboxItem(HWND hwndSource,
    404                           SHORT sSourceIndex,
    405                           HWND hwndTarget,
    406                           SHORT sTargetIndex,
    407                           BOOL fSelectTarget);
    408 
    409     /* ******************************************************************
    410      *                                                                  *
    411      *   Scroll bar helpers                                             *
    412      *                                                                  *
    413      ********************************************************************/
    414 
    415     BOOL winhUpdateScrollBar(HWND hwndScrollBar,
    416                              ULONG ulWinPels,
    417                              ULONG ulViewportPels,
    418                              ULONG ulCurUnitOfs,
    419                              BOOL fAutoHide);
    420 
    421     BOOL winhHandleScrollMsg(HWND hwnd2Scroll,
    422                              HWND hwndScrollBar,
    423                              PLONG plCurUnitOfs,
    424                              PRECTL prcl2Scroll,
    425                              LONG ulViewportPels,
    426                              USHORT usLineStepUnits,
    427                              ULONG msg,
    428                              MPARAM mp2);
    429 
    430     BOOL winhProcessScrollChars(HWND hwndClient,
    431                                 HWND hwndVScroll,
    432                                 HWND hwndHScroll,
    433                                 MPARAM mp1,
    434                                 MPARAM mp2,
    435                                 ULONG ulVertMax,
    436                                 ULONG ulHorzMax);
    437 
    438     /* ******************************************************************
    439      *                                                                  *
    440      *   Window positioning helpers                                     *
    441      *                                                                  *
    442      ********************************************************************/
    443 
    444     BOOL winhSaveWindowPos(HWND hwnd,
    445                            HINI hIni,
    446                            PSZ pszApp,
    447                            PSZ pszKey);
    448 
    449     BOOL winhRestoreWindowPos(HWND hwnd,
    450                            HINI hIni,
    451                            PSZ pszApp,
    452                            PSZ pszKey,
    453                            ULONG fl);
     449    PSZ XWPENTRY winhQueryLboxItemText(HWND hwndListbox, SHORT sIndex);
     450
     451    BOOL XWPENTRY winhMoveLboxItem(HWND hwndSource,
     452                                   SHORT sSourceIndex,
     453                                   HWND hwndTarget,
     454                                   SHORT sTargetIndex,
     455                                   BOOL fSelectTarget);
     456
     457    /* ******************************************************************
     458     *
     459     *   Scroll bar helpers
     460     *
     461     ********************************************************************/
     462
     463    BOOL XWPENTRY winhUpdateScrollBar(HWND hwndScrollBar,
     464                                      ULONG ulWinPels,
     465                                      ULONG ulViewportPels,
     466                                      ULONG ulCurUnitOfs,
     467                                      BOOL fAutoHide);
     468
     469    BOOL XWPENTRY winhHandleScrollMsg(HWND hwnd2Scroll,
     470                                      HWND hwndScrollBar,
     471                                      PLONG plCurUnitOfs,
     472                                      PRECTL prcl2Scroll,
     473                                      LONG ulViewportPels,
     474                                      USHORT usLineStepUnits,
     475                                      ULONG msg,
     476                                      MPARAM mp2);
     477
     478    BOOL XWPENTRY winhProcessScrollChars(HWND hwndClient,
     479                                         HWND hwndVScroll,
     480                                         HWND hwndHScroll,
     481                                         MPARAM mp1,
     482                                         MPARAM mp2,
     483                                         ULONG ulVertMax,
     484                                         ULONG ulHorzMax);
     485
     486    /* ******************************************************************
     487     *
     488     *   Window positioning helpers
     489     *
     490     ********************************************************************/
     491
     492    BOOL XWPENTRY winhSaveWindowPos(HWND hwnd, HINI hIni, PSZ pszApp, PSZ pszKey);
     493
     494    BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, PSZ pszApp, PSZ pszKey, ULONG fl);
    454495
    455496    #define XAC_MOVEX       0x0001
     
    470511    } XADJUSTCTRLS, *PXADJUSTCTRLS;
    471512
    472     BOOL winhAdjustControls(HWND hwndDlg,
    473                             MPARAM *pmpFlags,
    474                             ULONG ulCount,
    475                             PSWP pswpNew,
    476                             PXADJUSTCTRLS pxac);
    477 
    478     void winhCenterWindow(HWND hwnd);
    479 
    480     /* ******************************************************************
    481      *                                                                  *
    482      *   Presparams helpers                                             *
    483      *                                                                  *
    484      ********************************************************************/
    485 
    486     PSZ winhQueryWindowFont(HWND hwnd);
    487 
    488     BOOL winhSetWindowFont(HWND hwnd,
    489                            PSZ pszFont);
     513    BOOL XWPENTRY winhAdjustControls(HWND hwndDlg,
     514                                     MPARAM *pmpFlags,
     515                                     ULONG ulCount,
     516                                     PSWP pswpNew,
     517                                     PXADJUSTCTRLS pxac);
     518
     519    void XWPENTRY winhCenterWindow(HWND hwnd);
     520    typedef void XWPENTRY WINHCENTERWINDOW(HWND hwnd);
     521    typedef WINHCENTERWINDOW *PWINHCENTERWINDOW;
     522
     523    HWND XWPENTRY winhFindWindowBelow(HWND hwndFind);
     524
     525    /* ******************************************************************
     526     *
     527     *   Presparams helpers
     528     *
     529     ********************************************************************/
     530
     531    PSZ XWPENTRY winhQueryWindowFont(HWND hwnd);
     532    typedef PSZ XWPENTRY WINHQUERYWINDOWFONT(HWND hwnd);
     533    typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
     534
     535    BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
     536    typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
     537    typedef WINHSETWINDOWFONT *PWINHSETWINDOWFONT;
    490538
    491539    /*
     
    502550            (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont))
    503551
    504     ULONG winhSetControlsFont(HWND hwndDlg,
    505                               SHORT usIDMin,
    506                               SHORT usIDMax,
    507                               const char *pcszFont);
     552    ULONG XWPENTRY winhSetControlsFont(HWND hwndDlg, SHORT usIDMin, SHORT usIDMax, const char *pcszFont);
    508553
    509554    #ifdef INCL_WINSYS
    510         BOOL winhStorePresParam(PPRESPARAMS *pppp,
    511                                 ULONG ulAttrType,
    512                                 ULONG cbData,
    513                                 PVOID pData);
     555        BOOL XWPENTRY winhStorePresParam(PPRESPARAMS *pppp,
     556                                         ULONG ulAttrType,
     557                                         ULONG cbData,
     558                                         PVOID pData);
    514559    #endif
    515560
    516     LONG winhQueryPresColor(HWND    hwnd,
    517                             ULONG   ulPP,
    518                             BOOL    fInherit,
    519                             LONG    lSysColor);
    520 
    521     /* ******************************************************************
    522      *                                                                  *
    523      *   Help instance helpers                                          *
    524      *                                                                  *
     561    LONG XWPENTRY winhQueryPresColor(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
     562    typedef LONG XWPENTRY WINHQUERYPRESCOLOR(HWND hwnd, ULONG ulPP, BOOL fInherit, LONG lSysColor);
     563    typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
     564
     565    /* ******************************************************************
     566     *
     567     *   Help instance helpers
     568     *
    525569     ********************************************************************/
    526570
    527571    #ifdef INCL_WINHELP
    528         HWND winhCreateHelp(HWND hwndFrame,
    529                             PSZ pszFileName,
    530                             HMODULE hmod,
    531                             PHELPTABLE pHelpTable,
    532                             PSZ pszWindowTitle);
    533 
    534         void winhDestroyHelp(HWND hwndHelp,
    535                              HWND hwndFrame);
     572        HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
     573                                     PSZ pszFileName,
     574                                     HMODULE hmod,
     575                                     PHELPTABLE pHelpTable,
     576                                     PSZ pszWindowTitle);
     577
     578        void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
    536579    #endif
    537580
     
    543586
    544587    #ifdef INCL_WINPROGRAMLIST
    545         HAPP winhStartApp(HWND hwndNotify,
    546                           const PROGDETAILS *pcProgDetails);
     588        HAPP XWPENTRY winhStartApp(HWND hwndNotify, const PROGDETAILS *pcProgDetails);
    547589    #endif
    548590
    549     BOOL winhAnotherInstance(PSZ pszSemName,
    550                              BOOL fSwitch);
    551 
    552     HSWITCH winhAddToTasklist(HWND hwnd,
    553                               HPOINTER hIcon);
    554 
    555     /* ******************************************************************
    556      *                                                                  *
    557      *   Miscellaneous                                                  *
    558      *                                                                  *
    559      ********************************************************************/
    560 
    561     VOID winhSleep(HAB hab,
    562                    ULONG ulSleep);
     591    BOOL XWPENTRY winhAnotherInstance(PSZ pszSemName, BOOL fSwitch);
     592
     593    HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
     594
     595    /* ******************************************************************
     596     *
     597     *   Miscellaneous
     598     *
     599     ********************************************************************/
     600
     601    VOID XWPENTRY winhFree(PVOID p);
     602    typedef VOID XWPENTRY WINHFREE(PVOID p);
     603    typedef WINHFREE *PWINHFREE;
     604
     605    VOID XWPENTRY winhSleep(HAB hab, ULONG ulSleep);
    563606
    564607    #define WINH_FOD_SAVEDLG        0x0001
     
    566609    #define WINH_FOD_INISAVEDIR     0x0020
    567610
    568     BOOL winhFileDlg(HWND hwndOwner,
    569                      PSZ pszFile,
    570                      ULONG flFlags,
    571                      HINI hini,
    572                      PSZ pszApplication,
    573                      PSZ pszKey);
    574 
    575     HPOINTER winhSetWaitPointer(VOID);
    576 
    577     PSZ winhQueryWindowText(HWND hwnd);
     611    BOOL XWPENTRY winhFileDlg(HWND hwndOwner,
     612                              PSZ pszFile,
     613                              ULONG flFlags,
     614                              HINI hini,
     615                              PSZ pszApplication,
     616                              PSZ pszKey);
     617
     618    HPOINTER XWPENTRY winhSetWaitPointer(VOID);
     619
     620    PSZ XWPENTRY winhQueryWindowText(HWND hwnd);
    578621
    579622    /*
     
    585628    #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID))
    586629
    587     BOOL winhReplaceWindowText(HWND hwnd,
    588                                PSZ pszSearch,
    589                                PSZ pszReplaceWith);
    590 
    591     ULONG winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
     630    BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
     631                                        PSZ pszSearch,
     632                                        PSZ pszReplaceWith);
     633
     634    ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
    592635                  PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
    593 
    594     ULONG winhEnableControls(HWND hwndDlg,
    595                              USHORT usIDFirst,
    596                              USHORT usIDLast,
    597                              BOOL fEnable);
    598 
    599     HWND winhCreateStdWindow(HWND hwndFrameParent,
    600                              PSWP pswpFrame,
    601                              ULONG flFrameCreateFlags,
    602                              ULONG ulFrameStyle,
    603                              PSZ pszFrameTitle,
    604                              ULONG ulResourcesID,
    605                              PSZ pszClassClient,
    606                              ULONG flStyleClient,
    607                              ULONG ulID,
    608                              PVOID pClientCtlData,
    609                              PHWND phwndClient);
     636    typedef ULONG XWPENTRY WINHCENTEREDDLGBOX(HWND hwndParent, HWND hwndOwner,
     637                  PFNWP pfnDlgProc, HMODULE hmod, ULONG idDlg, PVOID pCreateParams);
     638    typedef WINHCENTEREDDLGBOX *PWINHCENTEREDDLGBOX;
     639
     640    ULONG XWPENTRY winhEnableControls(HWND hwndDlg,
     641                                      USHORT usIDFirst,
     642                                      USHORT usIDLast,
     643                                      BOOL fEnable);
     644
     645    HWND XWPENTRY winhCreateStdWindow(HWND hwndFrameParent,
     646                                      PSWP pswpFrame,
     647                                      ULONG flFrameCreateFlags,
     648                                      ULONG ulFrameStyle,
     649                                      PSZ pszFrameTitle,
     650                                      ULONG ulResourcesID,
     651                                      PSZ pszClassClient,
     652                                      ULONG flStyleClient,
     653                                      ULONG ulID,
     654                                      PVOID pClientCtlData,
     655                                      PHWND phwndClient);
    610656
    611657    /*
     
    626672                    (PSZ)"", 0, 0,0,0,0, 0, HWND_BOTTOM, 0, pvCreateParam, NULL)
    627673
    628     VOID winhRepaintWindows(HWND hwndParent);
    629 
    630     HMQ winhFindMsgQueue(PID pid,
    631                          TID tid,
    632                          HAB* phab);
    633 
    634     VOID winhFindPMErrorWindows(HWND *phwndHardError,
    635                                 HWND *phwndSysError);
    636 
    637     HWND winhCreateFakeDesktop(HWND hwndSibling);
    638 
    639     BOOL winhAssertWarp4Notebook(HWND hwndDlg,
     674    VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
     675
     676    HMQ XWPENTRY winhFindMsgQueue(PID pid, TID tid, HAB* phab);
     677
     678    VOID XWPENTRY winhFindPMErrorWindows(HWND *phwndHardError, HWND *phwndSysError);
     679
     680    HWND XWPENTRY winhCreateFakeDesktop(HWND hwndSibling);
     681
     682    BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
    640683                                 USHORT usIdThreshold,
    641684                                 ULONG ulDownUnits);
    642685
    643     ULONG winhDrawFormattedText(HPS hps, PRECTL prcl, PSZ pszText, ULONG flCmd);
    644 
    645     VOID winhKillTasklist(VOID);
    646 
    647     ULONG winhQueryPendingSpoolJobs(VOID);
    648 
    649     VOID winhSetNumLock(BOOL fState);
     686    ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, PSZ pszText, ULONG flCmd);
     687
     688    #ifdef INCL_WINSWITCHLIST
     689        PSWBLOCK XWPENTRY winhQuerySwitchList(HAB hab);
     690        typedef PSWBLOCK XWPENTRY WINHQUERYSWITCHLIST(HAB hab);
     691        typedef WINHQUERYSWITCHLIST *PWINHQUERYSWITCHLIST;
     692    #endif
     693
     694    HWND XWPENTRY winhQueryTasklistWindow(VOID);
     695    typedef HWND XWPENTRY WINHQUERYTASKLISTWINDOW(VOID);
     696    typedef WINHQUERYTASKLISTWINDOW *PWINHQUERYTASKLISTWINDOW;
     697
     698    VOID XWPENTRY winhKillTasklist(VOID);
     699
     700    ULONG XWPENTRY winhQueryPendingSpoolJobs(VOID);
     701
     702    VOID XWPENTRY winhSetNumLock(BOOL fState);
    650703
    651704    /*
     
    664717
    665718    /* ******************************************************************
    666      *                                                                  *
    667      *   WPS Class List helpers                                         *
    668      *                                                                  *
    669      ********************************************************************/
    670 
    671     PBYTE winhQueryWPSClassList(VOID);
    672 
    673     PBYTE winhQueryWPSClass(PBYTE pObjClass,
    674                             const char *pszClass);
    675 
    676     APIRET winhRegisterClass(const char* pcszClassName,
    677                              const char* pcszModule,
    678                              PSZ pszBuf,
    679                              ULONG cbBuf);
    680 
    681     BOOL winhIsClassRegistered(const char *pcszClass);
    682 
    683     ULONG winhResetWPS(HAB hab);
     719     *
     720     *   WPS Class List helpers
     721     *
     722     ********************************************************************/
     723
     724    PBYTE XWPENTRY winhQueryWPSClassList(VOID);
     725
     726    PBYTE XWPENTRY winhQueryWPSClass(PBYTE pObjClass, const char *pszClass);
     727
     728    APIRET XWPENTRY winhRegisterClass(const char* pcszClassName,
     729                                      const char* pcszModule,
     730                                      PSZ pszBuf,
     731                                      ULONG cbBuf);
     732
     733    BOOL XWPENTRY winhIsClassRegistered(const char *pcszClass);
     734
     735    ULONG XWPENTRY winhResetWPS(HAB hab);
    684736#endif
    685737
  • trunk/include/helpers/wphandle.h

    r7 r14  
    2121/*      This file Copyright (C) 1997-2000 Ulrich M”ller,
    2222 *                                        Henk Kelder.
    23  *      This file is part of the XWorkplace source package.
    24  *      XWorkplace is free software; you can redistribute it and/or modify
     23 *      This file is part of the "XWorkplace helpers" source package.
     24 *      This is free software; you can redistribute it and/or modify
    2525 *      it under the terms of the GNU General Public License as published by
    2626 *      the Free Software Foundation, in version 2 as it comes in the COPYING
  • trunk/include/helpers/xprf.h

    r7 r14  
    1515
    1616/*      Copyright (C) 2000 Ulrich M”ller.
    17  *      This file is part of the XWorkplace source package.
    18  *      XWorkplace is free software; you can redistribute it and/or modify
     17 *      This file is part of the "XWorkplace helpers" source package.
     18 *      This is free software; you can redistribute it and/or modify
    1919 *      it under the terms of the GNU General Public License as published
    2020 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3434
    3535    /* ******************************************************************
    36      *                                                                  *
    37      *   OS/2 INI file layout                                           *
    38      *                                                                  *
     36     *
     37     *   OS/2 INI file layout
     38     *
    3939     ********************************************************************/
    4040
     
    130130
    131131    /* ******************************************************************
    132      *                                                                  *
    133      *   API Functions                                                  *
    134      *                                                                  *
     132     *
     133     *   API Functions
     134     *
    135135     ********************************************************************/
    136136
     
    183183
    184184    /* ******************************************************************
    185      *                                                                  *
    186      *   Copy API Functions                                             *
    187      *                                                                  *
     185     *
     186     *   Copy API Functions
     187     *
    188188     ********************************************************************/
    189189
  • trunk/include/helpers/xstring.h

    r13 r14  
    1414/*
    1515 *      Copyright (C) 1999-2000 Ulrich M”ller.
    16  *      This file is part of the XWorkplace source package.
    17  *      XWorkplace is free software; you can redistribute it and/or modify
     16 *      This file is part of the "XWorkplace helpers" source package.
     17 *      This is free software; you can redistribute it and/or modify
    1818 *      it under the terms of the GNU General Public License as published
    1919 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3232    #define XSTRING_HEADER_INCLUDED
    3333
     34    #ifndef XWPENTRY
     35        #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
     36    #endif
     37
    3438    /*
    3539     *@@ XSTRING:
     
    4650    } XSTRING, *PXSTRING;
    4751
    48     void xstrInit(PXSTRING pxstr,
    49                   ULONG ulPreAllocate);
     52    void XWPENTRY xstrInit(PXSTRING pxstr, ULONG ulPreAllocate);
     53    typedef void XWPENTRY XSTRINIT(PXSTRING pxstr, ULONG ulPreAllocate);
     54    typedef XSTRINIT *PXSTRINIT;
    5055
    51     void xstrInitSet(PXSTRING pxstr,
    52                      PSZ pszNew);
     56    void XWPENTRY xstrInitSet(PXSTRING pxstr, PSZ pszNew);
    5357
    54     void xstrInitCopy(PXSTRING pxstr,
    55                       const char *pcszSource);
     58    void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource);
    5659
    57     void xstrClear(PXSTRING pxstr);
     60    void XWPENTRY xstrClear(PXSTRING pxstr);
     61    typedef void XWPENTRY XSTRCLEAR(PXSTRING pxstr);
     62    typedef XSTRCLEAR *PXSTRCLEAR;
    5863
    59     PXSTRING xstrCreate(ULONG ulPreAllocate);
     64    PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate);
    6065
    61     VOID xstrFree(PXSTRING pxstr);
     66    VOID XWPENTRY xstrFree(PXSTRING pxstr);
    6267
    63     ULONG xstrset(PXSTRING pxstr,
    64                   PSZ pszNew);
     68    ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew);
    6569
    66     ULONG xstrcpy(PXSTRING pxstr,
    67                   const char *pcszSource);
     70    ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource);
    6871
    69     ULONG xstrcat(PXSTRING pxstr,
    70                   const char *pcszSource);
     72    ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource);
     73    typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource);
     74    typedef XSTRCAT *PXSTRCAT;
    7175
    7276    /*
     
    7983    #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
    8084
    81     PSZ xstrFindWord(const XSTRING *pxstr,
    82                      ULONG ulOfs,
    83                      const XSTRING *pstrFind,
    84                      size_t *pShiftTable,
    85                      PBOOL pfRepeatFind,
    86                      const char *pcszBeginChars,
    87                      const char *pcszEndChars);
     85    PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
     86                              ULONG ulOfs,
     87                              const XSTRING *pstrFind,
     88                              size_t *pShiftTable,
     89                              PBOOL pfRepeatFind,
     90                              const char *pcszBeginChars,
     91                              const char *pcszEndChars);
    8892
    89     ULONG xstrrpl(PXSTRING pxstr,
    90                   PULONG pulOfs,
    91                   const XSTRING *pstrSearch,
    92                   const XSTRING *pstrReplace,
    93                   size_t *pShiftTable,
    94                   PBOOL pfRepeatFind);
     93    ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
     94                           PULONG pulOfs,
     95                           const XSTRING *pstrSearch,
     96                           const XSTRING *pstrReplace,
     97                           size_t *pShiftTable,
     98                           PBOOL pfRepeatFind);
    9599
    96     ULONG xstrcrpl(PXSTRING pxstr,
    97                    PULONG pulOfs,
    98                    const char *pcszSearch,
    99                    const char *pcszReplace);
     100    ULONG XWPENTRY xstrcrpl(PXSTRING pxstr,
     101                            PULONG pulOfs,
     102                            const char *pcszSearch,
     103                            const char *pcszReplace);
    100104#endif
    101105
  • trunk/src/helpers/animate.c

    r8 r14  
    2222/*
    2323 *      Copyright (C) 1997-2000 Ulrich M”ller.
    24  *      This file is part of the XWorkplace source package.
    25  *      XWorkplace is free software; you can redistribute it and/or modify
     24 *      This file is part of the "XWorkplace helpers" source package.
     25 *      This is free software; you can redistribute it and/or modify
    2626 *      it under the terms of the GNU General Public License as published
    2727 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838    // as unsigned char
    3939
    40 #define INCL_DOS
    41 #define INCL_DOSERRORS
     40#define INCL_DOSPROCESS
    4241#define INCL_DOSDEVICES
    4342#define INCL_DOSDEVIOCTL
    44 
    45 #define INCL_WIN
     43#define INCL_DOSERRORS
     44
     45#define INCL_WINPOINTERS
    4646#define INCL_WINSYS
    4747
     
    164164
    165165/* ******************************************************************
    166  *                                                                  *
    167  *   Other animations                                               *
    168  *                                                                  *
     166 *
     167 *   Other animations
     168 *
    169169 ********************************************************************/
    170170
  • trunk/src/helpers/cctl_chart.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Chart Control                                                  *
    88  *                                                                  *
     86 *
     87 *   Chart Control
     88 *
    8989 ********************************************************************/
    9090
  • trunk/src/helpers/cctl_checkcnr.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Global variables                                               *
    88  *                                                                  *
     86 *
     87 *   Global variables
     88 *
    8989 ********************************************************************/
    9090
     
    9494
    9595/* ******************************************************************
    96  *                                                                  *
    97  *   Checkbox container record cores                                *
    98  *                                                                  *
     96 *
     97 *   Checkbox container record cores
     98 *
    9999 ********************************************************************/
    100100
  • trunk/src/helpers/cctl_progbar.c

    r13 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Progress bars                                                  *
    88  *                                                                  *
     86 *
     87 *   Progress bars
     88 *
    8989 ********************************************************************/
    9090
  • trunk/src/helpers/cctl_splitwin.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Split windows                                                  *
    88  *                                                                  *
     86 *
     87 *   Split windows
     88 *
    8989 ********************************************************************/
    9090
  • trunk/src/helpers/cctl_tooltip.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Global variables                                               *
    88  *                                                                  *
     86 *
     87 *   Global variables
     88 *
    8989 ********************************************************************/
    9090
     
    9898
    9999/* ******************************************************************
    100  *                                                                  *
    101  *   "Tooltip" control                                              *
    102  *                                                                  *
     100 *
     101 *   "Tooltip" control
     102 *
    103103 ********************************************************************/
    104104
     
    724724    PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    725725
    726     TRY_LOUD(excpt1, NULL)
     726    TRY_LOUD(excpt1)
    727727    {
    728728        switch (msg)
  • trunk/src/helpers/cnrh.c

    r8 r14  
    2222/*
    2323 *      Copyright (C) 1997-2000 Ulrich M”ller.
    24  *      This file is part of the XWorkplace source package.
    25  *      XWorkplace is free software; you can redistribute it and/or modify
     24 *      This file is part of the "XWorkplace helpers" source package.
     25 *      This is free software; you can redistribute it and/or modify
    2626 *      it under the terms of the GNU General Public License as published
    2727 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838    // as unsigned char
    3939
    40 #define INCL_WIN
     40#define INCL_WINWINDOWMGR
     41#define INCL_WINRECTANGLES
     42#define INCL_WININPUT
     43#define INCL_WINPOINTERS
     44#define INCL_WINMENUS
     45#define INCL_WINSYS
     46#define INCL_WINSTDDRAG
     47#define INCL_WINSTDCNR
     48
    4149#define INCL_GPILOGCOLORTABLE
    4250#define INCL_GPIPRIMITIVES
     
    5967
    6068/* ******************************************************************
    61  *                                                                  *
    62  *   Details view field infos                                       *
    63  *                                                                  *
     69 *
     70 *   Details view field infos
     71 *
    6472 ********************************************************************/
    6573
     
    338346
    339347/* ******************************************************************
    340  *                                                                  *
    341  *   Record core management                                         *
    342  *                                                                  *
     348 *
     349 *   Record core management
     350 *
    343351 ********************************************************************/
    344352
     
    353361 *      by following the RECORDCORE.preccNextRecord pointers
    354362 *      (i.e. we have a linked list here).
     363 *
     364 *      Returns NULL on errors (what CM_ALLOCRECORD returns).
    355365 *
    356366 *      The record cores returned by the container are
     
    735745
    736746/* ******************************************************************
    737  *                                                                  *
    738  *   View management                                                *
    739  *                                                                  *
     747 *
     748 *   View management
     749 *
    740750 ********************************************************************/
    741751
     
    11191129                // convert this to screen coordinates
    11201130                WinMapWindowPoints(hwndCnr,
    1121                            HWND_DESKTOP,
    1122                            &ptl,
    1123                            1);
     1131                                   HWND_DESKTOP,
     1132                                   &ptl,
     1133                                   1);
    11241134                fQueried = TRUE;
    11251135            }
     
    13031313
    13041314/* ******************************************************************
    1305  *                                                                  *
    1306  *   Record relations/iteration                                     *
    1307  *                                                                  *
     1315 *
     1316 *   Record relations/iteration
     1317 *
    13081318 ********************************************************************/
    13091319
     
    15801590
    15811591/* ******************************************************************
    1582  *                                                                  *
    1583  *   Miscellaneous                                                  *
    1584  *                                                                  *
     1592 *
     1593 *   Miscellaneous
     1594 *
    15851595 ********************************************************************/
    15861596
  • trunk/src/helpers/comctl.c

    r8 r14  
    5353/*
    5454 *      Copyright (C) 1997-2000 Ulrich M”ller.
    55  *      This file is part of the XWorkplace source package.
    56  *      XWorkplace is free software; you can redistribute it and/or modify
     55 *      This file is part of the "XWorkplace helpers" source package.
     56 *      This is free software; you can redistribute it and/or modify
    5757 *      it under the terms of the GNU General Public License as published
    5858 *      by the Free Software Foundation, in version 2 as it comes in the
     
    117117
    118118/* ******************************************************************
    119  *                                                                  *
    120  *   Global variables                                               *
    121  *                                                                  *
     119 *
     120 *   Global variables
     121 *
    122122 ********************************************************************/
    123123
     
    127127
    128128/* ******************************************************************
    129  *                                                                  *
    130  *   "Menu button" control                                          *
    131  *                                                                  *
     129 *
     130 *   "Menu button" control
     131 *
    132132 ********************************************************************/
    133133
     
    149149    HWND        hwndMenu;
    150150} MENUBUTTONDATA, *PMENUBUTTONDATA;
     151
     152/*
     153 *@@ ctlDisplayButtonMenu:
     154 *      displays the specified menu above the button.
     155 *
     156 *@@added V0.9.7 (2000-11-29) [umoeller]
     157 */
     158
     159VOID ctlDisplayButtonMenu(HWND hwndButton,
     160                          HWND hwndMenu)
     161{
     162    SWP     swpButton;
     163    POINTL  ptlMenu;
     164    WinQueryWindowPos(hwndButton, &swpButton);
     165    ptlMenu.x = swpButton.x;
     166    ptlMenu.y = swpButton.y;
     167
     168    // ptlMenu now has button coordinates
     169    // relative to the button's parent;
     170    // convert this to screen coordinates:
     171    WinMapWindowPoints(WinQueryWindow(hwndButton, QW_PARENT),
     172                       HWND_DESKTOP,
     173                       &ptlMenu,
     174                       1);
     175
     176    // now show the menu on top of the button
     177    WinPopupMenu(HWND_DESKTOP,               // menu parent
     178                 hwndButton,                 // owner
     179                 hwndMenu,
     180                 (SHORT)(ptlMenu.x),
     181                 (SHORT)(ptlMenu.y + swpButton.cy - 1),
     182                 0,                          // ID
     183                 PU_NONE
     184                     | PU_MOUSEBUTTON1
     185                     | PU_KEYBOARD
     186                     | PU_HCONSTRAIN
     187                     | PU_VCONSTRAIN);
     188}
    151189
    152190/*
     
    288326                        // menu successfully loaded:
    289327                        // find out where to put it
    290                         SWP     swpButton;
    291                         POINTL  ptlMenu;
    292                         WinQueryWindowPos(hwndButton, &swpButton);
    293                         ptlMenu.x = swpButton.x;
    294                         ptlMenu.y = swpButton.y;
    295 
    296                         // ptlMenu now has button coordinates
    297                         // relative to the button's parent;
    298                         // convert this to screen coordinates:
    299                         WinMapWindowPoints(WinQueryWindow(hwndButton, QW_PARENT),
    300                                            HWND_DESKTOP,
    301                                            &ptlMenu,
    302                                            1);
    303 
    304                         // now show the menu on top of the button
    305                         WinPopupMenu(HWND_DESKTOP,               // menu parent
    306                                      hwndButton,                 // owner
    307                                      pmbd->hwndMenu,
    308                                      (SHORT)(ptlMenu.x),
    309                                      (SHORT)(ptlMenu.y + swpButton.cy - 1),
    310                                      0,                          // ID
    311                                       PU_NONE
    312                                          | PU_MOUSEBUTTON1
    313                                          | PU_KEYBOARD
    314                                          | PU_HCONSTRAIN
    315                                          | PU_VCONSTRAIN);
     328                        ctlDisplayButtonMenu(hwndButton,
     329                                             pmbd->hwndMenu);
    316330                    } // end if (pmbd->hwndMenu)
    317331                    else
     
    484498
    485499/* ******************************************************************
    486  *                                                                  *
    487  *   Subclassed Static Bitmap Control                               *
    488  *                                                                  *
     500 *
     501 *   Subclassed Static Bitmap Control
     502 *
    489503 ********************************************************************/
    490504
     
    788802
    789803/* ******************************************************************
    790  *                                                                  *
    791  *   Icon animation                                                 *
    792  *                                                                  *
     804 *
     805 *   Icon animation
     806 *
    793807 ********************************************************************/
    794808
     
    967981
    968982/* ******************************************************************
    969  *                                                                  *
    970  *   Bitmap functions                                               *
    971  *                                                                  *
     983 *
     984 *   Bitmap functions
     985 *
    972986 ********************************************************************/
    973987
     
    10501064
    10511065/* ******************************************************************
    1052  *                                                                  *
    1053  *   Hotkey entry field                                             *
    1054  *                                                                  *
     1066 *
     1067 *   Hotkey entry field
     1068 *
    10551069 ********************************************************************/
    10561070
  • trunk/src/helpers/datetime.c

    r8 r14  
    2525/*
    2626 *      This file Copyright (C) 1997-2000 Ulrich M”ller.
    27  *      This file is part of the XWorkplace source package.
    28  *      XWorkplace is free software; you can redistribute it and/or modify
     27 *      This file is part of the "XWorkplace helpers" source package.
     28 *      This is free software; you can redistribute it and/or modify
    2929 *      it under the terms of the GNU General Public License as published
    3030 *      by the Free Software Foundation, in version 2 as it comes in the
     
    6363const char  *pcszFormatTimestamp = "%4u%02u%02u%02u%02u%02u%";
    6464
     65ULONG G_ulDateScalarFirstCalled = 0;
     66
    6567/*
    6668 *@@ dtGetULongTime:
     
    7173 *      time in milliseconds.
    7274 *
    73  *      Warning: this does not handle day information. When called twice
    74  *      in between day changes, this returns incorrect information.
     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 *
     87 *      A ULONG can hold a max value of 4'294'967'295.
     88 *      So this overflows after 49.71... days.
     89 *
     90 *@@changed V0.9.7 (2000-12-05) [umoeller]: now handling date also
    7591 */
    7692
     
    7894{
    7995    DATETIME    dt;
     96    ULONG       ulTime,
     97                ulDateScalarPassed = 1;
    8098    DosGetDateTime(&dt);
    81     return (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(dt.hours)))));
     99    ulTime = (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(dt.hours)))));
     100
     101    if (G_ulDateScalarFirstCalled == 0)
     102    {
     103        // first call:
     104        G_ulDateScalarFirstCalled = dtDate2Scalar(dt.year,
     105                                                  dt.month,
     106                                                  dt.day);
     107    }
     108    else
     109    {
     110        // not first call:
     111        ULONG ulDateScalarNow = dtDate2Scalar(dt.year,
     112                                              dt.month,
     113                                              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;
     117    }
     118
     119    return (ulTime * ulDateScalarPassed);
    82120}
    83121
     
    147185
    148186/*
     187**
     188**
     189**   day:    day of month
     190**   mon:    month (1-12)
     191**   yr:     year
     192**
     193**
     194*/
     195
     196/*
     197 *@@ dtDayOfWeek:
     198 *      returns an integer that represents the day of
     199 *      the week for the date passed as parameters.
     200 *
     201 *      Returns 0-6 where 0 is sunday.
     202 *
     203 *@@added V0.9.7 (2000-12-05) [umoeller]
     204 */
     205
     206ULONG dtDayOfWeek(ULONG day,
     207                  ULONG mon,    // 1-12
     208                  ULONG yr)
     209{
     210    int dow;
     211
     212    if (mon <= 2)
     213    {
     214          mon += 12;
     215          yr -= 1;
     216    }
     217    dow = (   day
     218            + mon * 2
     219            + ((mon + 1) * 6) / 10
     220            + yr
     221            + yr / 4
     222            - yr / 100
     223            + yr / 400
     224            + 2);
     225    dow = dow % 7;
     226    return ((dow ? dow : 7) - 1);
     227}
     228
     229/*
    149230 *@@ dtIsLeapYear:
    150231 *      returns TRUE if yr is a leap year.
     
    164245/*
    165246 *@@ dtMonths2Days:
    166  *      returns the no. of days for month.
     247 *      returns the no. of days for the beginning
     248 *      of "month" (starting from 1).
     249 *
     250 *      For example, if you pass 1 (for january),
     251 *      you get 0 because there's no days at jan 1st
     252 *      yet.
     253 *
     254 *      If you pass 2 (for february), you get 31.
     255 *
     256 *      If you pass 3 (for march), you get 61.
     257 *
     258 *      This is useful for computing a day index
     259 *      for a given month/day pair. Pass the month
     260 *      in here and add (day-1); for march 3rd,
     261 *      you then get 63.
    167262 *
    168263 *      (c) Ray Gardner.
     
    171266unsigned dtMonths2Days(unsigned month)
    172267{
    173    return (month * 3057 - 3007) / 100;
     268    return (month * 3057 - 3007) / 100;
    174269}
    175270
     
    228323   *pyr = n;
    229324   n = (unsigned)(scalar - dtYears2Days(n-1));
    230    if ( n > 59 ) {                       /* adjust if past February */
     325   if ( n > 59 )    /* adjust if past February */
     326   {
    231327      n += 2;
    232328      if ( dtIsLeapYear(*pyr) )
     
    237333}
    238334
    239 
     335/*
     336 *@@ dtIsValidDate:
     337 *      returns TRUE if the given date is valid.
     338 *
     339 *@@added V0.9.7 (2000-12-05) [umoeller]
     340 */
     341
     342BOOL dtIsValidDate(LONG day,      // in: day (1-31)
     343                   LONG month,    // in: month (1-12)
     344                   ULONG year)    // in: year (e.g. 1999)
     345{
     346    BOOL brc = FALSE;
     347    if (day > 0)
     348    {
     349        switch( month )
     350        {
     351            case 1  :
     352            case 3  :
     353            case 5  :
     354            case 7  :
     355            case 8  :
     356            case 10 :
     357            case 12 :
     358                if (day <= 31)
     359                    brc = TRUE;
     360            break;
     361
     362            case 4  :
     363            case 6  :
     364            case 9  :
     365            case 11 :
     366                if (day <= 30)
     367                    brc = TRUE;
     368            break;
     369
     370            case 2 :
     371                if (day < 29)
     372                    brc = TRUE;
     373                else
     374                    if (day == 29)
     375                        if (dtIsLeapYear(year))
     376                            return 1 ;
     377        }
     378    }
     379    return (brc);
     380}
     381
  • trunk/src/helpers/debug.c

    r13 r14  
    3434 *                                      John Currier,
    3535 *                                      Anthony Cruise.
    36  *      This file is part of the XWorkplace source package.
    37  *      XWorkplace is free software; you can redistribute it and/or modify
     36 *      This file is part of the "XWorkplace helpers" source package.
     37 *      This is free software; you can redistribute it and/or modify
    3838 *      it under the terms of the GNU General Public License as published
    3939 *      by the Free Software Foundation, in version 2 as it comes in the
     
    5050    // as unsigned char
    5151
    52 #define INCL_BASE
     52#define INCL_DOSPROCESS
     53#define INCL_DOSMODULEMGR
     54#define INCL_DOSMISC
     55#define INCL_DOSERRORS
    5356#include <os2.h>
    5457
     
    8891
    8992/* ******************************************************************
    90  *                                                                  *
    91  *   Global variables                                               *
    92  *                                                                  *
     93 *
     94 *   Global variables
     95 *
    9396 ********************************************************************/
    9497
     
    353356
    354357/* ******************************************************************
    355  *                                                                  *
    356  *   PART 1: ANALYZE DEBUG CODE                                     *
    357  *                                                                  *
     358 *
     359 *   PART 1: ANALYZE DEBUG CODE
     360 *
    358361 ********************************************************************/
    359362
     
    11291132
    11301133/* ******************************************************************
    1131  *                                                                  *
    1132  *   PART 2: ANALYZE VARIABLES                                      *
    1133  *                                                                  *
     1134 *
     1135 *   PART 2: ANALYZE VARIABLES
     1136 *
    11341137 ********************************************************************/
    11351138
     
    14211424
    14221425/* ******************************************************************
    1423  *                                                                  *
    1424  *   PART 3: ANALYZE SYMBOL (.SYM) FILE                             *
    1425  *                                                                  *
     1426 *
     1427 *   PART 3: ANALYZE SYMBOL (.SYM) FILE
     1428 *
    14261429 ********************************************************************/
    14271430
     
    15661569
    15671570/* ******************************************************************
    1568  *                                                                  *
    1569  *   PART 4: dbgPrintStack                                          *
    1570  *                                                                  *
     1571 *
     1572 *   PART 4: dbgPrintStack
     1573 *
    15711574 ********************************************************************/
    15721575
  • trunk/src/helpers/dosh.c

    r13 r14  
    3131/*
    3232 *      This file Copyright (C) 1997-2000 Ulrich M”ller.
    33  *      This file is part of the XWorkplace source package.
    34  *      XWorkplace is free software; you can redistribute it and/or modify
     33 *      This file is part of the "XWorkplace helpers" source package.
     34 *      This is free software; you can redistribute it and/or modify
    3535 *      it under the terms of the GNU General Public License as published
    3636 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4747    // as unsigned char
    4848
    49 #define INCL_DOS
     49#define INCL_DOSMODULEMGR
     50#define INCL_DOSPROCESS
     51#define INCL_DOSSESMGR
     52#define INCL_DOSQUEUES
     53#define INCL_DOSMISC
     54#define INCL_DOSDEVICES
    5055#define INCL_DOSDEVIOCTL
    5156#define INCL_DOSERRORS
     57
    5258#define INCL_KBD
    5359#include <os2.h>
     60
    5461#include <stdlib.h>
    5562#include <string.h>
    5663#include <stdio.h>
    57 // #include <ctype.h>
    5864
    5965#include "setup.h"                      // code generation and debugging options
     
    7076
    7177/* ******************************************************************
    72  *                                                                  *
    73  *   Miscellaneous                                                  *
    74  *                                                                  *
     78 *
     79 *   Miscellaneous
     80 *
    7581 ********************************************************************/
    7682
     
    172178
    173179    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
     200APIRET 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);
    174216}
    175217
     
    213255
    214256/* ******************************************************************
    215  *                                                                  *
    216  *   Memory helpers                                                 *
    217  *                                                                  *
     257 *
     258 *   Memory helpers
     259 *
    218260 ********************************************************************/
    219261
     
    283325
    284326/* ******************************************************************
    285  *                                                                  *
    286  *   Drive helpers                                                  *
    287  *                                                                  *
     327 *
     328 *   Drive helpers
     329 *
    288330 ********************************************************************/
    289331
     
    417459{
    418460    ULONG ulBootDrive;
    419     DosQuerySysInfo(5, 5, &ulBootDrive, sizeof(ulBootDrive));
     461    DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE,
     462                    &ulBootDrive,
     463                    sizeof(ulBootDrive));
    420464    return (G_acDriveLetters[ulBootDrive]);
    421465}
     
    461505                  OPEN_FLAGS_DASD
    462506                         | OPEN_FLAGS_FAIL_ON_ERROR
     507                         | OPEN_FLAGS_NOINHERIT     // V0.9.6 (2000-11-25) [pr]
    463508                         | OPEN_ACCESS_READONLY
    464509                         | OPEN_SHARE_DENYNONE,
     
    523568
    524569/*
     570 *@@ doshSetLogicalMap:
     571 *       sets the mapping of logical floppy drives onto a single
     572 *       physical floppy drive.
     573 *       This means selecting either drive A: or drive B: to refer
     574 *       to the physical drive.
     575 *
     576 *@@added V0.9.6 (2000-11-24) [pr]
     577 */
     578
     579APIRET doshSetLogicalMap(ULONG ulLogicalDrive)
     580{
     581    CHAR    name[3] = "?:";
     582    ULONG   fd = 0,
     583            action = 0,
     584            paramsize = 0,
     585            datasize = 0;
     586    APIRET    rc = NO_ERROR;
     587    USHORT    data,
     588              param;
     589
     590    name[0] = doshQueryBootDrive();
     591    rc = DosOpen(name,
     592                 &fd,
     593                 &action,
     594                 0,
     595                 0,
     596                 OPEN_ACTION_FAIL_IF_NEW
     597                          | OPEN_ACTION_OPEN_IF_EXISTS,
     598                 OPEN_FLAGS_DASD
     599                       | OPEN_FLAGS_FAIL_ON_ERROR
     600                       | OPEN_FLAGS_NOINHERIT
     601                       | OPEN_ACCESS_READONLY
     602                       | OPEN_SHARE_DENYNONE,
     603                 0);
     604    if (rc == NO_ERROR)
     605    {
     606        param = 0;
     607        data = (USHORT)ulLogicalDrive;
     608        paramsize = sizeof(param);
     609        datasize = sizeof(data);
     610        rc = DosDevIOCtl(fd,
     611                         IOCTL_DISK, DSK_SETLOGICALMAP,
     612                         &param, paramsize, &paramsize,
     613                         &data, datasize, &datasize);
     614        DosClose(fd);
     615    }
     616
     617    return(rc);
     618}
     619
     620/*
    525621 *@@ doshQueryDiskFree:
    526622 *       returns the number of bytes remaining on the disk
    527  *       specified by the given logical drive, or -1 upon errors.
     623 *       specified by the given logical drive.
    528624 *
    529625 *       Note: This returns a "double" value, because a ULONG
     
    532628 *
    533629 *@@changed V0.9.0 [umoeller]: fixed another > 4 GB bug (thanks to Rdiger Ihle)
    534  */
    535 
    536 double doshQueryDiskFree(ULONG ulLogicalDrive) // in: 1 for A:, 2 for B:, 3 for C:, ...
    537 {
     630 *@@changed V0.9.7 (2000-12-01) [umoeller]: changed prototype
     631 */
     632
     633APIRET doshQueryDiskFree(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ...
     634                         double *pdFree)
     635{
     636    APIRET      arc = NO_ERROR;
    538637    FSALLOCATE  fsa;
    539638    double      dbl = -1;
    540639
    541     if (ulLogicalDrive)
    542         if (DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa))
    543                 == NO_ERROR)
    544             dbl = ((double)fsa.cSectorUnit * fsa.cbSector * fsa.cUnitAvail);
     640    arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa));
     641    if (arc == NO_ERROR)
     642        *pdFree = ((double)fsa.cSectorUnit * fsa.cbSector * fsa.cUnitAvail);
    545643                   // ^ fixed V0.9.0
    546644
    547     return (dbl);
     645    return (arc);
    548646}
    549647
     
    779877
    780878/* ******************************************************************
    781  *                                                                  *
    782  *   File helpers                                                   *
    783  *                                                                  *
     879 *
     880 *   File helpers
     881 *
    784882 ********************************************************************/
    785883
     
    12261324
    12271325/* ******************************************************************
    1228  *                                                                  *
    1229  *   Directory helpers                                              *
    1230  *                                                                  *
     1326 *
     1327 *   Directory helpers
     1328 *
    12311329 ********************************************************************/
    12321330
     
    14591557
    14601558/*
     1559 *@@category: Helpers\Control program helpers\Performance (CPU load) helpers
     1560 */
     1561
     1562/* ******************************************************************
     1563 *
     1564 *   Performance Counters (CPU Load)
     1565 *
     1566 ********************************************************************/
     1567
     1568/*
     1569 *@@ doshPerfOpen:
     1570 *      initializes the OS/2 DosPerfSysCall API for
     1571 *      the calling thread.
     1572 *
     1573 *      Note: This API is not supported on all OS/2
     1574 *      versions. I believe it came up with some Warp 4
     1575 *      fixpak. The API is resolved dynamically by
     1576 *      this function (using DosQueryProcAddr). Only
     1577 *      if NO_ERROR is returned, you may call doshPerfGet
     1578 *      afterwards.
     1579 *
     1580 *      This properly initializes the internal counters
     1581 *      which the OS/2 kernel uses for this API. Apparently,
     1582 *      with newer kernels (FP13/14), IBM has chosen to no
     1583 *      longer do this automatically, which is the reason
     1584 *      why many "pulse" utilities display garbage with these
     1585 *      fixpaks.
     1586 *
     1587 *      After NO_ERROR is returned, DOSHPERFSYS.cProcessors
     1588 *      contains the no. of processors found on the system.
     1589 *      All pointers in DOSHPERFSYS then point to arrays
     1590 *      which have exactly cProcessors array items.
     1591 *
     1592 *      Call doshPerfClose to clean up resources allocated
     1593 *      by this function.
     1594 *
     1595 *      Example code:
     1596 *
     1597 +      PDOSHPERFSYS pPerf = NULL;
     1598 +      APIRET arc = doshPerfOpen(&pPerf);
     1599 +      if (arc == NO_ERROR)
     1600 +      {
     1601 +          // this should really be in a timer
     1602 +          ULONG   ulCPU;
     1603 +          arc = doshPerfGet(&pPerf);
     1604 +          // go thru all CPUs
     1605 +          for (ulCPU = 0; ulCPU < pPerf->cProcessors; ulCPU++)
     1606 +          {
     1607 +              LONG lLoadThis = pPerf->palLoads[ulCPU];
     1608 +              ...
     1609 +          }
     1610 +
     1611 +          ...
     1612 +
     1613 +          // clean up
     1614 +          doshPerfClose(&pPerf);
     1615 +      }
     1616 +
     1617 *
     1618 *@@added V0.9.7 (2000-12-02) [umoeller]
     1619 */
     1620
     1621APIRET doshPerfOpen(PDOSHPERFSYS *ppPerfSys)  // out: new DOSHPERFSYS structure
     1622{
     1623    APIRET  arc = NO_ERROR;
     1624
     1625    // allocate DOSHPERFSYS structure
     1626    *ppPerfSys = (PDOSHPERFSYS)malloc(sizeof(DOSHPERFSYS));
     1627    if (!*ppPerfSys)
     1628        arc = ERROR_NOT_ENOUGH_MEMORY;
     1629    else
     1630    {
     1631        // initialize structure
     1632        PDOSHPERFSYS pPerfSys = *ppPerfSys;
     1633        memset(pPerfSys, 0, sizeof(*pPerfSys));
     1634
     1635        // resolve DosPerfSysCall API entry
     1636        arc = DosLoadModule(NULL, 0, "DOSCALLS", &pPerfSys->hmod);
     1637        if (arc == NO_ERROR)
     1638        {
     1639            arc = DosQueryProcAddr(pPerfSys->hmod,
     1640                                   976,
     1641                                   "DosPerfSysCall",
     1642                                   (PFN*)(&pPerfSys->pDosPerfSysCall));
     1643            if (arc == NO_ERROR)
     1644            {
     1645                // OK, we got the API: initialize!
     1646                arc = pPerfSys->pDosPerfSysCall(CMD_KI_ENABLE, 0, 0, 0);
     1647                if (arc == NO_ERROR)
     1648                {
     1649                    pPerfSys->fInitialized = TRUE;
     1650                            // call CMD_KI_DISABLE later
     1651
     1652                    arc = pPerfSys->pDosPerfSysCall(CMD_PERF_INFO,
     1653                                                    0,
     1654                                                    (ULONG)(&pPerfSys->cProcessors),
     1655                                                    0);
     1656                    if (arc == NO_ERROR)
     1657                    {
     1658                        ULONG   ul = 0;
     1659
     1660                        // allocate arrays
     1661                        pPerfSys->paCPUUtils = (PCPUUTIL)calloc(pPerfSys->cProcessors,
     1662                                                                sizeof(CPUUTIL));
     1663                        if (!pPerfSys->paCPUUtils)
     1664                            arc = ERROR_NOT_ENOUGH_MEMORY;
     1665                        else
     1666                        {
     1667                            pPerfSys->padBusyPrev = (double*)malloc(pPerfSys->cProcessors * sizeof(double));
     1668                            if (!pPerfSys->padBusyPrev)
     1669                                arc = ERROR_NOT_ENOUGH_MEMORY;
     1670                            else
     1671                            {
     1672                                pPerfSys->padTimePrev
     1673                                    = (double*)malloc(pPerfSys->cProcessors * sizeof(double));
     1674                                if (!pPerfSys->padTimePrev)
     1675                                    arc = ERROR_NOT_ENOUGH_MEMORY;
     1676                                else
     1677                                {
     1678                                    pPerfSys->palLoads = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG));
     1679                                    if (!pPerfSys->palLoads)
     1680                                        arc = ERROR_NOT_ENOUGH_MEMORY;
     1681                                    else
     1682                                    {
     1683                                        for (ul = 0; ul < pPerfSys->cProcessors; ul++)
     1684                                        {
     1685                                            pPerfSys->padBusyPrev[ul] = 0.0;
     1686                                            pPerfSys->padTimePrev[ul] = 0.0;
     1687                                            pPerfSys->palLoads[ul] = 0;
     1688                                        }
     1689                                    }
     1690                                }
     1691                            }
     1692                        }
     1693                    }
     1694                }
     1695            } // end if (arc == NO_ERROR)
     1696        } // end if (arc == NO_ERROR)
     1697
     1698        if (arc != NO_ERROR)
     1699        {
     1700            doshPerfClose(ppPerfSys);
     1701        }
     1702    } // end else if (!*ppPerfSys)
     1703
     1704    return (arc);
     1705}
     1706
     1707/*
     1708 *@@ doshPerfGet:
     1709 *      calculates a current snapshot of the system load,
     1710 *      compared with the load which was calculated on
     1711 *      the previous call.
     1712 *
     1713 *      If you want to continually measure the system CPU
     1714 *      load, this is the function you will want to call
     1715 *      regularly -- e.g. with a timer once per second.
     1716 *
     1717 *      Call this ONLY if doshPerfOpen returned NO_ERROR,
     1718 *      or you'll get crashes.
     1719 *
     1720 *      If this call returns NO_ERROR, you get a LONG
     1721 *      CPU load for each CPU in the system in the
     1722 *      DOSHPERFSYS.palLoads array (in per-mille, 0-1000).
     1723 *
     1724 *      For example, if there are two CPUs, after this call,
     1725 *
     1726 *      -- DOSHPERFSYS.palLoads[0] contains the load of
     1727 *         the first CPU,
     1728 *
     1729 *      -- DOSHPERFSYS.palLoads[1] contains the load of
     1730 *         the second CPU.
     1731 *
     1732 *      See doshPerfOpen for example code.
     1733 *
     1734 *@@added V0.9.7 (2000-12-02) [umoeller]
     1735 */
     1736
     1737APIRET doshPerfGet(PDOSHPERFSYS pPerfSys)
     1738{
     1739    APIRET arc = NO_ERROR;
     1740    if (!pPerfSys->pDosPerfSysCall)
     1741        arc = ERROR_INVALID_PARAMETER;
     1742    else
     1743    {
     1744        arc = pPerfSys->pDosPerfSysCall(CMD_KI_RDCNT,
     1745                                        (ULONG)pPerfSys->paCPUUtils,
     1746                                        0, 0);
     1747        if (arc == NO_ERROR)
     1748        {
     1749            // go thru all processors
     1750            ULONG ul = 0;
     1751            for (; ul < pPerfSys->cProcessors; ul++)
     1752            {
     1753                PCPUUTIL    pCPUUtilThis = &pPerfSys->paCPUUtils[ul];
     1754
     1755                double      dTime = LL2F(pCPUUtilThis->ulTimeHigh,
     1756                                         pCPUUtilThis->ulTimeLow);
     1757                double      dBusy = LL2F(pCPUUtilThis->ulBusyHigh,
     1758                                         pCPUUtilThis->ulBusyLow);
     1759
     1760                double      *pdBusyPrevThis = &pPerfSys->padBusyPrev[ul];
     1761                double      *pdTimePrevThis = &pPerfSys->padTimePrev[ul];
     1762
     1763                // avoid division by zero
     1764                double      dTimeDelta = (dTime - *pdTimePrevThis);
     1765                if (dTimeDelta)
     1766                    pPerfSys->palLoads[ul]
     1767                        = (LONG)( (double)(   (dBusy - *pdBusyPrevThis)
     1768                                            / dTimeDelta
     1769                                            * 1000.0
     1770                                          )
     1771                                );
     1772                else
     1773                    pPerfSys->palLoads[ul] = 0;
     1774
     1775                *pdTimePrevThis = dTime;
     1776                *pdBusyPrevThis = dBusy;
     1777            }
     1778        }
     1779    }
     1780
     1781    return (arc);
     1782}
     1783
     1784/*
     1785 *@@ doshPerfClose:
     1786 *      frees all resources allocated by doshPerfOpen.
     1787 *
     1788 *@@added V0.9.7 (2000-12-02) [umoeller]
     1789 */
     1790
     1791APIRET doshPerfClose(PDOSHPERFSYS *ppPerfSys)
     1792{
     1793    APIRET arc = NO_ERROR;
     1794    PDOSHPERFSYS pPerfSys = *ppPerfSys;
     1795    if (!pPerfSys)
     1796        arc = ERROR_INVALID_PARAMETER;
     1797    else
     1798    {
     1799        if (pPerfSys->fInitialized)
     1800            pPerfSys->pDosPerfSysCall(CMD_KI_DISABLE,
     1801                                      0, 0, 0);
     1802
     1803        if (pPerfSys->paCPUUtils)
     1804            free(pPerfSys->paCPUUtils);
     1805        if (pPerfSys->padBusyPrev)
     1806            free(pPerfSys->padBusyPrev);
     1807        if (pPerfSys->padTimePrev)
     1808            free(pPerfSys->padTimePrev);
     1809
     1810        if (pPerfSys->hmod)
     1811            DosFreeModule(pPerfSys->hmod);
     1812        free(pPerfSys);
     1813        *ppPerfSys = NULL;
     1814    }
     1815
     1816    return (arc);
     1817}
     1818
     1819/*
    14611820 *@@category: Helpers\Control program helpers\Process management
    14621821 */
    14631822
    14641823/* ******************************************************************
    1465  *                                                                  *
    1466  *   Process helpers                                                *
    1467  *                                                                  *
     1824 *
     1825 *   Process helpers
     1826 *
    14681827 ********************************************************************/
    14691828
  • trunk/src/helpers/dosh2.c

    r8 r14  
    3030 *      This file Copyright (C) 1997-2000 Ulrich M”ller,
    3131 *                                        Dmitry A. Steklenev.
    32  *      This file is part of the XWorkplace source package.
    33  *      XWorkplace is free software; you can redistribute it and/or modify
     32 *      This file is part of the "XWorkplace helpers" source package.
     33 *      This is free software; you can redistribute it and/or modify
    3434 *      it under the terms of the GNU General Public License as published
    3535 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4646    // as unsigned char
    4747
     48#define INCL_DOSMODULEMGR
     49#define INCL_DOSPROCESS
     50#define INCL_DOSSESMGR
     51#define INCL_DOSQUEUES
     52#define INCL_DOSMISC
     53#define INCL_DOSDEVICES
    4854#define INCL_DOSDEVIOCTL
    49 #define INCL_DOS
    5055#define INCL_DOSERRORS
    51 // #define INCL_GPI
    5256#include <os2.h>
     57
    5358#include <stdlib.h>
    5459#include <string.h>
     
    6873
    6974/* ******************************************************************
    70  *                                                                  *
    71  *   Miscellaneous                                                  *
    72  *                                                                  *
     75 *
     76 *   Miscellaneous
     77 *
    7378 ********************************************************************/
    7479
     
    109114                           BOOL fFullyQualified)    // in: if TRUE, pcszFile must be fully q'fied
    110115{
     116    APIRET  arc = NO_ERROR;
    111117    CHAR    szPath[CCHMAXPATH+4] = " :";
    112118    CHAR    szComponent[CCHMAXPATH];
     
    120126             || (*(pcszFile + 2) != '\\')
    121127           )
    122             return (ERROR_CURRENT_DIRECTORY);
     128            arc = ERROR_CURRENT_DIRECTORY;
    123129    }
    124130
     
    127133    {
    128134        CHAR cDrive = toupper(*pcszFile);
     135        double d;
    129136        // drive specified:
    130137        strcpy(szPath, pcszFile);
    131138        szPath[0] = toupper(*pcszFile);
    132         if (doshQueryDiskFree(cDrive - 'A' + 1) == -1)
    133             return (ERROR_INVALID_DRIVE);
     139        arc = doshQueryDiskFree(cDrive - 'A' + 1, &d);
    134140    }
    135141    else
     
    138144        ULONG   ulDriveNum = 0,
    139145                ulDriveMap = 0;
    140         DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
     146        arc = DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
    141147        szPath[0] = ((UCHAR)ulDriveNum) + 'A' - 1;
    142148        szPath[1] = ':';
     
    144150    }
    145151
    146     fIsFAT = doshIsFileOnFAT(szPath);
    147 
    148     pszInvalid = (fIsFAT)
    149                     ? "<>|+=:;,\"/[] "  // invalid characters in FAT
    150                     : "<>|:\"/";        // invalid characters in IFS's
    151 
    152     // now separate path components
    153     p1 = &szPath[2];       // advance past ':'
    154 
    155     do {
    156 
    157         if (*p1 == '\\')
    158             p1++;
    159 
    160         p2 = strchr(p1, '\\');
    161         if (p2 == NULL)
    162             p2 = p1 + strlen(p1);
    163 
    164         if (p1 != p2)
    165         {
    166             LONG    lDotOfs = -1,
    167                     lAfterDot = -1;
    168             ULONG   cbFile,
    169                     ul;
    170             PSZ     pSource = szComponent;
    171 
    172             strncpy(szComponent, p1, p2-p1);
    173             szComponent[p2-p1] = 0;
    174             cbFile = strlen(szComponent);
    175 
    176             // now check each path component
    177             for (ul = 0; ul < cbFile; ul++)
     152    if (arc == NO_ERROR)
     153    {
     154        fIsFAT = doshIsFileOnFAT(szPath);
     155
     156        pszInvalid = (fIsFAT)
     157                        ? "<>|+=:;,\"/[] "  // invalid characters in FAT
     158                        : "<>|:\"/";        // invalid characters in IFS's
     159
     160        // now separate path components
     161        p1 = &szPath[2];       // advance past ':'
     162
     163        do {
     164
     165            if (*p1 == '\\')
     166                p1++;
     167
     168            p2 = strchr(p1, '\\');
     169            if (p2 == NULL)
     170                p2 = p1 + strlen(p1);
     171
     172            if (p1 != p2)
    178173            {
     174                LONG    lDotOfs = -1,
     175                        lAfterDot = -1;
     176                ULONG   cbFile,
     177                        ul;
     178                PSZ     pSource = szComponent;
     179
     180                strncpy(szComponent, p1, p2-p1);
     181                szComponent[p2-p1] = 0;
     182                cbFile = strlen(szComponent);
     183
     184                // now check each path component
     185                for (ul = 0; ul < cbFile; ul++)
     186                {
     187                    if (fIsFAT)
     188                    {
     189                        // on FAT: only 8 characters allowed before dot
     190                        if (*pSource == '.')
     191                        {
     192                            lDotOfs = ul;
     193                            lAfterDot = 0;
     194                            if (ul > 7)
     195                                return (ERROR_FILENAME_EXCED_RANGE);
     196                        }
     197                    }
     198                    // and check for invalid characters
     199                    if (strchr(pszInvalid, *pSource) != NULL)
     200                        return (ERROR_INVALID_NAME);
     201
     202                    pSource++;
     203
     204                    // on FAT, allow only three chars after dot
     205                    if (fIsFAT)
     206                        if (lAfterDot != -1)
     207                        {
     208                            lAfterDot++;
     209                            if (lAfterDot > 3)
     210                                return (ERROR_FILENAME_EXCED_RANGE);
     211                        }
     212                }
     213
     214                // we are still missing the case of a FAT file
     215                // name without extension; if so, check whether
     216                // the file stem is <= 8 chars
    179217                if (fIsFAT)
    180                 {
    181                     // on FAT: only 8 characters allowed before dot
    182                     if (*pSource == '.')
    183                     {
    184                         lDotOfs = ul;
    185                         lAfterDot = 0;
    186                         if (ul > 7)
     218                    if (lDotOfs == -1)  // dot not found:
     219                        if (cbFile > 8)
    187220                            return (ERROR_FILENAME_EXCED_RANGE);
    188                     }
    189                 }
    190                 // and check for invalid characters
    191                 if (strchr(pszInvalid, *pSource) != NULL)
    192                     return (ERROR_INVALID_NAME);
    193 
    194                 pSource++;
    195 
    196                 // on FAT, allow only three chars after dot
    197                 if (fIsFAT)
    198                     if (lAfterDot != -1)
    199                     {
    200                         lAfterDot++;
    201                         if (lAfterDot > 3)
    202                             return(ERROR_FILENAME_EXCED_RANGE);
    203                     }
    204221            }
    205222
    206             // we are still missing the case of a FAT file
    207             // name without extension; if so, check whether
    208             // the file stem is <= 8 chars
    209             if (fIsFAT)
    210                 if (lDotOfs == -1)  // dot not found:
    211                     if (cbFile > 8)
    212                         return (ERROR_FILENAME_EXCED_RANGE);
    213         }
    214 
    215         // go for next component
    216         p1 = p2+1;
    217     } while (*p2);
    218 
    219     return (NO_ERROR);
     223            // go for next component
     224            p1 = p2+1;
     225        } while (*p2);
     226    }
     227
     228    return (arc);
    220229}
    221230
     
    340349
    341350/* ******************************************************************
    342  *                                                                  *
    343  *   Environment helpers                                            *
    344  *                                                                  *
     351 *
     352 *   Environment helpers
     353 *
    345354 ********************************************************************/
    346355
     
    716725
    717726/* ******************************************************************
    718  *                                                                  *
    719  *   Module handling helpers                                        *
    720  *                                                                  *
     727 *
     728 *   Module handling helpers
     729 *
    721730 ********************************************************************/
    722731
     
    773782
    774783/********************************************************************
    775  *                                                                  *
    776  *   Executable functions                                           *
    777  *                                                                  *
     784 *
     785 *   Executable functions
     786 *
    778787 ********************************************************************/
    779788
     
    12191228
    12201229/********************************************************************
    1221  *                                                                  *
    1222  *   Partition functions                                            *
    1223  *                                                                  *
     1230 *
     1231 *   Partition functions
     1232 *
    12241233 ********************************************************************/
    12251234
  • trunk/src/helpers/eah.c

    r8 r14  
    6767 *      Copyright (C) 1995 Massachusetts Institute of Technology.
    6868 *      Copyright (C) 1997-2000 Ulrich M”ller.
    69  *      This file is part of the XWorkplace source package.
    70  *      XWorkplace is free software; you can redistribute it and/or modify
     69 *      This file is part of the "XWorkplace helpers" source package.
     70 *      This is free software; you can redistribute it and/or modify
    7171 *      it under the terms of the GNU General Public License as published
    7272 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8383    // as unsigned char
    8484
    85 #define INCL_DOS
     85#define INCL_DOSFILEMGR
    8686#define INCL_DOSERRORS
    8787#include <os2.h>
     
    101101
    102102/********************************************************************
    103  *                                                                  *
    104  *   Extended Attribute handling                                    *
    105  *                                                                  *
     103 *
     104 *   Extended Attribute handling
     105 *
    106106 ********************************************************************/
    107107
     
    173173
    174174/* ******************************************************************
    175  *                                                                  *
    176  *   Read-EA functions                                              *
    177  *                                                                  *
     175 *
     176 *   Read-EA functions
     177 *
    178178 ********************************************************************/
    179179
     
    196196 */
    197197
    198 ULONG eaPathQueryTotalSize(PSZ pszPath)
     198ULONG eaPathQueryTotalSize(const char *pcszPath)
    199199{
    200200    APIRET  arc;
     
    202202    FILEFINDBUF4   ffb4;
    203203
    204     _Pmpf(("eaPathQueryTotalSize %s", pszPath));
    205 
    206     arc = DosQueryPathInfo(pszPath,
     204    arc = DosQueryPathInfo((PSZ)pcszPath,
    207205                           FIL_QUERYEASIZE,
    208206                           &ffb4,
     
    220218
    221219        arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH,
    222                                pszPath,
     220                               (PSZ)pcszPath,
    223221                               1,
    224222                               abBuf,
     
    230228        pdena2 = (PDENA2)abBuf;
    231229
    232         _Pmpf(("  %s: arc = %d, count = %d", pszPath, arc, lCount));
    233 
    234230        if (lCount > 0)
    235231        {
     
    247243    }
    248244
    249     _Pmpf(("    %s: total %d", pszPath, ulTotalEASize));
    250 
    251245    return (ulTotalEASize);
    252246}
     
    259253 */
    260254
    261 PEALIST eaPathReadAll(PSZ path)
    262 {
    263     return (ReadEAList(ENUMEA_REFTYPE_PATH, path));
     255PEALIST eaPathReadAll(const char *pcszPath)
     256{
     257    return (ReadEAList(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath));
    264258}
    265259
     
    283277 */
    284278
    285 PEABINDING eaPathReadOneByIndex(PSZ path, ULONG index)
    286 {
    287     return (ReadEAByIndex(ENUMEA_REFTYPE_PATH, path, index));
     279PEABINDING eaPathReadOneByIndex(const char *pcszPath, ULONG index)
     280{
     281    return (ReadEAByIndex(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, index));
    288282}
    289283
     
    305299 */
    306300
    307 PEABINDING eaPathReadOneByName(PSZ path, PSZ name)
    308 {
    309     return (ReadEAByName(ENUMEA_REFTYPE_PATH, path, name));
     301PEABINDING eaPathReadOneByName(const char *pcszPath, const char *pcszEAName)
     302{
     303    return (ReadEAByName(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, (PSZ)pcszEAName));
    310304}
    311305
     
    315309 */
    316310
    317 PEABINDING eaHFileReadOneByName(HFILE hfile, PSZ name)
    318 {
    319     return (ReadEAByName(ENUMEA_REFTYPE_FHANDLE, (&hfile), name));
     311PEABINDING eaHFileReadOneByName(HFILE hfile, const char *pcszEAName)
     312{
     313    return (ReadEAByName(ENUMEA_REFTYPE_FHANDLE, (&hfile), (PSZ)pcszEAName));
    320314}
    321315
    322316/* ******************************************************************
    323  *                                                                  *
    324  *   Write-EA functions                                             *
    325  *                                                                  *
     317 *
     318 *   Write-EA functions
     319 *
    326320 ********************************************************************/
    327321
     
    335329 *      field is 0; only in that case, the EABINDING.value
    336330 *      field may also be NULL.
    337  */
    338 
    339 void eaPathWriteAll(PSZ path, PEALIST list)
    340 {
    341     WriteEAList(ENUMEA_REFTYPE_PATH, path, list);
     331 *
     332 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     333 */
     334
     335APIRET eaPathWriteAll(const char *pcszPath, PEALIST list)
     336{
     337    return (WriteEAList(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, list));
    342338}
    343339
     
    345341 *@@ eaHFileWriteAll:
    346342 *      like eaPathWriteAll, but for an open file handle.
    347  */
    348 
    349 void eaHFileWriteAll(HFILE hfile, PEALIST list)
    350 {
    351     WriteEAList(ENUMEA_REFTYPE_FHANDLE, (&hfile), list);
     343 *
     344 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     345 */
     346
     347APIRET eaHFileWriteAll(HFILE hfile, PEALIST list)
     348{
     349    return (WriteEAList(ENUMEA_REFTYPE_FHANDLE, (&hfile), list));
    352350}
    353351
     
    362360 *
    363361 *      To delete an EA, you may also use eaPathDeleteOne.
    364  */
    365 
    366 void eaPathWriteOne(PSZ path, PEABINDING peab)
    367 {
    368     WriteEA(ENUMEA_REFTYPE_PATH, path, peab);
     362 *
     363 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     364 */
     365
     366APIRET eaPathWriteOne(const char *pcszPath, PEABINDING peab)
     367{
     368    return (WriteEA(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, peab));
    369369}
    370370
     
    372372 *@@ eaHFileWriteOne:
    373373 *      like eaPathWriteOne, but for an open file handle.
    374  */
    375 
    376 void eaHFileWriteOne(HFILE hfile, PEABINDING peab)
    377 {
    378     WriteEA(ENUMEA_REFTYPE_FHANDLE, (&hfile), peab);
     374 *
     375 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     376 */
     377
     378APIRET eaHFileWriteOne(HFILE hfile, PEABINDING peab)
     379{
     380    return (WriteEA(ENUMEA_REFTYPE_FHANDLE, (&hfile), peab));
    379381}
    380382
     
    386388 *
    387389 *@@added V0.9.0 [umoeller]
    388  */
    389 
    390 void eaPathDeleteOne(PSZ path, PSZ pszEAName)
     390 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     391 */
     392
     393APIRET eaPathDeleteOne(const char *pcszPath, const char *pcszEAName)
    391394{
    392395    EABINDING eab;
    393396    eab.bFlags = 0;
    394     eab.bNameLength = strlen(pszEAName);
    395     eab.pszName = pszEAName;
     397    eab.bNameLength = strlen(pcszEAName);
     398    eab.pszName = (PSZ)pcszEAName;
    396399    eab.usValueLength = 0;
    397400    eab.pszValue = 0;
    398     eaPathWriteOne(path, &eab);
     401    return (eaPathWriteOne(pcszPath, &eab));
    399402}
    400403
     
    404407
    405408/********************************************************************
    406  *                                                                  *
    407  *   Translation funcs                                              *
    408  *                                                                  *
     409 *
     410 *   Translation funcs
     411 *
    409412 ********************************************************************/
    410413
     
    484487 */
    485488
    486 PEABINDING eaCreateBindingFromPSZ(PSZ pszEAName,    // in: EA name (e.g. ".LONGNAME")
    487                                   PSZ pszString)     // in: string for EAT_ASCII EA
     489PEABINDING eaCreateBindingFromPSZ(const char *pcszEAName, // in: EA name (e.g. ".LONGNAME")
     490                                  const char *pcszInput)  // in: string for EAT_ASCII EA
    488491{
    489492    PEABINDING peab = (PEABINDING)malloc(sizeof(EABINDING));
     
    491494    {
    492495        SHORT cbString = 0;
    493         if (pszString)
    494             cbString = strlen(pszString);
     496        if (pcszInput)
     497            cbString = strlen(pcszInput);
    495498
    496499        peab->bFlags = 0;
    497         peab->bNameLength = strlen(pszEAName);
    498         peab->pszName = strdup(pszEAName);
     500        peab->bNameLength = strlen(pcszEAName);
     501        peab->pszName = strdup(pcszEAName);
    499502
    500503        if (cbString)
     
    510513                *((PUSHORT)(peab->pszValue + 2)) = cbString;
    511514                // copy string to byte 4 (no null-terminator)
    512                 memcpy(peab->pszValue + 4, pszString, cbString);
     515                memcpy(peab->pszValue + 4, pcszInput, cbString);
    513516            }
    514517            else
     
    743746
    744747PSZ eaCreatePSZFromMVBinding(PEABINDING peab,       // in: EAT_MVMT binding
    745                              PSZ     pszSeparator,  // in: null-terminated string used as separator
     748                             const char *pcszSeparator,  // in: null-terminated string used as separator
    746749                             PUSHORT pusCodepage)   // out: codepage found in binding (ptr can be NULL)
    747750{
     
    765768            USHORT  us = 0;
    766769            USHORT  cbComment = 0;
    767             USHORT  cbSeparator = strlen(pszSeparator);
     770            USHORT  cbSeparator = strlen(pcszSeparator);
    768771            while (us < usMVCount)
    769772            {
     
    794797                            // append separator
    795798                            memcpy(pszTotal + cbCommentOld,
    796                                    pszSeparator,
     799                                   pcszSeparator,
    797800                                   cbSeparator);
    798801                            // copy the rest after the separator (below)
     
    846849 */
    847850
    848 PEABINDING eaCreateMVBindingFromPSZ(PSZ pszEAName,      // in: EA name (e.g. ".KEYPHRASES")
    849                                     PSZ pszInput,       // in: string to parse
    850                                     PSZ pszSeparator,   // in: separator used in pszInput
     851PEABINDING eaCreateMVBindingFromPSZ(const char *pcszEAName,      // in: EA name (e.g. ".KEYPHRASES")
     852                                    const char *pcszInput,       // in: string to parse
     853                                    const char *pcszSeparator,   // in: separator used in pszInput
    851854                                    USHORT usCodepage)  // in: codepage to set in EAT_MVMT
    852855{
    853856    PEABINDING peab;
    854     if (pszInput)
     857    if (pcszInput)
    855858    {
    856859        peab = (PEABINDING)malloc(sizeof(EABINDING));
    857860        if (peab)
    858861        {
    859             PSZ     p = pszInput,
    860                     pSource,
    861                     pTarget;
    862             USHORT  cbInput = strlen(pszInput),
    863                     cbSep = strlen(pszSeparator),
     862            const char *p = pcszInput,
     863                    *pSource;
     864            PSZ     pTarget;
     865            USHORT  cbInput = strlen(pcszInput),
     866                    cbSep = strlen(pcszSeparator),
    864867                    usSepCount = 0,
    865868                    cbToAlloc = 0,
     
    868871
    869872            peab->bFlags = 0;
    870             peab->bNameLength = strlen(pszEAName);
    871             peab->pszName = strdup(pszEAName);
     873            peab->bNameLength = strlen(pcszEAName);
     874            peab->pszName = strdup(pcszEAName);
    872875
    873876            // now count the number of pszSeparators in pszInput
    874             while ((p = strstr(p, pszSeparator)))
     877            while ((p = strstr(p, pcszSeparator)))
    875878            {
    876879                usSepCount++;
     
    898901
    899902            // set pointer to first field
    900             pSource = pszInput;
     903            pSource = pcszInput;
    901904            pTarget = peab->pszValue + 6;
    902905
     
    907910            {
    908911                // find the next separator
    909                 PSZ     pNextSep = strstr(pSource, pszSeparator);
     912                PSZ     pNextSep = strstr(pSource, pcszSeparator);
    910913                // calculate the length of the substring
    911914                cbThis = pNextSep - pSource;
     
    934937
    935938/********************************************************************
    936  *                                                                  *
    937  *   EA helper funcs                                                *
    938  *                                                                  *
     939 *
     940 *   EA helper funcs
     941 *
    939942 ********************************************************************/
    940943
     
    12171220
    12181221/* ******************************************************************
    1219  *                                                                  *
    1220  *   Direct plain-string EA handling                                *
    1221  *                                                                  *
     1222 *
     1223 *   Direct plain-string EA handling
     1224 *
    12221225 ********************************************************************/
    12231226
  • trunk/src/helpers/except.c

    r13 r14  
    33 *@@sourcefile except.c:
    44 *      this file contains powerful exception handlers.
     5 *      except.h also defines easy-to-use macros for them.
    56 *
    67 *      Usage: All OS/2 programs, PM or text mode.
    78 *
    8  *      <B>except.h macros</B>
    9  *
    10  *      except.h declares a few handy macros to easily install
    11  *      exception handling for a section of code.
    12  *
    13  *      These macros automatically insert code for properly
    14  *      registering and deregistering the handlers. You should
    15  *      ALWAYS use these macros instead of directly registering
     9 *      <B>Introduction</B>
     10 *
     11 *      OS/2 exception handlers are a mess to program and,
     12 *      if installed wrongly, almost impossible to debug.
     13 *      The problem is that for any program that does a bit
     14 *      more than showing a message box, using exception
     15 *      handlers is a must to avoid system hangs. This
     16 *      especially applies to multi-thread programs using
     17 *      mutex semaphores (more on that below). The functions
     18 *      and macros in here are designed to make that more simple.
     19 *
     20 *      The macros in except.h automatically insert code for properly
     21 *      registering and deregistering the handlers in except.c. You
     22 *      should ALWAYS use these macros instead of directly registering
    1623 *      the handlers to avoid accidentally forgetting to deregister
    1724 *      them. If you forget to deregister an exception handler, this
     
    2027 *      might get completely messed up.
    2128 *
    22  *      The general idea of these macros is to define
    23  *      TRY / CATCH blocks similar to C++. If an exception
    24  *      occurs in the TRY block, execution is transferred
    25  *      to the CATCH block. (This works in both C and C++,
    26  *      by the way.)
    27  *
    28  *      In addition, with the TRY statement, you may specify
    29  *      an optional "OnKill" function which gets called if
    30  *      the thread gets killed while code in the TRY block is
    31  *      executed (new with V0.9.0). If you need no such
    32  *      function, specify NULL. Details follow.
     29 *      The general idea of these macros is to define TRY / CATCH
     30 *      blocks similar to C++. If an exception occurs in the TRY block,
     31 *      execution is transferred to the CATCH block. (This works in both
     32 *      C and C++, by the way.)
     33 *
     34 *      The "OnKill" function that was added with V0.9.0 has been
     35 *      removed again with V0.9.7. Use DosEnterMustComplete instead.
     36 *      Details follow.
    3337 *
    3438 *      The general usage is like this:
     
    3640 +          int your_protected_func(int ...)
    3741 +          {
    38  +              TRY_LOUD(excptid, OnKillFunc)
    39  +              // or: TRY_QUIET(excptid, OnKillFunc)
    40  +              // OnKillFunc can be NULL
     42 +              TRY_LOUD(excptid)         // or: TRY_QUIET(excptid)
    4143 +              {
    4244 +                  ....        // the stuff in here is protected by
     
    5052 +          } // end of your_func
    5153 *
    52  *      TRY_LOUD  is for excHandlerLoud (see below).
    53  *      TRY_QUIET is for excHandlerQuiet (see below).
     54 *      TRY_LOUD  is for installing excHandlerLoud.
     55 *      TRY_QUIET is for installing excHandlerQuiet.
    5456 *      CATCH / END_CATCH are the same for the two. This
    5557 *      is where the exception handler jumps to if an
     
    5860 *      in there.
    5961 *
    60  *      "excptid" can be any identifier which is not used in
     62 *      "excptid" can be any C identifier which is not used in
    6163 *      your current variable scope, e.g. "excpt1". This
    6264 *      is used for creating an EXCEPTSTRUCT variable of
     
    6567 *      store the exception handler data.
    6668 *
    67  *      It is possible to nest these handlers though. You
    68  *      must use different "excptid"'s only if more than one
    69  *      TRY_* block exists in the same variable scope. Avoid
    70  *      using gotos to jump between the different CATCH blocks,
    71  *      because this might not properly deregister the handlers.
     69 *      These macros may be nested if you use different
     70 *      "excptid"'s for sub-macros.
     71 *
     72 *      Inside the TRY and CATCH blocks, you must not use
     73 *      "goto" (to a location outside the block) or "return",
     74 *      because this will not deregister the handler.
    7275 *
    7376 *      Keep in mind that all the code in the TRY_* block is
     
    7679 *      TRY_* block, your entire application is protected.
    7780 *
    78  *      Your "OnKillFunc" must be declared as
    79  +          VOID APIENTRY YourOnKillFunc(VOID) {...}.
    80  *      This gets called when the thread gets terminated
    81  *      while being executed in the TRY block (that is,
    82  *      if either the thread gets killed explicitly or
    83  *      the entire process ends for some reason). After
    84  *      that function got executed, the thread will _always_
    85  *      be terminated; the CATCH block will not be executed
    86  *      then. You can specify NULL for the "OnKillFunc", if
    87  *      you don't need one.
    88  *
    89  *      To summarize: If an exception occurs in the TRY
    90  *      block,
    91  *
    92  *      a) "OnKillFunc" gets called if the thread got
    93  *         killed, and the thread then terminates;
    94  *
    95  *      b) the CATCH block is executed for other exceptions
    96  *         and execution continues.
     81 *      <B>Asynchronous exceptions</B>
     82 *
     83 *      The exception handlers in this file (which are installed
     84 *      with the TRY/CATCH mechanism) only intercept synchronous
     85 *      exceptions (see excHandlerLoud for a list). They do not
     86 *      protect your code against asynchronous exceptions.
     87 *
     88 *      OS/2 defines asynchronous exceptions to be those that
     89 *      can be delayed. With OS/2, there are only three of these:
     90 *
     91 *      -- XCPT_PROCESS_TERMINATE
     92 *      -- XCPT_ASYNC_PROCESS_TERMINATE
     93 *      -- XCPT_SIGNAL (thread 1 only)
     94 *
     95 *      To protect yourself against these also, put the section
     96 *      in question in a DosEnterMustComplete/DosExitMustComplete
     97 *      block as well.
    9798 *
    9899 *      <B>Mutex semaphores</B>
    99100 *
    100  *      Here's how to deal with mutex semaphores: WHENEVER
    101  *      you request a mutex semaphore, enclose the block
    102  *      with TRY/CATCH in case an error occurs, like this:
     101 *      The problem with OS/2 mutex semaphores is that they are
     102 *      not automatically released when a thread terminates.
     103 *      If the thread owning the mutex died without releasing
     104 *      the mutex, other threads which are blocked on that mutex
     105 *      will wait forever and become zombie threads. Even worse,
     106 *      if this happens to a PM thread, this will hang the system.
     107 *
     108 *      Here's the typical scenario with two threads:
     109 *
     110 *      1)  Thread 2 requests a mutex and does lots of processing.
     111 *
     112 *      2)  Thread 1 requests the mutex. Since it's still owned
     113 *          by thread 2, thread 1 blocks.
     114 *
     115 *      3)  Thread 2 crashes in its processing. Without an
     116 *          exception handler, OS/2 will terminate the process.
     117 *          It will first kill thread 2 and then attempt to
     118 *          kill thread 1. This fails because it is still
     119 *          blocking on the semaphore that thread 2 never
     120 *          released. Boom.
     121 *
     122 *      The same scenario happens when a process gets killed.
     123 *      Since OS/2 will kill secondary threads before thread 1,
     124 *      the same situation can arise.
     125 *
     126 *      As a result, you must protect any section of code which
     127 *      requests a semaphore _both_ against crashes _and_
     128 *      termination.
     129 *
     130 *      So _whenever_ you request a mutex semaphore, enclose
     131 *      the block with TRY/CATCH in case the code crashes.
     132 *      Besides, enclose the TRY/CATCH block in a must-complete
     133 *      section, like this:
    103134 *
    104135 +          HMTX hmtx = ...
    105  +
    106  +          VOID APIENTRY OnKillYourFunc(VOID)
    107  +          {
    108  +              DosReleaseMutexSem(hmtx);
    109  +          }
    110136 +
    111137 +          int your_func(int)
    112138 +          {
    113  +              BOOL fSemOwned = FALSE;
     139 +              BOOL    fSemOwned = FALSE;
     140 +              ULONG   ulNesting = 0;
     141 +
     142 +              DosEnterMustComplete(&ulNesting);
    114143 +              TRY_QUIET(excpt1, OnKillYourFunc) // or TRY_LOUD
    115144 +              {
     
    126155 +                  fSemOwned = FALSE;
    127156 +              }
     157 +              DosExitMustComplete(&ulNesting);
    128158 +          } // end of your_func
    129159 *
    130  *      This way your mutex semaphore gets released even if
    131  *      exceptions occur in your code. If you don't do this,
    132  *      threads waiting for that semaphore will be blocked
    133  *      forever when exceptions occur. As a result, depending
    134  *      on the thread, PM will hang, or the application will
    135  *      never terminate.
     160 *      This way your mutex semaphore gets released in every
     161 *      possible condition.
    136162 *
    137163 *      <B>Customizing</B>
    138164 *
    139  *      Note: As opposed to versions < 0.9.0, this is now
     165 *      As opposed to versions before 0.9.0, this code is now
    140166 *      completely independent of XWorkplace. This file now
    141167 *      contains "pure" exception handlers only.
     
    146172 *      If excRegisterHooks is not called, the following safe
    147173 *      defaults are used:
     174 *
    148175 *          --  the trap log file is TRAP.LOG in the root
    149176 *              directory of your boot drive.
     
    182209 *                                      John Currier,
    183210 *                                      Anthony Cruise.
    184  *      This file is part of the XWorkplace source package.
    185  *      XWorkplace is free software; you can redistribute it and/or modify
     211 *      This file is part of the "XWorkplace helpers" source package.
     212 *      This is free software; you can redistribute it and/or modify
    186213 *      it under the terms of the GNU General Public License as published
    187214 *      by the Free Software Foundation, in version 2 as it comes in the
     
    223250
    224251/* ******************************************************************
    225  *                                                                  *
    226  *   Global variables                                               *
    227  *                                                                  *
     252 *
     253 *   Global variables
     254 *
    228255 ********************************************************************/
    229256
     
    240267
    241268/* ******************************************************************
    242  *                                                                  *
    243  *   Exception helper routines                                      *
    244  *                                                                  *
     269 *
     270 *   Exception helper routines
     271 *
    245272 ********************************************************************/
    246273
     
    490517        case XCPT_ACCESS_VIOLATION:
    491518        {
    492             fprintf(file, "\nAccess violation: ");
     519            fprintf(file, "\nXCPT_ACCESS_VIOLATION: ");
    493520            if (pReportRec->ExceptionInfo[0] & XCPT_READ_ACCESS)
    494521                fprintf(file, "Invalid read access from 0x%04lX:%08lX.\n",
     
    516543        case XCPT_INTEGER_DIVIDE_BY_ZERO:
    517544        {
    518             fprintf(file, "\nInteger division by zero.\n");
     545            fprintf(file, "\nXCPT_INTEGER_DIVIDE_BY_ZERO.\n");
    519546            fprintf(file,
    520547                    "Explanation: An attempt was made to divide an integer value by zero,\n"
     
    525552        case XCPT_ILLEGAL_INSTRUCTION:
    526553        {
    527             fprintf(file, "\nIllegal instruction found.\n");
     554            fprintf(file, "\nXCPT_ILLEGAL_INSTRUCTION.\n");
    528555            fprintf(file,
    529556                    "Explanation: An attempt was made to execute an instruction that\n"
     
    534561        case XCPT_PRIVILEGED_INSTRUCTION:
    535562        {
    536             fprintf(file, "\nPrivileged instruction found.\n");
     563            fprintf(file, "\nXCPT_PRIVILEGED_INSTRUCTION.\n");
    537564            fprintf(file,
    538565                    "Explanation: An attempt was made to execute an instruction that\n"
     
    543570
    544571        case XCPT_INTEGER_OVERFLOW:
    545             fprintf(file, "\nInteger overflow.\n");
     572            fprintf(file, "\nXCPT_INTEGER_OVERFLOW.\n");
    546573            fprintf(file,
    547574                    "Explanation: An integer operation generated a carry-out of the most\n"
    548575                    "             significant bit. This is a sign of an attempt to store\n"
    549576                    "             a value which does not fit into an integer variable.\n");
     577
     578        default:
     579            fprintf(file, "\nUnknown OS/2 exception number %d.\n", pReportRec->ExceptionNum);
     580            fprintf(file, "Look this up in the OS/2 header files.\n");
    550581    }
    551582
     
    700731
    701732/* ******************************************************************
    702  *                                                                  *
    703  *   Exported routines                                              *
    704  *                                                                  *
     733 *
     734 *   Exported routines
     735 *
    705736 ********************************************************************/
    706737
     
    722753 *      The hooks are as follows:
    723754 *
    724  *      pfnExcOpenFileNew gets called to open
     755 *      --  pfnExcOpenFileNew gets called to open
    725756 *          the trap log file. This must return a FILE*
    726757 *          pointer from fopen(). If this is not defined,
     
    729760 *          into it before the actual exception info.
    730761 *
    731  *      pfnExcHookNew gets called while the trap log
     762 *      --  pfnExcHookNew gets called while the trap log
    732763 *          is being written. At this point,
    733764 *          the following info has been written into
     
    743774 *          Use this hook to write additional application
    744775 *          info into the trap log, such as the state
    745  *          of your threads.
    746  *
    747  *      pfnExcHookError gets called when the TRY_* macros
     776 *          of your own threads and mutexes.
     777 *
     778 *      --  pfnExcHookError gets called when the TRY_* macros
    748779 *          fail to install an exception handler (when
    749  *          DosSetExceptionHandler fails).
     780 *          DosSetExceptionHandler fails). I've never seen
     781 *          this happen.
    750782 *
    751783 *@@added V0.9.0 [umoeller]
     
    772804 *      to the thread to continue execution, i.e. the
    773805 *      default OS/2 exception handler will never get
    774  *      called. This requires a setjmp() call on
     806 *      called.
     807 *
     808 *      This requires a setjmp() call on
    775809 *      EXCEPTIONREGISTRATIONRECORD2.jmpThread before
    776  *      being installed.
    777  *
    778  *      This is best registered thru the TRY_LOUD macro
    779  *      (new with V0.84, described in except.c), which
    780  *      does the necessary setup.
    781  *
    782  *      Depending on the type of exception, the following
    783  *      happens:
    784  *
    785  *      <B>a) "real" exceptions</B>
     810 *      being installed. The TRY_LOUD macro will take
     811 *      care of this for you (see except.c).
     812 *
     813 *      This intercepts the following exceptions (see
     814 *      the OS/2 Control Program Reference for details):
    786815 *
    787816 *      --  XCPT_ACCESS_VIOLATION         (traps 0x0d, 0x0e)
     
    795824 *      what source code corresponds to the error.
    796825 *
     826 *      See excRegisterHooks for the default setup of this.
     827 *
    797828 *      Note that to get meaningful debugging information
    798829 *      in this handler's traplog, you need the following:
     830 *
    799831 *      a)  have a MAP file created at link time (/MAP)
     832 *
    800833 *      b)  convert the MAP to a SYM file using MAPSYM
     834 *
    801835 *      c)  put the SYM file in the same directory of
    802  *          the executable. This must have the same
    803  *          filestem as the executable.
    804  *
    805  *      See the "Control Programming Guide and Reference"
    806  *      for details.
     836 *          the module (EXE or DLL). This must have the
     837 *          same filestem as the module.
     838 *
    807839 *      All other exceptions are passed to the next handler
    808840 *      in the exception handler chain. This might be the
    809841 *      C/C++ compiler handler or the default OS/2 handler,
    810842 *      which will probably terminate the process.
    811  *
    812  *      <B>b) thread kills</B>
    813  *
    814  *      -- XCPT_PROCESS_TERMINATE
    815  *      -- XCPT_ASYNC_PROCESS_TERMINATE:
    816  *
    817  *      If EXCEPTIONREGISTRATIONRECORD2.pfnOnKill is != NULL,
    818  *      that function gets called to allow for thread cleanup
    819  *      before the thread really terminates. This should be
    820  *      used for releasing mutex semaphores.
    821843 *
    822844 *@@changed V0.9.0 [umoeller]: added support for thread termination
     
    852874    switch (pReportRec->ExceptionNum)
    853875    {
    854         case XCPT_PROCESS_TERMINATE:
     876        /* case XCPT_PROCESS_TERMINATE:
    855877        case XCPT_ASYNC_PROCESS_TERMINATE:
    856878            // thread terminated:
     
    859881            if (pRegRec2->pfnOnKill)
    860882                // call the "OnKill" function
    861                 pRegRec2->pfnOnKill();
     883                pRegRec2->pfnOnKill(pRegRec2);
    862884            // get outta here, which will kill the thread
    863         break;
     885        break; */
    864886
    865887        case XCPT_ACCESS_VIOLATION:
     
    867889        case XCPT_ILLEGAL_INSTRUCTION:
    868890        case XCPT_PRIVILEGED_INSTRUCTION:
     891        case XCPT_INVALID_LOCK_SEQUENCE:
    869892        case XCPT_INTEGER_OVERFLOW:
    870893        {
     
    924947 *      this is useful for certain error-prone functions, where
    925948 *      exceptions are likely to appear, for example used by
    926  *      cmnCheckObject to implement a fail-safe SOM object check.
     949 *      wpshCheckObject to implement a fail-safe SOM object check.
    927950 *
    928951 *      This does _not_ write an error log and makes _no_ sound.
     
    953976    switch (pReportRec->ExceptionNum)
    954977    {
    955         case XCPT_PROCESS_TERMINATE:
     978        /* case XCPT_PROCESS_TERMINATE:
    956979        case XCPT_ASYNC_PROCESS_TERMINATE:
    957980            // thread terminated:
     
    960983            if (pRegRec2->pfnOnKill)
    961984                // call the "OnKill" function
    962                 pRegRec2->pfnOnKill();
     985                pRegRec2->pfnOnKill(pRegRec2);
    963986            // get outta here, which will kill the thread
    964         break;
     987        break; */
    965988
    966989        case XCPT_ACCESS_VIOLATION:
     
    968991        case XCPT_ILLEGAL_INSTRUCTION:
    969992        case XCPT_PRIVILEGED_INSTRUCTION:
     993        case XCPT_INVALID_LOCK_SEQUENCE:
    970994        case XCPT_INTEGER_OVERFLOW:
    971995            // write excpt explanation only if the
    972             // resp. debugging #define is set (common.h)
     996            // resp. debugging #define is set (setup.h)
    973997            #ifdef DEBUG_WRITEQUIETEXCPT
    974998            {
  • trunk/src/helpers/gpih.c

    r13 r14  
    66 *      Usage: All PM programs.
    77 *
    8  *      A word about GPI rectangles: In general, graphics operations involving
    9  *      device coordinates (such as regions, bit maps and bit blts, and window
    10  *      management) use inclusive-exclusive rectangles.  All other graphics
    11  *      operations, such as GPI functions that define paths, use inclusive-inclusive
    12  *      rectangles.
     8 *      A word about GPI rectangles: In general, graphics operations
     9 *      involving device coordinates (such as regions, bit maps and
     10 *      bit blts, and window management) use inclusive-exclusive
     11 *      rectangles.  All other graphics operations, such as GPI
     12 *      functions that define paths, use inclusive-inclusive rectangles.
     13 *
     14 *      This can be a problem with mixing Win and Gpi functions. For
     15 *      example, WinQueryWindowRect returns an inclusive-exclusive
     16 *      rectangle (so that the xRight value is the same as the window
     17 *      width). However, GpiBox expects an inclusive-inclusive rectangle.
    1318 *
    1419 *      Function prefixes (new with V0.81):
     
    2328/*
    2429 *      Copyright (C) 1997-2000 Ulrich M”ller.
    25  *      This file is part of the XWorkplace source package.
    26  *      XWorkplace is free software; you can redistribute it and/or modify
     30 *      This file is part of the "XWorkplace helpers" source package.
     31 *      This is free software; you can redistribute it and/or modify
    2732 *      it under the terms of the GNU General Public License as published
    2833 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3944    // as unsigned char
    4045
    41 #define INCL_DOSDEVIOCTL
    42 #define INCL_DOS
    4346#define INCL_DOSERRORS
    44 #define INCL_WIN
    45 #define INCL_GPI
     47
     48#define INCL_WINWINDOWMGR
     49#define INCL_WINPOINTERS
     50#define INCL_WINSYS
     51
     52#define INCL_GPIPRIMITIVES
     53#define INCL_GPIBITMAPS
     54#define INCL_GPILOGCOLORTABLE
     55#define INCL_GPILCIDS
    4656#include <os2.h>
    4757
     
    6878
    6979/* ******************************************************************
    70  *                                                                  *
    71  *   Device helpers                                                 *
    72  *                                                                  *
     80 *
     81 *   Device helpers
     82 *
    7383 ********************************************************************/
    7484
     
    100110
    101111/* ******************************************************************
    102  *                                                                  *
    103  *   Color helpers                                                  *
    104  *                                                                  *
     112 *
     113 *   Color helpers
     114 *
    105115 ********************************************************************/
    106116
     
    139149
    140150/* ******************************************************************
    141  *                                                                  *
    142  *   Drawing primitives helpers                                     *
    143  *                                                                  *
     151 *
     152 *   Drawing primitives helpers
     153 *
    144154 ********************************************************************/
    145155
     
    187197 *      the top right point lies _outside_ the rectangle
    188198 *      which is actually drawn. This is the same as with
    189  *      WinFillRect.
     199 *      WinFillRect. ### I don't think so any more... GpiBox
     200 *      uses inclusive-inclusive rectangles...
    190201 *
    191202 *      Changes to the HPS:
     
    252263    GpiMove(hps, &ptlSave);
    253264    GpiSetColor(hps, lColorSave);
     265}
     266
     267/*
     268 *@@ gpihThickBox:
     269 *      draws a box from the specified rectangle with the
     270 *      specified width.
     271 *
     272 *      The specified rectangle is inclusive, that is, the top
     273 *      right corner specifies the top right pixel to be drawn.
     274 *
     275 *      If usWidth > 1, the additional pixels will be drawn towards
     276 *      the _center_ of the rectangle. prcl thus always specifies
     277 *      the bottom left and top right pixels to be drawn.
     278 *
     279 *      This is different from using GpiSetLineWidth, with which
     280 *      I was unable to find out in which direction lines are
     281 *      extended.
     282 *
     283 *      This is similar to gpihDraw3DFrame, except that everything
     284 *      is painted in the current color.
     285 *
     286 *@@added V0.9.7 (2000-12-06) [umoeller]
     287 */
     288
     289VOID gpihDrawThickFrame(HPS hps,              // in: presentation space for output
     290                        PRECTL prcl,          // in: rectangle to draw (exclusive)
     291                        ULONG ulWidth)       // in: line width (>= 1)
     292{
     293    ULONG ul = 0;
     294    for (;
     295         ul < ulWidth;
     296         ul++)
     297    {
     298        GpiMove(hps, (PPOINTL)prcl);
     299        GpiBox(hps,
     300               DRO_OUTLINE,
     301               (PPOINTL)&(prcl->xRight),
     302               0,
     303               0);
     304
     305        // and one more to the outside
     306        prcl->xLeft++;
     307        prcl->yBottom++;
     308        prcl->xRight--;
     309        prcl->yTop--;
     310    }
    254311}
    255312
     
    355412
    356413/* ******************************************************************
    357  *                                                                  *
    358  *   Font helpers                                                   *
    359  *                                                                  *
     414 *
     415 *   Font helpers
     416 *
    360417 ********************************************************************/
    361418
     
    10301087
    10311088/* ******************************************************************
    1032  *                                                                  *
    1033  *   Bitmap helpers                                                 *
    1034  *                                                                  *
     1089 *
     1090 *   Bitmap helpers
     1091 *
    10351092 ********************************************************************/
    10361093
  • trunk/src/helpers/helpers_post.in

    r13 r14  
    153153               $(PROJECTINC)\setup.h
    154154
     155$(OUTPUTDIR)\timer.obj:   $(@B).c $(HLPINC)\$(@B).h \
     156               $(HLPINC)\datetime.h $(HLPINC)\except.h $(HLPINC)\linklist.h $(HLPINC)\threads.h \
     157               $(PROJECTINC)\setup.h
     158
    155159$(OUTPUTDIR)\tmsgfile.obj:  $(@B).c $(HLPINC)\$(@B).h \
    156160               $(PROJECTINC)\setup.h \
  • trunk/src/helpers/helpers_pre.in

    r13 r14  
    8080$(OUTPUTDIR)\textview.obj \
    8181$(OUTPUTDIR)\textv_html.obj \
     82$(OUTPUTDIR)\timer.obj \
    8283$(OUTPUTDIR)\winh.obj
    8384
  • trunk/src/helpers/level.c

    r8 r14  
    1616 *      Copyright (C) 1994 Martin Lafaix (EDM/2 2-05).
    1717 *      Copyright (C) 2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3333
    3434#define INCL_DOSFILEMGR
    35 #define INCL_NOPMAPI
    3635#include <os2.h>
    3736
     
    5453
    5554/* ******************************************************************
    56  *                                                                  *
    57  *   Interface                                                      *
    58  *                                                                  *
     55 *
     56 *   Interface
     57 *
    5958 ********************************************************************/
    6059
     
    473472
    474473/* ******************************************************************
    475  *                                                                  *
    476  *   Local helper functions                                         *
    477  *                                                                  *
     474 *
     475 *   Local helper functions
     476 *
    478477 ********************************************************************/
    479478
  • trunk/src/helpers/linklist.c

    r8 r14  
    5757/*
    5858 *      Copyright (C) 1997-2000 Ulrich M”ller.
    59  *      This file is part of the XWorkplace source package.
    60  *      XWorkplace is free software; you can redistribute it and/or modify
     59 *      This file is part of the "XWorkplace helpers" source package.
     60 *      This is free software; you can redistribute it and/or modify
    6161 *      it under the terms of the GNU General Public License as published
    6262 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8282
    8383/* ******************************************************************
    84  *                                                                  *
    85  *   List base functions                                            *
    86  *                                                                  *
     84 *
     85 *   List base functions
     86 *
    8787 ********************************************************************/
     88
     89/*
     90 *@@ lstMalloc:
     91 *      wrapper around malloc() to make sure memory is
     92 *      allocated from the C runtime the helpers were
     93 *      compiled with. This is useful for auto-free
     94 *      lists.
     95 *
     96 *@@added V0.9.7 (2000-12-07) [umoeller]
     97 */
     98
     99void* lstMalloc(size_t size)
     100{
     101    return (malloc(size));
     102}
     103
     104/*
     105 *@@ lstStrDup:
     106 *      wrapper around strdup() to make sure memory is
     107 *      allocated from the C runtime the helpers were
     108 *      compiled with. This is useful for auto-free
     109 *      lists.
     110 *
     111 *@@added V0.9.7 (2000-12-07) [umoeller]
     112 */
     113
     114void* lstStrDup(const char *pcsz)
     115{
     116    return (strdup(pcsz));
     117}
    88118
    89119/*
     
    111141 *      you're storing other objects, such as numbers
    112142 *      or other static items.
     143 *
     144 *      This of course will be a "flat" free(). If
     145 *      you store structures in the list using other
     146 *      heap pointers, auto-free would cause memory leaks.
     147 *
     148 *      Also, auto-free only works if the malloc() that
     149 *      has been used on the list item is in the same C
     150 *      runtime as with the linklist functions. If the
     151 *      caller uses a different runtime (e.g. from a DLL),
     152 *      it can use lstMalloc() for allocating the list
     153 *      item and still use auto-free.
    113154 *
    114155 *      Note: You better call lstInit only once per list,
     
    758799
    759800/* ******************************************************************
    760  *                                                                  *
    761  *   List sorting                                                   *
    762  *                                                                  *
     801 *
     802 *   List sorting
     803 *
    763804 ********************************************************************/
    764805
     
    933974
    934975/* ******************************************************************
    935  *                                                                  *
    936  *   List pseudo-stacks                                             *
    937  *                                                                  *
     976 *
     977 *   List pseudo-stacks
     978 *
    938979 ********************************************************************/
    939980
  • trunk/src/helpers/memdebug.c

    r13 r14  
    134134
    135135/* ******************************************************************
    136  *                                                                  *
    137  *   Global variables                                               *
    138  *                                                                  *
     136 *
     137 *   Global variables
     138 *
    139139 ********************************************************************/
    140140
     
    156156
    157157/* ******************************************************************
    158  *                                                                  *
    159  *   Debug heap management                                          *
    160  *                                                                  *
     158 *
     159 *   Debug heap management
     160 *
    161161 ********************************************************************/
    162162
     
    660660
    661661/* ******************************************************************
    662  *                                                                  *
    663  *   XFolder debugging helpers                                      *
    664  *                                                                  *
     662 *
     663 *   XFolder debugging helpers
     664 *
    665665 ********************************************************************/
    666666
  • trunk/src/helpers/prfh.c

    r13 r14  
    1919/*
    2020 *      Copyright (C) 1997-2000 Ulrich M”ller.
    21  *      This file is part of the XWorkplace source package.
    22  *      XWorkplace is free software; you can redistribute it and/or modify
     21 *      This file is part of the "XWorkplace helpers" source package.
     22 *      This is free software; you can redistribute it and/or modify
    2323 *      it under the terms of the GNU General Public License as published
    2424 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3535    // as unsigned char
    3636
    37 #define INCL_DOS
    3837#define INCL_DOSERRORS
    39 #define INCL_WIN
     38#define INCL_WINSHELLDATA
    4039#include <os2.h>
    4140
     
    170169
    171170PSZ prfhQueryProfileData(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    172                         PSZ pszApp,      // in: application to query
    173                         PSZ pszKey,      // in: key to query
    174                         PULONG pcbBuf)   // out: size of the returned buffer
     171                         PSZ pszApp,     // in: application to query
     172                         PSZ pszKey,     // in: key to query
     173                         PULONG pcbBuf)  // out: size of the returned buffer; ptr can be NULL
    175174{
    176175    PSZ     pData = NULL;
     
    238237 *      --  cDateSep = '/' (date separator);
    239238 *      --  cTimeSep = ':' (time separator);
     239 *      --  cDecimal = '.' (decimal separator).
    240240 *      --  cThousands = ',' (thousands separator).
    241241 *
    242242 *@@added V0.9.0 [umoeller]
     243 *@@changed V0.9.7 (2000-12-02) [umoeller]: added cDecimal
    243244 */
    244245
     
    247248    if (pcs)
    248249    {
    249         pcs->ulDateFormat = PrfQueryProfileInt(HINI_USER, "PM_National", "iDate", 0);
    250         pcs->ulTimeFormat = PrfQueryProfileInt(HINI_USER, "PM_National", "iTime", 0);
    251         pcs->cDateSep = prfhQueryProfileChar(HINI_USER, "PM_National", "sDate", '/');
    252         pcs->cTimeSep = prfhQueryProfileChar(HINI_USER, "PM_National", "sTime", ':');
    253         pcs->cThousands = prfhQueryProfileChar(HINI_USER, "PM_National", "sThousand", ',');
     250        const char *pcszApp = "PM_National";
     251        pcs->ulDateFormat = PrfQueryProfileInt(HINI_USER, (PSZ)pcszApp, "iDate", 0);
     252        pcs->ulTimeFormat = PrfQueryProfileInt(HINI_USER, (PSZ)pcszApp, "iTime", 0);
     253        pcs->cDateSep = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sDate", '/');
     254        pcs->cTimeSep = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sTime", ':');
     255        pcs->cDecimal = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sDecimal", '.');
     256        pcs->cThousands = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sThousand", ',');
    254257    }
    255258}
  • trunk/src/helpers/prfh2.c

    r13 r14  
    2424/*
    2525 *      Copyright (C) 1997-2000 Ulrich M”ller.
    26  *      This file is part of the XWorkplace source package.
    27  *      XWorkplace is free software; you can redistribute it and/or modify
     26 *      This file is part of the "XWorkplace helpers" source package.
     27 *      This is free software; you can redistribute it and/or modify
    2828 *      it under the terms of the GNU General Public License as published
    2929 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4040    // as unsigned char
    4141
    42 #define INCL_DOS
    4342#define INCL_DOSERRORS
    44 #define INCL_WIN
     43#define INCL_WINSHELLDATA
    4544#include <os2.h>
    4645
  • trunk/src/helpers/procstat.c

    r13 r14  
    3434 *      Copyright (C) 1992-1994 Kai Uwe Rommel.
    3535 *      Copyright (C) 1998-2000 Ulrich M”ller.
    36  *      This file is part of the XWorkplace source package.
    37  *      XWorkplace is free software; you can redistribute it and/or modify
     36 *      This file is part of the "XWorkplace helpers" source package.
     37 *      This is free software; you can redistribute it and/or modify
    3838 *      it under the terms of the GNU General Public License as published
    3939 *      by the Free Software Foundation, in version 2 as it comes in the
     
    5050    // as unsigned char
    5151
    52 #define INCL_DOS
     52#define INCL_DOSMODULEMGR
    5353#define INCL_DOSERRORS
    54 #define INCL_DOSMODULEMGR
    5554#include <os2.h>
    5655
     
    7069
    7170/********************************************************************
    72  *                                                                  *
    73  *   DosQProcStat (16-bit) interface                                *
    74  *                                                                  *
     71 *
     72 *   DosQProcStat (16-bit) interface
     73 *
    7574 ********************************************************************/
    7675
     
    196195
    197196/********************************************************************
    198  *                                                                  *
    199  *   DosQProcStat (16-bit) helpers                                  *
    200  *                                                                  *
     197 *
     198 *   DosQProcStat (16-bit) helpers
     199 *
    201200 ********************************************************************/
    202201
     
    439438
    440439/********************************************************************
    441  *                                                                  *
    442  *   DosQuerySysState (32-bit) interface                            *
    443  *                                                                  *
     440 *
     441 *   DosQuerySysState (32-bit) interface
     442 *
    444443 ********************************************************************/
    445444
  • trunk/src/helpers/resh.c

    r8 r14  
    3434    // as unsigned char
    3535
     36#define INCL_DOSMODULEMGR
     37#define INCL_DOSRESOURCES
    3638#define INCL_DOSERRORS
    37 #define INCL_DOS
    38 #define INCL_DOS
    3939#include <os2.h>
    4040
  • trunk/src/helpers/shapewin.c

    r8 r14  
    167167 *                  Akira Hatakeyama,
    168168 *                  Takayuki Suwa.
    169  *      This file is part of the XWorkplace source package.
    170  *      XWorkplace is free software; you can redistribute it and/or modify
     169 *      This file is part of the "XWorkplace helpers" source package.
     170 *      This is free software; you can redistribute it and/or modify
    171171 *      it under the terms of the GNU General Public License as published
    172172 *      by the Free Software Foundation, in version 2 as it comes in the
     
    184184    // as unsigned char
    185185
    186 #define INCL_DOS
    187186#define INCL_DOSERRORS
    188 #define INCL_WIN
     187
     188#define INCL_WINWINDOWMGR
     189#define INCL_WINFRAMEMGR
     190#define INCL_WINDIALOGS
     191#define INCL_WININPUT
     192#define INCL_WINPOINTERS
    189193#define INCL_WINSYS
     194#define INCL_WINRECTANGLES
     195#define INCL_WINTRACKRECT
     196
    190197#define INCL_GPILOGCOLORTABLE
    191198#define INCL_GPIPRIMITIVES
     
    209216
    210217/* ******************************************************************
    211  *                                                                  *
    212  *   Global variables                                               *
    213  *                                                                  *
     218 *
     219 *   Global variables
     220 *
    214221 ********************************************************************/
    215222
     
    217224
    218225/* ******************************************************************
    219  *                                                                  *
    220  *   Part 1: Shape window functions                                 *
    221  *                                                                  *
     226 *
     227 *   Part 1: Shape window functions
     228 *
    222229 ********************************************************************/
    223230
     
    515522    HPS         hps ;
    516523
    517     pRgn = (PSHPREGION) WinQueryWindowPtr(hwnd, 0);
     524    pRgn = (PSHPREGION)WinQueryWindowPtr(hwnd, 0);
    518525
    519526    switch (msg)
     
    12161223        case WM_QUERYDLGCODE:
    12171224            // TRACE("WM_QUERYDLGCODE\n");
    1218             return (MRESULT) DLGC_STATIC;
     1225            return (MRESULT)DLGC_STATIC;
    12191226
    12201227        /*
     
    12951302
    12961303/* ******************************************************************
    1297  *                                                                  *
    1298  *   Part 2: Shape frame functions                                  *
    1299  *                                                                  *
     1304 *
     1305 *   Part 2: Shape frame functions
     1306 *
    13001307 ********************************************************************/
    13011308
  • trunk/src/helpers/stringh.c

    r13 r14  
    2525 *      Copyright (C) 1997-2000 Ulrich M”ller.
    2626 *      Parts Copyright (C) 1991-1999 iMatix Corporation.
    27  *      This file is part of the XWorkplace source package.
    28  *      XWorkplace is free software; you can redistribute it and/or modify
     27 *      This file is part of the "XWorkplace helpers" source package.
     28 *      This is free software; you can redistribute it and/or modify
    2929 *      it under the terms of the GNU General Public License as published
    3030 *      by the Free Software Foundation, in version 2 as it comes in the
     
    17091709
    17101710/* ******************************************************************
    1711  *                                                                  *
    1712  *   Miscellaneous                                                  *
    1713  *                                                                  *
     1711 *
     1712 *   Miscellaneous
     1713 *
    17141714 ********************************************************************/
    17151715
     
    17421742
    17431743VOID strhArrayAppend(PSZ *ppszRoot,         // in: root of array
    1744                      PSZ pszNew,            // in: string to append
     1744                     const char *pcszNew,   // in: string to append
    17451745                     PULONG pcbRoot)        // in/out: size of array
    17461746{
    1747     ULONG cbNew = strlen(pszNew);
     1747    ULONG cbNew = strlen(pcszNew);
    17481748    PSZ pszTemp = (PSZ)malloc(*pcbRoot
    17491749                              + cbNew
     
    17591759    // append new string
    17601760    strcpy(pszTemp + *pcbRoot,
    1761            pszNew);
     1761           pcszNew);
    17621762    // update root
    17631763    *ppszRoot = pszTemp;
     
    18591859
    18601860/* ******************************************************************
    1861  *                                                                  *
    1862  *   Wildcard matching                                              *
    1863  *                                                                  *
     1861 *
     1862 *   Wildcard matching
     1863 *
    18641864 ********************************************************************/
    18651865
     
    24572457
    24582458/* ******************************************************************
    2459  *                                                                  *
    2460  *   Fast string searches                                           *
    2461  *                                                                  *
     2459 *
     2460 *   Fast string searches
     2461 *
    24622462 ********************************************************************/
    24632463
  • trunk/src/helpers/textv_html.c

    r13 r14  
    5959
    6060/* ******************************************************************
    61  *                                                                  *
    62  *   Declarations                                                   *
    63  *                                                                  *
     61 *
     62 *   Declarations
     63 *
    6464 ********************************************************************/
    6565
     
    150150
    151151/* ******************************************************************
    152  *                                                                  *
    153  *   Global variables                                               *
    154  *                                                                  *
     152 *
     153 *   Global variables
     154 *
    155155 ********************************************************************/
    156156
    157157/* ******************************************************************
    158  *                                                                  *
    159  *   Append-char helpers                                            *
    160  *                                                                  *
     158 *
     159 *   Append-char helpers
     160 *
    161161 ********************************************************************/
    162162
     
    299299
    300300/* ******************************************************************
    301  *                                                                  *
    302  *   Tag converter functions                                        *
    303  *                                                                  *
     301 *
     302 *   Tag converter functions
     303 *
    304304 ********************************************************************/
    305305
     
    885885
    886886/* ******************************************************************
    887  *                                                                  *
    888  *   Tag helpers                                                    *
    889  *                                                                  *
     887 *
     888 *   Tag helpers
     889 *
    890890 ********************************************************************/
    891891
     
    19721972
    19731973/* ******************************************************************
    1974  *                                                                  *
    1975  *   Entry points                                                   *
    1976  *                                                                  *
     1974 *
     1975 *   Entry points
     1976 *
    19771977 ********************************************************************/
    19781978
  • trunk/src/helpers/textview.c

    r13 r14  
    252252
    253253/* ******************************************************************
    254  *                                                                  *
    255  *   Device-independent functions                                   *
    256  *                                                                  *
     254 *
     255 *   Device-independent functions
     256 *
    257257 ********************************************************************/
    258258
     
    466466
    467467/* ******************************************************************
    468  *                                                                  *
    469  *   Device-independent text formatting                             *
    470  *                                                                  *
     468 *
     469 *   Device-independent text formatting
     470 *
    471471 ********************************************************************/
    472472
     
    14001400
    14011401/* ******************************************************************
    1402  *                                                                  *
    1403  *   Device-independent text painting                               *
    1404  *                                                                  *
     1402 *
     1403 *   Device-independent text painting
     1404 *
    14051405 ********************************************************************/
    14061406
     
    18061806
    18071807/* ******************************************************************
    1808  *                                                                  *
    1809  *   Window-dependent functions                                     *
    1810  *                                                                  *
     1808 *
     1809 *   Window-dependent functions
     1810 *
    18111811 ********************************************************************/
    18121812
     
    31803180
    31813181/* ******************************************************************
    3182  *                                                                  *
    3183  *   Printer-dependent functions                                    *
    3184  *                                                                  *
     3182 *
     3183 *   Printer-dependent functions
     3184 *
    31853185 ********************************************************************/
    31863186
  • trunk/src/helpers/threads.c

    r8 r14  
    2424/*
    2525 *      Copyright (C) 1997-2000 Ulrich M”ller.
    26  *      This file is part of the XWorkplace source package.
    27  *      XWorkplace is free software; you can redistribute it and/or modify
     26 *      This file is part of the "XWorkplace helpers" source package.
     27 *      This is free software; you can redistribute it and/or modify
    2828 *      it under the terms of the GNU General Public License as published
    2929 *      by the Free Software Foundation, in version 2 as it comes in the
     
    102102            ((PTHREADFUNC)pti->pThreadFunc)(pti);
    103103
     104        if (pti->flFlags & THRF_WAIT)
     105            // "Wait" flag set: delete semaphore
     106            DosCloseEventSem(pti->hevRunning);
     107
    104108        // thread func returns:
    105109        pti->fExitComplete = TRUE;
    106110        pti->tid = NULLHANDLE;
    107 
    108         if (pti->flFlags & THRF_WAIT)
    109             // "Wait" flag set: delete semaphore
    110             DosCloseEventSem(pti->hevRunning);
    111111
    112112        if (pti->pfRunning)
  • trunk/src/helpers/tmsgfile.c

    r13 r14  
    5050 *      Copyright (C) 1999 Christian Langanke.
    5151 *      Copyright (C) 1999-2000 Ulrich M”ller.
    52  *      This file is part of the XWorkplace source package.
    53  *      XWorkplace is free software; you can redistribute it and/or modify
     52 *      This file is part of the "XWorkplace helpers" source package.
     53 *      This is free software; you can redistribute it and/or modify
    5454 *      it under the terms of the GNU General Public License as published
    5555 *      by the Free Software Foundation, in version 2 as it comes in the
     
    6666    // as unsigned char
    6767
    68 #define INCL_DOS
    69 #define INCL_ERRORS
     68#define INCL_DOSFILEMGR
     69#define INCL_DOSMISC
     70#define INCL_DOSNLS
     71#define INCL_DOSERRORS
    7072#include <os2.h>
    7173
     
    8587
    8688/* ******************************************************************
    87  *                                                                  *
    88  *   Declarations                                                   *
    89  *                                                                  *
     89 *
     90 *   Declarations
     91 *
    9092 ********************************************************************/
    9193
     
    111113
    112114/* ******************************************************************
    113  *                                                                  *
    114  *   Text Message File Code                                         *
    115  *                                                                  *
     115 *
     116 *   Text Message File Code
     117 *
    116118 ********************************************************************/
    117119
  • trunk/src/helpers/tree.c

    r13 r14  
    8989 *      Copyright (C) 1991-99 iMatix Corporation.
    9090 *      Copyright (C) 2000 Ulrich M”ller.
    91  *      This file is part of the XWorkplace source package.
    92  *      XWorkplace is free software; you can redistribute it and/or modify
     91 *      This file is part of the "XWorkplace helpers" source package.
     92 *      This is free software; you can redistribute it and/or modify
    9393 *      it under the terms of the GNU General Public License as published
    9494 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/src/helpers/winh.c

    r13 r14  
    2020/*
    2121 *      Copyright (C) 1997-2000 Ulrich M”ller.
    22  *      This file is part of the XWorkplace source package.
    23  *      XWorkplace is free software; you can redistribute it and/or modify
     22 *      This file is part of the "XWorkplace helpers" source package.
     23 *      This is free software; you can redistribute it and/or modify
    2424 *      it under the terms of the GNU General Public License as published
    2525 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3636    // as unsigned char
    3737
     38#define INCL_DOSPROCESS
     39#define INCL_DOSMODULEMGR
     40#define INCL_DOSSEMAPHORES
     41#define INCL_DOSDEVICES
    3842#define INCL_DOSDEVIOCTL
    39 #define INCL_DOS
    4043#define INCL_DOSERRORS
    41 #define INCL_WIN
    42 #define INCL_GPI
    43 
    44 // spooler #include's
    45 #define INCL_BASE
     44
     45#define INCL_WINWINDOWMGR
     46#define INCL_WINMESSAGEMGR
     47#define INCL_WINFRAMEMGR
     48#define INCL_WININPUT
     49#define INCL_WINDIALOGS
     50#define INCL_WINPOINTERS
     51#define INCL_WINRECTANGLES
     52#define INCL_WINSHELLDATA
     53#define INCL_WINSYS
     54#define INCL_WINHELP
     55#define INCL_WINPROGRAMLIST
     56#define INCL_WINSWITCHLIST
     57#define INCL_WINMENUS
     58#define INCL_WINSCROLLBARS
     59#define INCL_WINLISTBOXES
     60#define INCL_WINSTDSPIN
     61#define INCL_WINSTDSLIDER
     62#define INCL_WINCIRCULARSLIDER
     63#define INCL_WINSTDFILE
     64
    4665#define INCL_SPL
    4766#define INCL_SPLDOSPRINT
    4867#define INCL_SPLERRORS
    4968
     69#define INCL_GPIBITMAPS
     70#define INCL_GPIPRIMITIVES
    5071#include <os2.h>
    5172
     
    6990
    7091/* ******************************************************************
    71  *                                                                  *
    72  *   Menu helpers                                                   *
    73  *                                                                  *
     92 *
     93 *   Menu helpers
     94 *
    7495 ********************************************************************/
    7596
     
    255276 *      not found.
    256277 *
    257  *      If something != NULL is returned, you
    258  *      should free() the buffer afterwards.
     278 *      Returns NULL on error. Use winhFree()
     279 *      to free the return value.
    259280 *
    260281 *      Use the WinSetMenuItemText macro to
     
    387408
    388409/* ******************************************************************
    389  *                                                                  *
    390  *   Slider helpers                                                 *
    391  *                                                                  *
     410 *
     411 *   Slider helpers
     412 *
    392413 ********************************************************************/
    393414
     
    791812
    792813/* ******************************************************************
    793  *                                                                  *
    794  *   Spin button helpers                                            *
    795  *                                                                  *
     814 *
     815 *   Spin button helpers
     816 *
    796817 ********************************************************************/
    797818
     
    896917
    897918/* ******************************************************************
    898  *                                                                  *
    899  *   List box helpers                                               *
    900  *                                                                  *
     919 *
     920 *   List box helpers
     921 *
    901922 ********************************************************************/
    902923
     
    905926 *      returns the text of the specified
    906927 *      list box item in a newly allocated
    907  *      buffer, which you should free() afterwards,
    908  *      or NULL upon errors.
     928 *      buffer.
     929 *
     930 *      Returns NULL on error. Use winhFree()
     931 *      to free the return value.
    909932 *
    910933 *@@added V0.9.1 (99-12-14) [umoeller]
     
    10251048
    10261049/* ******************************************************************
    1027  *                                                                  *
    1028  *   Scroll bar helpers                                             *
    1029  *                                                                  *
     1050 *
     1051 *   Scroll bar helpers
     1052 *
    10301053 ********************************************************************/
    10311054
     
    15031526
    15041527/* ******************************************************************
    1505  *                                                                  *
    1506  *   Window positioning helpers                                     *
    1507  *                                                                  *
     1528 *
     1529 *   Window positioning helpers
     1530 *
    15081531 ********************************************************************/
    15091532
     
    19161939
    19171940/*
     1941 *@@ winhFindWindowBelow:
     1942 *      finds the window with the same parent
     1943 *      which sits right below hwndFind in the
     1944 *      window Z-order.
     1945 *
     1946 *@@added V0.9.7 (2000-12-04) [umoeller]
     1947 */
     1948
     1949HWND winhFindWindowBelow(HWND hwndFind)
     1950{
     1951    HWND hwnd = NULLHANDLE,
     1952         hwndParent = WinQueryWindow(hwndFind, QW_PARENT);
     1953
     1954    if (hwndParent)
     1955    {
     1956        HENUM   henum = WinBeginEnumWindows(hwndParent);
     1957        HWND    hwndThis;
     1958        while (hwndThis = WinGetNextWindow(henum))
     1959        {
     1960            SWP swp;
     1961            WinQueryWindowPos(hwndThis, &swp);
     1962            if (swp.hwndInsertBehind == hwndFind)
     1963            {
     1964                hwnd = hwndThis;
     1965                break;
     1966            }
     1967        }
     1968        WinEndEnumWindows(henum);
     1969    }
     1970
     1971    return (hwnd);
     1972}
     1973
     1974/*
    19181975 *@@category: Helpers\PM helpers\Presentation parameters
    19191976 */
    19201977
    19211978/* ******************************************************************
    1922  *                                                                  *
    1923  *   Presparams helpers                                             *
    1924  *                                                                  *
     1979 *
     1980 *   Presparams helpers
     1981 *
    19251982 ********************************************************************/
    19261983
     
    19281985 *@@ winhQueryWindowFont:
    19291986 *      returns the window font presentation parameter
    1930  *      in a newly allocated buffer, which you must
    1931  *      free() afterwards. Returns NULL if not found.
     1987 *      in a newly allocated buffer.
     1988 *
     1989 *      Returns NULL on error. Use winhFree()
     1990 *      to free the return value.
    19321991 *
    19331992 *@@added V0.9.1 (2000-02-14) [umoeller]
     
    19662025
    19672026BOOL winhSetWindowFont(HWND hwnd,
    1968                        PSZ pszFont)
     2027                       const char *pcszFont)
    19692028{
    19702029    CHAR    szFont[256];
    19712030
    1972     if (pszFont == NULL)
     2031    if (pcszFont == NULL)
    19732032    {
    19742033        if (doshIsWarp4())
     
    19782037    }
    19792038    else
    1980         strhncpy0(szFont, pszFont, sizeof(szFont));
     2039        strhncpy0(szFont, pcszFont, sizeof(szFont));
    19812040
    19822041    return (WinSetPresParam(hwnd,
     
    20602119 *      Use free() on your PPRESPARAMS pointer (whose
    20612120 *      address was passed) after WinCreateWindow.
     2121 *
     2122 *      See winhQueryPresColor for typical presparams
     2123 *      used in OS/2.
    20622124 *
    20632125 *      Example:
     
    21392201 *      3)  if this fails or (fInherit == FALSE), WinQuerySysColor
    21402202 *          is called to get lSysColor (which should be a SYSCLR_*
    2141  *          index).
     2203 *          index), if lSysColor != -1;
     2204 *      4)  if (lSysColor == -1), -1 is returned.
    21422205 *
    21432206 *      The return value is always an RGB LONG, _not_ a color index.
     
    22052268 *@@changed V0.9.0 [umoeller]: removed INI key query, using SYSCLR_* instead; function prototype changed
    22062269 *@@changed V0.9.0 [umoeller]: added fInherit parameter
     2270 *@@changed V0.9.7 (2000-12-02) [umoeller]: added lSysColor == -1 support
    22072271 */
    22082272
     
    22292293
    22302294    // not found: get system color
    2231     return (WinQuerySysColor(HWND_DESKTOP, lSysColor, 0));
     2295    if (lSysColor != -1)
     2296        return (WinQuerySysColor(HWND_DESKTOP, lSysColor, 0));
     2297
     2298    return -1;
    22322299}
    22332300
     
    22372304
    22382305/* ******************************************************************
    2239  *                                                                  *
    2240  *   Help instance helpers                                          *
    2241  *                                                                  *
     2306 *
     2307 *   Help instance helpers
     2308 *
    22422309 ********************************************************************/
    22432310
     
    27602827
    27612828/* ******************************************************************
    2762  *                                                                  *
    2763  *   Miscellaneous                                                  *
    2764  *                                                                  *
     2829 *
     2830 *   Miscellaneous
     2831 *
    27652832 ********************************************************************/
     2833
     2834/*
     2835 *@@ winhFree:
     2836 *      frees a block of memory allocated by the
     2837 *      winh* functions.
     2838 *
     2839 *      Since the winh* functions use malloc(),
     2840 *      you can also use free() directly on such
     2841 *      blocks. However, you must use winhFree
     2842 *      if the winh* functions are in a module
     2843 *      with a different C runtime.
     2844 *
     2845 *@@added V0.9.7 (2000-12-06) [umoeller]
     2846 */
     2847
     2848VOID winhFree(PVOID p)
     2849{
     2850    if (p)
     2851        free(p);
     2852}
    27662853
    27672854/*
     
    29303017 *@@ winhQueryWindowText:
    29313018 *      this returns the window text of the specified
    2932  *      HWND in a newly allocated buffer, which has
    2933  *      the exact size of the window text.
    2934  *
    2935  *      This buffer must be free()'d later.
     3019 *      HWND in a newly allocated buffer.
     3020 *
     3021 *      Returns NULL on error. Use winhFree()
     3022 *      to free the return value.
    29363023 */
    29373024
     
    30583145 *@@added V0.9.0 [umoeller]
    30593146 *@@changed V0.9.5 (2000-08-13) [umoeller]: flStyleClient never worked, fixed
     3147 *@@changed V0.9.7 (2000-12-08) [umoeller]: fixed client calc for invisible window
    30603148 */
    30613149
     
    31193207
    31203208            // position client
    3121             WinQueryWindowRect(hwndFrame, &rclClient);
    3122             WinCalcFrameRect(hwndFrame, &rclClient,
     3209            // WinQueryWindowRect(hwndFrame, &rclClient);
     3210            // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller]
     3211            rclClient.xLeft = 0;
     3212            rclClient.yBottom = 0;
     3213            rclClient.xRight = pswpFrame->cx;
     3214            rclClient.yTop = pswpFrame->cy;
     3215            WinCalcFrameRect(hwndFrame,
     3216                             &rclClient,
    31233217                             TRUE);     // calc client from frame
    31243218            WinSetWindowPos(*phwndClient,
     
    35153609
    35163610/*
     3611 *@@ winhQuerySwitchList:
     3612 *      returns the switch list in a newly
     3613 *      allocated buffer. This does the
     3614 *      regular double WinQuerySwitchList
     3615 *      call to first get the no. of items
     3616 *      and then get the items.
     3617 *
     3618 *      The no. of items can be found in
     3619 *      the returned SWBLOCK.cwsentry.
     3620 *
     3621 *      Returns NULL on errors. Use
     3622 *      winhFree to free the return value.
     3623 *
     3624 *@@added V0.9.7 (2000-12-06) [umoeller]
     3625 */
     3626
     3627PSWBLOCK winhQuerySwitchList(HAB hab)
     3628{
     3629    ULONG   cItems = WinQuerySwitchList(hab, NULL, 0);
     3630    ULONG   ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
     3631    PSWBLOCK pSwBlock = (PSWBLOCK)malloc(ulBufSize);
     3632    if (pSwBlock)
     3633    {
     3634        cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize);
     3635        if (!cItems)
     3636        {
     3637            free(pSwBlock);
     3638            pSwBlock = NULL;
     3639        }
     3640    }
     3641
     3642    return (pSwBlock);
     3643}
     3644
     3645/*
     3646 *@@ winhQueryTasklistWindow:
     3647 *      returns the window handle of the PM task list.
     3648 *
     3649 *@@added V0.9.7 (2000-12-07) [umoeller]
     3650 */
     3651
     3652HWND winhQueryTasklistWindow(VOID)
     3653{
     3654    SWBLOCK  swblock;
     3655    HWND     hwndTasklist = winhQueryTasklistWindow();
     3656    // the tasklist has entry #0 in the SWBLOCK
     3657    WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK));
     3658    return (swblock.aswentry[0].swctl.hwnd);
     3659}
     3660
     3661/*
    35173662 *@@ winhKillTasklist:
    35183663 *      this will destroy the Tasklist (window list) window.
     
    35253670VOID winhKillTasklist(VOID)
    35263671{
    3527     SWBLOCK  swblock;
    3528     HWND     hwndTasklist;
    3529     // the tasklist has entry #0 in the SWBLOCK
    3530     WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK));
    3531     hwndTasklist = swblock.aswentry[0].swctl.hwnd;
     3672    HWND     hwndTasklist = winhQueryTasklistWindow();
    35323673    WinPostMsg(hwndTasklist,
    35333674               0x0454,     // undocumented msg for killing tasklist
     
    36953836
    36963837/* ******************************************************************
    3697  *                                                                  *
    3698  *   WPS Class List helpers                                         *
    3699  *                                                                  *
     3838 *
     3839 *   WPS Class List helpers
     3840 *
    37003841 ********************************************************************/
    37013842
     
    37123853 *      See WinEnumObjectClasses() for details.
    37133854 *
    3714  *      The buffer is allocated using malloc(), so
    3715  *      you should free() it when it is no longer
    3716  *      needed.
    3717  *
    3718  *      This returns NULL if an error occured.
     3855 *      Returns NULL on error. Use winhFree()
     3856 *      to free the return value.
    37193857 *
    37203858 *@@added V0.9.0 [umoeller]
  • trunk/src/helpers/wphandle.c

    r8 r14  
    2424 *      This file Copyright (C) 1997-2000 Ulrich M”ller,
    2525 *                                        Henk Kelder.
    26  *      This file is part of the XWorkplace source package.
    27  *      XWorkplace is free software; you can redistribute it and/or modify
     26 *      This file is part of the "XWorkplace helpers" source package.
     27 *      This is free software; you can redistribute it and/or modify
    2828 *      it under the terms of the GNU General Public License as published
    2929 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4040    // as unsigned char
    4141
    42 #define INCL_DOS
    4342#define INCL_WINSHELLDATA
    4443#include <os2.h>
     
    7372
    7473/* ******************************************************************
    75  *                                                                  *
    76  *   Helper functions                                               *
    77  *                                                                  *
     74 *
     75 *   Helper functions
     76 *
    7877 ********************************************************************/
    7978
     
    281280
    282281/* ******************************************************************
    283  *                                                                  *
    284  *   Get HOBJECT from filename                                      *
    285  *                                                                  *
     282 *
     283 *   Get HOBJECT from filename
     284 *
    286285 ********************************************************************/
    287286
     
    521520
    522521/* ******************************************************************
    523  *                                                                  *
    524  *   Get filename from HOBJECT                                      *
    525  *                                                                  *
     522 *
     523 *   Get filename from HOBJECT
     524 *
    526525 ********************************************************************/
    527526
     
    640639
    641640/* ******************************************************************
    642  *                                                                  *
    643  *   Manipulation functions                                         *
    644  *                                                                  *
     641 *
     642 *   Manipulation functions
     643 *
    645644 ********************************************************************/
    646645
  • trunk/src/helpers/xml.c

    r13 r14  
    4646/*
    4747 *      Copyright (C) 2000 Ulrich M”ller.
    48  *      This file is part of the XWorkplace source package.
    49  *      XWorkplace is free software; you can redistribute it and/or modify
     48 *      This file is part of the "XWorkplace helpers" source package.
     49 *      This is free software; you can redistribute it and/or modify
    5050 *      it under the terms of the GNU General Public License as published
    5151 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/src/helpers/xprf.c

    r8 r14  
    7575/*
    7676 *      Copyright (C) 2000 Ulrich M”ller.
    77  *      This file is part of the XWorkplace source package.
    78  *      XWorkplace is free software; you can redistribute it and/or modify
     77 *      This file is part of the "XWorkplace helpers" source package.
     78 *      This is free software; you can redistribute it and/or modify
    7979 *      it under the terms of the GNU General Public License as published
    8080 *      by the Free Software Foundation, in version 2 as it comes in the
     
    9191    // as unsigned char
    9292
    93 #define INCL_DOS
    9493#define INCL_DOSERRORS
    9594#define INCL_WINSHELLDATA
     
    113112
    114113/* ******************************************************************
    115  *                                                                  *
    116  *   Declarations                                                   *
    117  *                                                                  *
     114 *
     115 *   Declarations
     116 *
    118117 ********************************************************************/
    119118
     
    143142
    144143/* ******************************************************************
    145  *                                                                  *
    146  *   Helpers                                                        *
    147  *                                                                  *
     144 *
     145 *   Helpers
     146 *
    148147 ********************************************************************/
    149148
     
    352351
    353352/* ******************************************************************
    354  *                                                                  *
    355  *   Read/write data                                                *
    356  *                                                                  *
     353 *
     354 *   Read/write data
     355 *
    357356 ********************************************************************/
    358357
     
    670669
    671670/* ******************************************************************
    672  *                                                                  *
    673  *   API Functions                                                  *
    674  *                                                                  *
     671 *
     672 *   API Functions
     673 *
    675674 ********************************************************************/
    676675
  • trunk/src/helpers/xprf2.c

    r12 r14  
    2222/*
    2323 *      Copyright (C) 2000 Ulrich M”ller.
    24  *      This file is part of the XWorkplace source package.
    25  *      XWorkplace is free software; you can redistribute it and/or modify
     24 *      This file is part of the "XWorkplace helpers" source package.
     25 *      This is free software; you can redistribute it and/or modify
    2626 *      it under the terms of the GNU General Public License as published
    2727 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838    // as unsigned char
    3939
    40 #define INCL_DOS
    4140#define INCL_DOSERRORS
    4241#define INCL_WINSHELLDATA
     
    6160
    6261/* ******************************************************************
    63  *                                                                  *
    64  *   Copy API Functions                                             *
    65  *                                                                  *
     62 *
     63 *   Copy API Functions
     64 *
    6665 ********************************************************************/
    6766
  • trunk/src/helpers/xstring.c

    r13 r14  
    8585/*
    8686 *      Copyright (C) 1999-2000 Ulrich M”ller.
    87  *      This file is part of the XWorkplace source package.
    88  *      XWorkplace is free software; you can redistribute it and/or modify
     87 *      This file is part of the "XWorkplace helpers" source package.
     88 *      This is free software; you can redistribute it and/or modify
    8989 *      it under the terms of the GNU General Public License as published
    9090 *      by the Free Software Foundation, in version 2 as it comes in the
Note: See TracChangeset for help on using the changeset viewer.