Wow, the next Lite Foundation release is here. And it is totally awesome, I'm really excited!

Just to get you started right away, here is the download link:
http://cl.ly/7Btf

And now about the new features:
The first new feature is of course multithreading, this gives you three new classes: LFThreadRef, LFLockRef, LFConditionRef. Now the sad part: Lite-C users will certainly have crashes when using the multithreaded Lite Foundation. Why? Because of the tricks I had to use to get Lite Foundation running, it uses a lot of global variables and function pointers. There is no way around this and it makes no sense to introduce a big lock because I can't handle everything on the Lite Foundation level.
I'm sorry and will certainly file a lot of feature requests!

But, there are way more exciting features. Lets start with a really useful one: Zombies.
Zombies is a operating mode of the runtime, in this mode the runtime won't purge objects from memory but let there bodies leak intentionally. Why? For a good reason: It will log EVERY access you make to the death object! So you can be sure that you can track over releasing of objects and using of deallocated objects as fast as possible.
The runtime will log the function that caused the problem, the objects class and the objects pointer, enough to give you an idea where the problem is. This is incredible useful for beginners new to the Lite Foundations memory model.

Here is an actual example and the output in the console:
Code:
LFRuntimeSetZombieLevel(kLFZombieLevelScribble); // Enable zombies
	
LFStringRef string = LFStringWithCString("Hello"); // Create a new, autoreleased string
LFRelease(string); // Release the string. This will deallocate the string because we are the only owner

LFStringAppendCString(string, "World"); // Do something bad!



This piece of code will log:
Code:
Sent LFStringAppendCString to already deallocated instance <LFString 0x1005b0>
Sent LFRelease to already deallocated instance <LFString 0x1005b0>


Pretty cool, hu?


More cool stuff? Oh yea, remember the first Lite Foundation version? It had a LFDateRef class and to be honest it sucked. One couldn't do any math with it and it couldn't represent fractions of seconds.
Now Lite Foundation knows again a LFDateRef object. Together with its buddies LFDateComponentsRef and LFTimeZoneRef, it is crazy powerful. And I mean really crazy powerful!
LFDateRef just wraps the time in seconds and sub-miliseconds since 1st January 2001. LFDateComponentsRef can get the single components (days, hours, etc) from a LFDateRef plus it can calculate with them. The difference between my birth and today in minutes? No problem, just two lines of code!
LFTimeZoneRef is an abstract wrapper for a time zone (currently no daylight saving time support, sorry). It holds an offset to GMT in seconds, thats it.

Here is an actual example:
Code:
// This function prints the minutes and hours passed since Lite Foundations release
// Lite Foundation was released on 19/04/2011 03:27 CET
void printTimeSinceLFRelease()
{
	LFDateComponentsRef components = LFDateComponentsCreate(2011, 04, 19, 3, 27, 0.0); // Create a new LFDateComponentsRef containing the date of the Lite Foundation release
	LFTimeZoneRef timeZone = LFTimeZoneCreateWithAbbreviation(LFSTR("CET")); // The thread was created in the central europe time zone
	
	LFDateRef releaseDate = LFDateComponentsGetDate(components, timeZone);
	LFDateRef currentDate = LFDateCreate(); // Grab the current date
	
	
	LFDateComponentsRef difference = LFDateComponentsGetDifferenceFromDates(currentDate, releaseDate, timeZone, kLFHoursComponent | kLFMinutesComponent); // Get the hours and minutes passed since the release
	// For simplicity we use the same time zone (CET) again, but you can interchange the time zone with yours to get the time since the post and the current date in your time zone
	
	printf("%i hours and %i minutes passed since the inital Lite Foundation release!", difference->hour, difference->minute);
	
	// Cleanup
	LFRelease(components);
	LFRelease(timeZone);
	LFRelease(currentDate);
}


All time function respect leap years and all the such and are really crazy powerful and useful. The download folder contains an example.

With working dates object, one could also revive the LFTimer class, right? Right! There is a new LFTimer class, it allows firing in the sub-milisecond range, or in an hour. Or at a specific date.

There is a lot of other stuff, but I guess I have already mentioned the most awesome stuff. Like I said, I'm really, really excited about this release and I hope you like it.

@FlorainP: Sorry, there is no new getting started guide in this release. But I'm working on it! If you don't mind, I will send you a draft via PN so you can say something about it?

Edit: Fun fact; The line count of this release is almost twice as large as the one from the previous release. 12333 vs 6402 lines.

Last edited by JustSid; 05/29/11 23:16.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com