1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_STRING_H
|
---|
8 | #define CR_STRING_H
|
---|
9 |
|
---|
10 | #include <iprt/cdefs.h>
|
---|
11 | #include <iprt/types.h>
|
---|
12 |
|
---|
13 | RT_C_DECLS_BEGIN
|
---|
14 |
|
---|
15 | DECLEXPORT(char *) crStrdup( const char *str );
|
---|
16 | DECLEXPORT(char *) crStrndup( const char *str, unsigned int len );
|
---|
17 | DECLEXPORT(int) crStrlen( const char *str );
|
---|
18 | DECLEXPORT(int) crStrcmp( const char *str1, const char *str2 );
|
---|
19 | DECLEXPORT(int) crStrncmp( const char *str1, const char *str2, int n );
|
---|
20 | DECLEXPORT(int) crStrcasecmp( const char *str1, const char *str2 );
|
---|
21 | DECLEXPORT(void) crStrcpy( char *dst, const char *src );
|
---|
22 | DECLEXPORT(void) crStrncpy( char *dst, const char *src, unsigned int len );
|
---|
23 | DECLEXPORT(void) crStrcat( char *dst, const char *src );
|
---|
24 | DECLEXPORT(char *) crStrjoin( const char *src1, const char *src2 );
|
---|
25 | DECLEXPORT(char *) crStrjoin3( const char *src1, const char *src2, const char *src3 );
|
---|
26 | DECLEXPORT(char *) crStrstr( const char *str, const char *pat );
|
---|
27 | DECLEXPORT(char *) crStrchr( const char *str, char c );
|
---|
28 | DECLEXPORT(char *) crStrrchr( const char *str, char c );
|
---|
29 | DECLEXPORT(int) crStrToInt( const char *str );
|
---|
30 | DECLEXPORT(float) crStrToFloat( const char *str );
|
---|
31 | DECLEXPORT(char **) crStrSplit( const char *str, const char *splitstr );
|
---|
32 | DECLEXPORT(char **) crStrSplitn( const char *str, const char *splitstr, int n );
|
---|
33 | DECLEXPORT(void) crFreeStrings( char **strings );
|
---|
34 | DECLEXPORT(char *) crStrIntersect( const char *s1, const char *s2 );
|
---|
35 | DECLEXPORT(int) crIsDigit( char c );
|
---|
36 |
|
---|
37 | DECLEXPORT(void) crBytesToString( char *string, int nstring, void *data, int ndata );
|
---|
38 | DECLEXPORT(void) crWordsToString( char *string, int nstring, void *data, int ndata );
|
---|
39 |
|
---|
40 | #define CR_GLVERSION_OFFSET_MAJOR (24)
|
---|
41 | #define CR_GLVERSION_OFFSET_MINOR (16)
|
---|
42 | #define CR_GLVERSION_OFFSET_BUILD (0)
|
---|
43 |
|
---|
44 | #define CR_GLVERSION_MAX_MAJOR (0x7f)
|
---|
45 | #define CR_GLVERSION_MAX_MINOR (0xff)
|
---|
46 | #define CR_GLVERSION_MAX_BUILD (0xffff)
|
---|
47 |
|
---|
48 | #define CR_GLVERSION_MASK_MAJOR (CR_GLVERSION_MAX_MAJOR << CR_GLVERSION_OFFSET_MAJOR)
|
---|
49 | #define CR_GLVERSION_MASK_MINOR (CR_GLVERSION_MAX_MINOR << CR_GLVERSION_OFFSET_MINOR)
|
---|
50 | #define CR_GLVERSION_MASK_BUILD (CR_GLVERSION_MAX_BUILD << CR_GLVERSION_OFFSET_BUILD)
|
---|
51 |
|
---|
52 | #define CR_GLVERSION_COMPOSE_EL(_val, _type) (((_val) << CR_GLVERSION_OFFSET_##_type) & CR_GLVERSION_MASK_##_type)
|
---|
53 |
|
---|
54 | #define CR_GLVERSION_COMPOSE(_maj, _min, _build) (CR_GLVERSION_COMPOSE_EL((_maj), MAJOR) \
|
---|
55 | + CR_GLVERSION_COMPOSE_EL((_min), MINOR) \
|
---|
56 | + CR_GLVERSION_COMPOSE_EL((_build), BUILD))
|
---|
57 |
|
---|
58 | #define CR_GLVERSION_GET_EL(_val, _type) (((_val) & CR_GLVERSION_MASK_##_type) >> CR_GLVERSION_OFFSET_##_type)
|
---|
59 | #define CR_GLVERSION_GET_MAJOR(_val) CR_GLVERSION_GET_EL((_val), MAJOR)
|
---|
60 | #define CR_GLVERSION_GET_MINOR(_val) CR_GLVERSION_GET_EL((_val), MINOR)
|
---|
61 | #define CR_GLVERSION_GET_BUILD(_val) CR_GLVERSION_GET_EL((_val), BUILD)
|
---|
62 |
|
---|
63 | DECLEXPORT(int) crStrParseGlVersion(const char * ver);
|
---|
64 | DECLEXPORT(int32_t) crStrParseI32(const char *pszStr, const int32_t defaultVal);
|
---|
65 | RT_C_DECLS_END
|
---|
66 |
|
---|
67 | #endif /* CR_STRING_H */
|
---|