implemented more prechecks including the existence of the primitive function handler and the number of supported arguments when compiling primitive method defintions

This commit is contained in:
hyunghwan.chung
2017-03-31 14:21:22 +00:00
parent 0f84a115ae
commit 447670aba8
14 changed files with 172 additions and 80 deletions

View File

@ -107,6 +107,15 @@ int moo_compucbcstr (const moo_uch_t* str1, const moo_bch_t* str2)
return (*str1 > *str2)? 1: -1;
}
int moo_compucharsucstr (const moo_uch_t* str1, moo_oow_t len, const moo_uch_t* str2)
{
const moo_uch_t* end = str1 + len;
while (str1 < end && *str2 != '\0' && *str1 == *str2) str1++, str2++;
if (str1 == end && *str2 == '\0') return 0;
if (*str1 == *str2) return (str1 < end)? 1: -1;
return (*str1 > *str2)? 1: -1;
}
int moo_compucharsbcstr (const moo_uch_t* str1, moo_oow_t len, const moo_bch_t* str2)
{
const moo_uch_t* end = str1 + len;
@ -125,6 +134,16 @@ int moo_compbcharsbcstr (const moo_bch_t* str1, moo_oow_t len, const moo_bch_t*
return (*str1 > *str2)? 1: -1;
}
int moo_compbcharsucstr (const moo_bch_t* str1, moo_oow_t len, const moo_uch_t* str2)
{
const moo_bch_t* end = str1 + len;
while (str1 < end && *str2 != '\0' && *str1 == *str2) str1++, str2++;
if (str1 == end && *str2 == '\0') return 0;
if (*str1 == *str2) return (str1 < end)? 1: -1;
return (*str1 > *str2)? 1: -1;
}
void moo_copyuchars (moo_uch_t* dst, const moo_uch_t* src, moo_oow_t len)
{
/* take note of no forced null termination */