16 #if _MSC_VER == 1400 //VC8
17 #if _SECURE_SCL != 0 || _HAS_ITERATOR_DEBUGGING != 0
18 #error Compiler Flags do not match! Do not use _SECURE_SCL or _HAS_ITERATOR_DEBUGGING
19 #endif // _SECURE_SCL != 0 || _HAS_ITERATOR_DEBUGGING != 0
20 #endif //_MSC_VER == 1400
28 #ifndef VLCONFIG_INCLUDED_H_
55 #include <sys/types.h>
61 #if DT_FD_ZERO_USES_MEMSET
65 #if DT_HAVE_BZERO_PROTO_IN_MEMORY_H
67 #elif DT_HAVE_BZERO_PROTO_IN_CC_LIBC_H
69 #elif DT_HAVE_BZERO_PROTO_IN_BSTRING_H
74 void bzero(
char* b,
int length );
89 #ifdef DtUSE_UTILITIES_NAMESPACE
90 namespace DtUSE_UTILITIES_NAMESPACE
102 #define DtDELETE_VOID(x, cast) \
105 cast* toDelete = reinterpret_cast<cast*>(x); \
112 #define DtISON(a, x) (a & x)
113 #define DtISOFF(a, x) (!DtISON(a, x))
114 #define DtTURNON(a, x) (a |= x)
115 #define DtTURNOFF(a, x) (a &= ~x)
119 #define DtNUMBER(foo) (sizeof(foo)/sizeof(foo[0]))
120 #define DtOFFSET(type, field) ((size_t)&((type *)NULL)->field)
121 #define DtSIZEOF(type, field) sizeof(((type *)NULL)->field)
123 #define DtRGBA_TO_UINT(r, g, b, a) ((((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
127 a = (
unsigned char)(val >> 24) & 0xFF;
128 r = (
unsigned char)(val >> 16) & 0xFF;
129 g = (
unsigned char)(val >> 8) & 0xFF;
130 b = (
unsigned char)(val) & 0xFF;
140 return (
int)ceil( (
float)num / (
float)mult ) * mult;
149 #define DtATOI(s) ((int)(strtoul(s, 0, 0)))
151 #define DtATOI(s) (int)strtol(s, 0, 0)
203 #define DT_8_BIT_MASK(value, bit) (DtU8)((value & ((DtU8)1 << bit)) >>bit)
209 #define DT_SET_8_BIT_MASK(value, bit) (value | ((DtU8)1 << bit) )
216 #define DT_8_BITS_MASK(value, yBits, startBit) (DtU8)((value & ((((DtU8)1 << yBits) -1) <<startBit)) >> startBit )
222 #define DT_16_BIT_MASK(value, bit) (DtU16)((value & ((DtU16)1 << bit)) >> bit)
228 #define DT_SET_16_BIT_MASK(value, bit) (value | ((DtU16)1 << bit) )
235 #define DT_16_BITS_MASK(value, yBits, startBit) (DtU16)((value & ((((DtU16)1 << yBits) -1) <<startBit)) >> startBit )
241 #define DT_32_BIT_MASK(value, bit) (DtU32)((value & ((DtU32)1 << bit)) >> bit)
247 #define DT_SET_32_BIT_MASK(value, bit) (value | ((DtU32)1 << bit) )
264 if ( fd >= 0 ) closesocket( fd );
271 if ( fd >= 0 ) close( fd );
290 return DtSelect( maxfd+1, &read, NULL, NULL, timeout );
294 FD_SET( (
unsigned int)fd, &read0 );
295 maxfd =
DtMax( maxfd, fd );
299 FD_CLR( (
unsigned int)fd, &read0 );
304 return ( (
int)( FD_ISSET( (
unsigned int)fd, &read ) ) );
369 if (alignment > 1 && value != (value&alignMask))
385 return reinterpret_cast<void*
>(
alignValue(value, alignment));
390 return reinterpret_cast<void*
>(
alignValue(value, alignment));
401 padding = (~value)+1;
402 padding &= (alignment-1);
420 #if DT_NO_CASECOMPARE
421 DT_DLL_VLUTIL int strcasecmp(
const char* strA,
const char* strB );
447 #define DT_VXWORKS_APP(name) \
448 int main(int argc, char** argv); \
449 int name(char* cmdLine) \
451 return realMain(DtArgc(cmdLine), DtArgv(cmdLine)); \
457 unsigned char * ptr,
unsigned int bytes );
460 #ifdef DtUSE_UTILITIES_NAMESPACE
void DtDecimalToBinary(const DtU32 value, std::vector< int > &binVal)
Get the 32-bit binary value of a passed in decimal integer.
DtString DtToLower(const char *)
This function returns a new lowercase DtString.
Definition: vlStringUtil.h:180
DtU32 DtIpv4Addr
Definition: vlUtil.h:330
void DtUINT_TO_RGBA(unsigned int val, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a)
Definition: vlUtil.h:125
fd_set read
Definition: vlUtil.h:310
int select(DtTime timeout)
Definition: vlUtil.h:287
int DtIsInList(const int *lst, int num)
Returns -1 if num is not in lst.
This file contains the declaration of DtClock and DtTime.
T DtMax(T x, T y)
Returns what ever is greater, x or y of type T.
Definition: vlUtil.h:157
DtMachineSize alignedPtrPadding(const void *ptr, DtMachineSize alignment)
Return the # padding bytes necessary to align the given pointer to the given byte alignment (in bytes...
Definition: vlUtil.h:409
int maxfd
Definition: vlUtil.h:308
void addRead(int fd)
Definition: vlUtil.h:292
const DtIpv4Addr loopbackAddr
Definition: vlUtil.h:336
DtIpv4Addr DtStringToInetAddr(const char *str)
Converts to internet dot notation to ulong in host order.
void printHexToStream(std::ostream &stream, unsigned int numberOfColumns, unsigned char *ptr, unsigned int bytes)
Prints Hex to a stream based on an address and the bytes.
int DtArgc(char *cmdLine)
Convert a command line (single string with args separated by spaces) to argv, argc format...
const char * DtInetAddrString(DtIpv4Addr addr)
Converts ulong to internet dot notation (returns internal static buffer).
int DtSelect(int n, fd_set *i, fd_set *o, fd_set *e, DtTime t)
DtString DtBinaryToHex(const std::string &s)
Get the hex value of a passed in 32-bit binary value.
const void * alignPtr(const void *ptr, DtMachineSize alignment)
Adjust the given pointer to the given byte alignment (in bytes)
Definition: vlUtil.h:382
char * DtStrdup(const char *str)
Strdup wrapper.
DtMachineSize alignValue(DtMachineSize value, DtMachineSize alignment)
Adjust the given value to the nearest multiple of the given alignment Efficient means to determine by...
Definition: vlUtil.h:364
int canRead(int fd)
Definition: vlUtil.h:302
DtIpv4Addr DtHexStringToInetAddr(const char *str)
Converts to internet dot notation to ulong in host order.
char * DtDeg2DmsString(double val, char *buff, int prec)
DtString DtToUpper(const char *)
This function returns a new uppercase DtString.
Definition: vlStringUtil.h:194
int DtGetPid()
Returns the process ID for the running process.
void delRead(int fd)
Definition: vlUtil.h:297
int DtResizeString(char *&buf, int &oldLn, int newLn)
For VXWORKS.
char ** DtArgv(char *cmdLine, int *argc=NULL)
DtMachineSize alignedPadding(DtMachineSize value, DtMachineSize alignment)
Return the adjustment necessary to align the given value to the given alignment Efficient means to de...
Definition: vlUtil.h:395
DtSelectParam()
Definition: vlUtil.h:281
const DtIpv4Addr DtInetAddrAny
Definition: vlUtil.h:333
DtString DtHexToBinary(const std::string &s, int sLength=0)
Get the 32-bit binary value of a passed in hex value.
int DtBinaryToDecimal(const std::string &s)
Get the decimal value given a binary value.
const char * DtOperatingSystem()
Returns the platform we're running on.
unsigned long DtU32
A 32 bit unsigned integer value.
Definition: vlMachineTypes.h:153
void DtClose(int &fd)
Definition: vlUtil.h:269
Instances of DtString are used to represent strings.
Definition: vlString.h:29
fd_set read0
Definition: vlUtil.h:309
const char * DtCompiler()
Returns the compiler.
int DtROUND_TO_MULT(int num, int mult)
Rounds num up to a multiple of mult.
Definition: vlUtil.h:138
int DtGetPPid()
Returns the process ID for the parent of the running process.
DtU32 DtMachineSize
A type that represents the addressing size.
Definition: vlMachineTypes.h:197
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109
T DtMin(T x, T y)
Returns the which ever is lesser, x or y of type T.
Definition: vlUtil.h:165
void bzero(char *b, int length)
Need bzero.