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

Last change on this file since 3550 was 3550, checked in by bird, 18 years ago

made kDbg compile again (not linking yet though).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1/* $Id: kHlpString.h 3550 2007-08-26 01:13:35Z bird $ */
2/** @file
3 * kHlpString - String And Memory Routines.
4 */
5
6/*
7 * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
8 *
9 * This file is part of kStuff.
10 *
11 * kStuff is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * kStuff is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with kStuff; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#ifndef ___k_kHlpString_h___
28#define ___k_kHlpString_h___
29
30#if 0 /* optimize / fix this later */
31#ifdef __GNUC__
32/** memchr */
33# define kHlpMemChr(a,b,c) __builtin_memchr(a,b,c)
34/** memcmp */
35# define kHlpMemComp(a,b,c) __builtin_memcmp(a,b,c)
36/** memcpy */
37# define kHlpMemCopy(a,b,c) __builtin_memcpy(a,b,c)
38/** memset */
39# define kHlpMemSet(a,b,c) __builtin_memset(a,b,c)
40/** strchr */
41# define kHlpStrChr(a, b) __builtin_strchr(a, b)
42/** strcmp */
43# define kHlpStrComp(a, b) __builtin_strcmp(a, b)
44/** strncmp */
45# define kHlpStrNComp(a,b,c) __builtin_strncmp(a, b, c)
46/** strlen */
47# define kHlpStrLen(a) __builtin_strlen(a)
48
49#elif defined(_MSC_VER)
50# pragma intrinsic(memcmp, memcpy, memset, strcmp, strlen)
51/** memcmp */
52# define kHlpMemComp(a,b,c) memcmp(a,b,c)
53/** memcpy */
54# define kHlpMemCopy(a,b,c) memcpy(a,b,c)
55/** memset */
56# define kHlpMemSet(a,b,c) memset(a,b,c)
57/** strcmp */
58# define kHlpStrComp(a, b) strcmp(a, b)
59/** strlen */
60# define kHlpStrLen(a) strlen(a)
61#else
62# error "Port Me"
63#endif
64#endif /* disabled */
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70#ifndef kHlpMemChr
71void *kHlpMemChr(const void *pv, int ch, KSIZE cb);
72#endif
73#ifndef kHlpMemComp
74int kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb);
75#endif
76#ifndef kHlpMemCopy
77void *kHlpMemCopy(void *pv1, const void *pv2, KSIZE cb);
78#endif
79#ifndef kHlpMemMove
80void *kHlpMemMove(void *pv1, const void *pv2, KSIZE cb);
81#endif
82#ifndef kHlpMemSet
83void *kHlpMemSet(void *pv1, int ch, KSIZE cb);
84#endif
85int kHlpMemIComp(const void *pv1, const void *pv2, KSIZE cb);
86
87#ifndef kHlpStrCat
88char *kHlpStrCat(char *psz1, const char *psz2);
89#endif
90#ifndef kHlpStrNCat
91char *kHlpStrNCat(char *psz1, const char *psz2, KSIZE cb);
92#endif
93#ifndef kHlpStrChr
94char *kHlpStrChr(const char *psz, int ch);
95#endif
96#ifndef kHlpStrRChr
97char *kHlpStrRChr(const char *psz, int ch);
98#endif
99#ifndef kHlpStrComp
100int kHlpStrComp(const char *psz1, const char *psz2);
101#endif
102#ifndef kHlpStrNComp
103int kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch);
104#endif
105#ifndef kHlpStrCopy
106char *kHlpStrCopy(char *psz1, const char *psz2);
107#endif
108#ifndef kHlpStrNCopy
109char *kHlpStrNCopy(char *psz1, const char *psz2, KSIZE cb);
110#endif
111#ifndef kHlpStrLen
112KSIZE kHlpStrLen(const char *psz1);
113#endif
114KSIZE kHlpStrNLen(const char *psz, KSIZE cchMax);
115int kHlpStrIComp(const char *pv1, const char *pv2);
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif
122
Note: See TracBrowser for help on using the repository browser.