VirtualBox

source: kStuff/trunk/include/k/kHlpString.h@ 121

Last change on this file since 121 was 29, checked in by bird, 15 years ago

Finally got around execute the switch to the MIT license.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 5.0 KB
Line 
1/* $Id: kHlpString.h 29 2009-07-01 20:30:29Z bird $ */
2/** @file
3 * kHlpString - String And Memory Routines.
4 */
5
6/*
7 * Copyright (c) 2006-2007 Knut St. Osmundsen <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31#ifndef ___k_kHlpString_h___
32#define ___k_kHlpString_h___
33
34#include <k/kHlpDefs.h>
35#include <k/kTypes.h>
36
37#if 0 /* optimize / fix this later */
38#ifdef __GNUC__
39/** memchr */
40# define kHlpMemChr(a,b,c) __builtin_memchr(a,b,c)
41/** memcmp */
42# define kHlpMemComp(a,b,c) __builtin_memcmp(a,b,c)
43/** memcpy */
44# define kHlpMemCopy(a,b,c) __builtin_memcpy(a,b,c)
45/** memset */
46# define kHlpMemSet(a,b,c) __builtin_memset(a,b,c)
47/** strchr */
48# define kHlpStrChr(a, b) __builtin_strchr(a, b)
49/** strcmp */
50# define kHlpStrComp(a, b) __builtin_strcmp(a, b)
51/** strncmp */
52# define kHlpStrNComp(a,b,c) __builtin_strncmp(a, b, c)
53/** strlen */
54# define kHlpStrLen(a) __builtin_strlen(a)
55
56#elif defined(_MSC_VER)
57# pragma intrinsic(memcmp, memcpy, memset, strcmp, strlen)
58/** memcmp */
59# define kHlpMemComp(a,b,c) memcmp(a,b,c)
60/** memcpy */
61# define kHlpMemCopy(a,b,c) memcpy(a,b,c)
62/** memset */
63# define kHlpMemSet(a,b,c) memset(a,b,c)
64/** strcmp */
65# define kHlpStrComp(a, b) strcmp(a, b)
66/** strlen */
67# define kHlpStrLen(a) strlen(a)
68#else
69# error "Port Me"
70#endif
71#endif /* disabled */
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77#ifndef kHlpMemChr
78KHLP_DECL(void *) kHlpMemChr(const void *pv, int ch, KSIZE cb);
79#endif
80#ifndef kHlpMemComp
81KHLP_DECL(int) kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb);
82#endif
83#ifndef kHlpMemComp
84KHLP_DECL(void *) kHlpMemPComp(const void *pv1, const void *pv2, KSIZE cb);
85#endif
86#ifndef kHlpMemCopy
87KHLP_DECL(void *) kHlpMemCopy(void *pv1, const void *pv2, KSIZE cb);
88#endif
89#ifndef kHlpMemPCopy
90KHLP_DECL(void *) kHlpMemPCopy(void *pv1, const void *pv2, KSIZE cb);
91#endif
92#ifndef kHlpMemMove
93KHLP_DECL(void *) kHlpMemMove(void *pv1, const void *pv2, KSIZE cb);
94#endif
95#ifndef kHlpMemPMove
96KHLP_DECL(void *) kHlpMemPMove(void *pv1, const void *pv2, KSIZE cb);
97#endif
98#ifndef kHlpMemSet
99KHLP_DECL(void *) kHlpMemSet(void *pv1, int ch, KSIZE cb);
100#endif
101#ifndef kHlpMemPSet
102KHLP_DECL(void *) kHlpMemPSet(void *pv1, int ch, KSIZE cb);
103#endif
104KHLP_DECL(int) kHlpMemICompAscii(const void *pv1, const void *pv2, KSIZE cb);
105
106#ifndef kHlpStrCat
107KHLP_DECL(char *) kHlpStrCat(char *psz1, const char *psz2);
108#endif
109#ifndef kHlpStrPCat
110KHLP_DECL(char *) kHlpStrPCat(char *psz1, const char *psz2);
111#endif
112#ifndef kHlpStrNCat
113KHLP_DECL(char *) kHlpStrNCat(char *psz1, const char *psz2, KSIZE cb);
114#endif
115#ifndef kHlpStrPNCat
116KHLP_DECL(char *) kHlpStrNPCat(char *psz1, const char *psz2, KSIZE cb);
117#endif
118#ifndef kHlpStrChr
119KHLP_DECL(char *) kHlpStrChr(const char *psz, int ch);
120#endif
121#ifndef kHlpStrRChr
122KHLP_DECL(char *) kHlpStrRChr(const char *psz, int ch);
123#endif
124#ifndef kHlpStrComp
125KHLP_DECL(int) kHlpStrComp(const char *psz1, const char *psz2);
126#endif
127KHLP_DECL(char *) kHlpStrPComp(const char *psz1, const char *psz2);
128#ifndef kHlpStrNComp
129KHLP_DECL(int) kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch);
130#endif
131KHLP_DECL(char *) kHlpStrNPComp(const char *psz1, const char *psz2, KSIZE cch);
132KHLP_DECL(int) kHlpStrICompAscii(const char *pv1, const char *pv2);
133KHLP_DECL(char *) kHlpStrIPCompAscii(const char *pv1, const char *pv2);
134KHLP_DECL(int) kHlpStrNICompAscii(const char *pv1, const char *pv2, KSIZE cch);
135KHLP_DECL(char *) kHlpStrNIPCompAscii(const char *pv1, const char *pv2, KSIZE cch);
136#ifndef kHlpStrCopy
137KHLP_DECL(char *) kHlpStrCopy(char *psz1, const char *psz2);
138#endif
139#ifndef kHlpStrPCopy
140KHLP_DECL(char *) kHlpStrPCopy(char *psz1, const char *psz2);
141#endif
142#ifndef kHlpStrLen
143KHLP_DECL(KSIZE) kHlpStrLen(const char *psz1);
144#endif
145#ifndef kHlpStrNLen
146KHLP_DECL(KSIZE) kHlpStrNLen(const char *psz, KSIZE cchMax);
147#endif
148
149KHLP_DECL(char *) kHlpInt2Ascii(char *psz, KSIZE cch, long lVal, unsigned iBase);
150
151#ifdef __cplusplus
152}
153#endif
154
155#endif
156
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette