Add the ability to print unicode characters in addition to "Latin1" ones

This commit is contained in:
Thomas Bernard
2018-02-11 21:43:44 +01:00
parent b564a4d4f4
commit 545308265b
11 changed files with 236 additions and 38 deletions

39
src/unicode.h Normal file
View File

@@ -0,0 +1,39 @@
/* vim:expandtab:ts=2 sw=2:
*/
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2018 Thomas Bernard
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
Grafx2 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
Grafx2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#ifndef UNICODE_H_INCLUDED
#define UNICODE_H_INCLUDED
#include "struct.h"
/// equivalent of strlen() for out Unicode strings
/// return the number of characters (words), so there is twice as much bytes
size_t Unicode_strlen(const word * str);
/// equivalent of strdup() for our Unicode strings
word * Unicode_strdup(const word * str);
/// Compare an unicode string with a regular Latin1 string
int Unicode_char_strcmp(const word * s1, const char * s2);
/// Copy a regular Latin1 string to an unicode string
void Unicode_char_strlcpy(word * dst, const char * src, size_t len);
#endif