Exemplo n.º 1
0
static RSCoreUSBDeviceRef __RSCoreUSBDeviceCreateInstance(RSAllocatorRef allocator, RSStringRef uuid) {
    RSCoreUSBDeviceRef instance = (RSCoreUSBDeviceRef)__RSRuntimeCreateInstance(allocator, _RSCoreUSBDeviceTypeID /*RSCoreUSBDeviceGetTypeID()*/, sizeof(struct __RSCoreUSBDevice) - sizeof(RSRuntimeBase));
    
    
    
    return instance;
}
Exemplo n.º 2
0
static RSQueueRef __RSQueueCreateInstance(RSAllocatorRef allocator, RSIndex capacity, RSQueueAtomType atom)
{
    RSQueueRef queue = (RSQueueRef)__RSRuntimeCreateInstance(allocator, _RSQueueTypeID, sizeof(struct __RSQueue) - sizeof(RSRuntimeBase));
    queue->_lock = RSSpinLockInit;
	if (atom == RSQueueAtom) setAtom(queue);
    queue->_capacity = capacity;
    queue->_queueCore = RSArrayCreateMutable(allocator, capacity);
    return queue;
}
Exemplo n.º 3
0
RSExport RSErrorRef RSErrorCreate(RSAllocatorRef allocator, RSStringRef domain, RSIndex code, RSDictionaryRef userInfo)
{
    RSErrorRef err = (RSErrorRef)__RSRuntimeCreateInstance(allocator, RSErrorGetTypeID(), sizeof(struct __RSError) - sizeof(RSRuntimeBase));
    err->_code = code;
    if (domain) err->_domain = RSRetain(domain);
    else HALTWithError(RSInvalidArgumentException, "the domain is nil.");
    if (userInfo) err->_userInfo = RSRetain(userInfo);
    
    return err;
}
Exemplo n.º 4
0
static RSTimerRef __RSTimerCreateInstance(RSAllocatorRef allocator, RSAbsoluteTime start, RSTimeInterval timeInterval, BOOL repeats, RSDictionaryRef userInfo)
{
    RSTimerRef timer = (RSTimerRef)__RSRuntimeCreateInstance(allocator, RSTimerGetTypeID(), sizeof(struct __RSTimer) - sizeof(struct __RSRuntimeBase));
    struct __RSTimer *_timer = (struct __RSTimer *)timer;
    if (userInfo) _timer->_userInfo = RSRetain(userInfo);
    RSBitU64 _start = __dps_convert_absolute(start);
    __RSTimerDescriptorInit(timer, _start, timeInterval);
    if (repeats) __RSTimerSetRepeat(timer);
    return timer;
}
Exemplo n.º 5
0
static RSProcessInfoRef __RSProcessInfoCreateInstance(RSAllocatorRef allocator, RSDictionaryRef content) {
    RSProcessInfoRef instance = (RSProcessInfoRef)__RSRuntimeCreateInstance(allocator, _RSProcessInfoTypeID, sizeof(struct __RSProcessInfo) - sizeof(RSRuntimeBase));
    
    if (content) {
        instance->_info = RSMutableCopy(allocator, content);
    } else {
        instance->_info = RSDictionaryCreateMutable(RSAllocatorDefault, 0, RSDictionaryRSTypeContext);
    }
    __RSRuntimeSetInstanceSpecial(instance->_info, YES);
    
    return instance;
}
Exemplo n.º 6
0
static RSCalendarRef __RSCalendarCreateInstance(RSAllocatorRef allocator, RSStringRef identifier)
{
    if (identifier != RSGregorianCalendar &&
        identifier != RSBuddhistCalendar &&
        identifier != RSJapaneseCalendar &&
        identifier != RSIslamicCalendar &&
        identifier != RSIslamicCivilCalendar &&
        identifier != RSHebrewCalendar)
    {
        //    if (identifier != RSGregorianCalendar && identifier != RSBuddhistCalendar && identifier != RSJapaneseCalendar && identifier != RSIslamicCalendar && identifier != RSIslamicCivilCalendar && identifier != RSHebrewCalendar && identifier != RSChineseCalendar) {
        if (RSEqual(RSGregorianCalendar, identifier)) identifier = RSGregorianCalendar;
        else if (RSEqual(RSBuddhistCalendar, identifier)) identifier = RSBuddhistCalendar;
        else if (RSEqual(RSJapaneseCalendar, identifier)) identifier = RSJapaneseCalendar;
        else if (RSEqual(RSIslamicCalendar, identifier)) identifier = RSIslamicCalendar;
        else if (RSEqual(RSIslamicCivilCalendar, identifier)) identifier = RSIslamicCivilCalendar;
        else if (RSEqual(RSHebrewCalendar, identifier)) identifier = RSHebrewCalendar;
        //	else if (RSEqual(RSChineseCalendar, identifier)) identifier = RSChineseCalendar;
        else return nil;
    }
    RSCalendarRef calendar = (RSCalendarRef)__RSRuntimeCreateInstance(allocator, RSCalendarGetTypeID(), sizeof(struct __RSCalendar) - sizeof(struct __RSRuntimeBase));
    __RSCalendarSetIndentifier(calendar, identifier);
    return calendar;
}
Exemplo n.º 7
0
static RSTimeZoneRef __RSTimeZoneCreateInstance(RSAllocatorRef allocator, RSStringRef zoneName)
{
    RSTimeZoneRef tz = __RSRuntimeCreateInstance(RSAllocatorSystemDefault, _RSTimeZoneTypeID, sizeof(struct __RSTimeZone) - sizeof(struct __RSRuntimeBase));
    __RSTimeZoneSetName(tz, zoneName);
    return tz;
}
Exemplo n.º 8
0
static   RSDateRef __RSDateCreateInstance(RSAllocatorRef allocator, RSAbsoluteTime time)
{
    RSDateRef date = (RSDateRef)__RSRuntimeCreateInstance(allocator, RSDateGetTypeID(), sizeof(struct __RSDate) - sizeof(struct __RSRuntimeBase));
    ((struct __RSDate*)date)->_time = time;
    return date;
}