summaryrefslogtreecommitdiffstats
path: root/src/lib/common/string.h
blob: 9cf59a57da6bbaabff657e9c74afc0d943a8f32a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/lib/common/string.h $                                     */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2016                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __STRING_H__
#define __STRING_H__

/// \file string.h
/// \brief Replacement for <string.h>
///
/// The SSX library does not implement the entire <string.h> function.
/// However the real reason for this header was the finding that under certain
/// optimization modes, we were geting errors from the default <string.h>
/// supplied with the MPC environment.  So we created this replacement that
/// only calls out what is implemented, exactly as it is implemented for SSX.

#ifndef __ASSEMBLER__

#include <stddef.h>
#if !defined(__size_t)
#include <stdint.h>
typedef size_t uint32_t;
#endif


// APIs inmplemented by string.c

size_t 
strlen(const char *s);

int
strcmp(const char* s1, const char* s2);

int 
strncmp(const char* s1, const char* s2, size_t n);

int
strcasecmp(const char* s1, const char* s2);

int 
strncasecmp(const char* s1, const char* s2, size_t n);

char *
strcpy(char *dest, const char *src);

char *
strncpy(char *dest, const char *src, size_t n);

void *
memcpy(void *dest, const void *src, size_t n);

void *
memset(void *s, int c, size_t n);

int
memcmp(const void* s1, const void* s2, size_t n);

// APIs implemented by strdup.c

char *
strdup(const char* s);

#endif  /* __ASSEMBLER__ */

#endif  /* __STRING_H__ */
OpenPOWER on IntegriCloud