started an official API to the C runtime

This commit is contained in:
kr.angelov
2012-12-12 11:25:58 +00:00
parent f39466f787
commit 1376df457d
15 changed files with 329 additions and 173 deletions

View File

@@ -5,7 +5,6 @@
#include <gu/exn.h>
#include <gu/assert.h>
#if defined(__STDC_ISO_10646__) && WCHAR_MAX >= 0x10FFFF
#include <wchar.h>
#define GU_UCS_WCHAR
@@ -25,19 +24,8 @@ gu_ucs_valid(GuUCS ucs)
return ucs >= 0 && ucs <= GU_UCS_MAX;
}
inline GuUCS
gu_char_ucs(char c)
{
gu_require(gu_char_is_valid(c));
#ifdef CHAR_ASCII
GuUCS u = (GuUCS) c;
#else
extern const uint8_t gu_ucs_ascii_reverse_[CHAR_MAX];
GuUCS u = gu_ucs_ascii_reverse_[(unsigned char) c];
#endif
gu_ensure(u < 0x80);
return u;
}
GuUCS
gu_char_ucs(char c);
char
gu_ucs_char(GuUCS uc, GuExn* err);