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

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

Helpers and macros.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1/* $Id: kHlpString.h 3545 2007-08-25 17:15:18Z 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#ifdef __cplusplus
31extern "C" {
32#endif
33
34#ifdef __GNUC__
35/** memchr */
36# define kHlpMemChr(a,b,c) __builtin_memchr(a,b,c)
37/** memcmp */
38# define kHlpMemComp(a,b,c) __builtin_memcmp(a,b,c)
39/** memcpy */
40# define kHlpMemCopy(a,b,c) __builtin_memcpy(a,b,c)
41/** memset */
42# define kHlpMemSet(a,b,c) __builtin_memset(a,b,c)
43/** strchr */
44# define kHlpStrChr(a, b) __builtin_strchr(a, b)
45/** strcmp */
46# define kHlpStrComp(a, b) __builtin_strcmp(a, b)
47/** strncmp */
48# define kHlpStrNComp(a,b,c) __builtin_strncmp(a, b, c)
49/** strlen */
50# define kHlpStrLen(a) __builtin_strlen(a)
51
52#elif defined(_MSC_VER)
53# pragma intrinsic(memcmp, memcpy, memset, strcmp, strlen)
54/** memcmp */
55# define kHlpMemComp(a,b,c) memcmp(a,b,c)
56/** memcpy */
57# define kHlpMemCopy(a,b,c) memcpy(a,b,c)
58/** memset */
59# define kHlpMemSet(a,b,c) memset(a,b,c)
60/** strcmp */
61# define kHlpStrComp(a, b) strcmp(a, b)
62/** strlen */
63# define kHlpStrLen(a) strlen(a)
64#else
65# error "Port Me"
66#endif
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72#ifndef kHlpMemChr
73void *kHlpMemChr(const void *pv, int ch, KSIZE cb);
74#endif
75#ifndef kHlpMemComp
76int kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb);
77#endif
78#ifndef kHlpMemCopy
79void *kHlpMemMopy(void *pv1, const void *pv2, KSIZE cb);
80#endif
81#ifndef kHlpMemMove
82void *kHlpMemMove(void *pv1, const void *pv2, KSIZE cb);
83#endif
84#ifndef kHlpMemSet
85void *kHlpMemSet(void *pv1, int ch, KSIZE cb);
86#endif
87int kHlpMemIComp(const void *pv1, const void *pv2, KSIZE cb);
88
89#ifndef kHlpStrChr
90char *kHlpStrChr(const char *psz, int ch);
91#endif
92#ifndef kHlpStrComp
93int kHlpStrComp(const char *psz1, const char *psz2);
94#endif
95#ifndef kHlpStrNComp
96int kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch);
97#endif
98#ifndef kHlpStrLen
99KSIZE kHlpStrLen(const char *psz1);
100#endif
101KSIZE kHlpStrNLen(const char *psz, KSIZE cchMax);
102int kHlpStrIComp(const char *pv1, const char *pv2);
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif
109
Note: See TracBrowser for help on using the repository browser.