예제 #1
0
파일: slbstr.c 프로젝트: DrakXtools/drakx
int _pSLbstring_foreach (SLtype type, SLang_Foreach_Context_Type *c)
{
   unsigned char ch;
   SLwchar_Type wch;
   unsigned char *s, *s1, *smax;

   (void) type;

   s = c->s;
   smax = c->smax;
   if (s == smax)
     return 0;

   if (c->using_chars == 0)
     {
	ch = (unsigned char) *s++;
	c->s = s;

	if (-1 == SLclass_push_char_obj (SLANG_UCHAR_TYPE, ch))
	  return -1;

	return 1;
     }
   s1 = SLutf8_decode (s, smax, &wch, NULL);
   if (s1 == NULL)
     {
	int iwch = (int) *s;
	c->s = s + 1;
	/* Invalid encoded char-- return it as a negative int */
	if (-1 == SLang_push_int (-iwch))
	  return -1;

	return 1;
     }
   c->s = s1;
   if (-1 == SLang_push_wchar (wch))
     return -1;

   return 1;
}
예제 #2
0
int SLang_push_uchar (unsigned char i)
{
    return SLclass_push_char_obj (SLANG_UCHAR_TYPE, (char) i);
}
예제 #3
0
int SLang_push_char (char i)
{
    return SLclass_push_char_obj (SLANG_CHAR_TYPE, i);
}
예제 #4
0
static int push_char_literal (SLtype type, VOID_STAR ptr)
{
    return SLclass_push_char_obj (type, (char) *(long *) ptr);
}