Example #1
0
IO_METHOD(IoSeq, convertToFixedSizeType)
{
	IO_ASSERT_NOT_SYMBOL(self);
	UArray_convertToFixedSizeType(DATA(self));
	IoObject_isDirty_(self, 1);
	return self;
}
Example #2
0
IoObject *IoSeq_convertToFixedSizeType(IoSeq *self, IoObject *locals, IoMessage *m)
{
	IO_ASSERT_NOT_SYMBOL(self);
	UArray_convertToFixedSizeType(DATA(self));
	IoObject_isDirty_(self, 1);
	return self;
}
Example #3
0
IoSymbol *IoState_symbolWithCString_length_(IoState *self, const char *s, size_t length)
{
	UArray *a = UArray_newWithData_type_size_copy_((char *)s, CTYPE_uint8_t, length, 1);
	UArray_setEncoding_(a, CENCODING_UTF8);
	UArray_convertToFixedSizeType(a);
	return IoState_symbolWithUArray_copy_(self, a, 0);
}
Example #4
0
IO_METHOD(IoSeq, asFixedSizeType)
{
	/*doc Sequence asFixedSizeType
	Returns a new sequence with the receiver encoded in the 
	minimal fixed width text encoding that it's characters can fit 
	into (either, ascii, utf8, utf16 or utf32). 
	*/
	
	UArray *out = UArray_new();
	UArray_copy_(out, DATA(self));
	UArray_convertToFixedSizeType(out);	
	return IoSeq_newWithUArray_copy_(IOSTATE, out, 0);
}
Example #5
0
UArray *IoDirectory_CurrentWorkingDirectoryAsUArray(void)
{
#if defined(sparc) || defined(__sparc)
    char *buf = getcwd(NULL, FILENAME_MAX + 1);
#else
    char *buf = NULL;
    buf = (char *)getcwd(buf, 1024);
#endif /* sparc || _sparc */

    if (!buf)
    {
        return UArray_newWithCString_copy_(".", 1);
    }
    else
    {
        UArray *ba =  UArray_newWithData_type_size_copy_((unsigned char *)buf, CTYPE_uint8_t, strlen(buf), 1);
        UArray_setEncoding_(ba, CENCODING_UTF8);
        UArray_convertToFixedSizeType(ba);
        // io_free(buf); OSX get cwd man page says we should io_free this, but MallocDebug does not like it
        return ba;
    }
}