|
X11workbench Toolkit
1.0
|
Definition file for platform-specific utility functions. More...
#include <stdarg.h>#include <stdint.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/Xmd.h>#include <X11/Xatom.h>#include <pthread.h>#include "X11workbenchToolkit_install_config.h"Go to the source code of this file.
Data Structures | |
| struct | tagXPM_ATTRIBUTES |
| Compatibility structure for use with MyLoadPixmapFromData() whenever libXpm is not in use. More... | |
Macros | |
| #define | INVALID_HANDLE_VALUE |
| INVALID HANDLE VALUE equivalent. More... | |
| #define | HAS_WB_UINT64_BUILTIN |
| defined whenever the 'WB_UINT64' data type is a 'built in' data type | |
| #define | WB_C99_INITIALIZERS /* allow C99-style initializers */ |
| Defined in 'platform_helper.h' when the compiler supports C99 initializers. | |
| #define | __PACKED__ /* platform dependent; actual def must be a blank or doxygen barphs on it */ |
| PACKED definition. More... | |
| #define | XPM_CREATE_PIXMAP_FROM_DATA(A, B, C, D, E, F) MyLoadPixmapFromData(A,B,C,D,E,F) |
| Platform helper macro to create a pixmap from data. More... | |
| #define | XPM_FREE_ATTRIBUTES(pAttr) /* does nothing */ |
| Platform helper macro to free XPM_ATTRIBUTES filled in by XPM_CREATE_PIXMAP_FROM_DATA() More... | |
| #define | NEXT_WORD(pX, pY, pZ) {while(*(pX) && *(pX) <= ' '){(pX)++;} (pY)=(pZ)=(pX); while(*(pX)>' '){(pX)++;} (pZ)=(pX);} |
| Obtain the 'next word' within a string pointed to by pX, bounded by pY and pZ. More... | |
| #define | FALSE 0 |
| #define | TRUE !0 |
| #define | DECLARE_SORT_FUNCTION(fn_name, p0, p1, p2) int fn_name(void *p0, const void *p1, const void *p2) |
| Wrapper to declare a sort function for QSORT_R. More... | |
| #define | QSORT_R(base, nmemb, size, thunk, compar) my_qsort_r((base),(nmemb),(size),(thunk),(compar)) |
| Local implementation of qsort_r() for operating systems that do not have it. More... | |
| #define | WB_FILE_HANDLE int |
| #define | WB_PROCESS_ID unsigned int |
| #define | WB_INVALID_FILE_HANDLE -1 |
| #define | WB_STRINGIZE(X) WB_STRINGIZE_INTERNAL(X) |
| stringize a macro argument More... | |
| #define | WB_STRINGIZE_INTERNAL(X) #X |
| helper to stringize a macro argument | |
| #define | WB_UNLIKELY(x) (__builtin_expect (!!(x), 0)) |
| optimization for code branching when condition is 'unlikely'. use within conditionals More... | |
| #define | WB_LIKELY(x) (__builtin_expect (!!(x), 1)) |
| optimization for code branching when condition is 'likely'. use within conditionals More... | |
| #define | WB_UNUSED __attribute__((unused)) |
| marks a variable as likely to be 'unused'. warning abatement. Place macro directly after the variable name More... | |
| #define | WB_INTERNAL_ATOM_MIN_VAL 0x3f000000L |
| The minimum 'internal' Atom value used by the toolkit. More... | |
| #define | WB_SECURE_HASH_TIMEOUT 60000 |
Typedefs | |
| typedef int | WB_INT32 |
| Platform abstract 32-bit integer. More... | |
| typedef unsigned int | WB_UINT32 |
| Platform abstract unsigned 32-bit integer. More... | |
| typedef long long | WB_INT64 |
| Platform abstract 64-bit integer. More... | |
| typedef unsigned long long | WB_UINT64 |
| Platform abstract unsigned 64-bit integer. More... | |
| typedef unsigned long long | WB_UINTPTR |
| Platform abstract unsigned integer that matches pointer size. More... | |
| typedef void * | WB_MODULE |
| MODULE HANDLE equivalent. More... | |
| typedef pthread_t | WB_THREAD |
| THREAD HANDLE equivalent. More... | |
| typedef void(* | WB_PROCADDRESS) (void) |
| PROC ADDRESS equivalent. More... | |
| typedef pthread_key_t | WB_THREAD_KEY |
| THREAD LOCAL STORAGE 'key' equivalent. More... | |
| typedef WB_UINT32 | WB_COND |
| CONDITION HANDLE equivalent (similar to an 'event') More... | |
| typedef pthread_mutex_t | WB_MUTEX |
| MUTEX HANDLE equivalent. More... | |
| typedef struct tagXPM_ATTRIBUTES | XPM_ATTRIBUTES |
| Compatibility structure for use with MyLoadPixmapFromData() whenever libXpm is not in use. More... | |
| typedef char * | WB_PSTR |
| pointer to char string - a convenience typedef | |
| typedef const char * | WB_PCSTR |
| pointer to const char string - a convenience typedef | |
Functions | |
| void | __internal_startup_display (const char *szVal) |
| void | __internal_startup_minimize (void) |
| void | __internal_startup_maximize (void) |
| void | __internal_startup_geometry (const char *szVal) |
| void | __internal_disable_antialias (void) |
| void | __internal_disable_imagecache (void) |
| void | WBPlatformOnInit (void) |
| Resource initialization on startup. More... | |
| void | WBPlatformOnExit (void) |
| Resource 'free-up' on exit (must call) More... | |
| int | WBMain (int argc, char *argv[], char *envp[]) |
| Startup function, equivalent to 'main()' - provided for convenience. More... | |
| void | WBUsage (void) |
| Optional startup function, sends 'usage' (help) info to stderr - application-defined function. More... | |
| int | WBParseStandardArguments (int *pargc, char ***pargv, char ***penvp) |
| parses standard C arguments as passed to 'main()' More... | |
| void | WBToolkitUsage (void) |
| Displays 'usage' for toolkit options to stderr. More... | |
| const char * | GetStartupAppName (void) |
| returns a pointer to a copy of the application name from argv[0] More... | |
| WB_UINT64 | WBGetTimeIndex (void) |
| Returns the current 'time index' (in microseconds) More... | |
| void | WBDelay (uint32_t uiDelay) |
| Delay for a specified period in microseconds. More... | |
| int | WBCPUCount (void) |
| Get the number of available CPU cores. More... | |
| void * | WBAlloc (int nSize) |
| High performance memory sub-allocator 'allocate'. More... | |
| void | WBFree (void *pBuf) |
| High performance memory sub-allocator 'free'. More... | |
| int | WBAllocUsableSize (void *pBuf) |
| High performance memory sub-allocator, similar to 'malloc_usable_size'. More... | |
| void * | WBReAlloc (void *pBuf, int nNewSize) |
| High performance memory sub-allocator 're-allocate'. More... | |
| void | WBSubAllocTrashMasher (void) |
| High performance memory sub-allocator 'trash masher' - call periodically to minimize wasted memory. More... | |
| char * | WBCopyString (const char *pSrc) |
| A simple utility that returns a WBAlloc() copy of a 0-byte terminated string. More... | |
| char * | WBCopyStringN (const char *pSrc, unsigned int nMaxChars) |
| A simple utility that returns a WBAlloc() copy of a string up to a maximum length (can also be 0-byte terminated) More... | |
| void | WBCatString (char **ppDest, const char *pSrc) |
| A simple utility that concatenates a string onto the end of a 0-byte terminated WBAlloc() string. More... | |
| void | WBCatStringN (char **ppDest, const char *pSrc, unsigned int nMaxChars) |
| A simple utility that concatenates a string onto the end of a 0-byte terminated WBAlloc() string up to a maximum length (can also be 0-byte terminated) More... | |
| void | WBDeQuoteString (char *pszStr) |
| De-Quote a string 'in place', that is modifying the original string by removing quotes. More... | |
| void | WBNormalizeXMLString (char *pString) |
| De-Quote and 'normalize' an XML string 'in place', that is modifying the original string by removing quotes and translationg things like '&' '>' etc. More... | |
| int | WBStringLineCount (const char *pSrc, unsigned int nMaxChars) |
| Determine how many 'lines' are in a block of text by counting 'linefeed' characters. More... | |
| const char * | WBStringNextLine (const char *pSrc, unsigned int *pnMaxChars) |
| Locate the next line in a block of text, returning its pointer (and updating remaining length) More... | |
| int | MyLoadPixmapFromData (Display *pDisplay, Window wID, char *aData[], Pixmap *pPixmap, Pixmap *pMask, XPM_ATTRIBUTES *pAttr) |
| Alternate for XpmCreatePixmapFromData() whenever libXpm is not being used. More... | |
| void | my_qsort_r (void *base, int nmemb, int size, void *thunk, int(*compar)(void *, const void *, const void *)) |
| Local implementation of qsort_r() for operating systems that do not have it. More... | |
| WB_UINT32 | WBCreatePointerHash (void *pPointer) |
| Create/obtain a 32-bit 'secure' hash for a pointer. More... | |
| void | WBDestroyPointerHash (WB_UINT32 uiHash) |
| Destroy a 32-bit 'secure' hash for a pointer. More... | |
| void | WBDestroyPointerHashPtr (void *pPointer) |
| Destroy a 32-bit 'secure' hash for a pointer regardless of reference count. More... | |
| void * | WBGetPointerFromHash (WB_UINT32 uiHash) |
| Obtain a pointer from a 32-bit 'secure' pointer hash value. More... | |
| Atom | WBGetAtom (Display *pDisplay, const char *szAtomName) |
| Lookup and/or allocate an internal Atom for a named string (lookups include X11 atoms) More... | |
| Atom | WBLookupAtom (Display *pDisplay, const char *szAtomName) |
| Lookup (but do not allocate) an internal (or X11) Atom for a named string. More... | |
| char * | WBGetAtomName (Display *pDisplay, Atom aAtom) |
| Lookup and/or allocate an internal Atom for a named string. More... | |
| int | WBMkDir (const char *szFileName, int flags) |
| a wrapper for 'mkdir' that makes directories recursively (as needed) More... | |
| char * | WBSearchPath (const char *szFileName) |
| search for a file using the PATH environment variable More... | |
| char * | WBTempFile (const char *szExt) |
| Get the name for a new, unique temporary file, creating the file in the process, and save its name for later deletion. More... | |
| char * | WBTempFile0 (const char *szExt) |
| Get the name for a new, unique temporary file, creating the file in the process. More... | |
| WB_PROCESS_ID | WBRunAsync (const char *szAppName,...) |
| Run an application asynchronously. More... | |
| int | WBGetProcessState (WB_PROCESS_ID idProcess, WB_INT32 *pExitCode) |
| Check on a running process, and return its state, and optionally the exit code. More... | |
| char * | WBRunResult (const char *szAppName,...) |
| Run an application synchronously, returning 'stdout' output in a character buffer. More... | |
| char * | WBRunResultWithInput (const char *szStdInBuf, const char *szAppName,...) |
| Run an application synchronously, supplying an input buffer for 'stdin', and returning 'stdout' output in a character buffer. More... | |
| WB_PROCESS_ID | WBRunAsyncPipe (WB_FILE_HANDLE hStdIn, WB_FILE_HANDLE hStdOut, WB_FILE_HANDLE hStdErr, const char *szAppName,...) |
| Run an application asynchronously, specifying file handles for STDIN, STDOUT, and STDERR. More... | |
| WB_PROCESS_ID | WBRunAsyncPipeV (WB_FILE_HANDLE hStdIn, WB_FILE_HANDLE hStdOut, WB_FILE_HANDLE hStdErr, const char *szAppName, va_list va) |
| Run an application asynchronously, specifying file handles for STDIN, STDOUT, and STDERR, using a va_list for the program's parameters. More... | |
| WB_MODULE | WBLoadLibrary (const char *szModuleName) |
| Loads a shared library, DLL, module, or whatever you call it on your operating system. More... | |
| void | WBFreeLibrary (WB_MODULE hModule) |
| Frees a shared library, DLL, module, or whatever, that was loaded via 'WBLoadLibrary()'. More... | |
| WB_PROCADDRESS | WBGetProcAddress (WB_MODULE hModule, const char *szProcName) |
| Obtains a function pointer for an exported function symbol in a shared library (or DLL) More... | |
| void * | WBGetDataAddress (WB_MODULE hModule, const char *szDataName) |
| Obtains a data pointer for an exported data symbol in a shared library (or DLL) More... | |
| WB_THREAD_KEY | WBThreadAllocLocal (void) |
| Allocate 'thread local' storage. More... | |
| void | WBThreadFreeLocal (WB_THREAD_KEY keyVal) |
| Free 'thread local' storage allocated by WBThreadAllocLocal() More... | |
| void * | WBThreadGetLocal (WB_THREAD_KEY keyVal) |
| Get 'thread local' data identified by 'keyVal'. More... | |
| void | WBThreadSetLocal (WB_THREAD_KEY keyVal, void *pValue) |
| Get 'thread local' data identified by 'keyVal'. More... | |
| WB_THREAD | WBThreadGetCurrent (void) |
| Get 'current thread' identifier. More... | |
| WB_THREAD | WBThreadCreate (void *(*function)(void *), void *pParam) |
| Create a new thread, returning its WB_THREAD identifier. More... | |
| void * | WBThreadWait (WB_THREAD hThread) |
| Wait for a specified threat to exit. More... | |
| int | WBThreadRunning (WB_THREAD hThread) |
| Determine whether a thread is running (can be suspended) More... | |
| void | WBThreadExit (void *pRval) |
| Exit the current thread immediately, specifying return code. More... | |
| void | WBThreadClose (WB_THREAD hThread) |
| Close the specified WB_THREAD identifier. More... | |
| int | WBCondCreate (WB_COND *pCond) |
| Create a signallable condition. More... | |
| int | WBMutexCreate (WB_MUTEX *pMtx) |
| Create a lockable mutex. More... | |
| void | WBCondFree (WB_COND *pCond) |
| Free a signallable condition. More... | |
| void | WBMutexFree (WB_MUTEX *pMtx) |
| Free a lockable mutex. More... | |
| int | WBMutexLock (WB_MUTEX *pMtx, int nTimeout) |
| Wait for and lock a mutex, blocking until it is available. More... | |
| int | WBMutexUnlock (WB_MUTEX *pMtx) |
| Unlock a previously locked mutex. More... | |
| int | WBCondSignal (WB_COND *pCond) |
| Signal a condition (event) More... | |
| int | WBCondWait (WB_COND *pCond, int nTimeout) |
| Wait for a signal on a condition (event) More... | |
| int | WBCondWaitMutex (WB_COND *pCond, WB_MUTEX *pMtx, int nTimeout) |
| Wait for a signal on a condition (event) More... | |
| WB_UINT32 | WBInterlockedDecrement (volatile WB_UINT32 *pValue) |
| Interlocked 'atomic' decrement of an unsigned integer. More... | |
| WB_UINT32 | WBInterlockedIncrement (volatile WB_UINT32 *pValue) |
| Interlocked 'atomic' increment of an unsigned integer. More... | |
| WB_UINT32 | WBInterlockedExchange (volatile WB_UINT32 *pValue, WB_UINT32 nNewVal) |
| Interlocked 'atomic' exchange of an unsigned integer with a specified value. More... | |
| WB_UINT32 | WBInterlockedRead (volatile WB_UINT32 *pValue) |
| Interlocked 'atomic' read of an unsigned integer. More... | |
| int | WBPrintPostScriptFile (const char *szPrinterName, const char *szFileName) |
| Send postscript file to a printer (using lpr-cups or lpr on POSIX systems) More... | |
| char * | WBGetPrinterList (void) |
| Get a list of printer names. More... | |
Variables | |
| int | bQuitFlag |
| 'Quit' Flag - you should check this periodically in your main (message) loop and exit whenever it is TRUE (non-zero) More... | |
Definition file for platform-specific utility functions.
This file contains definitions, stubs, workarounds, and any kind of platform-specific wrapper function or locally implemented library definition that is needed to make this system work on a given platform.
Definition in file platform_helper.h.