/*
 *               Copyright (C) 2008, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

#ifndef __STRING_H__
#define __STRING_H__

#if !defined(SDK_TWL)
#error "TWL version of this header file included for non-TWL platform"
#endif

#if !defined(__cplusplus)

/*
 * For TWL, use string primitives from the Nintendo SDK
 */

#include <nitro/std/string.h>

#define memset(dest, value, size) MI_CpuFill8(dest, value, size)
#define memcpy(dest, src, size) MI_CpuCopy8(src, dest, size)
#define memcmp(str1, str2, len) MI_CpuComp8(str1, str2, len)
#define strcmp(str1, str2) STD_CompareString(str1, str2)
#define strncmp(str1, str2, size) STD_CompareNString(str1, str2, size)
#define strstr(haystack, needle) STD_SearchString(haystack, needle)
#define strlen(str) STD_GetStringLength(str)
#define strcat(dest, src) STD_ConcatenateString(dest, src)
#define strchr(str, c) STD_SearchChar(str, c)
#define strrchr(str, c) STD_SearchCharReverse(str, c)
#define snprintf(str, len, fmt...) STD_TSNPrintf(str, len, fmt)
#define vsnprintf(str, len, fmt, vlist) STD_TVSNPrintf(str, len, fmt, vlist)

/*
 * For now, pick these up from the standard library, but don't include
 * the MetroWerks string.h.
 */
extern char *strncpy(char *dest, const char *src, size_t n);

#endif /* !__cplusplus */

#endif /* __STRING_H__ */
