Author: engelsman
Date: 2009-04-17 10:03:49 -0700 (Fri, 17 Apr 2009)
New Revision: 6768
Log:
added doxygen one-liners for more UTF-8 routines in fl_utf*.[hc]*
Modified:
branches/branch-1.3/FL/fl_utf8.h
branches/branch-1.3/src/fl_utf.c
branches/branch-1.3/src/fl_utf8.cxx
Modified: branches/branch-1.3/FL/fl_utf8.h
===================================================================
--- branches/branch-1.3/FL/fl_utf8.h 2009-04-16 22:23:36 UTC (rev 6767)
+++ branches/branch-1.3/FL/fl_utf8.h 2009-04-17 17:03:49 UTC (rev 6768)
@@ -87,6 +87,7 @@
@{
*/
+/** is this even defined anywhere? */
int fl_unichar_to_utf8_size(Fl_Unichar);
/* F2: comes from FLTK2 */
Modified: branches/branch-1.3/src/fl_utf.c
===================================================================
--- branches/branch-1.3/src/fl_utf.c 2009-04-16 22:23:36 UTC (rev 6767)
+++ branches/branch-1.3/src/fl_utf.c 2009-04-17 17:03:49 UTC (rev 6768)
@@ -403,8 +403,12 @@
}
-/* This function generates 32-bit wchar_t (e.g. "ucs4" as it were) except on
win32 where
- it returns Utf16 with surrogate pairs where required. */
+/**
+ Converts a UTF-8 string into a wide character string.
+
+ This function generates 32-bit wchar_t (e.g. "ucs4" as it were) except
+ on win32 where it returns Utf16 with surrogate pairs where required.
+ */
unsigned fl_utf8towc(const char* src, unsigned srclen,
wchar_t* dst, unsigned dstlen)
{
Modified: branches/branch-1.3/src/fl_utf8.cxx
===================================================================
--- branches/branch-1.3/src/fl_utf8.cxx 2009-04-16 22:23:36 UTC (rev 6767)
+++ branches/branch-1.3/src/fl_utf8.cxx 2009-04-17 17:03:49 UTC (rev 6768)
@@ -110,8 +110,9 @@
return table[ucs];
}
-/*** returns the byte length of the first UTF-8 char ***/
-/*** (returns -1 if not valid) ***/
+/**
+ returns the byte length of the first UTF-8 char sequence or -1 is not valid.
+ */
int fl_utf8len(char c)
{
if (!(c & 0x80)) return 1;
@@ -144,7 +145,9 @@
}
#endif
-/**** returns the number of Unicode chars in the UTF-8 string ***/
+/**
+ returns the number of Unicode chars in the UTF-8 string
+ */
int
fl_utf_nb_char(
const unsigned char *buf,
@@ -167,6 +170,11 @@
* return 1 if s1 is greater than s2
* return -1 if s1 is less than s2
*/
+/**
+ UTF-8 aware strncasecmp - converts to lower case Unicode and tests.
+
+ \todo Correct the incorrect logic where length of strings tested
+ */
int fl_utf_strncasecmp(const char *s1, const char *s2, int n)
{
int i;
@@ -212,6 +220,11 @@
* return 1 if s1 is greater than s2
* return -1 if s1 is less than s2
*/
+/**
+ UTF-8 aware strcasecmp - converts to Unicode and tests.
+
+ \todo Correct the incorrect logic where length of strings tested
+ */
int fl_utf_strcasecmp(const char *s1, const char *s2)
{
int s1_l = strlen(s1);
@@ -225,26 +238,26 @@
return fl_utf_strncasecmp(s1, s2, s1_l);
}
-/*
- * return the Unicode lower case value of ucs
- */
+/**
+ return the Unicode lower case value of \p ucs
+ */
int fl_tolower(unsigned int ucs)
{
return XUtf8Tolower(ucs);
}
-/*
- * return the Unicode upper case value of ucs
- */
+/**
+ return the Unicode upper case value of \p ucs
+ */
int fl_toupper(unsigned int ucs)
{
return Toupper(ucs);
}
-/*
- * converts the str string to the lower case equivalent into buf.
- * Warning: to be safe buf length must be at least 3 * len
- */
+/**
+ converts the str string to the lower case equivalent into buf.
+ Warning: to be safe buf length must be at least 3 * len [for 24-bit Unicode]
+ */
int fl_utf_tolower(const unsigned char *str, int len, char *buf)
{
int i;
@@ -272,10 +285,10 @@
return l;
}
-/*
- * converts the str string to the upper case equivalent into buf.
- * Warning: to be safe buf length must be at least 3 * len
- */
+/**
+ converts the str string to the upper case equivalent into buf.
+ Warning: to be safe buf length must be at least 3 * len [for 24-bit Unicode]
+ */
int fl_utf_toupper(const unsigned char *str, int len, char *buf)
{
int i;
@@ -356,6 +369,10 @@
}
#endif
+/**
+ returns true if the character is non-spacing.
+ \todo explain what non-spacing means.
+ */
unsigned int fl_nonspacing(unsigned int ucs)
{
#ifdef __APPLE__
@@ -428,6 +445,9 @@
}
#endif
+/**
+ converts UTF8 to a local multi-byte character string.
+ */
char * fl_utf2mbcs(const char *s)
{
if (!s) return NULL;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit