Run source tree through uncrustify
.uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
c6c937abc2
commit
9308a46039
|
@ -0,0 +1,228 @@
|
|||
tok_split_gte=false
|
||||
utf8_byte=true
|
||||
utf8_force=true
|
||||
indent_cmt_with_tabs=false
|
||||
indent_align_string=false
|
||||
indent_braces=false
|
||||
indent_braces_no_func=false
|
||||
indent_braces_no_class=false
|
||||
indent_braces_no_struct=false
|
||||
indent_brace_parent=false
|
||||
indent_namespace=false
|
||||
indent_extern=false
|
||||
indent_class=false
|
||||
indent_class_colon=false
|
||||
indent_else_if=false
|
||||
indent_var_def_cont=false
|
||||
indent_func_call_param=false
|
||||
indent_func_def_param=false
|
||||
indent_func_proto_param=false
|
||||
indent_func_class_param=false
|
||||
indent_func_ctor_var_param=false
|
||||
indent_template_param=false
|
||||
indent_func_param_double=false
|
||||
indent_relative_single_line_comments=false
|
||||
indent_col1_comment=false
|
||||
indent_access_spec_body=false
|
||||
indent_paren_nl=false
|
||||
indent_comma_paren=false
|
||||
indent_bool_paren=false
|
||||
indent_first_bool_expr=false
|
||||
indent_square_nl=false
|
||||
indent_preserve_sql=false
|
||||
indent_align_assign=true
|
||||
sp_balance_nested_parens=false
|
||||
align_keep_tabs=false
|
||||
align_with_tabs=false
|
||||
align_on_tabstop=false
|
||||
align_number_left=false
|
||||
align_func_params=false
|
||||
align_same_func_call_params=false
|
||||
align_var_def_colon=true
|
||||
align_var_def_attribute=true
|
||||
align_var_def_inline=true
|
||||
align_right_cmt_mix=false
|
||||
align_on_operator=false
|
||||
align_mix_var_proto=false
|
||||
align_single_line_func=false
|
||||
align_single_line_brace=false
|
||||
align_nl_cont=false
|
||||
align_left_shift=true
|
||||
align_oc_decl_colon=true
|
||||
nl_collapse_empty_body=true
|
||||
nl_assign_leave_one_liners=true
|
||||
nl_class_leave_one_liners=true
|
||||
nl_enum_leave_one_liners=true
|
||||
nl_getset_leave_one_liners=true
|
||||
nl_func_leave_one_liners=true
|
||||
nl_if_leave_one_liners=true
|
||||
nl_multi_line_cond=false
|
||||
nl_multi_line_define=false
|
||||
nl_before_case=true
|
||||
nl_after_case=true
|
||||
nl_after_return=false
|
||||
nl_after_semicolon=true
|
||||
nl_after_brace_open=true
|
||||
nl_after_brace_open_cmt=false
|
||||
nl_after_vbrace_open=false
|
||||
nl_after_vbrace_open_empty=false
|
||||
nl_after_brace_close=false
|
||||
nl_after_vbrace_close=false
|
||||
nl_define_macro=false
|
||||
nl_squeeze_ifdef=false
|
||||
nl_ds_struct_enum_cmt=false
|
||||
nl_ds_struct_enum_close_brace=false
|
||||
nl_create_if_one_liner=false
|
||||
nl_create_for_one_liner=false
|
||||
nl_create_while_one_liner=false
|
||||
ls_for_split_full=false
|
||||
ls_func_split_full=false
|
||||
nl_after_multiline_comment=false
|
||||
eat_blanks_after_open_brace=false
|
||||
eat_blanks_before_close_brace=false
|
||||
mod_full_brace_if_chain=false
|
||||
mod_pawn_semicolon=false
|
||||
mod_full_paren_if_bool=false
|
||||
mod_remove_extra_semicolon=false
|
||||
mod_sort_import=false
|
||||
mod_sort_using=false
|
||||
mod_sort_include=false
|
||||
mod_move_case_break=false
|
||||
mod_remove_empty_return=false
|
||||
cmt_indent_multi=true
|
||||
cmt_c_group=false
|
||||
cmt_c_nl_start=false
|
||||
cmt_c_nl_end=false
|
||||
cmt_cpp_group=false
|
||||
cmt_cpp_nl_start=false
|
||||
cmt_cpp_nl_end=false
|
||||
cmt_cpp_to_c=true
|
||||
cmt_star_cont=true
|
||||
cmt_multi_check_last=true
|
||||
cmt_insert_before_preproc=false
|
||||
pp_indent_at_level=false
|
||||
pp_region_indent_code=false
|
||||
pp_if_indent_code=false
|
||||
pp_define_at_level=false
|
||||
indent_columns=4
|
||||
indent_brace=0
|
||||
indent_switch_case=0
|
||||
align_struct_init_span=2
|
||||
align_pp_define_gap=0
|
||||
align_pp_define_span=2
|
||||
align_oc_msg_colon_span=16
|
||||
nl_end_of_file_min=1
|
||||
nl_func_var_def_blk=0
|
||||
code_width=78
|
||||
nl_max=2
|
||||
newlines=auto
|
||||
indent_with_tabs=0
|
||||
sp_arith=force
|
||||
sp_assign=force
|
||||
sp_assign_default=force
|
||||
sp_before_assign=force
|
||||
sp_after_assign=force
|
||||
sp_enum_assign=force
|
||||
sp_enum_before_assign=force
|
||||
sp_enum_after_assign=force
|
||||
sp_pp_stringify=add
|
||||
sp_bool=force
|
||||
sp_compare=force
|
||||
sp_inside_paren=remove
|
||||
sp_paren_paren=remove
|
||||
sp_paren_brace=force
|
||||
sp_before_ptr_star=ignore
|
||||
sp_before_unnamed_ptr_star=force
|
||||
sp_before_byref=force
|
||||
sp_before_unnamed_byref=force
|
||||
sp_after_byref=remove
|
||||
sp_after_type=force
|
||||
sp_before_sparen=force
|
||||
sp_inside_sparen=remove
|
||||
sp_inside_sparen_close=remove
|
||||
sp_after_sparen=force
|
||||
sp_sparen_brace=force
|
||||
sp_special_semi=force
|
||||
sp_before_semi=remove
|
||||
sp_after_semi=force
|
||||
sp_after_semi_for=force
|
||||
sp_after_semi_for_empty=force
|
||||
sp_before_square=remove
|
||||
sp_inside_square=remove
|
||||
sp_after_comma=force
|
||||
sp_before_comma=remove
|
||||
sp_paren_comma=force
|
||||
sp_before_ellipsis=force
|
||||
sp_after_class_colon=force
|
||||
sp_before_class_colon=force
|
||||
sp_before_case_colon=remove
|
||||
sp_after_cast=force
|
||||
sp_inside_paren_cast=remove
|
||||
sp_sizeof_paren=remove
|
||||
sp_inside_braces_enum=force
|
||||
sp_inside_braces_struct=force
|
||||
sp_inside_braces=force
|
||||
sp_inside_braces_empty=force
|
||||
sp_func_proto_paren=remove
|
||||
sp_func_def_paren=remove
|
||||
sp_inside_fparens=remove
|
||||
sp_inside_fparen=remove
|
||||
sp_square_fparen=remove
|
||||
sp_fparen_brace=force
|
||||
sp_func_call_paren=remove
|
||||
sp_func_call_paren_empty=remove
|
||||
sp_return_paren=force
|
||||
sp_attribute_paren=remove
|
||||
sp_defined_paren=remove
|
||||
sp_macro=force
|
||||
sp_macro_func=force
|
||||
sp_else_brace=force
|
||||
sp_brace_else=force
|
||||
sp_brace_typedef=force
|
||||
sp_not=remove
|
||||
sp_inv=remove
|
||||
nl_start_of_file=remove
|
||||
nl_end_of_file=force
|
||||
nl_assign_square=remove
|
||||
nl_after_square_assign=remove
|
||||
nl_fcall_brace=remove
|
||||
nl_enum_brace=remove
|
||||
nl_struct_brace=remove
|
||||
nl_union_brace=remove
|
||||
nl_if_brace=remove
|
||||
nl_brace_else=force
|
||||
nl_elseif_brace=remove
|
||||
nl_else_brace=remove
|
||||
nl_else_if=remove
|
||||
nl_for_brace=remove
|
||||
nl_do_brace=remove
|
||||
nl_brace_while=remove
|
||||
nl_switch_brace=remove
|
||||
nl_case_colon_brace=force
|
||||
nl_func_type_name=force
|
||||
nl_func_type_name_class=force
|
||||
nl_func_proto_type_name=force
|
||||
nl_func_paren=remove
|
||||
nl_func_def_paren=remove
|
||||
nl_func_decl_start=remove
|
||||
nl_func_def_start=remove
|
||||
nl_func_decl_args=remove
|
||||
nl_func_decl_end=remove
|
||||
nl_func_def_end=remove
|
||||
nl_func_decl_end_single=remove
|
||||
nl_func_def_end_single=remove
|
||||
nl_func_decl_empty=remove
|
||||
nl_func_def_empty=remove
|
||||
nl_fdef_brace=force
|
||||
nl_return_expr=remove
|
||||
nl_before_if=ignore
|
||||
nl_after_if=ignore
|
||||
nl_before_for=ignore
|
||||
nl_after_for=ignore
|
||||
nl_before_while=ignore
|
||||
nl_after_while=ignore
|
||||
nl_before_switch=ignore
|
||||
nl_after_switch=ignore
|
||||
nl_before_do=ignore
|
||||
nl_after_do=ignore
|
||||
pp_space=remove
|
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||
Copyright 2008 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||
* Copyright 2008 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
/************************************************************
|
||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
********************************************************/
|
||||
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* Copyright © 2009 Daniel Stone
|
||||
|
@ -76,7 +76,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
* Author: Daniel Stone <daniel@fooishbar.org>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _XKBCOMMON_H_
|
||||
#define _XKBCOMMON_H_
|
||||
|
||||
|
@ -94,14 +93,14 @@ typedef uint32_t xkb_mod_mask_t;
|
|||
typedef uint32_t xkb_group_index_t;
|
||||
typedef uint32_t xkb_led_index_t;
|
||||
|
||||
#define XKB_MOD_INVALID (0xffffffff)
|
||||
#define XKB_GROUP_INVALID (0xffffffff)
|
||||
#define XKB_KEYCODE_INVALID (0xffffffff)
|
||||
#define XKB_LED_INVALID (0xffffffff)
|
||||
#define XKB_MOD_INVALID (0xffffffff)
|
||||
#define XKB_GROUP_INVALID (0xffffffff)
|
||||
#define XKB_KEYCODE_INVALID (0xffffffff)
|
||||
#define XKB_LED_INVALID (0xffffffff)
|
||||
|
||||
#define XKB_KEYCODE_MAX (0xffffffff - 1)
|
||||
#define xkb_keycode_is_legal_ext(kc) (kc <= XKB_KEYCODE_MAX)
|
||||
#define xkb_keycode_is_legal_x11(kc) (kc >= 8 && kc <= 255)
|
||||
#define XKB_KEYCODE_MAX (0xffffffff - 1)
|
||||
#define xkb_keycode_is_legal_ext(kc) (kc <= XKB_KEYCODE_MAX)
|
||||
#define xkb_keycode_is_legal_x11(kc) (kc >= 8 && kc <= 255)
|
||||
|
||||
/**
|
||||
* Names to compile a keymap with, also known as RMLVO. These names together
|
||||
|
@ -168,7 +167,7 @@ xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size);
|
|||
* Returns the Unicode/UTF-32 representation of the provided keysym, which is
|
||||
* also compatible with UCS-4. A return value of zero means the keysym does
|
||||
* not have a known printable Unicode representation.
|
||||
*/
|
||||
*/
|
||||
uint32_t
|
||||
xkb_keysym_to_utf32(xkb_keysym_t keysym);
|
||||
|
||||
|
@ -283,17 +282,16 @@ enum xkb_keymap_format {
|
|||
* file.
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_file(struct xkb_context *context,
|
||||
FILE *file, enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
xkb_map_new_from_file(struct xkb_context *context, FILE *file,
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
/**
|
||||
* Creates an XKB keymap from a full text XKB keymap serialized into one
|
||||
* enormous string.
|
||||
*/
|
||||
struct xkb_keymap *
|
||||
xkb_map_new_from_string(struct xkb_context *context,
|
||||
const char *string,
|
||||
xkb_map_new_from_string(struct xkb_context *context, const char *string,
|
||||
enum xkb_keymap_format format,
|
||||
enum xkb_map_compile_flags flags);
|
||||
|
||||
|
@ -507,10 +505,8 @@ enum xkb_state_match {
|
|||
* Please do not use this unless you fit the description above.
|
||||
*/
|
||||
void
|
||||
xkb_state_update_mask(struct xkb_state *state,
|
||||
xkb_mod_mask_t base_mods,
|
||||
xkb_mod_mask_t latched_mods,
|
||||
xkb_mod_mask_t locked_mods,
|
||||
xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods,
|
||||
xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods,
|
||||
xkb_group_index_t base_group,
|
||||
xkb_group_index_t latched_group,
|
||||
xkb_group_index_t locked_group);
|
||||
|
@ -594,7 +590,8 @@ xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
|
|||
* exist in the current map.
|
||||
*/
|
||||
int
|
||||
xkb_state_group_index_is_active(struct xkb_state *state, xkb_group_index_t idx,
|
||||
xkb_state_group_index_is_active(struct xkb_state *state,
|
||||
xkb_group_index_t idx,
|
||||
enum xkb_state_component type);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
|
||||
Copyright 1990, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from The Open Group.
|
||||
|
||||
*/
|
||||
*
|
||||
* Copyright 1990, 1998 The Open Group
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of The Open Group shall
|
||||
* not be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in this Software without prior written authorization
|
||||
* from The Open Group.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Constructs hash tables for xkb_keysym_to_string and
|
||||
|
@ -48,7 +48,7 @@ static struct info {
|
|||
} info[KTNUM];
|
||||
|
||||
#define MIN_REHASH 15
|
||||
#define MATCHES 10
|
||||
#define MATCHES 10
|
||||
|
||||
static char tab[KTNUM];
|
||||
static unsigned short offsets[KTNUM];
|
||||
|
@ -64,7 +64,7 @@ parse_line(const char *buf, char *key, xkb_keysym_t *val, char *prefix)
|
|||
|
||||
/* See if we can catch a straight XK_foo 0x1234-style definition first;
|
||||
* the trickery around tmp is to account for prefices. */
|
||||
i = sscanf(buf, "#define %127s 0x%"SCNx32, key, val);
|
||||
i = sscanf(buf, "#define %127s 0x%" SCNx32, key, val);
|
||||
if (i == 2 && strncmp(key, "XKB_KEY_", 8) == 0) {
|
||||
prefix[0] = '\0';
|
||||
memmove(key, key + 8, strlen(key + 8) + 1);
|
||||
|
@ -73,7 +73,7 @@ parse_line(const char *buf, char *key, xkb_keysym_t *val, char *prefix)
|
|||
|
||||
i = sscanf(buf, "#define %127s %127s", key, alias);
|
||||
if (i == 2)
|
||||
fprintf(stderr, "can't parse keysym definition: %s", buf);
|
||||
fprintf(stderr, "can't parse keysym definition: %s", buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -109,7 +109,8 @@ main(int argc, char *argv[])
|
|||
if (val == XKB_KEY_VoidSymbol)
|
||||
val = 0;
|
||||
if (val > 0x1fffffff) {
|
||||
fprintf(stderr, "ignoring illegal keysym (%s, %"PRIx32")\n", key,
|
||||
fprintf(stderr, "ignoring illegal keysym (%s, %" PRIx32 ")\n",
|
||||
key,
|
||||
val);
|
||||
continue;
|
||||
}
|
||||
|
@ -140,7 +141,7 @@ main(int argc, char *argv[])
|
|||
num_found = 0;
|
||||
for (z = ksnum; z < KTNUM; z++) {
|
||||
max_rehash = 0;
|
||||
for (name = tab, i = z; --i >= 0;)
|
||||
for (name = tab, i = z; --i >= 0; )
|
||||
*name++ = 0;
|
||||
for (i = 0; i < ksnum; i++) {
|
||||
name = info[i].name;
|
||||
|
@ -168,7 +169,7 @@ main(int argc, char *argv[])
|
|||
if (num_found >= MATCHES)
|
||||
break;
|
||||
}
|
||||
next1: ;
|
||||
next1:;
|
||||
}
|
||||
|
||||
z = best_z;
|
||||
|
@ -196,13 +197,13 @@ next1: ;
|
|||
offsets[j] = k;
|
||||
indexes[i] = k;
|
||||
val = info[i].val;
|
||||
printf("0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2"PRIx32", "
|
||||
"0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2"PRIx32", ",
|
||||
printf("0x%.2" PRIx32 ", 0x%.2" PRIx32 ", 0x%.2" PRIx32 ", "
|
||||
"0x%.2" PRIx32 ", 0x%.2" PRIx32 ", 0x%.2" PRIx32 ", ",
|
||||
(sig >> 8) & 0xff, sig & 0xff, (val >> 24) & 0xff,
|
||||
(val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff);
|
||||
for (name = info[i].name, k += 7; (c = *name++); k++)
|
||||
printf("'%c',", c);
|
||||
printf((i == (ksnum-1)) ? "0\n" : "0,\n");
|
||||
printf((i == (ksnum - 1)) ? "0\n" : "0,\n");
|
||||
}
|
||||
printf("};\n");
|
||||
printf("\n");
|
||||
|
@ -210,7 +211,7 @@ next1: ;
|
|||
printf("#define KMAXHASH %d\n", best_max_rehash + 1);
|
||||
printf("\n");
|
||||
printf("static const unsigned short hashString[KTABLESIZE] = {\n");
|
||||
for (i = 0; i < z;) {
|
||||
for (i = 0; i < z; ) {
|
||||
printf("0x%.4x", offsets[i]);
|
||||
i++;
|
||||
if (i == z)
|
||||
|
@ -224,7 +225,7 @@ next1: ;
|
|||
num_found = 0;
|
||||
for (z = ksnum; z < KTNUM; z++) {
|
||||
max_rehash = 0;
|
||||
for (name = tab, i = z; --i >= 0;)
|
||||
for (name = tab, i = z; --i >= 0; )
|
||||
*name++ = 0;
|
||||
for (i = 0; i < ksnum; i++) {
|
||||
val = info[i].val;
|
||||
|
@ -242,7 +243,7 @@ next1: ;
|
|||
values[j] = val;
|
||||
if (k > max_rehash)
|
||||
max_rehash = k;
|
||||
skip1: ;
|
||||
skip1:;
|
||||
}
|
||||
if (max_rehash < MIN_REHASH) {
|
||||
if (max_rehash < best_max_rehash) {
|
||||
|
@ -253,7 +254,7 @@ skip1: ;
|
|||
if (num_found >= MATCHES)
|
||||
break;
|
||||
}
|
||||
next2: ;
|
||||
next2:;
|
||||
}
|
||||
|
||||
z = best_z;
|
||||
|
@ -262,7 +263,7 @@ next2: ;
|
|||
"Try increasing KTNUM in makekeys.c\n");
|
||||
exit(1);
|
||||
}
|
||||
for (i = z; --i >= 0;)
|
||||
for (i = z; --i >= 0; )
|
||||
offsets[i] = 0;
|
||||
for (i = 0; i < ksnum; i++) {
|
||||
val = info[i].val;
|
||||
|
@ -276,14 +277,14 @@ next2: ;
|
|||
}
|
||||
offsets[j] = indexes[i] + 2;
|
||||
values[j] = val;
|
||||
skip2: ;
|
||||
skip2:;
|
||||
}
|
||||
printf("\n");
|
||||
printf("#define VTABLESIZE %d\n", z);
|
||||
printf("#define VMAXHASH %d\n", best_max_rehash + 1);
|
||||
printf("\n");
|
||||
printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n");
|
||||
for (i = 0; i < z;) {
|
||||
for (i = 0; i < z; ) {
|
||||
printf("0x%.4x", offsets[i]);
|
||||
i++;
|
||||
if (i == z)
|
||||
|
|
50
src/alloc.c
50
src/alloc.c
|
@ -1,27 +1,27 @@
|
|||
/*
|
||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xkb-priv.h"
|
||||
#include "alloc.h"
|
||||
|
@ -279,7 +279,6 @@ XkbcAllocCompatMap(struct xkb_keymap *keymap, unsigned nSI)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
XkbcFreeCompatMap(struct xkb_keymap *keymap)
|
||||
{
|
||||
|
@ -292,7 +291,8 @@ XkbcFreeCompatMap(struct xkb_keymap *keymap)
|
|||
}
|
||||
|
||||
int
|
||||
XkbcAllocNames(struct xkb_keymap *keymap, unsigned which, size_t nTotalAliases)
|
||||
XkbcAllocNames(struct xkb_keymap *keymap, unsigned which,
|
||||
size_t nTotalAliases)
|
||||
{
|
||||
if (!keymap)
|
||||
return BadMatch;
|
||||
|
|
48
src/alloc.h
48
src/alloc.h
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifndef ALLOC_H
|
||||
#define ALLOC_H
|
||||
|
|
138
src/atom.c
138
src/atom.c
|
@ -1,73 +1,73 @@
|
|||
/***********************************************************
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
* Copyright 1987, 1998 The Open Group
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of The Open Group shall not be
|
||||
* used in advertising or otherwise to promote the sale, use or other dealings
|
||||
* in this Software without prior written authorization from The Open Group.
|
||||
*
|
||||
*
|
||||
* Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of Digital not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
/************************************************************
|
||||
Copyright 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "atom.h"
|
||||
|
@ -173,8 +173,8 @@ atom_intern(struct atom_table *table, const char *string)
|
|||
else if (comp > 0)
|
||||
np = &((*np)->right);
|
||||
else
|
||||
return(*np)->a;
|
||||
}
|
||||
return (*np)->a;
|
||||
}
|
||||
}
|
||||
|
||||
nd = malloc(sizeof(*nd));
|
||||
|
|
48
src/atom.h
48
src/atom.h
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifndef ATOM_H
|
||||
#define ATOM_H
|
||||
|
|
|
@ -107,7 +107,7 @@ xkb_context_include_path_clear(struct xkb_context *ctx)
|
|||
char **path;
|
||||
|
||||
darray_foreach(path, ctx->includes)
|
||||
free(*path);
|
||||
free(*path);
|
||||
|
||||
darray_free(ctx->includes);
|
||||
}
|
||||
|
|
334
src/darray.h
334
src/darray.h
|
@ -122,14 +122,16 @@
|
|||
|
||||
/*** Life cycle ***/
|
||||
|
||||
#define darray(type) struct {type *item; size_t size; size_t alloc;}
|
||||
#define darray(type) struct { type *item; size_t size; size_t alloc; }
|
||||
|
||||
#define darray_new() {0,0,0}
|
||||
#define darray_init(arr) do {(arr).item=0; (arr).size=0; (arr).alloc=0;} while(0)
|
||||
#define darray_free(arr) do {free((arr).item); darray_init(arr);} while(0)
|
||||
#define darray_new() { 0, 0, 0 }
|
||||
#define darray_init(arr) do { (arr).item = 0; (arr).size = 0; (arr).alloc = 0; \
|
||||
} while (0)
|
||||
#define darray_free(arr) do { free((arr).item); darray_init(arr); } while (0)
|
||||
|
||||
/* Only use for immutable darray - e.g. for static const initialzers. */
|
||||
#define darray_lit(c_array) {(c_array), sizeof(c_array) / sizeof(*(c_array)), 0}
|
||||
#define darray_lit(c_array) { (c_array), sizeof(c_array) / sizeof(*(c_array)), \
|
||||
0 }
|
||||
|
||||
/*
|
||||
* Typedefs for darrays of common types. These are useful
|
||||
|
@ -148,153 +150,186 @@
|
|||
* foo(&arr);
|
||||
*/
|
||||
|
||||
typedef darray(char) darray_char;
|
||||
typedef darray(signed char) darray_schar;
|
||||
typedef darray(unsigned char) darray_uchar;
|
||||
typedef darray (char) darray_char;
|
||||
typedef darray (signed char) darray_schar;
|
||||
typedef darray (unsigned char) darray_uchar;
|
||||
|
||||
typedef darray(short) darray_short;
|
||||
typedef darray(int) darray_int;
|
||||
typedef darray(long) darray_long;
|
||||
|
||||
typedef darray(unsigned short) darray_ushort;
|
||||
typedef darray(unsigned int) darray_uint;
|
||||
typedef darray(unsigned long) darray_ulong;
|
||||
typedef darray (short) darray_short;
|
||||
typedef darray (int) darray_int;
|
||||
typedef darray (long) darray_long;
|
||||
|
||||
typedef darray (unsigned short) darray_ushort;
|
||||
typedef darray (unsigned int) darray_uint;
|
||||
typedef darray (unsigned long) darray_ulong;
|
||||
|
||||
/*** Access ***/
|
||||
|
||||
#define darray_item(arr, i) ((arr).item[i])
|
||||
#define darray_size(arr) ((arr).size)
|
||||
#define darray_alloc(arr) ((arr).alloc)
|
||||
#define darray_empty(arr) ((arr).size == 0)
|
||||
#define darray_item(arr, i) ((arr).item[i])
|
||||
#define darray_size(arr) ((arr).size)
|
||||
#define darray_alloc(arr) ((arr).alloc)
|
||||
#define darray_empty(arr) ((arr).size == 0)
|
||||
|
||||
#define darray_mem(arr, offset) ((arr).item + (offset))
|
||||
#define darray_same(arr1, arr2) ((arr1).item == (arr2).item)
|
||||
|
||||
/*** Insertion (single item) ***/
|
||||
|
||||
#define darray_append(arr, ...) do { \
|
||||
darray_resize(arr, (arr).size+1); \
|
||||
(arr).item[(arr).size-1] = (__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define darray_append(arr, ...) do { \
|
||||
darray_resize(arr, (arr).size + 1); \
|
||||
(arr).item[(arr).size - 1] = (__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define darray_prepend(arr, ...) do { \
|
||||
darray_resize(arr, (arr).size+1); \
|
||||
memmove((arr).item+1, (arr).item, ((arr).size-1)*sizeof(*(arr).item)); \
|
||||
(arr).item[0] = (__VA_ARGS__); \
|
||||
} while(0)
|
||||
#define darray_push(arr, ...) darray_append(arr, __VA_ARGS__)
|
||||
|
||||
darray_resize(arr, (arr).size + 1); \
|
||||
memmove((arr).item + 1, (arr).item, \
|
||||
((arr).size - 1) * sizeof(*(arr).item)); \
|
||||
(arr).item[0] = (__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define darray_push(arr, ...) darray_append(arr, __VA_ARGS__)
|
||||
|
||||
/*** Insertion (multiple items) ***/
|
||||
|
||||
#define darray_append_items(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __oldSize + __count); \
|
||||
memcpy((arr).item + __oldSize, items, __count * sizeof(*(arr).item)); \
|
||||
} while(0)
|
||||
#define darray_append_items(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __oldSize + __count); \
|
||||
memcpy((arr).item + __oldSize, items, __count * sizeof(*(arr).item)); \
|
||||
} while (0)
|
||||
|
||||
#define darray_prepend_items(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __count + __oldSize); \
|
||||
memmove((arr).item + __count, (arr).item, __oldSize * sizeof(*(arr).item)); \
|
||||
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
||||
} while(0)
|
||||
#define darray_prepend_items(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __count + __oldSize); \
|
||||
memmove((arr).item + __count, (arr).item, __oldSize * \
|
||||
sizeof(*(arr).item)); \
|
||||
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
||||
} while (0)
|
||||
|
||||
#define darray_append_items_nullterminate(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __oldSize + __count + 1); \
|
||||
memcpy((arr).item + __oldSize, items, __count * sizeof(*(arr).item)); \
|
||||
(arr).item[--(arr).size] = 0; \
|
||||
} while(0)
|
||||
#define darray_append_items_nullterminate(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __oldSize + __count + 1); \
|
||||
memcpy((arr).item + __oldSize, items, __count * sizeof(*(arr).item)); \
|
||||
(arr).item[--(arr).size] = 0; \
|
||||
} while (0)
|
||||
|
||||
#define darray_prepend_items_nullterminate(arr, items, count) do { \
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __count + __oldSize + 1); \
|
||||
memmove((arr).item + __count, (arr).item, __oldSize * sizeof(*(arr).item)); \
|
||||
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
||||
(arr).item[--(arr).size] = 0; \
|
||||
} while(0)
|
||||
size_t __count = (count), __oldSize = (arr).size; \
|
||||
darray_resize(arr, __count + __oldSize + 1); \
|
||||
memmove((arr).item + __count, (arr).item, __oldSize * \
|
||||
sizeof(*(arr).item)); \
|
||||
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
||||
(arr).item[--(arr).size] = 0; \
|
||||
} while (0)
|
||||
|
||||
#if HAVE_TYPEOF
|
||||
#define darray_appends(arr, ...) darray_appends_t(arr, typeof((*(arr).item)), __VA_ARGS__)
|
||||
#define darray_prepends(arr, ...) darray_prepends_t(arr, typeof((*(arr).item)), __VA_ARGS__)
|
||||
#define darray_appends(arr, ...) darray_appends_t(arr, typeof((*(arr).item)), \
|
||||
__VA_ARGS__)
|
||||
#define darray_prepends(arr, ...) darray_prepends_t(arr, typeof((*(arr).item)), \
|
||||
__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define darray_appends_t(arr, type, ...) do { \
|
||||
type __src[] = {__VA_ARGS__}; \
|
||||
darray_append_items(arr, __src, sizeof(__src)/sizeof(*__src)); \
|
||||
} while(0)
|
||||
#define darray_appends_t(arr, type, ...) do { \
|
||||
type __src[] = { __VA_ARGS__ }; \
|
||||
darray_append_items(arr, __src, sizeof(__src) / sizeof(*__src)); \
|
||||
} while (0)
|
||||
#define darray_prepends_t(arr, type, ...) do { \
|
||||
type __src[] = {__VA_ARGS__}; \
|
||||
darray_prepend_items(arr, __src, sizeof(__src)/sizeof(*__src)); \
|
||||
} while(0)
|
||||
|
||||
type __src[] = { __VA_ARGS__ }; \
|
||||
darray_prepend_items(arr, __src, sizeof(__src) / sizeof(*__src)); \
|
||||
} while (0)
|
||||
|
||||
/*** Removal ***/
|
||||
|
||||
/* Warning: Do not call darray_pop on an empty darray. */
|
||||
#define darray_pop(arr) ((arr).item[--(arr).size])
|
||||
#define darray_pop(arr) ((arr).item[--(arr).size])
|
||||
#define darray_pop_check(arr) ((arr).size ? darray_pop(arr) : NULL)
|
||||
|
||||
|
||||
/*** Replacement ***/
|
||||
|
||||
#define darray_from_items(arr, items, count) do {size_t __count = (count); darray_resize(arr, __count); memcpy((arr).item, items, __count*sizeof(*(arr).item));} while(0)
|
||||
#define darray_from_c(arr, c_array) darray_from_items(arr, c_array, sizeof(c_array)/sizeof(*(c_array)))
|
||||
#define darray_copy(arr_to, arr_from) darray_from_items(arr_to, (arr_from).item, (arr_from).size)
|
||||
|
||||
#define darray_from_items(arr, items, count) do { size_t __count = (count); \
|
||||
darray_resize(arr, __count); \
|
||||
memcpy((arr).item, items, \
|
||||
__count \
|
||||
* sizeof(*(arr).item)); \
|
||||
} while (0)
|
||||
#define darray_from_c(arr, c_array) darray_from_items( \
|
||||
arr, c_array, sizeof(c_array) / sizeof(*(c_array)))
|
||||
#define darray_copy(arr_to, arr_from) darray_from_items( \
|
||||
arr_to, \
|
||||
(arr_from). \
|
||||
item, (arr_from).size)
|
||||
|
||||
/*** String buffer ***/
|
||||
|
||||
#define darray_append_string(arr, str) do {const char *__str = (str); darray_append_items(arr, __str, strlen(__str)+1); (arr).size--;} while(0)
|
||||
#define darray_append_lit(arr, stringLiteral) do {darray_append_items(arr, stringLiteral, sizeof(stringLiteral)); (arr).size--;} while(0)
|
||||
#define darray_append_string(arr, str) do { const char *__str = (str); \
|
||||
darray_append_items( \
|
||||
arr, __str, \
|
||||
strlen(__str) + 1); \
|
||||
(arr).size--; \
|
||||
} while (0)
|
||||
#define darray_append_lit(arr, stringLiteral) do { darray_append_items( \
|
||||
arr, stringLiteral, \
|
||||
sizeof(stringLiteral)); \
|
||||
(arr).size--; } while (0)
|
||||
|
||||
#define darray_prepend_string(arr, str) do { \
|
||||
const char *__str = (str); \
|
||||
darray_prepend_items_nullterminate(arr, __str, strlen(__str)); \
|
||||
} while(0)
|
||||
#define darray_prepend_string(arr, str) do { \
|
||||
const char *__str = (str); \
|
||||
darray_prepend_items_nullterminate(arr, __str, strlen(__str)); \
|
||||
} while (0)
|
||||
#define darray_prepend_lit(arr, stringLiteral) \
|
||||
darray_prepend_items_nullterminate(arr, stringLiteral, sizeof(stringLiteral) - 1)
|
||||
|
||||
#define darray_from_string(arr, str) do {const char *__str = (str); darray_from_items(arr, __str, strlen(__str)+1); (arr).size--;} while(0)
|
||||
#define darray_from_lit(arr, stringLiteral) do {darray_from_items(arr, stringLiteral, sizeof(stringLiteral)); (arr).size--;} while(0)
|
||||
darray_prepend_items_nullterminate(arr, stringLiteral, \
|
||||
sizeof(stringLiteral) - 1)
|
||||
|
||||
#define darray_from_string(arr, str) do { const char *__str = (str); \
|
||||
darray_from_items( \
|
||||
arr, __str, strlen( \
|
||||
__str) + 1); \
|
||||
(arr).size--; \
|
||||
} while (0)
|
||||
#define darray_from_lit(arr, stringLiteral) do { darray_from_items( \
|
||||
arr, stringLiteral, \
|
||||
sizeof(stringLiteral)); \
|
||||
(arr).size--; } while (0)
|
||||
|
||||
/*** Size management ***/
|
||||
|
||||
#define darray_resize(arr, newSize) darray_growalloc(arr, (arr).size = (newSize))
|
||||
#define darray_resize0(arr, newSize) do { \
|
||||
size_t __oldSize = (arr).size, __newSize = (newSize); \
|
||||
(arr).size = __newSize; \
|
||||
if (__newSize > __oldSize) { \
|
||||
darray_growalloc(arr, __newSize); \
|
||||
memset(&(arr).item[__oldSize], 0, (__newSize - __oldSize) * sizeof(*(arr).item)); \
|
||||
} \
|
||||
} while(0)
|
||||
#define darray_resize(arr, newSize) darray_growalloc(arr, (arr).size = \
|
||||
(newSize))
|
||||
#define darray_resize0(arr, newSize) do { \
|
||||
size_t __oldSize = (arr).size, __newSize = (newSize); \
|
||||
(arr).size = __newSize; \
|
||||
if (__newSize > __oldSize) { \
|
||||
darray_growalloc(arr, __newSize); \
|
||||
memset(&(arr).item[__oldSize], 0, \
|
||||
(__newSize - __oldSize) * sizeof(*(arr).item)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define darray_realloc(arr, newAlloc) do { \
|
||||
(arr).item = realloc((arr).item, ((arr).alloc = (newAlloc)) * sizeof(*(arr).item)); \
|
||||
} while(0)
|
||||
#define darray_growalloc(arr, need) do { \
|
||||
size_t __need = (need); \
|
||||
if (__need > (arr).alloc) \
|
||||
darray_realloc(arr, darray_next_alloc((arr).alloc, __need)); \
|
||||
} while(0)
|
||||
(arr).item = \
|
||||
realloc((arr).item, ((arr).alloc = (newAlloc)) * \
|
||||
sizeof(*(arr).item)); \
|
||||
} while (0)
|
||||
#define darray_growalloc(arr, need) do { \
|
||||
size_t __need = (need); \
|
||||
if (__need > (arr).alloc) \
|
||||
darray_realloc(arr, darray_next_alloc((arr).alloc, __need)); \
|
||||
} while (0)
|
||||
|
||||
#if HAVE_STATEMENT_EXPR==1
|
||||
#define darray_make_room(arr, room) ({size_t newAlloc = (arr).size+(room); if ((arr).alloc<newAlloc) darray_realloc(arr, newAlloc); (arr).item+(arr).size; })
|
||||
#if HAVE_STATEMENT_EXPR == 1
|
||||
#define darray_make_room(arr, \
|
||||
room) ({ size_t newAlloc = (arr).size + (room); \
|
||||
if ((arr).alloc < \
|
||||
newAlloc) darray_realloc(arr, newAlloc); \
|
||||
(arr).item + (arr).size; })
|
||||
#endif
|
||||
|
||||
static inline size_t darray_next_alloc(size_t alloc, size_t need)
|
||||
static inline size_t
|
||||
darray_next_alloc(size_t alloc, size_t need)
|
||||
{
|
||||
if (alloc == 0)
|
||||
alloc = 4;
|
||||
while (alloc < need)
|
||||
alloc *= 2;
|
||||
return alloc;
|
||||
if (alloc == 0)
|
||||
alloc = 4;
|
||||
while (alloc < need)
|
||||
alloc *= 2;
|
||||
return alloc;
|
||||
}
|
||||
|
||||
|
||||
/*** Traversal ***/
|
||||
|
||||
/*
|
||||
|
@ -303,7 +338,7 @@ static inline size_t darray_next_alloc(size_t alloc, size_t need)
|
|||
* Traverse a darray. `i` must be declared in advance as a pointer to an item.
|
||||
*/
|
||||
#define darray_foreach(i, arr) \
|
||||
for ((i) = &(arr).item[0]; (i) < &(arr).item[(arr).size]; (i)++)
|
||||
for ((i) = &(arr).item[0]; (i) < &(arr).item[(arr).size]; (i)++)
|
||||
|
||||
/*
|
||||
* darray_foreach_reverse(T *&i, darray(T) arr) {...}
|
||||
|
@ -311,53 +346,52 @@ static inline size_t darray_next_alloc(size_t alloc, size_t need)
|
|||
* Like darray_foreach, but traverse in reverse order.
|
||||
*/
|
||||
#define darray_foreach_reverse(i, arr) \
|
||||
for ((i) = &(arr).item[(arr).size]; (i)-- > &(arr).item[0]; )
|
||||
|
||||
for ((i) = &(arr).item[(arr).size]; (i)-- > &(arr).item[0]; )
|
||||
|
||||
#endif /* CCAN_DARRAY_H */
|
||||
|
||||
/*
|
||||
|
||||
darray_growalloc(arr, newAlloc) sees if the darray can currently hold newAlloc items;
|
||||
if not, it increases the alloc to satisfy this requirement, allocating slack
|
||||
space to avoid having to reallocate for every size increment.
|
||||
|
||||
darray_from_string(arr, str) copies a string to an darray_char.
|
||||
|
||||
darray_push(arr, item) pushes an item to the end of the darray.
|
||||
darray_pop(arr) pops it back out. Be sure there is at least one item in the darray before calling.
|
||||
darray_pop_check(arr) does the same as darray_pop, but returns NULL if there are no more items left in the darray.
|
||||
|
||||
darray_make_room(arr, room) ensures there's 'room' elements of space after the end of the darray, and it returns a pointer to this space.
|
||||
Currently requires HAVE_STATEMENT_EXPR, but I plan to remove this dependency by creating an inline function.
|
||||
|
||||
The following require HAVE_TYPEOF==1 :
|
||||
|
||||
darray_appends(arr, item0, item1...) appends a collection of comma-delimited items to the darray.
|
||||
darray_prepends(arr, item0, item1...) prepends a collection of comma-delimited items to the darray.\
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
darray(int) arr;
|
||||
int *i;
|
||||
|
||||
darray_appends(arr, 0,1,2,3,4);
|
||||
darray_appends(arr, -5,-4,-3,-2,-1);
|
||||
darray_foreach(i, arr)
|
||||
printf("%d ", *i);
|
||||
printf("\n");
|
||||
|
||||
darray_free(arr);
|
||||
|
||||
|
||||
typedef struct {int n,d;} Fraction;
|
||||
darray(Fraction) fractions;
|
||||
Fraction *i;
|
||||
|
||||
darray_appends(fractions, {3,4}, {3,5}, {2,1});
|
||||
darray_foreach(i, fractions)
|
||||
printf("%d/%d\n", i->n, i->d);
|
||||
|
||||
darray_free(fractions);
|
||||
*/
|
||||
*
|
||||
* darray_growalloc(arr, newAlloc) sees if the darray can currently hold newAlloc items;
|
||||
* if not, it increases the alloc to satisfy this requirement, allocating slack
|
||||
* space to avoid having to reallocate for every size increment.
|
||||
*
|
||||
* darray_from_string(arr, str) copies a string to an darray_char.
|
||||
*
|
||||
* darray_push(arr, item) pushes an item to the end of the darray.
|
||||
* darray_pop(arr) pops it back out. Be sure there is at least one item in the darray before calling.
|
||||
* darray_pop_check(arr) does the same as darray_pop, but returns NULL if there are no more items left in the darray.
|
||||
*
|
||||
* darray_make_room(arr, room) ensures there's 'room' elements of space after the end of the darray, and it returns a pointer to this space.
|
||||
* Currently requires HAVE_STATEMENT_EXPR, but I plan to remove this dependency by creating an inline function.
|
||||
*
|
||||
* The following require HAVE_TYPEOF==1 :
|
||||
*
|
||||
* darray_appends(arr, item0, item1...) appends a collection of comma-delimited items to the darray.
|
||||
* darray_prepends(arr, item0, item1...) prepends a collection of comma-delimited items to the darray.\
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* darray(int) arr;
|
||||
* int *i;
|
||||
*
|
||||
* darray_appends(arr, 0,1,2,3,4);
|
||||
* darray_appends(arr, -5,-4,-3,-2,-1);
|
||||
* darray_foreach(i, arr)
|
||||
* printf("%d ", *i);
|
||||
* printf("\n");
|
||||
*
|
||||
* darray_free(arr);
|
||||
*
|
||||
*
|
||||
* typedef struct {int n,d;} Fraction;
|
||||
* darray(Fraction) fractions;
|
||||
* Fraction *i;
|
||||
*
|
||||
* darray_appends(fractions, {3,4}, {3,5}, {2,1});
|
||||
* darray_foreach(i, fractions)
|
||||
* printf("%d/%d\n", i->n, i->d);
|
||||
*
|
||||
* darray_free(fractions);
|
||||
*/
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
|
@ -58,11 +58,11 @@
|
|||
#include "xkb-priv.h"
|
||||
#include "text.h"
|
||||
|
||||
#define VMOD_HIDE_VALUE 0
|
||||
#define VMOD_SHOW_VALUE 1
|
||||
#define VMOD_COMMENT_VALUE 2
|
||||
#define VMOD_HIDE_VALUE 0
|
||||
#define VMOD_SHOW_VALUE 1
|
||||
#define VMOD_COMMENT_VALUE 2
|
||||
|
||||
#define BUF_CHUNK_SIZE 4096
|
||||
#define BUF_CHUNK_SIZE 4096
|
||||
|
||||
static bool
|
||||
do_realloc(char **buf, size_t *size, size_t offset, size_t at_least)
|
||||
|
@ -86,45 +86,46 @@ do_realloc(char **buf, size_t *size, size_t offset, size_t at_least)
|
|||
/* This whole thing should be a function, but you can't call vsnprintf
|
||||
* multiple times. */
|
||||
#define check_write_buf(keymap, buf, size, offset, ...) \
|
||||
do { \
|
||||
size_t _printed; \
|
||||
bool _ret = true; \
|
||||
do { \
|
||||
size_t _printed; \
|
||||
bool _ret = true; \
|
||||
\
|
||||
/* Concatenate the strings, and check whether or not the output was \
|
||||
* truncated. */ \
|
||||
while ((_printed = snprintf(*buf + *offset, *size - *offset, \
|
||||
__VA_ARGS__)) >= \
|
||||
(*size - *offset)) {\
|
||||
/* If it was truncated, embiggen the string and roll from the top. */ \
|
||||
if (!do_realloc(buf, size, *offset, _printed)) { \
|
||||
fprintf(stderr, \
|
||||
"xkbcommon: failed to allocate %zu bytes for keymap\n", \
|
||||
*size); \
|
||||
free(*buf); \
|
||||
*buf = NULL; \
|
||||
_ret = false; \
|
||||
break; \
|
||||
/* Concatenate the strings, and check whether or not the output was \
|
||||
* truncated. */ \
|
||||
while ((_printed = snprintf(*buf + *offset, *size - *offset, \
|
||||
__VA_ARGS__)) >= \
|
||||
(*size - *offset)) { \
|
||||
/* If it was truncated, embiggen the string and roll from the top. */ \
|
||||
if (!do_realloc(buf, size, *offset, _printed)) { \
|
||||
fprintf(stderr, \
|
||||
"xkbcommon: couldn't allocate %zu bytes for keymap\n", \
|
||||
*size); \
|
||||
free(*buf); \
|
||||
*buf = NULL; \
|
||||
_ret = false; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
if (_ret == true) \
|
||||
*offset += _printed; \
|
||||
} while (0)
|
||||
if (_ret == true) \
|
||||
*offset += _printed; \
|
||||
} while (0)
|
||||
|
||||
#define write_buf(keymap, buf, size, offset, ...) \
|
||||
do { \
|
||||
check_write_buf(keymap, buf, size, offset, __VA_ARGS__); \
|
||||
if (*buf == NULL) \
|
||||
return false; \
|
||||
} while (0)
|
||||
do { \
|
||||
check_write_buf(keymap, buf, size, offset, __VA_ARGS__); \
|
||||
if (*buf == NULL) \
|
||||
return false; \
|
||||
} while (0)
|
||||
|
||||
static bool
|
||||
write_vmods(struct xkb_keymap *keymap, char **buf, size_t *size, size_t *offset)
|
||||
write_vmods(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||
size_t *offset)
|
||||
{
|
||||
int num_vmods = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < XkbNumVirtualMods; i++) {
|
||||
if (!keymap->names->vmods[i])
|
||||
if (!keymap->names->vmods[i])
|
||||
continue;
|
||||
if (num_vmods == 0)
|
||||
write_buf(keymap, buf, size, offset, "\t\tvirtual_modifiers ");
|
||||
|
@ -135,7 +136,7 @@ write_vmods(struct xkb_keymap *keymap, char **buf, size_t *size, size_t *offset)
|
|||
}
|
||||
|
||||
if (num_vmods > 0)
|
||||
write_buf(keymap, buf, size, offset, ";\n\n");
|
||||
write_buf(keymap, buf, size, offset, ";\n\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -143,10 +144,10 @@ write_vmods(struct xkb_keymap *keymap, char **buf, size_t *size, size_t *offset)
|
|||
#define GET_TEXT_BUF_SIZE 512
|
||||
|
||||
#define append_get_text(...) do { \
|
||||
int _size = snprintf(ret, GET_TEXT_BUF_SIZE, __VA_ARGS__); \
|
||||
if (_size >= GET_TEXT_BUF_SIZE) \
|
||||
return NULL; \
|
||||
} while(0)
|
||||
int _size = snprintf(ret, GET_TEXT_BUF_SIZE, __VA_ARGS__); \
|
||||
if (_size >= GET_TEXT_BUF_SIZE) \
|
||||
return NULL; \
|
||||
} while (0)
|
||||
|
||||
/* FIXME: Merge with src/xkbcomp/expr.c::modIndexNames. */
|
||||
static const char *core_mod_names[] = {
|
||||
|
@ -167,7 +168,8 @@ get_mod_index_text(uint8_t real_mod)
|
|||
}
|
||||
|
||||
static char *
|
||||
get_mod_mask_text(struct xkb_keymap *keymap, uint8_t real_mods, uint32_t vmods)
|
||||
get_mod_mask_text(struct xkb_keymap *keymap, uint8_t real_mods,
|
||||
uint32_t vmods)
|
||||
{
|
||||
static char ret[GET_TEXT_BUF_SIZE], ret2[GET_TEXT_BUF_SIZE];
|
||||
int i;
|
||||
|
@ -323,26 +325,25 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
keymap->max_key_code);
|
||||
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
if (darray_item(keymap->names->keys, key).name[0] == '\0')
|
||||
if (darray_item(keymap->names->keys, key).name[0] == '\0')
|
||||
continue;
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t\t%6s = %d;\n",
|
||||
XkbcKeyNameText(darray_item(keymap->names->keys, key).name),
|
||||
key);
|
||||
XkbcKeyNameText(darray_item(keymap->names->keys, key).name),
|
||||
key);
|
||||
}
|
||||
|
||||
for (i = 0; i < XkbNumIndicators; i++) {
|
||||
if (!keymap->names->indicators[i])
|
||||
continue;
|
||||
write_buf(keymap, buf, size, offset, "\t\tindicator %d = \"%s\";\n",
|
||||
write_buf(keymap, buf, size, offset, "\t\tindicator %d = \"%s\";\n",
|
||||
i + 1, keymap->names->indicators[i]);
|
||||
}
|
||||
|
||||
|
||||
darray_foreach(alias, keymap->names->key_aliases)
|
||||
write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n",
|
||||
XkbcKeyNameText(alias->alias),
|
||||
XkbcKeyNameText(alias->real));
|
||||
write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n",
|
||||
XkbcKeyNameText(alias->alias),
|
||||
XkbcKeyNameText(alias->real));
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t};\n\n");
|
||||
return true;
|
||||
|
@ -364,19 +365,19 @@ write_types(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_vmods(keymap, buf, size, offset);
|
||||
|
||||
darray_foreach(type, keymap->map->types) {
|
||||
write_buf(keymap, buf, size, offset, "\t\ttype \"%s\" {\n",
|
||||
type->name);
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tmodifiers= %s;\n",
|
||||
get_mod_mask_text(keymap, type->mods.real_mods,
|
||||
write_buf(keymap, buf, size, offset, "\t\ttype \"%s\" {\n",
|
||||
type->name);
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tmodifiers= %s;\n",
|
||||
get_mod_mask_text(keymap, type->mods.real_mods,
|
||||
type->mods.vmods));
|
||||
|
||||
for (n = 0; n < darray_size(type->map); n++) {
|
||||
for (n = 0; n < darray_size(type->map); n++) {
|
||||
struct xkb_kt_map_entry *entry = &darray_item(type->map, n);
|
||||
char *str;
|
||||
|
||||
str = get_mod_mask_text(keymap, entry->mods.real_mods,
|
||||
entry->mods.vmods);
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tmap[%s]= Level%d;\n",
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tmap[%s]= Level%d;\n",
|
||||
str, entry->level + 1);
|
||||
|
||||
if (!type->preserve || (!type->preserve[n].real_mods &&
|
||||
|
@ -386,18 +387,18 @@ write_types(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_buf(keymap, buf, size, offset, "%s;\n",
|
||||
get_mod_mask_text(keymap, type->preserve[n].real_mods,
|
||||
type->preserve[n].vmods));
|
||||
}
|
||||
}
|
||||
|
||||
if (type->level_names) {
|
||||
for (n = 0; n < type->num_levels; n++) {
|
||||
if (!type->level_names[n])
|
||||
continue;
|
||||
write_buf(keymap, buf, size, offset,
|
||||
if (type->level_names) {
|
||||
for (n = 0; n < type->num_levels; n++) {
|
||||
if (!type->level_names[n])
|
||||
continue;
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\t\tlevel_name[Level%d]= \"%s\";\n", n + 1,
|
||||
type->level_names[n]);
|
||||
}
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\t\t};\n");
|
||||
}
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\t\t};\n");
|
||||
}
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t};\n\n");
|
||||
|
@ -414,27 +415,29 @@ write_indicator_map(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
keymap->names->indicators[num]);
|
||||
|
||||
if (led->which_groups) {
|
||||
if (led->which_groups != XkbIM_UseEffective) {
|
||||
write_buf(keymap, buf, size, offset, "\t\t\twhichGroupState= %s;\n",
|
||||
get_indicator_state_text(led->which_groups));
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tgroups= 0x%02x;\n",
|
||||
if (led->which_groups != XkbIM_UseEffective) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\t\twhichGroupState= %s;\n",
|
||||
get_indicator_state_text(
|
||||
led->which_groups));
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tgroups= 0x%02x;\n",
|
||||
led->groups);
|
||||
}
|
||||
|
||||
if (led->which_mods) {
|
||||
if (led->which_mods != XkbIM_UseEffective) {
|
||||
write_buf(keymap, buf, size, offset, "\t\t\twhichModState= %s;\n",
|
||||
if (led->which_mods != XkbIM_UseEffective) {
|
||||
write_buf(keymap, buf, size, offset, "\t\t\twhichModState= %s;\n",
|
||||
get_indicator_state_text(led->which_mods));
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tmodifiers= %s;\n",
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tmodifiers= %s;\n",
|
||||
get_mod_mask_text(keymap, led->mods.real_mods,
|
||||
led->mods.vmods));
|
||||
led->mods.vmods));
|
||||
}
|
||||
|
||||
if (led->ctrls) {
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tcontrols= %s;\n",
|
||||
get_control_mask_text(led->ctrls));
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tcontrols= %s;\n",
|
||||
get_control_mask_text(led->ctrls));
|
||||
}
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t\t};\n");
|
||||
|
@ -447,24 +450,29 @@ get_interp_match_text(uint8_t type)
|
|||
static char ret[16];
|
||||
|
||||
switch (type & XkbSI_OpMask) {
|
||||
case XkbSI_NoneOf:
|
||||
sprintf(ret, "NoneOf");
|
||||
break;
|
||||
case XkbSI_AnyOfOrNone:
|
||||
sprintf(ret, "AnyOfOrNone");
|
||||
break;
|
||||
case XkbSI_AnyOf:
|
||||
sprintf(ret, "AnyOf");
|
||||
break;
|
||||
case XkbSI_AllOf:
|
||||
sprintf(ret, "AllOf");
|
||||
break;
|
||||
case XkbSI_Exactly:
|
||||
sprintf(ret, "Exactly");
|
||||
break;
|
||||
default:
|
||||
sprintf(ret, "0x%x", type & XkbSI_OpMask);
|
||||
break;
|
||||
case XkbSI_NoneOf:
|
||||
sprintf(ret, "NoneOf");
|
||||
break;
|
||||
|
||||
case XkbSI_AnyOfOrNone:
|
||||
sprintf(ret, "AnyOfOrNone");
|
||||
break;
|
||||
|
||||
case XkbSI_AnyOf:
|
||||
sprintf(ret, "AnyOf");
|
||||
break;
|
||||
|
||||
case XkbSI_AllOf:
|
||||
sprintf(ret, "AllOf");
|
||||
break;
|
||||
|
||||
case XkbSI_Exactly:
|
||||
sprintf(ret, "Exactly");
|
||||
break;
|
||||
|
||||
default:
|
||||
sprintf(ret, "0x%x", type & XkbSI_OpMask);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -501,11 +509,14 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_buf(keymap, buf, size, offset, "%s%s(modifiers=%s%s%s)%s",
|
||||
prefix, type, args,
|
||||
(action->any.type != XkbSA_LockGroup &&
|
||||
action->mods.flags & XkbSA_ClearLocks) ? ",clearLocks" : "",
|
||||
(action->mods.flags & XkbSA_ClearLocks)) ?
|
||||
",clearLocks" : "",
|
||||
(action->any.type != XkbSA_LockGroup &&
|
||||
action->mods.flags & XkbSA_LatchToLock) ? ",latchToLock" : "",
|
||||
(action->mods.flags & XkbSA_LatchToLock)) ?
|
||||
",latchToLock" : "",
|
||||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_SetGroup:
|
||||
if (!type)
|
||||
type = "SetGroup";
|
||||
|
@ -515,21 +526,27 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
case XkbSA_LockGroup:
|
||||
if (!type)
|
||||
type = "LockGroup";
|
||||
write_buf(keymap, buf, size, offset, "%s%s(group=%s%d%s%s)%s",
|
||||
prefix, type,
|
||||
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
||||
action->group.group > 0) ? "+" : "",
|
||||
(action->group.flags & XkbSA_GroupAbsolute) ?
|
||||
action->group.group + 1 : action->group.group,
|
||||
(action->any.type != XkbSA_LockGroup &&
|
||||
action->group.flags & XkbSA_ClearLocks) ? ",clearLocks" : "",
|
||||
(action->any.type != XkbSA_LockGroup &&
|
||||
action->group.flags & XkbSA_LatchToLock) ? ",latchToLock" : "",
|
||||
write_buf(
|
||||
keymap, buf, size, offset, "%s%s(group=%s%d%s%s)%s",
|
||||
prefix, type,
|
||||
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
||||
action->group.group > 0) ? "+" : "",
|
||||
(action->group.flags & XkbSA_GroupAbsolute) ?
|
||||
action->group.group + 1 : action->group.group,
|
||||
(action->any.type != XkbSA_LockGroup &&
|
||||
(action->group.flags & XkbSA_ClearLocks)) ?
|
||||
",clearLocks" : "",
|
||||
(action->any.type != XkbSA_LockGroup &&
|
||||
(action->group.flags & XkbSA_LatchToLock)) ?
|
||||
",latchToLock" : "",
|
||||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_Terminate:
|
||||
write_buf(keymap, buf, size, offset, "%sTerminate()%s", prefix,
|
||||
suffix);
|
||||
break;
|
||||
case XkbSA_Terminate:
|
||||
write_buf(keymap, buf, size, offset, "%sTerminate()%s", prefix, suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_MovePtr:
|
||||
write_buf(keymap, buf, size, offset, "%sMovePtr(x=%s%d,y=%s%d%s)%s",
|
||||
prefix,
|
||||
|
@ -542,22 +559,27 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
(action->ptr.flags & XkbSA_NoAcceleration) ? ",!accel" : "",
|
||||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_PtrBtn:
|
||||
if (!type)
|
||||
type = "PtrBtn";
|
||||
case XkbSA_LockPtrBtn:
|
||||
if (!type) {
|
||||
type = "LockPtrBtn";
|
||||
switch (action->btn.flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
||||
switch (action->btn.flags &
|
||||
(XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
||||
case XkbSA_LockNoUnlock:
|
||||
args = ",affect=lock";
|
||||
break;
|
||||
|
||||
case XkbSA_LockNoLock:
|
||||
args = ",affect=unlock";
|
||||
break;
|
||||
|
||||
case XkbSA_LockNoLock | XkbSA_LockNoUnlock:
|
||||
args = ",affect=neither";
|
||||
break;
|
||||
|
||||
default:
|
||||
args = ",affect=both";
|
||||
break;
|
||||
|
@ -578,6 +600,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_buf(keymap, buf, size, offset, "%s", args);
|
||||
write_buf(keymap, buf, size, offset, ")%s", suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_SetPtrDflt:
|
||||
write_buf(keymap, buf, size, offset, "%sSetPtrDflt(", prefix);
|
||||
if (action->dflt.affect == XkbSA_AffectDfltBtn)
|
||||
|
@ -587,6 +610,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
action->dflt.value);
|
||||
write_buf(keymap, buf, size, offset, ")%s", suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_SwitchScreen:
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"%sSwitchScreen(screen=%s%d,%ssame)%s", prefix,
|
||||
|
@ -596,6 +620,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
(action->screen.flags & XkbSA_SwitchApplication) ? "!" : "",
|
||||
suffix);
|
||||
break;
|
||||
|
||||
/* Deprecated actions below here */
|
||||
case XkbSA_SetControls:
|
||||
if (!type)
|
||||
|
@ -607,6 +632,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
prefix, type, get_control_mask_text(action->ctrls.ctrls),
|
||||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_ISOLock:
|
||||
case XkbSA_ActionMessage:
|
||||
case XkbSA_RedirectKey:
|
||||
|
@ -616,6 +642,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
/* XXX TODO */
|
||||
write_buf(keymap, buf, size, offset, "%sNoAction()%s", prefix, suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_XFree86Private:
|
||||
default:
|
||||
write_buf(keymap, buf, size, offset,
|
||||
|
@ -623,7 +650,8 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
prefix, action->any.type, action->any.data[0],
|
||||
action->any.data[1], action->any.data[2],
|
||||
action->any.data[3], action->any.data[4],
|
||||
action->any.data[5], action->any.data[6], suffix);
|
||||
action->any.data[5], action->any.data[6],
|
||||
suffix);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -638,14 +666,16 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
struct xkb_sym_interpret *interp;
|
||||
|
||||
if (keymap->names->compat)
|
||||
write_buf(keymap, buf, size, offset, "\txkb_compatibility \"%s\" {\n\n",
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\txkb_compatibility \"%s\" {\n\n",
|
||||
keymap->names->compat);
|
||||
else
|
||||
write_buf(keymap, buf, size, offset, "\txkb_compatibility {\n\n");
|
||||
|
||||
write_vmods(keymap, buf, size, offset);
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t\tinterpret.useModMapMods= AnyLevel;\n");
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\tinterpret.useModMapMods= AnyLevel;\n");
|
||||
write_buf(keymap, buf, size, offset, "\t\tinterpret.repeat= False;\n");
|
||||
write_buf(keymap, buf, size, offset, "\t\tinterpret.locking= False;\n");
|
||||
|
||||
|
@ -659,39 +689,41 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
|
||||
write_buf(keymap, buf, size, offset, "\t\tinterpret %s+%s(%s) {\n",
|
||||
keysym_name,
|
||||
get_interp_match_text(interp->match),
|
||||
get_mod_mask_text(keymap, interp->mods, 0));
|
||||
get_interp_match_text(interp->match),
|
||||
get_mod_mask_text(keymap, interp->mods, 0));
|
||||
|
||||
if (interp->virtual_mod != XkbNoModifier) {
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tvirtualModifier= %s;\n",
|
||||
if (interp->virtual_mod != XkbNoModifier) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\t\tvirtualModifier= %s;\n",
|
||||
keymap->names->vmods[interp->virtual_mod]);
|
||||
}
|
||||
}
|
||||
|
||||
if (interp->match & XkbSI_LevelOneOnly)
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tuseModMapMods=level1;\n");
|
||||
if (interp->flags & XkbSI_LockingKey)
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tlocking= True;\n");
|
||||
if (interp->flags & XkbSI_AutoRepeat)
|
||||
write_buf(keymap, buf, size, offset, "\t\t\trepeat= True;\n");
|
||||
if (interp->match & XkbSI_LevelOneOnly)
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\t\tuseModMapMods=level1;\n");
|
||||
if (interp->flags & XkbSI_LockingKey)
|
||||
write_buf(keymap, buf, size, offset, "\t\t\tlocking= True;\n");
|
||||
if (interp->flags & XkbSI_AutoRepeat)
|
||||
write_buf(keymap, buf, size, offset, "\t\t\trepeat= True;\n");
|
||||
|
||||
write_action(keymap, buf, size, offset, &interp->act,
|
||||
write_action(keymap, buf, size, offset, &interp->act,
|
||||
"\t\t\taction= ", ";\n");
|
||||
write_buf(keymap, buf, size, offset, "\t\t};\n");
|
||||
write_buf(keymap, buf, size, offset, "\t\t};\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < XkbNumKbdGroups; i++) {
|
||||
struct xkb_mods *gc;
|
||||
struct xkb_mods *gc;
|
||||
|
||||
gc = &keymap->compat->groups[i];
|
||||
if (gc->real_mods == 0 && gc->vmods ==0)
|
||||
continue;
|
||||
write_buf(keymap, buf, size, offset,
|
||||
gc = &keymap->compat->groups[i];
|
||||
if (gc->real_mods == 0 && gc->vmods == 0)
|
||||
continue;
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\tgroup %d = %s;\n", i + 1,
|
||||
get_mod_mask_text(keymap, gc->real_mods, gc->vmods));
|
||||
}
|
||||
|
||||
for (i = 0; i < XkbNumIndicators; i++) {
|
||||
struct xkb_indicator_map *map = &keymap->indicators->maps[i];
|
||||
struct xkb_indicator_map *map = &keymap->indicators->maps[i];
|
||||
if (map->flags == 0 && map->which_groups == 0 &&
|
||||
map->groups == 0 && map->which_mods == 0 &&
|
||||
map->mods.real_mods == 0 && map->mods.vmods == 0 &&
|
||||
|
@ -760,32 +792,33 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
write_buf(keymap, buf, size, offset, "\txkb_symbols {\n\n");
|
||||
|
||||
for (tmp = group = 0; group < XkbNumKbdGroups; group++) {
|
||||
if (!keymap->names->groups[group])
|
||||
if (!keymap->names->groups[group])
|
||||
continue;
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\t\tname[group%d]=\"%s\";\n", group + 1,
|
||||
keymap->names->groups[group]);
|
||||
tmp++;
|
||||
tmp++;
|
||||
}
|
||||
if (tmp > 0)
|
||||
write_buf(keymap, buf, size, offset, "\n");
|
||||
write_buf(keymap, buf, size, offset, "\n");
|
||||
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
bool simple = true;
|
||||
bool simple = true;
|
||||
|
||||
if (xkb_key_num_groups(keymap, key) == 0)
|
||||
continue;
|
||||
if (xkb_key_num_groups(keymap, key) == 0)
|
||||
continue;
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
|
||||
XkbcKeyNameText(darray_item(keymap->names->keys, key).name));
|
||||
if (srv->explicit) {
|
||||
write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
|
||||
XkbcKeyNameText(darray_item(keymap->names->keys, key).name));
|
||||
if (srv->explicit) {
|
||||
if ((srv->explicit[key] & XkbExplicitKeyTypesMask)) {
|
||||
bool multi_type = false;
|
||||
int type = XkbKeyTypeIndex(keymap, key, 0);
|
||||
|
||||
simple = false;
|
||||
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, key); group++) {
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, key);
|
||||
group++) {
|
||||
if (XkbKeyTypeIndex(keymap, key, group) != type) {
|
||||
multi_type = true;
|
||||
break;
|
||||
|
@ -810,81 +843,88 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
darray_item(map->types, type).name);
|
||||
}
|
||||
}
|
||||
if (keymap->ctrls && (srv->explicit[key] & XkbExplicitAutoRepeatMask)) {
|
||||
if (keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)))
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\trepeat= Yes,");
|
||||
else
|
||||
if (keymap->ctrls &&
|
||||
(srv->explicit[key] & XkbExplicitAutoRepeatMask)) {
|
||||
if (keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)))
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\trepeat= Yes,");
|
||||
else
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\trepeat= No,");
|
||||
simple = false;
|
||||
}
|
||||
if (keymap->server->vmodmap[key] &&
|
||||
(srv->explicit[key] & XkbExplicitVModMapMask)) {
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t\tvirtualMods= %s,",
|
||||
get_mod_mask_text(keymap, 0, keymap->server->vmodmap[key]));
|
||||
}
|
||||
}
|
||||
simple = false;
|
||||
}
|
||||
if (keymap->server->vmodmap[key] &&
|
||||
(srv->explicit[key] & XkbExplicitVModMapMask)) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tvirtualMods= %s,",
|
||||
get_mod_mask_text(keymap, 0,
|
||||
keymap->server->vmodmap[key]));
|
||||
}
|
||||
}
|
||||
|
||||
switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, key))) {
|
||||
case XkbClampIntoRange:
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
|
||||
break;
|
||||
case XkbRedirectIntoRange:
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tgroupsRedirect= Group%d,",
|
||||
XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap, key)) + 1);
|
||||
break;
|
||||
}
|
||||
switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, key))) {
|
||||
case XkbClampIntoRange:
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
|
||||
break;
|
||||
|
||||
if (srv->explicit == NULL ||
|
||||
case XkbRedirectIntoRange:
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tgroupsRedirect= Group%d,",
|
||||
XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap,
|
||||
key)) + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (srv->explicit == NULL ||
|
||||
(srv->explicit[key] & XkbExplicitInterpretMask))
|
||||
showActions = XkbKeyHasActions(keymap, key);
|
||||
else
|
||||
showActions = XkbKeyHasActions(keymap, key);
|
||||
else
|
||||
showActions = false;
|
||||
|
||||
if (xkb_key_num_groups(keymap, key) > 1 || showActions)
|
||||
simple = false;
|
||||
if (xkb_key_num_groups(keymap, key) > 1 || showActions)
|
||||
simple = false;
|
||||
|
||||
if (simple) {
|
||||
write_buf(keymap, buf, size, offset, "\t[ ");
|
||||
if (simple) {
|
||||
write_buf(keymap, buf, size, offset, "\t[ ");
|
||||
if (!write_keysyms(keymap, buf, size, offset, key, 0))
|
||||
return false;
|
||||
write_buf(keymap, buf, size, offset, " ] };\n");
|
||||
}
|
||||
else {
|
||||
union xkb_action *acts;
|
||||
int level;
|
||||
}
|
||||
else {
|
||||
union xkb_action *acts;
|
||||
int level;
|
||||
|
||||
acts = XkbKeyActionsPtr(keymap, key);
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, key); group++) {
|
||||
if (group != 0)
|
||||
write_buf(keymap, buf, size, offset, ",");
|
||||
write_buf(keymap, buf, size, offset,
|
||||
acts = XkbKeyActionsPtr(keymap, key);
|
||||
for (group = 0; group < xkb_key_num_groups(keymap, key);
|
||||
group++) {
|
||||
if (group != 0)
|
||||
write_buf(keymap, buf, size, offset, ",");
|
||||
write_buf(keymap, buf, size, offset,
|
||||
"\n\t\t\tsymbols[Group%d]= [ ", group + 1);
|
||||
if (!write_keysyms(keymap, buf, size, offset, key, group))
|
||||
return false;
|
||||
write_buf(keymap, buf, size, offset, " ]");
|
||||
if (showActions) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
write_buf(keymap, buf, size, offset, " ]");
|
||||
if (showActions) {
|
||||
write_buf(keymap, buf, size, offset,
|
||||
",\n\t\t\tactions[Group%d]= [ ", group + 1);
|
||||
for (level = 0;
|
||||
for (level = 0;
|
||||
level < XkbKeyGroupWidth(keymap, key, group);
|
||||
level++) {
|
||||
if (level != 0)
|
||||
write_buf(keymap, buf, size, offset, ", ");
|
||||
write_action(keymap, buf, size, offset, &acts[level],
|
||||
if (level != 0)
|
||||
write_buf(keymap, buf, size, offset, ", ");
|
||||
write_action(keymap, buf, size, offset, &acts[level],
|
||||
NULL, NULL);
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, " ]");
|
||||
acts += XkbKeyGroupsWidth(keymap, key);
|
||||
}
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t};\n");
|
||||
}
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, " ]");
|
||||
acts += XkbKeyGroupsWidth(keymap, key);
|
||||
}
|
||||
}
|
||||
write_buf(keymap, buf, size, offset, "\n\t\t};\n");
|
||||
}
|
||||
}
|
||||
if (map && map->modmap) {
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
||||
for (key = keymap->min_key_code; key <= keymap->max_key_code;
|
||||
key++) {
|
||||
int mod;
|
||||
|
||||
if (map->modmap[key] == 0)
|
||||
|
@ -900,7 +940,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
|||
XkbcKeyNameText(darray_item(keymap->names->keys,
|
||||
key).name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
write_buf(keymap, buf, size, offset, "\t};\n\n");
|
||||
|
|
|
@ -877,8 +877,6 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Copyright © 2012 Intel Corporation
|
||||
*
|
||||
|
@ -914,19 +912,24 @@ utf32_to_utf8(uint32_t unichar, char *buffer)
|
|||
buffer[0] = unichar;
|
||||
buffer[1] = '\0';
|
||||
return 2;
|
||||
} else if (unichar <= 0x07FF) {
|
||||
}
|
||||
else if (unichar <= 0x07FF) {
|
||||
length = 2;
|
||||
head = 0xc0;
|
||||
} else if (unichar <= 0xffff) {
|
||||
}
|
||||
else if (unichar <= 0xffff) {
|
||||
length = 3;
|
||||
head = 0xe0;
|
||||
} else if (unichar <= 0x1fffff) {
|
||||
}
|
||||
else if (unichar <= 0x1fffff) {
|
||||
length = 4;
|
||||
head = 0xf0;
|
||||
} else if (unichar <= 0x3ffffff) {
|
||||
}
|
||||
else if (unichar <= 0x3ffffff) {
|
||||
length = 5;
|
||||
head = 0xf8;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
length = 6;
|
||||
head = 0xfc;
|
||||
}
|
||||
|
|
85
src/keysym.c
85
src/keysym.c
|
@ -1,29 +1,29 @@
|
|||
/*
|
||||
Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||
Copyright 2008 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||
* Copyright 2008 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -59,9 +59,9 @@ xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size)
|
|||
|
||||
if ((entry[0] == val1) && (entry[1] == val2) &&
|
||||
(entry[2] == val3) && (entry[3] == val4)) {
|
||||
snprintf(buffer, size, "%s", entry + 4);
|
||||
return;
|
||||
}
|
||||
snprintf(buffer, size, "%s", entry + 4);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!--n)
|
||||
break;
|
||||
|
@ -73,11 +73,11 @@ xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size)
|
|||
}
|
||||
|
||||
if (ks >= 0x01000100 && ks <= 0x0110ffff)
|
||||
/* Unnamed Unicode codepoint. */
|
||||
/* Unnamed Unicode codepoint. */
|
||||
snprintf(buffer, size, "U%lx", ks & 0xffffffUL);
|
||||
else
|
||||
/* Unnamed, non-Unicode, symbol (shouldn't generally happen). */
|
||||
snprintf(buffer, size, "0x%08x", ks);
|
||||
/* Unnamed, non-Unicode, symbol (shouldn't generally happen). */
|
||||
snprintf(buffer, size, "0x%08x", ks);
|
||||
}
|
||||
|
||||
_X_EXPORT xkb_keysym_t
|
||||
|
@ -104,10 +104,9 @@ xkb_keysym_from_name(const char *s)
|
|||
entry = &_XkeyTable[idx];
|
||||
|
||||
if ((entry[0] == sig1) && (entry[1] == sig2) &&
|
||||
!strcmp(s, (const char *)entry + 6))
|
||||
{
|
||||
!strcmp(s, (const char *) entry + 6)) {
|
||||
val = (entry[2] << 24) | (entry[3] << 16) |
|
||||
(entry[4] << 8) | entry[5];
|
||||
(entry[4] << 8) | entry[5];
|
||||
if (!val)
|
||||
val = XKB_KEY_VoidSymbol;
|
||||
return val;
|
||||
|
@ -173,20 +172,25 @@ keysym_get_case(xkb_keysym_t ks)
|
|||
switch (set) {
|
||||
case 0: /* latin 1 */
|
||||
if ((ks >= XKB_KEY_A && ks <= XKB_KEY_Z) ||
|
||||
(ks >= XKB_KEY_Agrave && ks <= XKB_KEY_THORN && ks != XKB_KEY_multiply))
|
||||
(ks >= XKB_KEY_Agrave && ks <= XKB_KEY_THORN && ks !=
|
||||
XKB_KEY_multiply))
|
||||
return UPPERCASE;
|
||||
if ((ks >= XKB_KEY_a && ks <= XKB_KEY_z) ||
|
||||
(ks >= XKB_KEY_agrave && ks <= XKB_KEY_ydiaeresis))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 1: /* latin 2 */
|
||||
if ((ks >= XKB_KEY_Aogonek && ks <= XKB_KEY_Zabovedot && ks != XKB_KEY_breve) ||
|
||||
(ks >= XKB_KEY_Racute && ks<=XKB_KEY_Tcedilla))
|
||||
if ((ks >= XKB_KEY_Aogonek && ks <= XKB_KEY_Zabovedot && ks !=
|
||||
XKB_KEY_breve) ||
|
||||
(ks >= XKB_KEY_Racute && ks <= XKB_KEY_Tcedilla))
|
||||
return UPPERCASE;
|
||||
if ((ks >= XKB_KEY_aogonek && ks <= XKB_KEY_zabovedot && ks != XKB_KEY_caron) ||
|
||||
if ((ks >= XKB_KEY_aogonek && ks <= XKB_KEY_zabovedot && ks !=
|
||||
XKB_KEY_caron) ||
|
||||
(ks >= XKB_KEY_racute && ks <= XKB_KEY_tcedilla))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 2: /* latin 3 */
|
||||
if ((ks >= XKB_KEY_Hstroke && ks <= XKB_KEY_Jcircumflex) ||
|
||||
(ks >= XKB_KEY_Cabovedot && ks <= XKB_KEY_Scircumflex))
|
||||
|
@ -195,6 +199,7 @@ keysym_get_case(xkb_keysym_t ks)
|
|||
(ks >= XKB_KEY_cabovedot && ks <= XKB_KEY_scircumflex))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 3: /* latin 4 */
|
||||
if ((ks >= XKB_KEY_Rcedilla && ks <= XKB_KEY_Tslash) ||
|
||||
(ks == XKB_KEY_ENG) ||
|
||||
|
@ -205,6 +210,7 @@ keysym_get_case(xkb_keysym_t ks)
|
|||
(ks >= XKB_KEY_amacron && ks <= XKB_KEY_umacron))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 6: /* Cyrillic */
|
||||
if ((ks >= XKB_KEY_Serbian_DJE && ks <= XKB_KEY_Serbian_DZE) ||
|
||||
(ks >= XKB_KEY_Cyrillic_YU && ks <= XKB_KEY_Cyrillic_HARDSIGN))
|
||||
|
@ -213,6 +219,7 @@ keysym_get_case(xkb_keysym_t ks)
|
|||
(ks >= XKB_KEY_Cyrillic_yu && ks <= XKB_KEY_Cyrillic_hardsign))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 7: /* Greek */
|
||||
if ((ks >= XKB_KEY_Greek_ALPHAaccent &&
|
||||
ks <= XKB_KEY_Greek_OMEGAaccent) ||
|
||||
|
@ -223,6 +230,7 @@ keysym_get_case(xkb_keysym_t ks)
|
|||
(ks >= XKB_KEY_Greek_alpha && ks <= XKB_KEY_Greek_OMEGA))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 18: /* latin 8 */
|
||||
if ((ks == XKB_KEY_Wcircumflex) ||
|
||||
(ks == XKB_KEY_Ycircumflex) ||
|
||||
|
@ -249,6 +257,7 @@ keysym_get_case(xkb_keysym_t ks)
|
|||
(ks == XKB_KEY_ygrave))
|
||||
return LOWERCASE;
|
||||
break;
|
||||
|
||||
case 19: /* latin 9 */
|
||||
if (ks == XKB_KEY_OE || ks == XKB_KEY_Ydiaeresis)
|
||||
return UPPERCASE;
|
||||
|
|
|
@ -281,9 +281,11 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
|
|||
if (ret >= num_groups)
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case XkbClampIntoRange:
|
||||
ret = num_groups - 1;
|
||||
break;
|
||||
|
||||
case XkbWrapIntoRange:
|
||||
default:
|
||||
ret %= num_groups;
|
||||
|
|
51
src/state.c
51
src/state.c
|
@ -1,28 +1,28 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
********************************************************/
|
||||
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* Copyright © 2012 Intel Corporation
|
||||
|
@ -575,7 +575,8 @@ xkb_state_led_update_all(struct xkb_state *state)
|
|||
static void
|
||||
xkb_state_update_derived(struct xkb_state *state)
|
||||
{
|
||||
state->mods = (state->base_mods | state->latched_mods | state->locked_mods);
|
||||
state->mods =
|
||||
(state->base_mods | state->latched_mods | state->locked_mods);
|
||||
/* FIXME: Clamp/wrap locked_group */
|
||||
state->group = state->locked_group + state->base_group +
|
||||
state->latched_group;
|
||||
|
|
58
src/text.c
58
src/text.c
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "text.h"
|
||||
|
@ -56,9 +56,9 @@ XkbcVModIndexText(struct xkb_keymap *keymap, unsigned ndx)
|
|||
char buf[20];
|
||||
|
||||
if (ndx >= XkbNumVirtualMods)
|
||||
tmp = "illegal";
|
||||
tmp = "illegal";
|
||||
else if (keymap && keymap->names)
|
||||
tmp = keymap->names->vmods[ndx];
|
||||
tmp = keymap->names->vmods[ndx];
|
||||
|
||||
if (!tmp) {
|
||||
snprintf(buf, sizeof(buf) - 1, "%d", ndx);
|
||||
|
@ -90,12 +90,12 @@ XkbcVModMaskText(struct xkb_keymap *keymap, unsigned modMask, unsigned mask)
|
|||
mm = XkbcModMaskText(modMask, false);
|
||||
|
||||
str = buf;
|
||||
buf[0]= '\0';
|
||||
buf[0] = '\0';
|
||||
rem = BUFFER_SIZE;
|
||||
|
||||
if (mask) {
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods && rem > 1; i++, bit <<= 1)
|
||||
{
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods && rem > 1; i++, bit <<=
|
||||
1) {
|
||||
if (!(mask & bit))
|
||||
continue;
|
||||
|
||||
|
@ -206,7 +206,7 @@ XkbcFileTypeText(enum xkb_file_type type)
|
|||
}
|
||||
}
|
||||
|
||||
static const char *actionTypeNames[XkbSA_NumActions]= {
|
||||
static const char *actionTypeNames[XkbSA_NumActions] = {
|
||||
"NoAction", /* XkbSA_NoAction */
|
||||
"SetMods", /* XkbSA_SetMods */
|
||||
"LatchMods", /* XkbSA_LatchMods */
|
||||
|
|
48
src/text.h
48
src/text.h
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifndef TEXT_H
|
||||
#define TEXT_H
|
||||
|
|
57
src/utils.c
57
src/utils.c
|
@ -1,29 +1,28 @@
|
|||
|
||||
/*\
|
||||
*
|
||||
* COPYRIGHT 1990
|
||||
* DIGITAL EQUIPMENT CORPORATION
|
||||
* MAYNARD, MASSACHUSETTS
|
||||
* ALL RIGHTS RESERVED.
|
||||
*
|
||||
* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
|
||||
* SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
|
||||
* DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
|
||||
* FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
|
||||
* WARRANTY.
|
||||
*
|
||||
* IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
|
||||
* RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
|
||||
* ADDITION TO THAT SET FORTH ABOVE.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Digital Equipment Corporation not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
\*/
|
||||
/*\
|
||||
*
|
||||
* COPYRIGHT 1990
|
||||
* DIGITAL EQUIPMENT CORPORATION
|
||||
* MAYNARD, MASSACHUSETTS
|
||||
* ALL RIGHTS RESERVED.
|
||||
*
|
||||
* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
|
||||
* SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
|
||||
* DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
|
||||
* FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
|
||||
* WARRANTY.
|
||||
*
|
||||
* IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
|
||||
* RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
|
||||
* ADDITION TO THAT SET FORTH ABOVE.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Digital Equipment Corporation not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
\*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -40,8 +39,7 @@ static char *prefix = NULL;
|
|||
bool
|
||||
uSetErrorFile(char *name)
|
||||
{
|
||||
if ((errorFile != NULL) && (errorFile != stderr))
|
||||
{
|
||||
if ((errorFile != NULL) && (errorFile != stderr)) {
|
||||
fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
|
||||
fclose(errorFile);
|
||||
}
|
||||
|
@ -49,8 +47,7 @@ uSetErrorFile(char *name)
|
|||
errorFile = fopen(name, "w");
|
||||
else
|
||||
errorFile = stderr;
|
||||
if (errorFile == NULL)
|
||||
{
|
||||
if (errorFile == NULL) {
|
||||
errorFile = stderr;
|
||||
return false;
|
||||
}
|
||||
|
|
68
src/utils.h
68
src/utils.h
|
@ -1,31 +1,31 @@
|
|||
#ifndef UTILS_H
|
||||
#define UTILS_H 1
|
||||
|
||||
/*\
|
||||
*
|
||||
* COPYRIGHT 1990
|
||||
* DIGITAL EQUIPMENT CORPORATION
|
||||
* MAYNARD, MASSACHUSETTS
|
||||
* ALL RIGHTS RESERVED.
|
||||
*
|
||||
* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
|
||||
* SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
|
||||
* DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
|
||||
* FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
|
||||
* WARRANTY.
|
||||
*
|
||||
* IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
|
||||
* RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
|
||||
* ADDITION TO THAT SET FORTH ABOVE.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Digital Equipment Corporation not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
\*/
|
||||
/*\
|
||||
*
|
||||
* COPYRIGHT 1990
|
||||
* DIGITAL EQUIPMENT CORPORATION
|
||||
* MAYNARD, MASSACHUSETTS
|
||||
* ALL RIGHTS RESERVED.
|
||||
*
|
||||
* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
|
||||
* SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
|
||||
* DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
|
||||
* FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
|
||||
* WARRANTY.
|
||||
*
|
||||
* IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
|
||||
* RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
|
||||
* ADDITION TO THAT SET FORTH ABOVE.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Digital Equipment Corporation not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
\*/
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
|
@ -40,10 +40,10 @@
|
|||
* macro is used when we free these strings in order to avoid -Wcast-qual
|
||||
* errors.
|
||||
*/
|
||||
#define UNCONSTIFY(const_ptr) ((void *)(uintptr_t)(const_ptr))
|
||||
#define UNCONSTIFY(const_ptr) ((void *) (uintptr_t) (const_ptr))
|
||||
|
||||
#define uTypedAlloc(t) ((t*)malloc(sizeof(t)))
|
||||
#define uTypedCalloc(n, t) ((t*)calloc((n), sizeof(t)))
|
||||
#define uTypedAlloc(t) ((t *) malloc(sizeof(t)))
|
||||
#define uTypedCalloc(n, t) ((t *) calloc((n), sizeof(t)))
|
||||
|
||||
#define uDupString(s) ((s) ? strdup(s) : NULL)
|
||||
#define uStringText(s) ((s) == NULL ? "<NullString>" : (s))
|
||||
|
@ -54,33 +54,33 @@
|
|||
extern bool
|
||||
uSetErrorFile(char *name);
|
||||
|
||||
#define INFO uInformation
|
||||
#define INFO uInformation
|
||||
|
||||
extern _X_ATTRIBUTE_PRINTF(1, 2) void
|
||||
uInformation(const char *s, ...);
|
||||
|
||||
#define ACTION uAction
|
||||
#define ACTION uAction
|
||||
|
||||
extern _X_ATTRIBUTE_PRINTF(1, 2) void
|
||||
uAction(const char *s, ...);
|
||||
|
||||
#define WARN uWarning
|
||||
#define WARN uWarning
|
||||
|
||||
extern _X_ATTRIBUTE_PRINTF(1, 2) void
|
||||
uWarning(const char *s, ...);
|
||||
|
||||
#define ERROR uError
|
||||
#define ERROR uError
|
||||
|
||||
extern _X_ATTRIBUTE_PRINTF(1, 2) void
|
||||
uError(const char *s, ...);
|
||||
|
||||
#define FATAL uFatalError
|
||||
#define FATAL uFatalError
|
||||
|
||||
extern _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN void
|
||||
uFatalError(const char *s, ...);
|
||||
|
||||
/* WSGO stands for "Weird Stuff Going On" (wtf???) */
|
||||
#define WSGO uInternalError
|
||||
#define WSGO uInternalError
|
||||
|
||||
extern _X_ATTRIBUTE_PRINTF(1, 2) void
|
||||
uInternalError(const char *s, ...);
|
||||
|
|
338
src/xkb-priv.h
338
src/xkb-priv.h
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||
Copyright 2008 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||
* Copyright 2008 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
/************************************************************
|
||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
********************************************************/
|
||||
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* Copyright © 2012 Intel Corporation
|
||||
|
@ -91,21 +91,22 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
enum xkb_file_type {
|
||||
/* The top level file which includes the other component files. */
|
||||
FILE_TYPE_KEYMAP = (1 << 0),
|
||||
FILE_TYPE_KEYMAP = (1 << 0),
|
||||
|
||||
/* Component files. */
|
||||
FILE_TYPE_TYPES = (1 << 1),
|
||||
FILE_TYPE_COMPAT = (1 << 2),
|
||||
FILE_TYPE_SYMBOLS = (1 << 3),
|
||||
FILE_TYPE_KEYCODES = (1 << 4),
|
||||
FILE_TYPE_GEOMETRY = (1 << 5),
|
||||
FILE_TYPE_TYPES = (1 << 1),
|
||||
FILE_TYPE_COMPAT = (1 << 2),
|
||||
FILE_TYPE_SYMBOLS = (1 << 3),
|
||||
FILE_TYPE_KEYCODES = (1 << 4),
|
||||
FILE_TYPE_GEOMETRY = (1 << 5),
|
||||
|
||||
/* This one doesn't mix with the others, but useful here as well. */
|
||||
FILE_TYPE_RULES = (1 << 6),
|
||||
FILE_TYPE_RULES = (1 << 6),
|
||||
};
|
||||
|
||||
/* Files needed for a complete keymap. */
|
||||
#define REQUIRED_FILE_TYPES (FILE_TYPE_TYPES | FILE_TYPE_COMPAT | FILE_TYPE_SYMBOLS | FILE_TYPE_KEYCODES)
|
||||
#define REQUIRED_FILE_TYPES (FILE_TYPE_TYPES | FILE_TYPE_COMPAT | \
|
||||
FILE_TYPE_SYMBOLS | FILE_TYPE_KEYCODES)
|
||||
#define LEGAL_FILE_TYPES REQUIRED_FILE_TYPES
|
||||
|
||||
/**
|
||||
|
@ -119,132 +120,132 @@ struct xkb_component_names {
|
|||
};
|
||||
|
||||
struct xkb_any_action {
|
||||
uint8_t type;
|
||||
uint8_t data[7];
|
||||
uint8_t type;
|
||||
uint8_t data[7];
|
||||
};
|
||||
|
||||
struct xkb_mod_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t mask;
|
||||
uint8_t real_mods;
|
||||
uint16_t vmods;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t mask;
|
||||
uint8_t real_mods;
|
||||
uint16_t vmods;
|
||||
};
|
||||
|
||||
struct xkb_group_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
int16_t group;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
int16_t group;
|
||||
};
|
||||
|
||||
struct xkb_iso_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t mask;
|
||||
uint8_t real_mods;
|
||||
uint8_t group;
|
||||
uint8_t affect;
|
||||
uint16_t vmods;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t mask;
|
||||
uint8_t real_mods;
|
||||
uint8_t group;
|
||||
uint8_t affect;
|
||||
uint16_t vmods;
|
||||
};
|
||||
|
||||
struct xkb_controls_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint32_t ctrls;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint32_t ctrls;
|
||||
};
|
||||
|
||||
struct xkb_device_button_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t count;
|
||||
uint8_t button;
|
||||
uint8_t device;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t count;
|
||||
uint8_t button;
|
||||
uint8_t device;
|
||||
};
|
||||
|
||||
struct xkb_device_valuator_action {
|
||||
uint8_t type;
|
||||
uint8_t device;
|
||||
uint8_t v1_what;
|
||||
uint8_t v1_index;
|
||||
int8_t v1_value;
|
||||
uint8_t v2_what;
|
||||
uint8_t v2_index;
|
||||
int8_t v2_value;
|
||||
uint8_t type;
|
||||
uint8_t device;
|
||||
uint8_t v1_what;
|
||||
uint8_t v1_index;
|
||||
int8_t v1_value;
|
||||
uint8_t v2_what;
|
||||
uint8_t v2_index;
|
||||
int8_t v2_value;
|
||||
};
|
||||
|
||||
struct xkb_pointer_default_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t affect;
|
||||
int8_t value;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t affect;
|
||||
int8_t value;
|
||||
};
|
||||
|
||||
struct xkb_switch_screen_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
int8_t screen;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
int8_t screen;
|
||||
};
|
||||
|
||||
struct xkb_redirect_key_action {
|
||||
uint8_t type;
|
||||
xkb_keycode_t new_key;
|
||||
uint8_t mods_mask;
|
||||
uint8_t mods;
|
||||
uint16_t vmods_mask;
|
||||
uint16_t vmods;
|
||||
uint8_t type;
|
||||
xkb_keycode_t new_key;
|
||||
uint8_t mods_mask;
|
||||
uint8_t mods;
|
||||
uint16_t vmods_mask;
|
||||
uint16_t vmods;
|
||||
};
|
||||
|
||||
struct xkb_pointer_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
};
|
||||
|
||||
struct xkb_message_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t message[6];
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t message[6];
|
||||
};
|
||||
|
||||
struct xkb_pointer_button_action {
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t count;
|
||||
int8_t button;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint8_t count;
|
||||
int8_t button;
|
||||
};
|
||||
|
||||
union xkb_action {
|
||||
struct xkb_any_action any;
|
||||
struct xkb_mod_action mods;
|
||||
struct xkb_group_action group;
|
||||
struct xkb_iso_action iso;
|
||||
struct xkb_controls_action ctrls;
|
||||
struct xkb_device_button_action devbtn;
|
||||
struct xkb_any_action any;
|
||||
struct xkb_mod_action mods;
|
||||
struct xkb_group_action group;
|
||||
struct xkb_iso_action iso;
|
||||
struct xkb_controls_action ctrls;
|
||||
struct xkb_device_button_action devbtn;
|
||||
struct xkb_device_valuator_action devval;
|
||||
struct xkb_pointer_default_action dflt;
|
||||
struct xkb_switch_screen_action screen;
|
||||
struct xkb_redirect_key_action redirect; /* XXX wholly unnecessary? */
|
||||
struct xkb_pointer_action ptr; /* XXX delete for DeviceValuator */
|
||||
struct xkb_pointer_button_action btn; /* XXX delete for DeviceBtn */
|
||||
struct xkb_message_action msg; /* XXX just delete */
|
||||
unsigned char type;
|
||||
struct xkb_switch_screen_action screen;
|
||||
struct xkb_redirect_key_action redirect; /* XXX wholly unnecessary? */
|
||||
struct xkb_pointer_action ptr; /* XXX delete for DeviceValuator */
|
||||
struct xkb_pointer_button_action btn; /* XXX delete for DeviceBtn */
|
||||
struct xkb_message_action msg; /* XXX just delete */
|
||||
unsigned char type;
|
||||
};
|
||||
|
||||
struct xkb_mods {
|
||||
uint32_t mask; /* effective mods */
|
||||
uint32_t vmods;
|
||||
uint8_t real_mods;
|
||||
uint32_t mask; /* effective mods */
|
||||
uint32_t vmods;
|
||||
uint8_t real_mods;
|
||||
};
|
||||
|
||||
struct xkb_kt_map_entry {
|
||||
uint16_t level;
|
||||
struct xkb_mods mods;
|
||||
uint16_t level;
|
||||
struct xkb_mods mods;
|
||||
};
|
||||
|
||||
struct xkb_key_type {
|
||||
struct xkb_mods mods;
|
||||
uint16_t num_levels;
|
||||
struct xkb_mods mods;
|
||||
uint16_t num_levels;
|
||||
darray(struct xkb_kt_map_entry) map;
|
||||
struct xkb_mods * preserve;
|
||||
char *name;
|
||||
|
@ -252,26 +253,26 @@ struct xkb_key_type {
|
|||
};
|
||||
|
||||
struct xkb_sym_interpret {
|
||||
xkb_keysym_t sym;
|
||||
unsigned char flags;
|
||||
unsigned char match;
|
||||
uint8_t mods;
|
||||
uint32_t virtual_mod;
|
||||
xkb_keysym_t sym;
|
||||
unsigned char flags;
|
||||
unsigned char match;
|
||||
uint8_t mods;
|
||||
uint32_t virtual_mod;
|
||||
union xkb_action act;
|
||||
};
|
||||
|
||||
struct xkb_compat_map {
|
||||
darray(struct xkb_sym_interpret) sym_interpret;
|
||||
struct xkb_mods groups[XkbNumKbdGroups];
|
||||
struct xkb_mods groups[XkbNumKbdGroups];
|
||||
};
|
||||
|
||||
struct xkb_sym_map {
|
||||
unsigned char kt_index[XkbNumKbdGroups];
|
||||
unsigned char group_info;
|
||||
unsigned char width;
|
||||
int *sym_index; /* per level/group index into 'syms' */
|
||||
unsigned int *num_syms; /* per level/group */
|
||||
darray(xkb_keysym_t) syms;
|
||||
unsigned char kt_index[XkbNumKbdGroups];
|
||||
unsigned char group_info;
|
||||
unsigned char width;
|
||||
int *sym_index; /* per level/group index into 'syms' */
|
||||
unsigned int *num_syms; /* per level/group */
|
||||
darray(xkb_keysym_t) syms;
|
||||
};
|
||||
|
||||
struct xkb_client_map {
|
||||
|
@ -281,41 +282,40 @@ struct xkb_client_map {
|
|||
};
|
||||
|
||||
struct xkb_behavior {
|
||||
unsigned char type;
|
||||
unsigned char data;
|
||||
unsigned char type;
|
||||
unsigned char data;
|
||||
};
|
||||
|
||||
struct xkb_server_map {
|
||||
unsigned char * explicit;
|
||||
|
||||
darray(union xkb_action) acts;
|
||||
darray(size_t ) key_acts; /* acts[key_acts[keycode]] */
|
||||
darray(size_t) key_acts; /* acts[key_acts[keycode]] */
|
||||
struct xkb_behavior *behaviors;
|
||||
uint32_t vmods[XkbNumVirtualMods]; /* vmod -> mod mapping */
|
||||
uint32_t vmods[XkbNumVirtualMods]; /* vmod -> mod mapping */
|
||||
uint32_t *vmodmap; /* key -> vmod mapping */
|
||||
};
|
||||
|
||||
|
||||
struct xkb_indicator_map {
|
||||
unsigned char flags;
|
||||
unsigned char which_groups;
|
||||
unsigned char groups;
|
||||
unsigned char which_mods;
|
||||
struct xkb_mods mods;
|
||||
unsigned int ctrls;
|
||||
unsigned char flags;
|
||||
unsigned char which_groups;
|
||||
unsigned char groups;
|
||||
unsigned char which_mods;
|
||||
struct xkb_mods mods;
|
||||
unsigned int ctrls;
|
||||
};
|
||||
|
||||
struct xkb_indicator {
|
||||
struct xkb_indicator_map maps[XkbNumIndicators];
|
||||
struct xkb_indicator_map maps[XkbNumIndicators];
|
||||
};
|
||||
|
||||
struct xkb_key_name {
|
||||
char name[XkbKeyNameLength];
|
||||
char name[XkbKeyNameLength];
|
||||
};
|
||||
|
||||
struct xkb_key_alias {
|
||||
char real[XkbKeyNameLength];
|
||||
char alias[XkbKeyNameLength];
|
||||
char real[XkbKeyNameLength];
|
||||
char alias[XkbKeyNameLength];
|
||||
};
|
||||
|
||||
struct xkb_names {
|
||||
|
@ -354,10 +354,10 @@ struct xkb_controls {
|
|||
struct xkb_keymap {
|
||||
struct xkb_context *ctx;
|
||||
|
||||
unsigned int refcnt;
|
||||
unsigned short flags;
|
||||
xkb_keycode_t min_key_code;
|
||||
xkb_keycode_t max_key_code;
|
||||
unsigned int refcnt;
|
||||
unsigned short flags;
|
||||
xkb_keycode_t min_key_code;
|
||||
xkb_keycode_t max_key_code;
|
||||
|
||||
struct xkb_controls * ctrls;
|
||||
struct xkb_server_map * server;
|
||||
|
@ -371,7 +371,9 @@ struct xkb_keymap {
|
|||
#define XkbOutOfRangeGroupInfo(g) ((g) & 0xf0)
|
||||
#define XkbOutOfRangeGroupAction(g) ((g) & 0xc0)
|
||||
#define XkbOutOfRangeGroupNumber(g) (((g) & 0x30) >> 4)
|
||||
#define XkbSetGroupInfo(g, w, n) (((w) & 0xc0) | (((n) & 3) << 4) | ((g) & 0x0f))
|
||||
#define XkbSetGroupInfo(g, w, \
|
||||
n) (((w) & \
|
||||
0xc0) | (((n) & 3) << 4) | ((g) & 0x0f))
|
||||
#define XkbSetNumGroups(g, n) (((g) & 0xf0) | ((n) & 0x0f))
|
||||
|
||||
#define XkbKeyGroupInfo(d, k) \
|
||||
|
@ -387,11 +389,13 @@ struct xkb_keymap {
|
|||
#define XkbKeyType(d, k, g) \
|
||||
(&darray_item((d)->map->types, XkbKeyTypeIndex(d, k, g)))
|
||||
#define XkbKeyNumSyms(d, k, g, sl) \
|
||||
(darray_item((d)->map->key_sym_map, k).num_syms[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
||||
(darray_item((d)->map->key_sym_map, \
|
||||
k).num_syms[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
||||
#define XkbKeySym(d, k, n) \
|
||||
(&darray_item(darray_item((d)->map->key_sym_map, k).syms, n))
|
||||
#define XkbKeySymOffset(d, k, g, sl) \
|
||||
(darray_item((d)->map->key_sym_map, k).sym_index[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
||||
(darray_item((d)->map->key_sym_map, \
|
||||
k).sym_index[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
||||
#define XkbKeySymEntry(d, k, g, sl) \
|
||||
(XkbKeySym(d, k, XkbKeySymOffset(d, k, g, sl)))
|
||||
#define XkbKeyHasActions(d, k) \
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "action.h"
|
||||
|
@ -178,7 +178,7 @@ static bool
|
|||
ReportIllegal(unsigned action, unsigned field)
|
||||
{
|
||||
ERROR("Field %s is not defined for an action of type %s\n",
|
||||
fieldText(field), XkbcActionTypeText(action));
|
||||
fieldText(field), XkbcActionTypeText(action));
|
||||
ACTION("Action definition ignored\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static bool
|
|||
ReportActionNotArray(unsigned action, unsigned field)
|
||||
{
|
||||
ERROR("The %s field in the %s action is not an array\n",
|
||||
fieldText(field), XkbcActionTypeText(action));
|
||||
fieldText(field), XkbcActionTypeText(action));
|
||||
ACTION("Action definition ignored\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ ReportNotFound(unsigned action, unsigned field, const char *what,
|
|||
{
|
||||
ERROR("%s named %s not found\n", what, bad);
|
||||
ACTION("Ignoring the %s field of an %s action\n", fieldText(field),
|
||||
XkbcActionTypeText(action));
|
||||
XkbcActionTypeText(action));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -237,13 +237,11 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action, ExprDef *value,
|
|||
{
|
||||
ExprResult rtrn;
|
||||
|
||||
if (value->op == ExprIdent)
|
||||
{
|
||||
if (value->op == ExprIdent) {
|
||||
const char *valStr;
|
||||
valStr = xkb_atom_text(keymap->ctx, value->value.str);
|
||||
if (valStr && ((strcasecmp(valStr, "usemodmapmods") == 0) ||
|
||||
(strcasecmp(valStr, "modmapmods") == 0)))
|
||||
{
|
||||
(strcasecmp(valStr, "modmapmods") == 0))) {
|
||||
|
||||
*mods_rtrn = 0;
|
||||
*flags_inout |= XkbSA_UseModMapMods;
|
||||
|
@ -266,31 +264,27 @@ HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
unsigned t1, t2;
|
||||
|
||||
act = (struct xkb_mod_action *) action;
|
||||
if (array_ndx != NULL)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
if (array_ndx != NULL) {
|
||||
switch (field) {
|
||||
case F_ClearLocks:
|
||||
case F_LatchToLock:
|
||||
case F_Modifiers:
|
||||
return ReportActionNotArray(action->type, field);
|
||||
}
|
||||
}
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_ClearLocks:
|
||||
case F_LatchToLock:
|
||||
rtrn = act->flags;
|
||||
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn))
|
||||
{
|
||||
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn)) {
|
||||
act->flags = rtrn;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case F_Modifiers:
|
||||
t1 = act->flags;
|
||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2))
|
||||
{
|
||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
|
||||
act->flags = t1;
|
||||
act->real_mods = act->mask = (t2 & 0xff);
|
||||
act->vmods = (t2 >> 8) & 0xffff;
|
||||
|
@ -311,12 +305,10 @@ HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act = (struct xkb_mod_action *) action;
|
||||
if ((array_ndx != NULL) && (field == F_Modifiers))
|
||||
return ReportActionNotArray(action->type, field);
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_Modifiers:
|
||||
t1 = act->flags;
|
||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2))
|
||||
{
|
||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
|
||||
act->flags = t1;
|
||||
act->real_mods = act->mask = (t2 & 0xff);
|
||||
act->vmods = (t2 >> 8) & 0xffff;
|
||||
|
@ -334,13 +326,11 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
|
|||
ExprDef *spec;
|
||||
ExprResult rtrn;
|
||||
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
||||
{
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
|
||||
*flags_inout &= ~XkbSA_GroupAbsolute;
|
||||
spec = value->value.child;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*flags_inout |= XkbSA_GroupAbsolute;
|
||||
spec = value;
|
||||
}
|
||||
|
@ -366,33 +356,29 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
int t2;
|
||||
|
||||
act = (struct xkb_group_action *) action;
|
||||
if (array_ndx != NULL)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
if (array_ndx != NULL) {
|
||||
switch (field) {
|
||||
case F_ClearLocks:
|
||||
case F_LatchToLock:
|
||||
case F_Group:
|
||||
return ReportActionNotArray(action->type, field);
|
||||
}
|
||||
}
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_ClearLocks:
|
||||
case F_LatchToLock:
|
||||
rtrn = act->flags;
|
||||
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn))
|
||||
{
|
||||
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn)) {
|
||||
act->flags = rtrn;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case F_Group:
|
||||
t1 = act->flags;
|
||||
if (CheckGroupField(keymap, action->type, value, &t1, &t2))
|
||||
{
|
||||
if (CheckGroupField(keymap, action->type, value, &t1, &t2)) {
|
||||
act->flags = t1;
|
||||
act->group = t2;
|
||||
act->group = t2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -411,13 +397,11 @@ HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act = (struct xkb_group_action *) action;
|
||||
if ((array_ndx != NULL) && (field == F_Group))
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (field == F_Group)
|
||||
{
|
||||
if (field == F_Group) {
|
||||
t1 = act->flags;
|
||||
if (CheckGroupField(keymap, action->type, value, &t1, &t2))
|
||||
{
|
||||
if (CheckGroupField(keymap, action->type, value, &t1, &t2)) {
|
||||
act->flags = t1;
|
||||
act->group = t2;
|
||||
act->group = t2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -437,30 +421,26 @@ HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
|
||||
return ReportActionNotArray(action->type, field);
|
||||
|
||||
if ((field == F_X) || (field == F_Y))
|
||||
{
|
||||
if ((field == F_X) || (field == F_Y)) {
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
||||
absolute = false;
|
||||
else
|
||||
absolute = true;
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if (field == F_X)
|
||||
{
|
||||
if (field == F_X) {
|
||||
if (absolute)
|
||||
act->flags |= XkbSA_MoveAbsoluteX;
|
||||
act->x = rtrn.ival;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (absolute)
|
||||
act->flags |= XkbSA_MoveAbsoluteY;
|
||||
act->y = rtrn.ival;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (field == F_Accel)
|
||||
{
|
||||
else if (field == F_Accel) {
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "boolean");
|
||||
if (rtrn.uval)
|
||||
|
@ -472,11 +452,11 @@ HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
}
|
||||
|
||||
static const LookupEntry lockWhich[] = {
|
||||
{"both", 0},
|
||||
{"lock", XkbSA_LockNoUnlock},
|
||||
{"neither", (XkbSA_LockNoLock | XkbSA_LockNoUnlock)},
|
||||
{"unlock", XkbSA_LockNoLock},
|
||||
{NULL, 0}
|
||||
{ "both", 0 },
|
||||
{ "lock", XkbSA_LockNoUnlock },
|
||||
{ "neither", (XkbSA_LockNoLock | XkbSA_LockNoUnlock) },
|
||||
{ "unlock", XkbSA_LockNoLock },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static bool
|
||||
|
@ -487,15 +467,13 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
struct xkb_pointer_button_action *act;
|
||||
|
||||
act = (struct xkb_pointer_button_action *) action;
|
||||
if (field == F_Button)
|
||||
{
|
||||
if (field == F_Button) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..5)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 5))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 5)) {
|
||||
ERROR("Button must specify default or be in the range 1..5\n");
|
||||
ACTION("Illegal button value %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -503,8 +481,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->button = rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
else if ((action->type == XkbSA_LockPtrBtn) && (field == F_Affect))
|
||||
{
|
||||
else if ((action->type == XkbSA_LockPtrBtn) && (field == F_Affect)) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
||||
|
@ -513,14 +490,12 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->flags |= rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
else if (field == F_Count)
|
||||
{
|
||||
else if (field == F_Count) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("The count field must have a value in the range 0..255\n");
|
||||
ACTION("Illegal count %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -532,10 +507,10 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
}
|
||||
|
||||
static const LookupEntry ptrDflts[] = {
|
||||
{"dfltbtn", XkbSA_AffectDfltBtn},
|
||||
{"defaultbutton", XkbSA_AffectDfltBtn},
|
||||
{"button", XkbSA_AffectDfltBtn},
|
||||
{NULL, 0}
|
||||
{ "dfltbtn", XkbSA_AffectDfltBtn },
|
||||
{ "defaultbutton", XkbSA_AffectDfltBtn },
|
||||
{ "button", XkbSA_AffectDfltBtn },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static bool
|
||||
|
@ -546,8 +521,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
struct xkb_pointer_default_action *act;
|
||||
|
||||
act = (struct xkb_pointer_default_action *) action;
|
||||
if (field == F_Affect)
|
||||
{
|
||||
if (field == F_Affect) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, ptrDflts))
|
||||
|
@ -555,18 +529,15 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->affect = rtrn.uval;
|
||||
return true;
|
||||
}
|
||||
else if ((field == F_Button) || (field == F_Value))
|
||||
{
|
||||
else if ((field == F_Button) || (field == F_Value)) {
|
||||
ExprDef *btn;
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
||||
{
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
|
||||
act->flags &= ~XkbSA_DfltBtnAbsolute;
|
||||
btn = value->value.child;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
act->flags |= XkbSA_DfltBtnAbsolute;
|
||||
btn = value;
|
||||
}
|
||||
|
@ -574,39 +545,37 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
if (!ExprResolveButton(keymap->ctx, btn, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..5)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 5))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 5)) {
|
||||
ERROR("New default button value must be in the range 1..5\n");
|
||||
ACTION("Illegal default button value %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
}
|
||||
if (rtrn.ival == 0)
|
||||
{
|
||||
if (rtrn.ival == 0) {
|
||||
ERROR("Cannot set default pointer button to \"default\"\n");
|
||||
ACTION("Illegal default button setting ignored\n");
|
||||
return false;
|
||||
}
|
||||
if (value->op == OpNegate)
|
||||
act->value = -rtrn.ival;
|
||||
act->value = -rtrn.ival;
|
||||
else
|
||||
act->value = rtrn.ival;
|
||||
act->value = rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
return ReportIllegal(action->type, field);
|
||||
}
|
||||
|
||||
static const LookupEntry isoNames[] = {
|
||||
{"mods", XkbSA_ISONoAffectMods},
|
||||
{"modifiers", XkbSA_ISONoAffectMods},
|
||||
{"group", XkbSA_ISONoAffectGroup},
|
||||
{"groups", XkbSA_ISONoAffectGroup},
|
||||
{"ptr", XkbSA_ISONoAffectPtr},
|
||||
{"pointer", XkbSA_ISONoAffectPtr},
|
||||
{"ctrls", XkbSA_ISONoAffectCtrls},
|
||||
{"controls", XkbSA_ISONoAffectCtrls},
|
||||
{"all", ~((unsigned) 0)},
|
||||
{"none", 0},
|
||||
{NULL, 0},
|
||||
{ "mods", XkbSA_ISONoAffectMods },
|
||||
{ "modifiers", XkbSA_ISONoAffectMods },
|
||||
{ "group", XkbSA_ISONoAffectGroup },
|
||||
{ "groups", XkbSA_ISONoAffectGroup },
|
||||
{ "ptr", XkbSA_ISONoAffectPtr },
|
||||
{ "pointer", XkbSA_ISONoAffectPtr },
|
||||
{ "ctrls", XkbSA_ISONoAffectCtrls },
|
||||
{ "controls", XkbSA_ISONoAffectCtrls },
|
||||
{ "all", ~((unsigned) 0) },
|
||||
{ "none", 0 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
static bool
|
||||
|
@ -619,31 +588,30 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
int group;
|
||||
|
||||
act = (struct xkb_iso_action *) action;
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_Modifiers:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
flags = act->flags;
|
||||
if (CheckModifierField(keymap, action->type, value, &flags, &mods))
|
||||
{
|
||||
if (CheckModifierField(keymap, action->type, value, &flags, &mods)) {
|
||||
act->flags = flags & (~XkbSA_ISODfltIsGroup);
|
||||
act->real_mods = mods & 0xff;
|
||||
act->vmods = (mods >> 8) & 0xff;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case F_Group:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
flags = act->flags;
|
||||
if (CheckGroupField(keymap, action->type, value, &flags, &group))
|
||||
{
|
||||
if (CheckGroupField(keymap, action->type, value, &flags, &group)) {
|
||||
act->flags = flags | XkbSA_ISODfltIsGroup;
|
||||
act->group = group;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case F_Affect:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
|
@ -663,38 +631,33 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
struct xkb_switch_screen_action *act;
|
||||
|
||||
act = (struct xkb_switch_screen_action *) action;
|
||||
if (field == F_Screen)
|
||||
{
|
||||
if (field == F_Screen) {
|
||||
ExprDef *scrn;
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
||||
{
|
||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
|
||||
act->flags &= ~XkbSA_SwitchAbsolute;
|
||||
scrn = value->value.child;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
act->flags |= XkbSA_SwitchAbsolute;
|
||||
scrn = value;
|
||||
}
|
||||
|
||||
if (!ExprResolveInteger(keymap->ctx, scrn, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer (0..255)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("Screen index must be in the range 1..255\n");
|
||||
ACTION("Illegal screen value %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
}
|
||||
if (value->op == OpNegate)
|
||||
act->screen = -rtrn.ival;
|
||||
act->screen = -rtrn.ival;
|
||||
else
|
||||
act->screen = rtrn.ival;
|
||||
act->screen = rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
else if (field == F_Same)
|
||||
{
|
||||
else if (field == F_Same) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
|
@ -709,36 +672,37 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
}
|
||||
|
||||
const LookupEntry ctrlNames[] = {
|
||||
{"repeatkeys", XkbRepeatKeysMask},
|
||||
{"repeat", XkbRepeatKeysMask},
|
||||
{"autorepeat", XkbRepeatKeysMask},
|
||||
{"slowkeys", XkbSlowKeysMask},
|
||||
{"bouncekeys", XkbBounceKeysMask},
|
||||
{"stickykeys", XkbStickyKeysMask},
|
||||
{"mousekeys", XkbMouseKeysMask},
|
||||
{"mousekeysaccel", XkbMouseKeysAccelMask},
|
||||
{"accessxkeys", XkbAccessXKeysMask},
|
||||
{"accessxtimeout", XkbAccessXTimeoutMask},
|
||||
{"accessxfeedback", XkbAccessXFeedbackMask},
|
||||
{"audiblebell", XkbAudibleBellMask},
|
||||
{"ignoregrouplock", XkbIgnoreGroupLockMask},
|
||||
{"all", XkbAllBooleanCtrlsMask},
|
||||
{"overlay1", 0},
|
||||
{"overlay2", 0},
|
||||
{"none", 0},
|
||||
{NULL, 0}
|
||||
{ "repeatkeys", XkbRepeatKeysMask },
|
||||
{ "repeat", XkbRepeatKeysMask },
|
||||
{ "autorepeat", XkbRepeatKeysMask },
|
||||
{ "slowkeys", XkbSlowKeysMask },
|
||||
{ "bouncekeys", XkbBounceKeysMask },
|
||||
{ "stickykeys", XkbStickyKeysMask },
|
||||
{ "mousekeys", XkbMouseKeysMask },
|
||||
{ "mousekeysaccel", XkbMouseKeysAccelMask },
|
||||
{ "accessxkeys", XkbAccessXKeysMask },
|
||||
{ "accessxtimeout", XkbAccessXTimeoutMask },
|
||||
{ "accessxfeedback", XkbAccessXFeedbackMask },
|
||||
{ "audiblebell", XkbAudibleBellMask },
|
||||
{ "ignoregrouplock", XkbIgnoreGroupLockMask },
|
||||
{ "all", XkbAllBooleanCtrlsMask },
|
||||
{ "overlay1", 0 },
|
||||
{ "overlay2", 0 },
|
||||
{ "none", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static bool
|
||||
HandleSetLockControls(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
HandleSetLockControls(struct xkb_keymap *keymap,
|
||||
struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx,
|
||||
ExprDef *value)
|
||||
{
|
||||
ExprResult rtrn;
|
||||
struct xkb_controls_action *act;
|
||||
|
||||
act = (struct xkb_controls_action *) action;
|
||||
if (field == F_Controls)
|
||||
{
|
||||
if (field == F_Controls) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
||||
|
@ -750,13 +714,13 @@ HandleSetLockControls(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
}
|
||||
|
||||
static const LookupEntry evNames[] = {
|
||||
{"press", XkbSA_MessageOnPress},
|
||||
{"keypress", XkbSA_MessageOnPress},
|
||||
{"release", XkbSA_MessageOnRelease},
|
||||
{"keyrelease", XkbSA_MessageOnRelease},
|
||||
{"all", XkbSA_MessageOnPress | XkbSA_MessageOnRelease},
|
||||
{"none", 0},
|
||||
{NULL, 0}
|
||||
{ "press", XkbSA_MessageOnPress },
|
||||
{ "keypress", XkbSA_MessageOnPress },
|
||||
{ "release", XkbSA_MessageOnRelease },
|
||||
{ "keyrelease", XkbSA_MessageOnRelease },
|
||||
{ "all", XkbSA_MessageOnPress | XkbSA_MessageOnRelease },
|
||||
{ "none", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static bool
|
||||
|
@ -767,8 +731,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
struct xkb_message_action *act;
|
||||
|
||||
act = (struct xkb_message_action *) action;
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_Report:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
|
@ -778,6 +741,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->flags =
|
||||
rtrn.uval & (XkbSA_MessageOnPress | XkbSA_MessageOnRelease);
|
||||
return true;
|
||||
|
||||
case F_GenKeyEvent:
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
|
@ -788,16 +752,14 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
else
|
||||
act->flags &= ~XkbSA_MessageGenKeyEvent;
|
||||
return true;
|
||||
|
||||
case F_Data:
|
||||
if (array_ndx == NULL)
|
||||
{
|
||||
if (array_ndx == NULL) {
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "string");
|
||||
else
|
||||
{
|
||||
else {
|
||||
int len = strlen(rtrn.str);
|
||||
if ((len < 1) || (len > 6))
|
||||
{
|
||||
if ((len < 1) || (len > 6)) {
|
||||
WARN("An action message can hold only 6 bytes\n");
|
||||
ACTION("Extra %d bytes ignored\n", len - 6);
|
||||
}
|
||||
|
@ -805,26 +767,22 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
unsigned ndx;
|
||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn))
|
||||
{
|
||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn)) {
|
||||
ERROR("Array subscript must be integer\n");
|
||||
ACTION("Illegal subscript ignored\n");
|
||||
return false;
|
||||
}
|
||||
ndx = rtrn.uval;
|
||||
if (ndx > 5)
|
||||
{
|
||||
if (ndx > 5) {
|
||||
ERROR("An action message is at most 6 bytes long\n");
|
||||
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("Message data must be in the range 0..255\n");
|
||||
ACTION("Illegal datum %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -850,24 +808,23 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
return ReportActionNotArray(action->type, field);
|
||||
|
||||
act = (struct xkb_redirect_key_action *) action;
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_Keycode:
|
||||
if (!ExprResolveKeyName(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "key name");
|
||||
tmp = KeyNameToLong(rtrn.keyName.name);
|
||||
if (!FindNamedKey(keymap, tmp, &kc, true, CreateKeyNames(keymap), 0))
|
||||
{
|
||||
if (!FindNamedKey(keymap, tmp, &kc, true, CreateKeyNames(keymap),
|
||||
0)) {
|
||||
return ReportNotFound(action->type, field, "Key",
|
||||
XkbcKeyNameText(rtrn.keyName.name));
|
||||
}
|
||||
act->new_key = kc;
|
||||
return true;
|
||||
|
||||
case F_ModsToClear:
|
||||
case F_Modifiers:
|
||||
t1 = 0;
|
||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2))
|
||||
{
|
||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
|
||||
act->mods_mask |= (t2 & 0xff);
|
||||
if (field == F_Modifiers)
|
||||
act->mods |= (t2 & 0xff);
|
||||
|
@ -895,15 +852,13 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
struct xkb_device_button_action *act;
|
||||
|
||||
act = (struct xkb_device_button_action *) action;
|
||||
if (field == F_Button)
|
||||
{
|
||||
if (field == F_Button) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..255)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("Button must specify default or be in the range 1..255\n");
|
||||
ACTION("Illegal button value %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -911,8 +866,7 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->button = rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
else if ((action->type == XkbSA_LockDeviceBtn) && (field == F_Affect))
|
||||
{
|
||||
else if ((action->type == XkbSA_LockDeviceBtn) && (field == F_Affect)) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
||||
|
@ -921,14 +875,12 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->flags |= rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
else if (field == F_Count)
|
||||
{
|
||||
else if (field == F_Count) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("The count field must have a value in the range 0..255\n");
|
||||
ACTION("Illegal count %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -936,15 +888,13 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
act->count = rtrn.ival;
|
||||
return true;
|
||||
}
|
||||
else if (field == F_Device)
|
||||
{
|
||||
else if (field == F_Device) {
|
||||
if (array_ndx != NULL)
|
||||
return ReportActionNotArray(action->type, field);
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field,
|
||||
"integer (range 1..255)");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("Device must specify default or be in the range 1..255\n");
|
||||
ACTION("Illegal device value %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -975,29 +925,25 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
{
|
||||
ExprResult rtrn;
|
||||
|
||||
switch (field)
|
||||
{
|
||||
switch (field) {
|
||||
case F_Type:
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(PrivateAction, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("Private action type must be in the range 0..255\n");
|
||||
ACTION("Illegal type %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
}
|
||||
action->type = rtrn.uval;
|
||||
return true;
|
||||
|
||||
case F_Data:
|
||||
if (array_ndx == NULL)
|
||||
{
|
||||
if (array_ndx == NULL) {
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "string");
|
||||
else
|
||||
{
|
||||
else {
|
||||
int len = strlen(rtrn.str);
|
||||
if ((len < 1) || (len > 7))
|
||||
{
|
||||
if ((len < 1) || (len > 7)) {
|
||||
WARN("A private action has 7 data bytes\n");
|
||||
ACTION("Extra %d bytes ignored\n", len - 6);
|
||||
return false;
|
||||
|
@ -1007,26 +953,22 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
free(rtrn.str);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
unsigned ndx;
|
||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn))
|
||||
{
|
||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn)) {
|
||||
ERROR("Array subscript must be integer\n");
|
||||
ACTION("Illegal subscript ignored\n");
|
||||
return false;
|
||||
}
|
||||
ndx = rtrn.uval;
|
||||
if (ndx >= sizeof action->data)
|
||||
{
|
||||
if (ndx >= sizeof action->data) {
|
||||
ERROR("The data for a private action is 18 bytes long\n");
|
||||
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
||||
return false;
|
||||
}
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportMismatch(action->type, field, "integer");
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
||||
{
|
||||
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||
ERROR("All data for a private action must be 0..255\n");
|
||||
ACTION("Illegal datum %d ignored\n", rtrn.ival);
|
||||
return false;
|
||||
|
@ -1038,33 +980,33 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
return ReportIllegal(PrivateAction, field);
|
||||
}
|
||||
|
||||
typedef bool (*actionHandler) (struct xkb_keymap *keymap,
|
||||
struct xkb_any_action *action, unsigned field,
|
||||
ExprDef *array_ndx, ExprDef *value);
|
||||
typedef bool (*actionHandler)(struct xkb_keymap *keymap,
|
||||
struct xkb_any_action *action, unsigned field,
|
||||
ExprDef *array_ndx, ExprDef *value);
|
||||
|
||||
static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
||||
[XkbSA_NoAction] = HandleNoAction,
|
||||
[XkbSA_SetMods] = HandleSetLatchMods,
|
||||
[XkbSA_LatchMods] = HandleSetLatchMods,
|
||||
[XkbSA_LockMods] = HandleLockMods,
|
||||
[XkbSA_SetGroup] = HandleSetLatchGroup,
|
||||
[XkbSA_LatchGroup] = HandleSetLatchGroup,
|
||||
[XkbSA_LockGroup] = HandleLockGroup,
|
||||
[XkbSA_MovePtr] = HandleMovePtr,
|
||||
[XkbSA_PtrBtn] = HandlePtrBtn,
|
||||
[XkbSA_LockPtrBtn] = HandlePtrBtn,
|
||||
[XkbSA_SetPtrDflt] = HandleSetPtrDflt,
|
||||
[XkbSA_ISOLock] = HandleISOLock,
|
||||
[XkbSA_Terminate] = HandleNoAction,
|
||||
[XkbSA_SwitchScreen] = HandleSwitchScreen,
|
||||
[XkbSA_SetControls] = HandleSetLockControls,
|
||||
[XkbSA_LockControls] = HandleSetLockControls,
|
||||
[XkbSA_ActionMessage] = HandleActionMessage,
|
||||
[XkbSA_RedirectKey] = HandleRedirectKey,
|
||||
[XkbSA_DeviceBtn] = HandleDeviceBtn,
|
||||
[XkbSA_LockDeviceBtn] = HandleDeviceBtn,
|
||||
[XkbSA_NoAction] = HandleNoAction,
|
||||
[XkbSA_SetMods] = HandleSetLatchMods,
|
||||
[XkbSA_LatchMods] = HandleSetLatchMods,
|
||||
[XkbSA_LockMods] = HandleLockMods,
|
||||
[XkbSA_SetGroup] = HandleSetLatchGroup,
|
||||
[XkbSA_LatchGroup] = HandleSetLatchGroup,
|
||||
[XkbSA_LockGroup] = HandleLockGroup,
|
||||
[XkbSA_MovePtr] = HandleMovePtr,
|
||||
[XkbSA_PtrBtn] = HandlePtrBtn,
|
||||
[XkbSA_LockPtrBtn] = HandlePtrBtn,
|
||||
[XkbSA_SetPtrDflt] = HandleSetPtrDflt,
|
||||
[XkbSA_ISOLock] = HandleISOLock,
|
||||
[XkbSA_Terminate] = HandleNoAction,
|
||||
[XkbSA_SwitchScreen] = HandleSwitchScreen,
|
||||
[XkbSA_SetControls] = HandleSetLockControls,
|
||||
[XkbSA_LockControls] = HandleSetLockControls,
|
||||
[XkbSA_ActionMessage] = HandleActionMessage,
|
||||
[XkbSA_RedirectKey] = HandleRedirectKey,
|
||||
[XkbSA_DeviceBtn] = HandleDeviceBtn,
|
||||
[XkbSA_LockDeviceBtn] = HandleDeviceBtn,
|
||||
[XkbSA_DeviceValuator] = HandleDeviceValuator,
|
||||
[PrivateAction] = HandlePrivate,
|
||||
[PrivateAction] = HandlePrivate,
|
||||
};
|
||||
|
||||
/***====================================================================***/
|
||||
|
@ -1072,14 +1014,12 @@ static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
|||
static void
|
||||
ApplyActionFactoryDefaults(union xkb_action * action)
|
||||
{
|
||||
if (action->type == XkbSA_SetPtrDflt)
|
||||
{ /* increment default button */
|
||||
if (action->type == XkbSA_SetPtrDflt) { /* increment default button */
|
||||
action->dflt.affect = XkbSA_AffectDfltBtn;
|
||||
action->dflt.flags = 0;
|
||||
action->dflt.value = 1;
|
||||
}
|
||||
else if (action->type == XkbSA_ISOLock)
|
||||
{
|
||||
else if (action->type == XkbSA_ISOLock) {
|
||||
action->iso.real_mods = LockMask;
|
||||
}
|
||||
}
|
||||
|
@ -1099,37 +1039,31 @@ HandleActionDef(ExprDef * def,
|
|||
if (!actionsInitialized)
|
||||
ActionsInit(keymap->ctx);
|
||||
|
||||
if (def->op != ExprActionDecl)
|
||||
{
|
||||
if (def->op != ExprActionDecl) {
|
||||
ERROR("Expected an action definition, found %s\n",
|
||||
exprOpText(def->op));
|
||||
exprOpText(def->op));
|
||||
return false;
|
||||
}
|
||||
str = xkb_atom_text(keymap->ctx, def->value.action.name);
|
||||
if (!str)
|
||||
{
|
||||
if (!str) {
|
||||
WSGO("Missing name in action definition!!\n");
|
||||
return false;
|
||||
}
|
||||
if (!stringToAction(str, &tmp))
|
||||
{
|
||||
if (!stringToAction(str, &tmp)) {
|
||||
ERROR("Unknown action %s\n", str);
|
||||
return false;
|
||||
}
|
||||
action->type = hndlrType = tmp;
|
||||
if (action->type != XkbSA_NoAction)
|
||||
{
|
||||
if (action->type != XkbSA_NoAction) {
|
||||
ApplyActionFactoryDefaults((union xkb_action *) action);
|
||||
while (info)
|
||||
{
|
||||
if ((info->action == XkbSA_NoAction)
|
||||
|| (info->action == hndlrType))
|
||||
{
|
||||
if (!(*handleAction[hndlrType]) (keymap, action,
|
||||
info->field,
|
||||
info->array_ndx,
|
||||
info->value))
|
||||
{
|
||||
|| (info->action == hndlrType)) {
|
||||
if (!(*handleAction[hndlrType])(keymap, action,
|
||||
info->field,
|
||||
info->array_ndx,
|
||||
info->value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1137,27 +1071,22 @@ HandleActionDef(ExprDef * def,
|
|||
}
|
||||
}
|
||||
for (arg = def->value.action.args; arg != NULL;
|
||||
arg = (ExprDef *) arg->common.next)
|
||||
{
|
||||
arg = (ExprDef *) arg->common.next) {
|
||||
ExprDef *field, *value, *arrayRtrn;
|
||||
ExprResult elemRtrn, fieldRtrn;
|
||||
unsigned fieldNdx;
|
||||
|
||||
if (arg->op == OpAssign)
|
||||
{
|
||||
if (arg->op == OpAssign) {
|
||||
field = arg->value.binary.left;
|
||||
value = arg->value.binary.right;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((arg->op == OpNot) || (arg->op == OpInvert))
|
||||
{
|
||||
else {
|
||||
if ((arg->op == OpNot) || (arg->op == OpInvert)) {
|
||||
field = arg->value.child;
|
||||
constFalse.value.str = xkb_atom_intern(keymap->ctx, "false");
|
||||
value = &constFalse;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
field = arg;
|
||||
constTrue.value.str = xkb_atom_intern(keymap->ctx, "true");
|
||||
value = &constTrue;
|
||||
|
@ -1166,17 +1095,15 @@ HandleActionDef(ExprDef * def,
|
|||
if (!ExprResolveLhs(keymap, field, &elemRtrn, &fieldRtrn, &arrayRtrn))
|
||||
return false; /* internal error -- already reported */
|
||||
|
||||
if (elemRtrn.str != NULL)
|
||||
{
|
||||
if (elemRtrn.str != NULL) {
|
||||
ERROR("Cannot change defaults in an action definition\n");
|
||||
ACTION("Ignoring attempt to change %s.%s\n", elemRtrn.str,
|
||||
fieldRtrn.str);
|
||||
fieldRtrn.str);
|
||||
free(elemRtrn.str);
|
||||
free(fieldRtrn.str);
|
||||
return false;
|
||||
}
|
||||
if (!stringToField(fieldRtrn.str, &fieldNdx))
|
||||
{
|
||||
if (!stringToField(fieldRtrn.str, &fieldNdx)) {
|
||||
ERROR("Unknown field name %s\n", uStringText(fieldRtrn.str));
|
||||
free(elemRtrn.str);
|
||||
free(fieldRtrn.str);
|
||||
|
@ -1205,30 +1132,25 @@ SetActionField(struct xkb_keymap *keymap,
|
|||
ActionsInit(keymap->ctx);
|
||||
|
||||
new = uTypedAlloc(ActionInfo);
|
||||
if (new == NULL)
|
||||
{
|
||||
if (new == NULL) {
|
||||
WSGO("Couldn't allocate space for action default\n");
|
||||
return false;
|
||||
}
|
||||
if (strcasecmp(elem, "action") == 0)
|
||||
new->action = XkbSA_NoAction;
|
||||
else
|
||||
{
|
||||
if (!stringToAction(elem, &new->action))
|
||||
{
|
||||
else {
|
||||
if (!stringToAction(elem, &new->action)) {
|
||||
free(new);
|
||||
return false;
|
||||
}
|
||||
if (new->action == XkbSA_NoAction)
|
||||
{
|
||||
if (new->action == XkbSA_NoAction) {
|
||||
ERROR("\"%s\" is not a valid field in a NoAction action\n",
|
||||
field);
|
||||
field);
|
||||
free(new);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!stringToField(field, &new->field))
|
||||
{
|
||||
if (!stringToField(field, &new->field)) {
|
||||
ERROR("\"%s\" is not a legal field name\n", field);
|
||||
free(new);
|
||||
return false;
|
||||
|
@ -1251,8 +1173,7 @@ SetActionField(struct xkb_keymap *keymap,
|
|||
static void
|
||||
ActionsInit(struct xkb_context *ctx)
|
||||
{
|
||||
if (!actionsInitialized)
|
||||
{
|
||||
if (!actionsInitialized) {
|
||||
memset(&constTrue, 0, sizeof(constTrue));
|
||||
memset(&constFalse, 0, sizeof(constFalse));
|
||||
constTrue.common.stmtType = StmtExpr;
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef ACTION_H
|
||||
|
@ -30,36 +30,35 @@
|
|||
#include "xkbcomp-priv.h"
|
||||
#include "expr.h"
|
||||
|
||||
#define F_ClearLocks 0
|
||||
#define F_LatchToLock 1
|
||||
#define F_GenKeyEvent 2
|
||||
#define F_Report 3
|
||||
#define F_Default 4
|
||||
#define F_Affect 5
|
||||
#define F_Increment 6
|
||||
#define F_Modifiers 7
|
||||
#define F_Group 8
|
||||
#define F_X 9
|
||||
#define F_Y 10
|
||||
#define F_Accel 11
|
||||
#define F_Button 12
|
||||
#define F_Value 13
|
||||
#define F_Controls 14
|
||||
#define F_Type 15
|
||||
#define F_Count 16
|
||||
#define F_Screen 17
|
||||
#define F_Same 18
|
||||
#define F_Data 19
|
||||
#define F_Device 20
|
||||
#define F_Keycode 21
|
||||
#define F_ModsToClear 22
|
||||
#define F_LastField F_ModsToClear
|
||||
#define F_NumFields (F_LastField+1)
|
||||
#define F_ClearLocks 0
|
||||
#define F_LatchToLock 1
|
||||
#define F_GenKeyEvent 2
|
||||
#define F_Report 3
|
||||
#define F_Default 4
|
||||
#define F_Affect 5
|
||||
#define F_Increment 6
|
||||
#define F_Modifiers 7
|
||||
#define F_Group 8
|
||||
#define F_X 9
|
||||
#define F_Y 10
|
||||
#define F_Accel 11
|
||||
#define F_Button 12
|
||||
#define F_Value 13
|
||||
#define F_Controls 14
|
||||
#define F_Type 15
|
||||
#define F_Count 16
|
||||
#define F_Screen 17
|
||||
#define F_Same 18
|
||||
#define F_Data 19
|
||||
#define F_Device 20
|
||||
#define F_Keycode 21
|
||||
#define F_ModsToClear 22
|
||||
#define F_LastField F_ModsToClear
|
||||
#define F_NumFields (F_LastField + 1)
|
||||
|
||||
#define PrivateAction (XkbSA_LastAction+1)
|
||||
#define PrivateAction (XkbSA_LastAction + 1)
|
||||
|
||||
typedef struct _ActionInfo
|
||||
{
|
||||
typedef struct _ActionInfo {
|
||||
unsigned action;
|
||||
unsigned field;
|
||||
ExprDef *array_ndx;
|
||||
|
@ -69,11 +68,13 @@ typedef struct _ActionInfo
|
|||
|
||||
extern int
|
||||
HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
|
||||
struct xkb_any_action *action, ActionInfo *info);
|
||||
struct xkb_any_action *action,
|
||||
ActionInfo *info);
|
||||
|
||||
extern int
|
||||
SetActionField(struct xkb_keymap *keymap, char *elem, char *field,
|
||||
ExprDef *index, ExprDef *value, ActionInfo **info_rtrn);
|
||||
ExprDef *index, ExprDef *value,
|
||||
ActionInfo **info_rtrn);
|
||||
|
||||
extern const LookupEntry ctrlNames[];
|
||||
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "alias.h"
|
||||
|
@ -30,36 +30,30 @@
|
|||
static void
|
||||
HandleCollision(AliasInfo * old, AliasInfo * new)
|
||||
{
|
||||
if (strncmp(new->real, old->real, XkbKeyNameLength) == 0)
|
||||
{
|
||||
if (strncmp(new->real, old->real, XkbKeyNameLength) == 0) {
|
||||
if (((new->def.file_id == old->def.file_id) && (warningLevel > 0)) ||
|
||||
(warningLevel > 9))
|
||||
{
|
||||
(warningLevel > 9)) {
|
||||
WARN("Alias of %s for %s declared more than once\n",
|
||||
XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
|
||||
XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
|
||||
ACTION("First definition ignored\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
char *use, *ignore;
|
||||
if (new->def.merge == MERGE_AUGMENT)
|
||||
{
|
||||
if (new->def.merge == MERGE_AUGMENT) {
|
||||
use = old->real;
|
||||
ignore = new->real;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
use = new->real;
|
||||
ignore = old->real;
|
||||
}
|
||||
if (((old->def.file_id == new->def.file_id) && (warningLevel > 0)) ||
|
||||
(warningLevel > 9))
|
||||
{
|
||||
(warningLevel > 9)) {
|
||||
WARN("Multiple definitions for alias %s\n",
|
||||
XkbcKeyNameText(old->alias));
|
||||
XkbcKeyNameText(old->alias));
|
||||
ACTION("Using %s, ignoring %s\n",
|
||||
XkbcKeyNameText(use), XkbcKeyNameText(ignore));
|
||||
XkbcKeyNameText(use), XkbcKeyNameText(ignore));
|
||||
}
|
||||
if (use != old->real)
|
||||
memcpy(old->real, use, XkbKeyNameLength);
|
||||
|
@ -70,7 +64,8 @@ HandleCollision(AliasInfo * old, AliasInfo * new)
|
|||
|
||||
static void
|
||||
InitAliasInfo(AliasInfo * info,
|
||||
enum merge_mode merge, unsigned file_id, char *alias, char *real)
|
||||
enum merge_mode merge, unsigned file_id, char *alias,
|
||||
char *real)
|
||||
{
|
||||
memset(info, 0, sizeof(AliasInfo));
|
||||
info->def.merge = merge;
|
||||
|
@ -85,10 +80,9 @@ HandleAliasDef(KeyAliasDef * def,
|
|||
{
|
||||
AliasInfo *info;
|
||||
|
||||
for (info = *info_in; info != NULL; info = (AliasInfo *) info->def.next)
|
||||
{
|
||||
if (strncmp(info->alias, def->alias, XkbKeyNameLength) == 0)
|
||||
{
|
||||
for (info = *info_in; info != NULL; info =
|
||||
(AliasInfo *) info->def.next) {
|
||||
if (strncmp(info->alias, def->alias, XkbKeyNameLength) == 0) {
|
||||
AliasInfo new;
|
||||
InitAliasInfo(&new, merge, file_id, def->alias, def->real);
|
||||
HandleCollision(info, &new);
|
||||
|
@ -96,14 +90,13 @@ HandleAliasDef(KeyAliasDef * def,
|
|||
}
|
||||
}
|
||||
info = uTypedCalloc(1, AliasInfo);
|
||||
if (info == NULL)
|
||||
{
|
||||
if (info == NULL) {
|
||||
WSGO("Allocation failure in HandleAliasDef\n");
|
||||
return false;
|
||||
}
|
||||
info->def.file_id = file_id;
|
||||
info->def.merge = merge;
|
||||
info->def.next = (CommonInfo *) * info_in;
|
||||
info->def.next = (CommonInfo *) *info_in;
|
||||
memcpy(info->alias, def->alias, XkbKeyNameLength);
|
||||
memcpy(info->real, def->real, XkbKeyNameLength);
|
||||
*info_in = AddCommonInfo(&(*info_in)->def, &info->def);
|
||||
|
@ -126,15 +119,13 @@ MergeAliases(AliasInfo ** into, AliasInfo ** merge,
|
|||
|
||||
if ((*merge) == NULL)
|
||||
return true;
|
||||
if ((*into) == NULL)
|
||||
{
|
||||
if ((*into) == NULL) {
|
||||
*into = *merge;
|
||||
*merge = NULL;
|
||||
return true;
|
||||
}
|
||||
memset(&def, 0, sizeof(KeyAliasDef));
|
||||
for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next)
|
||||
{
|
||||
for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next) {
|
||||
if (how_merge == MERGE_DEFAULT)
|
||||
def.merge = tmp->def.merge;
|
||||
else
|
||||
|
@ -161,45 +152,39 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
|||
nOld = (keymap->names ? darray_size(keymap->names->key_aliases) : 0);
|
||||
old = (keymap->names ? &darray_item(keymap->names->key_aliases, 0) : NULL);
|
||||
for (nNew = 0, info = *info_in; info != NULL;
|
||||
info = (AliasInfo *) info->def.next)
|
||||
{
|
||||
info = (AliasInfo *) info->def.next) {
|
||||
unsigned long lname;
|
||||
xkb_keycode_t kc;
|
||||
|
||||
lname = KeyNameToLong(info->real);
|
||||
if (!FindNamedKey(keymap, lname, &kc, false, CreateKeyNames(keymap), 0))
|
||||
{
|
||||
if (warningLevel > 4)
|
||||
{
|
||||
if (!FindNamedKey(keymap, lname, &kc, false, CreateKeyNames(keymap),
|
||||
0)) {
|
||||
if (warningLevel > 4) {
|
||||
WARN("Attempt to alias %s to non-existent key %s\n",
|
||||
XkbcKeyNameText(info->alias), XkbcKeyNameText(info->real));
|
||||
XkbcKeyNameText(info->alias), XkbcKeyNameText(info->real));
|
||||
ACTION("Ignored\n");
|
||||
}
|
||||
info->alias[0] = '\0';
|
||||
continue;
|
||||
}
|
||||
lname = KeyNameToLong(info->alias);
|
||||
if (FindNamedKey(keymap, lname, &kc, false, false, 0))
|
||||
{
|
||||
if (warningLevel > 4)
|
||||
{
|
||||
if (FindNamedKey(keymap, lname, &kc, false, false, 0)) {
|
||||
if (warningLevel > 4) {
|
||||
WARN("Attempt to create alias with the name of a real key\n");
|
||||
ACTION("Alias \"%s = %s\" ignored\n",
|
||||
XkbcKeyNameText(info->alias),
|
||||
XkbcKeyNameText(info->real));
|
||||
XkbcKeyNameText(info->alias),
|
||||
XkbcKeyNameText(info->real));
|
||||
}
|
||||
info->alias[0] = '\0';
|
||||
continue;
|
||||
}
|
||||
nNew++;
|
||||
if (old)
|
||||
{
|
||||
for (i = 0, a = old; i < nOld; i++, a++)
|
||||
{
|
||||
if (strncmp(a->alias, info->alias, XkbKeyNameLength) == 0)
|
||||
{
|
||||
if (old) {
|
||||
for (i = 0, a = old; i < nOld; i++, a++) {
|
||||
if (strncmp(a->alias, info->alias, XkbKeyNameLength) == 0) {
|
||||
AliasInfo old_info;
|
||||
InitAliasInfo(&old_info, MERGE_AUGMENT, 0, a->alias, a->real);
|
||||
InitAliasInfo(&old_info, MERGE_AUGMENT, 0, a->alias,
|
||||
a->real);
|
||||
HandleCollision(&old_info, info);
|
||||
memcpy(old_info.real, a->real, XkbKeyNameLength);
|
||||
info->alias[0] = '\0';
|
||||
|
@ -209,34 +194,30 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (nNew == 0)
|
||||
{
|
||||
if (nNew == 0) {
|
||||
ClearCommonInfo(&(*info_in)->def);
|
||||
*info_in = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
status = XkbcAllocNames(keymap, XkbKeyAliasesMask, nOld + nNew);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
WSGO("Allocation failure in ApplyAliases\n");
|
||||
return false;
|
||||
}
|
||||
a = keymap->names ? &darray_item(keymap->names->key_aliases, nOld) : NULL;
|
||||
for (info = *info_in; info != NULL; info = (AliasInfo *) info->def.next)
|
||||
{
|
||||
if (info->alias[0] != '\0')
|
||||
{
|
||||
for (info = *info_in; info != NULL; info =
|
||||
(AliasInfo *) info->def.next) {
|
||||
if (info->alias[0] != '\0') {
|
||||
strncpy(a->alias, info->alias, XkbKeyNameLength);
|
||||
strncpy(a->real, info->real, XkbKeyNameLength);
|
||||
a++;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if ((a - old) != (nOld + nNew))
|
||||
{
|
||||
if ((a - old) != (nOld + nNew)) {
|
||||
WSGO("Expected %d aliases total but created %d\n", nOld + nNew,
|
||||
a - old);
|
||||
a - old);
|
||||
}
|
||||
#endif
|
||||
ClearCommonInfo(&(*info_in)->def);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef ALIAS_H
|
||||
|
@ -29,8 +29,7 @@
|
|||
|
||||
#include "xkbcomp-priv.h"
|
||||
|
||||
typedef struct _AliasInfo
|
||||
{
|
||||
typedef struct _AliasInfo {
|
||||
CommonInfo def;
|
||||
char alias[XkbKeyNameLength + 1];
|
||||
char real[XkbKeyNameLength + 1];
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "xkbcomp-priv.h"
|
||||
|
@ -30,20 +30,18 @@
|
|||
#include "indicators.h"
|
||||
#include "vmod.h"
|
||||
|
||||
typedef struct _SymInterpInfo
|
||||
{
|
||||
typedef struct _SymInterpInfo {
|
||||
CommonInfo defs;
|
||||
struct xkb_sym_interpret interp;
|
||||
} SymInterpInfo;
|
||||
|
||||
#define _SI_VirtualMod (1<<0)
|
||||
#define _SI_Action (1<<1)
|
||||
#define _SI_AutoRepeat (1<<2)
|
||||
#define _SI_LockingKey (1<<3)
|
||||
#define _SI_LevelOneOnly (1<<4)
|
||||
#define _SI_VirtualMod (1 << 0)
|
||||
#define _SI_Action (1 << 1)
|
||||
#define _SI_AutoRepeat (1 << 2)
|
||||
#define _SI_LockingKey (1 << 3)
|
||||
#define _SI_LevelOneOnly (1 << 4)
|
||||
|
||||
typedef struct _GroupCompatInfo
|
||||
{
|
||||
typedef struct _GroupCompatInfo {
|
||||
unsigned file_id;
|
||||
enum merge_mode merge;
|
||||
bool defined;
|
||||
|
@ -51,8 +49,7 @@ typedef struct _GroupCompatInfo
|
|||
xkb_atom_t vmods;
|
||||
} GroupCompatInfo;
|
||||
|
||||
typedef struct _CompatInfo
|
||||
{
|
||||
typedef struct _CompatInfo {
|
||||
char *name;
|
||||
unsigned file_id;
|
||||
int errorCount;
|
||||
|
@ -69,10 +66,10 @@ typedef struct _CompatInfo
|
|||
|
||||
/***====================================================================***/
|
||||
|
||||
#define ReportSINotArray(si,f,i) \
|
||||
ReportNotArray("symbol interpretation",(f),siText((si),(i)))
|
||||
#define ReportSIBadType(si,f,w,i) \
|
||||
ReportBadType("symbol interpretation",(f),siText((si),(i)),(w))
|
||||
#define ReportSINotArray(si, f, i) \
|
||||
ReportNotArray("symbol interpretation", (f), siText((si), (i)))
|
||||
#define ReportSIBadType(si, f, w, i) \
|
||||
ReportBadType("symbol interpretation", (f), siText((si), (i)), (w))
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
|
@ -81,16 +78,14 @@ siText(SymInterpInfo * si, CompatInfo * info)
|
|||
{
|
||||
static char buf[128];
|
||||
|
||||
if (si == &info->dflt)
|
||||
{
|
||||
if (si == &info->dflt) {
|
||||
snprintf(buf, sizeof(buf), "default");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
snprintf(buf, sizeof(buf), "%s+%s(%s)",
|
||||
XkbcKeysymText(si->interp.sym),
|
||||
XkbcSIMatchText(si->interp.match),
|
||||
XkbcModMaskText(si->interp.mods, false));
|
||||
XkbcKeysymText(si->interp.sym),
|
||||
XkbcSIMatchText(si->interp.match),
|
||||
XkbcModMaskText(si->interp.mods, false));
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
@ -147,9 +142,9 @@ ClearCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
|
|||
XkbNumKbdGroups * sizeof(GroupCompatInfo));
|
||||
info->leds = ClearCommonInfo(&info->leds->defs);
|
||||
while (info->act) {
|
||||
next = info->act->next;
|
||||
free(info->act);
|
||||
info->act = next;
|
||||
next = info->act->next;
|
||||
free(info->act);
|
||||
info->act = next;
|
||||
}
|
||||
ClearVModInfo(&info->vmods, keymap);
|
||||
}
|
||||
|
@ -160,8 +155,7 @@ NextInterp(CompatInfo * info)
|
|||
SymInterpInfo *si;
|
||||
|
||||
si = uTypedAlloc(SymInterpInfo);
|
||||
if (si)
|
||||
{
|
||||
if (si) {
|
||||
memset(si, 0, sizeof(SymInterpInfo));
|
||||
info->interps = AddCommonInfo(&info->interps->defs, &si->defs);
|
||||
info->nInterps++;
|
||||
|
@ -175,12 +169,10 @@ FindMatchingInterp(CompatInfo * info, SymInterpInfo * new)
|
|||
SymInterpInfo *old;
|
||||
|
||||
for (old = info->interps; old != NULL;
|
||||
old = (SymInterpInfo *) old->defs.next)
|
||||
{
|
||||
old = (SymInterpInfo *) old->defs.next) {
|
||||
if ((old->interp.sym == new->interp.sym) &&
|
||||
(old->interp.mods == new->interp.mods) &&
|
||||
(old->interp.match == new->interp.match))
|
||||
{
|
||||
(old->interp.match == new->interp.match)) {
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
@ -195,14 +187,11 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
|
|||
|
||||
collide = 0;
|
||||
old = FindMatchingInterp(info, new);
|
||||
if (old != NULL)
|
||||
{
|
||||
if (new->defs.merge == MERGE_REPLACE)
|
||||
{
|
||||
if (old != NULL) {
|
||||
if (new->defs.merge == MERGE_REPLACE) {
|
||||
SymInterpInfo *next = (SymInterpInfo *) old->defs.next;
|
||||
if (((old->defs.file_id == new->defs.file_id)
|
||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
||||
{
|
||||
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||
WARN("Multiple definitions for \"%s\"\n", siText(new, info));
|
||||
ACTION("Earlier interpretation ignored\n");
|
||||
}
|
||||
|
@ -210,39 +199,34 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
|
|||
old->defs.next = &next->defs;
|
||||
return true;
|
||||
}
|
||||
if (UseNewField(_SI_VirtualMod, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_SI_VirtualMod, &old->defs, &new->defs, &collide)) {
|
||||
old->interp.virtual_mod = new->interp.virtual_mod;
|
||||
old->defs.defined |= _SI_VirtualMod;
|
||||
}
|
||||
if (UseNewField(_SI_Action, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_SI_Action, &old->defs, &new->defs, &collide)) {
|
||||
old->interp.act = new->interp.act;
|
||||
old->defs.defined |= _SI_Action;
|
||||
}
|
||||
if (UseNewField(_SI_AutoRepeat, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_SI_AutoRepeat, &old->defs, &new->defs, &collide)) {
|
||||
old->interp.flags &= ~XkbSI_AutoRepeat;
|
||||
old->interp.flags |= (new->interp.flags & XkbSI_AutoRepeat);
|
||||
old->defs.defined |= _SI_AutoRepeat;
|
||||
}
|
||||
if (UseNewField(_SI_LockingKey, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_SI_LockingKey, &old->defs, &new->defs, &collide)) {
|
||||
old->interp.flags &= ~XkbSI_LockingKey;
|
||||
old->interp.flags |= (new->interp.flags & XkbSI_LockingKey);
|
||||
old->defs.defined |= _SI_LockingKey;
|
||||
}
|
||||
if (UseNewField(_SI_LevelOneOnly, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_SI_LevelOneOnly, &old->defs, &new->defs,
|
||||
&collide)) {
|
||||
old->interp.match &= ~XkbSI_LevelOneOnly;
|
||||
old->interp.match |= (new->interp.match & XkbSI_LevelOneOnly);
|
||||
old->defs.defined |= _SI_LevelOneOnly;
|
||||
}
|
||||
if (collide)
|
||||
{
|
||||
if (collide) {
|
||||
WARN("Multiple interpretations of \"%s\"\n", siText(new, info));
|
||||
ACTION("Using %s definition for duplicate fields\n",
|
||||
(new->defs.merge != MERGE_AUGMENT ? "last" : "first"));
|
||||
(new->defs.merge != MERGE_AUGMENT ? "last" : "first"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -262,16 +246,15 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
|
|||
|
||||
merge = newGC->merge;
|
||||
gc = &info->groupCompat[group];
|
||||
if (((gc->real_mods == newGC->real_mods) && (gc->vmods == newGC->vmods)))
|
||||
{
|
||||
if (((gc->real_mods == newGC->real_mods) &&
|
||||
(gc->vmods == newGC->vmods))) {
|
||||
return true;
|
||||
}
|
||||
if (((gc->file_id == newGC->file_id) && (warningLevel > 0))
|
||||
|| (warningLevel > 9))
|
||||
{
|
||||
|| (warningLevel > 9)) {
|
||||
WARN("Compat map for group %d redefined\n", group + 1);
|
||||
ACTION("Using %s definition\n",
|
||||
(merge == MERGE_AUGMENT ? "old" : "new"));
|
||||
(merge == MERGE_AUGMENT ? "old" : "new"));
|
||||
}
|
||||
if (newGC->defined && (merge != MERGE_AUGMENT || !gc->defined))
|
||||
*gc = *newGC;
|
||||
|
@ -287,16 +270,14 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
{
|
||||
ExprResult result;
|
||||
|
||||
if (expr == NULL)
|
||||
{
|
||||
if (expr == NULL) {
|
||||
*pred_rtrn = XkbSI_AnyOfOrNone;
|
||||
*mods_rtrn = ~0;
|
||||
return true;
|
||||
}
|
||||
|
||||
*pred_rtrn = XkbSI_Exactly;
|
||||
if (expr->op == ExprActionDecl)
|
||||
{
|
||||
if (expr->op == ExprActionDecl) {
|
||||
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
||||
expr->value.action.name);
|
||||
if (strcasecmp(pred_txt, "noneof") == 0)
|
||||
|
@ -309,28 +290,24 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
*pred_rtrn = XkbSI_AllOf;
|
||||
else if (strcasecmp(pred_txt, "exactly") == 0)
|
||||
*pred_rtrn = XkbSI_Exactly;
|
||||
else
|
||||
{
|
||||
else {
|
||||
ERROR("Illegal modifier predicate \"%s\"\n", pred_txt);
|
||||
ACTION("Ignored\n");
|
||||
return false;
|
||||
}
|
||||
expr = expr->value.action.args;
|
||||
}
|
||||
else if (expr->op == ExprIdent)
|
||||
{
|
||||
else if (expr->op == ExprIdent) {
|
||||
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
||||
expr->value.str);
|
||||
if ((pred_txt) && (strcasecmp(pred_txt, "any") == 0))
|
||||
{
|
||||
if ((pred_txt) && (strcasecmp(pred_txt, "any") == 0)) {
|
||||
*pred_rtrn = XkbSI_AnyOf;
|
||||
*mods_rtrn = 0xff;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ExprResolveModMask(info->keymap->ctx, expr, &result))
|
||||
{
|
||||
if (ExprResolveModMask(info->keymap->ctx, expr, &result)) {
|
||||
*mods_rtrn = result.uval;
|
||||
return true;
|
||||
}
|
||||
|
@ -340,39 +317,36 @@ ResolveStateAndPredicate(ExprDef * expr,
|
|||
/***====================================================================***/
|
||||
|
||||
static void
|
||||
MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, enum merge_mode merge)
|
||||
MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from,
|
||||
enum merge_mode merge)
|
||||
{
|
||||
SymInterpInfo *si;
|
||||
LEDInfo *led, *rtrn, *next;
|
||||
GroupCompatInfo *gcm;
|
||||
int i;
|
||||
|
||||
if (from->errorCount > 0)
|
||||
{
|
||||
if (from->errorCount > 0) {
|
||||
into->errorCount += from->errorCount;
|
||||
return;
|
||||
}
|
||||
if (into->name == NULL)
|
||||
{
|
||||
if (into->name == NULL) {
|
||||
into->name = from->name;
|
||||
from->name = NULL;
|
||||
}
|
||||
for (si = from->interps; si; si = (SymInterpInfo *) si->defs.next)
|
||||
{
|
||||
for (si = from->interps; si; si = (SymInterpInfo *) si->defs.next) {
|
||||
if (merge != MERGE_DEFAULT)
|
||||
si->defs.merge = merge;
|
||||
if (!AddInterp(into, si))
|
||||
into->errorCount++;
|
||||
}
|
||||
for (i = 0, gcm = &from->groupCompat[0]; i < XkbNumKbdGroups; i++, gcm++)
|
||||
{
|
||||
for (i = 0, gcm = &from->groupCompat[0]; i < XkbNumKbdGroups; i++,
|
||||
gcm++) {
|
||||
if (merge != MERGE_DEFAULT)
|
||||
gcm->merge = merge;
|
||||
if (!AddGroupCompat(into, i, gcm))
|
||||
into->errorCount++;
|
||||
}
|
||||
for (led = from->leds; led != NULL; led = next)
|
||||
{
|
||||
for (led = from->leds; led != NULL; led = next) {
|
||||
next = (LEDInfo *) led->defs.next;
|
||||
if (merge != MERGE_DEFAULT)
|
||||
led->defs.merge = merge;
|
||||
|
@ -385,7 +359,8 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, enum merge_mode me
|
|||
}
|
||||
|
||||
static void
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge,
|
||||
CompatInfo *info);
|
||||
|
||||
static bool
|
||||
|
@ -398,53 +373,45 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
bool haveSelf;
|
||||
|
||||
haveSelf = false;
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
||||
{
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL)) {
|
||||
haveSelf = true;
|
||||
included = *info;
|
||||
memset(info, 0, sizeof(CompatInfo));
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_COMPAT, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
&newMerge)) {
|
||||
InitCompatInfo(&included, keymap, rtrn->id);
|
||||
included.dflt = info->dflt;
|
||||
included.dflt.defs.merge = newMerge;
|
||||
included.ledDflt.defs.merge = newMerge;
|
||||
included.act = info->act;
|
||||
HandleCompatMapFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||
if (stmt->stmt != NULL)
|
||||
{
|
||||
if (stmt->stmt != NULL) {
|
||||
free(included.name);
|
||||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
if (info->act != NULL)
|
||||
included.act = NULL;
|
||||
included.act = NULL;
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
info->errorCount += 10;
|
||||
return false;
|
||||
}
|
||||
if ((stmt->next != NULL) && (included.errorCount < 1))
|
||||
{
|
||||
if ((stmt->next != NULL) && (included.errorCount < 1)) {
|
||||
IncludeStmt *next;
|
||||
unsigned op;
|
||||
CompatInfo next_incl;
|
||||
|
||||
for (next = stmt->next; next != NULL; next = next->next)
|
||||
{
|
||||
if ((next->file == NULL) && (next->map == NULL))
|
||||
{
|
||||
for (next = stmt->next; next != NULL; next = next->next) {
|
||||
if ((next->file == NULL) && (next->map == NULL)) {
|
||||
haveSelf = true;
|
||||
MergeIncludedCompatMaps(&included, info, next->merge);
|
||||
ClearCompatInfo(info, keymap);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_COMPAT,
|
||||
&rtrn, &op))
|
||||
{
|
||||
&rtrn, &op)) {
|
||||
InitCompatInfo(&next_incl, keymap, rtrn->id);
|
||||
next_incl.file_id = rtrn->id;
|
||||
next_incl.dflt = info->dflt;
|
||||
|
@ -456,12 +423,11 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
HandleCompatMapFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
||||
MergeIncludedCompatMaps(&included, &next_incl, op);
|
||||
if (info->act != NULL)
|
||||
next_incl.act = NULL;
|
||||
next_incl.act = NULL;
|
||||
ClearCompatInfo(&next_incl, keymap);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
info->errorCount += 10;
|
||||
return false;
|
||||
}
|
||||
|
@ -469,8 +435,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
}
|
||||
if (haveSelf)
|
||||
*info = included;
|
||||
else
|
||||
{
|
||||
else {
|
||||
MergeIncludedCompatMaps(info, &included, newMerge);
|
||||
ClearCompatInfo(&included, keymap);
|
||||
}
|
||||
|
@ -478,11 +443,11 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
}
|
||||
|
||||
static const LookupEntry useModMapValues[] = {
|
||||
{"levelone", 1},
|
||||
{"level1", 1},
|
||||
{"anylevel", 0},
|
||||
{"any", 0},
|
||||
{NULL, 0}
|
||||
{ "levelone", 1 },
|
||||
{ "level1", 1 },
|
||||
{ "anylevel", 0 },
|
||||
{ "any", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -492,8 +457,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
int ok = 1;
|
||||
ExprResult tmp;
|
||||
|
||||
if (strcasecmp(field, "action") == 0)
|
||||
{
|
||||
if (strcasecmp(field, "action") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = HandleActionDef(value, keymap, &si->interp.act.any, info->act);
|
||||
|
@ -501,26 +465,22 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
si->defs.defined |= _SI_Action;
|
||||
}
|
||||
else if ((strcasecmp(field, "virtualmodifier") == 0) ||
|
||||
(strcasecmp(field, "virtualmod") == 0))
|
||||
{
|
||||
(strcasecmp(field, "virtualmod") == 0)) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ResolveVirtualModifier(value, keymap, &tmp, &info->vmods);
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
si->interp.virtual_mod = tmp.uval;
|
||||
si->defs.defined |= _SI_VirtualMod;
|
||||
}
|
||||
else
|
||||
return ReportSIBadType(si, field, "virtual modifier", info);
|
||||
}
|
||||
else if (strcasecmp(field, "repeat") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "repeat") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
if (tmp.uval)
|
||||
si->interp.flags |= XkbSI_AutoRepeat;
|
||||
else
|
||||
|
@ -530,13 +490,11 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
else
|
||||
return ReportSIBadType(si, field, "boolean", info);
|
||||
}
|
||||
else if (strcasecmp(field, "locking") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "locking") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
if (tmp.uval)
|
||||
si->interp.flags |= XkbSI_LockingKey;
|
||||
else
|
||||
|
@ -547,13 +505,11 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
return ReportSIBadType(si, field, "boolean", info);
|
||||
}
|
||||
else if ((strcasecmp(field, "usemodmap") == 0) ||
|
||||
(strcasecmp(field, "usemodmapmods") == 0))
|
||||
{
|
||||
(strcasecmp(field, "usemodmapmods") == 0)) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportSINotArray(si, field, info);
|
||||
ok = ExprResolveEnum(keymap->ctx, value, &tmp, useModMapValues);
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
if (tmp.uval)
|
||||
si->interp.match |= XkbSI_LevelOneOnly;
|
||||
else
|
||||
|
@ -563,8 +519,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
|||
else
|
||||
return ReportSIBadType(si, field, "level specification", info);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ok = ReportBadField("symbol interpretation", field, siText(si, info));
|
||||
}
|
||||
return ok;
|
||||
|
@ -581,13 +536,13 @@ HandleInterpVar(VarDef * stmt, struct xkb_keymap *keymap, CompatInfo * info)
|
|||
ret = 0; /* internal error, already reported */
|
||||
else if (elem.str && (strcasecmp(elem.str, "interpret") == 0))
|
||||
ret = SetInterpField(&info->dflt, keymap, field.str, ndx, stmt->value,
|
||||
info);
|
||||
info);
|
||||
else if (elem.str && (strcasecmp(elem.str, "indicator") == 0))
|
||||
ret = SetIndicatorMapField(&info->ledDflt, keymap, field.str, ndx,
|
||||
stmt->value);
|
||||
stmt->value);
|
||||
else
|
||||
ret = SetActionField(keymap, elem.str, field.str, ndx, stmt->value,
|
||||
&info->act);
|
||||
&info->act);
|
||||
free(elem.str);
|
||||
free(field.str);
|
||||
return ret;
|
||||
|
@ -601,10 +556,8 @@ HandleInterpBody(VarDef *def, struct xkb_keymap *keymap, SymInterpInfo *si,
|
|||
ExprResult tmp, field;
|
||||
ExprDef *arrayNdx;
|
||||
|
||||
for (; def != NULL; def = (VarDef *) def->common.next)
|
||||
{
|
||||
if ((def->name) && (def->name->type == ExprFieldRef))
|
||||
{
|
||||
for (; def != NULL; def = (VarDef *) def->common.next) {
|
||||
if ((def->name) && (def->name->type == ExprFieldRef)) {
|
||||
ok = HandleInterpVar(def, keymap, info);
|
||||
continue;
|
||||
}
|
||||
|
@ -619,14 +572,14 @@ HandleInterpBody(VarDef *def, struct xkb_keymap *keymap, SymInterpInfo *si,
|
|||
}
|
||||
|
||||
static int
|
||||
HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge,
|
||||
CompatInfo *info)
|
||||
{
|
||||
unsigned pred, mods;
|
||||
SymInterpInfo si;
|
||||
|
||||
if (!ResolveStateAndPredicate(def->match, &pred, &mods, info))
|
||||
{
|
||||
if (!ResolveStateAndPredicate(def->match, &pred, &mods, info)) {
|
||||
ERROR("Couldn't determine matching modifiers\n");
|
||||
ACTION("Symbol interpretation ignored\n");
|
||||
return false;
|
||||
|
@ -636,22 +589,19 @@ HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, enum merge_mode merge
|
|||
|
||||
si = info->dflt;
|
||||
si.defs.merge = merge;
|
||||
if (!LookupKeysym(def->sym, &si.interp.sym))
|
||||
{
|
||||
if (!LookupKeysym(def->sym, &si.interp.sym)) {
|
||||
ERROR("Could not resolve keysym %s\n", def->sym);
|
||||
ACTION("Symbol interpretation ignored\n");
|
||||
return false;
|
||||
}
|
||||
si.interp.match = pred & XkbSI_OpMask;
|
||||
si.interp.mods = mods;
|
||||
if (!HandleInterpBody(def->def, keymap, &si, info))
|
||||
{
|
||||
if (!HandleInterpBody(def->def, keymap, &si, info)) {
|
||||
info->errorCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AddInterp(info, &si))
|
||||
{
|
||||
if (!AddInterp(info, &si)) {
|
||||
info->errorCount++;
|
||||
return false;
|
||||
}
|
||||
|
@ -667,21 +617,19 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
|||
|
||||
if (def->merge != MERGE_DEFAULT)
|
||||
merge = def->merge;
|
||||
if (!XkbIsLegalGroup(def->group - 1))
|
||||
{
|
||||
if (!XkbIsLegalGroup(def->group - 1)) {
|
||||
ERROR("Keyboard group must be in the range 1..%d\n",
|
||||
XkbNumKbdGroups + 1);
|
||||
XkbNumKbdGroups + 1);
|
||||
ACTION("Compatibility map for illegal group %d ignored\n",
|
||||
def->group);
|
||||
def->group);
|
||||
return false;
|
||||
}
|
||||
tmp.file_id = info->file_id;
|
||||
tmp.merge = merge;
|
||||
if (!ExprResolveVModMask(def->def, &val, keymap))
|
||||
{
|
||||
if (!ExprResolveVModMask(def->def, &val, keymap)) {
|
||||
ERROR("Expected a modifier mask in group compatibility definition\n");
|
||||
ACTION("Ignoring illegal compatibility map for group %d\n",
|
||||
def->group);
|
||||
def->group);
|
||||
return false;
|
||||
}
|
||||
tmp.real_mods = val.uval & 0xff;
|
||||
|
@ -691,10 +639,12 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
|||
}
|
||||
|
||||
static void
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge,
|
||||
CompatInfo *info)
|
||||
{
|
||||
ParseCommon *stmt;
|
||||
LEDInfo *leds;
|
||||
|
||||
if (merge == MERGE_DEFAULT)
|
||||
merge = MERGE_AUGMENT;
|
||||
|
@ -703,8 +653,7 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode me
|
|||
stmt = file->defs;
|
||||
while (stmt)
|
||||
{
|
||||
switch (stmt->stmtType)
|
||||
{
|
||||
switch (stmt->stmtType) {
|
||||
case StmtInclude:
|
||||
if (!HandleIncludeCompatMap((IncludeStmt *) stmt, keymap, info))
|
||||
info->errorCount++;
|
||||
|
@ -715,20 +664,17 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode me
|
|||
break;
|
||||
case StmtGroupCompatDef:
|
||||
if (!HandleGroupCompatDef
|
||||
((GroupCompatDef *) stmt, keymap, merge, info))
|
||||
((GroupCompatDef *) stmt, keymap, merge, info))
|
||||
info->errorCount++;
|
||||
break;
|
||||
case StmtIndicatorMapDef:
|
||||
{
|
||||
LEDInfo *rtrn;
|
||||
rtrn = HandleIndicatorMapDef((IndicatorMapDef *) stmt, keymap,
|
||||
leds = HandleIndicatorMapDef((IndicatorMapDef *) stmt, keymap,
|
||||
&info->ledDflt, info->leds, merge);
|
||||
if (rtrn != NULL)
|
||||
info->leds = rtrn;
|
||||
if (leds != NULL)
|
||||
info->leds = leds;
|
||||
else
|
||||
info->errorCount++;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case StmtVarDef:
|
||||
if (!HandleInterpVar((VarDef *) stmt, keymap, info))
|
||||
info->errorCount++;
|
||||
|
@ -744,12 +690,11 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode me
|
|||
break;
|
||||
default:
|
||||
WSGO("Unexpected statement type %d in HandleCompatMapFile\n",
|
||||
stmt->stmtType);
|
||||
stmt->stmtType);
|
||||
break;
|
||||
}
|
||||
stmt = stmt->next;
|
||||
if (info->errorCount > 10)
|
||||
{
|
||||
if (info->errorCount > 10) {
|
||||
#ifdef NOISY
|
||||
ERROR("Too many errors\n");
|
||||
#endif
|
||||
|
@ -765,8 +710,7 @@ CopyInterps(CompatInfo * info,
|
|||
{
|
||||
SymInterpInfo *si;
|
||||
|
||||
for (si = info->interps; si; si = (SymInterpInfo *) si->defs.next)
|
||||
{
|
||||
for (si = info->interps; si; si = (SymInterpInfo *) si->defs.next) {
|
||||
if (((si->interp.match & XkbSI_OpMask) != pred) ||
|
||||
(needSymbol && (si->interp.sym == XKB_KEY_NoSymbol)) ||
|
||||
((!needSymbol) && (si->interp.sym != XKB_KEY_NoSymbol)))
|
||||
|
@ -776,7 +720,8 @@ CopyInterps(CompatInfo * info,
|
|||
}
|
||||
|
||||
bool
|
||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge)
|
||||
{
|
||||
int i;
|
||||
CompatInfo info;
|
||||
|
@ -813,8 +758,10 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge
|
|||
CopyInterps(&info, keymap->compat, false, XkbSI_AnyOfOrNone);
|
||||
}
|
||||
|
||||
for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups; i++, gcm++) {
|
||||
if ((gcm->file_id != 0) || (gcm->real_mods != 0) || (gcm->vmods != 0)) {
|
||||
for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups; i++,
|
||||
gcm++) {
|
||||
if ((gcm->file_id != 0) || (gcm->real_mods != 0) ||
|
||||
(gcm->vmods != 0)) {
|
||||
keymap->compat->groups[i].mask = gcm->real_mods;
|
||||
keymap->compat->groups[i].real_mods = gcm->real_mods;
|
||||
keymap->compat->groups[i].vmods = gcm->vmods;
|
||||
|
@ -866,12 +813,14 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
|
|||
act->mods.mask = act->mods.real_mods;
|
||||
act->mods.mask |= VModsToReal(keymap, act->mods.vmods);
|
||||
break;
|
||||
|
||||
case XkbSA_ISOLock:
|
||||
if (act->iso.flags & XkbSA_UseModMapMods)
|
||||
act->iso.real_mods = rmodmask;
|
||||
act->iso.mask = act->iso.real_mods;
|
||||
act->iso.mask |= VModsToReal(keymap, act->iso.vmods);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -960,7 +909,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
interps[i] = NULL;
|
||||
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||
level++) {
|
||||
i = (group * width) + level;
|
||||
if (i >= INTERP_SIZE) /* XXX FIXME */
|
||||
return false;
|
||||
|
@ -977,7 +927,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
return false;
|
||||
|
||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) {
|
||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||
level++) {
|
||||
struct xkb_sym_interpret *interp;
|
||||
|
||||
i = (group * width) + level;
|
||||
|
@ -985,10 +936,12 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
|||
|
||||
/* Infer default key behaviours from the base level. */
|
||||
if (group == 0 && level == 0) {
|
||||
if (!(keymap->server->explicit[key] & XkbExplicitAutoRepeatMask) &&
|
||||
if (!(keymap->server->explicit[key] &
|
||||
XkbExplicitAutoRepeatMask) &&
|
||||
(!interp || interp->flags & XkbSI_AutoRepeat))
|
||||
keymap->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8));
|
||||
if (!(keymap->server->explicit[key] & XkbExplicitBehaviorMask) &&
|
||||
keymap->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8));
|
||||
if (!(keymap->server->explicit[key] &
|
||||
XkbExplicitBehaviorMask) &&
|
||||
interp && (interp->flags & XkbSI_LockingKey))
|
||||
keymap->server->behaviors[key].type = XkbKB_Lock;
|
||||
}
|
||||
|
@ -1058,8 +1011,8 @@ UpdateModifiersFromCompat(struct xkb_keymap *keymap)
|
|||
}
|
||||
|
||||
darray_foreach(entry, type->map)
|
||||
entry->mods.mask = entry->mods.real_mods |
|
||||
VModsToReal(keymap, entry->mods.vmods);
|
||||
entry->mods.mask = entry->mods.real_mods |
|
||||
VModsToReal(keymap, entry->mods.vmods);
|
||||
}
|
||||
|
||||
/* Update action modifiers. */
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "expr.h"
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
typedef bool (*IdentLookupFunc) (struct xkb_context *ctx, const void *priv,
|
||||
xkb_atom_t field, unsigned type,
|
||||
ExprResult *val_rtrn);
|
||||
typedef bool (*IdentLookupFunc)(struct xkb_context *ctx, const void *priv,
|
||||
xkb_atom_t field, unsigned type,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
|
@ -39,8 +39,7 @@ exprOpText(unsigned type)
|
|||
{
|
||||
static char buf[32];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case ExprValue:
|
||||
strcpy(buf, "literal");
|
||||
break;
|
||||
|
@ -101,8 +100,7 @@ exprTypeText(unsigned type)
|
|||
{
|
||||
static char buf[20];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case TypeUnknown:
|
||||
strcpy(buf, "unknown");
|
||||
break;
|
||||
|
@ -133,8 +131,7 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
|||
ExprResult *elem_rtrn, ExprResult *field_rtrn,
|
||||
ExprDef **index_rtrn)
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprIdent:
|
||||
elem_rtrn->str = NULL;
|
||||
field_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||
|
@ -168,32 +165,30 @@ SimpleLookup(struct xkb_context *ctx, const void *priv,
|
|||
const char *str;
|
||||
|
||||
if ((priv == NULL) || (field == XKB_ATOM_NONE) || (type != TypeInt))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
str = xkb_atom_text(ctx, field);
|
||||
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++)
|
||||
{
|
||||
if (strcasecmp(str, entry->name) == 0)
|
||||
{
|
||||
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++) {
|
||||
if (strcasecmp(str, entry->name) == 0) {
|
||||
val_rtrn->uval = entry->result;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const LookupEntry modIndexNames[] = {
|
||||
{"shift", ShiftMapIndex},
|
||||
{"control", ControlMapIndex},
|
||||
{"lock", LockMapIndex},
|
||||
{"mod1", Mod1MapIndex},
|
||||
{"mod2", Mod2MapIndex},
|
||||
{"mod3", Mod3MapIndex},
|
||||
{"mod4", Mod4MapIndex},
|
||||
{"mod5", Mod5MapIndex},
|
||||
{"none", XkbNoModifier},
|
||||
{NULL, 0}
|
||||
{ "shift", ShiftMapIndex },
|
||||
{ "control", ControlMapIndex },
|
||||
{ "lock", LockMapIndex },
|
||||
{ "mod1", Mod1MapIndex },
|
||||
{ "mod2", Mod2MapIndex },
|
||||
{ "mod3", Mod3MapIndex },
|
||||
{ "mod4", Mod4MapIndex },
|
||||
{ "mod5", Mod5MapIndex },
|
||||
{ "none", XkbNoModifier },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -233,33 +228,29 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
|||
int ok = 0;
|
||||
const char *bogus = NULL;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type != TypeBoolean)
|
||||
{
|
||||
if (expr->type != TypeBoolean) {
|
||||
ERROR
|
||||
("Found constant of type %s where boolean was expected\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->ival = expr->value.ival;
|
||||
return true;
|
||||
|
||||
case ExprIdent:
|
||||
bogus = xkb_atom_text(ctx, expr->value.str);
|
||||
if (bogus)
|
||||
{
|
||||
if (bogus) {
|
||||
if ((strcasecmp(bogus, "true") == 0) ||
|
||||
(strcasecmp(bogus, "yes") == 0) ||
|
||||
(strcasecmp(bogus, "on") == 0))
|
||||
{
|
||||
(strcasecmp(bogus, "on") == 0)) {
|
||||
val_rtrn->uval = 1;
|
||||
return true;
|
||||
}
|
||||
else if ((strcasecmp(bogus, "false") == 0) ||
|
||||
(strcasecmp(bogus, "no") == 0) ||
|
||||
(strcasecmp(bogus, "off") == 0))
|
||||
{
|
||||
(strcasecmp(bogus, "off") == 0)) {
|
||||
val_rtrn->uval = 0;
|
||||
return true;
|
||||
}
|
||||
|
@ -267,11 +258,13 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
|||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return false;
|
||||
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type boolean is unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
|
||||
case OpInvert:
|
||||
case OpNot:
|
||||
ok = ExprResolveBoolean(ctx, expr, val_rtrn);
|
||||
|
@ -298,9 +291,11 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
|||
bogus = "Negation";
|
||||
ERROR("%s of boolean values not permitted\n", bogus);
|
||||
break;
|
||||
|
||||
case OpUnaryPlus:
|
||||
ERROR("Unary \"+\" operator not permitted for boolean values\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveBoolean\n", expr->op);
|
||||
break;
|
||||
|
@ -316,38 +311,37 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprResult leftRtrn, rightRtrn;
|
||||
ExprDef *left, *right;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type == TypeString)
|
||||
{
|
||||
if (expr->type == TypeString) {
|
||||
const char *str;
|
||||
str = xkb_atom_text(ctx, expr->value.str);
|
||||
if ((str != NULL) && (strlen(str) == 1))
|
||||
{
|
||||
if ((str != NULL) && (strlen(str) == 1)) {
|
||||
val_rtrn->uval = str[0] * XkbGeomPtsPerMM;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (expr->type != TypeInt)
|
||||
{
|
||||
if (expr->type != TypeInt) {
|
||||
ERROR("Found constant of type %s, expected a number\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->ival = expr->value.ival;
|
||||
if (expr->type == TypeInt)
|
||||
val_rtrn->ival *= XkbGeomPtsPerMM;
|
||||
return true;
|
||||
|
||||
case ExprIdent:
|
||||
ERROR("Numeric identifier \"%s\" unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return ok;
|
||||
|
||||
case ExprFieldRef:
|
||||
ERROR("Numeric default \"%s.%s\" unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
case OpMultiply:
|
||||
|
@ -355,19 +349,20 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
|||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveFloat(ctx, left, &leftRtrn) &&
|
||||
ExprResolveFloat(ctx, right, &rightRtrn))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
ExprResolveFloat(ctx, right, &rightRtrn)) {
|
||||
switch (expr->op) {
|
||||
case OpAdd:
|
||||
val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
|
||||
break;
|
||||
|
||||
case OpSubtract:
|
||||
val_rtrn->ival = leftRtrn.ival - rightRtrn.ival;
|
||||
break;
|
||||
|
||||
case OpMultiply:
|
||||
val_rtrn->ival = leftRtrn.ival * rightRtrn.ival;
|
||||
break;
|
||||
|
||||
case OpDivide:
|
||||
val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
|
||||
break;
|
||||
|
@ -375,17 +370,19 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpAssign:
|
||||
WSGO("Assignment operator not implemented yet\n");
|
||||
break;
|
||||
|
||||
case OpNot:
|
||||
ERROR("The ! operator cannot be applied to a number\n");
|
||||
return false;
|
||||
|
||||
case OpInvert:
|
||||
case OpNegate:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveFloat(ctx, left, &leftRtrn))
|
||||
{
|
||||
if (ExprResolveFloat(ctx, left, &leftRtrn)) {
|
||||
if (expr->op == OpNegate)
|
||||
val_rtrn->ival = -leftRtrn.ival;
|
||||
else
|
||||
|
@ -393,9 +390,11 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpUnaryPlus:
|
||||
left = expr->value.child;
|
||||
return ExprResolveFloat(ctx, left, val_rtrn);
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveFloat\n", expr->op);
|
||||
break;
|
||||
|
@ -410,18 +409,17 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprResult leftRtrn, rightRtrn;
|
||||
ExprDef *left, *right;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type != TypeInt)
|
||||
{
|
||||
if (expr->type != TypeInt) {
|
||||
ERROR
|
||||
("Found constant of type %s where an int was expected\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->uval = expr->value.uval;
|
||||
return true;
|
||||
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
case OpMultiply:
|
||||
|
@ -429,10 +427,8 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
|||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn) &&
|
||||
ExprResolveKeyCode(ctx, right, &rightRtrn))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
ExprResolveKeyCode(ctx, right, &rightRtrn)) {
|
||||
switch (expr->op) {
|
||||
case OpAdd:
|
||||
val_rtrn->uval = leftRtrn.uval + rightRtrn.uval;
|
||||
break;
|
||||
|
@ -449,17 +445,19 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpNegate:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn))
|
||||
{
|
||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn)) {
|
||||
val_rtrn->uval = ~leftRtrn.uval;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpUnaryPlus:
|
||||
left = expr->value.child;
|
||||
return ExprResolveKeyCode(ctx, left, val_rtrn);
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveKeyCode\n", expr->op);
|
||||
break;
|
||||
|
@ -490,16 +488,13 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprResult leftRtrn, rightRtrn;
|
||||
ExprDef *left, *right;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type == TypeString)
|
||||
{
|
||||
if (expr->type == TypeString) {
|
||||
const char *str;
|
||||
str = xkb_atom_text(ctx, expr->value.str);
|
||||
if (str != NULL)
|
||||
switch (strlen(str))
|
||||
{
|
||||
switch (strlen(str)) {
|
||||
case 0:
|
||||
val_rtrn->uval = 0;
|
||||
return true;
|
||||
|
@ -510,39 +505,41 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (expr->type != TypeInt)
|
||||
{
|
||||
if (expr->type != TypeInt) {
|
||||
ERROR
|
||||
("Found constant of type %s where an int was expected\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->ival = expr->value.ival;
|
||||
return true;
|
||||
|
||||
case ExprIdent:
|
||||
if (lookup)
|
||||
ok = lookup(ctx, lookupPriv, expr->value.str,
|
||||
TypeInt, val_rtrn);
|
||||
if (!ok)
|
||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return ok;
|
||||
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
case OpMultiply:
|
||||
case OpDivide:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup, lookupPriv) &&
|
||||
ExprResolveIntegerLookup(ctx, right, &rightRtrn, lookup, lookupPriv))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv) &&
|
||||
ExprResolveIntegerLookup(ctx, right, &rightRtrn, lookup,
|
||||
lookupPriv)) {
|
||||
switch (expr->op) {
|
||||
case OpAdd:
|
||||
val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
|
||||
break;
|
||||
|
@ -559,18 +556,20 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpAssign:
|
||||
WSGO("Assignment operator not implemented yet\n");
|
||||
break;
|
||||
|
||||
case OpNot:
|
||||
ERROR("The ! operator cannot be applied to an integer\n");
|
||||
return false;
|
||||
|
||||
case OpInvert:
|
||||
case OpNegate:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv))
|
||||
{
|
||||
lookupPriv)) {
|
||||
if (expr->op == OpNegate)
|
||||
val_rtrn->ival = -leftRtrn.ival;
|
||||
else
|
||||
|
@ -578,10 +577,12 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpUnaryPlus:
|
||||
left = expr->value.child;
|
||||
return ExprResolveIntegerLookup(ctx, left, val_rtrn, lookup,
|
||||
lookupPriv);
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
|
||||
break;
|
||||
|
@ -685,34 +686,34 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprDef *right;
|
||||
const char *bogus = NULL;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type != TypeString)
|
||||
{
|
||||
if (expr->type != TypeString) {
|
||||
ERROR("Found constant of type %s, expected a string\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->str = xkb_atom_strdup(ctx, expr->value.str);
|
||||
if (val_rtrn->str == NULL)
|
||||
val_rtrn->str = strdup("");
|
||||
return true;
|
||||
|
||||
case ExprIdent:
|
||||
ERROR("Identifier \"%s\" of type string not found\n",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return false;
|
||||
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type string not found\n",
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
|
||||
case OpAdd:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveString(ctx, left, &leftRtrn) &&
|
||||
ExprResolveString(ctx, right, &rightRtrn))
|
||||
{
|
||||
ExprResolveString(ctx, right, &rightRtrn)) {
|
||||
int len;
|
||||
char *new;
|
||||
len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1;
|
||||
|
@ -728,6 +729,7 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
|||
free(rightRtrn.str);
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpSubtract:
|
||||
if (bogus == NULL)
|
||||
bogus = "Subtraction";
|
||||
|
@ -748,12 +750,15 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
|||
bogus = "Bitwise complement";
|
||||
ERROR("%s of string values not permitted\n", bogus);
|
||||
return false;
|
||||
|
||||
case OpNot:
|
||||
ERROR("The ! operator cannot be applied to a string\n");
|
||||
return false;
|
||||
|
||||
case OpUnaryPlus:
|
||||
ERROR("The + operator cannot be applied to a string\n");
|
||||
return false;
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveString\n", expr->op);
|
||||
break;
|
||||
|
@ -767,26 +772,27 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
|||
{
|
||||
const char *bogus = NULL;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type != TypeKeyName)
|
||||
{
|
||||
if (expr->type != TypeKeyName) {
|
||||
ERROR("Found constant of type %s, expected a key name\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
memcpy(val_rtrn->keyName.name, expr->value.keyName, XkbKeyNameLength);
|
||||
return true;
|
||||
|
||||
case ExprIdent:
|
||||
ERROR("Identifier \"%s\" of type string not found\n",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return false;
|
||||
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type key name not found\n",
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
|
||||
case OpAdd:
|
||||
if (bogus == NULL)
|
||||
bogus = "Addition";
|
||||
|
@ -810,12 +816,15 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
|||
bogus = "Bitwise complement";
|
||||
ERROR("%s of key name values not permitted\n", bogus);
|
||||
return false;
|
||||
|
||||
case OpNot:
|
||||
ERROR("The ! operator cannot be applied to a key name\n");
|
||||
return false;
|
||||
|
||||
case OpUnaryPlus:
|
||||
ERROR("The + operator cannot be applied to a key name\n");
|
||||
return false;
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveKeyName\n", expr->op);
|
||||
break;
|
||||
|
@ -829,17 +838,15 @@ int
|
|||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values)
|
||||
{
|
||||
if (expr->op != ExprIdent)
|
||||
{
|
||||
if (expr->op != ExprIdent) {
|
||||
ERROR("Found a %s where an enumerated value was expected\n",
|
||||
exprOpText(expr->op));
|
||||
exprOpText(expr->op));
|
||||
return false;
|
||||
}
|
||||
if (!SimpleLookup(ctx, values, expr->value.str, TypeInt, val_rtrn))
|
||||
{
|
||||
if (!SimpleLookup(ctx, values, expr->value.str, TypeInt, val_rtrn)) {
|
||||
int nOut = 0;
|
||||
ERROR("Illegal identifier %s (expected one of: ",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
while (values && values->name)
|
||||
{
|
||||
if (nOut != 0)
|
||||
|
@ -865,48 +872,51 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprDef *left, *right;
|
||||
const char *bogus = NULL;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprValue:
|
||||
if (expr->type != TypeInt)
|
||||
{
|
||||
if (expr->type != TypeInt) {
|
||||
ERROR
|
||||
("Found constant of type %s where a mask was expected\n",
|
||||
exprTypeText(expr->type));
|
||||
exprTypeText(expr->type));
|
||||
return false;
|
||||
}
|
||||
val_rtrn->ival = expr->value.ival;
|
||||
return true;
|
||||
|
||||
case ExprIdent:
|
||||
ok = lookup(ctx, lookupPriv, expr->value.str, TypeInt, val_rtrn);
|
||||
if (!ok)
|
||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
xkb_atom_text(ctx, expr->value.str));
|
||||
return ok;
|
||||
|
||||
case ExprFieldRef:
|
||||
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
||||
xkb_atom_text(ctx, expr->value.field.element),
|
||||
xkb_atom_text(ctx, expr->value.field.field));
|
||||
return false;
|
||||
|
||||
case ExprArrayRef:
|
||||
bogus = "array reference";
|
||||
|
||||
case ExprActionDecl:
|
||||
if (bogus == NULL)
|
||||
bogus = "function use";
|
||||
ERROR("Unexpected %s in mask expression\n", bogus);
|
||||
ACTION("Expression ignored\n");
|
||||
return false;
|
||||
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
case OpMultiply:
|
||||
case OpDivide:
|
||||
left = expr->value.binary.left;
|
||||
right = expr->value.binary.right;
|
||||
if (ExprResolveMaskLookup(ctx, left, &leftRtrn, lookup, lookupPriv) &&
|
||||
ExprResolveMaskLookup(ctx, right, &rightRtrn, lookup, lookupPriv))
|
||||
{
|
||||
switch (expr->op)
|
||||
{
|
||||
if (ExprResolveMaskLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv) &&
|
||||
ExprResolveMaskLookup(ctx, right, &rightRtrn, lookup,
|
||||
lookupPriv)) {
|
||||
switch (expr->op) {
|
||||
case OpAdd:
|
||||
val_rtrn->ival = leftRtrn.ival | rightRtrn.ival;
|
||||
break;
|
||||
|
@ -916,36 +926,38 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
case OpMultiply:
|
||||
case OpDivide:
|
||||
ERROR("Cannot %s masks\n",
|
||||
expr->op == OpDivide ? "divide" : "multiply");
|
||||
expr->op == OpDivide ? "divide" : "multiply");
|
||||
ACTION("Illegal operation ignored\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpAssign:
|
||||
WSGO("Assignment operator not implemented yet\n");
|
||||
break;
|
||||
|
||||
case OpInvert:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv))
|
||||
{
|
||||
lookupPriv)) {
|
||||
val_rtrn->ival = ~leftRtrn.ival;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case OpUnaryPlus:
|
||||
case OpNegate:
|
||||
case OpNot:
|
||||
left = expr->value.child;
|
||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||
lookupPriv))
|
||||
{
|
||||
lookupPriv)) {
|
||||
ERROR("The %s operator cannot be used with a mask\n",
|
||||
(expr->op == OpNegate ? "-" : "!"));
|
||||
(expr->op == OpNegate ? "-" : "!"));
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveMask\n", expr->op);
|
||||
break;
|
||||
|
@ -982,8 +994,7 @@ ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
|||
int ok = 0;
|
||||
xkb_keysym_t sym;
|
||||
|
||||
if (expr->op == ExprIdent)
|
||||
{
|
||||
if (expr->op == ExprIdent) {
|
||||
const char *str;
|
||||
str = xkb_atom_text(ctx, expr->value.str);
|
||||
if (str) {
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef EXPR_H
|
||||
|
@ -29,8 +29,7 @@
|
|||
|
||||
#include "xkbcomp-priv.h"
|
||||
|
||||
typedef union _ExprResult
|
||||
{
|
||||
typedef union _ExprResult {
|
||||
char *str;
|
||||
int ival;
|
||||
unsigned uval;
|
||||
|
@ -42,27 +41,28 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
|||
ExprResult *elem_rtrn, ExprResult *field_rtrn,
|
||||
ExprDef **index_rtrn);
|
||||
|
||||
typedef struct _LookupEntry
|
||||
{
|
||||
typedef struct _LookupEntry {
|
||||
const char *name;
|
||||
unsigned result;
|
||||
} LookupEntry;
|
||||
|
||||
|
||||
extern const char *
|
||||
exprOpText(unsigned type);
|
||||
|
||||
extern bool
|
||||
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn);
|
||||
unsigned type,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern bool
|
||||
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn);
|
||||
unsigned type,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern bool
|
||||
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn);
|
||||
unsigned type,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
||||
|
@ -85,20 +85,17 @@ ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn);
|
||||
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||
|
@ -109,12 +106,12 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
|||
ExprResult *val_rtrn);
|
||||
|
||||
extern int
|
||||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values);
|
||||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn,
|
||||
const LookupEntry *values);
|
||||
|
||||
extern int
|
||||
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResult *val_rtrn, const LookupEntry *values);
|
||||
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn,
|
||||
const LookupEntry *values);
|
||||
|
||||
extern int
|
||||
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "indicators.h"
|
||||
|
@ -57,28 +57,23 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
unsigned collide;
|
||||
|
||||
last = NULL;
|
||||
for (old = oldLEDs; old != NULL; old = (LEDInfo *) old->defs.next)
|
||||
{
|
||||
if (old->name == new->name)
|
||||
{
|
||||
for (old = oldLEDs; old != NULL; old = (LEDInfo *) old->defs.next) {
|
||||
if (old->name == new->name) {
|
||||
if ((old->real_mods == new->real_mods) &&
|
||||
(old->vmods == new->vmods) &&
|
||||
(old->groups == new->groups) &&
|
||||
(old->ctrls == new->ctrls) &&
|
||||
(old->which_mods == new->which_mods) &&
|
||||
(old->which_groups == new->which_groups))
|
||||
{
|
||||
(old->which_groups == new->which_groups)) {
|
||||
old->defs.defined |= new->defs.defined;
|
||||
return oldLEDs;
|
||||
}
|
||||
if (new->defs.merge == MERGE_REPLACE)
|
||||
{
|
||||
if (new->defs.merge == MERGE_REPLACE) {
|
||||
CommonInfo *next = old->defs.next;
|
||||
if (((old->defs.file_id == new->defs.file_id)
|
||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
||||
{
|
||||
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||
WARN("Map for indicator %s redefined\n",
|
||||
xkb_atom_text(keymap->ctx, old->name));
|
||||
xkb_atom_text(keymap->ctx, old->name));
|
||||
ACTION("Earlier definition ignored\n");
|
||||
}
|
||||
*old = *new;
|
||||
|
@ -86,53 +81,48 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
return oldLEDs;
|
||||
}
|
||||
collide = 0;
|
||||
if (UseNewField(_LED_Index, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_Index, &old->defs, &new->defs, &collide)) {
|
||||
old->indicator = new->indicator;
|
||||
old->defs.defined |= _LED_Index;
|
||||
}
|
||||
if (UseNewField(_LED_Mods, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_Mods, &old->defs, &new->defs, &collide)) {
|
||||
old->which_mods = new->which_mods;
|
||||
old->real_mods = new->real_mods;
|
||||
old->vmods = new->vmods;
|
||||
old->defs.defined |= _LED_Mods;
|
||||
}
|
||||
if (UseNewField(_LED_Groups, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_Groups, &old->defs, &new->defs, &collide)) {
|
||||
old->which_groups = new->which_groups;
|
||||
old->groups = new->groups;
|
||||
old->defs.defined |= _LED_Groups;
|
||||
}
|
||||
if (UseNewField(_LED_Ctrls, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_Ctrls, &old->defs, &new->defs, &collide)) {
|
||||
old->ctrls = new->ctrls;
|
||||
old->defs.defined |= _LED_Ctrls;
|
||||
}
|
||||
if (UseNewField(_LED_Explicit, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_Explicit, &old->defs, &new->defs,
|
||||
&collide)) {
|
||||
old->flags &= ~XkbIM_NoExplicit;
|
||||
old->flags |= (new->flags & XkbIM_NoExplicit);
|
||||
old->defs.defined |= _LED_Explicit;
|
||||
}
|
||||
if (UseNewField(_LED_Automatic, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_Automatic, &old->defs, &new->defs,
|
||||
&collide)) {
|
||||
old->flags &= ~XkbIM_NoAutomatic;
|
||||
old->flags |= (new->flags & XkbIM_NoAutomatic);
|
||||
old->defs.defined |= _LED_Automatic;
|
||||
}
|
||||
if (UseNewField(_LED_DrivesKbd, &old->defs, &new->defs, &collide))
|
||||
{
|
||||
if (UseNewField(_LED_DrivesKbd, &old->defs, &new->defs,
|
||||
&collide)) {
|
||||
old->flags &= ~XkbIM_LEDDrivesKB;
|
||||
old->flags |= (new->flags & XkbIM_LEDDrivesKB);
|
||||
old->defs.defined |= _LED_DrivesKbd;
|
||||
}
|
||||
if (collide)
|
||||
{
|
||||
if (collide) {
|
||||
WARN("Map for indicator %s redefined\n",
|
||||
xkb_atom_text(keymap->ctx, old->name));
|
||||
ACTION("Using %s definition for duplicate fields\n",
|
||||
(new->defs.merge == MERGE_AUGMENT ? "first" : "last"));
|
||||
(new->defs.merge == MERGE_AUGMENT ? "first" : "last"));
|
||||
}
|
||||
return oldLEDs;
|
||||
}
|
||||
|
@ -141,17 +131,15 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
}
|
||||
/* new definition */
|
||||
old = uTypedAlloc(LEDInfo);
|
||||
if (!old)
|
||||
{
|
||||
if (!old) {
|
||||
WSGO("Couldn't allocate indicator map\n");
|
||||
ACTION("Map for indicator %s not compiled\n",
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
return NULL;
|
||||
}
|
||||
*old = *new;
|
||||
old->defs.next = NULL;
|
||||
if (last)
|
||||
{
|
||||
if (last) {
|
||||
last->defs.next = &old->defs;
|
||||
return oldLEDs;
|
||||
}
|
||||
|
@ -159,37 +147,37 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
|||
}
|
||||
|
||||
static const LookupEntry modComponentNames[] = {
|
||||
{"base", XkbIM_UseBase},
|
||||
{"latched", XkbIM_UseLatched},
|
||||
{"locked", XkbIM_UseLocked},
|
||||
{"effective", XkbIM_UseEffective},
|
||||
{"compat", XkbIM_UseCompat},
|
||||
{"any", XkbIM_UseAnyMods},
|
||||
{"none", 0},
|
||||
{NULL, 0}
|
||||
{ "base", XkbIM_UseBase },
|
||||
{ "latched", XkbIM_UseLatched },
|
||||
{ "locked", XkbIM_UseLocked },
|
||||
{ "effective", XkbIM_UseEffective },
|
||||
{ "compat", XkbIM_UseCompat },
|
||||
{ "any", XkbIM_UseAnyMods },
|
||||
{ "none", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static const LookupEntry groupComponentNames[] = {
|
||||
{"base", XkbIM_UseBase},
|
||||
{"latched", XkbIM_UseLatched},
|
||||
{"locked", XkbIM_UseLocked},
|
||||
{"effective", XkbIM_UseEffective},
|
||||
{"any", XkbIM_UseAnyGroup},
|
||||
{"none", 0},
|
||||
{NULL, 0}
|
||||
{ "base", XkbIM_UseBase },
|
||||
{ "latched", XkbIM_UseLatched },
|
||||
{ "locked", XkbIM_UseLocked },
|
||||
{ "effective", XkbIM_UseEffective },
|
||||
{ "any", XkbIM_UseAnyGroup },
|
||||
{ "none", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static const LookupEntry groupNames[] = {
|
||||
{"group1", 0x01},
|
||||
{"group2", 0x02},
|
||||
{"group3", 0x04},
|
||||
{"group4", 0x08},
|
||||
{"group5", 0x10},
|
||||
{"group6", 0x20},
|
||||
{"group7", 0x40},
|
||||
{"group8", 0x80},
|
||||
{"none", 0x00},
|
||||
{"all", 0xff},
|
||||
{NULL, 0}
|
||||
{ "group1", 0x01 },
|
||||
{ "group2", 0x02 },
|
||||
{ "group3", 0x04 },
|
||||
{ "group4", 0x08 },
|
||||
{ "group5", 0x10 },
|
||||
{ "group6", 0x20 },
|
||||
{ "group7", 0x40 },
|
||||
{ "group8", 0x80 },
|
||||
{ "none", 0x00 },
|
||||
{ "all", 0xff },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -201,8 +189,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
|
||||
ok = true;
|
||||
if ((strcasecmp(field, "modifiers") == 0) ||
|
||||
(strcasecmp(field, "mods") == 0))
|
||||
{
|
||||
(strcasecmp(field, "mods") == 0)) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveVModMask(value, &rtrn, keymap))
|
||||
|
@ -211,8 +198,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
led->vmods = (rtrn.uval >> 8) & 0xff;
|
||||
led->defs.defined |= _LED_Mods;
|
||||
}
|
||||
else if (strcasecmp(field, "groups") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "groups") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupNames))
|
||||
|
@ -221,8 +207,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
led->defs.defined |= _LED_Groups;
|
||||
}
|
||||
else if ((strcasecmp(field, "controls") == 0) ||
|
||||
(strcasecmp(field, "ctrls") == 0))
|
||||
{
|
||||
(strcasecmp(field, "ctrls") == 0)) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
||||
|
@ -231,8 +216,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
led->ctrls = rtrn.uval;
|
||||
led->defs.defined |= _LED_Ctrls;
|
||||
}
|
||||
else if (strcasecmp(field, "allowexplicit") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "allowexplicit") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
|
@ -244,23 +228,20 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
led->defs.defined |= _LED_Explicit;
|
||||
}
|
||||
else if ((strcasecmp(field, "whichmodstate") == 0) ||
|
||||
(strcasecmp(field, "whichmodifierstate") == 0))
|
||||
{
|
||||
(strcasecmp(field, "whichmodifierstate") == 0)) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, modComponentNames))
|
||||
{
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, modComponentNames)) {
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"mask of modifier state components");
|
||||
}
|
||||
led->which_mods = rtrn.uval;
|
||||
}
|
||||
else if (strcasecmp(field, "whichgroupstate") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "whichgroupstate") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupComponentNames))
|
||||
{
|
||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn,
|
||||
groupComponentNames)) {
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"mask of group state components");
|
||||
}
|
||||
|
@ -271,8 +252,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
(strcasecmp(field, "leddriveskbd") == 0) ||
|
||||
(strcasecmp(field, "leddriveskeyboard") == 0) ||
|
||||
(strcasecmp(field, "indicatordriveskbd") == 0) ||
|
||||
(strcasecmp(field, "indicatordriveskeyboard") == 0))
|
||||
{
|
||||
(strcasecmp(field, "indicatordriveskeyboard") == 0)) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||
|
@ -283,28 +263,25 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
|||
led->flags &= ~XkbIM_LEDDrivesKB;
|
||||
led->defs.defined |= _LED_DrivesKbd;
|
||||
}
|
||||
else if (strcasecmp(field, "index") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "index") == 0) {
|
||||
if (arrayNdx != NULL)
|
||||
return ReportIndicatorNotArray(keymap, led, field);
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||
return ReportIndicatorBadType(keymap, led, field,
|
||||
"indicator index");
|
||||
if ((rtrn.uval < 1) || (rtrn.uval > 32))
|
||||
{
|
||||
if ((rtrn.uval < 1) || (rtrn.uval > 32)) {
|
||||
ERROR("Illegal indicator index %d (range 1..%d)\n",
|
||||
rtrn.uval, XkbNumIndicators);
|
||||
rtrn.uval, XkbNumIndicators);
|
||||
ACTION("Index definition for %s indicator ignored\n",
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
return false;
|
||||
}
|
||||
led->indicator = rtrn.uval;
|
||||
led->defs.defined |= _LED_Index;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ERROR("Unknown field %s in map for %s indicator\n", field,
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
ACTION("Definition ignored\n");
|
||||
ok = false;
|
||||
}
|
||||
|
@ -327,33 +304,28 @@ HandleIndicatorMapDef(IndicatorMapDef *def, struct xkb_keymap *keymap,
|
|||
led.name = def->name;
|
||||
|
||||
ok = true;
|
||||
for (var = def->body; var != NULL; var = (VarDef *) var->common.next)
|
||||
{
|
||||
for (var = def->body; var != NULL; var = (VarDef *) var->common.next) {
|
||||
ExprResult elem, field;
|
||||
ExprDef *arrayNdx;
|
||||
if (!ExprResolveLhs(keymap, var->name, &elem, &field, &arrayNdx))
|
||||
{
|
||||
if (!ExprResolveLhs(keymap, var->name, &elem, &field, &arrayNdx)) {
|
||||
ok = false;
|
||||
continue;
|
||||
}
|
||||
if (elem.str != NULL)
|
||||
{
|
||||
if (elem.str != NULL) {
|
||||
ERROR
|
||||
("Cannot set defaults for \"%s\" element in indicator map\n",
|
||||
elem.str);
|
||||
elem.str);
|
||||
ACTION("Assignment to %s.%s ignored\n", elem.str, field.str);
|
||||
ok = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ok = SetIndicatorMapField(&led, keymap, field.str, arrayNdx,
|
||||
var->value) && ok;
|
||||
}
|
||||
free(elem.str);
|
||||
free(field.str);
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
rtrn = AddIndicatorMap(keymap, oldLEDs, &led);
|
||||
return rtrn;
|
||||
}
|
||||
|
@ -366,74 +338,60 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
|||
int i;
|
||||
LEDInfo *led, *next, *last;
|
||||
|
||||
if (keymap->names != NULL)
|
||||
{
|
||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
|
||||
{
|
||||
if (led->indicator == _LED_NotBound)
|
||||
{
|
||||
for (i = 0; i < XkbNumIndicators; i++)
|
||||
{
|
||||
if (keymap->names != NULL) {
|
||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next) {
|
||||
if (led->indicator == _LED_NotBound) {
|
||||
for (i = 0; i < XkbNumIndicators; i++) {
|
||||
if (keymap->names->indicators[i] &&
|
||||
strcmp(keymap->names->indicators[i],
|
||||
xkb_atom_text(keymap->ctx, led->name)) == 0)
|
||||
{
|
||||
xkb_atom_text(keymap->ctx, led->name)) == 0) {
|
||||
led->indicator = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
|
||||
{
|
||||
if (led->indicator == _LED_NotBound)
|
||||
{
|
||||
for (i = 0; i < XkbNumIndicators; i++)
|
||||
{
|
||||
if (keymap->names->indicators[i] == NULL)
|
||||
{
|
||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next) {
|
||||
if (led->indicator == _LED_NotBound) {
|
||||
for (i = 0; i < XkbNumIndicators; i++) {
|
||||
if (keymap->names->indicators[i] == NULL) {
|
||||
keymap->names->indicators[i] =
|
||||
xkb_atom_strdup(keymap->ctx, led->name);
|
||||
led->indicator = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (led->indicator == _LED_NotBound)
|
||||
{
|
||||
if (led->indicator == _LED_NotBound) {
|
||||
ERROR("No unnamed indicators found\n");
|
||||
ACTION
|
||||
("Virtual indicator map \"%s\" not bound\n",
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (last = NULL, led = unbound; led != NULL; led = next)
|
||||
{
|
||||
for (last = NULL, led = unbound; led != NULL; led = next) {
|
||||
next = (LEDInfo *) led->defs.next;
|
||||
if (led->indicator == _LED_NotBound)
|
||||
{
|
||||
if (led->indicator == _LED_NotBound) {
|
||||
unbound = next;
|
||||
free(led);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if ((keymap->names != NULL) &&
|
||||
(strcmp(keymap->names->indicators[led->indicator - 1],
|
||||
xkb_atom_text(keymap->ctx, led->name)) != 0))
|
||||
{
|
||||
const char *old = keymap->names->indicators[led->indicator - 1];
|
||||
xkb_atom_text(keymap->ctx, led->name)) != 0)) {
|
||||
const char *old =
|
||||
keymap->names->indicators[led->indicator - 1];
|
||||
ERROR("Multiple names bound to indicator %d\n",
|
||||
(unsigned int) led->indicator);
|
||||
(unsigned int) led->indicator);
|
||||
ACTION("Using %s, ignoring %s\n", old,
|
||||
xkb_atom_text(keymap->ctx, led->name));
|
||||
led->indicator = _LED_NotBound;
|
||||
unbound = next;
|
||||
free(led);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
struct xkb_indicator_map * map;
|
||||
map = &keymap->indicators->maps[led->indicator - 1];
|
||||
map->flags = led->flags;
|
||||
|
@ -454,8 +412,7 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
|||
}
|
||||
}
|
||||
|
||||
for (led = unbound; led != NULL; led = next)
|
||||
{
|
||||
for (led = unbound; led != NULL; led = next) {
|
||||
next = led ? (LEDInfo *) led->defs.next : NULL;
|
||||
free(led);
|
||||
}
|
||||
|
@ -467,26 +424,22 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
|||
LEDInfo *led, *next;
|
||||
LEDInfo *unbound = NULL, *last = NULL;
|
||||
|
||||
if (XkbcAllocNames(keymap, XkbIndicatorNamesMask, 0) != Success)
|
||||
{
|
||||
if (XkbcAllocNames(keymap, XkbIndicatorNamesMask, 0) != Success) {
|
||||
WSGO("Couldn't allocate names\n");
|
||||
ACTION("Indicator names may be incorrect\n");
|
||||
}
|
||||
if (XkbcAllocIndicatorMaps(keymap) != Success)
|
||||
{
|
||||
if (XkbcAllocIndicatorMaps(keymap) != Success) {
|
||||
WSGO("Can't allocate indicator maps\n");
|
||||
ACTION("Indicator map definitions may be lost\n");
|
||||
return false;
|
||||
}
|
||||
for (led = leds; led != NULL; led = next)
|
||||
{
|
||||
for (led = leds; led != NULL; led = next) {
|
||||
next = (LEDInfo *) led->defs.next;
|
||||
if ((led->groups != 0) && (led->which_groups == 0))
|
||||
led->which_groups = XkbIM_UseEffective;
|
||||
if ((led->which_mods == 0) && ((led->real_mods) || (led->vmods)))
|
||||
led->which_mods = XkbIM_UseEffective;
|
||||
if ((led->indicator == _LED_NotBound) || (!keymap->indicators))
|
||||
{
|
||||
if ((led->indicator == _LED_NotBound) || (!keymap->indicators)) {
|
||||
led->defs.next = NULL;
|
||||
if (last != NULL)
|
||||
last->defs.next = (CommonInfo *) led;
|
||||
|
@ -494,8 +447,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
|||
unbound = led;
|
||||
last = led;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
struct xkb_indicator_map * im;
|
||||
im = &keymap->indicators->maps[led->indicator - 1];
|
||||
im->flags = led->flags;
|
||||
|
@ -506,10 +458,9 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
|||
im->mods.real_mods = led->real_mods;
|
||||
im->mods.vmods = led->vmods;
|
||||
im->ctrls = led->ctrls;
|
||||
if (keymap->names != NULL)
|
||||
{
|
||||
if (keymap->names != NULL) {
|
||||
free(keymap->names->indicators[led->indicator - 1]);
|
||||
keymap->names->indicators[led->indicator-1] =
|
||||
keymap->names->indicators[led->indicator - 1] =
|
||||
xkb_atom_strdup(keymap->ctx, led->name);
|
||||
}
|
||||
free(led);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef INDICATORS_H
|
||||
|
@ -29,18 +29,17 @@
|
|||
|
||||
#include "xkbcomp-priv.h"
|
||||
|
||||
#define _LED_Index (1<<0)
|
||||
#define _LED_Mods (1<<1)
|
||||
#define _LED_Groups (1<<2)
|
||||
#define _LED_Ctrls (1<<3)
|
||||
#define _LED_Explicit (1<<4)
|
||||
#define _LED_Automatic (1<<5)
|
||||
#define _LED_DrivesKbd (1<<6)
|
||||
#define _LED_Index (1 << 0)
|
||||
#define _LED_Mods (1 << 1)
|
||||
#define _LED_Groups (1 << 2)
|
||||
#define _LED_Ctrls (1 << 3)
|
||||
#define _LED_Explicit (1 << 4)
|
||||
#define _LED_Automatic (1 << 5)
|
||||
#define _LED_DrivesKbd (1 << 6)
|
||||
|
||||
#define _LED_NotBound 255
|
||||
#define _LED_NotBound 255
|
||||
|
||||
typedef struct _LEDInfo
|
||||
{
|
||||
typedef struct _LEDInfo {
|
||||
CommonInfo defs;
|
||||
xkb_atom_t name;
|
||||
unsigned char indicator;
|
||||
|
@ -56,17 +55,18 @@ typedef struct _LEDInfo
|
|||
extern void
|
||||
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo *info);
|
||||
|
||||
|
||||
extern LEDInfo *
|
||||
AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *newLED);
|
||||
|
||||
extern int
|
||||
SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap, char *field,
|
||||
ExprDef *arrayNdx, ExprDef *value);
|
||||
ExprDef *arrayNdx,
|
||||
ExprDef *value);
|
||||
|
||||
extern LEDInfo *
|
||||
HandleIndicatorMapDef(IndicatorMapDef *stmt, struct xkb_keymap *keymap,
|
||||
LEDInfo *dflt, LEDInfo *oldLEDs, enum merge_mode mergeMode);
|
||||
LEDInfo *dflt, LEDInfo *oldLEDs,
|
||||
enum merge_mode mergeMode);
|
||||
|
||||
extern bool
|
||||
CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "keycodes.h"
|
||||
|
@ -51,16 +51,14 @@ LongToKeyName(unsigned long val, char *name)
|
|||
|
||||
/***====================================================================***/
|
||||
|
||||
typedef struct _IndicatorNameInfo
|
||||
{
|
||||
typedef struct _IndicatorNameInfo {
|
||||
CommonInfo defs;
|
||||
int ndx;
|
||||
xkb_atom_t name;
|
||||
bool virtual;
|
||||
} IndicatorNameInfo;
|
||||
|
||||
typedef struct _KeyNamesInfo
|
||||
{
|
||||
typedef struct _KeyNamesInfo {
|
||||
char *name; /* e.g. evdev+aliases(qwerty) */
|
||||
int errorCount;
|
||||
unsigned file_id;
|
||||
|
@ -75,8 +73,10 @@ typedef struct _KeyNamesInfo
|
|||
AliasInfo *aliases;
|
||||
} KeyNamesInfo;
|
||||
|
||||
static void HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge, KeyNamesInfo *info);
|
||||
static void
|
||||
HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge,
|
||||
KeyNamesInfo *info);
|
||||
|
||||
static void
|
||||
ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
|
||||
|
@ -103,8 +103,7 @@ InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
|
|||
static void
|
||||
ClearIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
|
||||
{
|
||||
if (ii == info->leds)
|
||||
{
|
||||
if (ii == info->leds) {
|
||||
ClearCommonInfo(&ii->defs);
|
||||
info->leds = NULL;
|
||||
}
|
||||
|
@ -116,8 +115,7 @@ NextIndicatorName(KeyNamesInfo * info)
|
|||
IndicatorNameInfo *ii;
|
||||
|
||||
ii = uTypedAlloc(IndicatorNameInfo);
|
||||
if (ii)
|
||||
{
|
||||
if (ii) {
|
||||
InitIndicatorNameInfo(ii, info);
|
||||
info->leds = AddCommonInfo(&info->leds->defs, &ii->defs);
|
||||
}
|
||||
|
@ -130,8 +128,7 @@ FindIndicatorByIndex(KeyNamesInfo * info, int ndx)
|
|||
IndicatorNameInfo *old;
|
||||
|
||||
for (old = info->leds; old != NULL;
|
||||
old = (IndicatorNameInfo *) old->defs.next)
|
||||
{
|
||||
old = (IndicatorNameInfo *) old->defs.next) {
|
||||
if (old->ndx == ndx)
|
||||
return old;
|
||||
}
|
||||
|
@ -144,8 +141,7 @@ FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
|
|||
IndicatorNameInfo *old;
|
||||
|
||||
for (old = info->leds; old != NULL;
|
||||
old = (IndicatorNameInfo *) old->defs.next)
|
||||
{
|
||||
old = (IndicatorNameInfo *) old->defs.next) {
|
||||
if (old->name == name)
|
||||
return old;
|
||||
}
|
||||
|
@ -153,7 +149,8 @@ FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
|
|||
}
|
||||
|
||||
static bool
|
||||
AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode merge,
|
||||
AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge,
|
||||
IndicatorNameInfo *new)
|
||||
{
|
||||
IndicatorNameInfo *old;
|
||||
|
@ -161,49 +158,39 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
|||
|
||||
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
|
||||
old = FindIndicatorByName(info, new->name);
|
||||
if (old)
|
||||
{
|
||||
if (old) {
|
||||
if (((old->defs.file_id == new->defs.file_id) && (warningLevel > 0))
|
||||
|| (warningLevel > 9))
|
||||
{
|
||||
|| (warningLevel > 9)) {
|
||||
WARN("Multiple indicators named %s\n",
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
if (old->ndx == new->ndx)
|
||||
{
|
||||
if (old->virtual != new->virtual)
|
||||
{
|
||||
if (old->ndx == new->ndx) {
|
||||
if (old->virtual != new->virtual) {
|
||||
if (replace)
|
||||
old->virtual = new->virtual;
|
||||
ACTION("Using %s instead of %s\n",
|
||||
(old->virtual ? "virtual" : "real"),
|
||||
(old->virtual ? "real" : "virtual"));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ACTION("Identical definitions ignored\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (replace)
|
||||
ACTION("Ignoring %d, using %d\n", old->ndx, new->ndx);
|
||||
else
|
||||
ACTION("Using %d, ignoring %d\n", old->ndx, new->ndx);
|
||||
}
|
||||
if (replace)
|
||||
{
|
||||
if (replace) {
|
||||
if (info->leds == old)
|
||||
info->leds = (IndicatorNameInfo *) old->defs.next;
|
||||
else
|
||||
{
|
||||
else {
|
||||
IndicatorNameInfo *tmp;
|
||||
tmp = info->leds;
|
||||
for (; tmp != NULL;
|
||||
tmp = (IndicatorNameInfo *) tmp->defs.next)
|
||||
{
|
||||
if (tmp->defs.next == (CommonInfo *) old)
|
||||
{
|
||||
tmp = (IndicatorNameInfo *) tmp->defs.next) {
|
||||
if (tmp->defs.next == (CommonInfo *) old) {
|
||||
tmp->defs.next = old->defs.next;
|
||||
break;
|
||||
}
|
||||
|
@ -214,16 +201,13 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
|||
}
|
||||
}
|
||||
old = FindIndicatorByIndex(info, new->ndx);
|
||||
if (old)
|
||||
{
|
||||
if (old) {
|
||||
if (((old->defs.file_id == new->defs.file_id) && (warningLevel > 0))
|
||||
|| (warningLevel > 9))
|
||||
{
|
||||
|| (warningLevel > 9)) {
|
||||
WARN("Multiple names for indicator %d\n", new->ndx);
|
||||
if ((old->name == new->name) && (old->virtual == new->virtual))
|
||||
ACTION("Identical definitions ignored\n");
|
||||
else
|
||||
{
|
||||
else {
|
||||
const char *oldType, *newType;
|
||||
xkb_atom_t using, ignoring;
|
||||
if (old->virtual)
|
||||
|
@ -234,23 +218,20 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
|||
newType = "virtual indicator";
|
||||
else
|
||||
newType = "real indicator";
|
||||
if (replace)
|
||||
{
|
||||
if (replace) {
|
||||
using = new->name;
|
||||
ignoring = old->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
using = old->name;
|
||||
ignoring = new->name;
|
||||
}
|
||||
ACTION("Using %s %s, ignoring %s %s\n",
|
||||
oldType, xkb_atom_text(keymap->ctx, using),
|
||||
newType, xkb_atom_text(keymap->ctx, ignoring));
|
||||
oldType, xkb_atom_text(keymap->ctx, using),
|
||||
newType, xkb_atom_text(keymap->ctx, ignoring));
|
||||
}
|
||||
}
|
||||
if (replace)
|
||||
{
|
||||
if (replace) {
|
||||
old->name = new->name;
|
||||
old->virtual = new->virtual;
|
||||
}
|
||||
|
@ -258,8 +239,7 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
|||
}
|
||||
old = new;
|
||||
new = NextIndicatorName(info);
|
||||
if (!new)
|
||||
{
|
||||
if (!new) {
|
||||
WSGO("Couldn't allocate name for indicator %d\n", old->ndx);
|
||||
ACTION("Ignored\n");
|
||||
return false;
|
||||
|
@ -331,39 +311,32 @@ AddKeyName(KeyNamesInfo * info,
|
|||
info->computedMax = kc;
|
||||
lval = KeyNameToLong(name);
|
||||
|
||||
if (reportCollisions)
|
||||
{
|
||||
if (reportCollisions) {
|
||||
reportCollisions = (warningLevel > 7 ||
|
||||
(warningLevel > 0 &&
|
||||
file_id == darray_item(info->files, kc)));
|
||||
}
|
||||
|
||||
if (darray_item(info->names, kc) != 0)
|
||||
{
|
||||
if (darray_item(info->names, kc) != 0) {
|
||||
char buf[6];
|
||||
|
||||
LongToKeyName(darray_item(info->names, kc), buf);
|
||||
buf[4] = '\0';
|
||||
if (darray_item(info->names, kc) == lval && reportCollisions)
|
||||
{
|
||||
if (darray_item(info->names, kc) == lval && reportCollisions) {
|
||||
WARN("Multiple identical key name definitions\n");
|
||||
ACTION("Later occurences of \"<%s> = %d\" ignored\n",
|
||||
buf, kc);
|
||||
return true;
|
||||
}
|
||||
if (merge == MERGE_AUGMENT)
|
||||
{
|
||||
if (reportCollisions)
|
||||
{
|
||||
if (merge == MERGE_AUGMENT) {
|
||||
if (reportCollisions) {
|
||||
WARN("Multiple names for keycode %d\n", kc);
|
||||
ACTION("Using <%s>, ignoring <%s>\n", buf, name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (reportCollisions)
|
||||
{
|
||||
else {
|
||||
if (reportCollisions) {
|
||||
WARN("Multiple names for keycode %d\n", kc);
|
||||
ACTION("Using <%s>, ignoring <%s>\n", name, buf);
|
||||
}
|
||||
|
@ -372,22 +345,17 @@ AddKeyName(KeyNamesInfo * info,
|
|||
}
|
||||
}
|
||||
old = FindKeyByLong(info, lval);
|
||||
if ((old != 0) && (old != kc))
|
||||
{
|
||||
if (merge == MERGE_OVERRIDE)
|
||||
{
|
||||
if ((old != 0) && (old != kc)) {
|
||||
if (merge == MERGE_OVERRIDE) {
|
||||
darray_item(info->names, old) = 0;
|
||||
darray_item(info->files, old) = 0;
|
||||
if (reportCollisions)
|
||||
{
|
||||
if (reportCollisions) {
|
||||
WARN("Key name <%s> assigned to multiple keys\n", name);
|
||||
ACTION("Using %d, ignoring %d\n", kc, old);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((reportCollisions) && (warningLevel > 3))
|
||||
{
|
||||
else {
|
||||
if ((reportCollisions) && (warningLevel > 3)) {
|
||||
WARN("Key name <%s> assigned to multiple keys\n", name);
|
||||
ACTION("Using %d, ignoring %d\n", old, kc);
|
||||
}
|
||||
|
@ -408,21 +376,18 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
|||
uint64_t i;
|
||||
char buf[5];
|
||||
|
||||
if (from->errorCount > 0)
|
||||
{
|
||||
if (from->errorCount > 0) {
|
||||
into->errorCount += from->errorCount;
|
||||
return;
|
||||
}
|
||||
if (into->name == NULL)
|
||||
{
|
||||
if (into->name == NULL) {
|
||||
into->name = from->name;
|
||||
from->name = NULL;
|
||||
}
|
||||
|
||||
ResizeKeyNameArrays(into, from->computedMax);
|
||||
|
||||
for (i = from->computedMin; i <= from->computedMax; i++)
|
||||
{
|
||||
for (i = from->computedMin; i <= from->computedMax; i++) {
|
||||
if (darray_item(from->names, i) == 0)
|
||||
continue;
|
||||
LongToKeyName(darray_item(from->names, i), buf);
|
||||
|
@ -430,11 +395,9 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
|||
if (!AddKeyName(into, i, buf, merge, from->file_id, false))
|
||||
into->errorCount++;
|
||||
}
|
||||
if (from->leds)
|
||||
{
|
||||
if (from->leds) {
|
||||
IndicatorNameInfo *led, *next;
|
||||
for (led = from->leds; led != NULL; led = next)
|
||||
{
|
||||
for (led = from->leds; led != NULL; led = next) {
|
||||
if (merge != MERGE_DEFAULT)
|
||||
led->defs.merge = merge;
|
||||
if (!AddIndicatorName(into, keymap, led->defs.merge, led))
|
||||
|
@ -444,14 +407,12 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
|||
}
|
||||
if (!MergeAliases(&into->aliases, &from->aliases, merge))
|
||||
into->errorCount++;
|
||||
if (from->explicitMin != 0)
|
||||
{
|
||||
if (from->explicitMin != 0) {
|
||||
if ((into->explicitMin == 0)
|
||||
|| (into->explicitMin > from->explicitMin))
|
||||
into->explicitMin = from->explicitMin;
|
||||
}
|
||||
if (from->explicitMax > 0)
|
||||
{
|
||||
if (from->explicitMax > 0) {
|
||||
if ((into->explicitMax == 0)
|
||||
|| (into->explicitMax < from->explicitMax))
|
||||
into->explicitMax = from->explicitMax;
|
||||
|
@ -477,63 +438,53 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
memset(&included, 0, sizeof(included));
|
||||
|
||||
haveSelf = false;
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
||||
{
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL)) {
|
||||
haveSelf = true;
|
||||
included = *info;
|
||||
memset(info, 0, sizeof(KeyNamesInfo));
|
||||
}
|
||||
else if (stmt->file && strcmp(stmt->file, "computed") == 0)
|
||||
{
|
||||
else if (stmt->file && strcmp(stmt->file, "computed") == 0) {
|
||||
keymap->flags |= AutoKeyNames;
|
||||
info->explicitMin = 0;
|
||||
info->explicitMax = XKB_KEYCODE_MAX;
|
||||
return (info->errorCount == 0);
|
||||
} /* parse file, store returned info in the xkb struct */
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_KEYCODES, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
&newMerge)) {
|
||||
InitKeyNamesInfo(&included, rtrn->id);
|
||||
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||
if (stmt->stmt != NULL)
|
||||
{
|
||||
if (stmt->stmt != NULL) {
|
||||
free(included.name);
|
||||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
info->errorCount += 10; /* XXX: why 10?? */
|
||||
return false;
|
||||
}
|
||||
/* Do we have more than one include statement? */
|
||||
if ((stmt->next != NULL) && (included.errorCount < 1))
|
||||
{
|
||||
if ((stmt->next != NULL) && (included.errorCount < 1)) {
|
||||
IncludeStmt *next;
|
||||
unsigned op;
|
||||
KeyNamesInfo next_incl;
|
||||
|
||||
for (next = stmt->next; next != NULL; next = next->next)
|
||||
{
|
||||
if ((next->file == NULL) && (next->map == NULL))
|
||||
{
|
||||
for (next = stmt->next; next != NULL; next = next->next) {
|
||||
if ((next->file == NULL) && (next->map == NULL)) {
|
||||
haveSelf = true;
|
||||
MergeIncludedKeycodes(&included, keymap, info, next->merge);
|
||||
ClearKeyNamesInfo(info);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_KEYCODES,
|
||||
&rtrn, &op))
|
||||
{
|
||||
&rtrn, &op)) {
|
||||
InitKeyNamesInfo(&next_incl, rtrn->id);
|
||||
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
||||
MergeIncludedKeycodes(&included, keymap, &next_incl, op);
|
||||
ClearKeyNamesInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
info->errorCount += 10; /* XXX: Why 10?? */
|
||||
ClearKeyNamesInfo(&included);
|
||||
return false;
|
||||
|
@ -542,8 +493,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
}
|
||||
if (haveSelf)
|
||||
*info = included;
|
||||
else
|
||||
{
|
||||
else {
|
||||
MergeIncludedKeycodes(info, keymap, &included, newMerge);
|
||||
ClearKeyNamesInfo(&included);
|
||||
}
|
||||
|
@ -558,16 +508,14 @@ static int
|
|||
HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
|
||||
{
|
||||
if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
|
||||
(info->explicitMax != 0 && stmt->value > info->explicitMax))
|
||||
{
|
||||
(info->explicitMax != 0 && stmt->value > info->explicitMax)) {
|
||||
ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
|
||||
ACTION("Must be in the range %d-%d inclusive\n",
|
||||
info->explicitMin,
|
||||
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
|
||||
info->explicitMin,
|
||||
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
|
||||
return 0;
|
||||
}
|
||||
if (stmt->merge != MERGE_DEFAULT)
|
||||
{
|
||||
if (stmt->merge != MERGE_DEFAULT) {
|
||||
if (stmt->merge == MERGE_REPLACE)
|
||||
merge = MERGE_OVERRIDE;
|
||||
else
|
||||
|
@ -577,8 +525,8 @@ HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
|
|||
true);
|
||||
}
|
||||
|
||||
#define MIN_KEYCODE_DEF 0
|
||||
#define MAX_KEYCODE_DEF 1
|
||||
#define MIN_KEYCODE_DEF 0
|
||||
#define MAX_KEYCODE_DEF 1
|
||||
|
||||
/**
|
||||
* Handle the minimum/maximum statement of the xkb file.
|
||||
|
@ -596,8 +544,7 @@ HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
|
|||
if (ExprResolveLhs(keymap, stmt->name, &tmp, &field, &arrayNdx) == 0)
|
||||
return 0; /* internal error, already reported */
|
||||
|
||||
if (tmp.str != NULL)
|
||||
{
|
||||
if (tmp.str != NULL) {
|
||||
ERROR("Unknown element %s encountered\n", tmp.str);
|
||||
ACTION("Default for field %s ignored\n", field.str);
|
||||
goto err_out;
|
||||
|
@ -606,66 +553,56 @@ HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
|
|||
which = MIN_KEYCODE_DEF;
|
||||
else if (strcasecmp(field.str, "maximum") == 0)
|
||||
which = MAX_KEYCODE_DEF;
|
||||
else
|
||||
{
|
||||
else {
|
||||
ERROR("Unknown field encountered\n");
|
||||
ACTION("Assigment to field %s ignored\n", field.str);
|
||||
goto err_out;
|
||||
}
|
||||
if (arrayNdx != NULL)
|
||||
{
|
||||
if (arrayNdx != NULL) {
|
||||
ERROR("The %s setting is not an array\n", field.str);
|
||||
ACTION("Illegal array reference ignored\n");
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0)
|
||||
{
|
||||
if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0) {
|
||||
ACTION("Assignment to field %s ignored\n", field.str);
|
||||
goto err_out;
|
||||
}
|
||||
if (tmp.uval > XKB_KEYCODE_MAX)
|
||||
{
|
||||
if (tmp.uval > XKB_KEYCODE_MAX) {
|
||||
ERROR
|
||||
("Illegal keycode %d (must be in the range %d-%d inclusive)\n",
|
||||
tmp.uval, 0, XKB_KEYCODE_MAX);
|
||||
tmp.uval, 0, XKB_KEYCODE_MAX);
|
||||
ACTION("Value of \"%s\" not changed\n", field.str);
|
||||
goto err_out;
|
||||
}
|
||||
if (which == MIN_KEYCODE_DEF)
|
||||
{
|
||||
if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval))
|
||||
{
|
||||
if (which == MIN_KEYCODE_DEF) {
|
||||
if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval)) {
|
||||
ERROR
|
||||
("Minimum key code (%d) must be <= maximum key code (%d)\n",
|
||||
tmp.uval, info->explicitMax);
|
||||
tmp.uval, info->explicitMax);
|
||||
ACTION("Minimum key code value not changed\n");
|
||||
goto err_out;
|
||||
}
|
||||
if ((info->computedMax > 0) && (info->computedMin < tmp.uval))
|
||||
{
|
||||
if ((info->computedMax > 0) && (info->computedMin < tmp.uval)) {
|
||||
ERROR
|
||||
("Minimum key code (%d) must be <= lowest defined key (%d)\n",
|
||||
tmp.uval, info->computedMin);
|
||||
tmp.uval, info->computedMin);
|
||||
ACTION("Minimum key code value not changed\n");
|
||||
goto err_out;
|
||||
}
|
||||
info->explicitMin = tmp.uval;
|
||||
}
|
||||
if (which == MAX_KEYCODE_DEF)
|
||||
{
|
||||
if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval))
|
||||
{
|
||||
if (which == MAX_KEYCODE_DEF) {
|
||||
if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval)) {
|
||||
ERROR("Maximum code (%d) must be >= minimum key code (%d)\n",
|
||||
tmp.uval, info->explicitMin);
|
||||
tmp.uval, info->explicitMin);
|
||||
ACTION("Maximum code value not changed\n");
|
||||
goto err_out;
|
||||
}
|
||||
if ((info->computedMax > 0) && (info->computedMax > tmp.uval))
|
||||
{
|
||||
if ((info->computedMax > 0) && (info->computedMax > tmp.uval)) {
|
||||
ERROR
|
||||
("Maximum code (%d) must be >= highest defined key (%d)\n",
|
||||
tmp.uval, info->computedMax);
|
||||
tmp.uval, info->computedMax);
|
||||
ACTION("Maximum code value not changed\n");
|
||||
goto err_out;
|
||||
}
|
||||
|
@ -687,8 +624,7 @@ HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
|||
IndicatorNameInfo ii;
|
||||
ExprResult tmp;
|
||||
|
||||
if ((def->ndx < 1) || (def->ndx > XkbNumIndicators))
|
||||
{
|
||||
if ((def->ndx < 1) || (def->ndx > XkbNumIndicators)) {
|
||||
info->errorCount++;
|
||||
ERROR("Name specified for illegal indicator index %d\n", def->ndx);
|
||||
ACTION("Ignored\n");
|
||||
|
@ -696,8 +632,7 @@ HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
|||
}
|
||||
InitIndicatorNameInfo(&ii, info);
|
||||
ii.ndx = def->ndx;
|
||||
if (!ExprResolveString(keymap->ctx, def->name, &tmp))
|
||||
{
|
||||
if (!ExprResolveString(keymap->ctx, def->name, &tmp)) {
|
||||
char buf[20];
|
||||
snprintf(buf, sizeof(buf), "%d", def->ndx);
|
||||
info->errorCount++;
|
||||
|
@ -735,8 +670,7 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
|||
stmt = file->defs;
|
||||
while (stmt)
|
||||
{
|
||||
switch (stmt->stmtType)
|
||||
{
|
||||
switch (stmt->stmtType) {
|
||||
case StmtInclude: /* e.g. include "evdev+aliases(qwerty)" */
|
||||
if (!HandleIncludeKeycodes((IncludeStmt *) stmt, keymap, info))
|
||||
info->errorCount++;
|
||||
|
@ -763,19 +697,18 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
|||
case StmtVModDef:
|
||||
ERROR("Keycode files may define key and indicator names only\n");
|
||||
ACTION("Ignoring definition of %s\n",
|
||||
((stmt->stmtType ==
|
||||
StmtInterpDef) ? "a symbol interpretation" :
|
||||
"virtual modifiers"));
|
||||
((stmt->stmtType ==
|
||||
StmtInterpDef) ? "a symbol interpretation" :
|
||||
"virtual modifiers"));
|
||||
info->errorCount++;
|
||||
break;
|
||||
default:
|
||||
WSGO("Unexpected statement type %d in HandleKeycodesFile\n",
|
||||
stmt->stmtType);
|
||||
stmt->stmtType);
|
||||
break;
|
||||
}
|
||||
stmt = stmt->next;
|
||||
if (info->errorCount > 10)
|
||||
{
|
||||
if (info->errorCount > 10) {
|
||||
#ifdef NOISY
|
||||
ERROR("Too many errors\n");
|
||||
#endif
|
||||
|
@ -796,7 +729,8 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
|||
* @return true on success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge)
|
||||
{
|
||||
KeyNamesInfo info; /* contains all the info after parsing */
|
||||
|
||||
|
@ -827,7 +761,8 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
|||
darray_item(keymap->names->keys, i).name);
|
||||
if (info.name)
|
||||
keymap->names->keycodes = strdup(info.name);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
WSGO("Cannot create struct xkb_names in CompileKeycodes\n");
|
||||
goto err_info;
|
||||
}
|
||||
|
@ -839,7 +774,7 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
|||
ACTION("Physical indicators not set\n");
|
||||
}
|
||||
|
||||
for (ii = info.leds; ii; ii = (IndicatorNameInfo *)ii->defs.next) {
|
||||
for (ii = info.leds; ii; ii = (IndicatorNameInfo *) ii->defs.next) {
|
||||
free(keymap->names->indicators[ii->ndx - 1]);
|
||||
keymap->names->indicators[ii->ndx - 1] =
|
||||
xkb_atom_strdup(keymap->ctx, ii->name);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef KEYCODES_H
|
||||
|
@ -30,13 +30,14 @@
|
|||
#include "xkbcomp-priv.h"
|
||||
|
||||
#define KeyNameToLong(n) ( \
|
||||
(((unsigned long)n[0]) << 24) | \
|
||||
(((unsigned long)n[1]) << 16) | \
|
||||
(((unsigned long)n[2]) << 8) | \
|
||||
(((unsigned long)n[3]) << 0))
|
||||
(((unsigned long) n[0]) << 24) | \
|
||||
(((unsigned long) n[1]) << 16) | \
|
||||
(((unsigned long) n[2]) << 8) | \
|
||||
(((unsigned long) n[3]) << 0))
|
||||
|
||||
extern const
|
||||
char *longText(unsigned long val);
|
||||
char *
|
||||
longText(unsigned long val);
|
||||
|
||||
extern void
|
||||
LongToKeyName(unsigned long val, char *name_rtrn);
|
||||
|
|
|
@ -1,35 +1,34 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "xkbcomp-priv.h"
|
||||
#include "parseutils.h"
|
||||
#include "vmod.h"
|
||||
|
||||
typedef struct _PreserveInfo
|
||||
{
|
||||
typedef struct _PreserveInfo {
|
||||
CommonInfo defs;
|
||||
short matchingMapIndex;
|
||||
unsigned char indexMods;
|
||||
|
@ -38,14 +37,13 @@ typedef struct _PreserveInfo
|
|||
unsigned short preVMods;
|
||||
} PreserveInfo;
|
||||
|
||||
#define _KT_Name (1<<0)
|
||||
#define _KT_Mask (1<<1)
|
||||
#define _KT_Map (1<<2)
|
||||
#define _KT_Preserve (1<<3)
|
||||
#define _KT_LevelNames (1<<4)
|
||||
#define _KT_Name (1 << 0)
|
||||
#define _KT_Mask (1 << 1)
|
||||
#define _KT_Map (1 << 2)
|
||||
#define _KT_Preserve (1 << 3)
|
||||
#define _KT_LevelNames (1 << 4)
|
||||
|
||||
typedef struct _KeyTypeInfo
|
||||
{
|
||||
typedef struct _KeyTypeInfo {
|
||||
CommonInfo defs;
|
||||
xkb_atom_t name;
|
||||
unsigned file_id;
|
||||
|
@ -58,8 +56,7 @@ typedef struct _KeyTypeInfo
|
|||
darray(xkb_atom_t) lvlNames;
|
||||
} KeyTypeInfo;
|
||||
|
||||
typedef struct _KeyTypesInfo
|
||||
{
|
||||
typedef struct _KeyTypesInfo {
|
||||
char *name;
|
||||
int errorCount;
|
||||
unsigned file_id;
|
||||
|
@ -124,20 +121,17 @@ InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap,
|
|||
darray_init(info->dflt.lvlNames);
|
||||
info->dflt.preserve = NULL;
|
||||
InitVModInfo(&info->vmods, keymap);
|
||||
if (from != NULL)
|
||||
{
|
||||
if (from != NULL) {
|
||||
info->dflt = from->dflt;
|
||||
|
||||
darray_copy(info->dflt.entries, from->dflt.entries);
|
||||
darray_copy(info->dflt.lvlNames, from->dflt.lvlNames);
|
||||
|
||||
if (from->dflt.preserve)
|
||||
{
|
||||
if (from->dflt.preserve) {
|
||||
PreserveInfo *old, *new, *last;
|
||||
last = NULL;
|
||||
old = from->dflt.preserve;
|
||||
for (; old; old = (PreserveInfo *) old->defs.next)
|
||||
{
|
||||
for (; old; old = (PreserveInfo *) old->defs.next) {
|
||||
new = uTypedAlloc(PreserveInfo);
|
||||
if (!new)
|
||||
return;
|
||||
|
@ -158,8 +152,7 @@ FreeKeyTypeInfo(KeyTypeInfo * type)
|
|||
{
|
||||
darray_free(type->entries);
|
||||
darray_free(type->lvlNames);
|
||||
if (type->preserve != NULL)
|
||||
{
|
||||
if (type->preserve != NULL) {
|
||||
ClearCommonInfo(&type->preserve->defs);
|
||||
type->preserve = NULL;
|
||||
}
|
||||
|
@ -170,11 +163,10 @@ FreeKeyTypesInfo(KeyTypesInfo * info)
|
|||
{
|
||||
free(info->name);
|
||||
info->name = NULL;
|
||||
if (info->types)
|
||||
{
|
||||
if (info->types) {
|
||||
KeyTypeInfo *type;
|
||||
for (type = info->types; type; type = (KeyTypeInfo *) type->defs.next)
|
||||
{
|
||||
for (type = info->types; type; type =
|
||||
(KeyTypeInfo *) type->defs.next) {
|
||||
FreeKeyTypeInfo(type);
|
||||
}
|
||||
info->types = ClearCommonInfo(&info->types->defs);
|
||||
|
@ -188,8 +180,7 @@ NextKeyType(KeyTypesInfo * info)
|
|||
KeyTypeInfo *type;
|
||||
|
||||
type = uTypedAlloc(KeyTypeInfo);
|
||||
if (type != NULL)
|
||||
{
|
||||
if (type != NULL) {
|
||||
memset(type, 0, sizeof(KeyTypeInfo));
|
||||
type->defs.file_id = info->file_id;
|
||||
info->types = AddCommonInfo(&info->types->defs, &type->defs);
|
||||
|
@ -203,8 +194,7 @@ FindMatchingKeyType(KeyTypesInfo * info, KeyTypeInfo * new)
|
|||
{
|
||||
KeyTypeInfo *old;
|
||||
|
||||
for (old = info->types; old; old = (KeyTypeInfo *) old->defs.next)
|
||||
{
|
||||
for (old = info->types; old; old = (KeyTypeInfo *) old->defs.next) {
|
||||
if (old->name == new->name)
|
||||
return old;
|
||||
}
|
||||
|
@ -224,30 +214,26 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
{
|
||||
KeyTypeInfo *old;
|
||||
|
||||
if (new->name == tok_ONE_LEVEL)
|
||||
{
|
||||
if (new->name == tok_ONE_LEVEL) {
|
||||
if (new->numLevels > 1)
|
||||
return ReportTypeBadWidth("ONE_LEVEL", new->numLevels, 1);
|
||||
info->stdPresent |= XkbOneLevelMask;
|
||||
}
|
||||
else if (new->name == tok_TWO_LEVEL)
|
||||
{
|
||||
else if (new->name == tok_TWO_LEVEL) {
|
||||
if (new->numLevels > 2)
|
||||
return ReportTypeBadWidth("TWO_LEVEL", new->numLevels, 2);
|
||||
else if (new->numLevels < 2)
|
||||
new->numLevels = 2;
|
||||
info->stdPresent |= XkbTwoLevelMask;
|
||||
}
|
||||
else if (new->name == tok_ALPHABETIC)
|
||||
{
|
||||
else if (new->name == tok_ALPHABETIC) {
|
||||
if (new->numLevels > 2)
|
||||
return ReportTypeBadWidth("ALPHABETIC", new->numLevels, 2);
|
||||
else if (new->numLevels < 2)
|
||||
new->numLevels = 2;
|
||||
info->stdPresent |= XkbAlphabeticMask;
|
||||
}
|
||||
else if (new->name == tok_KEYPAD)
|
||||
{
|
||||
else if (new->name == tok_KEYPAD) {
|
||||
if (new->numLevels > 2)
|
||||
return ReportTypeBadWidth("KEYPAD", new->numLevels, 2);
|
||||
else if (new->numLevels < 2)
|
||||
|
@ -256,16 +242,13 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
}
|
||||
|
||||
old = FindMatchingKeyType(info, new);
|
||||
if (old != NULL)
|
||||
{
|
||||
if (old != NULL) {
|
||||
bool report;
|
||||
if ((new->defs.merge == MERGE_REPLACE)
|
||||
|| (new->defs.merge == MERGE_OVERRIDE))
|
||||
{
|
||||
|| (new->defs.merge == MERGE_OVERRIDE)) {
|
||||
KeyTypeInfo *next = (KeyTypeInfo *) old->defs.next;
|
||||
if (((old->defs.file_id == new->defs.file_id)
|
||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
||||
{
|
||||
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||
WARN("Multiple definitions of the %s key type\n",
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
ACTION("Earlier definition ignored\n");
|
||||
|
@ -278,9 +261,9 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
|||
old->defs.next = &next->defs;
|
||||
return true;
|
||||
}
|
||||
report = (old->defs.file_id == new->defs.file_id) && (warningLevel > 0);
|
||||
if (report)
|
||||
{
|
||||
report = (old->defs.file_id == new->defs.file_id) &&
|
||||
(warningLevel > 0);
|
||||
if (report) {
|
||||
WARN("Multiple definitions of the %s key type\n",
|
||||
xkb_atom_text(keymap->ctx, new->name));
|
||||
ACTION("Later definition ignored\n");
|
||||
|
@ -307,18 +290,15 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
|||
{
|
||||
KeyTypeInfo *type;
|
||||
|
||||
if (from->errorCount > 0)
|
||||
{
|
||||
if (from->errorCount > 0) {
|
||||
into->errorCount += from->errorCount;
|
||||
return;
|
||||
}
|
||||
if (into->name == NULL)
|
||||
{
|
||||
if (into->name == NULL) {
|
||||
into->name = from->name;
|
||||
from->name = NULL;
|
||||
}
|
||||
for (type = from->types; type; type = (KeyTypeInfo *) type->defs.next)
|
||||
{
|
||||
for (type = from->types; type; type = (KeyTypeInfo *) type->defs.next) {
|
||||
if (merge != MERGE_DEFAULT)
|
||||
type->defs.merge = merge;
|
||||
if (!AddKeyType(keymap, into, type))
|
||||
|
@ -329,7 +309,8 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
|||
|
||||
static void
|
||||
HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge, KeyTypesInfo *info);
|
||||
enum merge_mode merge,
|
||||
KeyTypesInfo *info);
|
||||
|
||||
static bool
|
||||
HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||
|
@ -341,49 +322,41 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
bool haveSelf;
|
||||
|
||||
haveSelf = false;
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
||||
{
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL)) {
|
||||
haveSelf = true;
|
||||
included = *info;
|
||||
memset(info, 0, sizeof(KeyTypesInfo));
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_TYPES, &rtrn,
|
||||
&newMerge))
|
||||
{
|
||||
&newMerge)) {
|
||||
InitKeyTypesInfo(&included, keymap, info, rtrn->id);
|
||||
included.dflt.defs.merge = newMerge;
|
||||
|
||||
HandleKeyTypesFile(rtrn, keymap, newMerge, &included);
|
||||
if (stmt->stmt != NULL)
|
||||
{
|
||||
if (stmt->stmt != NULL) {
|
||||
free(included.name);
|
||||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
info->errorCount += 10;
|
||||
return false;
|
||||
}
|
||||
if ((stmt->next != NULL) && (included.errorCount < 1))
|
||||
{
|
||||
if ((stmt->next != NULL) && (included.errorCount < 1)) {
|
||||
IncludeStmt *next;
|
||||
unsigned op;
|
||||
KeyTypesInfo next_incl;
|
||||
|
||||
for (next = stmt->next; next != NULL; next = next->next)
|
||||
{
|
||||
if ((next->file == NULL) && (next->map == NULL))
|
||||
{
|
||||
for (next = stmt->next; next != NULL; next = next->next) {
|
||||
if ((next->file == NULL) && (next->map == NULL)) {
|
||||
haveSelf = true;
|
||||
MergeIncludedKeyTypes(&included, info, next->merge, keymap);
|
||||
FreeKeyTypesInfo(info);
|
||||
}
|
||||
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_TYPES,
|
||||
&rtrn, &op))
|
||||
{
|
||||
&rtrn, &op)) {
|
||||
InitKeyTypesInfo(&next_incl, keymap, &included, rtrn->id);
|
||||
next_incl.dflt.defs.merge = op;
|
||||
HandleKeyTypesFile(rtrn, keymap, op, &next_incl);
|
||||
|
@ -391,8 +364,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
FreeKeyTypesInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
info->errorCount += 10;
|
||||
FreeKeyTypesInfo(&included);
|
||||
return false;
|
||||
|
@ -401,8 +373,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
|||
}
|
||||
if (haveSelf)
|
||||
*info = included;
|
||||
else
|
||||
{
|
||||
else {
|
||||
MergeIncludedKeyTypes(info, &included, newMerge, keymap);
|
||||
FreeKeyTypesInfo(&included);
|
||||
}
|
||||
|
@ -417,8 +388,8 @@ FindMatchingMapEntry(KeyTypeInfo * type, unsigned mask, unsigned vmask)
|
|||
struct xkb_kt_map_entry *entry;
|
||||
|
||||
darray_foreach(entry, type->entries)
|
||||
if (entry->mods.real_mods == mask && entry->mods.vmods == vmask)
|
||||
return entry;
|
||||
if (entry->mods.real_mods == mask && entry->mods.vmods == vmask)
|
||||
return entry;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -434,7 +405,7 @@ DeleteLevel1MapEntries(KeyTypeInfo * type)
|
|||
for (n = i; n < darray_size(type->entries) - 1; n++)
|
||||
darray_item(type->entries, n) =
|
||||
darray_item(type->entries, n + 1);
|
||||
(void)darray_pop(type->entries);
|
||||
(void) darray_pop(type->entries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,27 +427,23 @@ AddPreserve(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
|||
while (old != NULL)
|
||||
{
|
||||
if ((old->indexMods != new->indexMods) ||
|
||||
(old->indexVMods != new->indexVMods))
|
||||
{
|
||||
(old->indexVMods != new->indexVMods)) {
|
||||
old = (PreserveInfo *) old->defs.next;
|
||||
continue;
|
||||
}
|
||||
if ((old->preMods == new->preMods)
|
||||
&& (old->preVMods == new->preVMods))
|
||||
{
|
||||
if (warningLevel > 9)
|
||||
{
|
||||
&& (old->preVMods == new->preVMods)) {
|
||||
if (warningLevel > 9) {
|
||||
WARN("Identical definitions for preserve[%s] in %s\n",
|
||||
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
||||
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
||||
ACTION("Ignored\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (report && (warningLevel > 0))
|
||||
{
|
||||
if (report && (warningLevel > 0)) {
|
||||
const char *str;
|
||||
WARN("Multiple definitions for preserve[%s] in %s\n",
|
||||
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
||||
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
||||
|
||||
if (clobber)
|
||||
str = PreserveTxt(keymap, new);
|
||||
|
@ -489,16 +456,14 @@ AddPreserve(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
|||
str = PreserveTxt(keymap, new);
|
||||
INFO("ignoring %s\n", str);
|
||||
}
|
||||
if (clobber)
|
||||
{
|
||||
if (clobber) {
|
||||
old->preMods = new->preMods;
|
||||
old->preVMods = new->preVMods;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
old = uTypedAlloc(PreserveInfo);
|
||||
if (!old)
|
||||
{
|
||||
if (!old) {
|
||||
WSGO("Couldn't allocate preserve in %s\n", TypeTxt(keymap, type));
|
||||
ACTION("Preserve[%s] lost\n", PreserveIndexTxt(keymap, new));
|
||||
return false;
|
||||
|
@ -524,30 +489,26 @@ AddMapEntry(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
|||
struct xkb_kt_map_entry * old;
|
||||
|
||||
if ((old =
|
||||
FindMatchingMapEntry(type, new->mods.real_mods, new->mods.vmods)))
|
||||
{
|
||||
if (report && (old->level != new->level))
|
||||
{
|
||||
FindMatchingMapEntry(type, new->mods.real_mods,
|
||||
new->mods.vmods))) {
|
||||
if (report && (old->level != new->level)) {
|
||||
unsigned use, ignore;
|
||||
if (clobber)
|
||||
{
|
||||
if (clobber) {
|
||||
use = new->level + 1;
|
||||
ignore = old->level + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
use = old->level + 1;
|
||||
ignore = new->level + 1;
|
||||
}
|
||||
WARN("Multiple map entries for %s in %s\n",
|
||||
MapEntryTxt(keymap, new), TypeTxt(keymap, type));
|
||||
MapEntryTxt(keymap, new), TypeTxt(keymap, type));
|
||||
ACTION("Using %d, ignoring %d\n", use, ignore);
|
||||
}
|
||||
else if (warningLevel > 9)
|
||||
{
|
||||
else if (warningLevel > 9) {
|
||||
WARN("Multiple occurences of map[%s]= %d in %s\n",
|
||||
MapEntryTxt(keymap, new), new->level + 1,
|
||||
TypeTxt(keymap, type));
|
||||
MapEntryTxt(keymap, new), new->level + 1,
|
||||
TypeTxt(keymap, type));
|
||||
ACTION("Ignored\n");
|
||||
return true;
|
||||
}
|
||||
|
@ -580,13 +541,12 @@ SetMapEntry(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
|||
entry.mods.real_mods = rtrn.uval & 0xff; /* modifiers < 512 */
|
||||
entry.mods.vmods = (rtrn.uval >> 8) & 0xffff; /* modifiers > 512 */
|
||||
if ((entry.mods.real_mods & (~type->mask)) ||
|
||||
((entry.mods.vmods & (~type->vmask)) != 0))
|
||||
{
|
||||
if (warningLevel > 0)
|
||||
{
|
||||
WARN("Map entry for unused modifiers in %s\n", TypeTxt(keymap, type));
|
||||
((entry.mods.vmods & (~type->vmask)) != 0)) {
|
||||
if (warningLevel > 0) {
|
||||
WARN("Map entry for unused modifiers in %s\n",
|
||||
TypeTxt(keymap, type));
|
||||
ACTION("Using %s instead of ",
|
||||
XkbcVModMaskText(keymap,
|
||||
XkbcVModMaskText(keymap,
|
||||
entry.mods.real_mods & type->mask,
|
||||
entry.mods.vmods & type->vmask));
|
||||
INFO("%s\n", MapEntryTxt(keymap, &entry));
|
||||
|
@ -594,8 +554,7 @@ SetMapEntry(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
|||
entry.mods.real_mods &= type->mask;
|
||||
entry.mods.vmods &= type->vmask;
|
||||
}
|
||||
if (!ExprResolveLevel(keymap->ctx, value, &rtrn))
|
||||
{
|
||||
if (!ExprResolveLevel(keymap->ctx, value, &rtrn)) {
|
||||
ERROR("Level specifications in a key type must be integer\n");
|
||||
ACTION("Ignoring malformed level specification\n");
|
||||
return false;
|
||||
|
@ -620,12 +579,11 @@ SetPreserve(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
|||
new.defs.next = NULL;
|
||||
new.indexMods = rtrn.uval & 0xff;
|
||||
new.indexVMods = (rtrn.uval >> 8) & 0xffff;
|
||||
if ((new.indexMods & (~type->mask)) || (new.indexVMods & (~type->vmask)))
|
||||
{
|
||||
if (warningLevel > 0)
|
||||
{
|
||||
if ((new.indexMods & (~type->mask)) ||
|
||||
(new.indexVMods & (~type->vmask))) {
|
||||
if (warningLevel > 0) {
|
||||
WARN("Preserve for modifiers not used by the %s type\n",
|
||||
TypeTxt(keymap, type));
|
||||
TypeTxt(keymap, type));
|
||||
ACTION("Index %s converted to ", PreserveIndexTxt(keymap, &new));
|
||||
}
|
||||
new.indexMods &= type->mask;
|
||||
|
@ -633,28 +591,24 @@ SetPreserve(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
|||
if (warningLevel > 0)
|
||||
INFO("%s\n", PreserveIndexTxt(keymap, &new));
|
||||
}
|
||||
if (!ExprResolveVModMask(value, &rtrn, keymap))
|
||||
{
|
||||
if (!ExprResolveVModMask(value, &rtrn, keymap)) {
|
||||
ERROR("Preserve value in a key type is not a modifier mask\n");
|
||||
ACTION("Ignoring preserve[%s] in type %s\n",
|
||||
PreserveIndexTxt(keymap, &new), TypeTxt(keymap, type));
|
||||
PreserveIndexTxt(keymap, &new), TypeTxt(keymap, type));
|
||||
return false;
|
||||
}
|
||||
new.preMods = rtrn.uval & 0xff;
|
||||
new.preVMods = (rtrn.uval >> 16) & 0xffff;
|
||||
if ((new.preMods & (~new.indexMods))
|
||||
|| (new.preVMods & (~new.indexVMods)))
|
||||
{
|
||||
if (warningLevel > 0)
|
||||
{
|
||||
|| (new.preVMods & (~new.indexVMods))) {
|
||||
if (warningLevel > 0) {
|
||||
WARN("Illegal value for preserve[%s] in type %s\n",
|
||||
PreserveTxt(keymap, &new), TypeTxt(keymap, type));
|
||||
PreserveTxt(keymap, &new), TypeTxt(keymap, type));
|
||||
ACTION("Converted %s to ", PreserveIndexTxt(keymap, &new));
|
||||
}
|
||||
new.preMods &= new.indexMods;
|
||||
new.preVMods &= new.indexVMods;
|
||||
if (warningLevel > 0)
|
||||
{
|
||||
if (warningLevel > 0) {
|
||||
INFO("%s\n", PreserveIndexTxt(keymap, &new));
|
||||
}
|
||||
}
|
||||
|
@ -713,10 +667,9 @@ SetLevelName(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
|||
if (!ExprResolveLevel(keymap->ctx, arrayNdx, &rtrn))
|
||||
return ReportTypeBadType(keymap, type, "level name", "integer");
|
||||
level = rtrn.ival - 1;
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||
{
|
||||
if (!ExprResolveString(keymap->ctx, value, &rtrn)) {
|
||||
ERROR("Non-string name for level %d in key type %s\n", level + 1,
|
||||
xkb_atom_text(keymap->ctx, type->name));
|
||||
xkb_atom_text(keymap->ctx, type->name));
|
||||
ACTION("Ignoring illegal level name definition\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -739,27 +692,23 @@ SetKeyTypeField(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
|||
{
|
||||
ExprResult tmp;
|
||||
|
||||
if (strcasecmp(field, "modifiers") == 0)
|
||||
{
|
||||
if (strcasecmp(field, "modifiers") == 0) {
|
||||
unsigned mods, vmods;
|
||||
if (arrayNdx != NULL)
|
||||
{
|
||||
if (arrayNdx != NULL) {
|
||||
WARN("The modifiers field of a key type is not an array\n");
|
||||
ACTION("Illegal array subscript ignored\n");
|
||||
}
|
||||
/* get modifier mask for current type */
|
||||
if (!ExprResolveVModMask(value, &tmp, keymap))
|
||||
{
|
||||
if (!ExprResolveVModMask(value, &tmp, keymap)) {
|
||||
ERROR("Key type mask field must be a modifier mask\n");
|
||||
ACTION("Key type definition ignored\n");
|
||||
return false;
|
||||
}
|
||||
mods = tmp.uval & 0xff; /* core mods */
|
||||
vmods = (tmp.uval >> 8) & 0xffff; /* xkb virtual mods */
|
||||
if (type->defs.defined & _KT_Mask)
|
||||
{
|
||||
if (type->defs.defined & _KT_Mask) {
|
||||
WARN("Multiple modifier mask definitions for key type %s\n",
|
||||
xkb_atom_text(keymap->ctx, type->name));
|
||||
xkb_atom_text(keymap->ctx, type->name));
|
||||
ACTION("Using %s, ", TypeMaskTxt(type, keymap));
|
||||
INFO("ignoring %s\n", XkbcVModMaskText(keymap, mods, vmods));
|
||||
return false;
|
||||
|
@ -769,19 +718,16 @@ SetKeyTypeField(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
|||
type->defs.defined |= _KT_Mask;
|
||||
return true;
|
||||
}
|
||||
else if (strcasecmp(field, "map") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "map") == 0) {
|
||||
type->defs.defined |= _KT_Map;
|
||||
return SetMapEntry(type, keymap, arrayNdx, value);
|
||||
}
|
||||
else if (strcasecmp(field, "preserve") == 0)
|
||||
{
|
||||
else if (strcasecmp(field, "preserve") == 0) {
|
||||
type->defs.defined |= _KT_Preserve;
|
||||
return SetPreserve(type, keymap, arrayNdx, value);
|
||||
}
|
||||
else if ((strcasecmp(field, "levelname") == 0) ||
|
||||
(strcasecmp(field, "level_name") == 0))
|
||||
{
|
||||
(strcasecmp(field, "level_name") == 0)) {
|
||||
type->defs.defined |= _KT_LevelNames;
|
||||
return SetLevelName(type, keymap, arrayNdx, value);
|
||||
}
|
||||
|
@ -801,15 +747,13 @@ HandleKeyTypeVar(VarDef *stmt, struct xkb_keymap *keymap, KeyTypesInfo *info)
|
|||
if (elem.str && (strcasecmp(elem.str, "type") == 0))
|
||||
return SetKeyTypeField(&info->dflt, keymap, field.str, arrayNdx,
|
||||
stmt->value, info);
|
||||
if (elem.str != NULL)
|
||||
{
|
||||
if (elem.str != NULL) {
|
||||
ERROR("Default for unknown element %s\n", uStringText(elem.str));
|
||||
ACTION("Value for field %s ignored\n", uStringText(field.str));
|
||||
}
|
||||
else if (field.str != NULL)
|
||||
{
|
||||
else if (field.str != NULL) {
|
||||
ERROR("Default defined for unknown field %s\n",
|
||||
uStringText(field.str));
|
||||
uStringText(field.str));
|
||||
ACTION("Ignored\n");
|
||||
}
|
||||
return false;
|
||||
|
@ -823,10 +767,8 @@ HandleKeyTypeBody(VarDef *def, struct xkb_keymap *keymap,
|
|||
ExprResult tmp, field;
|
||||
ExprDef *arrayNdx;
|
||||
|
||||
for (; def != NULL; def = (VarDef *) def->common.next)
|
||||
{
|
||||
if ((def->name) && (def->name->type == ExprFieldRef))
|
||||
{
|
||||
for (; def != NULL; def = (VarDef *) def->common.next) {
|
||||
if ((def->name) && (def->name->type == ExprFieldRef)) {
|
||||
ok = HandleKeyTypeVar(def, keymap, info);
|
||||
continue;
|
||||
}
|
||||
|
@ -869,8 +811,7 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
|||
type.preserve = NULL;
|
||||
|
||||
/* Parse the actual content. */
|
||||
if (!HandleKeyTypeBody(def->body, keymap, &type, info))
|
||||
{
|
||||
if (!HandleKeyTypeBody(def->body, keymap, &type, info)) {
|
||||
info->errorCount++;
|
||||
return false;
|
||||
}
|
||||
|
@ -882,14 +823,12 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
|||
(entry->mods.vmods & type.vmask) == entry->mods.vmods)
|
||||
AddMapEntry(keymap, &type, entry, false, false);
|
||||
}
|
||||
if (info->dflt.preserve)
|
||||
{
|
||||
if (info->dflt.preserve) {
|
||||
PreserveInfo *dflt = info->dflt.preserve;
|
||||
while (dflt)
|
||||
{
|
||||
if (((dflt->indexMods & type.mask) == dflt->indexMods) &&
|
||||
((dflt->indexVMods & type.vmask) == dflt->indexVMods))
|
||||
{
|
||||
((dflt->indexVMods & type.vmask) == dflt->indexVMods)) {
|
||||
AddPreserve(keymap, &type, dflt, false, false);
|
||||
}
|
||||
dflt = (PreserveInfo *) dflt->defs.next;
|
||||
|
@ -898,16 +837,14 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
|||
|
||||
for (i = 0; i < darray_size(info->dflt.lvlNames); i++) {
|
||||
if (i < type.numLevels &&
|
||||
darray_item(info->dflt.lvlNames, i) != XKB_ATOM_NONE)
|
||||
{
|
||||
darray_item(info->dflt.lvlNames, i) != XKB_ATOM_NONE) {
|
||||
AddLevelName(keymap, &type, i,
|
||||
darray_item(info->dflt.lvlNames, i), false);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now add the new keytype to the info struct */
|
||||
if (!AddKeyType(keymap, info, &type))
|
||||
{
|
||||
if (!AddKeyType(keymap, info, &type)) {
|
||||
info->errorCount++;
|
||||
return false;
|
||||
}
|
||||
|
@ -932,8 +869,7 @@ HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
|||
stmt = file->defs;
|
||||
while (stmt)
|
||||
{
|
||||
switch (stmt->stmtType)
|
||||
{
|
||||
switch (stmt->stmtType) {
|
||||
case StmtInclude:
|
||||
if (!HandleIncludeKeyTypes((IncludeStmt *) stmt, keymap, info))
|
||||
info->errorCount++;
|
||||
|
@ -967,12 +903,11 @@ HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
|||
break;
|
||||
default:
|
||||
WSGO("Unexpected statement type %d in HandleKeyTypesFile\n",
|
||||
stmt->stmtType);
|
||||
stmt->stmtType);
|
||||
break;
|
||||
}
|
||||
stmt = stmt->next;
|
||||
if (info->errorCount > 10)
|
||||
{
|
||||
if (info->errorCount > 10) {
|
||||
#ifdef NOISY
|
||||
ERROR("Too many errors\n");
|
||||
#endif
|
||||
|
@ -998,7 +933,8 @@ ComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type)
|
|||
if (tmp == 0)
|
||||
continue;
|
||||
}
|
||||
entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask;
|
||||
entry->mods.mask =
|
||||
(entry->mods.real_mods | tmp) & type->mods.mask;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1015,8 +951,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
PreserveInfo *pre;
|
||||
|
||||
for (pre = def->preserve; pre != NULL;
|
||||
pre = (PreserveInfo *) pre->defs.next)
|
||||
{
|
||||
pre = (PreserveInfo *) pre->defs.next) {
|
||||
struct xkb_kt_map_entry * match;
|
||||
struct xkb_kt_map_entry tmp;
|
||||
tmp.mods.real_mods = pre->indexMods;
|
||||
|
@ -1024,8 +959,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
tmp.level = 0;
|
||||
AddMapEntry(keymap, def, &tmp, false, false);
|
||||
match = FindMatchingMapEntry(def, pre->indexMods, pre->indexVMods);
|
||||
if (!match)
|
||||
{
|
||||
if (!match) {
|
||||
WSGO("Couldn't find matching entry for preserve\n");
|
||||
ACTION("Aborting\n");
|
||||
return false;
|
||||
|
@ -1036,20 +970,16 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
type->mods.vmods = def->vmask;
|
||||
type->num_levels = def->numLevels;
|
||||
memcpy(&type->map, &def->entries, sizeof(def->entries));
|
||||
if (def->preserve)
|
||||
{
|
||||
if (def->preserve) {
|
||||
type->preserve = uTypedCalloc(darray_size(type->map), struct xkb_mods);
|
||||
if (!type->preserve)
|
||||
{
|
||||
if (!type->preserve) {
|
||||
WARN("Couldn't allocate preserve array in CopyDefToKeyType\n");
|
||||
ACTION("Preserve setting for type %s lost\n",
|
||||
xkb_atom_text(keymap->ctx, def->name));
|
||||
xkb_atom_text(keymap->ctx, def->name));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
pre = def->preserve;
|
||||
for (; pre != NULL; pre = (PreserveInfo *) pre->defs.next)
|
||||
{
|
||||
for (; pre != NULL; pre = (PreserveInfo *) pre->defs.next) {
|
||||
int ndx = pre->matchingMapIndex;
|
||||
type->preserve[ndx].mask = pre->preMods;
|
||||
type->preserve[ndx].real_mods = pre->preMods;
|
||||
|
@ -1078,30 +1008,30 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
|||
return ComputeEffectiveMap(keymap, type);
|
||||
}
|
||||
|
||||
static struct xkb_kt_map_entry map2Level[]= {
|
||||
static struct xkb_kt_map_entry map2Level[] = {
|
||||
{
|
||||
.level = ShiftMask,
|
||||
.mods = {.mask = 1, .vmods = ShiftMask, .real_mods = 0 }
|
||||
.mods = { .mask = 1, .vmods = ShiftMask, .real_mods = 0 }
|
||||
}
|
||||
};
|
||||
|
||||
static struct xkb_kt_map_entry mapAlpha[]= {
|
||||
static struct xkb_kt_map_entry mapAlpha[] = {
|
||||
{
|
||||
.level = ShiftMask,
|
||||
.mods = { .mask = 1, .vmods = ShiftMask, .real_mods = 0 }
|
||||
},
|
||||
{
|
||||
.level = LockMask,
|
||||
.mods = { .mask = 0, .vmods = LockMask, .real_mods = 0 }
|
||||
.mods = { .mask = 0, .vmods = LockMask, .real_mods = 0 }
|
||||
}
|
||||
};
|
||||
|
||||
static struct xkb_mods preAlpha[]= {
|
||||
{ .mask = 0, .vmods = 0, .real_mods = 0 },
|
||||
static struct xkb_mods preAlpha[] = {
|
||||
{ .mask = 0, .vmods = 0, .real_mods = 0 },
|
||||
{ .mask = LockMask, .vmods = LockMask, .real_mods = 0 }
|
||||
};
|
||||
|
||||
static struct xkb_kt_map_entry mapKeypad[]= {
|
||||
static struct xkb_kt_map_entry mapKeypad[] = {
|
||||
{
|
||||
.level = ShiftMask,
|
||||
.mods = { .mask = 1, .vmods = ShiftMask, .real_mods = 0 }
|
||||
|
@ -1130,8 +1060,8 @@ static const struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
|
|||
},
|
||||
{
|
||||
.mods = {
|
||||
.mask = ShiftMask|LockMask,
|
||||
.vmods = ShiftMask|LockMask,
|
||||
.mask = ShiftMask | LockMask,
|
||||
.vmods = ShiftMask | LockMask,
|
||||
.real_mods = 0
|
||||
},
|
||||
.num_levels = 2,
|
||||
|
@ -1151,7 +1081,8 @@ static const struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
|
|||
};
|
||||
|
||||
static int
|
||||
InitCanonicalKeyTypes(struct xkb_keymap *keymap, unsigned which, int keypadVMod)
|
||||
InitCanonicalKeyTypes(struct xkb_keymap *keymap, unsigned which,
|
||||
int keypadVMod)
|
||||
{
|
||||
struct xkb_client_map *map;
|
||||
const struct xkb_key_type *from;
|
||||
|
@ -1210,7 +1141,8 @@ InitCanonicalKeyTypes(struct xkb_keymap *keymap, unsigned which, int keypadVMod)
|
|||
}
|
||||
|
||||
bool
|
||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge)
|
||||
{
|
||||
unsigned int i;
|
||||
struct xkb_key_type *type, *next;
|
||||
|
@ -1290,7 +1222,7 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
|||
if (!CopyDefToKeyType(keymap, type, def))
|
||||
goto err_info;
|
||||
|
||||
def = (KeyTypeInfo *)def->defs.next;
|
||||
def = (KeyTypeInfo *) def->defs.next;
|
||||
}
|
||||
|
||||
FreeKeyTypesInfo(&info);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "xkbcomp-priv.h"
|
||||
|
@ -54,16 +54,13 @@ ProcessIncludeFile(struct xkb_context *ctx,
|
|||
XkbFile *rtrn, *mapToUse, *next;
|
||||
|
||||
file = XkbFindFileInPath(ctx, stmt->file, file_type, &stmt->path);
|
||||
if (file == NULL)
|
||||
{
|
||||
if (file == NULL) {
|
||||
ERROR("Can't find file \"%s\" for %s include\n", stmt->file,
|
||||
XkbDirectoryForInclude(file_type));
|
||||
XkbDirectoryForInclude(file_type));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!XKBParseFile(ctx, file, stmt->file, &rtrn))
|
||||
{
|
||||
if (!XKBParseFile(ctx, file, stmt->file, &rtrn)) {
|
||||
ERROR("Error interpreting include file \"%s\"\n", stmt->file);
|
||||
fclose(file);
|
||||
return false;
|
||||
|
@ -71,41 +68,35 @@ ProcessIncludeFile(struct xkb_context *ctx,
|
|||
fclose(file);
|
||||
|
||||
mapToUse = rtrn;
|
||||
if (stmt->map != NULL)
|
||||
{
|
||||
if (stmt->map != NULL) {
|
||||
while (mapToUse)
|
||||
{
|
||||
next = (XkbFile *)mapToUse->common.next;
|
||||
next = (XkbFile *) mapToUse->common.next;
|
||||
mapToUse->common.next = NULL;
|
||||
if (strcmp(mapToUse->name, stmt->map) == 0 &&
|
||||
mapToUse->type == file_type)
|
||||
{
|
||||
FreeXKBFile(next);
|
||||
break;
|
||||
mapToUse->type == file_type) {
|
||||
FreeXKBFile(next);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FreeXKBFile(mapToUse);
|
||||
}
|
||||
mapToUse = next;
|
||||
}
|
||||
if (!mapToUse)
|
||||
{
|
||||
if (!mapToUse) {
|
||||
ERROR("No %s named \"%s\" in the include file \"%s\"\n",
|
||||
XkbcFileTypeText(file_type), stmt->map, stmt->file);
|
||||
XkbcFileTypeText(file_type), stmt->map, stmt->file);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ((rtrn->common.next != NULL) && (warningLevel > 5))
|
||||
{
|
||||
else if ((rtrn->common.next != NULL) && (warningLevel > 5)) {
|
||||
WARN("No map in include statement, but \"%s\" contains several\n",
|
||||
stmt->file);
|
||||
stmt->file);
|
||||
ACTION("Using first defined map, \"%s\"\n", rtrn->name);
|
||||
}
|
||||
if (mapToUse->type != file_type)
|
||||
{
|
||||
if (mapToUse->type != file_type) {
|
||||
ERROR("Include file wrong type (expected %s, got %s)\n",
|
||||
XkbcFileTypeText(file_type), XkbcFileTypeText(mapToUse->type));
|
||||
XkbcFileTypeText(file_type), XkbcFileTypeText(mapToUse->type));
|
||||
ACTION("Include file \"%s\" ignored\n", stmt->file);
|
||||
return false;
|
||||
}
|
||||
|
@ -160,13 +151,10 @@ UseNewField(unsigned field,
|
|||
bool useNew;
|
||||
|
||||
useNew = false;
|
||||
if (oldDefs->defined & field)
|
||||
{
|
||||
if (newDefs->defined & field)
|
||||
{
|
||||
if (oldDefs->defined & field) {
|
||||
if (newDefs->defined & field) {
|
||||
if (((oldDefs->file_id == newDefs->file_id)
|
||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
||||
{
|
||||
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||
*pCollide |= field;
|
||||
}
|
||||
if (newDefs->merge != MERGE_AUGMENT)
|
||||
|
@ -181,11 +169,9 @@ UseNewField(unsigned field,
|
|||
void *
|
||||
ClearCommonInfo(CommonInfo * cmn)
|
||||
{
|
||||
if (cmn != NULL)
|
||||
{
|
||||
if (cmn != NULL) {
|
||||
CommonInfo *this, *next;
|
||||
for (this = cmn; this != NULL; this = next)
|
||||
{
|
||||
for (this = cmn; this != NULL; this = next) {
|
||||
next = this->next;
|
||||
free(this);
|
||||
}
|
||||
|
@ -204,8 +190,7 @@ AddCommonInfo(CommonInfo * old, CommonInfo * new)
|
|||
old = old->next;
|
||||
}
|
||||
new->next = NULL;
|
||||
if (old)
|
||||
{
|
||||
if (old) {
|
||||
old->next = new;
|
||||
return first;
|
||||
}
|
||||
|
@ -234,56 +219,44 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
|||
{
|
||||
unsigned n;
|
||||
|
||||
if (start_from < keymap->min_key_code)
|
||||
{
|
||||
if (start_from < keymap->min_key_code) {
|
||||
start_from = keymap->min_key_code;
|
||||
}
|
||||
else if (start_from > keymap->max_key_code)
|
||||
{
|
||||
else if (start_from > keymap->max_key_code) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*kc_rtrn = 0; /* some callers rely on this */
|
||||
if (keymap && keymap->names && !darray_empty(keymap->names->keys))
|
||||
{
|
||||
for (n = start_from; n <= keymap->max_key_code; n++)
|
||||
{
|
||||
if (keymap && keymap->names && !darray_empty(keymap->names->keys)) {
|
||||
for (n = start_from; n <= keymap->max_key_code; n++) {
|
||||
unsigned long tmp;
|
||||
tmp = KeyNameToLong(darray_item(keymap->names->keys, n).name);
|
||||
if (tmp == name)
|
||||
{
|
||||
if (tmp == name) {
|
||||
*kc_rtrn = n;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (use_aliases)
|
||||
{
|
||||
if (use_aliases) {
|
||||
unsigned long new_name;
|
||||
if (FindKeyNameForAlias(keymap, name, &new_name))
|
||||
return FindNamedKey(keymap, new_name, kc_rtrn, false,
|
||||
create, 0);
|
||||
}
|
||||
}
|
||||
if (create)
|
||||
{
|
||||
if ((!keymap->names) || darray_empty(keymap->names->keys))
|
||||
{
|
||||
if (XkbcAllocNames(keymap, XkbKeyNamesMask, 0) != Success)
|
||||
{
|
||||
if (warningLevel > 0)
|
||||
{
|
||||
if (create) {
|
||||
if ((!keymap->names) || darray_empty(keymap->names->keys)) {
|
||||
if (XkbcAllocNames(keymap, XkbKeyNamesMask, 0) != Success) {
|
||||
if (warningLevel > 0) {
|
||||
WARN("Couldn't allocate key names in FindNamedKey\n");
|
||||
ACTION("Key \"%s\" not automatically created\n",
|
||||
longText(name));
|
||||
longText(name));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/* Find first unused keycode and store our key here */
|
||||
for (n = keymap->min_key_code; n <= keymap->max_key_code; n++)
|
||||
{
|
||||
if (darray_item(keymap->names->keys, n).name[0] == '\0')
|
||||
{
|
||||
for (n = keymap->min_key_code; n <= keymap->max_key_code; n++) {
|
||||
if (darray_item(keymap->names->keys, n).name[0] == '\0') {
|
||||
char buf[XkbKeyNameLength + 1];
|
||||
LongToKeyName(name, buf);
|
||||
memcpy(darray_item(keymap->names->keys, n).name, buf,
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "parseutils.h"
|
||||
|
@ -38,8 +38,7 @@ AppendStmt(ParseCommon * to, ParseCommon * append)
|
|||
{
|
||||
to = to->next;
|
||||
}
|
||||
if (to)
|
||||
{
|
||||
if (to) {
|
||||
to->next = append;
|
||||
return start;
|
||||
}
|
||||
|
@ -51,15 +50,13 @@ ExprCreate(unsigned op, unsigned type)
|
|||
{
|
||||
ExprDef *expr;
|
||||
expr = uTypedAlloc(ExprDef);
|
||||
if (expr)
|
||||
{
|
||||
if (expr) {
|
||||
expr->common.stmtType = StmtExpr;
|
||||
expr->common.next = NULL;
|
||||
expr->op = op;
|
||||
expr->type = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate expression in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -71,16 +68,14 @@ ExprCreateUnary(unsigned op, unsigned type, ExprDef * child)
|
|||
{
|
||||
ExprDef *expr;
|
||||
expr = uTypedAlloc(ExprDef);
|
||||
if (expr)
|
||||
{
|
||||
if (expr) {
|
||||
expr->common.stmtType = StmtExpr;
|
||||
expr->common.next = NULL;
|
||||
expr->op = op;
|
||||
expr->type = type;
|
||||
expr->value.child = child;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate expression in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -92,8 +87,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
|
|||
{
|
||||
ExprDef *expr;
|
||||
expr = uTypedAlloc(ExprDef);
|
||||
if (expr)
|
||||
{
|
||||
if (expr) {
|
||||
expr->common.stmtType = StmtExpr;
|
||||
expr->common.next = NULL;
|
||||
expr->op = op;
|
||||
|
@ -106,8 +100,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
|
|||
expr->value.binary.left = left;
|
||||
expr->value.binary.right = right;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate expression in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -120,16 +113,14 @@ KeycodeCreate(const char *name, unsigned long value)
|
|||
KeycodeDef *def;
|
||||
|
||||
def = uTypedAlloc(KeycodeDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtKeycodeDef;
|
||||
def->common.next = NULL;
|
||||
strncpy(def->name, name, XkbKeyNameLength);
|
||||
def->name[XkbKeyNameLength] = '\0';
|
||||
def->value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate key name definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -142,8 +133,7 @@ KeyAliasCreate(const char *alias, const char *real)
|
|||
KeyAliasDef *def;
|
||||
|
||||
def = uTypedAlloc(KeyAliasDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtKeyAliasDef;
|
||||
def->common.next = NULL;
|
||||
strncpy(def->alias, alias, XkbKeyNameLength);
|
||||
|
@ -151,8 +141,7 @@ KeyAliasCreate(const char *alias, const char *real)
|
|||
strncpy(def->real, real, XkbKeyNameLength);
|
||||
def->real[XkbKeyNameLength] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate key alias definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -164,15 +153,13 @@ VModCreate(xkb_atom_t name, ExprDef * value)
|
|||
{
|
||||
VModDef *def;
|
||||
def = uTypedAlloc(VModDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtVModDef;
|
||||
def->common.next = NULL;
|
||||
def->name = name;
|
||||
def->value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate variable definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -184,15 +171,13 @@ VarCreate(ExprDef * name, ExprDef * value)
|
|||
{
|
||||
VarDef *def;
|
||||
def = uTypedAlloc(VarDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtVarDef;
|
||||
def->common.next = NULL;
|
||||
def->name = name;
|
||||
def->value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate variable definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -217,15 +202,13 @@ InterpCreate(char *sym, ExprDef * match)
|
|||
InterpDef *def;
|
||||
|
||||
def = uTypedAlloc(InterpDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtInterpDef;
|
||||
def->common.next = NULL;
|
||||
def->sym = sym;
|
||||
def->match = match;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate interp definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -238,16 +221,14 @@ KeyTypeCreate(xkb_atom_t name, VarDef * body)
|
|||
KeyTypeDef *def;
|
||||
|
||||
def = uTypedAlloc(KeyTypeDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtKeyTypeDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->name = name;
|
||||
def->body = body;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate key type definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -260,8 +241,7 @@ SymbolsCreate(const char *keyName, ExprDef *symbols)
|
|||
SymbolsDef *def;
|
||||
|
||||
def = uTypedAlloc(SymbolsDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtSymbolsDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
|
@ -269,8 +249,7 @@ SymbolsCreate(const char *keyName, ExprDef *symbols)
|
|||
strncpy(def->keyName, keyName, 4);
|
||||
def->symbols = symbols;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate symbols definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -283,16 +262,14 @@ GroupCompatCreate(int group, ExprDef * val)
|
|||
GroupCompatDef *def;
|
||||
|
||||
def = uTypedAlloc(GroupCompatDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtGroupCompatDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->group = group;
|
||||
def->def = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate group compat definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -305,16 +282,14 @@ ModMapCreate(uint32_t modifier, ExprDef * keys)
|
|||
ModMapDef *def;
|
||||
|
||||
def = uTypedAlloc(ModMapDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtModMapDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->modifier = modifier;
|
||||
def->keys = keys;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate mod mask definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -327,16 +302,14 @@ IndicatorMapCreate(xkb_atom_t name, VarDef * body)
|
|||
IndicatorMapDef *def;
|
||||
|
||||
def = uTypedAlloc(IndicatorMapDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtIndicatorMapDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
def->name = name;
|
||||
def->body = body;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate indicator map definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -349,8 +322,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
|
|||
IndicatorNameDef *def;
|
||||
|
||||
def = uTypedAlloc(IndicatorNameDef);
|
||||
if (def)
|
||||
{
|
||||
if (def) {
|
||||
def->common.stmtType = StmtIndicatorNameDef;
|
||||
def->common.next = NULL;
|
||||
def->merge = MERGE_DEFAULT;
|
||||
|
@ -358,8 +330,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
|
|||
def->name = name;
|
||||
def->virtual = virtual;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FATAL("Couldn't allocate indicator index definition in parser\n");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -372,8 +343,7 @@ ActionCreate(xkb_atom_t name, ExprDef * args)
|
|||
ExprDef *act;
|
||||
|
||||
act = uTypedAlloc(ExprDef);
|
||||
if (act)
|
||||
{
|
||||
if (act) {
|
||||
act->common.stmtType = StmtExpr;
|
||||
act->common.next = NULL;
|
||||
act->op = ExprActionDecl;
|
||||
|
@ -391,8 +361,7 @@ CreateKeysymList(char *sym)
|
|||
ExprDef *def;
|
||||
|
||||
def = ExprCreate(ExprKeysymList, TypeSymbols);
|
||||
if (!def)
|
||||
{
|
||||
if (!def) {
|
||||
FATAL("Couldn't allocate expression for keysym list in parser\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -457,20 +426,17 @@ LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn)
|
|||
xkb_keysym_t sym;
|
||||
|
||||
if ((!str) || (strcasecmp(str, "any") == 0) ||
|
||||
(strcasecmp(str, "nosymbol") == 0))
|
||||
{
|
||||
(strcasecmp(str, "nosymbol") == 0)) {
|
||||
*sym_rtrn = XKB_KEY_NoSymbol;
|
||||
return 1;
|
||||
}
|
||||
else if ((strcasecmp(str, "none") == 0) ||
|
||||
(strcasecmp(str, "voidsymbol") == 0))
|
||||
{
|
||||
(strcasecmp(str, "voidsymbol") == 0)) {
|
||||
*sym_rtrn = XKB_KEY_VoidSymbol;
|
||||
return 1;
|
||||
}
|
||||
sym = xkb_keysym_from_name(str);
|
||||
if (sym != XKB_KEY_NoSymbol)
|
||||
{
|
||||
if (sym != XKB_KEY_NoSymbol) {
|
||||
*sym_rtrn = sym;
|
||||
return 1;
|
||||
}
|
||||
|
@ -495,23 +461,19 @@ IncludeCreate(char *str, enum merge_mode merge)
|
|||
stmt = uDupString(str);
|
||||
while ((tmp) && (*tmp))
|
||||
{
|
||||
if (XkbParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data))
|
||||
{
|
||||
if ((file == NULL) && (map == NULL))
|
||||
{
|
||||
if (XkbParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data)) {
|
||||
if ((file == NULL) && (map == NULL)) {
|
||||
if (haveSelf)
|
||||
goto BAIL;
|
||||
haveSelf = true;
|
||||
}
|
||||
if (first == NULL)
|
||||
first = incl = uTypedAlloc(IncludeStmt);
|
||||
else
|
||||
{
|
||||
else {
|
||||
incl->next = uTypedAlloc(IncludeStmt);
|
||||
incl = incl->next;
|
||||
}
|
||||
if (incl)
|
||||
{
|
||||
if (incl) {
|
||||
incl->common.stmtType = StmtInclude;
|
||||
incl->common.next = NULL;
|
||||
incl->merge = merge;
|
||||
|
@ -522,8 +484,7 @@ IncludeCreate(char *str, enum merge_mode merge)
|
|||
incl->path = NULL;
|
||||
incl->next = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
WSGO("Allocation failure in IncludeCreate\n");
|
||||
ACTION("Using only part of the include\n");
|
||||
break;
|
||||
|
@ -533,8 +494,7 @@ IncludeCreate(char *str, enum merge_mode merge)
|
|||
else
|
||||
merge = MERGE_OVERRIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
goto BAIL;
|
||||
}
|
||||
}
|
||||
|
@ -559,21 +519,17 @@ CheckDefaultMap(XkbFile * maps, const char *fileName)
|
|||
|
||||
dflt = NULL;
|
||||
for (tmp = maps, dflt = NULL; tmp != NULL;
|
||||
tmp = (XkbFile *) tmp->common.next)
|
||||
{
|
||||
if (tmp->flags & XkbLC_Default)
|
||||
{
|
||||
tmp = (XkbFile *) tmp->common.next) {
|
||||
if (tmp->flags & XkbLC_Default) {
|
||||
if (dflt == NULL)
|
||||
dflt = tmp;
|
||||
else
|
||||
{
|
||||
if (warningLevel > 2)
|
||||
{
|
||||
else {
|
||||
if (warningLevel > 2) {
|
||||
WARN("Multiple default components in %s\n",
|
||||
(fileName ? fileName : "(unknown)"));
|
||||
(fileName ? fileName : "(unknown)"));
|
||||
ACTION("Using %s, ignoring %s\n",
|
||||
(dflt->name ? dflt->name : "(first)"),
|
||||
(tmp->name ? tmp->name : "(subsequent)"));
|
||||
(dflt->name ? dflt->name : "(first)"),
|
||||
(tmp->name ? tmp->name : "(subsequent)"));
|
||||
}
|
||||
tmp->flags &= (~XkbLC_Default);
|
||||
}
|
||||
|
@ -598,9 +554,9 @@ EnsureSafeMapName(char *name)
|
|||
if (!name)
|
||||
return;
|
||||
|
||||
while (*name!='\0') {
|
||||
while (*name != '\0') {
|
||||
if ((componentSpecLegal[(*name) / 8] & (1 << ((*name) % 8))) == 0)
|
||||
*name= '_';
|
||||
*name = '_';
|
||||
name++;
|
||||
}
|
||||
}
|
||||
|
@ -612,8 +568,7 @@ CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
|||
XkbFile *file;
|
||||
|
||||
file = uTypedAlloc(XkbFile);
|
||||
if (file)
|
||||
{
|
||||
if (file) {
|
||||
EnsureSafeMapName(name);
|
||||
memset(file, 0, sizeof(XkbFile));
|
||||
file->type = type;
|
||||
|
@ -634,8 +589,7 @@ FreeExpr(ExprDef *expr)
|
|||
if (!expr)
|
||||
return;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case ExprActionList:
|
||||
case OpNegate:
|
||||
case OpUnaryPlus:
|
||||
|
@ -643,6 +597,7 @@ FreeExpr(ExprDef *expr)
|
|||
case OpInvert:
|
||||
FreeStmt(&expr->value.child->common);
|
||||
break;
|
||||
|
||||
case OpDivide:
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
|
@ -651,19 +606,23 @@ FreeExpr(ExprDef *expr)
|
|||
FreeStmt(&expr->value.binary.left->common);
|
||||
FreeStmt(&expr->value.binary.right->common);
|
||||
break;
|
||||
|
||||
case ExprActionDecl:
|
||||
FreeStmt(&expr->value.action.args->common);
|
||||
break;
|
||||
|
||||
case ExprArrayRef:
|
||||
FreeStmt(&expr->value.array.entry->common);
|
||||
break;
|
||||
|
||||
case ExprKeysymList:
|
||||
darray_foreach(sym, expr->value.list.syms)
|
||||
free(*sym);
|
||||
free(*sym);
|
||||
darray_free(expr->value.list.syms);
|
||||
darray_free(expr->value.list.symsMapIndex);
|
||||
darray_free(expr->value.list.symsNumEntries);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -700,10 +659,9 @@ FreeStmt(ParseCommon *stmt)
|
|||
next = stmt->next;
|
||||
u.any = stmt;
|
||||
|
||||
switch (stmt->stmtType)
|
||||
{
|
||||
switch (stmt->stmtType) {
|
||||
case StmtInclude:
|
||||
FreeInclude((IncludeStmt *)stmt);
|
||||
FreeInclude((IncludeStmt *) stmt);
|
||||
/* stmt is already free'd here. */
|
||||
stmt = NULL;
|
||||
break;
|
||||
|
@ -756,13 +714,13 @@ FreeXKBFile(XkbFile *file)
|
|||
|
||||
while (file)
|
||||
{
|
||||
next = (XkbFile *)file->common.next;
|
||||
next = (XkbFile *) file->common.next;
|
||||
|
||||
switch (file->type)
|
||||
{
|
||||
switch (file->type) {
|
||||
case FILE_TYPE_KEYMAP:
|
||||
FreeXKBFile((XkbFile *)file->defs);
|
||||
FreeXKBFile((XkbFile *) file->defs);
|
||||
break;
|
||||
|
||||
case FILE_TYPE_TYPES:
|
||||
case FILE_TYPE_COMPAT:
|
||||
case FILE_TYPE_SYMBOLS:
|
||||
|
@ -770,6 +728,7 @@ FreeXKBFile(XkbFile *file)
|
|||
case FILE_TYPE_GEOMETRY:
|
||||
FreeStmt(file->defs);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef PARSEUTILS_H
|
||||
|
@ -118,15 +118,17 @@ CheckDefaultMap(XkbFile *maps, const char *fileName);
|
|||
|
||||
extern XkbFile *
|
||||
CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
||||
ParseCommon *defs, unsigned flags);
|
||||
ParseCommon *defs,
|
||||
unsigned flags);
|
||||
|
||||
extern bool
|
||||
XKBParseFile(struct xkb_context *ctx, FILE *file,
|
||||
const char *file_name, XkbFile **out);
|
||||
XKBParseFile(struct xkb_context *ctx, FILE *file, const char *file_name,
|
||||
XkbFile **out);
|
||||
|
||||
extern bool
|
||||
XKBParseString(struct xkb_context *context, const char *string,
|
||||
const char *file_name, XkbFile **out);
|
||||
const char *file_name,
|
||||
XkbFile **out);
|
||||
|
||||
extern void
|
||||
FreeXKBFile(XkbFile *file);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
|
@ -62,63 +62,52 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
|||
char *tmp, *str, *next;
|
||||
|
||||
str = *str_inout;
|
||||
if ((*str == '+') || (*str == '|'))
|
||||
{
|
||||
if ((*str == '+') || (*str == '|')) {
|
||||
*file_rtrn = *map_rtrn = NULL;
|
||||
*nextop_rtrn = *str;
|
||||
next = str + 1;
|
||||
}
|
||||
else if (*str == '%')
|
||||
{
|
||||
else if (*str == '%') {
|
||||
*file_rtrn = *map_rtrn = NULL;
|
||||
*nextop_rtrn = str[1];
|
||||
next = str + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* search for tokens inside the string */
|
||||
next = strpbrk(str, "|+");
|
||||
if (next)
|
||||
{
|
||||
if (next) {
|
||||
/* set nextop_rtrn to \0, next to next character */
|
||||
*nextop_rtrn = *next;
|
||||
*next++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*nextop_rtrn = '\0';
|
||||
next = NULL;
|
||||
}
|
||||
/* search for :, store result in extra_data */
|
||||
tmp = strchr(str, ':');
|
||||
if (tmp != NULL)
|
||||
{
|
||||
if (tmp != NULL) {
|
||||
*tmp++ = '\0';
|
||||
*extra_data = uDupString(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*extra_data = NULL;
|
||||
}
|
||||
tmp = strchr(str, '(');
|
||||
if (tmp == NULL)
|
||||
{
|
||||
if (tmp == NULL) {
|
||||
*file_rtrn = uDupString(str);
|
||||
*map_rtrn = NULL;
|
||||
}
|
||||
else if (str[0] == '(')
|
||||
{
|
||||
else if (str[0] == '(') {
|
||||
free(*extra_data);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*tmp++ = '\0';
|
||||
*file_rtrn = uDupString(str);
|
||||
str = tmp;
|
||||
tmp = strchr(str, ')');
|
||||
if ((tmp == NULL) || (tmp[1] != '\0'))
|
||||
{
|
||||
if ((tmp == NULL) || (tmp[1] != '\0')) {
|
||||
free(*file_rtrn);
|
||||
free(*extra_data);
|
||||
return false;
|
||||
|
@ -144,22 +133,28 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
|||
const char *
|
||||
XkbDirectoryForInclude(enum xkb_file_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case FILE_TYPE_KEYMAP:
|
||||
return "keymap";
|
||||
|
||||
case FILE_TYPE_KEYCODES:
|
||||
return "keycodes";
|
||||
|
||||
case FILE_TYPE_TYPES:
|
||||
return "types";
|
||||
|
||||
case FILE_TYPE_SYMBOLS:
|
||||
return "symbols";
|
||||
|
||||
case FILE_TYPE_COMPAT:
|
||||
return "compat";
|
||||
|
||||
case FILE_TYPE_GEOMETRY:
|
||||
return "geometry";
|
||||
|
||||
case FILE_TYPE_RULES:
|
||||
return "rules";
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
@ -189,12 +184,10 @@ XkbFindFileInPath(struct xkb_context *ctx,
|
|||
const char *typeDir;
|
||||
|
||||
typeDir = XkbDirectoryForInclude(type);
|
||||
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
|
||||
{
|
||||
for (i = 0; i < xkb_context_num_include_paths(ctx); i++) {
|
||||
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||
xkb_context_include_path_get(ctx, i), typeDir, name);
|
||||
if (ret >= (ssize_t)sizeof(buf))
|
||||
{
|
||||
if (ret >= (ssize_t) sizeof(buf)) {
|
||||
ERROR("File name (%s/%s/%s) too long\n",
|
||||
xkb_context_include_path_get(ctx, i), typeDir, name);
|
||||
ACTION("Ignored\n");
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef XKBCOMP_PATH_H
|
||||
|
@ -33,13 +33,14 @@
|
|||
|
||||
bool
|
||||
XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
||||
char *nextop_rtrn, char **extra_data);
|
||||
char *nextop_rtrn,
|
||||
char **extra_data);
|
||||
|
||||
const char *
|
||||
XkbDirectoryForInclude(unsigned type);
|
||||
|
||||
FILE *
|
||||
XkbFindFileInPath(struct xkb_context *ctx,
|
||||
const char *name, unsigned type, char **pathRtrn);
|
||||
XkbFindFileInPath(struct xkb_context *ctx, const char *name, unsigned type,
|
||||
char **pathRtrn);
|
||||
|
||||
#endif /* XKBCOMP_PATH_H */
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -192,9 +192,9 @@ struct group {
|
|||
|
||||
enum rule_flag {
|
||||
RULE_FLAG_PENDING_MATCH = (1L << 1),
|
||||
RULE_FLAG_OPTION = (1L << 2),
|
||||
RULE_FLAG_APPEND = (1L << 3),
|
||||
RULE_FLAG_NORMAL = (1L << 4),
|
||||
RULE_FLAG_OPTION = (1L << 2),
|
||||
RULE_FLAG_APPEND = (1L << 3),
|
||||
RULE_FLAG_NORMAL = (1L << 4),
|
||||
};
|
||||
|
||||
struct rule {
|
||||
|
@ -236,9 +236,11 @@ get_index(char *str, int *ndx)
|
|||
if (consumed > 0) {
|
||||
*ndx = num;
|
||||
str += consumed;
|
||||
} else if (empty > 0) {
|
||||
}
|
||||
else if (empty > 0) {
|
||||
*ndx = -1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*ndx = 0;
|
||||
}
|
||||
|
||||
|
@ -299,10 +301,12 @@ match_mapping_line(darray_char *line, struct mapping *mapping)
|
|||
|
||||
if (ndx < 1 || ndx > XkbNumKbdGroups) {
|
||||
WARN("Illegal %s index: %d\n", cname[i], ndx);
|
||||
WARN("Index must be in range 1..%d\n", XkbNumKbdGroups);
|
||||
WARN("Index must be in range 1..%d\n",
|
||||
XkbNumKbdGroups);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ndx = 0;
|
||||
}
|
||||
|
||||
|
@ -412,7 +416,8 @@ match_rule_line(darray_char *line, struct mapping *mapping,
|
|||
|
||||
str = darray_mem(*line, 0);
|
||||
|
||||
for (nread = 0; (tok = strtok_r(str, " ", &strtok_buf)) != NULL; nread++) {
|
||||
for (nread = 0; (tok = strtok_r(str, " ", &strtok_buf)) != NULL;
|
||||
nread++) {
|
||||
str = NULL;
|
||||
|
||||
if (strcmp(tok, "=") == 0) {
|
||||
|
@ -488,15 +493,15 @@ match_line(darray_char *line, struct mapping *mapping,
|
|||
static void
|
||||
squeeze_spaces(char *p1)
|
||||
{
|
||||
char *p2;
|
||||
char *p2;
|
||||
|
||||
for (p2 = p1; *p2; p2++) {
|
||||
*p1 = *p2;
|
||||
if (*p1 != ' ')
|
||||
p1++;
|
||||
}
|
||||
for (p2 = p1; *p2; p2++) {
|
||||
*p1 = *p2;
|
||||
if (*p1 != ' ')
|
||||
p1++;
|
||||
}
|
||||
|
||||
*p1 = '\0';
|
||||
*p1 = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -577,7 +582,8 @@ make_multi_defs(struct multi_defs *mdefs, const struct xkb_rule_names *mlvo)
|
|||
if ((p = strchr(p, ','))) {
|
||||
*p++ = '\0';
|
||||
mdefs->variant[i] = p;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -654,26 +660,26 @@ static bool
|
|||
match_group_member(struct rules *rules, const char *group_name,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
const char *word;
|
||||
struct group *iter, *group = NULL;
|
||||
int i;
|
||||
const char *word;
|
||||
struct group *iter, *group = NULL;
|
||||
|
||||
darray_foreach(iter, rules->groups) {
|
||||
if (strcmp(iter->name, group_name) == 0) {
|
||||
group = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
darray_foreach(iter, rules->groups) {
|
||||
if (strcmp(iter->name, group_name) == 0) {
|
||||
group = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group)
|
||||
return false;
|
||||
if (!group)
|
||||
return false;
|
||||
|
||||
word = group->words;
|
||||
for (i = 0; i < group->number; i++, word += strlen(word) + 1)
|
||||
if (strcmp(word, name) == 0)
|
||||
return true;
|
||||
word = group->words;
|
||||
for (i = 0; i < group->number; i++, word += strlen(word) + 1)
|
||||
if (strcmp(word, name) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Match @needle out of @sep-seperated @haystack. */
|
||||
|
@ -733,7 +739,7 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
|
|||
else if (rule->layout[0] == '$') {
|
||||
if (!match_group_member(rules, rule->layout,
|
||||
mdefs->layout[rule->layout_num]))
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(rule->layout,
|
||||
mdefs->layout[rule->layout_num]) != 0) {
|
||||
|
@ -747,7 +753,8 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
|
|||
|
||||
if (strcmp(rule->variant, "*") == 0) {
|
||||
pending = true;
|
||||
} else if (rule->variant[0] == '$') {
|
||||
}
|
||||
else if (rule->variant[0] == '$') {
|
||||
if (!match_group_member(rules, rule->variant,
|
||||
mdefs->variant[rule->variant_num]))
|
||||
return 0;
|
||||
|
@ -760,7 +767,8 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
|
|||
|
||||
if (pending) {
|
||||
rule->flags |= RULE_FLAG_PENDING_MATCH;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Exact match, apply it now. */
|
||||
apply_rule(rule, kccgst);
|
||||
}
|
||||
|
@ -774,7 +782,7 @@ clear_partial_matches(struct rules *rules)
|
|||
struct rule *rule;
|
||||
|
||||
darray_foreach(rule, rules->rules)
|
||||
rule->flags &= ~RULE_FLAG_PENDING_MATCH;
|
||||
rule->flags &= ~RULE_FLAG_PENDING_MATCH;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -783,8 +791,8 @@ apply_partial_matches(struct rules *rules, struct xkb_component_names *kccgst)
|
|||
struct rule *rule;
|
||||
|
||||
darray_foreach(rule, rules->rules)
|
||||
if (rule->flags & RULE_FLAG_PENDING_MATCH)
|
||||
apply_rule(rule, kccgst);
|
||||
if (rule->flags & RULE_FLAG_PENDING_MATCH)
|
||||
apply_rule(rule, kccgst);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -904,7 +912,8 @@ substitute_vars(char *name, struct multi_defs *mdefs)
|
|||
if (sfx)
|
||||
*outstr++ = sfx;
|
||||
}
|
||||
else if (*var == 'v' && mdefs->variant[ndx] && *mdefs->variant[ndx]) {
|
||||
else if (*var == 'v' && mdefs->variant[ndx] &&
|
||||
*mdefs->variant[ndx]) {
|
||||
if (pfx)
|
||||
*outstr++ = pfx;
|
||||
|
||||
|
@ -919,11 +928,11 @@ substitute_vars(char *name, struct multi_defs *mdefs)
|
|||
str++;
|
||||
}
|
||||
else {
|
||||
*outstr++= *str++;
|
||||
*outstr++ = *str++;
|
||||
}
|
||||
}
|
||||
|
||||
*outstr++= '\0';
|
||||
*outstr++ = '\0';
|
||||
|
||||
if (orig != name)
|
||||
free(orig);
|
||||
|
@ -959,8 +968,8 @@ get_components(struct rules *rules, const struct xkb_rule_names *mlvo,
|
|||
|
||||
free_multi_defs(&mdefs);
|
||||
|
||||
return
|
||||
kccgst->keycodes && kccgst->symbols && kccgst->types && kccgst->compat;
|
||||
return kccgst->keycodes && kccgst->symbols && kccgst->types &&
|
||||
kccgst->compat;
|
||||
}
|
||||
|
||||
static struct rules *
|
||||
|
@ -988,7 +997,8 @@ load_rules(FILE *file)
|
|||
if (tgroup.number) {
|
||||
darray_append(rules->groups, tgroup);
|
||||
memset(&tgroup, 0, sizeof(tgroup));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
darray_append(rules->rules, trule);
|
||||
memset(&trule, 0, sizeof(trule));
|
||||
}
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifndef RULES_H
|
||||
#define RULES_H
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#include "vmod.h"
|
||||
|
@ -47,11 +47,9 @@ ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap)
|
|||
return;
|
||||
|
||||
info->keymap = keymap;
|
||||
if (keymap && keymap->names)
|
||||
{
|
||||
if (keymap && keymap->names) {
|
||||
int bit;
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
||||
{
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
|
||||
if (keymap->names->vmods[i] != NULL)
|
||||
info->defined |= bit;
|
||||
}
|
||||
|
@ -69,7 +67,8 @@ ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap)
|
|||
* @param mergeMode Merge strategy (e.g. MERGE_OVERRIDE)
|
||||
*/
|
||||
bool
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMode,
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
|
||||
enum merge_mode mergeMode,
|
||||
VModInfo *info)
|
||||
{
|
||||
int i, bit, nextFree;
|
||||
|
@ -77,23 +76,20 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
|||
struct xkb_server_map *srv = keymap->server;
|
||||
struct xkb_names *names = keymap->names;
|
||||
|
||||
for (i = 0, bit = 1, nextFree = -1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
||||
{
|
||||
if (info->defined & bit)
|
||||
{
|
||||
for (i = 0, bit = 1, nextFree = -1; i < XkbNumVirtualMods; i++, bit <<=
|
||||
1) {
|
||||
if (info->defined & bit) {
|
||||
if (names->vmods[i] &&
|
||||
strcmp(names->vmods[i],
|
||||
xkb_atom_text(keymap->ctx, stmt->name)) == 0)
|
||||
{ /* already defined */
|
||||
xkb_atom_text(keymap->ctx, stmt->name)) == 0) { /* already defined */
|
||||
info->available |= bit;
|
||||
if (stmt->value == NULL)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
else {
|
||||
const char *str1;
|
||||
const char *str2 = "";
|
||||
if (!ExprResolveModMask(keymap->ctx, stmt->value, &mod))
|
||||
{
|
||||
if (!ExprResolveModMask(keymap->ctx, stmt->value,
|
||||
&mod)) {
|
||||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||
ACTION("Declaration of %s ignored\n", str1);
|
||||
return false;
|
||||
|
@ -104,8 +100,7 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
|||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||
WARN("Virtual modifier %s multiply defined\n", str1);
|
||||
str1 = XkbcModMaskText(srv->vmods[i], true);
|
||||
if (mergeMode == MERGE_OVERRIDE)
|
||||
{
|
||||
if (mergeMode == MERGE_OVERRIDE) {
|
||||
str2 = str1;
|
||||
str1 = XkbcModMaskText(mod.uval, true);
|
||||
}
|
||||
|
@ -119,10 +114,9 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
|||
else if (nextFree < 0)
|
||||
nextFree = i;
|
||||
}
|
||||
if (nextFree < 0)
|
||||
{
|
||||
if (nextFree < 0) {
|
||||
ERROR("Too many virtual modifiers defined (maximum %d)\n",
|
||||
XkbNumVirtualMods);
|
||||
XkbNumVirtualMods);
|
||||
return false;
|
||||
}
|
||||
info->defined |= (1 << nextFree);
|
||||
|
@ -131,12 +125,12 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
|||
names->vmods[nextFree] = xkb_atom_strdup(keymap->ctx, stmt->name);
|
||||
if (stmt->value == NULL)
|
||||
return true;
|
||||
if (ExprResolveModMask(keymap->ctx, stmt->value, &mod))
|
||||
{
|
||||
if (ExprResolveModMask(keymap->ctx, stmt->value, &mod)) {
|
||||
srv->vmods[nextFree] = mod.uval;
|
||||
return true;
|
||||
}
|
||||
ACTION("Declaration of %s ignored\n", xkb_atom_text(keymap->ctx, stmt->name));
|
||||
ACTION("Declaration of %s ignored\n",
|
||||
xkb_atom_text(keymap->ctx, stmt->name));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -158,8 +152,7 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
|||
int i;
|
||||
const char *name = xkb_atom_text(keymap->ctx, field);
|
||||
|
||||
if ((keymap == NULL) || (keymap->names == NULL) || (type != TypeInt))
|
||||
{
|
||||
if ((keymap == NULL) || (keymap->names == NULL) || (type != TypeInt)) {
|
||||
return false;
|
||||
}
|
||||
/* For each named modifier, get the name and compare it to the one passed
|
||||
|
@ -167,11 +160,9 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
|||
* The order of modifiers is the same as in the virtual_modifiers line in
|
||||
* the xkb_types section.
|
||||
*/
|
||||
for (i = 0; i < XkbNumVirtualMods; i++)
|
||||
{
|
||||
for (i = 0; i < XkbNumVirtualMods; i++) {
|
||||
if (keymap->names->vmods[i] &&
|
||||
strcmp(keymap->names->vmods[i], name) == 0)
|
||||
{
|
||||
strcmp(keymap->names->vmods[i], name) == 0) {
|
||||
val_rtrn->uval = i;
|
||||
return true;
|
||||
}
|
||||
|
@ -193,12 +184,10 @@ bool
|
|||
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||
unsigned type, ExprResult *val_rtrn)
|
||||
{
|
||||
if (LookupModMask(ctx, NULL, field, type, val_rtrn))
|
||||
{
|
||||
if (LookupModMask(ctx, NULL, field, type, val_rtrn)) {
|
||||
return true;
|
||||
}
|
||||
else if (LookupVModIndex(priv, field, type, val_rtrn))
|
||||
{
|
||||
else if (LookupVModIndex(priv, field, type, val_rtrn)) {
|
||||
unsigned ndx = val_rtrn->uval;
|
||||
val_rtrn->uval = (1 << (XkbNumModifiers + ndx));
|
||||
return true;
|
||||
|
@ -213,8 +202,7 @@ FindKeypadVMod(struct xkb_keymap *keymap)
|
|||
ExprResult rtrn;
|
||||
|
||||
name = xkb_atom_intern(keymap->ctx, "NumLock");
|
||||
if ((keymap) && LookupVModIndex(keymap, name, TypeInt, &rtrn))
|
||||
{
|
||||
if ((keymap) && LookupVModIndex(keymap, name, TypeInt, &rtrn)) {
|
||||
return rtrn.ival;
|
||||
}
|
||||
return -1;
|
||||
|
@ -226,26 +214,22 @@ ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
|||
{
|
||||
struct xkb_names *names = keymap->names;
|
||||
|
||||
if (def->op == ExprIdent)
|
||||
{
|
||||
if (def->op == ExprIdent) {
|
||||
int i, bit;
|
||||
const char *name = xkb_atom_text(keymap->ctx, def->value.str);
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
||||
{
|
||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
|
||||
if ((info->available & bit) && names->vmods[i] &&
|
||||
strcmp(names->vmods[i], name) == 0)
|
||||
{
|
||||
strcmp(names->vmods[i], name) == 0) {
|
||||
val_rtrn->uval = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ExprResolveInteger(keymap->ctx, def, val_rtrn))
|
||||
{
|
||||
if (ExprResolveInteger(keymap->ctx, def, val_rtrn)) {
|
||||
if (val_rtrn->uval < XkbNumVirtualMods)
|
||||
return true;
|
||||
ERROR("Illegal virtual modifier %d (must be 0..%d inclusive)\n",
|
||||
val_rtrn->uval, XkbNumVirtualMods - 1);
|
||||
val_rtrn->uval, XkbNumVirtualMods - 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef VMOD_H
|
||||
|
@ -30,8 +30,7 @@
|
|||
#include "xkbcomp-priv.h"
|
||||
#include "expr.h"
|
||||
|
||||
typedef struct _VModInfo
|
||||
{
|
||||
typedef struct _VModInfo {
|
||||
struct xkb_keymap *keymap;
|
||||
unsigned defined;
|
||||
unsigned available;
|
||||
|
@ -46,7 +45,8 @@ extern void
|
|||
ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap);
|
||||
|
||||
extern bool
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMode,
|
||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
|
||||
enum merge_mode mergeMode,
|
||||
VModInfo *info);
|
||||
|
||||
extern bool
|
||||
|
@ -57,6 +57,7 @@ FindKeypadVMod(struct xkb_keymap *keymap);
|
|||
|
||||
extern bool
|
||||
ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
||||
ExprResult *value_rtrn, VModInfo *info);
|
||||
ExprResult *value_rtrn,
|
||||
VModInfo *info);
|
||||
|
||||
#endif /* VMOD_H */
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef XKBCOMP_PRIV_H
|
||||
|
@ -32,8 +32,7 @@
|
|||
#include "text.h"
|
||||
#include "utils.h"
|
||||
|
||||
typedef struct _CommonInfo
|
||||
{
|
||||
typedef struct _CommonInfo {
|
||||
unsigned short defined;
|
||||
unsigned file_id;
|
||||
enum merge_mode merge;
|
||||
|
@ -48,7 +47,7 @@ extern void *
|
|||
ClearCommonInfo(CommonInfo *cmn);
|
||||
|
||||
extern void *
|
||||
AddCommonInfo(CommonInfo *old, CommonInfo *new);
|
||||
AddCommonInfo(CommonInfo * old, CommonInfo * new);
|
||||
|
||||
extern int
|
||||
ReportNotArray(const char *type, const char *field, const char *name);
|
||||
|
@ -64,9 +63,9 @@ extern int
|
|||
ReportBadField(const char *type, const char *field, const char *name);
|
||||
|
||||
extern bool
|
||||
ProcessIncludeFile(struct xkb_context *ctx,
|
||||
IncludeStmt *stmt, enum xkb_file_type file_type,
|
||||
XkbFile **file_rtrn, enum merge_mode *merge_rtrn);
|
||||
ProcessIncludeFile(struct xkb_context *ctx, IncludeStmt *stmt,
|
||||
enum xkb_file_type file_type, XkbFile **file_rtrn,
|
||||
enum merge_mode *merge_rtrn);
|
||||
|
||||
extern bool
|
||||
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include "xkbcomp-priv.h"
|
||||
#include "rules.h"
|
||||
|
@ -42,21 +42,21 @@ keymap_file_from_components(struct xkb_context *ctx,
|
|||
|
||||
inc = IncludeCreate(ktcsg->keycodes, MERGE_DEFAULT);
|
||||
keycodes = CreateXKBFile(ctx, FILE_TYPE_KEYCODES, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
(ParseCommon *) inc, 0);
|
||||
|
||||
inc = IncludeCreate(ktcsg->types, MERGE_DEFAULT);
|
||||
types = CreateXKBFile(ctx, FILE_TYPE_TYPES, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
(ParseCommon *) inc, 0);
|
||||
AppendStmt(&keycodes->common, &types->common);
|
||||
|
||||
inc = IncludeCreate(ktcsg->compat, MERGE_DEFAULT);
|
||||
compat = CreateXKBFile(ctx, FILE_TYPE_COMPAT, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
(ParseCommon *) inc, 0);
|
||||
AppendStmt(&keycodes->common, &compat->common);
|
||||
|
||||
inc = IncludeCreate(ktcsg->symbols, MERGE_DEFAULT);
|
||||
symbols = CreateXKBFile(ctx, FILE_TYPE_SYMBOLS, NULL,
|
||||
(ParseCommon *)inc, 0);
|
||||
(ParseCommon *) inc, 0);
|
||||
AppendStmt(&keycodes->common, &symbols->common);
|
||||
|
||||
return CreateXKBFile(ctx, FILE_TYPE_KEYMAP, strdup(""),
|
||||
|
@ -97,11 +97,11 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
|||
}
|
||||
|
||||
/* Check for duplicate entries in the input file */
|
||||
for (file = (XkbFile *)file->defs; file;
|
||||
file = (XkbFile *)file->common.next) {
|
||||
for (file = (XkbFile *) file->defs; file;
|
||||
file = (XkbFile *) file->common.next) {
|
||||
if (have & file->type) {
|
||||
ERROR("More than one %s section in a keymap file\n",
|
||||
XkbcFileTypeText(file->type));
|
||||
XkbcFileTypeText(file->type));
|
||||
ACTION("All sections after the first ignored\n");
|
||||
continue;
|
||||
}
|
||||
|
@ -110,18 +110,22 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
|||
case FILE_TYPE_KEYCODES:
|
||||
keycodes = file;
|
||||
break;
|
||||
|
||||
case FILE_TYPE_TYPES:
|
||||
types = file;
|
||||
break;
|
||||
|
||||
case FILE_TYPE_SYMBOLS:
|
||||
symbols = file;
|
||||
break;
|
||||
|
||||
case FILE_TYPE_COMPAT:
|
||||
compat = file;
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR("Cannot define %s in a keymap file\n",
|
||||
XkbcFileTypeText(file->type));
|
||||
XkbcFileTypeText(file->type));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,82 +1,81 @@
|
|||
/************************************************************
|
||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose and without
|
||||
fee is hereby granted, provided that the above copyright
|
||||
notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting
|
||||
documentation, and that the name of Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Silicon Graphics not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific prior written permission.
|
||||
* Silicon Graphics makes no representation about the suitability
|
||||
* of this software for any purpose. It is provided "as is"
|
||||
* without any express or implied warranty.
|
||||
*
|
||||
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
#ifndef XKBCOMP_H
|
||||
#define XKBCOMP_H 1
|
||||
#define XKBCOMP_H 1
|
||||
|
||||
#include "xkb-priv.h"
|
||||
|
||||
#define TypeUnknown 0
|
||||
#define TypeBoolean 1
|
||||
#define TypeInt 2
|
||||
#define TypeString 4
|
||||
#define TypeAction 5
|
||||
#define TypeKeyName 6
|
||||
#define TypeSymbols 7
|
||||
#define TypeUnknown 0
|
||||
#define TypeBoolean 1
|
||||
#define TypeInt 2
|
||||
#define TypeString 4
|
||||
#define TypeAction 5
|
||||
#define TypeKeyName 6
|
||||
#define TypeSymbols 7
|
||||
|
||||
#define StmtUnknown 0
|
||||
#define StmtInclude 1
|
||||
#define StmtKeycodeDef 2
|
||||
#define StmtKeyAliasDef 3
|
||||
#define StmtExpr 4
|
||||
#define StmtVarDef 5
|
||||
#define StmtKeyTypeDef 6
|
||||
#define StmtInterpDef 7
|
||||
#define StmtVModDef 8
|
||||
#define StmtSymbolsDef 9
|
||||
#define StmtModMapDef 10
|
||||
#define StmtGroupCompatDef 11
|
||||
#define StmtIndicatorMapDef 12
|
||||
#define StmtIndicatorNameDef 13
|
||||
#define StmtUnknown 0
|
||||
#define StmtInclude 1
|
||||
#define StmtKeycodeDef 2
|
||||
#define StmtKeyAliasDef 3
|
||||
#define StmtExpr 4
|
||||
#define StmtVarDef 5
|
||||
#define StmtKeyTypeDef 6
|
||||
#define StmtInterpDef 7
|
||||
#define StmtVModDef 8
|
||||
#define StmtSymbolsDef 9
|
||||
#define StmtModMapDef 10
|
||||
#define StmtGroupCompatDef 11
|
||||
#define StmtIndicatorMapDef 12
|
||||
#define StmtIndicatorNameDef 13
|
||||
|
||||
#define FileSymInterp 100
|
||||
#define FileSymInterp 100
|
||||
|
||||
typedef struct _ParseCommon
|
||||
{
|
||||
typedef struct _ParseCommon {
|
||||
unsigned stmtType;
|
||||
struct _ParseCommon *next;
|
||||
} ParseCommon;
|
||||
|
||||
#define ExprValue 0
|
||||
#define ExprIdent 1
|
||||
#define ExprActionDecl 2
|
||||
#define ExprFieldRef 3
|
||||
#define ExprArrayRef 4
|
||||
#define ExprKeysymList 5
|
||||
#define ExprActionList 6
|
||||
#define ExprValue 0
|
||||
#define ExprIdent 1
|
||||
#define ExprActionDecl 2
|
||||
#define ExprFieldRef 3
|
||||
#define ExprArrayRef 4
|
||||
#define ExprKeysymList 5
|
||||
#define ExprActionList 6
|
||||
|
||||
#define OpAdd 20
|
||||
#define OpSubtract 21
|
||||
#define OpMultiply 22
|
||||
#define OpDivide 23
|
||||
#define OpAssign 24
|
||||
#define OpNot 25
|
||||
#define OpNegate 26
|
||||
#define OpInvert 27
|
||||
#define OpUnaryPlus 28
|
||||
#define OpAdd 20
|
||||
#define OpSubtract 21
|
||||
#define OpMultiply 22
|
||||
#define OpDivide 23
|
||||
#define OpAssign 24
|
||||
#define OpNot 25
|
||||
#define OpNegate 26
|
||||
#define OpInvert 27
|
||||
#define OpUnaryPlus 28
|
||||
|
||||
enum merge_mode {
|
||||
MERGE_DEFAULT,
|
||||
|
@ -85,13 +84,12 @@ enum merge_mode {
|
|||
MERGE_REPLACE,
|
||||
};
|
||||
|
||||
#define AutoKeyNames (1L << 0)
|
||||
#define CreateKeyNames(x) ((x)->flags&AutoKeyNames)
|
||||
#define AutoKeyNames (1L << 0)
|
||||
#define CreateKeyNames(x) ((x)->flags & AutoKeyNames)
|
||||
|
||||
extern unsigned warningLevel;
|
||||
|
||||
typedef struct _IncludeStmt
|
||||
{
|
||||
typedef struct _IncludeStmt {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
char *stmt;
|
||||
|
@ -102,36 +100,29 @@ typedef struct _IncludeStmt
|
|||
struct _IncludeStmt *next;
|
||||
} IncludeStmt;
|
||||
|
||||
typedef struct _Expr
|
||||
{
|
||||
typedef struct _Expr {
|
||||
ParseCommon common;
|
||||
unsigned op;
|
||||
unsigned type;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
struct _Expr *left;
|
||||
struct _Expr *right;
|
||||
} binary;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
xkb_atom_t element;
|
||||
xkb_atom_t field;
|
||||
} field;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
xkb_atom_t element;
|
||||
xkb_atom_t field;
|
||||
struct _Expr *entry;
|
||||
} array;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
xkb_atom_t name;
|
||||
struct _Expr *args;
|
||||
} action;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
darray(char *) syms;
|
||||
darray(int) symsMapIndex;
|
||||
darray(unsigned int) symsNumEntries;
|
||||
|
@ -144,72 +135,63 @@ typedef struct _Expr
|
|||
} value;
|
||||
} ExprDef;
|
||||
|
||||
typedef struct _VarDef
|
||||
{
|
||||
typedef struct _VarDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
ExprDef *name;
|
||||
ExprDef *value;
|
||||
} VarDef;
|
||||
|
||||
typedef struct _VModDef
|
||||
{
|
||||
typedef struct _VModDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
xkb_atom_t name;
|
||||
ExprDef *value;
|
||||
} VModDef;
|
||||
|
||||
typedef struct _KeycodeDef
|
||||
{
|
||||
typedef struct _KeycodeDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
char name[5];
|
||||
unsigned long value;
|
||||
} KeycodeDef;
|
||||
|
||||
typedef struct _KeyAliasDef
|
||||
{
|
||||
typedef struct _KeyAliasDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
char alias[5];
|
||||
char real[5];
|
||||
} KeyAliasDef;
|
||||
|
||||
typedef struct _KeyTypeDef
|
||||
{
|
||||
typedef struct _KeyTypeDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
xkb_atom_t name;
|
||||
VarDef *body;
|
||||
} KeyTypeDef;
|
||||
|
||||
typedef struct _SymbolsDef
|
||||
{
|
||||
typedef struct _SymbolsDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
char keyName[5];
|
||||
ExprDef *symbols;
|
||||
} SymbolsDef;
|
||||
|
||||
typedef struct _ModMapDef
|
||||
{
|
||||
typedef struct _ModMapDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
xkb_atom_t modifier;
|
||||
ExprDef *keys;
|
||||
} ModMapDef;
|
||||
|
||||
typedef struct _GroupCompatDef
|
||||
{
|
||||
typedef struct _GroupCompatDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
int group;
|
||||
ExprDef *def;
|
||||
} GroupCompatDef;
|
||||
|
||||
typedef struct _InterpDef
|
||||
{
|
||||
typedef struct _InterpDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
char *sym;
|
||||
|
@ -217,8 +199,7 @@ typedef struct _InterpDef
|
|||
VarDef *def;
|
||||
} InterpDef;
|
||||
|
||||
typedef struct _IndicatorNameDef
|
||||
{
|
||||
typedef struct _IndicatorNameDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
int ndx;
|
||||
|
@ -226,8 +207,7 @@ typedef struct _IndicatorNameDef
|
|||
bool virtual;
|
||||
} IndicatorNameDef;
|
||||
|
||||
typedef struct _IndicatorMapDef
|
||||
{
|
||||
typedef struct _IndicatorMapDef {
|
||||
ParseCommon common;
|
||||
enum merge_mode merge;
|
||||
unsigned type;
|
||||
|
@ -235,8 +215,7 @@ typedef struct _IndicatorMapDef
|
|||
VarDef *body;
|
||||
} IndicatorMapDef;
|
||||
|
||||
typedef struct _XkbFile
|
||||
{
|
||||
typedef struct _XkbFile {
|
||||
ParseCommon common;
|
||||
enum xkb_file_type type;
|
||||
char *topName;
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
Copyright © 2012 Daniel Stone
|
||||
Copyright © 2012 Ran Benita
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
* Copyright © 2012 Daniel Stone
|
||||
* Copyright © 2012 Ran Benita
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
|
51
test/dump.c
51
test/dump.c
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -36,7 +36,8 @@ authorization from the authors.
|
|||
#include "xkbcommon/xkbcommon.h"
|
||||
#include "test.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct xkb_context *ctx = test_get_context();
|
||||
struct xkb_keymap *keymap;
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
* Copyright 2009 Dan Nicholson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/* Copyright 2009 Dan Nicholson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of the authors or their
|
||||
institutions shall not be used in advertising or otherwise to promote the
|
||||
sale, use or other dealings in this Software without prior written
|
||||
authorization from the authors.
|
||||
*/
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -42,5 +42,5 @@ test_compile_string(struct xkb_context *context, const char *string);
|
|||
|
||||
struct xkb_keymap *
|
||||
test_compile_rules(struct xkb_context *context, const char *rules,
|
||||
const char *model, const char *layout,
|
||||
const char *variant, const char *options);
|
||||
const char *model, const char *layout, const char *variant,
|
||||
const char *options);
|
||||
|
|
Loading…
Reference in New Issue