SUBSYSTEM OVERVIEW
Utility General (UGN) Subsystem
The Utility GN subsystem provides functions for general data manipulation and general utilities.
DATA MANIPULATION
The function ugn_FillByte can be used to set an area of memory to a specified byte value. The function ugn_ZeroByte initializes an area of memory to zero.
The following functions move data between areas of memory:
ugn_MoveByte ugn_MoveShort ugn_MoveInt ugn_MoveLong ugn_MoveFloat ugn_MoveDouble
A set of macros allow inline data moving (thus avoiding the overhead of a function call). These macros have the same names as above except that the portion following the underscore is all uppercase (i.e. ugn_MOVEBYTE is the inline version of ugn_MoveByte). The inline macro versions should only be used if the amount of data to be moved is small or the call is made inside of a tight loop because they do not include the optimizations which the function versions provide.
The following functions swap values between two arrays:
ugn_SwapByte ugn_SwapShort ugn_SwapInt ugn_SwapLong ugn_SwapFloat ugn_SwapDouble
Inline macros of these are available to swap single elements betweeen arrays:
ugn_Swap2Byte ugn_Swap2Short ugn_Swap2Int ugn_Swap2Long ugn_Swap2Float ugn_Swap2Double
FILE UTILITIES
The function ugn_FileExist can be used to check for existance of a file. The function ugn_TempFile can be used to generate a temporary file name.
MISCELLANEOUS UTILITIES
The funcion ugn_GetPID returns the process ID of the current process. The functions ugn_GetMax and ugn_GetMin return the maximium or minimium of two values
ENVIRONMENT VARIABLE ALIASES
An application can establish an alias for environment variables used by the library so that the names used for library environment variables are consistent with those used in the application. This is done by using the function ugn_SetEnvAlias as shown in the following example:
ugn_SetEnvAlias (UGN_NOOPT, "PDELIB_TMP", "APPL_TMPDIR");
Now the location of temporary files can be controlled by setting either the PDELIB_TMP or APPL_TMPDIR environment variables. Note that to obtain the value of an environment variable which has been aliased, a call must be made to ugn_GetEnv rather than getenv. See the manual page for ugn_SetEnvAlias for further information.