(source code as 4 code::blocks builds are included also)
Joshy
Overview FLTK Unicode and UTF-8 support.
new UTF8 stuff
Code: Select all
...
...
'########
'# UTF8 #
'########
'Return the number of bytes needed to encode the given UCS4 character in UTF8.
declare function Fl_utf8bytes(ucs as uinteger) as integer
' OD: returns the byte length of the first UTF-8 char sequence (returns -1 if not valid)
declare function Fl_utf8len(c as byte) as integer
' OD: returns the byte length of the first UTF-8 char sequence (returns +1 if not valid)
declare function Fl_utf8len1(c as byte) as integer
' OD: returns the number of Unicode chars in the UTF-8 string
declare function Fl_utf_nb_char(buf as const ubyte ptr, len as integer) as integer
' F2: Convert the next UTF8 char-sequence into a Unicode value (and say how many bytes were used)
declare function Fl_utf8decode(p as const zstring ptr, end as const zstring ptr, len as integer ptr) as uinteger
' F2: Encode a Unicode value into a UTF8 sequence, return the number of bytes used
declare function Fl_utf8encode(ucs as uinteger, buf as zstring ptr) as integer
' F2: Move forward to the next valid UTF8 sequence start betwen start and end
declare function Fl_utf8fwd(p as const zstring ptr, start as const zstring ptr, end as const zstring ptr) as const zstring ptr
' F2: Move backward to the previous valid UTF8 sequence start
declare function Fl_utf8back(p as const zstring ptr, start as const zstring ptr, end as const zstring ptr) as const zstring ptr
' XX: Convert a single 32-bit Unicode value into UTF16
declare function Fl_ucs_to_Utf16(ucs as const uinteger, dst as ushort ptr, dstlen as const uinteger) as uinteger
' F2: Convert a UTF8 string into UTF16
declare function Fl_utf8toUtf16(src as const zstring ptr, srclen as uinteger, dst as ushort ptr, dstlen as uinteger) as uinteger
' F2: Convert a UTF8 string into a wide character string - makes UTF16 on win32, "UCS4" elsewhere
declare function Fl_utf8towc(src as const zstring ptr, srclen as uinteger, dst as wchar_t ptr, dstlen as uinteger) as uinteger
' F2: Convert a wide character string to UTF8 - takes in UTF16 on win32, "UCS4" elsewhere
declare function Fl_utf8fromwc(dst as zstring ptr, dstlen as uinteger, src as const wchar_t ptr, srclen as uinteger) as uinteger
' F2: Convert a UTF8 string into ASCII, eliding untranslatable glyphs
declare function Fl_utf8toa (src as const zstring ptr, srclen as uinteger, dst as zstring ptr, dstlen as uinteger) as uinteger
' F2: Convert 8859-1 string to UTF8
declare function Fl_utf8froma (dst as zstring ptr, dstlen as uinteger, src as const zstring ptr, srclen as uinteger) as uinteger
' F2: Returns true if the current O/S locale is UTF8
declare function Fl_utf8locale() as integer
/' F2: Examine the first len characters of src, to determine if the input text is UTF8 or not
NOTE: The value returned is not simply boolean - it contains information about the probable type of the src text. '/
declare function Fl_utf8test(src as const zstring ptr, len as uinteger) as integer
/' XX: return width of "raw" ucs character in columns.
* for internal use only '/
declare function Fl_wcwidth_(ucs as uinteger) as integer
/' XX: return width of utf-8 character string in columns.
NOTE: this may also do C1 control character (0x80 to 0x9f) to CP1252 mapping, depending on original build options '/
declare function Fl_wcwidth(src as const zstring ptr) as integer
' OD: Return true if the character is non-spacing
declare function Fl_nonspacing(ucs as uinteger) as uinteger
' F2: Convert UTF8 to a local multi-byte encoding - mainly for win32?
declare function Fl_utf8to_mb(src as const zstring ptr, srclen as uinteger, dst as zstring ptr, dstlen as uinteger) as uinteger
' OD: Convert UTF8 to a local multi-byte encoding
declare function Fl_utf2mbcs(src as const zstring ptr) as zstring ptr
' F2: Convert a local multi-byte encoding to UTF8 - mainly for win32?
declare function Fl_utf8from_mb(dst as zstring ptr, dstlen as uinteger, src as const zstring ptr, srclen as uinteger) as uinteger
#ifdef __FB_WIN32__
' OD: Attempt to convert the UTF8 string to the current locale
declare function Fl_utf8_to_locale(s as const zstring ptr, len as integer, codepage as uinteger) as zstring ptr
' OD: Attempt to convert a string in the current locale to UTF8
declare function Fl_locale_to_utf8(s as const zstring ptr, len as integer, codepage as uinteger) as zstring ptr
#endif
' The following functions are intended to provide portable, UTF8 aware versions of standard functions
' OD: UTF8 aware strncasecmp - converts to lower case Unicode and tests
declare function Fl_utf_strncasecmp(s1 as const zstring ptr, s2 as const zstring ptr, n as integer) as integer
' OD: UTF8 aware strcasecmp - converts to Unicode and tests
declare function Fl_utf_strcasecmp(s1 as const zstring ptr, s2 as const zstring ptr) as integer
' OD: return the Unicode lower case value of ucs
declare function Fl_tolower(ucs as uinteger) as integer
' OD: return the Unicode upper case value of ucs
declare function Fl_toupper(ucs as uinteger) as integer
' OD: converts the UTF8 string to the lower case equivalent
declare function Fl_utf_tolower(str as const ubyte ptr,len as integer, buf as zstring ptr) as integer
' OD: converts the UTF8 string to the upper case equivalent
declare function Fl_utf_toupper(str as const ubyte ptr, len as integer, buf as zstring ptr) as integer
' OD: Portable UTF8 aware chmod wrapper
declare function Fl_chmod(f as const zstring ptr, mode as integer) as integer
' OD: Portable UTF8 aware access wrapper
declare function Fl_access(f as const zstring ptr, mode as integer) as integer
' OD: Portable UTF8 aware stat wrapper !!! buffer as stat ptr
declare function Fl_stat(path as const zstring ptr, buffer as any ptr) as integer
' OD: Portable UTF8 aware getcwd wrapper
declare function Fl_getcwd( buf as zstring ptr, maxlen as integer) as zstring ptr
' OD: Portable UTF8 aware fopen wrapper
declare function Fl_fopen(f as const zstring ptr, mode as const zstring ptr) as FILE ptr
' OD: Portable UTF8 aware system wrapper
declare function Fl_system(f as const zstring ptr) as integer
' OD: Portable UTF8 aware execvp wrapper
declare function Fl_execvp(file as const zstring ptr, argv as const zstring ptr ptr) as integer
' OD: Portable UTF8 aware open wrapper
declare function Fl_open(f as const zstring ptr, o as integer) as integer
' OD: Portable UTF8 aware unlink wrapper
declare function Fl_unlink(f as const zstring ptr) as integer
' OD: Portable UTF8 aware rmdir wrapper
declare function Fl_rmdir(f as const zstring ptr) as integer
' OD: Portable UTF8 aware getenv wrapper
declare function Fl_getenv(name as const zstring ptr) as zstring ptr
' OD: Portable UTF8 aware execvp wrapper
declare function Fl_mkdir(f as const zstring ptr, mode as integer) as integer
' OD: Portable UTF8 aware rename wrapper
declare function Fl_rename(f as const zstring ptr, t as const zstring ptr) as integer
' OD: Given a full pathname, this will create the directory path needed to hold the file named
declare sub Fl_make_path_for_file(path as const zstring ptr)
' OD: recursively create a path in the file system
declare function Fl_make_path(path as const zstring ptr) as byte
...
...