[5] | 1 |
|
---|
| 2 | /*
|
---|
| 3 | *@@setup.h:
|
---|
| 4 | * common include file for _all_ XWorkplace code
|
---|
| 5 | * files (src\main and src\helpers) which defines
|
---|
| 6 | * common flags for debugging etc.
|
---|
| 7 | *
|
---|
| 8 | * If this file is changed, this will cause the
|
---|
| 9 | * makefiles to recompile _all_ XWorkplace sources,
|
---|
| 10 | * because this is included will all source files.
|
---|
| 11 | *
|
---|
| 12 | * Include this _after_ os2.h and standard C includes
|
---|
| 13 | * (stdlib.h et al), but _before_ any project includes,
|
---|
| 14 | * because this modifies some standard definitions.
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 | #ifdef SETUP_HEADER_INCLUDED
|
---|
| 18 | #error setup.h included twice.
|
---|
| 19 | #else
|
---|
| 20 | #define SETUP_HEADER_INCLUDED
|
---|
| 21 |
|
---|
| 22 | /*************************************************************
|
---|
| 23 | *
|
---|
| 24 | * API wrappers
|
---|
| 25 | *
|
---|
| 26 | *************************************************************/
|
---|
| 27 |
|
---|
| 28 | // All these have been added with V0.9.12 (2001-05-18) [umoeller].
|
---|
| 29 | // If you run into trouble with these in one of your code files,
|
---|
| 30 | // after including setup.h, #undef the respective flag.
|
---|
| 31 |
|
---|
| 32 | // enable wrappers in include\helpers\winh.h
|
---|
| 33 | #define WINH_STANDARDWRAPPERS
|
---|
| 34 | // and include\helpers\dosh.h
|
---|
| 35 | #define DOSH_STANDARDWRAPPERS
|
---|
| 36 |
|
---|
| 37 | /*************************************************************
|
---|
| 38 | *
|
---|
| 39 | * Page tuning
|
---|
| 40 | *
|
---|
| 41 | *************************************************************/
|
---|
| 42 |
|
---|
| 43 | // stdlib; doesn't work right now... should we include
|
---|
| 44 | // setup.h before any stdlib headers?
|
---|
| 45 | #pragma alloc_text(FREQ_CODE1, strlen)
|
---|
| 46 | #pragma alloc_text(FREQ_CODE1, strdup)
|
---|
| 47 | #pragma alloc_text(FREQ_CODE1, free)
|
---|
| 48 | #pragma alloc_text(FREQ_CODE1, malloc)
|
---|
| 49 | #pragma alloc_text(FREQ_CODE1, strcmp)
|
---|
| 50 | #pragma alloc_text(FREQ_CODE1, memcpy)
|
---|
| 51 |
|
---|
| 52 | // dosh.c
|
---|
| 53 | #pragma alloc_text(FREQ_CODE1, doshSleep)
|
---|
| 54 | #pragma alloc_text(FREQ_CODE1, doshRequestMutexSem)
|
---|
| 55 | #pragma alloc_text(FREQ_CODE1, doshSetExceptionHandler)
|
---|
| 56 | #pragma alloc_text(FREQ_CODE1, doshUnsetExceptionHandler)
|
---|
| 57 | #pragma alloc_text(FREQ_CODE1, PerformMatch)
|
---|
| 58 | #pragma alloc_text(FREQ_CODE1, doshMatch)
|
---|
| 59 | #pragma alloc_text(FREQ_CODE1, doshQuerySysUptime)
|
---|
| 60 |
|
---|
| 61 | // winh.c
|
---|
| 62 | #pragma alloc_text(FREQ_CODE1, winhRequestMutexSem)
|
---|
| 63 |
|
---|
| 64 | // common.c
|
---|
| 65 | #pragma alloc_text(FREQ_CODE1, cmnQuerySetting)
|
---|
| 66 | #pragma alloc_text(FREQ_CODE1, cmnGetString)
|
---|
| 67 |
|
---|
| 68 | /*
|
---|
| 69 | * functions used with wpQueryIcon and
|
---|
| 70 | * extended associations
|
---|
| 71 | *
|
---|
| 72 | */
|
---|
| 73 |
|
---|
| 74 | // linklist.c
|
---|
| 75 | #pragma alloc_text(FREQ_CODE1, lstInit)
|
---|
| 76 | #pragma alloc_text(FREQ_CODE1, lstCreate)
|
---|
| 77 | #pragma alloc_text(FREQ_CODE1, lstQueryFirstNode)
|
---|
| 78 | #pragma alloc_text(FREQ_CODE1, lstCountItems)
|
---|
| 79 | #pragma alloc_text(FREQ_CODE1, lstNodeFromIndex)
|
---|
| 80 | #pragma alloc_text(FREQ_CODE1, lstNodeFromItem)
|
---|
| 81 | #pragma alloc_text(FREQ_CODE1, lstAppendItem)
|
---|
| 82 | #pragma alloc_text(FREQ_CODE1, lstClear)
|
---|
| 83 | #pragma alloc_text(FREQ_CODE1, lstFree)
|
---|
| 84 |
|
---|
| 85 | // tree.c
|
---|
| 86 | #pragma alloc_text(FREQ_CODE1, treeFind)
|
---|
| 87 | #pragma alloc_text(FREQ_CODE1, treeCompareKeys)
|
---|
| 88 | #pragma alloc_text(FREQ_CODE1, treeCompareStrings)
|
---|
| 89 |
|
---|
| 90 | // object.c
|
---|
| 91 | #pragma alloc_text(FREQ_CODE1, LockHandlesCache)
|
---|
| 92 | #pragma alloc_text(FREQ_CODE1, UnlockHandlesCache)
|
---|
| 93 | #pragma alloc_text(FREQ_CODE1, objFindObjFromHandle)
|
---|
| 94 |
|
---|
| 95 | // xfdataf.c
|
---|
| 96 | #pragma alloc_text(FREQ_CODE1, xdf_wpQueryIcon)
|
---|
| 97 | #pragma alloc_text(FREQ_CODE1, xdf_wpQueryAssociatedProgram)
|
---|
| 98 | #pragma alloc_text(FREQ_CODE1, xdf_wpQueryAssociatedFileIcon)
|
---|
| 99 |
|
---|
| 100 | // filetype.c
|
---|
| 101 | #pragma alloc_text(FREQ_CODE1, prfhQueryKeysForApp)
|
---|
| 102 | #pragma alloc_text(FREQ_CODE1, prfhQueryProfileData)
|
---|
| 103 |
|
---|
| 104 | #pragma alloc_text(FREQ_CODE1, ListAssocsForType)
|
---|
| 105 |
|
---|
| 106 | #pragma alloc_text(FREQ_CODE1, ftypLockCaches)
|
---|
| 107 | #pragma alloc_text(FREQ_CODE1, ftypUnlockCaches)
|
---|
| 108 | #pragma alloc_text(FREQ_CODE1, ftypQueryAssociatedProgram)
|
---|
| 109 | #pragma alloc_text(FREQ_CODE1, ftypBuildAssocsList)
|
---|
| 110 |
|
---|
| 111 | #pragma alloc_text(FREQ_CODE1, ftypFreeAssocsList)
|
---|
| 112 |
|
---|
| 113 | #pragma alloc_text(FREQ_CODE1, FindWPSTypeAssoc)
|
---|
| 114 | #pragma alloc_text(FREQ_CODE1, strhSubstr)
|
---|
| 115 |
|
---|
| 116 | #pragma alloc_text(FREQ_CODE1, AppendSingleTypeUnique)
|
---|
| 117 | #pragma alloc_text(FREQ_CODE1, AppendTypesFromString)
|
---|
| 118 | #pragma alloc_text(FREQ_CODE1, AppendTypesForFile)
|
---|
| 119 | #pragma alloc_text(FREQ_CODE1, GetCachedTypesWithFilters)
|
---|
| 120 |
|
---|
| 121 | /*
|
---|
| 122 | * functions used with exe icons
|
---|
| 123 | *
|
---|
| 124 | */
|
---|
| 125 |
|
---|
| 126 | #pragma alloc_text(FREQ_CODE2, xpgf_wpSetProgIcon)
|
---|
| 127 | #pragma alloc_text(FREQ_CODE2, doshGetExtension)
|
---|
| 128 |
|
---|
| 129 | #pragma alloc_text(FREQ_CODE2, krnLock)
|
---|
| 130 | #pragma alloc_text(FREQ_CODE2, krnUnlock)
|
---|
| 131 |
|
---|
| 132 | #pragma alloc_text(FREQ_CODE2, icoLoadICOFile)
|
---|
| 133 | #pragma alloc_text(FREQ_CODE2, doshOpen )
|
---|
| 134 | #pragma alloc_text(FREQ_CODE2, doshReadAt)
|
---|
| 135 | #pragma alloc_text(FREQ_CODE2, doshQueryPathSize )
|
---|
| 136 | #pragma alloc_text(FREQ_CODE2, doshQueryFileSize )
|
---|
| 137 | #pragma alloc_text(FREQ_CODE2, icoBuildPtrHandle )
|
---|
| 138 | #pragma alloc_text(FREQ_CODE2, doshLockFile)
|
---|
| 139 | #pragma alloc_text(FREQ_CODE2, doshUnlockFile)
|
---|
| 140 | #pragma alloc_text(FREQ_CODE2, doshClose )
|
---|
| 141 |
|
---|
| 142 | #pragma alloc_text(FREQ_CODE2, exehOpen)
|
---|
| 143 | #pragma alloc_text(FREQ_CODE2, exehClose)
|
---|
| 144 |
|
---|
| 145 | #pragma alloc_text(FREQ_CODE2, doshAllocArray)
|
---|
| 146 |
|
---|
| 147 | #pragma alloc_text(FREQ_CODE2, exehLoadLXMaps )
|
---|
| 148 | #pragma alloc_text(FREQ_CODE2, exehFreeLXMaps)
|
---|
| 149 |
|
---|
| 150 | #pragma alloc_text(FREQ_CODE2, GetOfsFromPageTableIndex)
|
---|
| 151 | #pragma alloc_text(FREQ_CODE2, ExpandIterdata1)
|
---|
| 152 | #pragma alloc_text(FREQ_CODE2, ExpandIterdata2)
|
---|
| 153 | #pragma alloc_text(FREQ_CODE2, memcpyb)
|
---|
| 154 | #pragma alloc_text(FREQ_CODE2, memcpyw)
|
---|
| 155 | #pragma alloc_text(FREQ_CODE2, exehReadLXPage )
|
---|
| 156 |
|
---|
| 157 | #pragma alloc_text(FREQ_CODE2, exehLoadLXResource )
|
---|
| 158 |
|
---|
| 159 | #pragma alloc_text(FREQ_CODE2, ConvertWinIcon)
|
---|
| 160 | #pragma alloc_text(FREQ_CODE2, LoadWinNEResource )
|
---|
| 161 |
|
---|
| 162 | // skipping OS2 NE (too rare)
|
---|
| 163 | // todo: LoadWinPEResource
|
---|
| 164 |
|
---|
| 165 | #pragma alloc_text(FREQ_CODE2, xpgf_xwpQueryProgType)
|
---|
| 166 | #pragma alloc_text(FREQ_CODE2, progQueryProgType)
|
---|
| 167 |
|
---|
| 168 | #pragma alloc_text(FREQ_CODE2, progFindIcon)
|
---|
| 169 |
|
---|
| 170 | #pragma alloc_text(FREQ_CODE2, icoLoadExeIcon)
|
---|
| 171 |
|
---|
| 172 | #pragma alloc_text(FREQ_CODE2, LockIcons)
|
---|
| 173 | #pragma alloc_text(FREQ_CODE2, UnlockIcons)
|
---|
| 174 | #pragma alloc_text(FREQ_CODE2, cmnGetStandardIcon)
|
---|
| 175 |
|
---|
| 176 | /*************************************************************
|
---|
| 177 | *
|
---|
| 178 | * Feature selections
|
---|
| 179 | *
|
---|
| 180 | *************************************************************/
|
---|
| 181 |
|
---|
| 182 | // This section describes what features can be disabled
|
---|
| 183 | // selectively. The source code reacts to those #defines.
|
---|
| 184 |
|
---|
| 185 | #ifdef __XWPLITE__
|
---|
| 186 | #include "features_lite.h"
|
---|
| 187 | #endif
|
---|
| 188 |
|
---|
| 189 | /*************************************************************
|
---|
| 190 | *
|
---|
| 191 | * Debug info setup
|
---|
| 192 | *
|
---|
| 193 | *************************************************************/
|
---|
| 194 |
|
---|
| 195 | /*
|
---|
| 196 | * The following #define's determine whether additional debugging
|
---|
| 197 | * info will be compiled into xfldr.dll.
|
---|
| 198 | *
|
---|
| 199 | * 1) The general DONTDEBUGATALL flag will disable all other
|
---|
| 200 | * debugging flags, if defined. DONTDEBUGATALL gets set
|
---|
| 201 | * automatically if __DEBUG__ is not defined (that is,
|
---|
| 202 | * if DEBUG is disabled in setup.in).
|
---|
| 203 | *
|
---|
| 204 | * Alternatively, set DONTDEBUGATALL explicitly here to
|
---|
| 205 | * disable the debugging flags completely. Of course, that
|
---|
| 206 | * does not affect compiler options.
|
---|
| 207 | *
|
---|
| 208 | * 2) If DONTDEBUGATALL is not set (i.e. if we're in debug mode),
|
---|
| 209 | * the various flags below are taken into account. Note that
|
---|
| 210 | * many of these are from very old XFolder versions, and
|
---|
| 211 | * I cannot guarantee that these will compile any more.
|
---|
| 212 | */
|
---|
| 213 |
|
---|
| 214 | // disable debugging if debug code is off
|
---|
| 215 | #ifndef __DEBUG__
|
---|
| 216 | #define DONTDEBUGATALL
|
---|
| 217 | #endif
|
---|
| 218 |
|
---|
| 219 | // or set it here explicitly even though debugging is on:
|
---|
| 220 | // #define DONTDEBUGATALL
|
---|
| 221 |
|
---|
| 222 | #ifndef DONTDEBUGATALL
|
---|
| 223 |
|
---|
| 224 | // If the following is commented out, no PMPRINTF will be
|
---|
| 225 | // used at all. XWorkplace uses Dennis Bareis' PMPRINTF
|
---|
| 226 | // package to do this.
|
---|
| 227 |
|
---|
| 228 | // **** IMPORTANT NOTE: if you use this flag, you _must_
|
---|
| 229 | // have the PMPRINTF DLLs somewhere on your LIBPATH, or
|
---|
| 230 | // otherwise XFLDR.DLL cannot be loaded, because the imports
|
---|
| 231 | // will fail. That is, XWorkplace classes can neither be registered
|
---|
| 232 | // nor loaded at Desktop startup. This has cost me a lot of thought
|
---|
| 233 | // once, and you'll get no error message, so be warned.
|
---|
| 234 | #define _PMPRINTF_
|
---|
| 235 |
|
---|
| 236 | // The following replaces the SOMMethodDebug macros with
|
---|
| 237 | // a PMPRINTF version. This leads to a LOT of output for
|
---|
| 238 | // each SOM method called from all the XWorkplace files and
|
---|
| 239 | // slows down the system _very_ much if the PMPRINTF output
|
---|
| 240 | // wnd is open.
|
---|
| 241 | // #define DEBUG_SOMMETHODS
|
---|
| 242 |
|
---|
| 243 | // the following will show a dumb message box when XWPSetup
|
---|
| 244 | // is opened to check whether all classes have properly
|
---|
| 245 | // registered themselves in THREADGLOBALS
|
---|
| 246 | // #define DEBUG_XWPSETUP_CLASSES
|
---|
| 247 |
|
---|
| 248 | // the following writes xfldtrap.log even for "quiet"
|
---|
| 249 | // exceptions, i.e. those handled by excHandlerQuiet
|
---|
| 250 | // #define DEBUG_WRITEQUIETEXCPT
|
---|
| 251 |
|
---|
| 252 | // The following printfs about folder context menus.
|
---|
| 253 | // #define DEBUG_CONTEXT
|
---|
| 254 |
|
---|
| 255 | // the following allows debug mode for XShutdown, which
|
---|
| 256 | // will be enabled by holding down SHIFT while selecting
|
---|
| 257 | // "Shutdown..." from the desktop context menu. In addition,
|
---|
| 258 | // you'll get some PMPRINTF info and beeps
|
---|
| 259 | // #define DEBUG_SHUTDOWN
|
---|
| 260 |
|
---|
| 261 | // the following beeps when thread priorities change
|
---|
| 262 | // #define DEBUG_PRIORITY
|
---|
| 263 |
|
---|
| 264 | // the following printf's each added awake object
|
---|
| 265 | // #define DEBUG_AWAKEOBJECTS
|
---|
| 266 |
|
---|
| 267 | // the following gives information on ordered folder content
|
---|
| 268 | // (sorting by .ICONPOS etc.)
|
---|
| 269 | // #define DEBUG_ORDEREDLIST
|
---|
| 270 |
|
---|
| 271 | // the following displays internal status bar data
|
---|
| 272 | // #define DEBUG_STATUSBARS
|
---|
| 273 |
|
---|
| 274 | // the following will printf all kinds of settings
|
---|
| 275 | // notebook information
|
---|
| 276 | // #define DEBUG_SETTINGS
|
---|
| 277 |
|
---|
| 278 | // the following will printf WM_CONTROL for WPS cnrs
|
---|
| 279 | // #define DEBUG_CNRCNTRL
|
---|
| 280 |
|
---|
| 281 | // the following will printf wpAddToContent
|
---|
| 282 | // #define DEBUG_CNRCONTENT
|
---|
| 283 |
|
---|
| 284 | // the following will printf lots of sort info
|
---|
| 285 | // #define DEBUG_SORT
|
---|
| 286 |
|
---|
| 287 | // the following will printf language code queries and
|
---|
| 288 | // NLS DLL evaluation
|
---|
| 289 | // #define DEBUG_LANGCODES
|
---|
| 290 |
|
---|
| 291 | // the following will printf folder/global hotkey info
|
---|
| 292 | // #define DEBUG_KEYS
|
---|
| 293 |
|
---|
| 294 | // the following displays XWorkplace memory usage in the
|
---|
| 295 | // "Object internals" of the Desktop settings; this
|
---|
| 296 | // will produce additional debug code for malloc(),
|
---|
| 297 | // so this better only be used for debugging
|
---|
| 298 | // #define DEBUG_MEMORY
|
---|
| 299 |
|
---|
| 300 | // the following beeps when the Worker thread cleans up
|
---|
| 301 | // the default heap
|
---|
| 302 | // #define DEBUG_MEMORYBEEP
|
---|
| 303 |
|
---|
| 304 | // the following displays a lot of infos about menu
|
---|
| 305 | // processing (msgs), esp. for folder content menus
|
---|
| 306 | // #define DEBUG_MENUS
|
---|
| 307 |
|
---|
| 308 | // debug startup (folder, archives) processing
|
---|
| 309 | // #define DEBUG_STARTUP
|
---|
| 310 |
|
---|
| 311 | // debug title clash dialog
|
---|
| 312 | // #define DEBUG_TITLECLASH
|
---|
| 313 |
|
---|
| 314 | // debug new system sounds
|
---|
| 315 | // #define DEBUG_SOUNDS
|
---|
| 316 |
|
---|
| 317 | // debug data/program file associations/icons
|
---|
| 318 | // #define DEBUG_ASSOCS
|
---|
| 319 |
|
---|
| 320 | // debug folder icon replacements
|
---|
| 321 | // #define DEBUG_FLDRICONS
|
---|
| 322 |
|
---|
| 323 | // debug wpRestoreData and such
|
---|
| 324 | // #define DEBUG_RESTOREDATA
|
---|
| 325 |
|
---|
| 326 | // debug notebook.c callbacks
|
---|
| 327 | // #define DEBUG_NOTEBOOKS
|
---|
| 328 |
|
---|
| 329 | // debug trashcan
|
---|
| 330 | // #define DEBUG_TRASHCAN
|
---|
| 331 |
|
---|
| 332 | // debug Xtimers
|
---|
| 333 | // #define DEBUG_XTIMERS
|
---|
| 334 | #endif
|
---|
| 335 |
|
---|
| 336 | /*************************************************************
|
---|
| 337 | *
|
---|
| 338 | * Common helpers declarations
|
---|
| 339 | *
|
---|
| 340 | *************************************************************/
|
---|
| 341 |
|
---|
| 342 | // XWPEXPORT defines the standard linkage for the
|
---|
| 343 | // XWorkplace helpers.
|
---|
| 344 |
|
---|
| 345 | // VAC:
|
---|
| 346 | #if defined(__IBMC__) || defined(__IBMCPP__)
|
---|
| 347 | #define XWPENTRY _Optlink
|
---|
| 348 | #else
|
---|
| 349 | // EMX or Watcom:
|
---|
| 350 | #define XWPENTRY
|
---|
| 351 | #endif
|
---|
| 352 |
|
---|
| 353 | /********************************************************************
|
---|
| 354 | *
|
---|
| 355 | * Global #include's
|
---|
| 356 | *
|
---|
| 357 | ********************************************************************/
|
---|
| 358 |
|
---|
| 359 | #ifdef OS2_INCLUDED
|
---|
| 360 | // the following reacts to the _PMPRINTF_ macro def'd above;
|
---|
| 361 | // if that's #define'd, _Pmpf(()) commands will produce output,
|
---|
| 362 | // if not, no code will be produced.
|
---|
| 363 | #include "pmprintf.h"
|
---|
| 364 |
|
---|
| 365 | // SOMMethodDebug is the macro defined for all those
|
---|
| 366 | // xxxMethodDebug thingies created by the SOM compiler.
|
---|
| 367 | // If you have uncommended DEBUG_SOMMETHODS above, this
|
---|
| 368 | // will make sure that _Pmpf is used for that. In order
|
---|
| 369 | // for this to work, you'll also need _PMPRINTF_.
|
---|
| 370 | #ifdef SOMMethodDebug
|
---|
| 371 | #undef SOMMethodDebug
|
---|
| 372 | #endif
|
---|
| 373 |
|
---|
| 374 | #ifdef DEBUG_SOMMETHODS
|
---|
| 375 | #define SOMMethodDebug(c,m) _Pmpf(("%s::%s", c,m))
|
---|
| 376 | #else
|
---|
| 377 | #define SOMMethodDebug(c,m) ;
|
---|
| 378 | #endif
|
---|
| 379 | #endif
|
---|
| 380 |
|
---|
| 381 | #define _min(a,b) ( ((a) > (b)) ? b : a )
|
---|
| 382 | #define _max(a,b) ( ((a) > (b)) ? a : b )
|
---|
| 383 |
|
---|
| 384 | // all this added V0.9.2 (2000-03-10) [umoeller]
|
---|
| 385 | #if ( defined ( __IBMCPP__ ) && ( __IBMCPP__ < 400 ) )
|
---|
| 386 | typedef int bool;
|
---|
| 387 | #define true 1
|
---|
| 388 | #define false 0
|
---|
| 389 | #define _BooleanConst // needed for some VAC headers, which define bool also
|
---|
| 390 | #endif
|
---|
| 391 |
|
---|
| 392 | #ifndef __stdlib_h // <stdlib.h>
|
---|
| 393 | #include <stdlib.h>
|
---|
| 394 | #endif
|
---|
| 395 | #ifndef __string_h // <string.h>
|
---|
| 396 | #include <string.h>
|
---|
| 397 | #endif
|
---|
| 398 |
|
---|
| 399 | #ifdef __DEBUG__
|
---|
| 400 | // enable memory debugging; comment out this line
|
---|
| 401 | // if you don't want it
|
---|
| 402 | #define __XWPMEMDEBUG__
|
---|
| 403 |
|
---|
| 404 | #include "helpers\memdebug.h"
|
---|
| 405 | #endif
|
---|
| 406 | #endif
|
---|
| 407 |
|
---|