mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 21:10:27 +02:00
* guile-readline/readline.c: * libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/async.c: * libguile/atomic.c: * libguile/backtrace.c: * libguile/boolean.c: * libguile/bytevectors.c: * libguile/chars.c: * libguile/continuations.c: * libguile/debug.c: * libguile/dynl.c: * libguile/eq.c: * libguile/error.c: * libguile/eval.c: * libguile/evalext.c: * libguile/expand.c: * libguile/feature.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/fports.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/goops.c: * libguile/goops.h: * libguile/guardians.c: * libguile/hash.c: * libguile/hashtab.c: * libguile/hashtab.h: * libguile/hooks.c: * libguile/i18n.c: * libguile/ioext.c: * libguile/keywords.c: * libguile/list.c: * libguile/load.c: * libguile/macros.c: * libguile/memoize.c: * libguile/modules.h: * libguile/net_db.c: * libguile/numbers.c: * libguile/pairs.c: * libguile/poll.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/procs.c: * libguile/promises.c: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/rdelim.c: * libguile/read.c: * libguile/regex-posix.c: * libguile/rw.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/simpos.c: * libguile/socket.c: * libguile/sort.c: * libguile/srcprop.c: * libguile/srfi-1.c: * libguile/srfi-4.c: * libguile/srfi-60.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/strorder.c: * libguile/strports.c: * libguile/struct.c: * libguile/symbols.c: * libguile/syntax.c: * libguile/threads.c: * libguile/throw.c: * libguile/trees.c: * libguile/unicode.c: * libguile/values.c: * libguile/variable.c: * libguile/vectors.c: * libguile/vports.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: * libguile.h: Remove validate.h include.
95 lines
2.4 KiB
C
95 lines
2.4 KiB
C
/* Copyright (C) 2014, 2018 Free Software Foundation, Inc.
|
||
*
|
||
* This library is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU Lesser General Public License as
|
||
* published by the Free Software Foundation, either version 3 of the
|
||
* License, or (at your option) any later version.
|
||
*
|
||
* This library 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 Lesser General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU Lesser General Public
|
||
* License along with this library. If not, see
|
||
* <http://www.gnu.org/licenses/>.
|
||
*/
|
||
|
||
|
||
#ifdef HAVE_CONFIG_H
|
||
# include <config.h>
|
||
#endif
|
||
|
||
#include <ctype.h>
|
||
#include <limits.h>
|
||
#include <unicase.h>
|
||
#include <unictype.h>
|
||
#include <uniname.h>
|
||
|
||
#include "libguile/_scm.h"
|
||
#include "libguile/extensions.h"
|
||
|
||
#include "libguile/unicode.h"
|
||
|
||
|
||
|
||
SCM_DEFINE (scm_char_to_formal_name, "char->formal-name", 1, 0, 0,
|
||
(SCM ch),
|
||
"Return the formal all-upper-case unicode name of @var{ch},\n"
|
||
"as a string. If the character has no name, return @code{#f}.")
|
||
#define FUNC_NAME s_scm_char_to_formal_name
|
||
{
|
||
char buf[UNINAME_MAX + 1];
|
||
|
||
SCM_VALIDATE_CHAR (1, ch);
|
||
|
||
memset(buf, 0, UNINAME_MAX + 1);
|
||
|
||
if (unicode_character_name (SCM_CHAR (ch), buf))
|
||
return scm_from_latin1_string (buf);
|
||
|
||
return SCM_BOOL_F;
|
||
}
|
||
#undef FUNC_NAME
|
||
|
||
SCM_DEFINE (scm_formal_name_to_char, "formal-name->char", 1, 0, 0,
|
||
(SCM name),
|
||
"Return the character whose formal all-upper-case unicode name is\n"
|
||
"@var{name}, or @code{#f} if no such character is known.")
|
||
#define FUNC_NAME s_scm_formal_name_to_char
|
||
{
|
||
char *c_name;
|
||
scm_t_wchar ret;
|
||
|
||
SCM_VALIDATE_STRING (1, name);
|
||
|
||
c_name = scm_to_latin1_string (name);
|
||
ret = unicode_name_character (c_name);
|
||
free (c_name);
|
||
|
||
return ret == UNINAME_INVALID ? SCM_BOOL_F : SCM_MAKE_CHAR (ret);
|
||
}
|
||
#undef FUNC_NAME
|
||
|
||
static void
|
||
scm_load_unicode (void)
|
||
{
|
||
#ifndef SCM_MAGIC_SNARFER
|
||
#include "libguile/unicode.x"
|
||
#endif
|
||
}
|
||
|
||
void
|
||
scm_init_unicode (void)
|
||
{
|
||
scm_c_register_extension ("libguile-" SCM_EFFECTIVE_VERSION,
|
||
"scm_init_unicode",
|
||
(scm_t_extension_init_func)scm_load_unicode,
|
||
NULL);
|
||
}
|
||
|
||
/*
|
||
Local Variables:
|
||
c-file-style: "gnu"
|
||
End:
|
||
*/
|