cstring.c File Reference

Implementations of ctl_sconst specific code and units. More...

#include "ctl/ctldef.h"
#include "ctl/cstring.temp.h"

Include dependency graph for cstring.c:

Go to the source code of this file.

Detailed Description

Implementations of ctl_sconst specific code and units.

David Mace
Currently these only support wchar_t or char. The wchar_t is for assumed to be wide (unicode) characters, and if it isn't defined for your target, just stick to char, or define all of the relevant translations and extensions, then plug them in as your own lib.

I may reduce this down to one 'UTF8' type instead. I haven't made up my mind.

Using cstring is ultra-fast compared to conventional string parsing methods. Instead of finding a string, copying a string (and probably allocating space to do that), NUL terminating it and further operating on a string, we operate on a set of pointers. One to the beginning, one to the end, and one to the current position where reads are happening. Instead of spending cycles copying text to manage one pointer, we manage two pointers into existing text.

This also reduces somewhat the madness and frustration encountered writing string code acrosss platforms. The runtime cost is nil, as we wrap the functions in macros to sort out the nasty disagreements in naming conventions (and gaps) within various C runtime library implementations.

Definition in file cstring.c.

Generated on Fri Jan 2 15:28:35 2009 for Squat by  doxygen 1.5.6