Changeset 14
- Timestamp:
- Dec 9, 2000, 8:19:42 PM (25 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 63 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/animate.h
r7 r14 15 15 16 16 /* Copyright (C) 1997-2000 Ulrich Mller. 17 * This file is part of the XWorkplacesource package.18 * XWorkplaceis free software; you can redistribute it and/or modify17 * This file is part of the "XWorkplace helpers" source package. 18 * This is free software; you can redistribute it and/or modify 19 19 * it under the terms of the GNU General Public License as published 20 20 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/cnrh.h
r7 r14 17 17 18 18 /* Copyright (C) 1997-2000 Ulrich Mller. 19 * This file is part of the XWorkplacesource package.20 * XWorkplaceis free software; you can redistribute it and/or modify19 * This file is part of the "XWorkplace helpers" source package. 20 * This is free software; you can redistribute it and/or modify 21 21 * it under the terms of the GNU General Public License as published 22 22 * by the Free Software Foundation, in version 2 as it comes in the … … 40 40 41 41 /* ****************************************************************** 42 * *43 * Details view field infos *44 * *42 * 43 * Details view field infos 44 * 45 45 ********************************************************************/ 46 46 … … 108 108 109 109 /* ****************************************************************** 110 * *111 * Record core management *112 * *110 * 111 * Record core management 112 * 113 113 ********************************************************************/ 114 114 … … 175 175 176 176 /* ****************************************************************** 177 * *178 * CNRINFO management *179 * *177 * 178 * CNRINFO management 179 * 180 180 ********************************************************************/ 181 181 … … 403 403 404 404 /* ****************************************************************** 405 * *406 * View management *407 * *405 * 406 * View management 407 * 408 408 ********************************************************************/ 409 409 … … 472 472 473 473 /* ****************************************************************** 474 * *475 * Record relations/iteration *476 * *474 * 475 * Record relations/iteration 476 * 477 477 ********************************************************************/ 478 478 … … 480 480 PRECORDCORE precc); 481 481 482 typedef ULONG (EXPENTRY FNCBRECC)(HWND, PRECORDCORE, ULONG, ULONG);482 typedef ULONG EXPENTRY FNCBRECC(HWND, PRECORDCORE, ULONG, ULONG); 483 483 typedef FNCBRECC *PFNCBRECC; 484 484 … … 539 539 540 540 /* ****************************************************************** 541 * *542 * Miscellaneous *543 * *541 * 542 * Miscellaneous 543 * 544 544 ********************************************************************/ 545 545 -
trunk/include/helpers/comctl.h
r7 r14 11 11 12 12 /* Copyright (C) 1997-2000 Ulrich Mller. 13 * This file is part of the XWorkplacesource package.14 * XWorkplaceis free software; you can redistribute it and/or modify13 * This file is part of the "XWorkplace helpers" source package. 14 * This is free software; you can redistribute it and/or modify 15 15 * it under the terms of the GNU General Public License as published 16 16 * by the Free Software Foundation, in version 2 as it comes in the … … 40 40 41 41 /* ****************************************************************** 42 * *43 * "Menu button" control *44 * *42 * 43 * "Menu button" control 44 * 45 45 ********************************************************************/ 46 46 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); 50 53 51 54 /* ****************************************************************** 52 * *53 * Progress bars *54 * *55 * 56 * Progress bars 57 * 55 58 ********************************************************************/ 56 59 … … 85 88 86 89 /* ****************************************************************** 87 * *88 * Chart Control *89 * *90 * 91 * Chart Control 92 * 90 93 ********************************************************************/ 91 94 … … 236 239 237 240 /* ****************************************************************** 238 * *239 * Split bars *240 * *241 * 242 * Split bars 243 * 241 244 ********************************************************************/ 242 245 … … 358 361 359 362 /* ****************************************************************** 360 * *361 * Subclassed Static Bitmap Control *362 * *363 * 364 * Subclassed Static Bitmap Control 365 * 363 366 ********************************************************************/ 364 367 … … 424 427 425 428 /* ****************************************************************** 426 * *427 * "Tooltip" control *428 * *429 * 430 * "Tooltip" control 431 * 429 432 ********************************************************************/ 430 433 … … 701 704 702 705 /* ****************************************************************** 703 * *704 * Checkbox container record cores *705 * *706 * 707 * Checkbox container record cores 708 * 706 709 ********************************************************************/ 707 710 … … 777 780 778 781 /* ****************************************************************** 779 * *780 * Hotkey entry field *781 * *782 * 783 * Hotkey entry field 784 * 782 785 ********************************************************************/ 783 786 -
trunk/include/helpers/datetime.h
r7 r14 14 14 15 15 /* Copyright (C) 1997-2000 Ulrich Mller. 16 * This file is part of the XWorkplacesource package.17 * XWorkplaceis free software; you can redistribute it and/or modify16 * This file is part of the "XWorkplace helpers" source package. 17 * This is free software; you can redistribute it and/or modify 18 18 * it under the terms of the GNU General Public License as published 19 19 * by the Free Software Foundation, in version 2 as it comes in the … … 41 41 DATETIME* pdt); 42 42 43 ULONG dtDayOfWeek(ULONG day, 44 ULONG mon, 45 ULONG yr); 46 43 47 int dtIsLeapYear(unsigned yr); 44 48 … … 56 60 unsigned *pday); 57 61 62 BOOL dtIsValidDate(LONG day, 63 LONG month, 64 ULONG year); 58 65 #if __cplusplus 59 66 } -
trunk/include/helpers/debug.h
r7 r14 43 43 44 44 /******************************************************************** 45 * *46 * SYM file declarations *47 * *45 * 46 * SYM file declarations 47 * 48 48 ********************************************************************/ 49 49 … … 135 135 136 136 /******************************************************************** 137 * *138 * EXE declarations taken from exe.h *139 * *137 * 138 * EXE declarations taken from exe.h 139 * 140 140 ********************************************************************/ 141 141 … … 185 185 186 186 /******************************************************************** 187 * *188 * Object Module Format (OMF) declarations *189 * *187 * 188 * Object Module Format (OMF) declarations 189 * 190 190 ********************************************************************/ 191 191 … … 631 631 632 632 /******************************************************************** 633 * *634 * Prototypes *635 * *633 * 634 * Prototypes 635 * 636 636 ********************************************************************/ 637 637 … … 674 674 675 675 /******************************************************************** 676 * *677 * Executable definitions *678 * *676 * 677 * Executable definitions 678 * 679 679 ********************************************************************/ 680 680 -
trunk/include/helpers/dosh.h
r7 r14 17 17 /* This file Copyright (C) 1997-2000 Ulrich Mller, 18 18 * Dmitry A. Steklenev. 19 * This file is part of the XWorkplacesource package.20 * XWorkplaceis free software; you can redistribute it and/or modify19 * This file is part of the "XWorkplace helpers" source package. 20 * This is free software; you can redistribute it and/or modify 21 21 * it under the terms of the GNU General Public License as published 22 22 * by the Free Software Foundation, in version 2 as it comes in the … … 36 36 37 37 /* ****************************************************************** 38 * *39 * Miscellaneous *40 * *38 * 39 * Miscellaneous 40 * 41 41 ********************************************************************/ 42 42 … … 47 47 BOOL doshIsWarp4(VOID); 48 48 49 APIRET doshQueryAvailPhysMem(PULONG pulMem, 50 ULONG ulLogicalSwapDrive); 51 49 52 PSZ doshQuerySysErrorMsg(APIRET arc); 50 53 51 54 /* ****************************************************************** 52 * *53 * Memory helpers *54 * *55 * 56 * Memory helpers 57 * 55 58 ********************************************************************/ 56 59 … … 61 64 62 65 /* ****************************************************************** 63 * *64 * Drive helpers *65 * *66 * 67 * Drive helpers 68 * 66 69 ********************************************************************/ 67 70 … … 74 77 APIRET doshAssertDrive(ULONG ulLogicalDrive); 75 78 76 double doshQueryDiskFree(ULONG ulLogicalDrive); 79 APIRET doshSetLogicalMap(ULONG ulLogicalDrive); 80 81 APIRET doshQueryDiskFree(ULONG ulLogicalDrive, 82 double *pdFree); 77 83 78 84 APIRET doshQueryDiskFSType(ULONG ulLogicalDrive, … … 174 180 175 181 /* ****************************************************************** 176 * *177 * File helpers *178 * *182 * 183 * File helpers 184 * 179 185 ********************************************************************/ 180 186 … … 213 219 214 220 /* ****************************************************************** 215 * *216 * Directory helpers *217 * *221 * 222 * Directory helpers 223 * 218 224 ********************************************************************/ 219 225 … … 236 242 237 243 /* ****************************************************************** 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 * 241 311 ********************************************************************/ 242 312 … … 253 323 254 324 /* ****************************************************************** 255 * *256 * Environment helpers *257 * *325 * 326 * Environment helpers 327 * 258 328 ********************************************************************/ 259 329 … … 291 361 292 362 /* ****************************************************************** 293 * *294 * Module handling helpers *295 * *363 * 364 * Module handling helpers 365 * 296 366 ********************************************************************/ 297 367 … … 316 386 317 387 /******************************************************************** 318 * *319 * Executable helpers *320 * *388 * 389 * Executable helpers 390 * 321 391 ********************************************************************/ 322 392 … … 548 618 549 619 /******************************************************************** 550 * *551 * Partition functions *552 * *620 * 621 * Partition functions 622 * 553 623 ********************************************************************/ 554 624 -
trunk/include/helpers/eah.h
r7 r14 49 49 * This file Copyright (C) 1997-2000 Ulrich Mller, 50 50 * Massachusetts Institute of Technology. 51 * This file is part of the XWorkplacesource package.52 * XWorkplaceis free software; you can redistribute it and/or modify51 * This file is part of the "XWorkplace helpers" source package. 52 * This is free software; you can redistribute it and/or modify 53 53 * it under the terms of the GNU General Public License as published 54 54 * by the Free Software Foundation, in version 2 as it comes in the … … 115 115 116 116 /* ****************************************************************** 117 * *118 * Read-EA functions *119 * *117 * 118 * Read-EA functions 119 * 120 120 ********************************************************************/ 121 121 122 122 ULONG eaHFileQueryTotalSize(HFILE hFile); 123 123 124 ULONG eaPathQueryTotalSize( PSZ path);124 ULONG eaPathQueryTotalSize(const char *pcszPath); 125 125 126 126 PEALIST eaHFileReadAll(HFILE hfile); 127 127 128 PEALIST eaPathReadAll( PSZ path);128 PEALIST eaPathReadAll(const char *pcszPath); 129 129 130 130 PEABINDING eaHFileReadOneByIndex(HFILE hfile, ULONG index); 131 131 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); 137 137 138 138 /* ****************************************************************** 139 * *140 * Write-EA functions *141 * *142 ********************************************************************/ 143 144 voideaHFileWriteAll(HFILE hfile, PEALIST list);145 146 void eaPathWriteAll(PSZ path, PEALIST list);147 148 voideaHFileWriteOne(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); 153 153 154 154 /******************************************************************** 155 * *156 * Translation funcs *157 * *155 * 156 * Translation funcs 157 * 158 158 ********************************************************************/ 159 159 … … 162 162 PSZ eaCreatePSZFromBinding(PEABINDING peab); 163 163 164 PEABINDING eaCreateBindingFromPSZ( PSZ pszEAName,165 PSZ pszString);164 PEABINDING eaCreateBindingFromPSZ(const char *pcszEAName, 165 const char *pcszInput); 166 166 167 167 USHORT eaQueryMVCount(PEABINDING peab, … … 170 170 171 171 PSZ eaQueryMVItem(PEABINDING peab, 172 173 174 175 172 USHORT usIndex, 173 PUSHORT pusEAType, 174 PUSHORT pusCodepage, 175 PUSHORT pusDataLength); 176 176 177 177 PSZ eaCreatePSZFromMVBinding(PEABINDING peab, 178 PSZ pszSeparator,178 const char *pcszSeparator, 179 179 PUSHORT pusCodepage); 180 180 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, 184 184 USHORT usCodepage); 185 185 186 186 /* ****************************************************************** 187 * *188 * Direct plain-string EA handling *189 * *187 * 188 * Direct plain-string EA handling 189 * 190 190 ********************************************************************/ 191 191 -
trunk/include/helpers/except.h
r7 r14 53 53 54 54 /******************************************************************** 55 * *56 * Declarations *57 * *55 * 56 * Declarations 57 * 58 58 ********************************************************************/ 59 60 // forward declaration 61 typedef struct _EXCEPTIONREGISTRATIONRECORD2 *PEXCEPTIONREGISTRATIONRECORD2; 59 62 60 63 // "OnKill" function prototype for EXCEPTIONREGISTRATIONRECORD2 61 64 // 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; 64 68 65 69 /* … … 77 81 PFN pfnHandler; // as in EXCEPTIONREGISTRATIONRECORD 78 82 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; 81 86 82 87 /* … … 110 115 111 116 /******************************************************************** 112 * *113 * Prototypes *114 * *117 * 118 * Prototypes 119 * 115 120 ********************************************************************/ 116 121 … … 133 138 134 139 /******************************************************************** 135 * *136 * Macros *137 * *140 * 141 * Macros 142 * 138 143 ********************************************************************/ 139 144 … … 142 147 #ifdef __NO_EXCEPTION_HANDLERS__ 143 148 // 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) \ 147 152 { \ 148 153 EXCEPTSTRUCT excptstruct = {0}; \ 149 154 excptstruct.RegRec2.pfnHandler = (PFN)excHandlerLoud; \ 150 excptstruct.RegRec2.pfnOnKill = _pfnOnKill; \151 155 excptstruct.arc = DosSetExceptionHandler( \ 152 156 (PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2)); \ … … 159 163 if (excptstruct.ulExcpt == 0) \ 160 164 { 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) \ 168 173 { \ 169 174 EXCEPTSTRUCT excptstruct = {0}; \ 170 175 excptstruct.RegRec2.pfnHandler = (PFN)excHandlerQuiet; \ 171 excptstruct.RegRec2.pfnOnKill = _pfnOnKill; \172 176 excptstruct.arc = DosSetExceptionHandler( \ 173 177 (PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2)); \ … … 180 184 if (excptstruct.ulExcpt == 0) \ 181 185 { 186 182 187 #endif 183 188 … … 192 197 else \ 193 198 { /* exception occured: */ \ 194 DosUnsetExceptionHandler( \ 195 (PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2)); 199 DosUnsetExceptionHandler((PEXCEPTIONREGISTRATIONRECORD)&(excptstruct.RegRec2)); 196 200 #endif 197 201 -
trunk/include/helpers/gpih.h
r7 r14 9 9 * numbering. 10 10 * 11 *@@include #define INCL_GPILOGCOLORTABLE 11 *@@include #define INCL_GPILOGCOLORTABLE // for some funcs 12 12 *@@include #include <os2.h> 13 13 *@@include #include "gpih.h" … … 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 35 35 36 36 /* ****************************************************************** 37 * *38 * Device helpers *39 * *37 * 38 * Device helpers 39 * 40 40 ********************************************************************/ 41 41 … … 43 43 44 44 /* ****************************************************************** 45 * *46 * Color helpers *47 * *45 * 46 * Color helpers 47 * 48 48 ********************************************************************/ 49 49 … … 72 72 BYTE bDivisor); 73 73 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 * 87 91 ********************************************************************/ 88 92 … … 100 104 LONG lColor); 101 105 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; 107 121 108 122 LONG gpihCharStringPosAt(HPS hps, … … 114 128 115 129 /* ****************************************************************** 116 * *117 * Font helpers *118 * *130 * 131 * Font helpers 132 * 119 133 ********************************************************************/ 120 134 … … 144 158 145 159 /* ****************************************************************** 146 * *147 * Bitmap helpers *148 * *160 * 161 * Bitmap helpers 162 * 149 163 ********************************************************************/ 150 164 -
trunk/include/helpers/level.h
r7 r14 10 10 * Copyright (C) 2000 Ulrich Mller. 11 11 * Copyright (C) 1994 Martin Lafaix (EDM/2 2-05). 12 * This file is part of the XWorkplacesource package.13 * XWorkplaceis free software; you can redistribute it and/or modify12 * This file is part of the "XWorkplace helpers" source package. 13 * This is free software; you can redistribute it and/or modify 14 14 * it under the terms of the GNU General Public License as published 15 15 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/linklist.h
r10 r14 13 13 14 14 /* Copyright (C) 1997-2000 Ulrich Mller. 15 * This file is part of the XWorkplacesource package.16 * XWorkplaceis free software; you can redistribute it and/or modify15 * This file is part of the "XWorkplace helpers" source package. 16 * This is free software; you can redistribute it and/or modify 17 17 * it under the terms of the GNU General Public License as published 18 18 * by the Free Software Foundation, in version 2 as it comes in the … … 31 31 #define LINKLIST_HEADER_INCLUDED 32 32 33 #ifndef XWPENTRY 34 #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers. 35 #endif 36 33 37 // define some basic things to make this work even with standard C 34 38 #if (!defined OS2_INCLUDED) && (!defined _OS2_H) && (!defined __SIMPLES_DEFINED) // changed V0.9.0 (99-10-22) [umoeller] … … 92 96 93 97 /* ****************************************************************** 94 * *95 * List base functions *96 * *98 * 99 * List base functions 100 * 97 101 ********************************************************************/ 98 102 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; 100 114 101 115 #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; 106 125 107 126 #define lstCreate(b) lstCreateDebug((b), __FILE__, __LINE__, __FUNCTION__) 108 127 #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; 125 160 126 161 #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); 132 167 #define lstAppendItem(pl, pd) lstAppendItemDebug((pl), (pd), __FILE__, __LINE__, __FUNCTION__) 133 168 #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; 147 193 148 194 /* ****************************************************************** 149 * *150 * List sorting *151 * *195 * 196 * List sorting 197 * 152 198 ********************************************************************/ 153 199 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); 161 207 162 208 #endif -
trunk/include/helpers/memdebug.h
r13 r14 13 13 14 14 /* Copyright (C) 2000 Ulrich Mller. 15 * This file is part of the XWorkplacesource package.16 * XWorkplaceis free software; you can redistribute it and/or modify15 * This file is part of the "XWorkplace helpers" source package. 16 * This is free software; you can redistribute it and/or modify 17 17 * it under the terms of the GNU General Public License as published 18 18 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/prfh.h
r7 r14 19 19 20 20 /* Copyright (C) 1997-2000 Ulrich Mller. 21 * This file is part of the XWorkplacesource package.22 * XWorkplaceis free software; you can redistribute it and/or modify21 * This file is part of the "XWorkplace helpers" source package. 22 * This is free software; you can redistribute it and/or modify 23 23 * it under the terms of the GNU General Public License as published 24 24 * by the Free Software Foundation, in version 2 as it comes in the … … 96 96 cTimeSep, 97 97 // time separator (e.g. ':') 98 cDecimal, 99 // decimal separator (e.g. '.') 98 100 cThousands; 99 101 // thousands separator (e.g. ',') -
trunk/include/helpers/procstat.h
r7 r14 17 17 * This file Copyright (C) 1992-99 Ulrich Mller, 18 18 * Kai Uwe Rommel. 19 * This file is part of the XWorkplacesource package.20 * XWorkplaceis free software; you can redistribute it and/or modify19 * This file is part of the "XWorkplace helpers" source package. 20 * This is free software; you can redistribute it and/or modify 21 21 * it under the terms of the GNU General Public License as published 22 22 * by the Free Software Foundation, in version 2 as it comes in the … … 38 38 39 39 /******************************************************************** 40 * *41 * DosQProcStatus declarations (16-bit) *42 * *40 * 41 * DosQProcStatus declarations (16-bit) 42 * 43 43 ********************************************************************/ 44 44 … … 230 230 231 231 /******************************************************************** 232 * *233 * DosQuerySysState declarations (32-bit) *234 * *232 * 233 * DosQuerySysState declarations (32-bit) 234 * 235 235 ********************************************************************/ 236 236 … … 596 596 597 597 /******************************************************************** 598 * *599 * New procstat.c declarations *600 * *598 * 599 * New procstat.c declarations 600 * 601 601 ********************************************************************/ 602 602 … … 639 639 640 640 /******************************************************************** 641 * *642 * DosQProcStat (16-bit) interface *643 * *641 * 642 * DosQProcStat (16-bit) interface 643 * 644 644 ********************************************************************/ 645 645 … … 655 655 656 656 /******************************************************************** 657 * *658 * DosQProcStat (16-bit) helpers *659 * *657 * 658 * DosQProcStat (16-bit) helpers 659 * 660 660 ********************************************************************/ 661 661 … … 671 671 672 672 /******************************************************************** 673 * *674 * DosQuerySysState (32-bit) interface *675 * *673 * 674 * DosQuerySysState (32-bit) interface 675 * 676 676 ********************************************************************/ 677 677 -
trunk/include/helpers/shapewin.h
r7 r14 18 18 * Akira Hatakeyama, 19 19 * Takayuki Suwa. 20 * This file is part of the XWorkplacesource package.21 * XWorkplaceis free software; you can redistribute it and/or modify20 * This file is part of the "XWorkplace helpers" source package. 21 * This is free software; you can redistribute it and/or modify 22 22 * it under the terms of the GNU General Public License as published 23 23 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/stringh.h
r13 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 70 70 ULONG strhWords(PSZ psz); 71 71 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; 73 75 74 76 PSZ strhThousandsDouble(PSZ pszTarget, double dbl, CHAR cThousands); … … 87 89 CHAR cTimeSep); 88 90 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; 96 106 97 107 #define STRH_BEGIN_CHARS "\x0d\x0a " … … 156 166 157 167 /* ****************************************************************** 158 * *159 * Miscellaneous *160 * *168 * 169 * Miscellaneous 170 * 161 171 ********************************************************************/ 162 172 163 173 VOID strhArrayAppend(PSZ *ppszRoot, 164 PSZ pszNew,174 const char *pcszNew, 165 175 PULONG pcbRoot); 166 176 … … 170 180 171 181 /* ****************************************************************** 172 * *173 * Wildcard matching *174 * *182 * 183 * Wildcard matching 184 * 175 185 ********************************************************************/ 176 186 … … 195 205 196 206 /* ****************************************************************** 197 * *198 * Fast string searches *199 * *207 * 208 * Fast string searches 209 * 200 210 ********************************************************************/ 201 211 -
trunk/include/helpers/syssound.h
r7 r14 15 15 16 16 /* Copyright (C) 1999-2000 Ulrich Mller. 17 * This file is part of the XWorkplacesource package.18 * XWorkplaceis free software; you can redistribute it and/or modify17 * This file is part of the "XWorkplace helpers" source package. 18 * This is free software; you can redistribute it and/or modify 19 19 * it under the terms of the GNU General Public License as published 20 20 * by the Free Software Foundation, in version 2 as it comes in the … … 35 35 36 36 /******************************************************************** 37 * *38 * Declarations *39 * *37 * 38 * Declarations 39 * 40 40 ********************************************************************/ 41 41 … … 63 63 64 64 /******************************************************************** 65 * *66 * Function prototypes *67 * *65 * 66 * Function prototypes 67 * 68 68 ********************************************************************/ 69 69 -
trunk/include/helpers/textv_html.h
r7 r14 9 9 10 10 /* Copyright (C) 2000 Ulrich Mller. 11 * This file is part of the XWorkplacesource package.12 * XWorkplaceis free software; you can redistribute it and/or modify11 * This file is part of the "XWorkplace helpers" source package. 12 * This is free software; you can redistribute it and/or modify 13 13 * it under the terms of the GNU General Public License as published 14 14 * by the Free Software Foundation, in version 2 as it comes in the … … 32 32 33 33 /* ****************************************************************** 34 * *35 * HTML converter *36 * *34 * 35 * HTML converter 36 * 37 37 ********************************************************************/ 38 38 -
trunk/include/helpers/textview.h
r12 r14 9 9 10 10 /* Copyright (C) 2000 Ulrich Mller. 11 * This file is part of the XWorkplacesource package.12 * XWorkplaceis free software; you can redistribute it and/or modify11 * This file is part of the "XWorkplace helpers" source package. 12 * This is free software; you can redistribute it and/or modify 13 13 * it under the terms of the GNU General Public License as published 14 14 * by the Free Software Foundation, in version 2 as it comes in the … … 34 34 35 35 /* ****************************************************************** 36 * *37 * Escape sequences *38 * *36 * 37 * Escape sequences 38 * 39 39 ********************************************************************/ 40 40 … … 151 151 152 152 /* ****************************************************************** 153 * *154 * Device-independent functions *155 * *153 * 154 * Device-independent functions 155 * 156 156 ********************************************************************/ 157 157 … … 380 380 381 381 /* ****************************************************************** 382 * *383 * Window-dependent functions *384 * *382 * 383 * Window-dependent functions 384 * 385 385 ********************************************************************/ 386 386 … … 474 474 475 475 /* ****************************************************************** 476 * *477 * Printer-dependent functions *478 * *476 * 477 * Printer-dependent functions 478 * 479 479 ********************************************************************/ 480 480 -
trunk/include/helpers/threads.h
r7 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/tree.h
r13 r14 12 12 * Copyright (C) 1991-99 iMatix Corporation. 13 13 * Copyright (C) 2000 Ulrich Mller. 14 * This file is part of the XWorkplacesource package.15 * XWorkplaceis free software; you can redistribute it and/or modify14 * This file is part of the "XWorkplace helpers" source package. 15 * This is free software; you can redistribute it and/or modify 16 16 * it under the terms of the GNU General Public License as published 17 17 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/undoc.h
r7 r14 15 15 16 16 /* Copyright (C) 1997-2000 Ulrich Mller. 17 * This file is part of the XWorkplacesource package.18 * XWorkplaceis free software; you can redistribute it and/or modify17 * This file is part of the "XWorkplace helpers" source package. 18 * This is free software; you can redistribute it and/or modify 19 19 * it under the terms of the GNU General Public License as published 20 20 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/include/helpers/winh.h
r7 r14 11 11 12 12 /* Copyright (C) 1997-2000 Ulrich Mller. 13 * This file is part of the XWorkplacesource package.14 * XWorkplaceis free software; you can redistribute it and/or modify13 * This file is part of the "XWorkplace helpers" source package. 14 * This is free software; you can redistribute it and/or modify 15 15 * it under the terms of the GNU General Public License as published 16 16 * by the Free Software Foundation, in version 2 as it comes in the … … 34 34 *@@include #define INCL_WINSYS 35 35 *@@include #define INCL_WINSHELLDATA 36 *@@include #define INCL_WINSWITCHLIST // for winhQuerySwitchList 36 37 *@@include #define INCL_WINPROGRAMLIST // for winhStartApp 37 38 *@@include #define INCL_WINHELP // for help manager helpers … … 47 48 #define WINH_HEADER_INCLUDED 48 49 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 * 53 58 ********************************************************************/ 54 59 … … 62 67 63 68 /* ****************************************************************** 64 * *65 * Macros *66 * *69 * 70 * Macros 71 * 67 72 ********************************************************************/ 68 73 … … 101 106 102 107 /* ****************************************************************** 103 * *104 * Menu helpers *105 * *108 * 109 * Menu helpers 110 * 106 111 ********************************************************************/ 107 112 … … 121 126 HWND_DESKTOP, HWND_TOP, 0, 0, 0) 122 127 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); 139 144 140 145 /* … … 165 170 (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0) 166 171 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); 200 203 201 204 /* … … 230 233 0)) 231 234 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 * 263 266 ********************************************************************/ 264 267 … … 302 305 303 306 /* ****************************************************************** 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: 311 356 * returns the no. of items in the listbox 312 357 * as a SHORT. 313 358 * 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 319 366 320 367 /* … … 349 396 * 350 397 * 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. 351 401 */ 352 402 … … 375 425 (MPARAM)(fSelect))) 376 426 377 ULONG winhLboxSelectAll(HWND hwndListBox, 378 BOOL fSelect); 427 ULONG XWPENTRY winhLboxSelectAll(HWND hwndListBox, BOOL fSelect); 379 428 380 429 /* … … 398 447 MPFROMSHORT(sItemIndex), (MPARAM)NULL) 399 448 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); 454 495 455 496 #define XAC_MOVEX 0x0001 … … 470 511 } XADJUSTCTRLS, *PXADJUSTCTRLS; 471 512 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; 490 538 491 539 /* … … 502 550 (winhSetWindowFont(WinWindowFromID(hwnd, usId), pszFont)) 503 551 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); 508 553 509 554 #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); 514 559 #endif 515 560 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 * 525 569 ********************************************************************/ 526 570 527 571 #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); 536 579 #endif 537 580 … … 543 586 544 587 #ifdef INCL_WINPROGRAMLIST 545 HAPP winhStartApp(HWND hwndNotify, 546 const PROGDETAILS *pcProgDetails); 588 HAPP XWPENTRY winhStartApp(HWND hwndNotify, const PROGDETAILS *pcProgDetails); 547 589 #endif 548 590 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); 563 606 564 607 #define WINH_FOD_SAVEDLG 0x0001 … … 566 609 #define WINH_FOD_INISAVEDIR 0x0020 567 610 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); 578 621 579 622 /* … … 585 628 #define winhQueryDlgItemText(hwnd, usItemID) winhQueryWindowText(WinWindowFromID(hwnd, usItemID)) 586 629 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, 592 635 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); 610 656 611 657 /* … … 626 672 (PSZ)"", 0, 0,0,0,0, 0, HWND_BOTTOM, 0, pvCreateParam, NULL) 627 673 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, 640 683 USHORT usIdThreshold, 641 684 ULONG ulDownUnits); 642 685 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); 650 703 651 704 /* … … 664 717 665 718 /* ****************************************************************** 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); 684 736 #endif 685 737 -
trunk/include/helpers/wphandle.h
r7 r14 21 21 /* This file Copyright (C) 1997-2000 Ulrich Mller, 22 22 * Henk Kelder. 23 * This file is part of the XWorkplacesource package.24 * XWorkplaceis free software; you can redistribute it and/or modify23 * This file is part of the "XWorkplace helpers" source package. 24 * This is free software; you can redistribute it and/or modify 25 25 * it under the terms of the GNU General Public License as published by 26 26 * the Free Software Foundation, in version 2 as it comes in the COPYING -
trunk/include/helpers/xprf.h
r7 r14 15 15 16 16 /* Copyright (C) 2000 Ulrich Mller. 17 * This file is part of the XWorkplacesource package.18 * XWorkplaceis free software; you can redistribute it and/or modify17 * This file is part of the "XWorkplace helpers" source package. 18 * This is free software; you can redistribute it and/or modify 19 19 * it under the terms of the GNU General Public License as published 20 20 * by the Free Software Foundation, in version 2 as it comes in the … … 34 34 35 35 /* ****************************************************************** 36 * *37 * OS/2 INI file layout *38 * *36 * 37 * OS/2 INI file layout 38 * 39 39 ********************************************************************/ 40 40 … … 130 130 131 131 /* ****************************************************************** 132 * *133 * API Functions *134 * *132 * 133 * API Functions 134 * 135 135 ********************************************************************/ 136 136 … … 183 183 184 184 /* ****************************************************************** 185 * *186 * Copy API Functions *187 * *185 * 186 * Copy API Functions 187 * 188 188 ********************************************************************/ 189 189 -
trunk/include/helpers/xstring.h
r13 r14 14 14 /* 15 15 * Copyright (C) 1999-2000 Ulrich Mller. 16 * This file is part of the XWorkplacesource package.17 * XWorkplaceis free software; you can redistribute it and/or modify16 * This file is part of the "XWorkplace helpers" source package. 17 * This is free software; you can redistribute it and/or modify 18 18 * it under the terms of the GNU General Public License as published 19 19 * by the Free Software Foundation, in version 2 as it comes in the … … 32 32 #define XSTRING_HEADER_INCLUDED 33 33 34 #ifndef XWPENTRY 35 #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers. 36 #endif 37 34 38 /* 35 39 *@@ XSTRING: … … 46 50 } XSTRING, *PXSTRING; 47 51 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; 50 55 51 void xstrInitSet(PXSTRING pxstr, 52 PSZ pszNew); 56 void XWPENTRY xstrInitSet(PXSTRING pxstr, PSZ pszNew); 53 57 54 void xstrInitCopy(PXSTRING pxstr, 55 const char *pcszSource); 58 void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource); 56 59 57 void xstrClear(PXSTRING pxstr); 60 void XWPENTRY xstrClear(PXSTRING pxstr); 61 typedef void XWPENTRY XSTRCLEAR(PXSTRING pxstr); 62 typedef XSTRCLEAR *PXSTRCLEAR; 58 63 59 PXSTRING xstrCreate(ULONG ulPreAllocate);64 PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate); 60 65 61 VOID xstrFree(PXSTRING pxstr);66 VOID XWPENTRY xstrFree(PXSTRING pxstr); 62 67 63 ULONG xstrset(PXSTRING pxstr, 64 PSZ pszNew); 68 ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew); 65 69 66 ULONG xstrcpy(PXSTRING pxstr, 67 const char *pcszSource); 70 ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource); 68 71 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; 71 75 72 76 /* … … 79 83 #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) ) 80 84 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); 88 92 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); 95 99 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); 100 104 #endif 101 105 -
trunk/src/helpers/animate.c
r8 r14 22 22 /* 23 23 * Copyright (C) 1997-2000 Ulrich Mller. 24 * This file is part of the XWorkplacesource package.25 * XWorkplaceis free software; you can redistribute it and/or modify24 * This file is part of the "XWorkplace helpers" source package. 25 * This is free software; you can redistribute it and/or modify 26 26 * it under the terms of the GNU General Public License as published 27 27 * by the Free Software Foundation, in version 2 as it comes in the … … 38 38 // as unsigned char 39 39 40 #define INCL_DOS 41 #define INCL_DOSERRORS 40 #define INCL_DOSPROCESS 42 41 #define INCL_DOSDEVICES 43 42 #define INCL_DOSDEVIOCTL 44 45 #define INCL_WIN 43 #define INCL_DOSERRORS 44 45 #define INCL_WINPOINTERS 46 46 #define INCL_WINSYS 47 47 … … 164 164 165 165 /* ****************************************************************** 166 * *167 * Other animations *168 * *166 * 167 * Other animations 168 * 169 169 ********************************************************************/ 170 170 -
trunk/src/helpers/cctl_chart.c
r8 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 84 84 85 85 /* ****************************************************************** 86 * *87 * Chart Control *88 * *86 * 87 * Chart Control 88 * 89 89 ********************************************************************/ 90 90 -
trunk/src/helpers/cctl_checkcnr.c
r8 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 84 84 85 85 /* ****************************************************************** 86 * *87 * Global variables *88 * *86 * 87 * Global variables 88 * 89 89 ********************************************************************/ 90 90 … … 94 94 95 95 /* ****************************************************************** 96 * *97 * Checkbox container record cores *98 * *96 * 97 * Checkbox container record cores 98 * 99 99 ********************************************************************/ 100 100 -
trunk/src/helpers/cctl_progbar.c
r13 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 84 84 85 85 /* ****************************************************************** 86 * *87 * Progress bars *88 * *86 * 87 * Progress bars 88 * 89 89 ********************************************************************/ 90 90 -
trunk/src/helpers/cctl_splitwin.c
r8 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 84 84 85 85 /* ****************************************************************** 86 * *87 * Split windows *88 * *86 * 87 * Split windows 88 * 89 89 ********************************************************************/ 90 90 -
trunk/src/helpers/cctl_tooltip.c
r8 r14 16 16 /* 17 17 * Copyright (C) 1997-2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 84 84 85 85 /* ****************************************************************** 86 * *87 * Global variables *88 * *86 * 87 * Global variables 88 * 89 89 ********************************************************************/ 90 90 … … 98 98 99 99 /* ****************************************************************** 100 * *101 * "Tooltip" control *102 * *100 * 101 * "Tooltip" control 102 * 103 103 ********************************************************************/ 104 104 … … 724 724 PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1); 725 725 726 TRY_LOUD(excpt1 , NULL)726 TRY_LOUD(excpt1) 727 727 { 728 728 switch (msg) -
trunk/src/helpers/cnrh.c
r8 r14 22 22 /* 23 23 * Copyright (C) 1997-2000 Ulrich Mller. 24 * This file is part of the XWorkplacesource package.25 * XWorkplaceis free software; you can redistribute it and/or modify24 * This file is part of the "XWorkplace helpers" source package. 25 * This is free software; you can redistribute it and/or modify 26 26 * it under the terms of the GNU General Public License as published 27 27 * by the Free Software Foundation, in version 2 as it comes in the … … 38 38 // as unsigned char 39 39 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 41 49 #define INCL_GPILOGCOLORTABLE 42 50 #define INCL_GPIPRIMITIVES … … 59 67 60 68 /* ****************************************************************** 61 * *62 * Details view field infos *63 * *69 * 70 * Details view field infos 71 * 64 72 ********************************************************************/ 65 73 … … 338 346 339 347 /* ****************************************************************** 340 * *341 * Record core management *342 * *348 * 349 * Record core management 350 * 343 351 ********************************************************************/ 344 352 … … 353 361 * by following the RECORDCORE.preccNextRecord pointers 354 362 * (i.e. we have a linked list here). 363 * 364 * Returns NULL on errors (what CM_ALLOCRECORD returns). 355 365 * 356 366 * The record cores returned by the container are … … 735 745 736 746 /* ****************************************************************** 737 * *738 * View management *739 * *747 * 748 * View management 749 * 740 750 ********************************************************************/ 741 751 … … 1119 1129 // convert this to screen coordinates 1120 1130 WinMapWindowPoints(hwndCnr, 1121 HWND_DESKTOP,1122 &ptl,1123 1);1131 HWND_DESKTOP, 1132 &ptl, 1133 1); 1124 1134 fQueried = TRUE; 1125 1135 } … … 1303 1313 1304 1314 /* ****************************************************************** 1305 * *1306 * Record relations/iteration *1307 * *1315 * 1316 * Record relations/iteration 1317 * 1308 1318 ********************************************************************/ 1309 1319 … … 1580 1590 1581 1591 /* ****************************************************************** 1582 * *1583 * Miscellaneous *1584 * *1592 * 1593 * Miscellaneous 1594 * 1585 1595 ********************************************************************/ 1586 1596 -
trunk/src/helpers/comctl.c
r8 r14 53 53 /* 54 54 * Copyright (C) 1997-2000 Ulrich Mller. 55 * This file is part of the XWorkplacesource package.56 * XWorkplaceis free software; you can redistribute it and/or modify55 * This file is part of the "XWorkplace helpers" source package. 56 * This is free software; you can redistribute it and/or modify 57 57 * it under the terms of the GNU General Public License as published 58 58 * by the Free Software Foundation, in version 2 as it comes in the … … 117 117 118 118 /* ****************************************************************** 119 * *120 * Global variables *121 * *119 * 120 * Global variables 121 * 122 122 ********************************************************************/ 123 123 … … 127 127 128 128 /* ****************************************************************** 129 * *130 * "Menu button" control *131 * *129 * 130 * "Menu button" control 131 * 132 132 ********************************************************************/ 133 133 … … 149 149 HWND hwndMenu; 150 150 } 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 159 VOID 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 } 151 189 152 190 /* … … 288 326 // menu successfully loaded: 289 327 // 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); 316 330 } // end if (pmbd->hwndMenu) 317 331 else … … 484 498 485 499 /* ****************************************************************** 486 * *487 * Subclassed Static Bitmap Control *488 * *500 * 501 * Subclassed Static Bitmap Control 502 * 489 503 ********************************************************************/ 490 504 … … 788 802 789 803 /* ****************************************************************** 790 * *791 * Icon animation *792 * *804 * 805 * Icon animation 806 * 793 807 ********************************************************************/ 794 808 … … 967 981 968 982 /* ****************************************************************** 969 * *970 * Bitmap functions *971 * *983 * 984 * Bitmap functions 985 * 972 986 ********************************************************************/ 973 987 … … 1050 1064 1051 1065 /* ****************************************************************** 1052 * *1053 * Hotkey entry field *1054 * *1066 * 1067 * Hotkey entry field 1068 * 1055 1069 ********************************************************************/ 1056 1070 -
trunk/src/helpers/datetime.c
r8 r14 25 25 /* 26 26 * This file Copyright (C) 1997-2000 Ulrich Mller. 27 * This file is part of the XWorkplacesource package.28 * XWorkplaceis free software; you can redistribute it and/or modify27 * This file is part of the "XWorkplace helpers" source package. 28 * This is free software; you can redistribute it and/or modify 29 29 * it under the terms of the GNU General Public License as published 30 30 * by the Free Software Foundation, in version 2 as it comes in the … … 63 63 const char *pcszFormatTimestamp = "%4u%02u%02u%02u%02u%02u%"; 64 64 65 ULONG G_ulDateScalarFirstCalled = 0; 66 65 67 /* 66 68 *@@ dtGetULongTime: … … 71 73 * time in milliseconds. 72 74 * 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 75 91 */ 76 92 … … 78 94 { 79 95 DATETIME dt; 96 ULONG ulTime, 97 ulDateScalarPassed = 1; 80 98 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); 82 120 } 83 121 … … 147 185 148 186 /* 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 206 ULONG 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 /* 149 230 *@@ dtIsLeapYear: 150 231 * returns TRUE if yr is a leap year. … … 164 245 /* 165 246 *@@ 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. 167 262 * 168 263 * (c) Ray Gardner. … … 171 266 unsigned dtMonths2Days(unsigned month) 172 267 { 173 return (month * 3057 - 3007) / 100;268 return (month * 3057 - 3007) / 100; 174 269 } 175 270 … … 228 323 *pyr = n; 229 324 n = (unsigned)(scalar - dtYears2Days(n-1)); 230 if ( n > 59 ) { /* adjust if past February */ 325 if ( n > 59 ) /* adjust if past February */ 326 { 231 327 n += 2; 232 328 if ( dtIsLeapYear(*pyr) ) … … 237 333 } 238 334 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 342 BOOL 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 34 34 * John Currier, 35 35 * Anthony Cruise. 36 * This file is part of the XWorkplacesource package.37 * XWorkplaceis free software; you can redistribute it and/or modify36 * This file is part of the "XWorkplace helpers" source package. 37 * This is free software; you can redistribute it and/or modify 38 38 * it under the terms of the GNU General Public License as published 39 39 * by the Free Software Foundation, in version 2 as it comes in the … … 50 50 // as unsigned char 51 51 52 #define INCL_BASE 52 #define INCL_DOSPROCESS 53 #define INCL_DOSMODULEMGR 54 #define INCL_DOSMISC 55 #define INCL_DOSERRORS 53 56 #include <os2.h> 54 57 … … 88 91 89 92 /* ****************************************************************** 90 * *91 * Global variables *92 * *93 * 94 * Global variables 95 * 93 96 ********************************************************************/ 94 97 … … 353 356 354 357 /* ****************************************************************** 355 * *356 * PART 1: ANALYZE DEBUG CODE *357 * *358 * 359 * PART 1: ANALYZE DEBUG CODE 360 * 358 361 ********************************************************************/ 359 362 … … 1129 1132 1130 1133 /* ****************************************************************** 1131 * *1132 * PART 2: ANALYZE VARIABLES *1133 * *1134 * 1135 * PART 2: ANALYZE VARIABLES 1136 * 1134 1137 ********************************************************************/ 1135 1138 … … 1421 1424 1422 1425 /* ****************************************************************** 1423 * *1424 * PART 3: ANALYZE SYMBOL (.SYM) FILE *1425 * *1426 * 1427 * PART 3: ANALYZE SYMBOL (.SYM) FILE 1428 * 1426 1429 ********************************************************************/ 1427 1430 … … 1566 1569 1567 1570 /* ****************************************************************** 1568 * *1569 * PART 4: dbgPrintStack *1570 * *1571 * 1572 * PART 4: dbgPrintStack 1573 * 1571 1574 ********************************************************************/ 1572 1575 -
trunk/src/helpers/dosh.c
r13 r14 31 31 /* 32 32 * This file Copyright (C) 1997-2000 Ulrich Mller. 33 * This file is part of the XWorkplacesource package.34 * XWorkplaceis free software; you can redistribute it and/or modify33 * This file is part of the "XWorkplace helpers" source package. 34 * This is free software; you can redistribute it and/or modify 35 35 * it under the terms of the GNU General Public License as published 36 36 * by the Free Software Foundation, in version 2 as it comes in the … … 47 47 // as unsigned char 48 48 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 50 55 #define INCL_DOSDEVIOCTL 51 56 #define INCL_DOSERRORS 57 52 58 #define INCL_KBD 53 59 #include <os2.h> 60 54 61 #include <stdlib.h> 55 62 #include <string.h> 56 63 #include <stdio.h> 57 // #include <ctype.h>58 64 59 65 #include "setup.h" // code generation and debugging options … … 70 76 71 77 /* ****************************************************************** 72 * *73 * Miscellaneous *74 * *78 * 79 * Miscellaneous 80 * 75 81 ********************************************************************/ 76 82 … … 172 178 173 179 return (s_brc); 180 } 181 182 /* 183 *@@ doshQueryAvailPhysMem: 184 * returns the amount of physical memory which 185 * is presently available (before the swapper 186 * would have to be expanded). 187 * 188 * This number is calculated by getting the 189 * total available memory (QSV_TOTRESMEM) 190 * and subtracting the free space on the 191 * drive with the swap file from it. 192 * 193 * As a result, you also need to specify 194 * the logical drive on which the swapper 195 * resides (3 = C, 4 = D, and so on). 196 * 197 *@@added V0.9.7 (2000-12-01) [umoeller] 198 */ 199 200 APIRET doshQueryAvailPhysMem(PULONG pulMem, 201 ULONG ulLogicalSwapDrive) 202 { 203 APIRET arc = DosQuerySysInfo(QSV_TOTAVAILMEM, 204 QSV_TOTAVAILMEM, 205 pulMem, 206 sizeof(*pulMem)); 207 if (arc == NO_ERROR) 208 { 209 double dFree = 0; 210 arc = doshQueryDiskFree(ulLogicalSwapDrive, 211 &dFree); 212 *pulMem -= (ULONG)dFree; 213 } 214 215 return (arc); 174 216 } 175 217 … … 213 255 214 256 /* ****************************************************************** 215 * *216 * Memory helpers *217 * *257 * 258 * Memory helpers 259 * 218 260 ********************************************************************/ 219 261 … … 283 325 284 326 /* ****************************************************************** 285 * *286 * Drive helpers *287 * *327 * 328 * Drive helpers 329 * 288 330 ********************************************************************/ 289 331 … … 417 459 { 418 460 ULONG ulBootDrive; 419 DosQuerySysInfo(5, 5, &ulBootDrive, sizeof(ulBootDrive)); 461 DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, 462 &ulBootDrive, 463 sizeof(ulBootDrive)); 420 464 return (G_acDriveLetters[ulBootDrive]); 421 465 } … … 461 505 OPEN_FLAGS_DASD 462 506 | OPEN_FLAGS_FAIL_ON_ERROR 507 | OPEN_FLAGS_NOINHERIT // V0.9.6 (2000-11-25) [pr] 463 508 | OPEN_ACCESS_READONLY 464 509 | OPEN_SHARE_DENYNONE, … … 523 568 524 569 /* 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 579 APIRET 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 ¶m, paramsize, ¶msize, 613 &data, datasize, &datasize); 614 DosClose(fd); 615 } 616 617 return(rc); 618 } 619 620 /* 525 621 *@@ doshQueryDiskFree: 526 622 * 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. 528 624 * 529 625 * Note: This returns a "double" value, because a ULONG … … 532 628 * 533 629 *@@changed V0.9.0 [umoeller]: fixed another > 4 GB bug (thanks to Rdiger 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 633 APIRET doshQueryDiskFree(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ... 634 double *pdFree) 635 { 636 APIRET arc = NO_ERROR; 538 637 FSALLOCATE fsa; 539 638 double dbl = -1; 540 639 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); 545 643 // ^ fixed V0.9.0 546 644 547 return ( dbl);645 return (arc); 548 646 } 549 647 … … 779 877 780 878 /* ****************************************************************** 781 * *782 * File helpers *783 * *879 * 880 * File helpers 881 * 784 882 ********************************************************************/ 785 883 … … 1226 1324 1227 1325 /* ****************************************************************** 1228 * *1229 * Directory helpers *1230 * *1326 * 1327 * Directory helpers 1328 * 1231 1329 ********************************************************************/ 1232 1330 … … 1459 1557 1460 1558 /* 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 1621 APIRET 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 1737 APIRET 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 1791 APIRET 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 /* 1461 1820 *@@category: Helpers\Control program helpers\Process management 1462 1821 */ 1463 1822 1464 1823 /* ****************************************************************** 1465 * *1466 * Process helpers *1467 * *1824 * 1825 * Process helpers 1826 * 1468 1827 ********************************************************************/ 1469 1828 -
trunk/src/helpers/dosh2.c
r8 r14 30 30 * This file Copyright (C) 1997-2000 Ulrich Mller, 31 31 * Dmitry A. Steklenev. 32 * This file is part of the XWorkplacesource package.33 * XWorkplaceis free software; you can redistribute it and/or modify32 * This file is part of the "XWorkplace helpers" source package. 33 * This is free software; you can redistribute it and/or modify 34 34 * it under the terms of the GNU General Public License as published 35 35 * by the Free Software Foundation, in version 2 as it comes in the … … 46 46 // as unsigned char 47 47 48 #define INCL_DOSMODULEMGR 49 #define INCL_DOSPROCESS 50 #define INCL_DOSSESMGR 51 #define INCL_DOSQUEUES 52 #define INCL_DOSMISC 53 #define INCL_DOSDEVICES 48 54 #define INCL_DOSDEVIOCTL 49 #define INCL_DOS50 55 #define INCL_DOSERRORS 51 // #define INCL_GPI52 56 #include <os2.h> 57 53 58 #include <stdlib.h> 54 59 #include <string.h> … … 68 73 69 74 /* ****************************************************************** 70 * *71 * Miscellaneous *72 * *75 * 76 * Miscellaneous 77 * 73 78 ********************************************************************/ 74 79 … … 109 114 BOOL fFullyQualified) // in: if TRUE, pcszFile must be fully q'fied 110 115 { 116 APIRET arc = NO_ERROR; 111 117 CHAR szPath[CCHMAXPATH+4] = " :"; 112 118 CHAR szComponent[CCHMAXPATH]; … … 120 126 || (*(pcszFile + 2) != '\\') 121 127 ) 122 return (ERROR_CURRENT_DIRECTORY);128 arc = ERROR_CURRENT_DIRECTORY; 123 129 } 124 130 … … 127 133 { 128 134 CHAR cDrive = toupper(*pcszFile); 135 double d; 129 136 // drive specified: 130 137 strcpy(szPath, pcszFile); 131 138 szPath[0] = toupper(*pcszFile); 132 if (doshQueryDiskFree(cDrive - 'A' + 1) == -1) 133 return (ERROR_INVALID_DRIVE); 139 arc = doshQueryDiskFree(cDrive - 'A' + 1, &d); 134 140 } 135 141 else … … 138 144 ULONG ulDriveNum = 0, 139 145 ulDriveMap = 0; 140 DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);146 arc = DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); 141 147 szPath[0] = ((UCHAR)ulDriveNum) + 'A' - 1; 142 148 szPath[1] = ':'; … … 144 150 } 145 151 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) 178 173 { 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 179 217 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) 187 220 return (ERROR_FILENAME_EXCED_RANGE); 188 }189 }190 // and check for invalid characters191 if (strchr(pszInvalid, *pSource) != NULL)192 return (ERROR_INVALID_NAME);193 194 pSource++;195 196 // on FAT, allow only three chars after dot197 if (fIsFAT)198 if (lAfterDot != -1)199 {200 lAfterDot++;201 if (lAfterDot > 3)202 return(ERROR_FILENAME_EXCED_RANGE);203 }204 221 } 205 222 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); 220 229 } 221 230 … … 340 349 341 350 /* ****************************************************************** 342 * *343 * Environment helpers *344 * *351 * 352 * Environment helpers 353 * 345 354 ********************************************************************/ 346 355 … … 716 725 717 726 /* ****************************************************************** 718 * *719 * Module handling helpers *720 * *727 * 728 * Module handling helpers 729 * 721 730 ********************************************************************/ 722 731 … … 773 782 774 783 /******************************************************************** 775 * *776 * Executable functions *777 * *784 * 785 * Executable functions 786 * 778 787 ********************************************************************/ 779 788 … … 1219 1228 1220 1229 /******************************************************************** 1221 * *1222 * Partition functions *1223 * *1230 * 1231 * Partition functions 1232 * 1224 1233 ********************************************************************/ 1225 1234 -
trunk/src/helpers/eah.c
r8 r14 67 67 * Copyright (C) 1995 Massachusetts Institute of Technology. 68 68 * Copyright (C) 1997-2000 Ulrich Mller. 69 * This file is part of the XWorkplacesource package.70 * XWorkplaceis free software; you can redistribute it and/or modify69 * This file is part of the "XWorkplace helpers" source package. 70 * This is free software; you can redistribute it and/or modify 71 71 * it under the terms of the GNU General Public License as published 72 72 * by the Free Software Foundation, in version 2 as it comes in the … … 83 83 // as unsigned char 84 84 85 #define INCL_DOS 85 #define INCL_DOSFILEMGR 86 86 #define INCL_DOSERRORS 87 87 #include <os2.h> … … 101 101 102 102 /******************************************************************** 103 * *104 * Extended Attribute handling *105 * *103 * 104 * Extended Attribute handling 105 * 106 106 ********************************************************************/ 107 107 … … 173 173 174 174 /* ****************************************************************** 175 * *176 * Read-EA functions *177 * *175 * 176 * Read-EA functions 177 * 178 178 ********************************************************************/ 179 179 … … 196 196 */ 197 197 198 ULONG eaPathQueryTotalSize( PSZ pszPath)198 ULONG eaPathQueryTotalSize(const char *pcszPath) 199 199 { 200 200 APIRET arc; … … 202 202 FILEFINDBUF4 ffb4; 203 203 204 _Pmpf(("eaPathQueryTotalSize %s", pszPath)); 205 206 arc = DosQueryPathInfo(pszPath, 204 arc = DosQueryPathInfo((PSZ)pcszPath, 207 205 FIL_QUERYEASIZE, 208 206 &ffb4, … … 220 218 221 219 arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH, 222 pszPath,220 (PSZ)pcszPath, 223 221 1, 224 222 abBuf, … … 230 228 pdena2 = (PDENA2)abBuf; 231 229 232 _Pmpf((" %s: arc = %d, count = %d", pszPath, arc, lCount));233 234 230 if (lCount > 0) 235 231 { … … 247 243 } 248 244 249 _Pmpf((" %s: total %d", pszPath, ulTotalEASize));250 251 245 return (ulTotalEASize); 252 246 } … … 259 253 */ 260 254 261 PEALIST eaPathReadAll( PSZ path)262 { 263 return (ReadEAList(ENUMEA_REFTYPE_PATH, path));255 PEALIST eaPathReadAll(const char *pcszPath) 256 { 257 return (ReadEAList(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath)); 264 258 } 265 259 … … 283 277 */ 284 278 285 PEABINDING eaPathReadOneByIndex( PSZ path, ULONG index)286 { 287 return (ReadEAByIndex(ENUMEA_REFTYPE_PATH, path, index));279 PEABINDING eaPathReadOneByIndex(const char *pcszPath, ULONG index) 280 { 281 return (ReadEAByIndex(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, index)); 288 282 } 289 283 … … 305 299 */ 306 300 307 PEABINDING eaPathReadOneByName( PSZ path, PSZ name)308 { 309 return (ReadEAByName(ENUMEA_REFTYPE_PATH, path, name));301 PEABINDING eaPathReadOneByName(const char *pcszPath, const char *pcszEAName) 302 { 303 return (ReadEAByName(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, (PSZ)pcszEAName)); 310 304 } 311 305 … … 315 309 */ 316 310 317 PEABINDING eaHFileReadOneByName(HFILE hfile, PSZ name)318 { 319 return (ReadEAByName(ENUMEA_REFTYPE_FHANDLE, (&hfile), name));311 PEABINDING eaHFileReadOneByName(HFILE hfile, const char *pcszEAName) 312 { 313 return (ReadEAByName(ENUMEA_REFTYPE_FHANDLE, (&hfile), (PSZ)pcszEAName)); 320 314 } 321 315 322 316 /* ****************************************************************** 323 * *324 * Write-EA functions *325 * *317 * 318 * Write-EA functions 319 * 326 320 ********************************************************************/ 327 321 … … 335 329 * field is 0; only in that case, the EABINDING.value 336 330 * 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 335 APIRET eaPathWriteAll(const char *pcszPath, PEALIST list) 336 { 337 return (WriteEAList(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, list)); 342 338 } 343 339 … … 345 341 *@@ eaHFileWriteAll: 346 342 * 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 347 APIRET eaHFileWriteAll(HFILE hfile, PEALIST list) 348 { 349 return (WriteEAList(ENUMEA_REFTYPE_FHANDLE, (&hfile), list)); 352 350 } 353 351 … … 362 360 * 363 361 * 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 366 APIRET eaPathWriteOne(const char *pcszPath, PEABINDING peab) 367 { 368 return (WriteEA(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, peab)); 369 369 } 370 370 … … 372 372 *@@ eaHFileWriteOne: 373 373 * 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 378 APIRET eaHFileWriteOne(HFILE hfile, PEABINDING peab) 379 { 380 return (WriteEA(ENUMEA_REFTYPE_FHANDLE, (&hfile), peab)); 379 381 } 380 382 … … 386 388 * 387 389 *@@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 393 APIRET eaPathDeleteOne(const char *pcszPath, const char *pcszEAName) 391 394 { 392 395 EABINDING eab; 393 396 eab.bFlags = 0; 394 eab.bNameLength = strlen(p szEAName);395 eab.pszName = pszEAName;397 eab.bNameLength = strlen(pcszEAName); 398 eab.pszName = (PSZ)pcszEAName; 396 399 eab.usValueLength = 0; 397 400 eab.pszValue = 0; 398 eaPathWriteOne(path, &eab);401 return (eaPathWriteOne(pcszPath, &eab)); 399 402 } 400 403 … … 404 407 405 408 /******************************************************************** 406 * *407 * Translation funcs *408 * *409 * 410 * Translation funcs 411 * 409 412 ********************************************************************/ 410 413 … … 484 487 */ 485 488 486 PEABINDING eaCreateBindingFromPSZ( PSZ pszEAName,// in: EA name (e.g. ".LONGNAME")487 PSZ pszString)// in: string for EAT_ASCII EA489 PEABINDING eaCreateBindingFromPSZ(const char *pcszEAName, // in: EA name (e.g. ".LONGNAME") 490 const char *pcszInput) // in: string for EAT_ASCII EA 488 491 { 489 492 PEABINDING peab = (PEABINDING)malloc(sizeof(EABINDING)); … … 491 494 { 492 495 SHORT cbString = 0; 493 if (p szString)494 cbString = strlen(p szString);496 if (pcszInput) 497 cbString = strlen(pcszInput); 495 498 496 499 peab->bFlags = 0; 497 peab->bNameLength = strlen(p szEAName);498 peab->pszName = strdup(p szEAName);500 peab->bNameLength = strlen(pcszEAName); 501 peab->pszName = strdup(pcszEAName); 499 502 500 503 if (cbString) … … 510 513 *((PUSHORT)(peab->pszValue + 2)) = cbString; 511 514 // copy string to byte 4 (no null-terminator) 512 memcpy(peab->pszValue + 4, p szString, cbString);515 memcpy(peab->pszValue + 4, pcszInput, cbString); 513 516 } 514 517 else … … 743 746 744 747 PSZ eaCreatePSZFromMVBinding(PEABINDING peab, // in: EAT_MVMT binding 745 PSZ pszSeparator, // in: null-terminated string used as separator748 const char *pcszSeparator, // in: null-terminated string used as separator 746 749 PUSHORT pusCodepage) // out: codepage found in binding (ptr can be NULL) 747 750 { … … 765 768 USHORT us = 0; 766 769 USHORT cbComment = 0; 767 USHORT cbSeparator = strlen(p szSeparator);770 USHORT cbSeparator = strlen(pcszSeparator); 768 771 while (us < usMVCount) 769 772 { … … 794 797 // append separator 795 798 memcpy(pszTotal + cbCommentOld, 796 p szSeparator,799 pcszSeparator, 797 800 cbSeparator); 798 801 // copy the rest after the separator (below) … … 846 849 */ 847 850 848 PEABINDING eaCreateMVBindingFromPSZ( PSZ pszEAName, // in: EA name (e.g. ".KEYPHRASES")849 PSZ pszInput, // in: string to parse850 PSZ pszSeparator, // in: separator used in pszInput851 PEABINDING 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 851 854 USHORT usCodepage) // in: codepage to set in EAT_MVMT 852 855 { 853 856 PEABINDING peab; 854 if (p szInput)857 if (pcszInput) 855 858 { 856 859 peab = (PEABINDING)malloc(sizeof(EABINDING)); 857 860 if (peab) 858 861 { 859 PSZ p = pszInput,860 pSource,861 862 USHORT cbInput = strlen(p szInput),863 cbSep = strlen(p szSeparator),862 const char *p = pcszInput, 863 *pSource; 864 PSZ pTarget; 865 USHORT cbInput = strlen(pcszInput), 866 cbSep = strlen(pcszSeparator), 864 867 usSepCount = 0, 865 868 cbToAlloc = 0, … … 868 871 869 872 peab->bFlags = 0; 870 peab->bNameLength = strlen(p szEAName);871 peab->pszName = strdup(p szEAName);873 peab->bNameLength = strlen(pcszEAName); 874 peab->pszName = strdup(pcszEAName); 872 875 873 876 // now count the number of pszSeparators in pszInput 874 while ((p = strstr(p, p szSeparator)))877 while ((p = strstr(p, pcszSeparator))) 875 878 { 876 879 usSepCount++; … … 898 901 899 902 // set pointer to first field 900 pSource = p szInput;903 pSource = pcszInput; 901 904 pTarget = peab->pszValue + 6; 902 905 … … 907 910 { 908 911 // find the next separator 909 PSZ pNextSep = strstr(pSource, p szSeparator);912 PSZ pNextSep = strstr(pSource, pcszSeparator); 910 913 // calculate the length of the substring 911 914 cbThis = pNextSep - pSource; … … 934 937 935 938 /******************************************************************** 936 * *937 * EA helper funcs *938 * *939 * 940 * EA helper funcs 941 * 939 942 ********************************************************************/ 940 943 … … 1217 1220 1218 1221 /* ****************************************************************** 1219 * *1220 * Direct plain-string EA handling *1221 * *1222 * 1223 * Direct plain-string EA handling 1224 * 1222 1225 ********************************************************************/ 1223 1226 -
trunk/src/helpers/except.c
r13 r14 3 3 *@@sourcefile except.c: 4 4 * this file contains powerful exception handlers. 5 * except.h also defines easy-to-use macros for them. 5 6 * 6 7 * Usage: All OS/2 programs, PM or text mode. 7 8 * 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 16 23 * the handlers to avoid accidentally forgetting to deregister 17 24 * them. If you forget to deregister an exception handler, this … … 20 27 * might get completely messed up. 21 28 * 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. 33 37 * 34 38 * The general usage is like this: … … 36 40 + int your_protected_func(int ...) 37 41 + { 38 + TRY_LOUD(excptid, OnKillFunc) 39 + // or: TRY_QUIET(excptid, OnKillFunc) 40 + // OnKillFunc can be NULL 42 + TRY_LOUD(excptid) // or: TRY_QUIET(excptid) 41 43 + { 42 44 + .... // the stuff in here is protected by … … 50 52 + } // end of your_func 51 53 * 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. 54 56 * CATCH / END_CATCH are the same for the two. This 55 57 * is where the exception handler jumps to if an … … 58 60 * in there. 59 61 * 60 * "excptid" can be any identifier which is not used in62 * "excptid" can be any C identifier which is not used in 61 63 * your current variable scope, e.g. "excpt1". This 62 64 * is used for creating an EXCEPTSTRUCT variable of … … 65 67 * store the exception handler data. 66 68 * 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. 72 75 * 73 76 * Keep in mind that all the code in the TRY_* block is … … 76 79 * TRY_* block, your entire application is protected. 77 80 * 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. 97 98 * 98 99 * <B>Mutex semaphores</B> 99 100 * 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: 103 134 * 104 135 + HMTX hmtx = ... 105 +106 + VOID APIENTRY OnKillYourFunc(VOID)107 + {108 + DosReleaseMutexSem(hmtx);109 + }110 136 + 111 137 + int your_func(int) 112 138 + { 113 + BOOL fSemOwned = FALSE; 139 + BOOL fSemOwned = FALSE; 140 + ULONG ulNesting = 0; 141 + 142 + DosEnterMustComplete(&ulNesting); 114 143 + TRY_QUIET(excpt1, OnKillYourFunc) // or TRY_LOUD 115 144 + { … … 126 155 + fSemOwned = FALSE; 127 156 + } 157 + DosExitMustComplete(&ulNesting); 128 158 + } // end of your_func 129 159 * 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. 136 162 * 137 163 * <B>Customizing</B> 138 164 * 139 * Note: As opposed to versions < 0.9.0, thisis now165 * As opposed to versions before 0.9.0, this code is now 140 166 * completely independent of XWorkplace. This file now 141 167 * contains "pure" exception handlers only. … … 146 172 * If excRegisterHooks is not called, the following safe 147 173 * defaults are used: 174 * 148 175 * -- the trap log file is TRAP.LOG in the root 149 176 * directory of your boot drive. … … 182 209 * John Currier, 183 210 * Anthony Cruise. 184 * This file is part of the XWorkplacesource package.185 * XWorkplaceis free software; you can redistribute it and/or modify211 * This file is part of the "XWorkplace helpers" source package. 212 * This is free software; you can redistribute it and/or modify 186 213 * it under the terms of the GNU General Public License as published 187 214 * by the Free Software Foundation, in version 2 as it comes in the … … 223 250 224 251 /* ****************************************************************** 225 * *226 * Global variables *227 * *252 * 253 * Global variables 254 * 228 255 ********************************************************************/ 229 256 … … 240 267 241 268 /* ****************************************************************** 242 * *243 * Exception helper routines *244 * *269 * 270 * Exception helper routines 271 * 245 272 ********************************************************************/ 246 273 … … 490 517 case XCPT_ACCESS_VIOLATION: 491 518 { 492 fprintf(file, "\n Access violation: ");519 fprintf(file, "\nXCPT_ACCESS_VIOLATION: "); 493 520 if (pReportRec->ExceptionInfo[0] & XCPT_READ_ACCESS) 494 521 fprintf(file, "Invalid read access from 0x%04lX:%08lX.\n", … … 516 543 case XCPT_INTEGER_DIVIDE_BY_ZERO: 517 544 { 518 fprintf(file, "\n Integer division by zero.\n");545 fprintf(file, "\nXCPT_INTEGER_DIVIDE_BY_ZERO.\n"); 519 546 fprintf(file, 520 547 "Explanation: An attempt was made to divide an integer value by zero,\n" … … 525 552 case XCPT_ILLEGAL_INSTRUCTION: 526 553 { 527 fprintf(file, "\n Illegal instruction found.\n");554 fprintf(file, "\nXCPT_ILLEGAL_INSTRUCTION.\n"); 528 555 fprintf(file, 529 556 "Explanation: An attempt was made to execute an instruction that\n" … … 534 561 case XCPT_PRIVILEGED_INSTRUCTION: 535 562 { 536 fprintf(file, "\n Privileged instruction found.\n");563 fprintf(file, "\nXCPT_PRIVILEGED_INSTRUCTION.\n"); 537 564 fprintf(file, 538 565 "Explanation: An attempt was made to execute an instruction that\n" … … 543 570 544 571 case XCPT_INTEGER_OVERFLOW: 545 fprintf(file, "\n Integer overflow.\n");572 fprintf(file, "\nXCPT_INTEGER_OVERFLOW.\n"); 546 573 fprintf(file, 547 574 "Explanation: An integer operation generated a carry-out of the most\n" 548 575 " significant bit. This is a sign of an attempt to store\n" 549 576 " 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"); 550 581 } 551 582 … … 700 731 701 732 /* ****************************************************************** 702 * *703 * Exported routines *704 * *733 * 734 * Exported routines 735 * 705 736 ********************************************************************/ 706 737 … … 722 753 * The hooks are as follows: 723 754 * 724 * pfnExcOpenFileNew gets called to open755 * -- pfnExcOpenFileNew gets called to open 725 756 * the trap log file. This must return a FILE* 726 757 * pointer from fopen(). If this is not defined, … … 729 760 * into it before the actual exception info. 730 761 * 731 * pfnExcHookNew gets called while the trap log762 * -- pfnExcHookNew gets called while the trap log 732 763 * is being written. At this point, 733 764 * the following info has been written into … … 743 774 * Use this hook to write additional application 744 775 * info into the trap log, such as the state 745 * of your threads.746 * 747 * pfnExcHookError gets called when the TRY_* macros776 * of your own threads and mutexes. 777 * 778 * -- pfnExcHookError gets called when the TRY_* macros 748 779 * fail to install an exception handler (when 749 * DosSetExceptionHandler fails). 780 * DosSetExceptionHandler fails). I've never seen 781 * this happen. 750 782 * 751 783 *@@added V0.9.0 [umoeller] … … 772 804 * to the thread to continue execution, i.e. the 773 805 * 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 775 809 * 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): 786 815 * 787 816 * -- XCPT_ACCESS_VIOLATION (traps 0x0d, 0x0e) … … 795 824 * what source code corresponds to the error. 796 825 * 826 * See excRegisterHooks for the default setup of this. 827 * 797 828 * Note that to get meaningful debugging information 798 829 * in this handler's traplog, you need the following: 830 * 799 831 * a) have a MAP file created at link time (/MAP) 832 * 800 833 * b) convert the MAP to a SYM file using MAPSYM 834 * 801 835 * 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 * 807 839 * All other exceptions are passed to the next handler 808 840 * in the exception handler chain. This might be the 809 841 * C/C++ compiler handler or the default OS/2 handler, 810 842 * which will probably terminate the process. 811 *812 * <B>b) thread kills</B>813 *814 * -- XCPT_PROCESS_TERMINATE815 * -- XCPT_ASYNC_PROCESS_TERMINATE:816 *817 * If EXCEPTIONREGISTRATIONRECORD2.pfnOnKill is != NULL,818 * that function gets called to allow for thread cleanup819 * before the thread really terminates. This should be820 * used for releasing mutex semaphores.821 843 * 822 844 *@@changed V0.9.0 [umoeller]: added support for thread termination … … 852 874 switch (pReportRec->ExceptionNum) 853 875 { 854 case XCPT_PROCESS_TERMINATE:876 /* case XCPT_PROCESS_TERMINATE: 855 877 case XCPT_ASYNC_PROCESS_TERMINATE: 856 878 // thread terminated: … … 859 881 if (pRegRec2->pfnOnKill) 860 882 // call the "OnKill" function 861 pRegRec2->pfnOnKill( );883 pRegRec2->pfnOnKill(pRegRec2); 862 884 // get outta here, which will kill the thread 863 break; 885 break; */ 864 886 865 887 case XCPT_ACCESS_VIOLATION: … … 867 889 case XCPT_ILLEGAL_INSTRUCTION: 868 890 case XCPT_PRIVILEGED_INSTRUCTION: 891 case XCPT_INVALID_LOCK_SEQUENCE: 869 892 case XCPT_INTEGER_OVERFLOW: 870 893 { … … 924 947 * this is useful for certain error-prone functions, where 925 948 * 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. 927 950 * 928 951 * This does _not_ write an error log and makes _no_ sound. … … 953 976 switch (pReportRec->ExceptionNum) 954 977 { 955 case XCPT_PROCESS_TERMINATE:978 /* case XCPT_PROCESS_TERMINATE: 956 979 case XCPT_ASYNC_PROCESS_TERMINATE: 957 980 // thread terminated: … … 960 983 if (pRegRec2->pfnOnKill) 961 984 // call the "OnKill" function 962 pRegRec2->pfnOnKill( );985 pRegRec2->pfnOnKill(pRegRec2); 963 986 // get outta here, which will kill the thread 964 break; 987 break; */ 965 988 966 989 case XCPT_ACCESS_VIOLATION: … … 968 991 case XCPT_ILLEGAL_INSTRUCTION: 969 992 case XCPT_PRIVILEGED_INSTRUCTION: 993 case XCPT_INVALID_LOCK_SEQUENCE: 970 994 case XCPT_INTEGER_OVERFLOW: 971 995 // write excpt explanation only if the 972 // resp. debugging #define is set ( common.h)996 // resp. debugging #define is set (setup.h) 973 997 #ifdef DEBUG_WRITEQUIETEXCPT 974 998 { -
trunk/src/helpers/gpih.c
r13 r14 6 6 * Usage: All PM programs. 7 7 * 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. 13 18 * 14 19 * Function prefixes (new with V0.81): … … 23 28 /* 24 29 * Copyright (C) 1997-2000 Ulrich Mller. 25 * This file is part of the XWorkplacesource package.26 * XWorkplaceis free software; you can redistribute it and/or modify30 * This file is part of the "XWorkplace helpers" source package. 31 * This is free software; you can redistribute it and/or modify 27 32 * it under the terms of the GNU General Public License as published 28 33 * by the Free Software Foundation, in version 2 as it comes in the … … 39 44 // as unsigned char 40 45 41 #define INCL_DOSDEVIOCTL42 #define INCL_DOS43 46 #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 46 56 #include <os2.h> 47 57 … … 68 78 69 79 /* ****************************************************************** 70 * *71 * Device helpers *72 * *80 * 81 * Device helpers 82 * 73 83 ********************************************************************/ 74 84 … … 100 110 101 111 /* ****************************************************************** 102 * *103 * Color helpers *104 * *112 * 113 * Color helpers 114 * 105 115 ********************************************************************/ 106 116 … … 139 149 140 150 /* ****************************************************************** 141 * *142 * Drawing primitives helpers *143 * *151 * 152 * Drawing primitives helpers 153 * 144 154 ********************************************************************/ 145 155 … … 187 197 * the top right point lies _outside_ the rectangle 188 198 * 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... 190 201 * 191 202 * Changes to the HPS: … … 252 263 GpiMove(hps, &ptlSave); 253 264 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 289 VOID 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 } 254 311 } 255 312 … … 355 412 356 413 /* ****************************************************************** 357 * *358 * Font helpers *359 * *414 * 415 * Font helpers 416 * 360 417 ********************************************************************/ 361 418 … … 1030 1087 1031 1088 /* ****************************************************************** 1032 * *1033 * Bitmap helpers *1034 * *1089 * 1090 * Bitmap helpers 1091 * 1035 1092 ********************************************************************/ 1036 1093 -
trunk/src/helpers/helpers_post.in
r13 r14 153 153 $(PROJECTINC)\setup.h 154 154 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 155 159 $(OUTPUTDIR)\tmsgfile.obj: $(@B).c $(HLPINC)\$(@B).h \ 156 160 $(PROJECTINC)\setup.h \ -
trunk/src/helpers/helpers_pre.in
r13 r14 80 80 $(OUTPUTDIR)\textview.obj \ 81 81 $(OUTPUTDIR)\textv_html.obj \ 82 $(OUTPUTDIR)\timer.obj \ 82 83 $(OUTPUTDIR)\winh.obj 83 84 -
trunk/src/helpers/level.c
r8 r14 16 16 * Copyright (C) 1994 Martin Lafaix (EDM/2 2-05). 17 17 * Copyright (C) 2000 Ulrich Mller. 18 * This file is part of the XWorkplacesource package.19 * XWorkplaceis free software; you can redistribute it and/or modify18 * This file is part of the "XWorkplace helpers" source package. 19 * This is free software; you can redistribute it and/or modify 20 20 * it under the terms of the GNU General Public License as published 21 21 * by the Free Software Foundation, in version 2 as it comes in the … … 33 33 34 34 #define INCL_DOSFILEMGR 35 #define INCL_NOPMAPI36 35 #include <os2.h> 37 36 … … 54 53 55 54 /* ****************************************************************** 56 * *57 * Interface *58 * *55 * 56 * Interface 57 * 59 58 ********************************************************************/ 60 59 … … 473 472 474 473 /* ****************************************************************** 475 * *476 * Local helper functions *477 * *474 * 475 * Local helper functions 476 * 478 477 ********************************************************************/ 479 478 -
trunk/src/helpers/linklist.c
r8 r14 57 57 /* 58 58 * Copyright (C) 1997-2000 Ulrich Mller. 59 * This file is part of the XWorkplacesource package.60 * XWorkplaceis free software; you can redistribute it and/or modify59 * This file is part of the "XWorkplace helpers" source package. 60 * This is free software; you can redistribute it and/or modify 61 61 * it under the terms of the GNU General Public License as published 62 62 * by the Free Software Foundation, in version 2 as it comes in the … … 82 82 83 83 /* ****************************************************************** 84 * *85 * List base functions *86 * *84 * 85 * List base functions 86 * 87 87 ********************************************************************/ 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 99 void* 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 114 void* lstStrDup(const char *pcsz) 115 { 116 return (strdup(pcsz)); 117 } 88 118 89 119 /* … … 111 141 * you're storing other objects, such as numbers 112 142 * 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. 113 154 * 114 155 * Note: You better call lstInit only once per list, … … 758 799 759 800 /* ****************************************************************** 760 * *761 * List sorting *762 * *801 * 802 * List sorting 803 * 763 804 ********************************************************************/ 764 805 … … 933 974 934 975 /* ****************************************************************** 935 * *936 * List pseudo-stacks *937 * *976 * 977 * List pseudo-stacks 978 * 938 979 ********************************************************************/ 939 980 -
trunk/src/helpers/memdebug.c
r13 r14 134 134 135 135 /* ****************************************************************** 136 * *137 * Global variables *138 * *136 * 137 * Global variables 138 * 139 139 ********************************************************************/ 140 140 … … 156 156 157 157 /* ****************************************************************** 158 * *159 * Debug heap management *160 * *158 * 159 * Debug heap management 160 * 161 161 ********************************************************************/ 162 162 … … 660 660 661 661 /* ****************************************************************** 662 * *663 * XFolder debugging helpers *664 * *662 * 663 * XFolder debugging helpers 664 * 665 665 ********************************************************************/ 666 666 -
trunk/src/helpers/prfh.c
r13 r14 19 19 /* 20 20 * Copyright (C) 1997-2000 Ulrich Mller. 21 * This file is part of the XWorkplacesource package.22 * XWorkplaceis free software; you can redistribute it and/or modify21 * This file is part of the "XWorkplace helpers" source package. 22 * This is free software; you can redistribute it and/or modify 23 23 * it under the terms of the GNU General Public License as published 24 24 * by the Free Software Foundation, in version 2 as it comes in the … … 35 35 // as unsigned char 36 36 37 #define INCL_DOS38 37 #define INCL_DOSERRORS 39 #define INCL_WIN 38 #define INCL_WINSHELLDATA 40 39 #include <os2.h> 41 40 … … 170 169 171 170 PSZ prfhQueryProfileData(HINI hIni, // in: INI handle (can be HINI_USER or HINI_SYSTEM) 172 PSZ pszApp,// in: application to query173 PSZ pszKey,// in: key to query174 PULONG pcbBuf) // out: size of the returned buffer171 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 175 174 { 176 175 PSZ pData = NULL; … … 238 237 * -- cDateSep = '/' (date separator); 239 238 * -- cTimeSep = ':' (time separator); 239 * -- cDecimal = '.' (decimal separator). 240 240 * -- cThousands = ',' (thousands separator). 241 241 * 242 242 *@@added V0.9.0 [umoeller] 243 *@@changed V0.9.7 (2000-12-02) [umoeller]: added cDecimal 243 244 */ 244 245 … … 247 248 if (pcs) 248 249 { 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", ','); 254 257 } 255 258 } -
trunk/src/helpers/prfh2.c
r13 r14 24 24 /* 25 25 * Copyright (C) 1997-2000 Ulrich Mller. 26 * This file is part of the XWorkplacesource package.27 * XWorkplaceis free software; you can redistribute it and/or modify26 * This file is part of the "XWorkplace helpers" source package. 27 * This is free software; you can redistribute it and/or modify 28 28 * it under the terms of the GNU General Public License as published 29 29 * by the Free Software Foundation, in version 2 as it comes in the … … 40 40 // as unsigned char 41 41 42 #define INCL_DOS43 42 #define INCL_DOSERRORS 44 #define INCL_WIN 43 #define INCL_WINSHELLDATA 45 44 #include <os2.h> 46 45 -
trunk/src/helpers/procstat.c
r13 r14 34 34 * Copyright (C) 1992-1994 Kai Uwe Rommel. 35 35 * Copyright (C) 1998-2000 Ulrich Mller. 36 * This file is part of the XWorkplacesource package.37 * XWorkplaceis free software; you can redistribute it and/or modify36 * This file is part of the "XWorkplace helpers" source package. 37 * This is free software; you can redistribute it and/or modify 38 38 * it under the terms of the GNU General Public License as published 39 39 * by the Free Software Foundation, in version 2 as it comes in the … … 50 50 // as unsigned char 51 51 52 #define INCL_DOS 52 #define INCL_DOSMODULEMGR 53 53 #define INCL_DOSERRORS 54 #define INCL_DOSMODULEMGR55 54 #include <os2.h> 56 55 … … 70 69 71 70 /******************************************************************** 72 * *73 * DosQProcStat (16-bit) interface *74 * *71 * 72 * DosQProcStat (16-bit) interface 73 * 75 74 ********************************************************************/ 76 75 … … 196 195 197 196 /******************************************************************** 198 * *199 * DosQProcStat (16-bit) helpers *200 * *197 * 198 * DosQProcStat (16-bit) helpers 199 * 201 200 ********************************************************************/ 202 201 … … 439 438 440 439 /******************************************************************** 441 * *442 * DosQuerySysState (32-bit) interface *443 * *440 * 441 * DosQuerySysState (32-bit) interface 442 * 444 443 ********************************************************************/ 445 444 -
trunk/src/helpers/resh.c
r8 r14 34 34 // as unsigned char 35 35 36 #define INCL_DOSMODULEMGR 37 #define INCL_DOSRESOURCES 36 38 #define INCL_DOSERRORS 37 #define INCL_DOS38 #define INCL_DOS39 39 #include <os2.h> 40 40 -
trunk/src/helpers/shapewin.c
r8 r14 167 167 * Akira Hatakeyama, 168 168 * Takayuki Suwa. 169 * This file is part of the XWorkplacesource package.170 * XWorkplaceis free software; you can redistribute it and/or modify169 * This file is part of the "XWorkplace helpers" source package. 170 * This is free software; you can redistribute it and/or modify 171 171 * it under the terms of the GNU General Public License as published 172 172 * by the Free Software Foundation, in version 2 as it comes in the … … 184 184 // as unsigned char 185 185 186 #define INCL_DOS187 186 #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 189 193 #define INCL_WINSYS 194 #define INCL_WINRECTANGLES 195 #define INCL_WINTRACKRECT 196 190 197 #define INCL_GPILOGCOLORTABLE 191 198 #define INCL_GPIPRIMITIVES … … 209 216 210 217 /* ****************************************************************** 211 * *212 * Global variables *213 * *218 * 219 * Global variables 220 * 214 221 ********************************************************************/ 215 222 … … 217 224 218 225 /* ****************************************************************** 219 * *220 * Part 1: Shape window functions *221 * *226 * 227 * Part 1: Shape window functions 228 * 222 229 ********************************************************************/ 223 230 … … 515 522 HPS hps ; 516 523 517 pRgn = (PSHPREGION) 524 pRgn = (PSHPREGION)WinQueryWindowPtr(hwnd, 0); 518 525 519 526 switch (msg) … … 1216 1223 case WM_QUERYDLGCODE: 1217 1224 // TRACE("WM_QUERYDLGCODE\n"); 1218 return (MRESULT) 1225 return (MRESULT)DLGC_STATIC; 1219 1226 1220 1227 /* … … 1295 1302 1296 1303 /* ****************************************************************** 1297 * *1298 * Part 2: Shape frame functions *1299 * *1304 * 1305 * Part 2: Shape frame functions 1306 * 1300 1307 ********************************************************************/ 1301 1308 -
trunk/src/helpers/stringh.c
r13 r14 25 25 * Copyright (C) 1997-2000 Ulrich Mller. 26 26 * Parts Copyright (C) 1991-1999 iMatix Corporation. 27 * This file is part of the XWorkplacesource package.28 * XWorkplaceis free software; you can redistribute it and/or modify27 * This file is part of the "XWorkplace helpers" source package. 28 * This is free software; you can redistribute it and/or modify 29 29 * it under the terms of the GNU General Public License as published 30 30 * by the Free Software Foundation, in version 2 as it comes in the … … 1709 1709 1710 1710 /* ****************************************************************** 1711 * *1712 * Miscellaneous *1713 * *1711 * 1712 * Miscellaneous 1713 * 1714 1714 ********************************************************************/ 1715 1715 … … 1742 1742 1743 1743 VOID strhArrayAppend(PSZ *ppszRoot, // in: root of array 1744 PSZ pszNew,// in: string to append1744 const char *pcszNew, // in: string to append 1745 1745 PULONG pcbRoot) // in/out: size of array 1746 1746 { 1747 ULONG cbNew = strlen(p szNew);1747 ULONG cbNew = strlen(pcszNew); 1748 1748 PSZ pszTemp = (PSZ)malloc(*pcbRoot 1749 1749 + cbNew … … 1759 1759 // append new string 1760 1760 strcpy(pszTemp + *pcbRoot, 1761 p szNew);1761 pcszNew); 1762 1762 // update root 1763 1763 *ppszRoot = pszTemp; … … 1859 1859 1860 1860 /* ****************************************************************** 1861 * *1862 * Wildcard matching *1863 * *1861 * 1862 * Wildcard matching 1863 * 1864 1864 ********************************************************************/ 1865 1865 … … 2457 2457 2458 2458 /* ****************************************************************** 2459 * *2460 * Fast string searches *2461 * *2459 * 2460 * Fast string searches 2461 * 2462 2462 ********************************************************************/ 2463 2463 -
trunk/src/helpers/textv_html.c
r13 r14 59 59 60 60 /* ****************************************************************** 61 * *62 * Declarations *63 * *61 * 62 * Declarations 63 * 64 64 ********************************************************************/ 65 65 … … 150 150 151 151 /* ****************************************************************** 152 * *153 * Global variables *154 * *152 * 153 * Global variables 154 * 155 155 ********************************************************************/ 156 156 157 157 /* ****************************************************************** 158 * *159 * Append-char helpers *160 * *158 * 159 * Append-char helpers 160 * 161 161 ********************************************************************/ 162 162 … … 299 299 300 300 /* ****************************************************************** 301 * *302 * Tag converter functions *303 * *301 * 302 * Tag converter functions 303 * 304 304 ********************************************************************/ 305 305 … … 885 885 886 886 /* ****************************************************************** 887 * *888 * Tag helpers *889 * *887 * 888 * Tag helpers 889 * 890 890 ********************************************************************/ 891 891 … … 1972 1972 1973 1973 /* ****************************************************************** 1974 * *1975 * Entry points *1976 * *1974 * 1975 * Entry points 1976 * 1977 1977 ********************************************************************/ 1978 1978 -
trunk/src/helpers/textview.c
r13 r14 252 252 253 253 /* ****************************************************************** 254 * *255 * Device-independent functions *256 * *254 * 255 * Device-independent functions 256 * 257 257 ********************************************************************/ 258 258 … … 466 466 467 467 /* ****************************************************************** 468 * *469 * Device-independent text formatting *470 * *468 * 469 * Device-independent text formatting 470 * 471 471 ********************************************************************/ 472 472 … … 1400 1400 1401 1401 /* ****************************************************************** 1402 * *1403 * Device-independent text painting *1404 * *1402 * 1403 * Device-independent text painting 1404 * 1405 1405 ********************************************************************/ 1406 1406 … … 1806 1806 1807 1807 /* ****************************************************************** 1808 * *1809 * Window-dependent functions *1810 * *1808 * 1809 * Window-dependent functions 1810 * 1811 1811 ********************************************************************/ 1812 1812 … … 3180 3180 3181 3181 /* ****************************************************************** 3182 * *3183 * Printer-dependent functions *3184 * *3182 * 3183 * Printer-dependent functions 3184 * 3185 3185 ********************************************************************/ 3186 3186 -
trunk/src/helpers/threads.c
r8 r14 24 24 /* 25 25 * Copyright (C) 1997-2000 Ulrich Mller. 26 * This file is part of the XWorkplacesource package.27 * XWorkplaceis free software; you can redistribute it and/or modify26 * This file is part of the "XWorkplace helpers" source package. 27 * This is free software; you can redistribute it and/or modify 28 28 * it under the terms of the GNU General Public License as published 29 29 * by the Free Software Foundation, in version 2 as it comes in the … … 102 102 ((PTHREADFUNC)pti->pThreadFunc)(pti); 103 103 104 if (pti->flFlags & THRF_WAIT) 105 // "Wait" flag set: delete semaphore 106 DosCloseEventSem(pti->hevRunning); 107 104 108 // thread func returns: 105 109 pti->fExitComplete = TRUE; 106 110 pti->tid = NULLHANDLE; 107 108 if (pti->flFlags & THRF_WAIT)109 // "Wait" flag set: delete semaphore110 DosCloseEventSem(pti->hevRunning);111 111 112 112 if (pti->pfRunning) -
trunk/src/helpers/tmsgfile.c
r13 r14 50 50 * Copyright (C) 1999 Christian Langanke. 51 51 * Copyright (C) 1999-2000 Ulrich Mller. 52 * This file is part of the XWorkplacesource package.53 * XWorkplaceis free software; you can redistribute it and/or modify52 * This file is part of the "XWorkplace helpers" source package. 53 * This is free software; you can redistribute it and/or modify 54 54 * it under the terms of the GNU General Public License as published 55 55 * by the Free Software Foundation, in version 2 as it comes in the … … 66 66 // as unsigned char 67 67 68 #define INCL_DOS 69 #define INCL_ERRORS 68 #define INCL_DOSFILEMGR 69 #define INCL_DOSMISC 70 #define INCL_DOSNLS 71 #define INCL_DOSERRORS 70 72 #include <os2.h> 71 73 … … 85 87 86 88 /* ****************************************************************** 87 * *88 * Declarations *89 * *89 * 90 * Declarations 91 * 90 92 ********************************************************************/ 91 93 … … 111 113 112 114 /* ****************************************************************** 113 * *114 * Text Message File Code *115 * *115 * 116 * Text Message File Code 117 * 116 118 ********************************************************************/ 117 119 -
trunk/src/helpers/tree.c
r13 r14 89 89 * Copyright (C) 1991-99 iMatix Corporation. 90 90 * Copyright (C) 2000 Ulrich Mller. 91 * This file is part of the XWorkplacesource package.92 * XWorkplaceis free software; you can redistribute it and/or modify91 * This file is part of the "XWorkplace helpers" source package. 92 * This is free software; you can redistribute it and/or modify 93 93 * it under the terms of the GNU General Public License as published 94 94 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/src/helpers/winh.c
r13 r14 20 20 /* 21 21 * Copyright (C) 1997-2000 Ulrich Mller. 22 * This file is part of the XWorkplacesource package.23 * XWorkplaceis free software; you can redistribute it and/or modify22 * This file is part of the "XWorkplace helpers" source package. 23 * This is free software; you can redistribute it and/or modify 24 24 * it under the terms of the GNU General Public License as published 25 25 * by the Free Software Foundation, in version 2 as it comes in the … … 36 36 // as unsigned char 37 37 38 #define INCL_DOSPROCESS 39 #define INCL_DOSMODULEMGR 40 #define INCL_DOSSEMAPHORES 41 #define INCL_DOSDEVICES 38 42 #define INCL_DOSDEVIOCTL 39 #define INCL_DOS40 43 #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 46 65 #define INCL_SPL 47 66 #define INCL_SPLDOSPRINT 48 67 #define INCL_SPLERRORS 49 68 69 #define INCL_GPIBITMAPS 70 #define INCL_GPIPRIMITIVES 50 71 #include <os2.h> 51 72 … … 69 90 70 91 /* ****************************************************************** 71 * *72 * Menu helpers *73 * *92 * 93 * Menu helpers 94 * 74 95 ********************************************************************/ 75 96 … … 255 276 * not found. 256 277 * 257 * If something != NULL is returned, you258 * should free() the buffer afterwards.278 * Returns NULL on error. Use winhFree() 279 * to free the return value. 259 280 * 260 281 * Use the WinSetMenuItemText macro to … … 387 408 388 409 /* ****************************************************************** 389 * *390 * Slider helpers *391 * *410 * 411 * Slider helpers 412 * 392 413 ********************************************************************/ 393 414 … … 791 812 792 813 /* ****************************************************************** 793 * *794 * Spin button helpers *795 * *814 * 815 * Spin button helpers 816 * 796 817 ********************************************************************/ 797 818 … … 896 917 897 918 /* ****************************************************************** 898 * *899 * List box helpers *900 * *919 * 920 * List box helpers 921 * 901 922 ********************************************************************/ 902 923 … … 905 926 * returns the text of the specified 906 927 * 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. 909 932 * 910 933 *@@added V0.9.1 (99-12-14) [umoeller] … … 1025 1048 1026 1049 /* ****************************************************************** 1027 * *1028 * Scroll bar helpers *1029 * *1050 * 1051 * Scroll bar helpers 1052 * 1030 1053 ********************************************************************/ 1031 1054 … … 1503 1526 1504 1527 /* ****************************************************************** 1505 * *1506 * Window positioning helpers *1507 * *1528 * 1529 * Window positioning helpers 1530 * 1508 1531 ********************************************************************/ 1509 1532 … … 1916 1939 1917 1940 /* 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 1949 HWND 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 /* 1918 1975 *@@category: Helpers\PM helpers\Presentation parameters 1919 1976 */ 1920 1977 1921 1978 /* ****************************************************************** 1922 * *1923 * Presparams helpers *1924 * *1979 * 1980 * Presparams helpers 1981 * 1925 1982 ********************************************************************/ 1926 1983 … … 1928 1985 *@@ winhQueryWindowFont: 1929 1986 * 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. 1932 1991 * 1933 1992 *@@added V0.9.1 (2000-02-14) [umoeller] … … 1966 2025 1967 2026 BOOL winhSetWindowFont(HWND hwnd, 1968 PSZ pszFont)2027 const char *pcszFont) 1969 2028 { 1970 2029 CHAR szFont[256]; 1971 2030 1972 if (p szFont == NULL)2031 if (pcszFont == NULL) 1973 2032 { 1974 2033 if (doshIsWarp4()) … … 1978 2037 } 1979 2038 else 1980 strhncpy0(szFont, p szFont, sizeof(szFont));2039 strhncpy0(szFont, pcszFont, sizeof(szFont)); 1981 2040 1982 2041 return (WinSetPresParam(hwnd, … … 2060 2119 * Use free() on your PPRESPARAMS pointer (whose 2061 2120 * address was passed) after WinCreateWindow. 2121 * 2122 * See winhQueryPresColor for typical presparams 2123 * used in OS/2. 2062 2124 * 2063 2125 * Example: … … 2139 2201 * 3) if this fails or (fInherit == FALSE), WinQuerySysColor 2140 2202 * 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. 2142 2205 * 2143 2206 * The return value is always an RGB LONG, _not_ a color index. … … 2205 2268 *@@changed V0.9.0 [umoeller]: removed INI key query, using SYSCLR_* instead; function prototype changed 2206 2269 *@@changed V0.9.0 [umoeller]: added fInherit parameter 2270 *@@changed V0.9.7 (2000-12-02) [umoeller]: added lSysColor == -1 support 2207 2271 */ 2208 2272 … … 2229 2293 2230 2294 // 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; 2232 2299 } 2233 2300 … … 2237 2304 2238 2305 /* ****************************************************************** 2239 * *2240 * Help instance helpers *2241 * *2306 * 2307 * Help instance helpers 2308 * 2242 2309 ********************************************************************/ 2243 2310 … … 2760 2827 2761 2828 /* ****************************************************************** 2762 * *2763 * Miscellaneous *2764 * *2829 * 2830 * Miscellaneous 2831 * 2765 2832 ********************************************************************/ 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 2848 VOID winhFree(PVOID p) 2849 { 2850 if (p) 2851 free(p); 2852 } 2766 2853 2767 2854 /* … … 2930 3017 *@@ winhQueryWindowText: 2931 3018 * this returns the window text of the specified 2932 * HWND in a newly allocated buffer , which has2933 * 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. 2936 3023 */ 2937 3024 … … 3058 3145 *@@added V0.9.0 [umoeller] 3059 3146 *@@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 3060 3148 */ 3061 3149 … … 3119 3207 3120 3208 // 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, 3123 3217 TRUE); // calc client from frame 3124 3218 WinSetWindowPos(*phwndClient, … … 3515 3609 3516 3610 /* 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 3627 PSWBLOCK 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 3652 HWND 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 /* 3517 3662 *@@ winhKillTasklist: 3518 3663 * this will destroy the Tasklist (window list) window. … … 3525 3670 VOID winhKillTasklist(VOID) 3526 3671 { 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(); 3532 3673 WinPostMsg(hwndTasklist, 3533 3674 0x0454, // undocumented msg for killing tasklist … … 3695 3836 3696 3837 /* ****************************************************************** 3697 * *3698 * WPS Class List helpers *3699 * *3838 * 3839 * WPS Class List helpers 3840 * 3700 3841 ********************************************************************/ 3701 3842 … … 3712 3853 * See WinEnumObjectClasses() for details. 3713 3854 * 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. 3719 3857 * 3720 3858 *@@added V0.9.0 [umoeller] -
trunk/src/helpers/wphandle.c
r8 r14 24 24 * This file Copyright (C) 1997-2000 Ulrich Mller, 25 25 * Henk Kelder. 26 * This file is part of the XWorkplacesource package.27 * XWorkplaceis free software; you can redistribute it and/or modify26 * This file is part of the "XWorkplace helpers" source package. 27 * This is free software; you can redistribute it and/or modify 28 28 * it under the terms of the GNU General Public License as published 29 29 * by the Free Software Foundation, in version 2 as it comes in the … … 40 40 // as unsigned char 41 41 42 #define INCL_DOS43 42 #define INCL_WINSHELLDATA 44 43 #include <os2.h> … … 73 72 74 73 /* ****************************************************************** 75 * *76 * Helper functions *77 * *74 * 75 * Helper functions 76 * 78 77 ********************************************************************/ 79 78 … … 281 280 282 281 /* ****************************************************************** 283 * *284 * Get HOBJECT from filename *285 * *282 * 283 * Get HOBJECT from filename 284 * 286 285 ********************************************************************/ 287 286 … … 521 520 522 521 /* ****************************************************************** 523 * *524 * Get filename from HOBJECT *525 * *522 * 523 * Get filename from HOBJECT 524 * 526 525 ********************************************************************/ 527 526 … … 640 639 641 640 /* ****************************************************************** 642 * *643 * Manipulation functions *644 * *641 * 642 * Manipulation functions 643 * 645 644 ********************************************************************/ 646 645 -
trunk/src/helpers/xml.c
r13 r14 46 46 /* 47 47 * Copyright (C) 2000 Ulrich Mller. 48 * This file is part of the XWorkplacesource package.49 * XWorkplaceis free software; you can redistribute it and/or modify48 * This file is part of the "XWorkplace helpers" source package. 49 * This is free software; you can redistribute it and/or modify 50 50 * it under the terms of the GNU General Public License as published 51 51 * by the Free Software Foundation, in version 2 as it comes in the -
trunk/src/helpers/xprf.c
r8 r14 75 75 /* 76 76 * Copyright (C) 2000 Ulrich Mller. 77 * This file is part of the XWorkplacesource package.78 * XWorkplaceis free software; you can redistribute it and/or modify77 * This file is part of the "XWorkplace helpers" source package. 78 * This is free software; you can redistribute it and/or modify 79 79 * it under the terms of the GNU General Public License as published 80 80 * by the Free Software Foundation, in version 2 as it comes in the … … 91 91 // as unsigned char 92 92 93 #define INCL_DOS94 93 #define INCL_DOSERRORS 95 94 #define INCL_WINSHELLDATA … … 113 112 114 113 /* ****************************************************************** 115 * *116 * Declarations *117 * *114 * 115 * Declarations 116 * 118 117 ********************************************************************/ 119 118 … … 143 142 144 143 /* ****************************************************************** 145 * *146 * Helpers *147 * *144 * 145 * Helpers 146 * 148 147 ********************************************************************/ 149 148 … … 352 351 353 352 /* ****************************************************************** 354 * *355 * Read/write data *356 * *353 * 354 * Read/write data 355 * 357 356 ********************************************************************/ 358 357 … … 670 669 671 670 /* ****************************************************************** 672 * *673 * API Functions *674 * *671 * 672 * API Functions 673 * 675 674 ********************************************************************/ 676 675 -
trunk/src/helpers/xprf2.c
r12 r14 22 22 /* 23 23 * Copyright (C) 2000 Ulrich Mller. 24 * This file is part of the XWorkplacesource package.25 * XWorkplaceis free software; you can redistribute it and/or modify24 * This file is part of the "XWorkplace helpers" source package. 25 * This is free software; you can redistribute it and/or modify 26 26 * it under the terms of the GNU General Public License as published 27 27 * by the Free Software Foundation, in version 2 as it comes in the … … 38 38 // as unsigned char 39 39 40 #define INCL_DOS41 40 #define INCL_DOSERRORS 42 41 #define INCL_WINSHELLDATA … … 61 60 62 61 /* ****************************************************************** 63 * *64 * Copy API Functions *65 * *62 * 63 * Copy API Functions 64 * 66 65 ********************************************************************/ 67 66 -
trunk/src/helpers/xstring.c
r13 r14 85 85 /* 86 86 * Copyright (C) 1999-2000 Ulrich Mller. 87 * This file is part of the XWorkplacesource package.88 * XWorkplaceis free software; you can redistribute it and/or modify87 * This file is part of the "XWorkplace helpers" source package. 88 * This is free software; you can redistribute it and/or modify 89 89 * it under the terms of the GNU General Public License as published 90 90 * by the Free Software Foundation, in version 2 as it comes in the
Note:
See TracChangeset
for help on using the changeset viewer.