Changeset 69
- Timestamp:
- May 19, 2001, 3:47:20 PM (24 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/dosh.h
r67 r69 46 46 47 47 PSZ doshQuerySysErrorMsg(APIRET arc); 48 49 ULONG doshQuerySysUptime(VOID); 48 50 49 51 /* ****************************************************************** … … 765 767 an extra call to doshExecQueryBldLevel. */ 766 768 767 PSZ pszDescription; // whole string (first non-res name tbl entry) 768 PSZ pszVendor; // vendor substring (if IBM BLDLEVEL format) 769 PSZ pszVersion; // version substring (if IBM BLDLEVEL format) 770 PSZ pszInfo; // module info substring (if IBM BLDLEVEL format) 769 PSZ pszDescription; 770 // whole string (first non-res name tbl entry) 771 PSZ pszVendor; 772 // vendor substring (if IBM BLDLEVEL format) 773 PSZ pszVersion; 774 // version substring (if IBM BLDLEVEL format) 775 776 PSZ pszInfo; 777 // module info substring (if IBM BLDLEVEL format) 778 779 // if pszInfo is extended DESCRIPTION field, the following 780 // are set as well: 781 PSZ pszBuildDateTime, 782 pszBuildMachine, 783 pszASD, 784 pszLanguage, 785 pszCountry, 786 pszRevision, 787 pszUnknown, 788 pszFixpak; 771 789 772 790 } EXECUTABLE, *PEXECUTABLE; -
trunk/include/helpers/winh.h
r62 r69 3 3 *@@sourcefile winh.h: 4 4 * header file for winh.c (PM helper funcs). See remarks there. 5 * 6 * Special #define's which this thing reacts to: 7 * 8 * -- If WINH_STANDARDWRAPPERS is defined to anything, this include 9 * file maps a number of freqently API calls (such as WinSendMsg) 10 * to winh* equivalents to reduce the amount of fixup records 11 * in the final executable. 5 12 * 6 13 * Note: Version numbering in this file relates to XWorkplace version … … 66 73 /* ****************************************************************** 67 74 * 75 * Wrappers 76 * 77 ********************************************************************/ 78 79 // if WINH_STANDARDWRAPPERS is #define'd before including winh.h, 80 // all the following Win* API calls are redirected to the winh* 81 // counterparts 82 83 #ifdef WINH_STANDARDWRAPPERS 84 85 MRESULT _Optlink winhSendMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 86 #define WinSendMsg(a,b,c,d) winhSendMsg((a),(b),(c),(d)) 87 88 BOOL _Optlink winhPostMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 89 #define WinPostMsg(a,b,c,d) winhPostMsg((a),(b),(c),(d)) 90 91 HWND _Optlink winhWindowFromID(HWND hwnd, ULONG id); 92 #define WinWindowFromID(a,b) winhWindowFromID((a),(b)) 93 94 HWND _Optlink winhQueryWindow(HWND hwnd, LONG lCode); 95 #define WinQueryWindow(a,b) winhQueryWindow((a),(b)) 96 97 #endif 98 99 /* ****************************************************************** 100 * 68 101 * Macros 69 102 * … … 81 114 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, ((PSZ)text), ((PSZ)title), 0, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE) 82 115 83 #define winhSetDlgItemChecked(hwnd, id, bCheck) \ 116 // made these functions V0.9.12 (2001-05-18) [umoeller] 117 /* #define winhSetDlgItemChecked(hwnd, id, bCheck) \ 84 118 WinSendDlgItemMsg((hwnd), (id), BM_SETCHECK, MPFROMSHORT(bCheck), MPNULL) 85 86 119 #define winhIsDlgItemChecked(hwnd, id) \ 87 120 (SHORT1FROMMR(WinSendDlgItemMsg((hwnd), (id), BM_QUERYCHECK, MPNULL, MPNULL))) 121 */ 88 122 89 123 #define winhSetMenuItemChecked(hwndMenu, usId, bCheck) \ … … 94 128 WinShowWindow(WinWindowFromID(hwnd, id), show) 95 129 96 #define winhEnableDlgItem(hwndDlg, ulId, Enable) \ 130 // made these functions V0.9.12 (2001-05-18) [umoeller] 131 /* #define winhEnableDlgItem(hwndDlg, ulId, Enable) \ 97 132 WinEnableWindow(WinWindowFromID(hwndDlg, ulId), Enable) 98 99 133 #define winhIsDlgItemEnabled(hwndDlg, ulId) \ 100 134 WinIsWindowEnabled(WinWindowFromID(hwndDlg, ulId)) 135 */ 101 136 102 137 #define winhSetDlgItemFocus(hwndDlg, ulId) \ … … 113 148 /* ****************************************************************** 114 149 * 150 * Generics 151 * 152 ********************************************************************/ 153 154 BOOL XWPENTRY winhSetDlgItemChecked(HWND hwnd, SHORT id, SHORT bCheck); 155 156 SHORT XWPENTRY winhIsDlgItemChecked(HWND hwnd, SHORT id); 157 158 BOOL XWPENTRY winhEnableDlgItem(HWND hwndDlg, SHORT id, BOOL fEnable); 159 160 BOOL XWPENTRY winhIsDlgItemEnabled(HWND hwndDlg, SHORT id); 161 162 /* ****************************************************************** 163 * 115 164 * Menu helpers 116 165 * 117 166 ********************************************************************/ 167 168 #ifdef INCL_WINMENUS 169 BOOL XWPENTRY winhQueryMenuItem(HWND hwndMenu, 170 USHORT usItemID, 171 BOOL fSearchSubmenus, 172 PMENUITEM pmi); 173 #endif 118 174 119 175 /* … … 772 828 773 829 ULONG XWPENTRY winhResetWPS(HAB hab); 830 774 831 #endif 775 832 -
trunk/src/helpers/dosh.c
r64 r69 230 230 } 231 231 return (pszReturn); 232 } 233 234 /* 235 *@@ doshQuerySysUptime: 236 * returns the system uptime in milliseconds. 237 * This can be used for time comparisons. 238 * 239 *@@added V0.9.12 (2001-05-18) [umoeller] 240 */ 241 242 ULONG doshQuerySysUptime(VOID) 243 { 244 ULONG ulms; 245 DosQuerySysInfo(QSV_MS_COUNT, 246 QSV_MS_COUNT, 247 &ulms, 248 sizeof(ulms)); 249 return (ulms); 232 250 } 233 251 -
trunk/src/helpers/dosh2.c
r67 r69 1115 1115 1116 1116 /* 1117 *@@ ParseBldLevel: 1118 * called from doshExecQueryBldLevel to parse 1119 * the BLDLEVEL string. 1120 * 1121 * On entry, caller has copied the string into 1122 * pExec->pszDescription. The string is 1123 * null-terminated. 1124 * 1125 * The BLDLEVEL string comes in two flavors. 1126 * 1127 * -- The standard format is: 1128 * 1129 + @#VENDOR:VERSION#@DESCRIPTION 1130 * 1131 * DESCRIPTION can have leading spaces, but 1132 * need to have them. 1133 * 1134 * -- However, there is an extended version 1135 * in that the DESCRIPTION field is split 1136 * up even more. The marker for this seems 1137 * to be that the description starts out 1138 * with "##1##". 1139 * 1140 + ##1## DATETIME BUILDMACHINE:ASD:LANG:CTRY:REVISION:UNKNOWN:FIXPAK@@DESCRIPTION 1141 * 1142 * The problem is that the DATETIME field comes 1143 * in several flavors. IBM uses things like 1144 * 1145 + "Thu Nov 30 15:30:37 2000 BWBLD228" 1146 * 1147 * while DANIS506.ADD has 1148 * 1149 + "15.12.2000 18:22:57 Nachtigall" 1150 * 1151 * Looks like the date/time string is standardized 1152 * to have 24 characters then. 1153 * 1154 *@@added V0.9.12 (2001-05-18) [umoeller] 1155 *@@changed V0.9.12 (2001-05-19) [umoeller]: added extended BLDLEVEL support 1156 */ 1157 1158 VOID ParseBldLevel(PEXECUTABLE pExec) 1159 { 1160 const char *pStartOfAuthor = 0, 1161 *pStartOfVendor = 0; 1162 1163 // @#VENDOR:VERSION#@ DESCRIPTION 1164 // but skip the first byte, which has the string length 1165 pStartOfVendor = strstr(pExec->pszDescription, 1166 "@#"); 1167 if (pStartOfVendor) 1168 { 1169 const char *pStartOfInfo = strstr(pStartOfVendor + 2, 1170 "#@"); 1171 if (pStartOfInfo) 1172 { 1173 const char *pEndOfVendor = strchr(pStartOfVendor + 2, 1174 ':'); 1175 if (pEndOfVendor) 1176 { 1177 pExec->pszVendor = strhSubstr(pStartOfVendor + 2, 1178 pEndOfVendor); 1179 pExec->pszVersion = strhSubstr(pEndOfVendor + 1, 1180 pStartOfInfo); 1181 // skip "@#" in DESCRIPTION string 1182 pStartOfInfo += 2; 1183 1184 // now check if we have extended DESCRIPTION V0.9.12 (2001-05-19) [umoeller] 1185 if ( (strlen(pStartOfInfo) > 6) 1186 && (!memcmp(pStartOfInfo, "##1##", 5)) 1187 ) 1188 { 1189 // yes: parse that beast 1190 const char *p = pStartOfInfo + 5; 1191 1192 // get build date/time 1193 if (strlen(p) > 24) 1194 { 1195 // date/time seems to be fixed 24 chars in length 1196 pExec->pszBuildDateTime = (PSZ)malloc(25); 1197 if (pExec->pszBuildDateTime) 1198 { 1199 memcpy(pExec->pszBuildDateTime, 1200 p, 1201 24); 1202 pExec->pszBuildDateTime[24] = '\0'; 1203 1204 p += 24; 1205 1206 // now we're at the colon-separated 1207 // strings, first of which is the 1208 // build machine; 1209 // skip leading spaces 1210 while (*p == ' ') 1211 p++; 1212 1213 if (*p) 1214 { 1215 char **papsz[] = 1216 { 1217 &pExec->pszBuildMachine, 1218 &pExec->pszASD, 1219 &pExec->pszLanguage, 1220 &pExec->pszCountry, 1221 &pExec->pszRevision, 1222 &pExec->pszUnknown, 1223 &pExec->pszFixpak 1224 }; 1225 ULONG ul; 1226 1227 for (ul = 0; 1228 ul < sizeof(papsz) / sizeof(papsz[0]); 1229 ul++) 1230 { 1231 BOOL fStop = FALSE; 1232 const char *pNextColon = strchr(p, ':'), 1233 *pDoubleAt = strstr(p, "@@"); 1234 if (!pNextColon) 1235 { 1236 // last item: 1237 if (pDoubleAt) 1238 pNextColon = pDoubleAt; 1239 else 1240 pNextColon = p + strlen(p); 1241 1242 fStop = TRUE; 1243 } 1244 1245 if ( (fStop) 1246 || ( (pNextColon) 1247 && ( (!pDoubleAt) 1248 || (pNextColon < pDoubleAt) 1249 ) 1250 ) 1251 ) 1252 { 1253 if (pNextColon > p + 1) 1254 *(papsz[ul]) = strhSubstr(p, pNextColon); 1255 } 1256 else 1257 break; 1258 1259 if (fStop) 1260 break; 1261 1262 p = pNextColon + 1; 1263 } 1264 } 1265 } 1266 } 1267 1268 pStartOfInfo = strstr(p, 1269 "@@"); 1270 if (pStartOfInfo) 1271 pStartOfInfo += 2; 1272 } 1273 1274 // -- if we had no extended DESCRIPTION, 1275 // pStartOfInfo points to regular description now 1276 // -- if we parse the extended DESCRIPTION above, 1277 // pStartOfInfo points to after @@ now 1278 // -- if we had an error, pStartOfInfo is NULL 1279 if (pStartOfInfo) 1280 { 1281 // add the regular DESCRIPTION then 1282 // skip leading spaces in info string 1283 while (*pStartOfInfo == ' ') 1284 pStartOfInfo++; 1285 if (*pStartOfInfo) // V0.9.9 (2001-04-04) [umoeller] 1286 // and copy until end of string 1287 pExec->pszInfo = strdup(pStartOfInfo); 1288 } 1289 } 1290 } 1291 } 1292 } 1293 1294 /* 1117 1295 *@@ doshExecQueryBldLevel: 1118 1296 * this retrieves buildlevel information for an … … 1168 1346 *@@changed V0.9.1 (99-12-06): fixed memory leak 1169 1347 *@@changed V0.9.9 (2001-04-04) [umoeller]: added more error checking 1348 *@@changed V0.9.12 (2001-05-18) [umoeller]: extracted ParseBldLevel 1170 1349 */ 1171 1350 … … 1243 1422 else 1244 1423 { 1245 const char *pStartOfAuthor = 0,1246 *pStartOfVendor = 0;1247 1248 1424 memcpy(pExec->pszDescription, 1249 1425 pszNameTable + 1, // skip length byte … … 1252 1428 *(pExec->pszDescription + (*pszNameTable)) = 0; 1253 1429 1254 // now parse the damn thing: 1255 // @#VENDOR:VERSION#@ DESCRIPTION 1256 // but skip the first byte, which has the string length 1257 pStartOfVendor = strstr(pExec->pszDescription, 1258 "@#"); 1259 if (pStartOfVendor) 1260 { 1261 const char *pStartOfInfo = strstr(pStartOfVendor + 2, 1262 "#@"); 1263 if (pStartOfInfo) 1264 { 1265 PSZ pEndOfVendor = strchr(pStartOfVendor + 2, 1266 ':'); 1267 if (pEndOfVendor) 1268 { 1269 pExec->pszVendor = strhSubstr(pStartOfVendor + 2, 1270 pEndOfVendor); 1271 pExec->pszVersion = strhSubstr(pEndOfVendor + 1, 1272 pStartOfInfo); 1273 // skip "@#" in info string 1274 pStartOfInfo += 2; 1275 // skip leading spaces in info string 1276 while (*pStartOfInfo == ' ') 1277 pStartOfInfo++; 1278 if (*pStartOfInfo) // V0.9.9 (2001-04-04) [umoeller] 1279 // and copy until end of string 1280 pExec->pszInfo = strdup(pStartOfInfo); 1281 } 1282 } 1283 } 1430 ParseBldLevel(pExec); 1284 1431 } 1285 1432 } -
trunk/src/helpers/stringh.c
r56 r69 1115 1115 *@@ strhBeautifyTitle: 1116 1116 * replaces all line breaks (0xd, 0xa) with spaces. 1117 * 1118 *@@changed V0.9.12 (2001-05-17) [pr]: multiple line break chars. end up as only 1 space 1117 1119 */ 1118 1120 … … 1120 1122 { 1121 1123 BOOL rc = FALSE; 1122 CHAR *p; 1123 while ((p = strchr(psz, 0xa))) 1124 { 1125 *p = ' '; 1126 rc = TRUE; 1127 } 1128 while ((p = strchr(psz, 0xd))) 1129 { 1130 *p = ' '; 1131 rc = TRUE; 1132 } 1124 CHAR *p = psz; 1125 1126 while(*p) 1127 if ( (*p == '\r') 1128 || (*p == '\n') 1129 ) 1130 { 1131 rc = TRUE; 1132 if ( (p != psz) 1133 && (p[-1] == ' ') 1134 ) 1135 memmove(p, p + 1, strlen(p)); 1136 else 1137 *p++ = ' '; 1138 } 1139 else 1140 p++; 1141 1133 1142 return (rc); 1134 1143 } -
trunk/src/helpers/timer.c
r68 r69 443 443 PXTIMER pTimer = (PXTIMER)pTimerNode->pItemData; 444 444 445 if (pTimer->ulNextFire < ulTimeNow) 445 if ( (pTimer) 446 && (pTimer->ulNextFire < ulTimeNow) 447 ) 446 448 { 447 449 // this timer has elapsed: -
trunk/src/helpers/winh.c
r62 r69 57 57 #define INCL_WINPROGRAMLIST 58 58 #define INCL_WINSWITCHLIST 59 #define INCL_WINBUTTONS 59 60 #define INCL_WINMENUS 60 61 #define INCL_WINSCROLLBARS … … 88 89 89 90 /* 91 *@@category: Helpers\PM helpers\Wrappers 92 */ 93 94 /* ****************************************************************** 95 * 96 * Wrappers 97 * 98 ********************************************************************/ 99 100 #ifdef WINH_STANDARDWRAPPERS 101 102 /* 103 *@@ winhSendMsg: 104 * wrapper for WinSendMsg. 105 * 106 * If WINH_STANDARDWRAPPERS is #defined before 107 * including win.h, all WinSendMsg calls are 108 * redefined to use this wrapper instead. This 109 * reduces the amount of external fixups required 110 * for loading the module. 111 * 112 *@@added V0.9.12 (2001-05-18) [umoeller] 113 */ 114 115 MRESULT winhSendMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 116 { 117 // put the call in brackets so the macro won't apply here 118 return ((WinSendMsg)(hwnd, msg, mp1, mp2)); 119 } 120 121 /* 122 *@@ winhPostMsg: 123 * wrapper for WinPostMsg. 124 * 125 * If WINH_STANDARDWRAPPERS is #defined before 126 * including win.h, all WinSendMsg calls are 127 * redefined to use this wrapper instead. This 128 * reduces the amount of external fixups required 129 * for loading the module. 130 * 131 *@@added V0.9.12 (2001-05-18) [umoeller] 132 */ 133 134 BOOL winhPostMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 135 { 136 // put the call in brackets so the macro won't apply here 137 return ((WinPostMsg)(hwnd, msg, mp1, mp2)); 138 } 139 140 /* 141 *@@ winhWindowFromID: 142 * 143 *@@added V0.9.12 (2001-05-18) [umoeller] 144 */ 145 146 HWND winhWindowFromID(HWND hwnd, ULONG id) 147 { 148 // put the call in brackets so the macro won't apply here 149 return ((WinWindowFromID)(hwnd, id)); 150 } 151 152 /* 153 *@@ winhQueryWindow: 154 * 155 *@@added V0.9.12 (2001-05-18) [umoeller] 156 */ 157 158 HWND winhQueryWindow(HWND hwnd, LONG lCode) 159 { 160 // put the call in brackets so the macro won't apply here 161 return ((WinQueryWindow)(hwnd, lCode)); 162 } 163 164 #endif // WINH_STANDARDWRAPPERS 165 166 /* 90 167 *@@category: Helpers\PM helpers\Rectangle helpers 91 168 */ … … 119 196 120 197 /* 198 *@@category: Helpers\PM helpers\Generics 199 */ 200 201 /* ****************************************************************** 202 * 203 * Generics 204 * 205 ********************************************************************/ 206 207 /* 208 *@@ winhSetDlgItemChecked: 209 * checks a check box. 210 * 211 * This has been turned into a real function 212 * because this is used hundreds of times in 213 * XWP, and each WinSendDlgItemMsg in each 214 * macro produced a fixup relocation record. 215 * 216 *@@added V0.9.12 (2001-05-18) [umoeller] 217 */ 218 219 BOOL winhSetDlgItemChecked(HWND hwnd, // in: dialog 220 SHORT id, // in: dialog item ID 221 SHORT bCheck) // in: 0, 1, or (for tri-state) 2 222 { 223 return ((BOOL)WinSendDlgItemMsg(hwnd, 224 id, 225 BM_SETCHECK, 226 MPFROMSHORT(bCheck), 227 MPNULL)); 228 } 229 230 /* 231 *@@ winhIsDlgItemChecked: 232 * returns the current check state of the 233 * specified check box, which can be 0, 1, 234 * or (for tri-state checkboxes) 2. 235 * 236 *@@added V0.9.12 (2001-05-18) [umoeller] 237 */ 238 239 SHORT winhIsDlgItemChecked(HWND hwnd, // in: dialog 240 SHORT id) // in: dialog item ID 241 { 242 return (SHORT1FROMMR(WinSendDlgItemMsg(hwnd, 243 id, 244 BM_QUERYCHECK, 245 MPNULL, 246 MPNULL))); 247 } 248 249 /* 250 *@@ winhEnableDlgItem: 251 * 252 *@@added V0.9.12 (2001-05-18) [umoeller] 253 */ 254 255 BOOL winhEnableDlgItem(HWND hwndDlg, 256 SHORT id, 257 BOOL fEnable) 258 { 259 return (WinEnableWindow(WinWindowFromID(hwndDlg, id), fEnable)); 260 } 261 262 /* 263 *@@ winhIsDlgItemEnabled: 264 * 265 *@@added V0.9.12 (2001-05-18) [umoeller] 266 */ 267 268 BOOL winhIsDlgItemEnabled(HWND hwndDlg, 269 SHORT id) 270 { 271 return (WinIsWindowEnabled(WinWindowFromID(hwndDlg, id))); 272 } 273 274 275 /* 121 276 *@@category: Helpers\PM helpers\Menu helpers 122 277 */ … … 127 282 * 128 283 ********************************************************************/ 284 285 /* 286 *@@ winhQueryMenuItem: 287 * wrapper around MM_QUERYITEM. 288 * 289 *@@added V0.9.12 (2001-05-18) [umoeller] 290 */ 291 292 BOOL winhQueryMenuItem(HWND hwndMenu, 293 USHORT usItemID, 294 BOOL fSearchSubmenus, 295 PMENUITEM pmi) // out: MENUITEM data 296 { 297 return ((BOOL)WinSendMsg(hwndMenu, 298 MM_QUERYITEM, 299 MPFROM2SHORT(usItemID, fSearchSubmenus), 300 (MPARAM)pmi)); 301 } 129 302 130 303 /* … … 1525 1698 // which considers this inclusive! 1526 1699 LONG ulViewportPels, // in: total viewport dimension, 1527 // into which *p lCurPelsOfs is an offset1700 // into which *pulCurPelsOfs is an offset 1528 1701 USHORT usLineStepPels, // in: pixels to scroll line-wise 1529 1702 // (scroll bar buttons pressed) … … 1602 1775 if (*pulCurPelsOfs > (lMaxAllowedUnitOfs * usScrollUnitPels)) 1603 1776 { 1604 // _Pmpf((" !!! limiting 2: %d to %d", *plCurUnitOfs, lMaxAllowedUnitOfs));1605 1777 *pulCurPelsOfs = (lMaxAllowedUnitOfs * usScrollUnitPels); 1606 1778 }
Note:
See TracChangeset
for help on using the changeset viewer.