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

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

use .cpp. some string fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1/* $Id: kHlpString.h 3546 2007-08-25 17:28:50Z 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 kHlpStrChr
88char *kHlpStrChr(const char *psz, int ch);
89#endif
90#ifndef kHlpStrComp
91int kHlpStrComp(const char *psz1, const char *psz2);
92#endif
93#ifndef kHlpStrNComp
94int kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch);
95#endif
96#ifndef kHlpStrLen
97KSIZE kHlpStrLen(const char *psz1);
98#endif
99KSIZE kHlpStrNLen(const char *psz, KSIZE cchMax);
100int kHlpStrIComp(const char *pv1, const char *pv2);
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif
107
Note: See TracBrowser for help on using the repository browser.