Use stdbool.h

'Cause defining your own True and False is so 1990's.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Fixed for xkb_desc -> xkb_keymap changes.]
master
Ran Benita 2012-04-06 03:38:55 +03:00 committed by Daniel Stone
parent a39ed85f56
commit a641a1859b
33 changed files with 736 additions and 737 deletions

View File

@ -79,6 +79,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef _XKBCOMMONINT_H_
#define _XKBCOMMONINT_H_
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
@ -86,13 +87,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkbcommon/xkbcommon.h"
#ifndef True
#define True 1
#define False 0
#endif
typedef int Bool;
/* From XKM.h */
#define XkmFileVersion 15

View File

@ -240,12 +240,12 @@ XkbcCopyKeyType(struct xkb_key_type * from, struct xkb_key_type * into)
return Success;
}
Bool
bool
XkbcResizeKeySyms(struct xkb_keymap * xkb, xkb_keycode_t key,
unsigned int needed)
{
if (xkb->map->key_sym_map[key].size_syms >= needed)
return True;
return true;
xkb->map->key_sym_map[key].syms =
uTypedRecalloc(xkb->map->key_sym_map[key].syms,
@ -254,11 +254,11 @@ XkbcResizeKeySyms(struct xkb_keymap * xkb, xkb_keycode_t key,
xkb_keysym_t);
if (!xkb->map->key_sym_map[key].syms) {
xkb->map->key_sym_map[key].size_syms = 0;
return False;
return false;
}
xkb->map->key_sym_map[key].size_syms = needed;
return True;
return true;
}
union xkb_action *

View File

@ -96,21 +96,21 @@ InputLineAddChar(InputLine *line,int ch)
(int)((l)->line[(l)->num_line++]= (c)):\
InputLineAddChar(l,c))
static Bool
GetInputLine(FILE *file,InputLine *line,Bool checkbang)
static bool
GetInputLine(FILE *file,InputLine *line,bool checkbang)
{
int ch;
Bool endOfFile,spacePending,slashPending,inComment;
bool endOfFile,spacePending,slashPending,inComment;
endOfFile= False;
endOfFile= false;
while ((!endOfFile)&&(line->num_line==0)) {
spacePending= slashPending= inComment= False;
spacePending= slashPending= inComment= false;
while (((ch=getc(file))!='\n')&&(ch!=EOF)) {
if (ch=='\\') {
if ((ch=getc(file))==EOF)
break;
if (ch=='\n') {
inComment= False;
inComment= false;
ch= ' ';
line->line_num++;
}
@ -119,21 +119,21 @@ GetInputLine(FILE *file,InputLine *line,Bool checkbang)
continue;
if (ch=='/') {
if (slashPending) {
inComment= True;
slashPending= False;
inComment= true;
slashPending= false;
}
else {
slashPending= True;
slashPending= true;
}
continue;
}
else if (slashPending) {
if (spacePending) {
ADD_CHAR(line,' ');
spacePending= False;
spacePending= false;
}
ADD_CHAR(line,'/');
slashPending= False;
slashPending= false;
}
if (isspace(ch)) {
while (isspace(ch)&&(ch!='\n')&&(ch!=EOF)) {
@ -142,13 +142,13 @@ GetInputLine(FILE *file,InputLine *line,Bool checkbang)
if (ch==EOF)
break;
if ((ch!='\n')&&(line->num_line>0))
spacePending= True;
spacePending= true;
ungetc(ch,file);
}
else {
if (spacePending) {
ADD_CHAR(line,' ');
spacePending= False;
spacePending= false;
}
if (checkbang && ch=='!') {
if (line->num_line!=0) {
@ -163,13 +163,13 @@ GetInputLine(FILE *file,InputLine *line,Bool checkbang)
}
}
if (ch==EOF)
endOfFile= True;
endOfFile= true;
/* else line->num_line++;*/
}
if ((line->num_line==0)&&(endOfFile))
return False;
return false;
ADD_CHAR(line,'\0');
return True;
return true;
}
/***====================================================================***/
@ -255,7 +255,7 @@ SetUpRemap(InputLine *line,RemapSpec *remap)
int ndx;
char *strtok_buf;
#ifdef DEBUG
Bool found;
bool found;
#endif
@ -266,7 +266,7 @@ SetUpRemap(InputLine *line,RemapSpec *remap)
remap->number = len;
while ((tok = strtok_r(str, " ", &strtok_buf)) != NULL) {
#ifdef DEBUG
found= False;
found= false;
#endif
str= NULL;
if (strcmp(tok,"=")==0)
@ -289,7 +289,7 @@ SetUpRemap(InputLine *line,RemapSpec *remap)
ndx = 0;
}
#ifdef DEBUG
found= True;
found= true;
#endif
if (present&(1<<i)) {
if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
@ -347,7 +347,7 @@ SetUpRemap(InputLine *line,RemapSpec *remap)
remap->number++;
}
static Bool
static bool
MatchOneOf(char *wanted,char *vals_defined)
{
char *str, *next;
@ -364,14 +364,14 @@ MatchOneOf(char *wanted,char *vals_defined)
len= strlen(str);
}
if ((len==want_len)&&(strncmp(wanted,str,len)==0))
return True;
return true;
}
return False;
return false;
}
/***====================================================================***/
static Bool
static bool
CheckLine( InputLine * line,
RemapSpec * remap,
XkbRF_RulePtr rule,
@ -381,7 +381,7 @@ CheckLine( InputLine * line,
int nread, i;
FileSpec tmp;
char *strtok_buf;
Bool append = False;
bool append = false;
if (line->line[0]=='!') {
if (line->line[1] == '$' ||
@ -389,14 +389,14 @@ CheckLine( InputLine * line,
char *gname = strchr(line->line, '$');
char *words = strchr(gname, ' ');
if(!words)
return False;
return false;
*words++ = '\0';
for (; *words; words++) {
if (*words != '=' && *words != ' ')
break;
}
if (*words == '\0')
return False;
return false;
group->name = uDupString(gname);
group->words = uDupString(words);
for (i = 1, words = group->words; *words; words++) {
@ -406,17 +406,17 @@ CheckLine( InputLine * line,
}
}
group->number = i;
return True;
return true;
} else {
SetUpRemap(line,remap);
return False;
return false;
}
}
if (remap->num_remap==0) {
PR_DEBUG("Must have a mapping before first line of data\n");
PR_DEBUG("Illegal line of data ignored\n");
return False;
return false;
}
memset(&tmp, 0, sizeof(FileSpec));
str= line->line;
@ -433,12 +433,12 @@ CheckLine( InputLine * line,
}
tmp.name[remap->remap[nread].word]= tok;
if (*tok == '+' || *tok == '|')
append = True;
append = true;
}
if (nread<remap->num_remap) {
PR_DEBUG1("Too few words on a line: %s\n", line->line);
PR_DEBUG("line ignored\n");
return False;
return false;
}
rule->flags= 0;
@ -469,7 +469,7 @@ CheckLine( InputLine * line,
rule->variant_num = remap->remap[i].index;
}
}
return True;
return true;
}
static char *
@ -497,7 +497,7 @@ squeeze_spaces(char *p1)
*p1 = '\0';
}
static Bool
static bool
MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
{
memset(mdefs, 0, sizeof(XkbRF_MultiDefsRec));
@ -513,7 +513,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
int i;
p = uDupString(defs->layout);
if (p == NULL)
return False;
return false;
squeeze_spaces(p);
mdefs->layout[1] = p;
for (i = 2; i <= XkbNumKbdGroups; i++) {
@ -537,7 +537,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
int i;
p = uDupString(defs->variant);
if (p == NULL)
return False;
return false;
squeeze_spaces(p);
mdefs->variant[1] = p;
for (i = 2; i <= XkbNumKbdGroups; i++) {
@ -552,7 +552,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
*p = '\0';
}
}
return True;
return true;
}
static void
@ -589,7 +589,7 @@ XkbRF_ApplyRule( XkbRF_RulePtr rule,
Apply(rule->keymap, &names->keymap);
}
static Bool
static bool
CheckGroup( XkbRF_RulesPtr rules,
const char * group_name,
const char * name)
@ -604,13 +604,13 @@ CheckGroup( XkbRF_RulesPtr rules,
}
}
if (i == rules->num_groups)
return False;
return false;
for (i = 0, p = group->words; i < group->number; i++, p += strlen(p)+1) {
if (! strcmp(p, name)) {
return True;
return true;
}
}
return False;
return false;
}
static int
@ -619,13 +619,13 @@ XkbRF_CheckApplyRule( XkbRF_RulePtr rule,
struct xkb_component_names * names,
XkbRF_RulesPtr rules)
{
Bool pending = False;
bool pending = false;
if (rule->model != NULL) {
if(mdefs->model == NULL)
return 0;
if (strcmp(rule->model, "*") == 0) {
pending = True;
pending = true;
} else {
if (rule->model[0] == '$') {
if (!CheckGroup(rules, rule->model, mdefs->model))
@ -648,7 +648,7 @@ XkbRF_CheckApplyRule( XkbRF_RulePtr rule,
*mdefs->layout[rule->layout_num] == '\0')
return 0;
if (strcmp(rule->layout, "*") == 0) {
pending = True;
pending = true;
} else {
if (rule->layout[0] == '$') {
if (!CheckGroup(rules, rule->layout,
@ -665,7 +665,7 @@ XkbRF_CheckApplyRule( XkbRF_RulePtr rule,
*mdefs->variant[rule->variant_num] == '\0')
return 0;
if (strcmp(rule->variant, "*") == 0) {
pending = True;
pending = true;
} else {
if (rule->variant[0] == '$') {
if (!CheckGroup(rules, rule->variant,
@ -831,7 +831,7 @@ XkbRF_SubstituteVars(char *name, XkbRF_MultiDefsPtr mdefs)
/***====================================================================***/
Bool
bool
XkbcRF_GetComponents( XkbRF_RulesPtr rules,
XkbRF_VarDefsPtr defs,
struct xkb_component_names * names)
@ -911,7 +911,7 @@ XkbcRF_AddGroup(XkbRF_RulesPtr rules)
return &rules->groups[rules->num_groups++];
}
Bool
bool
XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules)
{
InputLine line;
@ -920,11 +920,11 @@ XkbRF_RuleRec trule,*rule;
XkbRF_GroupRec tgroup,*group;
if (!(rules && file))
return False;
return false;
memset(&remap, 0, sizeof(RemapSpec));
memset(&tgroup, 0, sizeof(XkbRF_GroupRec));
InitInputLine(&line);
while (GetInputLine(file,&line,True)) {
while (GetInputLine(file, &line, true)) {
if (CheckLine(&line,&remap,&trule,&tgroup)) {
if (tgroup.number) {
if ((group= XkbcRF_AddGroup(rules))!=NULL) {
@ -941,7 +941,7 @@ XkbRF_GroupRec tgroup,*group;
line.num_line= 0;
}
FreeInputLine(&line);
return True;
return true;
}
static void

View File

@ -32,12 +32,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define mapSize(m) (sizeof(m) / sizeof(struct xkb_kt_map_entry))
static struct xkb_kt_map_entry map2Level[]= {
{ True, ShiftMask, {1, ShiftMask, 0} }
{ true, ShiftMask, {1, ShiftMask, 0} }
};
static struct xkb_kt_map_entry mapAlpha[]= {
{ True, ShiftMask, { 1, ShiftMask, 0 } },
{ True, LockMask, { 0, LockMask, 0 } }
{ true, ShiftMask, { 1, ShiftMask, 0 } },
{ true, LockMask, { 0, LockMask, 0 } }
};
static struct xkb_mods preAlpha[]= {
@ -47,8 +47,8 @@ static struct xkb_mods preAlpha[]= {
#define NL_VMOD_MASK 0
static struct xkb_kt_map_entry mapKeypad[]= {
{ True, ShiftMask, { 1, ShiftMask, 0 } },
{ False, 0, { 1, 0, NL_VMOD_MASK } }
{ true, ShiftMask, { 1, ShiftMask, 0 } },
{ false, 0, { 1, 0, NL_VMOD_MASK } }
};
static struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
@ -119,12 +119,12 @@ XkbcInitCanonicalKeyTypes(struct xkb_keymap * xkb, unsigned which, int keypadVMo
if ((keypadVMod >= 0) && (keypadVMod < XkbNumVirtualMods) &&
(rtrn == Success)) {
type->mods.vmods = (1 << keypadVMod);
type->map[0].active = True;
type->map[0].active = true;
type->map[0].mods.mask = ShiftMask;
type->map[0].mods.real_mods = ShiftMask;
type->map[0].mods.vmods = 0;
type->map[0].level = 1;
type->map[1].active = False;
type->map[1].active = false;
type->map[1].mods.mask = 0;
type->map[1].mods.real_mods = 0;
type->map[1].mods.vmods = (1 << keypadVMod);
@ -135,7 +135,7 @@ XkbcInitCanonicalKeyTypes(struct xkb_keymap * xkb, unsigned which, int keypadVMo
return Success;
}
Bool
bool
XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
unsigned *mask_rtrn)
{
@ -143,13 +143,13 @@ XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
unsigned mask;
if (!xkb)
return False;
return false;
if (virtual_mask == 0) {
*mask_rtrn = 0;
return True;
return true;
}
if (!xkb->server)
return False;
return false;
for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
if (virtual_mask & bit)
@ -157,7 +157,7 @@ XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
}
*mask_rtrn = mask;
return True;
return true;
}
/*
@ -264,7 +264,7 @@ _XkbcKSCheckCase(xkb_keysym_t ks)
#define UNMATCHABLE(c) ((c) == '(' || (c) == ')' || (c) == '/')
Bool
bool
XkbcNameMatchesPattern(char *name, char *ptrn)
{
while (ptrn[0] != '\0') {
@ -273,21 +273,21 @@ XkbcNameMatchesPattern(char *name, char *ptrn)
ptrn++;
continue;
}
return False;
return false;
}
if (ptrn[0] == '?') {
if (UNMATCHABLE(name[0]))
return False;
return false;
}
else if (ptrn[0] == '*') {
if (!UNMATCHABLE(name[0]) &&
XkbcNameMatchesPattern(name + 1, ptrn))
return True;
return true;
return XkbcNameMatchesPattern(name, ptrn + 1);
}
else if (ptrn[0] != name[0])
return False;
return false;
name++;
ptrn++;

View File

@ -92,7 +92,7 @@ XkbcVModMaskText(struct xkb_keymap * xkb, unsigned modMask, unsigned mask)
return "none";
if (modMask != 0)
mm = XkbcModMaskText(modMask, False);
mm = XkbcModMaskText(modMask, false);
str = buf;
buf[0]= '\0';
@ -158,7 +158,7 @@ XkbcModIndexText(unsigned ndx)
}
const char *
XkbcModMaskText(unsigned mask, Bool cFormat)
XkbcModMaskText(unsigned mask, bool cFormat)
{
int i, rem, bit;
char *str, *buf;

View File

@ -53,7 +53,7 @@ static int outCount = 0;
static char *preMsg = NULL;
static char *prefix = NULL;
Bool
bool
uSetErrorFile(char *name)
{
if ((errorFile != NULL) && (errorFile != stderr))
@ -68,9 +68,9 @@ uSetErrorFile(char *name)
if (errorFile == NULL)
{
errorFile = stderr;
return (False);
return false;
}
return (True);
return true;
}
void

View File

@ -29,8 +29,9 @@
/***====================================================================***/
#include <stdbool.h>
#include <stdio.h>
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
extern void *
@ -54,7 +55,7 @@ recalloc(void *ptr, size_t old_size, size_t new_size);
/***====================================================================***/
extern Bool
extern bool
uSetErrorFile(char *name);
#define INFO uInformation

View File

@ -94,7 +94,7 @@ xkb_canonicalise_components(struct xkb_component_names * names,
old ? old->types : NULL);
}
Bool
bool
XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
unsigned char *map_rtrn)
{
@ -103,11 +103,11 @@ XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
struct xkb_kt_map_entry * entry = NULL;
if (!xkb || !type || !xkb->server)
return False;
return false;
if (type->mods.vmods != 0) {
if (!XkbcVirtualModsToReal(xkb, type->mods.vmods, &tmp))
return False;
return false;
type->mods.mask = tmp | type->mods.real_mods;
entry = type->map;
@ -115,13 +115,13 @@ XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
tmp = 0;
if (entry->mods.vmods != 0) {
if (!XkbcVirtualModsToReal(xkb, entry->mods.vmods, &tmp))
return False;
return false;
if (tmp == 0) {
entry->active = False;
entry->active = false;
continue;
}
}
entry->active = True;
entry->active = true;
entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask;
}
}
@ -135,5 +135,5 @@ XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
map_rtrn[type->map[i].mods.mask] = type->map[i].level;
}
return True;
return true;
}

View File

@ -60,7 +60,7 @@ XkbcAllocServerMap(struct xkb_keymap * xkb, unsigned which, unsigned nNewActions
extern int
XkbcCopyKeyType(struct xkb_key_type * from, struct xkb_key_type *into);
extern Bool
extern bool
XkbcResizeKeySyms(struct xkb_keymap * xkb, xkb_keycode_t key, uint32_t needed);
extern union xkb_action *

View File

@ -36,7 +36,7 @@
#include "action.h"
#include "misc.h"
static Bool actionsInitialized;
static bool actionsInitialized;
static ExprDef constTrue;
static ExprDef constFalse;
@ -124,23 +124,23 @@ static const LookupEntry fieldStrings[] = {
{ NULL, 0 }
};
static Bool
static bool
stringToValue(const LookupEntry tab[], const char *string,
unsigned *value_rtrn)
{
const LookupEntry *entry;
if (!string)
return False;
return false;
for (entry = tab; entry->name != NULL; entry++) {
if (strcasecmp(entry->name, string) == 0) {
*value_rtrn = entry->result;
return True;
return true;
}
}
return False;
return false;
}
static const char *
@ -155,13 +155,13 @@ valueToString(const LookupEntry tab[], unsigned value)
return "unknown";
}
static Bool
static bool
stringToAction(const char *str, unsigned *type_rtrn)
{
return stringToValue(actionStrings, str, type_rtrn);
}
static Bool
static bool
stringToField(const char *str, unsigned *field_rtrn)
{
return stringToValue(fieldStrings, str, field_rtrn);
@ -175,43 +175,43 @@ fieldText(unsigned field)
/***====================================================================***/
static Bool
static bool
ReportMismatch(unsigned action, unsigned field, const char *type)
{
ERROR("Value of %s field must be of type %s\n", fieldText(field), type);
ACTION("Action %s definition ignored\n", XkbcActionTypeText(action));
return False;
return false;
}
static Bool
static bool
ReportIllegal(unsigned action, unsigned field)
{
ERROR("Field %s is not defined for an action of type %s\n",
fieldText(field), XkbcActionTypeText(action));
ACTION("Action definition ignored\n");
return False;
return false;
}
static Bool
static bool
ReportActionNotArray(unsigned action, unsigned field)
{
ERROR("The %s field in the %s action is not an array\n",
fieldText(field), XkbcActionTypeText(action));
ACTION("Action definition ignored\n");
return False;
return false;
}
static Bool
static bool
ReportNotFound(unsigned action, unsigned field, const char *what,
const char *bad)
{
ERROR("%s named %s not found\n", what, bad);
ACTION("Ignoring the %s field of an %s action\n", fieldText(field),
XkbcActionTypeText(action));
return False;
return false;
}
static Bool
static bool
HandleNoAction(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -219,7 +219,7 @@ HandleNoAction(struct xkb_keymap * xkb,
return ReportIllegal(action->type, field);
}
static Bool
static bool
CheckLatchLockFlags(unsigned action,
unsigned field, ExprDef * value, unsigned *flags_inout)
{
@ -231,17 +231,17 @@ CheckLatchLockFlags(unsigned action,
else if (field == F_LatchToLock)
tmp = XkbSA_LatchToLock;
else
return False; /* WSGO! */
return false; /* WSGO! */
if (!ExprResolveBoolean(value, &result))
return ReportMismatch(action, field, "boolean");
if (result.uval)
*flags_inout |= tmp;
else
*flags_inout &= ~tmp;
return True;
return true;
}
static Bool
static bool
CheckModifierField(struct xkb_keymap * xkb,
unsigned action,
ExprDef * value,
@ -259,17 +259,17 @@ CheckModifierField(struct xkb_keymap * xkb,
*mods_rtrn = 0;
*flags_inout |= XkbSA_UseModMapMods;
return True;
return true;
}
}
if (!ExprResolveVModMask(value, &rtrn, xkb))
return ReportMismatch(action, F_Modifiers, "modifier mask");
*mods_rtrn = rtrn.uval;
*flags_inout &= ~XkbSA_UseModMapMods;
return True;
return true;
}
static Bool
static bool
HandleSetLatchMods(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -297,9 +297,9 @@ HandleSetLatchMods(struct xkb_keymap * xkb,
if (CheckLatchLockFlags(action->type, field, value, &rtrn))
{
act->flags = rtrn;
return True;
return true;
}
return False;
return false;
case F_Modifiers:
t1 = act->flags;
if (CheckModifierField(xkb, action->type, value, &t1, &t2))
@ -307,14 +307,14 @@ HandleSetLatchMods(struct xkb_keymap * xkb,
act->flags = t1;
act->real_mods = act->mask = (t2 & 0xff);
act->vmods = (t2 >> 8) & 0xffff;
return True;
return true;
}
return False;
return false;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleLockMods(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -334,14 +334,14 @@ HandleLockMods(struct xkb_keymap * xkb,
act->flags = t1;
act->real_mods = act->mask = (t2 & 0xff);
act->vmods = (t2 >> 8) & 0xffff;
return True;
return true;
}
return False;
return false;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
CheckGroupField(unsigned action,
ExprDef * value, unsigned *flags_inout, int *grp_rtrn)
{
@ -367,10 +367,10 @@ CheckGroupField(unsigned action,
*grp_rtrn = rtrn.ival;
else
*grp_rtrn = rtrn.ival - 1;
return True;
return true;
}
static Bool
static bool
HandleSetLatchGroup(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -399,23 +399,23 @@ HandleSetLatchGroup(struct xkb_keymap * xkb,
if (CheckLatchLockFlags(action->type, field, value, &rtrn))
{
act->flags = rtrn;
return True;
return true;
}
return False;
return false;
case F_Group:
t1 = act->flags;
if (CheckGroupField(action->type, value, &t1, &t2))
{
act->flags = t1;
act->group = t2;
return True;
return true;
}
return False;
return false;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleLockGroup(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -434,21 +434,21 @@ HandleLockGroup(struct xkb_keymap * xkb,
{
act->flags = t1;
act->group = t2;
return True;
return true;
}
return False;
return false;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleMovePtr(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
struct xkb_pointer_action *act;
Bool absolute;
bool absolute;
act = (struct xkb_pointer_action *) action;
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
@ -457,9 +457,9 @@ HandleMovePtr(struct xkb_keymap * xkb,
if ((field == F_X) || (field == F_Y))
{
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
absolute = False;
absolute = false;
else
absolute = True;
absolute = true;
if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field, "integer");
if (field == F_X)
@ -474,7 +474,7 @@ HandleMovePtr(struct xkb_keymap * xkb,
act->flags |= XkbSA_MoveAbsoluteY;
act->y = rtrn.ival;
}
return True;
return true;
}
else if (field == F_Accel)
{
@ -496,7 +496,7 @@ static const LookupEntry lockWhich[] = {
{NULL, 0}
};
static Bool
static bool
HandlePtrBtn(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -516,10 +516,10 @@ HandlePtrBtn(struct xkb_keymap * xkb,
{
ERROR("Button must specify default or be in the range 1..5\n");
ACTION("Illegal button value %d ignored\n", rtrn.ival);
return False;
return false;
}
act->button = rtrn.ival;
return True;
return true;
}
else if ((action->type == XkbSA_LockPtrBtn) && (field == F_Affect))
{
@ -529,7 +529,7 @@ HandlePtrBtn(struct xkb_keymap * xkb,
return ReportMismatch(action->type, field, "lock or unlock");
act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
act->flags |= rtrn.ival;
return True;
return true;
}
else if (field == F_Count)
{
@ -541,10 +541,10 @@ HandlePtrBtn(struct xkb_keymap * xkb,
{
ERROR("The count field must have a value in the range 0..255\n");
ACTION("Illegal count %d ignored\n", rtrn.ival);
return False;
return false;
}
act->count = rtrn.ival;
return True;
return true;
}
return ReportIllegal(action->type, field);
}
@ -556,7 +556,7 @@ static const LookupEntry ptrDflts[] = {
{NULL, 0}
};
static Bool
static bool
HandleSetPtrDflt(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -572,7 +572,7 @@ HandleSetPtrDflt(struct xkb_keymap * xkb,
if (!ExprResolveEnum(value, &rtrn, ptrDflts))
return ReportMismatch(action->type, field, "pointer component");
act->affect = rtrn.uval;
return True;
return true;
}
else if ((field == F_Button) || (field == F_Value))
{
@ -597,19 +597,19 @@ HandleSetPtrDflt(struct xkb_keymap * xkb,
{
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;
return false;
}
if (rtrn.ival == 0)
{
ERROR("Cannot set default pointer button to \"default\"\n");
ACTION("Illegal default button setting ignored\n");
return False;
return false;
}
if (value->op == OpNegate)
act->value = -rtrn.ival;
else
act->value = rtrn.ival;
return True;
return true;
}
return ReportIllegal(action->type, field);
}
@ -628,7 +628,7 @@ static const LookupEntry isoNames[] = {
{NULL, 0},
};
static Bool
static bool
HandleISOLock(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -650,9 +650,9 @@ HandleISOLock(struct xkb_keymap * xkb,
act->flags = flags & (~XkbSA_ISODfltIsGroup);
act->real_mods = mods & 0xff;
act->vmods = (mods >> 8) & 0xff;
return True;
return true;
}
return False;
return false;
case F_Group:
if (array_ndx != NULL)
return ReportActionNotArray(action->type, field);
@ -661,21 +661,21 @@ HandleISOLock(struct xkb_keymap * xkb,
{
act->flags = flags | XkbSA_ISODfltIsGroup;
act->group = group;
return True;
return true;
}
return False;
return false;
case F_Affect:
if (array_ndx != NULL)
return ReportActionNotArray(action->type, field);
if (!ExprResolveMask(value, &rtrn, isoNames))
return ReportMismatch(action->type, field, "keyboard component");
act->affect = (~rtrn.uval) & XkbSA_ISOAffectMask;
return True;
return true;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleSwitchScreen(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -706,13 +706,13 @@ HandleSwitchScreen(struct xkb_keymap * xkb,
{
ERROR("Screen index must be in the range 1..255\n");
ACTION("Illegal screen value %d ignored\n", rtrn.ival);
return False;
return false;
}
if (value->op == OpNegate)
act->screen = -rtrn.ival;
else
act->screen = rtrn.ival;
return True;
return true;
}
else if (field == F_Same)
{
@ -724,7 +724,7 @@ HandleSwitchScreen(struct xkb_keymap * xkb,
act->flags &= ~XkbSA_SwitchApplication;
else
act->flags |= XkbSA_SwitchApplication;
return True;
return true;
}
return ReportIllegal(action->type, field);
}
@ -750,7 +750,7 @@ const LookupEntry ctrlNames[] = {
{NULL, 0}
};
static Bool
static bool
HandleSetLockControls(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -766,7 +766,7 @@ HandleSetLockControls(struct xkb_keymap * xkb,
if (!ExprResolveMask(value, &rtrn, ctrlNames))
return ReportMismatch(action->type, field, "controls mask");
act->ctrls = rtrn.uval;
return True;
return true;
}
return ReportIllegal(action->type, field);
}
@ -781,7 +781,7 @@ static const LookupEntry evNames[] = {
{NULL, 0}
};
static Bool
static bool
HandleActionMessage(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -800,7 +800,7 @@ HandleActionMessage(struct xkb_keymap * xkb,
act->flags &= ~(XkbSA_MessageOnPress | XkbSA_MessageOnRelease);
act->flags =
rtrn.uval & (XkbSA_MessageOnPress | XkbSA_MessageOnRelease);
return True;
return true;
case F_GenKeyEvent:
if (array_ndx != NULL)
return ReportActionNotArray(action->type, field);
@ -810,7 +810,7 @@ HandleActionMessage(struct xkb_keymap * xkb,
act->flags |= XkbSA_MessageGenKeyEvent;
else
act->flags &= ~XkbSA_MessageGenKeyEvent;
return True;
return true;
case F_Data:
if (array_ndx == NULL)
{
@ -826,7 +826,7 @@ HandleActionMessage(struct xkb_keymap * xkb,
}
strncpy((char *) act->message, rtrn.str, 6);
}
return True;
return true;
}
else
{
@ -835,14 +835,14 @@ HandleActionMessage(struct xkb_keymap * xkb,
{
ERROR("Array subscript must be integer\n");
ACTION("Illegal subscript ignored\n");
return False;
return false;
}
ndx = rtrn.uval;
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;
return false;
}
if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field, "integer");
@ -850,16 +850,16 @@ HandleActionMessage(struct xkb_keymap * xkb,
{
ERROR("Message data must be in the range 0..255\n");
ACTION("Illegal datum %d ignored\n", rtrn.ival);
return False;
return false;
}
act->message[ndx] = rtrn.uval;
}
return True;
return true;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleRedirectKey(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -880,13 +880,13 @@ HandleRedirectKey(struct xkb_keymap * xkb,
if (!ExprResolveKeyName(value, &rtrn))
return ReportMismatch(action->type, field, "key name");
tmp = KeyNameToLong(rtrn.keyName.name);
if (!FindNamedKey(xkb, tmp, &kc, True, CreateKeyNames(xkb), 0))
if (!FindNamedKey(xkb, tmp, &kc, true, CreateKeyNames(xkb), 0))
{
return ReportNotFound(action->type, field, "Key",
XkbcKeyNameText(rtrn.keyName.name));
}
act->new_key = kc;
return True;
return true;
case F_ModsToClear:
case F_Modifiers:
t1 = 0;
@ -904,14 +904,14 @@ HandleRedirectKey(struct xkb_keymap * xkb,
act->vmods |= t2;
else
act->vmods &= ~t2;
return True;
return true;
}
return True;
return true;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleDeviceBtn(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -931,10 +931,10 @@ HandleDeviceBtn(struct xkb_keymap * xkb,
{
ERROR("Button must specify default or be in the range 1..255\n");
ACTION("Illegal button value %d ignored\n", rtrn.ival);
return False;
return false;
}
act->button = rtrn.ival;
return True;
return true;
}
else if ((action->type == XkbSA_LockDeviceBtn) && (field == F_Affect))
{
@ -944,7 +944,7 @@ HandleDeviceBtn(struct xkb_keymap * xkb,
return ReportMismatch(action->type, field, "lock or unlock");
act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
act->flags |= rtrn.ival;
return True;
return true;
}
else if (field == F_Count)
{
@ -956,10 +956,10 @@ HandleDeviceBtn(struct xkb_keymap * xkb,
{
ERROR("The count field must have a value in the range 0..255\n");
ACTION("Illegal count %d ignored\n", rtrn.ival);
return False;
return false;
}
act->count = rtrn.ival;
return True;
return true;
}
else if (field == F_Device)
{
@ -972,15 +972,15 @@ HandleDeviceBtn(struct xkb_keymap * xkb,
{
ERROR("Device must specify default or be in the range 1..255\n");
ACTION("Illegal device value %d ignored\n", rtrn.ival);
return False;
return false;
}
act->device = rtrn.ival;
return True;
return true;
}
return ReportIllegal(action->type, field);
}
static Bool
static bool
HandleDeviceValuator(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -992,10 +992,10 @@ HandleDeviceValuator(struct xkb_keymap * xkb,
act = (struct xkb_device_valuator_action *) action;
/* XXX - Not yet implemented */
#endif
return False;
return false;
}
static Bool
static bool
HandlePrivate(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
@ -1011,10 +1011,10 @@ HandlePrivate(struct xkb_keymap * xkb,
{
ERROR("Private action type must be in the range 0..255\n");
ACTION("Illegal type %d ignored\n", rtrn.ival);
return False;
return false;
}
action->type = rtrn.uval;
return True;
return true;
case F_Data:
if (array_ndx == NULL)
{
@ -1027,12 +1027,12 @@ HandlePrivate(struct xkb_keymap * xkb,
{
WARN("A private action has 7 data bytes\n");
ACTION("Extra %d bytes ignored\n", len - 6);
return False;
return false;
}
strncpy((char *) action->data, rtrn.str, sizeof action->data);
}
free(rtrn.str);
return True;
return true;
}
else
{
@ -1041,14 +1041,14 @@ HandlePrivate(struct xkb_keymap * xkb,
{
ERROR("Array subscript must be integer\n");
ACTION("Illegal subscript ignored\n");
return False;
return false;
}
ndx = rtrn.uval;
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;
return false;
}
if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field, "integer");
@ -1056,16 +1056,16 @@ HandlePrivate(struct xkb_keymap * xkb,
{
ERROR("All data for a private action must be 0..255\n");
ACTION("Illegal datum %d ignored\n", rtrn.ival);
return False;
return false;
}
action->data[ndx] = rtrn.uval;
return True;
return true;
}
}
return ReportIllegal(PrivateAction, field);
}
typedef Bool (*actionHandler) (struct xkb_keymap *xkb,
typedef bool (*actionHandler) (struct xkb_keymap *xkb,
struct xkb_any_action *action, unsigned field,
ExprDef *array_ndx, ExprDef *value);
@ -1130,18 +1130,18 @@ HandleActionDef(ExprDef * def,
{
ERROR("Expected an action definition, found %s\n",
exprOpText(def->op));
return False;
return false;
}
str = XkbcAtomText(def->value.action.name);
if (!str)
{
WSGO("Missing name in action definition!!\n");
return False;
return false;
}
if (!stringToAction(str, &tmp))
{
ERROR("Unknown action %s\n", str);
return False;
return false;
}
action->type = hndlrType = tmp;
if (action->type != XkbSA_NoAction)
@ -1157,7 +1157,7 @@ HandleActionDef(ExprDef * def,
info->array_ndx,
info->value))
{
return False;
return false;
}
}
info = info->next;
@ -1191,7 +1191,7 @@ HandleActionDef(ExprDef * def,
}
}
if (!ExprResolveLhs(field, &elemRtrn, &fieldRtrn, &arrayRtrn))
return False; /* internal error -- already reported */
return false; /* internal error -- already reported */
if (elemRtrn.str != NULL)
{
@ -1200,24 +1200,24 @@ HandleActionDef(ExprDef * def,
fieldRtrn.str);
free(elemRtrn.str);
free(fieldRtrn.str);
return False;
return false;
}
if (!stringToField(fieldRtrn.str, &fieldNdx))
{
ERROR("Unknown field name %s\n", uStringText(fieldRtrn.str));
free(elemRtrn.str);
free(fieldRtrn.str);
return False;
return false;
}
free(elemRtrn.str);
free(fieldRtrn.str);
if (!(*handleAction[hndlrType])
(xkb, action, fieldNdx, arrayRtrn, value))
{
return False;
return false;
}
}
return True;
return true;
}
/***====================================================================***/
@ -1237,7 +1237,7 @@ SetActionField(struct xkb_keymap * xkb,
if (new == NULL)
{
WSGO("Couldn't allocate space for action default\n");
return False;
return false;
}
if (strcasecmp(elem, "action") == 0)
new->action = XkbSA_NoAction;
@ -1246,21 +1246,21 @@ SetActionField(struct xkb_keymap * xkb,
if (!stringToAction(elem, &new->action))
{
free(new);
return False;
return false;
}
if (new->action == XkbSA_NoAction)
{
ERROR("\"%s\" is not a valid field in a NoAction action\n",
field);
free(new);
return False;
return false;
}
}
if (!stringToField(field, &new->field))
{
ERROR("\"%s\" is not a legal field name\n", field);
free(new);
return False;
return false;
}
new->array_ndx = array_ndx;
new->value = value;
@ -1272,7 +1272,7 @@ SetActionField(struct xkb_keymap * xkb,
*info_rtrn = new;
else
old->next = new;
return True;
return true;
}
/***====================================================================***/

View File

@ -96,14 +96,14 @@ HandleAliasDef(KeyAliasDef * def,
AliasInfo new;
InitAliasInfo(&new, merge, file_id, def->alias, def->real);
HandleCollision(info, &new);
return True;
return true;
}
}
info = uTypedCalloc(1, AliasInfo);
if (info == NULL)
{
WSGO("Allocation failure in HandleAliasDef\n");
return False;
return false;
}
info->def.fileID = file_id;
info->def.merge = merge;
@ -111,7 +111,7 @@ HandleAliasDef(KeyAliasDef * def,
memcpy(info->alias, def->alias, XkbKeyNameLength);
memcpy(info->real, def->real, XkbKeyNameLength);
*info_in = (AliasInfo *) AddCommonInfo(&(*info_in)->def, &info->def);
return True;
return true;
}
void
@ -121,19 +121,19 @@ ClearAliases(AliasInfo ** info_in)
ClearCommonInfo(&(*info_in)->def);
}
Bool
bool
MergeAliases(AliasInfo ** into, AliasInfo ** merge, unsigned how_merge)
{
AliasInfo *tmp;
KeyAliasDef def;
if ((*merge) == NULL)
return True;
return true;
if ((*into) == NULL)
{
*into = *merge;
*merge = NULL;
return True;
return true;
}
memset(&def, 0, sizeof(KeyAliasDef));
for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next)
@ -145,9 +145,9 @@ MergeAliases(AliasInfo ** into, AliasInfo ** merge, unsigned how_merge)
memcpy(def.alias, tmp->alias, XkbKeyNameLength);
memcpy(def.real, tmp->real, XkbKeyNameLength);
if (!HandleAliasDef(&def, def.merge, tmp->def.fileID, into))
return False;
return false;
}
return True;
return true;
}
int
@ -160,7 +160,7 @@ ApplyAliases(struct xkb_keymap * xkb, AliasInfo ** info_in)
int status;
if (*info_in == NULL)
return True;
return true;
nOld = (xkb->names ? xkb->names->num_key_aliases : 0);
old = (xkb->names ? xkb->names->key_aliases : NULL);
for (nNew = 0, info = *info_in; info != NULL;
@ -170,7 +170,7 @@ ApplyAliases(struct xkb_keymap * xkb, AliasInfo ** info_in)
xkb_keycode_t kc;
lname = KeyNameToLong(info->real);
if (!FindNamedKey(xkb, lname, &kc, False, CreateKeyNames(xkb), 0))
if (!FindNamedKey(xkb, lname, &kc, false, CreateKeyNames(xkb), 0))
{
if (warningLevel > 4)
{
@ -182,7 +182,7 @@ ApplyAliases(struct xkb_keymap * xkb, AliasInfo ** info_in)
continue;
}
lname = KeyNameToLong(info->alias);
if (FindNamedKey(xkb, lname, &kc, False, False, 0))
if (FindNamedKey(xkb, lname, &kc, false, false, 0))
{
if (warningLevel > 4)
{
@ -216,7 +216,7 @@ ApplyAliases(struct xkb_keymap * xkb, AliasInfo ** info_in)
{
ClearCommonInfo(&(*info_in)->def);
*info_in = NULL;
return True;
return true;
}
status = XkbcAllocNames(xkb, XkbKeyAliasesMask, nOld + nNew);
if (xkb->names)
@ -224,7 +224,7 @@ ApplyAliases(struct xkb_keymap * xkb, AliasInfo ** info_in)
if (status != Success)
{
WSGO("Allocation failure in ApplyAliases\n");
return False;
return false;
}
a = xkb->names ? &xkb->names->key_aliases[nOld] : NULL;
for (info = *info_in; info != NULL; info = (AliasInfo *) info->def.next)
@ -245,5 +245,5 @@ ApplyAliases(struct xkb_keymap * xkb, AliasInfo ** info_in)
#endif
ClearCommonInfo(&(*info_in)->def);
*info_in = NULL;
return True;
return true;
}

View File

@ -41,7 +41,7 @@ HandleAliasDef(KeyAliasDef *def, unsigned merge, unsigned file_id,
extern void
ClearAliases(AliasInfo **info);
extern Bool
extern bool
MergeAliases(AliasInfo **into, AliasInfo **merge, unsigned how_merge);
extern int

View File

@ -50,7 +50,7 @@ typedef struct _GroupCompatInfo
{
unsigned char fileID;
unsigned char merge;
Bool defined;
bool defined;
unsigned char real_mods;
xkb_atom_t vmods;
} GroupCompatInfo;
@ -94,7 +94,7 @@ siText(SymInterpInfo * si, CompatInfo * info)
snprintf(buf, sizeof(buf), "%s+%s(%s)",
XkbcKeysymText(si->interp.sym),
XkbcSIMatchText(si->interp.match),
XkbcModMaskText(si->interp.mods, False));
XkbcModMaskText(si->interp.mods, false));
}
return buf;
}
@ -193,7 +193,7 @@ FindMatchingInterp(CompatInfo * info, SymInterpInfo * new)
return NULL;
}
static Bool
static bool
AddInterp(CompatInfo * info, SymInterpInfo * new)
{
unsigned collide;
@ -214,7 +214,7 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
}
*old = *new;
old->defs.next = &next->defs;
return True;
return true;
}
if (UseNewField(_SI_VirtualMod, &old->defs, &new->defs, &collide))
{
@ -250,17 +250,17 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
ACTION("Using %s definition for duplicate fields\n",
(new->defs.merge != MergeAugment ? "last" : "first"));
}
return True;
return true;
}
old = new;
if ((new = NextInterp(info)) == NULL)
return False;
return false;
*new = *old;
new->defs.next = NULL;
return True;
return true;
}
static Bool
static bool
AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
{
GroupCompatInfo *gc;
@ -270,7 +270,7 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
gc = &info->groupCompat[group];
if (((gc->real_mods == newGC->real_mods) && (gc->vmods == newGC->vmods)))
{
return True;
return true;
}
if (((gc->fileID == newGC->fileID) && (warningLevel > 0))
|| (warningLevel > 9))
@ -281,12 +281,12 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
}
if (newGC->defined && (merge != MergeAugment || !gc->defined))
*gc = *newGC;
return True;
return true;
}
/***====================================================================***/
static Bool
static bool
ResolveStateAndPredicate(ExprDef * expr,
unsigned *pred_rtrn,
unsigned *mods_rtrn, CompatInfo * info)
@ -297,7 +297,7 @@ ResolveStateAndPredicate(ExprDef * expr,
{
*pred_rtrn = XkbSI_AnyOfOrNone;
*mods_rtrn = ~0;
return True;
return true;
}
*pred_rtrn = XkbSI_Exactly;
@ -318,7 +318,7 @@ ResolveStateAndPredicate(ExprDef * expr,
{
ERROR("Illegal modifier predicate \"%s\"\n", pred_txt);
ACTION("Ignored\n");
return False;
return false;
}
expr = expr->value.action.args;
}
@ -329,16 +329,16 @@ ResolveStateAndPredicate(ExprDef * expr,
{
*pred_rtrn = XkbSI_AnyOf;
*mods_rtrn = 0xff;
return True;
return true;
}
}
if (ExprResolveModMask(expr, &result))
{
*mods_rtrn = result.uval;
return True;
return true;
}
return False;
return false;
}
/***====================================================================***/
@ -391,19 +391,19 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge)
typedef void (*FileHandler) (XkbFile *rtrn, struct xkb_keymap *xkb,
unsigned merge, CompatInfo *info);
static Bool
static bool
HandleIncludeCompatMap(IncludeStmt * stmt,
struct xkb_keymap * xkb, CompatInfo * info, FileHandler hndlr)
{
unsigned newMerge;
XkbFile *rtrn;
CompatInfo included;
Bool haveSelf;
bool haveSelf;
haveSelf = False;
haveSelf = false;
if ((stmt->file == NULL) && (stmt->map == NULL))
{
haveSelf = True;
haveSelf = true;
included = *info;
memset(info, 0, sizeof(CompatInfo));
}
@ -432,7 +432,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
else
{
info->errorCount += 10;
return False;
return false;
}
if ((stmt->next != NULL) && (included.errorCount < 1))
{
@ -444,7 +444,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
{
if ((next->file == NULL) && (next->map == NULL))
{
haveSelf = True;
haveSelf = true;
MergeIncludedCompatMaps(&included, info, next->merge);
ClearCompatInfo(info, xkb);
}
@ -469,7 +469,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
else
{
info->errorCount += 10;
return False;
return false;
}
}
}
@ -638,7 +638,7 @@ HandleInterpDef(InterpDef * def, struct xkb_keymap * xkb, unsigned merge,
{
ERROR("Couldn't determine matching modifiers\n");
ACTION("Symbol interpretation ignored\n");
return False;
return false;
}
if (def->merge != MergeDefault)
merge = def->merge;
@ -649,22 +649,22 @@ HandleInterpDef(InterpDef * def, struct xkb_keymap * xkb, unsigned merge,
{
ERROR("Could not resolve keysym %s\n", def->sym);
ACTION("Symbol interpretation ignored\n");
return False;
return false;
}
si.interp.match = pred & XkbSI_OpMask;
si.interp.mods = mods;
if (!HandleInterpBody(def->def, xkb, &si, info))
{
info->errorCount++;
return False;
return false;
}
if (!AddInterp(info, &si))
{
info->errorCount++;
return False;
return false;
}
return True;
return true;
}
static int
@ -682,7 +682,7 @@ HandleGroupCompatDef(GroupCompatDef * def,
XkbNumKbdGroups + 1);
ACTION("Compatibility map for illegal group %d ignored\n",
def->group);
return False;
return false;
}
tmp.fileID = info->fileID;
tmp.merge = merge;
@ -691,11 +691,11 @@ HandleGroupCompatDef(GroupCompatDef * def,
ERROR("Expected a modifier mask in group compatibility definition\n");
ACTION("Ignoring illegal compatibility map for group %d\n",
def->group);
return False;
return false;
}
tmp.real_mods = val.uval & 0xff;
tmp.vmods = (val.uval >> 8) & 0xffff;
tmp.defined = True;
tmp.defined = true;
return AddGroupCompat(info, def->group - 1, &tmp);
}
@ -771,7 +771,7 @@ HandleCompatMapFile(XkbFile * file,
static void
CopyInterps(CompatInfo * info,
struct xkb_compat_map * compat, Bool needSymbol, unsigned pred)
struct xkb_compat_map * compat, bool needSymbol, unsigned pred)
{
SymInterpInfo *si;
@ -791,7 +791,7 @@ CopyInterps(CompatInfo * info,
}
}
Bool
bool
CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
LEDInfoPtr *unboundLEDs)
{
@ -811,20 +811,20 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
Success)
{
WSGO("Couldn't allocate compatibility map\n");
return False;
return false;
}
size = info.nInterps * sizeof(struct xkb_sym_interpret);
if (size > 0)
{
CopyInterps(&info, xkb->compat, True, XkbSI_Exactly);
CopyInterps(&info, xkb->compat, True, XkbSI_AllOf | XkbSI_NoneOf);
CopyInterps(&info, xkb->compat, True, XkbSI_AnyOf);
CopyInterps(&info, xkb->compat, True, XkbSI_AnyOfOrNone);
CopyInterps(&info, xkb->compat, False, XkbSI_Exactly);
CopyInterps(&info, xkb->compat, False,
CopyInterps(&info, xkb->compat, true, XkbSI_Exactly);
CopyInterps(&info, xkb->compat, true, XkbSI_AllOf | XkbSI_NoneOf);
CopyInterps(&info, xkb->compat, true, XkbSI_AnyOf);
CopyInterps(&info, xkb->compat, true, XkbSI_AnyOfOrNone);
CopyInterps(&info, xkb->compat, false, XkbSI_Exactly);
CopyInterps(&info, xkb->compat, false,
XkbSI_AllOf | XkbSI_NoneOf);
CopyInterps(&info, xkb->compat, False, XkbSI_AnyOf);
CopyInterps(&info, xkb->compat, False, XkbSI_AnyOfOrNone);
CopyInterps(&info, xkb->compat, false, XkbSI_AnyOf);
CopyInterps(&info, xkb->compat, false, XkbSI_AnyOfOrNone);
}
for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups;
i++, gcm++)
@ -844,10 +844,10 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
info.leds = NULL;
}
ClearCompatInfo(&info, xkb);
return True;
return true;
}
free(info.interps);
return False;
return false;
}
static uint32_t
@ -911,7 +911,7 @@ FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint
for (i = 0; i < xkb->compat->num_si; i++) {
struct xkb_sym_interpret *interp = &xkb->compat->sym_interpret[i];
uint32_t mods;
Bool found;
bool found;
if ((num_syms > 1 || interp->sym != syms[0]) &&
interp->sym != XKB_KEYSYM_NO_SYMBOL)
@ -939,7 +939,7 @@ FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint
found = (interp->mods == mods);
break;
default:
found = False;
found = false;
break;
}
@ -954,7 +954,7 @@ FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint
/**
*/
static Bool
static bool
ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
{
#define INTERP_SIZE (8 * 4)
@ -968,7 +968,7 @@ ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
/* If we've been told not to bind interps to this key, then don't. */
if (xkb->server->explicit[key] & XkbExplicitInterpretMask)
return True;
return true;
for (i = 0; i < INTERP_SIZE; i++)
interps[i] = NULL;
@ -977,7 +977,7 @@ ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
for (level = 0; level < XkbKeyGroupWidth(xkb, key, group); level++) {
i = (group * width) + level;
if (i >= INTERP_SIZE) /* XXX FIXME */
return False;
return false;
interps[i] = FindInterpForKey(xkb, key, group, level);
if (interps[i])
num_acts++;
@ -988,9 +988,9 @@ ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
num_acts = XkbKeyNumGroups(xkb, key) * width;
acts = XkbcResizeKeyActions(xkb, key, num_acts);
if (!num_acts)
return True;
return true;
else if (!acts)
return False;
return false;
for (group = 0; group < XkbKeyNumGroups(xkb, key); group++) {
for (level = 0; level < XkbKeyGroupWidth(xkb, key, group); level++) {
@ -1024,7 +1024,7 @@ ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
if (!(xkb->server->explicit[key] & XkbExplicitVModMapMask))
xkb->server->vmodmap[key] = vmodmask;
return True;
return true;
#undef INTERP_SIZE
}
@ -1034,7 +1034,7 @@ ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
* your actions and types are a lot more useful when any of your modifiers
* other than Shift actually do something ...
*/
Bool
bool
UpdateModifiersFromCompat(struct xkb_keymap *xkb)
{
xkb_keycode_t key;
@ -1044,7 +1044,7 @@ UpdateModifiersFromCompat(struct xkb_keymap *xkb)
* which will also update the vmodmap. */
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++)
if (!ApplyInterpsToKey(xkb, key))
return False;
return false;
/* Update xkb->server->vmods, the virtual -> real mod mapping. */
for (i = 0; i < XkbNumVirtualMods; i++)
@ -1099,5 +1099,5 @@ UpdateModifiersFromCompat(struct xkb_keymap *xkb)
led->mask = led->real_mods | VModsToReal(xkb, led->vmods);
}
return True;
return true;
}

View File

@ -35,7 +35,7 @@
/***====================================================================***/
typedef Bool (*IdentLookupFunc) (const void *priv, xkb_atom_t field,
typedef bool (*IdentLookupFunc) (const void *priv, xkb_atom_t field,
unsigned type, ExprResult *val_rtrn);
/***====================================================================***/
@ -145,23 +145,23 @@ ExprResolveLhs(ExprDef * expr,
elem_rtrn->str = NULL;
field_rtrn->str = XkbcAtomGetString(expr->value.str);
*index_rtrn = NULL;
return True;
return true;
case ExprFieldRef:
elem_rtrn->str = XkbcAtomGetString(expr->value.field.element);
field_rtrn->str = XkbcAtomGetString(expr->value.field.field);
*index_rtrn = NULL;
return True;
return true;
case ExprArrayRef:
elem_rtrn->str = XkbcAtomGetString(expr->value.array.element);
field_rtrn->str = XkbcAtomGetString(expr->value.array.field);
*index_rtrn = expr->value.array.entry;
return True;
return true;
}
WSGO("Unexpected operator %d in ResolveLhs\n", expr->op);
return False;
return false;
}
static Bool
static bool
SimpleLookup(const void * priv, xkb_atom_t field, unsigned type,
ExprResult * val_rtrn)
{
@ -170,7 +170,7 @@ SimpleLookup(const void * priv, xkb_atom_t field, unsigned type,
if ((priv == NULL) || (field == XKB_ATOM_NONE) || (type != TypeInt))
{
return False;
return false;
}
str = XkbcAtomText(field);
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++)
@ -178,10 +178,10 @@ SimpleLookup(const void * priv, xkb_atom_t field, unsigned type,
if (strcasecmp(str, entry->name) == 0)
{
val_rtrn->uval = entry->result;
return True;
return true;
}
}
return False;
return false;
}
static const LookupEntry modIndexNames[] = {
@ -197,25 +197,25 @@ static const LookupEntry modIndexNames[] = {
{NULL, 0}
};
int
bool
LookupModIndex(const void * priv, xkb_atom_t field, unsigned type,
ExprResult * val_rtrn)
{
return SimpleLookup(modIndexNames, field, type, val_rtrn);
}
int
bool
LookupModMask(const void * priv, xkb_atom_t field, unsigned type,
ExprResult * val_rtrn)
{
const char *str;
Bool ret = True;
bool ret = true;
if (type != TypeInt)
return False;
return false;
str = XkbcAtomText(field);
if (str == NULL)
return False;
return false;
if (strcasecmp(str, "all") == 0)
val_rtrn->uval = 0xff;
else if (strcasecmp(str, "none") == 0)
@ -223,7 +223,7 @@ LookupModMask(const void * priv, xkb_atom_t field, unsigned type,
else if (LookupModIndex(priv, field, type, val_rtrn))
val_rtrn->uval = (1 << val_rtrn->uval);
else
ret = False;
ret = false;
return ret;
}
@ -242,10 +242,10 @@ ExprResolveBoolean(ExprDef * expr,
ERROR
("Found constant of type %s where boolean was expected\n",
exprTypeText(expr->type));
return False;
return false;
}
val_rtrn->ival = expr->value.ival;
return True;
return true;
case ExprIdent:
bogus = XkbcAtomText(expr->value.str);
if (bogus)
@ -255,24 +255,24 @@ ExprResolveBoolean(ExprDef * expr,
(strcasecmp(bogus, "on") == 0))
{
val_rtrn->uval = 1;
return True;
return true;
}
else if ((strcasecmp(bogus, "false") == 0) ||
(strcasecmp(bogus, "no") == 0) ||
(strcasecmp(bogus, "off") == 0))
{
val_rtrn->uval = 0;
return True;
return true;
}
}
ERROR("Identifier \"%s\" of type int is unknown\n",
XkbcAtomText(expr->value.str));
return False;
return false;
case ExprFieldRef:
ERROR("Default \"%s.%s\" of type boolean is unknown\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
return false;
case OpInvert:
case OpNot:
ok = ExprResolveBoolean(expr, val_rtrn);
@ -306,7 +306,7 @@ ExprResolveBoolean(ExprDef * expr,
WSGO("Unknown operator %d in ResolveBoolean\n", expr->op);
break;
}
return False;
return false;
}
int
@ -327,19 +327,19 @@ ExprResolveFloat(ExprDef * expr,
if ((str != NULL) && (strlen(str) == 1))
{
val_rtrn->uval = str[0] * XkbGeomPtsPerMM;
return True;
return true;
}
}
if (expr->type != TypeInt)
{
ERROR("Found constant of type %s, expected a number\n",
exprTypeText(expr->type));
return False;
return false;
}
val_rtrn->ival = expr->value.ival;
if (expr->type == TypeInt)
val_rtrn->ival *= XkbGeomPtsPerMM;
return True;
return true;
case ExprIdent:
ERROR("Numeric identifier \"%s\" unknown\n",
XkbcAtomText(expr->value.str));
@ -348,7 +348,7 @@ ExprResolveFloat(ExprDef * expr,
ERROR("Numeric default \"%s.%s\" unknown\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
return false;
case OpAdd:
case OpSubtract:
case OpMultiply:
@ -373,15 +373,15 @@ ExprResolveFloat(ExprDef * expr,
val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
break;
}
return True;
return true;
}
return False;
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;
return false;
case OpInvert:
case OpNegate:
left = expr->value.child;
@ -391,9 +391,9 @@ ExprResolveFloat(ExprDef * expr,
val_rtrn->ival = -leftRtrn.ival;
else
val_rtrn->ival = ~leftRtrn.ival;
return True;
return true;
}
return False;
return false;
case OpUnaryPlus:
left = expr->value.child;
return ExprResolveFloat(left, val_rtrn);
@ -401,7 +401,7 @@ ExprResolveFloat(ExprDef * expr,
WSGO("Unknown operator %d in ResolveFloat\n", expr->op);
break;
}
return False;
return false;
}
int
@ -419,10 +419,10 @@ ExprResolveKeyCode(ExprDef * expr,
ERROR
("Found constant of type %s where an int was expected\n",
exprTypeText(expr->type));
return False;
return false;
}
val_rtrn->uval = expr->value.uval;
return True;
return true;
case OpAdd:
case OpSubtract:
case OpMultiply:
@ -447,17 +447,17 @@ ExprResolveKeyCode(ExprDef * expr,
val_rtrn->uval = leftRtrn.uval / rightRtrn.uval;
break;
}
return True;
return true;
}
return False;
return false;
case OpNegate:
left = expr->value.child;
if (ExprResolveKeyCode(left, &leftRtrn))
{
val_rtrn->uval = ~leftRtrn.uval;
return True;
return true;
}
return False;
return false;
case OpUnaryPlus:
left = expr->value.child;
return ExprResolveKeyCode(left, val_rtrn);
@ -465,7 +465,7 @@ ExprResolveKeyCode(ExprDef * expr,
WSGO("Unknown operator %d in ResolveKeyCode\n", expr->op);
break;
}
return False;
return false;
}
/**
@ -503,10 +503,10 @@ ExprResolveIntegerLookup(ExprDef * expr,
{
case 0:
val_rtrn->uval = 0;
return True;
return true;
case 1:
val_rtrn->uval = str[0];
return True;
return true;
default:
break;
}
@ -516,10 +516,10 @@ ExprResolveIntegerLookup(ExprDef * expr,
ERROR
("Found constant of type %s where an int was expected\n",
exprTypeText(expr->type));
return False;
return false;
}
val_rtrn->ival = expr->value.ival;
return True;
return true;
case ExprIdent:
if (lookup)
{
@ -533,7 +533,7 @@ ExprResolveIntegerLookup(ExprDef * expr,
ERROR("Default \"%s.%s\" of type int is unknown\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
return false;
case OpAdd:
case OpSubtract:
case OpMultiply:
@ -558,15 +558,15 @@ ExprResolveIntegerLookup(ExprDef * expr,
val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
break;
}
return True;
return true;
}
return False;
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;
return false;
case OpInvert:
case OpNegate:
left = expr->value.child;
@ -576,9 +576,9 @@ ExprResolveIntegerLookup(ExprDef * expr,
val_rtrn->ival = -leftRtrn.ival;
else
val_rtrn->ival = ~leftRtrn.ival;
return True;
return true;
}
return False;
return false;
case OpUnaryPlus:
left = expr->value.child;
return ExprResolveIntegerLookup(left, val_rtrn, lookup, lookupPriv);
@ -586,7 +586,7 @@ ExprResolveIntegerLookup(ExprDef * expr,
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
break;
}
return False;
return false;
}
int
@ -614,16 +614,16 @@ ExprResolveGroup(ExprDef * expr,
};
ret = ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup, group_names);
if (ret == False)
if (ret == false)
return ret;
if (val_rtrn->uval == 0 || val_rtrn->uval > XkbNumKbdGroups) {
ERROR("Group index %d is out of range (1..%d)\n",
val_rtrn->uval, XkbNumKbdGroups);
return False;
return false;
}
return True;
return true;
}
int
@ -644,16 +644,16 @@ ExprResolveLevel(ExprDef * expr,
};
ret = ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup, level_names);
if (ret == False)
if (ret == false)
return ret;
if (val_rtrn->ival < 1 || val_rtrn->ival > XkbMaxShiftLevel) {
ERROR("Shift level %d is out of range (1..%d)\n", val_rtrn->ival,
XkbMaxShiftLevel);
return False;
return false;
}
return True;
return true;
}
int
@ -690,21 +690,21 @@ ExprResolveString(ExprDef * expr,
{
ERROR("Found constant of type %s, expected a string\n",
exprTypeText(expr->type));
return False;
return false;
}
val_rtrn->str = XkbcAtomGetString(expr->value.str);
if (val_rtrn->str == NULL)
val_rtrn->str = strdup("");
return True;
return true;
case ExprIdent:
ERROR("Identifier \"%s\" of type string not found\n",
XkbcAtomText(expr->value.str));
return False;
return false;
case ExprFieldRef:
ERROR("Default \"%s.%s\" of type string not found\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
return false;
case OpAdd:
left = expr->value.binary.left;
right = expr->value.binary.right;
@ -720,12 +720,12 @@ ExprResolveString(ExprDef * expr,
free(leftRtrn.str);
free(rightRtrn.str);
val_rtrn->str = new;
return True;
return true;
}
free(leftRtrn.str);
free(rightRtrn.str);
}
return False;
return false;
case OpSubtract:
if (bogus == NULL)
bogus = "Subtraction";
@ -745,18 +745,18 @@ ExprResolveString(ExprDef * expr,
if (bogus == NULL)
bogus = "Bitwise complement";
ERROR("%s of string values not permitted\n", bogus);
return False;
return false;
case OpNot:
ERROR("The ! operator cannot be applied to a string\n");
return False;
return false;
case OpUnaryPlus:
ERROR("The + operator cannot be applied to a string\n");
return False;
return false;
default:
WSGO("Unknown operator %d in ResolveString\n", expr->op);
break;
}
return False;
return false;
}
int
@ -772,19 +772,19 @@ ExprResolveKeyName(ExprDef * expr,
{
ERROR("Found constant of type %s, expected a key name\n",
exprTypeText(expr->type));
return False;
return false;
}
memcpy(val_rtrn->keyName.name, expr->value.keyName, XkbKeyNameLength);
return True;
return true;
case ExprIdent:
ERROR("Identifier \"%s\" of type string not found\n",
XkbcAtomText(expr->value.str));
return False;
return false;
case ExprFieldRef:
ERROR("Default \"%s.%s\" of type key name not found\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
return false;
case OpAdd:
if (bogus == NULL)
bogus = "Addition";
@ -807,18 +807,18 @@ ExprResolveKeyName(ExprDef * expr,
if (bogus == NULL)
bogus = "Bitwise complement";
ERROR("%s of key name values not permitted\n", bogus);
return False;
return false;
case OpNot:
ERROR("The ! operator cannot be applied to a key name\n");
return False;
return false;
case OpUnaryPlus:
ERROR("The + operator cannot be applied to a key name\n");
return False;
return false;
default:
WSGO("Unknown operator %d in ResolveKeyName\n", expr->op);
break;
}
return False;
return false;
}
/***====================================================================***/
@ -830,7 +830,7 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, const LookupEntry * value
{
ERROR("Found a %s where an enumerated value was expected\n",
exprOpText(expr->op));
return False;
return false;
}
if (!SimpleLookup(values, expr->value.str, TypeInt, val_rtrn))
{
@ -847,9 +847,9 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, const LookupEntry * value
nOut++;
}
INFO(")\n");
return False;
return false;
}
return True;
return true;
}
static int
@ -871,10 +871,10 @@ ExprResolveMaskLookup(ExprDef * expr,
ERROR
("Found constant of type %s where a mask was expected\n",
exprTypeText(expr->type));
return False;
return false;
}
val_rtrn->ival = expr->value.ival;
return True;
return true;
case ExprIdent:
ok = (*lookup) (lookupPriv, expr->value.str, TypeInt, val_rtrn);
if (!ok)
@ -885,7 +885,7 @@ ExprResolveMaskLookup(ExprDef * expr,
ERROR("Default \"%s.%s\" of type int is unknown\n",
XkbcAtomText(expr->value.field.element),
XkbcAtomText(expr->value.field.field));
return False;
return false;
case ExprArrayRef:
bogus = "array reference";
case ExprActionDecl:
@ -893,7 +893,7 @@ ExprResolveMaskLookup(ExprDef * expr,
bogus = "function use";
ERROR("Unexpected %s in mask expression\n", bogus);
ACTION("Expression ignored\n");
return False;
return false;
case OpAdd:
case OpSubtract:
case OpMultiply:
@ -916,11 +916,11 @@ ExprResolveMaskLookup(ExprDef * expr,
ERROR("Cannot %s masks\n",
expr->op == OpDivide ? "divide" : "multiply");
ACTION("Illegal operation ignored\n");
return False;
return false;
}
return True;
return true;
}
return False;
return false;
case OpAssign:
WSGO("Assignment operator not implemented yet\n");
break;
@ -929,9 +929,9 @@ ExprResolveMaskLookup(ExprDef * expr,
if (ExprResolveIntegerLookup(left, &leftRtrn, lookup, lookupPriv))
{
val_rtrn->ival = ~leftRtrn.ival;
return True;
return true;
}
return False;
return false;
case OpUnaryPlus:
case OpNegate:
case OpNot:
@ -941,12 +941,12 @@ ExprResolveMaskLookup(ExprDef * expr,
ERROR("The %s operator cannot be used with a mask\n",
(expr->op == OpNegate ? "-" : "!"));
}
return False;
return false;
default:
WSGO("Unknown operator %d in ResolveMask\n", expr->op);
break;
}
return False;
return false;
}
int
@ -987,7 +987,7 @@ ExprResolveKeySym(ExprDef * expr,
sym = xkb_string_to_keysym(str);
if (sym != XKB_KEYSYM_NO_SYMBOL) {
val_rtrn->uval = sym;
return True;
return true;
}
}
}

View File

@ -27,6 +27,8 @@
#ifndef EXPR_H
#define EXPR_H 1
#include <stdbool.h>
typedef union _ExprResult
{
char *str;
@ -49,15 +51,15 @@ typedef struct _LookupEntry
extern const char *
exprOpText(unsigned type);
extern int
extern bool
LookupModMask(const void *priv, xkb_atom_t field, unsigned type,
ExprResult *val_rtrn);
extern int
extern bool
LookupVModMask(const void *priv, xkb_atom_t field, unsigned type,
ExprResult *val_rtrn);
extern int
extern bool
LookupModIndex(const void *priv, xkb_atom_t field, unsigned type,
ExprResult *val_rtrn);

View File

@ -202,9 +202,9 @@ SetIndicatorMapField(LEDInfo * led,
char *field, ExprDef * arrayNdx, ExprDef * value)
{
ExprResult rtrn;
Bool ok;
bool ok;
ok = True;
ok = true;
if ((strcasecmp(field, "modifiers") == 0) ||
(strcasecmp(field, "mods") == 0))
{
@ -301,7 +301,7 @@ SetIndicatorMapField(LEDInfo * led,
rtrn.uval, XkbNumIndicators);
ACTION("Index definition for %s indicator ignored\n",
XkbcAtomText(led->name));
return False;
return false;
}
led->indicator = rtrn.uval;
led->defs.defined |= _LED_Index;
@ -311,7 +311,7 @@ SetIndicatorMapField(LEDInfo * led,
ERROR("Unknown field %s in map for %s indicator\n", field,
XkbcAtomText(led->name));
ACTION("Definition ignored\n");
ok = False;
ok = false;
}
return ok;
}
@ -323,7 +323,7 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
{
LEDInfo led, *rtrn;
VarDef *var;
Bool ok;
bool ok;
if (def->merge != MergeDefault)
merge = def->merge;
@ -332,14 +332,14 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
led.defs.merge = merge;
led.name = def->name;
ok = True;
ok = true;
for (var = def->body; var != NULL; var = (VarDef *) var->common.next)
{
ExprResult elem, field;
ExprDef *arrayNdx;
if (!ExprResolveLhs(var->name, &elem, &field, &arrayNdx))
{
ok = False;
ok = false;
continue;
}
if (elem.str != NULL)
@ -348,7 +348,7 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
("Cannot set defaults for \"%s\" element in indicator map\n",
elem.str);
ACTION("Assignment to %s.%s ignored\n", elem.str, field.str);
ok = False;
ok = false;
}
else
{
@ -366,7 +366,7 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
return NULL;
}
Bool
bool
CopyIndicatorMapDefs(struct xkb_keymap * xkb, LEDInfo *leds, LEDInfo **unboundRtrn)
{
LEDInfo *led, *next;
@ -381,7 +381,7 @@ CopyIndicatorMapDefs(struct xkb_keymap * xkb, LEDInfo *leds, LEDInfo **unboundRt
{
WSGO("Can't allocate indicator maps\n");
ACTION("Indicator map definitions may be lost\n");
return False;
return false;
}
last = unbound = (unboundRtrn ? *unboundRtrn : NULL);
while ((last != NULL) && (last->defs.next != NULL))
@ -433,11 +433,11 @@ CopyIndicatorMapDefs(struct xkb_keymap * xkb, LEDInfo *leds, LEDInfo **unboundRt
{
*unboundRtrn = unbound;
}
return True;
return true;
}
Bool
BindIndicators(struct xkb_keymap * xkb, Bool force, LEDInfo *unbound,
bool
BindIndicators(struct xkb_keymap * xkb, bool force, LEDInfo *unbound,
LEDInfo **unboundRtrn)
{
int i;
@ -566,5 +566,5 @@ BindIndicators(struct xkb_keymap * xkb, Bool force, LEDInfo *unbound,
free(led);
}
}
return True;
return true;
}

View File

@ -66,12 +66,12 @@ extern LEDInfo *
HandleIndicatorMapDef(IndicatorMapDef *stmt, struct xkb_keymap *xkb,
LEDInfo *dflt, LEDInfo *oldLEDs, unsigned mergeMode);
extern Bool
extern bool
CopyIndicatorMapDefs(struct xkb_keymap *xkb, LEDInfo *leds,
LEDInfo **unboundRtrn);
extern Bool
BindIndicators(struct xkb_keymap *xkb, Bool force, LEDInfo *unbound,
extern bool
BindIndicators(struct xkb_keymap *xkb, bool force, LEDInfo *unbound,
LEDInfo **unboundRtrn);
#endif /* INDICATORS_H */

View File

@ -60,7 +60,7 @@ typedef struct _IndicatorNameInfo
CommonInfo defs;
int ndx;
xkb_atom_t name;
Bool virtual;
bool virtual;
} IndicatorNameInfo;
typedef struct _KeyNamesInfo
@ -142,7 +142,7 @@ InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
ii->defs.next = NULL;
ii->ndx = 0;
ii->name = XKB_ATOM_NONE;
ii->virtual = False;
ii->virtual = false;
}
static void
@ -198,11 +198,11 @@ FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
return NULL;
}
static Bool
static bool
AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new)
{
IndicatorNameInfo *old;
Bool replace;
bool replace;
replace = (new->defs.merge == MergeReplace) ||
(new->defs.merge == MergeOverride);
@ -227,7 +227,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new)
{
ACTION("Identical definitions ignored\n");
}
return True;
return true;
}
else
{
@ -299,7 +299,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new)
old->name = new->name;
old->virtual = new->virtual;
}
return True;
return true;
}
old = new;
new = NextIndicatorName(info);
@ -307,12 +307,12 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new)
{
WSGO("Couldn't allocate name for indicator %d\n", old->ndx);
ACTION("Ignored\n");
return False;
return false;
}
new->name = old->name;
new->ndx = old->ndx;
new->virtual = old->virtual;
return True;
return true;
}
static void
@ -366,10 +366,10 @@ FindKeyByLong(KeyNamesInfo * info, unsigned long name)
* keycode. If the same keys is referred to twice, print a warning.
* Note that the key's name is stored as a long, the keycode is the index.
*/
static Bool
static bool
AddKeyName(KeyNamesInfo * info,
xkb_keycode_t kc,
char *name, unsigned merge, unsigned fileID, Bool reportCollisions)
char *name, unsigned merge, unsigned fileID, bool reportCollisions)
{
xkb_keycode_t old;
unsigned long lval;
@ -377,7 +377,7 @@ AddKeyName(KeyNamesInfo * info,
if (kc > info->arraySize && !ResizeKeyNameArrays(info, kc)) {
ERROR("Couldn't resize KeyNames arrays for keycode %d\n", kc);
ACTION("Ignoring key %d\n", kc);
return False;
return false;
}
if (kc < info->computedMin)
info->computedMin = kc;
@ -402,7 +402,7 @@ AddKeyName(KeyNamesInfo * info,
{
if (info->has_alt_forms[kc] || (merge == MergeAltForm))
{
info->has_alt_forms[kc] = True;
info->has_alt_forms[kc] = true;
}
else if (reportCollisions)
{
@ -410,7 +410,7 @@ AddKeyName(KeyNamesInfo * info,
ACTION("Later occurences of \"<%s> = %d\" ignored\n",
buf, kc);
}
return True;
return true;
}
if (merge == MergeAugment)
{
@ -419,7 +419,7 @@ AddKeyName(KeyNamesInfo * info,
WARN("Multiple names for keycode %d\n", kc);
ACTION("Using <%s>, ignoring <%s>\n", buf, name);
}
return True;
return true;
}
else
{
@ -439,7 +439,7 @@ AddKeyName(KeyNamesInfo * info,
{
info->names[old] = 0;
info->files[old] = 0;
info->has_alt_forms[old] = True;
info->has_alt_forms[old] = true;
if (reportCollisions)
{
WARN("Key name <%s> assigned to multiple keys\n", name);
@ -455,17 +455,17 @@ AddKeyName(KeyNamesInfo * info,
ACTION
("Use 'alternate' keyword to assign the same name to multiple keys\n");
}
return True;
return true;
}
else
{
info->has_alt_forms[old] = True;
info->has_alt_forms[old] = true;
}
}
info->names[kc] = lval;
info->files[kc] = fileID;
info->has_alt_forms[kc] = (merge == MergeAltForm);
return True;
return true;
}
/***====================================================================***/
@ -506,7 +506,7 @@ MergeIncludedKeycodes(KeyNamesInfo * into, KeyNamesInfo * from,
thisMerge = MergeAltForm;
else
thisMerge = merge;
if (!AddKeyName(into, i, buf, thisMerge, from->fileID, False))
if (!AddKeyName(into, i, buf, thisMerge, from->fileID, false))
into->errorCount++;
}
if (from->leds)
@ -544,20 +544,20 @@ MergeIncludedKeycodes(KeyNamesInfo * into, KeyNamesInfo * from,
* @param xkb Unused for all but the xkb->flags.
* @param info Struct to store the key info in.
*/
static Bool
static bool
HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_keymap * xkb, KeyNamesInfo * info)
{
unsigned newMerge;
XkbFile *rtrn;
KeyNamesInfo included;
Bool haveSelf;
bool haveSelf;
memset(&included, 0, sizeof(included));
haveSelf = False;
haveSelf = false;
if ((stmt->file == NULL) && (stmt->map == NULL))
{
haveSelf = True;
haveSelf = true;
included = *info;
memset(info, 0, sizeof(KeyNamesInfo));
}
@ -584,7 +584,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_keymap * xkb, KeyNamesInfo
else
{
info->errorCount += 10; /* XXX: why 10?? */
return False;
return false;
}
/* Do we have more than one include statement? */
if ((stmt->next != NULL) && (included.errorCount < 1))
@ -597,7 +597,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_keymap * xkb, KeyNamesInfo
{
if ((next->file == NULL) && (next->map == NULL))
{
haveSelf = True;
haveSelf = true;
MergeIncludedKeycodes(&included, info, next->merge);
ClearKeyNamesInfo(info);
}
@ -614,7 +614,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_keymap * xkb, KeyNamesInfo
{
info->errorCount += 10; /* XXX: Why 10?? */
ClearKeyNamesInfo(&included);
return False;
return false;
}
}
}
@ -652,7 +652,7 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
merge = stmt->merge;
}
return AddKeyName(info, stmt->value, stmt->name, merge, info->fileID,
True);
true);
}
#define MIN_KEYCODE_DEF 0
@ -770,7 +770,7 @@ HandleIndicatorNameDef(IndicatorNameDef * def,
info->errorCount++;
ERROR("Name specified for illegal indicator index %d\n", def->ndx);
ACTION("Ignored\n");
return False;
return false;
}
InitIndicatorNameInfo(&ii, info);
ii.ndx = def->ndx;
@ -785,8 +785,8 @@ HandleIndicatorNameDef(IndicatorNameDef * def,
free(tmp.str);
ii.virtual = def->virtual;
if (!AddIndicatorName(info, &ii))
return False;
return True;
return false;
return true;
}
/**
@ -873,9 +873,9 @@ HandleKeycodesFile(XkbFile * file,
* @param result The effective keycodes, as gathered from the file.
* @param merge Merge strategy.
*
* @return True on success, False otherwise.
* @return true on success, false otherwise.
*/
Bool
bool
CompileKeycodes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
KeyNamesInfo info; /* contains all the info after parsing */
@ -905,7 +905,7 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
else
{
WSGO("Cannot create struct xkb_names in CompileKeycodes\n");
return False;
return false;
}
if (info.leds)
{
@ -934,8 +934,8 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
if (info.aliases)
ApplyAliases(xkb, &info.aliases);
ClearKeyNamesInfo(&info);
return True;
return true;
}
ClearKeyNamesInfo(&info);
return False;
return false;
}

View File

@ -42,7 +42,7 @@ struct xkb_keymap *
CompileKeymap(struct xkb_context *context, XkbFile *file, unsigned merge)
{
unsigned have;
Bool ok;
bool ok;
unsigned required, legal;
unsigned mainType;
const char *mainName;
@ -79,7 +79,7 @@ CompileKeymap(struct xkb_context *context, XkbFile *file, unsigned merge)
default:
ERROR("Cannot compile %s alone into an XKM file\n",
XkbcConfigText(mainType));
return False;
return false;
}
have = 0;
ok = 1;
@ -186,7 +186,7 @@ CompileKeymap(struct xkb_context *context, XkbFile *file, unsigned merge)
xkb->defined = have;
ok = BindIndicators(xkb, True, unbound, NULL);
ok = BindIndicators(xkb, true, unbound, NULL);
if (!ok)
goto err;

View File

@ -56,7 +56,7 @@ typedef struct _KeyTypeInfo
int fileID;
unsigned mask;
unsigned vmask;
Bool groupInfo;
bool groupInfo;
unsigned numLevels;
unsigned nEntries;
unsigned szEntries;
@ -124,7 +124,7 @@ InitKeyTypesInfo(KeyTypesInfo * info, struct xkb_keymap * xkb, KeyTypesInfo * fr
info->dflt.name = XKB_ATOM_NONE;
info->dflt.mask = 0;
info->dflt.vmask = 0;
info->dflt.groupInfo = False;
info->dflt.groupInfo = false;
info->dflt.numLevels = 1;
info->dflt.nEntries = info->dflt.szEntries = 0;
info->dflt.entries = NULL;
@ -237,15 +237,15 @@ FindMatchingKeyType(KeyTypesInfo * info, KeyTypeInfo * new)
return NULL;
}
static Bool
static bool
ReportTypeBadWidth(const char *type, int has, int needs)
{
ERROR("Key type \"%s\" has %d levels, must have %d\n", type, has, needs);
ACTION("Illegal type definition ignored\n");
return False;
return false;
}
static Bool
static bool
AddKeyType(struct xkb_keymap * xkb, KeyTypesInfo * info, KeyTypeInfo * new)
{
KeyTypeInfo *old;
@ -284,7 +284,7 @@ AddKeyType(struct xkb_keymap * xkb, KeyTypesInfo * info, KeyTypeInfo * new)
old = FindMatchingKeyType(info, new);
if (old != NULL)
{
Bool report;
bool report;
if ((new->defs.merge == MergeReplace)
|| (new->defs.merge == MergeOverride))
{
@ -303,7 +303,7 @@ AddKeyType(struct xkb_keymap * xkb, KeyTypesInfo * info, KeyTypeInfo * new)
new->preserve = NULL;
new->lvlNames = NULL;
old->defs.next = &next->defs;
return True;
return true;
}
report = (old->defs.fileID == new->defs.fileID) && (warningLevel > 0);
if (report)
@ -313,11 +313,11 @@ AddKeyType(struct xkb_keymap * xkb, KeyTypesInfo * info, KeyTypeInfo * new)
ACTION("Later definition ignored\n");
}
FreeKeyTypeInfo(new);
return True;
return true;
}
old = NextKeyType(info);
if (old == NULL)
return False;
return false;
*old = *new;
old->defs.next = NULL;
new->nEntries = new->szEntries = 0;
@ -325,7 +325,7 @@ AddKeyType(struct xkb_keymap * xkb, KeyTypesInfo * info, KeyTypeInfo * new)
new->szNames = 0;
new->lvlNames = NULL;
new->preserve = NULL;
return True;
return true;
}
/***====================================================================***/
@ -359,19 +359,19 @@ MergeIncludedKeyTypes(KeyTypesInfo * into,
typedef void (*FileHandler) (XkbFile *file, struct xkb_keymap *xkb,
unsigned merge, KeyTypesInfo *included);
static Bool
static bool
HandleIncludeKeyTypes(IncludeStmt * stmt,
struct xkb_keymap * xkb, KeyTypesInfo * info, FileHandler hndlr)
{
unsigned newMerge;
XkbFile *rtrn;
KeyTypesInfo included;
Bool haveSelf;
bool haveSelf;
haveSelf = False;
haveSelf = false;
if ((stmt->file == NULL) && (stmt->map == NULL))
{
haveSelf = True;
haveSelf = true;
included = *info;
memset(info, 0, sizeof(KeyTypesInfo));
}
@ -394,7 +394,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
else
{
info->errorCount += 10;
return False;
return false;
}
if ((stmt->next != NULL) && (included.errorCount < 1))
{
@ -406,7 +406,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
{
if ((next->file == NULL) && (next->map == NULL))
{
haveSelf = True;
haveSelf = true;
MergeIncludedKeyTypes(&included, info, next->merge, xkb);
FreeKeyTypesInfo(info);
}
@ -425,7 +425,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
{
info->errorCount += 10;
FreeKeyTypesInfo(&included);
return False;
return false;
}
}
}
@ -508,9 +508,9 @@ NextMapEntry(KeyTypeInfo * type)
return &type->entries[type->nEntries++];
}
static Bool
static bool
AddPreserve(struct xkb_keymap * xkb,
KeyTypeInfo * type, PreserveInfo * new, Bool clobber, Bool report)
KeyTypeInfo * type, PreserveInfo * new, bool clobber, bool report)
{
PreserveInfo *old;
@ -532,7 +532,7 @@ AddPreserve(struct xkb_keymap * xkb,
PreserveIndexTxt(xkb, old), TypeTxt(type));
ACTION("Ignored\n");
}
return True;
return true;
}
if (report && (warningLevel > 0))
{
@ -556,20 +556,20 @@ AddPreserve(struct xkb_keymap * xkb,
old->preMods = new->preMods;
old->preVMods = new->preVMods;
}
return True;
return true;
}
old = uTypedAlloc(PreserveInfo);
if (!old)
{
WSGO("Couldn't allocate preserve in %s\n", TypeTxt(type));
ACTION("Preserve[%s] lost\n", PreserveIndexTxt(xkb, new));
return False;
return false;
}
*old = *new;
old->matchingMapIndex = -1;
type->preserve =
(PreserveInfo *) AddCommonInfo(&type->preserve->defs, &old->defs);
return True;
return true;
}
/**
@ -578,12 +578,12 @@ AddPreserve(struct xkb_keymap * xkb,
* entry is created.
*
* @param clobber Overwrite existing entry.
* @param report True if a warning is to be printed on.
* @param report true if a warning is to be printed on.
*/
static Bool
static bool
AddMapEntry(struct xkb_keymap * xkb,
KeyTypeInfo * type,
struct xkb_kt_map_entry * new, Bool clobber, Bool report)
struct xkb_kt_map_entry * new, bool clobber, bool report)
{
struct xkb_kt_map_entry * old;
@ -612,28 +612,28 @@ AddMapEntry(struct xkb_keymap * xkb,
WARN("Multiple occurences of map[%s]= %d in %s\n",
MapEntryTxt(xkb, new), new->level + 1, TypeTxt(type));
ACTION("Ignored\n");
return True;
return true;
}
if (clobber)
old->level = new->level;
return True;
return true;
}
if ((old = NextMapEntry(type)) == NULL)
return False; /* allocation failure, already reported */
return false; /* allocation failure, already reported */
if (new->level >= type->numLevels)
type->numLevels = new->level + 1;
if (new->mods.vmods == 0)
old->active = True;
old->active = true;
else
old->active = False;
old->active = false;
old->mods.mask = new->mods.real_mods;
old->mods.real_mods = new->mods.real_mods;
old->mods.vmods = new->mods.vmods;
old->level = new->level;
return True;
return true;
}
static Bool
static bool
SetMapEntry(KeyTypeInfo * type,
struct xkb_keymap * xkb, ExprDef * arrayNdx, ExprDef * value)
{
@ -665,13 +665,13 @@ SetMapEntry(KeyTypeInfo * type,
{
ERROR("Level specifications in a key type must be integer\n");
ACTION("Ignoring malformed level specification\n");
return False;
return false;
}
entry.level = rtrn.ival - 1;
return AddMapEntry(xkb, type, &entry, True, True);
return AddMapEntry(xkb, type, &entry, true, true);
}
static Bool
static bool
SetPreserve(KeyTypeInfo * type,
struct xkb_keymap * xkb, ExprDef * arrayNdx, ExprDef * value)
{
@ -704,7 +704,7 @@ SetPreserve(KeyTypeInfo * type,
ERROR("Preserve value in a key type is not a modifier mask\n");
ACTION("Ignoring preserve[%s] in type %s\n",
PreserveIndexTxt(xkb, &new), TypeTxt(type));
return False;
return false;
}
new.preMods = rtrn.uval & 0xff;
new.preVMods = (rtrn.uval >> 16) & 0xffff;
@ -724,14 +724,14 @@ SetPreserve(KeyTypeInfo * type,
INFO("%s\n", PreserveIndexTxt(xkb, &new));
}
}
return AddPreserve(xkb, type, &new, True, True);
return AddPreserve(xkb, type, &new, true, true);
}
/***====================================================================***/
static Bool
static bool
AddLevelName(KeyTypeInfo * type,
unsigned level, xkb_atom_t name, Bool clobber, Bool report)
unsigned level, xkb_atom_t name, bool clobber, bool report)
{
if ((type->lvlNames == NULL) || (type->szNames <= level))
{
@ -743,7 +743,7 @@ AddLevelName(KeyTypeInfo * type,
TypeTxt(type));
ACTION("Level names lost\n");
type->szNames = 0;
return False;
return false;
}
type->szNames = level + 1;
}
@ -755,7 +755,7 @@ AddLevelName(KeyTypeInfo * type,
level + 1, TypeTxt(type));
ACTION("Ignored\n");
}
return True;
return true;
}
else if (type->lvlNames[level] != XKB_ATOM_NONE)
{
@ -772,15 +772,15 @@ AddLevelName(KeyTypeInfo * type,
ACTION("Using %s, ignoring %s\n", old, new);
}
if (!clobber)
return True;
return true;
}
if (level >= type->numLevels)
type->numLevels = level + 1;
type->lvlNames[level] = name;
return True;
return true;
}
static Bool
static bool
SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value)
{
ExprResult rtrn;
@ -797,11 +797,11 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value)
ERROR("Non-string name for level %d in key type %s\n", level + 1,
XkbcAtomText(type->name));
ACTION("Ignoring illegal level name definition\n");
return False;
return false;
}
level_name = xkb_intern_atom(rtrn.str);
free(rtrn.str);
return AddLevelName(type, level, level_name, True, True);
return AddLevelName(type, level, level_name, true, true);
}
/***====================================================================***/
@ -811,7 +811,7 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value)
*
* @param field The field to parse (e.g. modifiers, map, level_name)
*/
static Bool
static bool
SetKeyTypeField(KeyTypeInfo * type,
struct xkb_keymap * xkb,
char *field,
@ -832,7 +832,7 @@ SetKeyTypeField(KeyTypeInfo * type,
{
ERROR("Key type mask field must be a modifier mask\n");
ACTION("Key type definition ignored\n");
return False;
return false;
}
mods = tmp.uval & 0xff; /* core mods */
vmods = (tmp.uval >> 8) & 0xffff; /* xkb virtual mods */
@ -842,12 +842,12 @@ SetKeyTypeField(KeyTypeInfo * type,
XkbcAtomText(type->name));
ACTION("Using %s, ", TypeMaskTxt(type, xkb));
INFO("ignoring %s\n", XkbcVModMaskText(xkb, mods, vmods));
return False;
return false;
}
type->mask = mods;
type->vmask = vmods;
type->defs.defined |= _KT_Mask;
return True;
return true;
}
else if (strcasecmp(field, "map") == 0)
{
@ -867,17 +867,17 @@ SetKeyTypeField(KeyTypeInfo * type,
}
ERROR("Unknown field %s in key type %s\n", field, TypeTxt(type));
ACTION("Definition ignored\n");
return False;
return false;
}
static Bool
static bool
HandleKeyTypeVar(VarDef * stmt, struct xkb_keymap * xkb, KeyTypesInfo * info)
{
ExprResult elem, field;
ExprDef *arrayNdx;
if (!ExprResolveLhs(stmt->name, &elem, &field, &arrayNdx))
return False; /* internal error, already reported */
return false; /* internal error, already reported */
if (elem.str && (strcasecmp(elem.str, "type") == 0))
return SetKeyTypeField(&info->dflt, xkb, field.str, arrayNdx,
stmt->value, info);
@ -892,7 +892,7 @@ HandleKeyTypeVar(VarDef * stmt, struct xkb_keymap * xkb, KeyTypesInfo * info)
uStringText(field.str));
ACTION("Ignored\n");
}
return False;
return false;
}
static int
@ -953,7 +953,7 @@ HandleKeyTypeDef(KeyTypeDef * def,
if (!HandleKeyTypeBody(def->body, xkb, &type, info))
{
info->errorCount++;
return False;
return false;
}
/* now copy any appropriate map, preserve or level names from the */
@ -965,7 +965,7 @@ HandleKeyTypeDef(KeyTypeDef * def,
if (((dflt->mods.real_mods & type.mask) == dflt->mods.real_mods) &&
((dflt->mods.vmods & type.vmask) == dflt->mods.vmods))
{
AddMapEntry(xkb, &type, dflt, False, False);
AddMapEntry(xkb, &type, dflt, false, false);
}
}
if (info->dflt.preserve)
@ -976,7 +976,7 @@ HandleKeyTypeDef(KeyTypeDef * def,
if (((dflt->indexMods & type.mask) == dflt->indexMods) &&
((dflt->indexVMods & type.vmask) == dflt->indexVMods))
{
AddPreserve(xkb, &type, dflt, False, False);
AddPreserve(xkb, &type, dflt, false, false);
}
dflt = (PreserveInfo *) dflt->defs.next;
}
@ -985,16 +985,16 @@ HandleKeyTypeDef(KeyTypeDef * def,
{
if ((i < type.numLevels) && (info->dflt.lvlNames[i] != XKB_ATOM_NONE))
{
AddLevelName(&type, i, info->dflt.lvlNames[i], False, False);
AddLevelName(&type, i, info->dflt.lvlNames[i], false, false);
}
}
/* Now add the new keytype to the info struct */
if (!AddKeyType(xkb, info, &type))
{
info->errorCount++;
return False;
return false;
}
return True;
return true;
}
/**
@ -1066,7 +1066,7 @@ HandleKeyTypesFile(XkbFile * file,
}
}
static Bool
static bool
CopyDefToKeyType(struct xkb_keymap * xkb, struct xkb_key_type * type, KeyTypeInfo * def)
{
unsigned int i;
@ -1080,13 +1080,13 @@ CopyDefToKeyType(struct xkb_keymap * xkb, struct xkb_key_type * type, KeyTypeInf
tmp.mods.real_mods = pre->indexMods;
tmp.mods.vmods = pre->indexVMods;
tmp.level = 0;
AddMapEntry(xkb, def, &tmp, False, False);
AddMapEntry(xkb, def, &tmp, false, false);
match = FindMatchingMapEntry(def, pre->indexMods, pre->indexVMods);
if (!match)
{
WSGO("Couldn't find matching entry for preserve\n");
ACTION("Aborting\n");
return False;
return false;
}
pre->matchingMapIndex = match - def->entries;
}
@ -1139,7 +1139,7 @@ CopyDefToKeyType(struct xkb_keymap * xkb, struct xkb_key_type * type, KeyTypeInf
return XkbcComputeEffectiveMap(xkb, type, NULL);
}
Bool
bool
CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
KeyTypesInfo info;
@ -1167,7 +1167,7 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
FreeKeyTypesInfo(&info);
WSGO("Couldn't allocate client map\n");
return False;
return false;
}
xkb->map->num_types = i;
if (XkbAllRequiredTypes & (~info.stdPresent))
@ -1180,7 +1180,7 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
FreeKeyTypesInfo(&info);
WSGO("Couldn't initialize canonical key types\n");
return False;
return false;
}
if (missing & XkbOneLevelMask)
xkb->map->types[XkbOneLevelIndex].name =
@ -1211,14 +1211,14 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
DeleteLevel1MapEntries(def);
if (!CopyDefToKeyType(xkb, type, def)) {
FreeKeyTypesInfo(&info);
return False;
return false;
}
def = (KeyTypeInfo *) def->defs.next;
}
FreeKeyTypesInfo(&info);
return True;
return true;
}
FreeKeyTypesInfo(&info);
return False;
return false;
}

View File

@ -45,9 +45,9 @@
* @param file_rtrn Returns the key map to be used.
* @param merge_rtrn Always returns stmt->merge.
*
* @return True on success or False otherwise.
* @return true on success or false otherwise.
*/
Bool
bool
ProcessIncludeFile(struct xkb_context *context,
IncludeStmt * stmt,
unsigned file_type,
@ -61,14 +61,14 @@ ProcessIncludeFile(struct xkb_context *context,
{
ERROR("Can't find file \"%s\" for %s include\n", stmt->file,
XkbDirectoryForInclude(file_type));
return False;
return false;
}
/* parse the file */
if ((XKBParseFile(file, stmt->file, &rtrn) == 0) || (rtrn == NULL))
{
ERROR("Error interpreting include file \"%s\"\n", stmt->file);
fclose(file);
return False;
return false;
}
fclose(file);
@ -95,7 +95,7 @@ ProcessIncludeFile(struct xkb_context *context,
{
ERROR("No %s named \"%s\" in the include file \"%s\"\n",
XkbcConfigText(file_type), stmt->map, stmt->file);
return False;
return false;
}
}
else if ((rtrn->common.next != NULL) && (warningLevel > 5))
@ -109,14 +109,14 @@ ProcessIncludeFile(struct xkb_context *context,
ERROR("Include file wrong type (expected %s, got %s)\n",
XkbcConfigText(file_type), XkbcConfigText(mapToUse->type));
ACTION("Include file \"%s\" ignored\n", stmt->file);
return False;
return false;
}
/* FIXME: we have to check recursive includes here (or somewhere) */
mapToUse->compiled = True;
mapToUse->compiled = true;
*file_rtrn = mapToUse;
*merge_rtrn = stmt->merge;
return True;
return true;
}
/***====================================================================***/
@ -126,7 +126,7 @@ ReportNotArray(const char *type, const char *field, const char *name)
{
ERROR("The %s %s field is not an array\n", type, field);
ACTION("Ignoring illegal assignment in %s\n", name);
return False;
return false;
}
int
@ -134,7 +134,7 @@ ReportShouldBeArray(const char *type, const char *field, const char *name)
{
ERROR("Missing subscript for %s %s\n", type, field);
ACTION("Ignoring illegal assignment in %s\n", name);
return False;
return false;
}
int
@ -143,7 +143,7 @@ ReportBadType(const char *type, const char *field,
{
ERROR("The %s %s field must be a %s\n", type, field, wanted);
ACTION("Ignoring illegal assignment in %s\n", name);
return False;
return false;
}
int
@ -151,18 +151,18 @@ ReportBadField(const char *type, const char *field, const char *name)
{
ERROR("Unknown %s field %s in %s\n", type, field, name);
ACTION("Ignoring assignment to unknown field in %s\n", name);
return False;
return false;
}
/***====================================================================***/
Bool
bool
UseNewField(unsigned field,
CommonInfo * oldDefs, CommonInfo * newDefs, unsigned *pCollide)
{
Bool useNew;
bool useNew;
useNew = False;
useNew = false;
if (oldDefs->defined & field)
{
if (newDefs->defined & field)
@ -173,11 +173,11 @@ UseNewField(unsigned field,
*pCollide |= field;
}
if (newDefs->merge != MergeAugment)
useNew = True;
useNew = true;
}
}
else if (newDefs->defined & field)
useNew = True;
useNew = true;
return useNew;
}
@ -222,18 +222,18 @@ AddCommonInfo(CommonInfo * old, CommonInfo * new)
*
* @param name The 4-letter name of the key as a long.
* @param kc_rtrn Set to the keycode if the key was found, otherwise 0.
* @param use_aliases True if the key aliases should be searched too.
* @param create If True and the key is not found, it is added to the
* @param use_aliases true if the key aliases should be searched too.
* @param create If true and the key is not found, it is added to the
* xkb->names at the first free keycode.
* @param start_from Keycode to start searching from.
*
* @return True if found, False otherwise.
* @return true if found, false otherwise.
*/
Bool
bool
FindNamedKey(struct xkb_keymap * xkb,
unsigned long name,
xkb_keycode_t *kc_rtrn,
Bool use_aliases, Bool create, xkb_keycode_t start_from)
bool use_aliases, bool create, xkb_keycode_t start_from)
{
unsigned n;
@ -243,7 +243,7 @@ FindNamedKey(struct xkb_keymap * xkb,
}
else if (start_from > xkb->max_key_code)
{
return False;
return false;
}
*kc_rtrn = 0; /* some callers rely on this */
@ -256,14 +256,14 @@ FindNamedKey(struct xkb_keymap * xkb,
if (tmp == name)
{
*kc_rtrn = n;
return True;
return true;
}
}
if (use_aliases)
{
unsigned long new_name;
if (FindKeyNameForAlias(xkb, name, &new_name))
return FindNamedKey(xkb, new_name, kc_rtrn, False, create, 0);
return FindNamedKey(xkb, new_name, kc_rtrn, false, create, 0);
}
}
if (create)
@ -278,7 +278,7 @@ FindNamedKey(struct xkb_keymap * xkb,
ACTION("Key \"%s\" not automatically created\n",
longText(name));
}
return False;
return false;
}
}
/* Find first unused keycode and store our key here */
@ -290,14 +290,14 @@ FindNamedKey(struct xkb_keymap * xkb,
LongToKeyName(name, buf);
memcpy(xkb->names->keys[n].name, buf, XkbKeyNameLength);
*kc_rtrn = n;
return True;
return true;
}
}
}
return False;
return false;
}
Bool
bool
FindKeyNameForAlias(struct xkb_keymap * xkb, unsigned long lname,
unsigned long *real_name)
{
@ -315,9 +315,9 @@ FindKeyNameForAlias(struct xkb_keymap * xkb, unsigned long lname,
if (strncmp(name, a->alias, XkbKeyNameLength) == 0)
{
*real_name = KeyNameToLong(a->real);
return True;
return true;
}
}
}
return False;
return false;
}

View File

@ -35,7 +35,7 @@ typedef struct _CommonInfo
struct _CommonInfo *next;
} CommonInfo;
extern Bool
extern bool
UseNewField(unsigned field, CommonInfo *oldDefs, CommonInfo *newDefs,
unsigned *pCollide);
@ -58,16 +58,16 @@ ReportBadType(const char *type, const char *field, const char *name,
extern int
ReportBadField(const char *type, const char *field, const char *name);
extern Bool
extern bool
ProcessIncludeFile(struct xkb_context *context,
IncludeStmt *stmt, unsigned file_type, XkbFile **file_rtrn,
unsigned *merge_rtrn);
extern Bool
extern bool
FindNamedKey(struct xkb_keymap *xkb, unsigned long name, xkb_keycode_t *kc_rtrn,
Bool use_aliases, Bool create, xkb_keycode_t start_from);
bool use_aliases, bool create, xkb_keycode_t start_from);
extern Bool
extern bool
FindKeyNameForAlias(struct xkb_keymap *xkb, unsigned long lname,
unsigned long *real_name);

View File

@ -28,8 +28,8 @@
#include "xkbmisc.h"
#include "xkbpath.h"
#include "xkbparse.h"
#include <X11/keysym.h>
#include <X11/Xalloca.h>
ParseCommon *
AppendStmt(ParseCommon * to, ParseCommon * append)
@ -348,7 +348,7 @@ IndicatorMapCreate(xkb_atom_t name, VarDef * body)
}
IndicatorNameDef *
IndicatorNameCreate(int ndx, ExprDef * name, Bool virtual)
IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
{
IndicatorNameDef *def;
@ -389,7 +389,7 @@ ActionCreate(xkb_atom_t name, ExprDef * args)
return NULL;
}
static Bool
static bool
ResizeKeysymList(ExprDef *list, unsigned int extra)
{
int i;
@ -407,7 +407,7 @@ ResizeKeysymList(ExprDef *list, unsigned int extra)
if (list->value.list.syms == NULL)
{
FATAL("Couldn't resize list of symbols for append\n");
return False;
return false;
}
}
if (list->value.list.nLevels >= list->value.list.szLevels)
@ -423,7 +423,7 @@ ResizeKeysymList(ExprDef *list, unsigned int extra)
if (list->value.list.symsMapIndex == NULL)
{
FATAL("Couldn't resize keysym index map for append\n");
return False;
return false;
}
list->value.list.symsNumEntries =
uTypedRecalloc(list->value.list.symsNumEntries,
@ -433,13 +433,13 @@ ResizeKeysymList(ExprDef *list, unsigned int extra)
if (list->value.list.symsNumEntries == NULL)
{
FATAL("Couldn't resize num keysym entries for append\n");
return False;
return false;
}
for (i = list->value.list.nLevels; i < list->value.list.szLevels; i++)
list->value.list.symsMapIndex[i] = -1;
}
return True;
return true;
}
ExprDef *
@ -567,9 +567,9 @@ IncludeCreate(char *str, unsigned merge)
IncludeStmt *incl, *first;
char *file, *map, *stmt, *tmp, *extra_data;
char nextop;
Bool haveSelf;
bool haveSelf;
haveSelf = False;
haveSelf = false;
incl = first = NULL;
file = map = NULL;
tmp = str;
@ -582,7 +582,7 @@ IncludeCreate(char *str, unsigned merge)
{
if (haveSelf)
goto BAIL;
haveSelf = True;
haveSelf = true;
}
if (first == NULL)
first = incl = uTypedAlloc(IncludeStmt);
@ -696,7 +696,7 @@ CreateXKBFile(int type, char *name, ParseCommon * defs, unsigned flags)
file->name = name;
file->defs = defs;
file->id = fileID++;
file->compiled = False;
file->compiled = false;
file->flags = flags;
}
return file;

View File

@ -87,7 +87,7 @@ extern IndicatorMapDef *
IndicatorMapCreate(xkb_atom_t name, VarDef *body);
extern IndicatorNameDef *
IndicatorNameCreate(int ndx, ExprDef *name, Bool virtual);
IndicatorNameCreate(int ndx, ExprDef *name, bool virtual);
extern ExprDef *
ActionCreate(xkb_atom_t name, ExprDef *args);

View File

@ -166,8 +166,8 @@ FreeKeyInfo(KeyInfo * info)
* If old is reset, new simply re-uses old's memory. Otherwise, the memory is
* newly allocated and new points to the new memory areas.
*/
static Bool
CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
static bool
CopyKeyInfo(KeyInfo * old, KeyInfo * new, bool clearOld)
{
int i;
@ -200,7 +200,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
new->sizeSyms[i] = 0;
new->numLevels[i] = 0;
new->acts[i] = NULL;
return False;
return false;
}
memcpy(new->syms[i], old->syms[i],
new->sizeSyms[i] * sizeof(xkb_keysym_t));
@ -212,7 +212,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
new->sizeSyms[i] = 0;
new->numLevels[i] = 0;
new->acts[i] = NULL;
return False;
return false;
}
memcpy(new->symsMapIndex[i], old->symsMapIndex[i],
width * sizeof(int));
@ -226,7 +226,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
new->symsMapIndex[i] = NULL;
new->numLevels[i] = 0;
new->acts[i] = NULL;
return False;
return false;
}
memcpy(new->symsMapNumEntries[i], old->symsMapNumEntries[i],
width * sizeof(unsigned int));
@ -244,14 +244,14 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
free(new->symsMapNumEntries[i]);
new->symsMapNumEntries[i] = NULL;
new->numLevels[i] = 0;
return False;
return false;
}
memcpy(new->acts[i], old->acts[i],
width * sizeof(union xkb_action));
}
}
}
return True;
return true;
}
/***====================================================================***/
@ -259,7 +259,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
typedef struct _ModMapEntry
{
CommonInfo defs;
Bool haveSymbol;
bool haveSymbol;
int modifier;
union
{
@ -332,9 +332,9 @@ FreeSymbolsInfo(SymbolsInfo * info)
memset(info, 0, sizeof(SymbolsInfo));
}
static Bool
static bool
ResizeKeyGroup(KeyInfo * key, unsigned int group, unsigned int numLevels,
unsigned sizeSyms, Bool forceActions)
unsigned sizeSyms, bool forceActions)
{
int i;
@ -346,7 +346,7 @@ ResizeKeyGroup(KeyInfo * key, unsigned int group, unsigned int numLevels,
xkb_keysym_t);
if (!key->syms[group]) {
key->sizeSyms[group] = 0;
return False;
return false;
}
key->sizeSyms[group] = sizeSyms;
}
@ -356,7 +356,7 @@ ResizeKeyGroup(KeyInfo * key, unsigned int group, unsigned int numLevels,
numLevels,
int);
if (!key->symsMapIndex[group])
return False;
return false;
for (i = key->numLevels[group]; i < numLevels; i++)
key->symsMapIndex[group][i] = -1;
}
@ -368,7 +368,7 @@ ResizeKeyGroup(KeyInfo * key, unsigned int group, unsigned int numLevels,
numLevels,
unsigned int);
if (!key->symsMapNumEntries[group])
return False;
return false;
}
if ((forceActions &&
(key->numLevels[group] < numLevels || (key->acts[group] == NULL))) ||
@ -379,14 +379,14 @@ ResizeKeyGroup(KeyInfo * key, unsigned int group, unsigned int numLevels,
numLevels,
union xkb_action);
if (!key->acts[group])
return False;
return false;
}
if (key->numLevels[group] < numLevels)
key->numLevels[group] = numLevels;
return True;
return true;
}
static Bool
static bool
MergeKeyGroups(SymbolsInfo * info,
KeyInfo * into, KeyInfo * from, unsigned group)
{
@ -396,7 +396,7 @@ MergeKeyGroups(SymbolsInfo * info,
unsigned int resultSize = 0;
int cur_idx = 0;
int i;
Bool report, clobber;
bool report, clobber;
clobber = (from->defs.merge != MergeAugment);
report = (warningLevel > 9) ||
@ -424,7 +424,7 @@ MergeKeyGroups(SymbolsInfo * info,
ACTION("Group %d of key %s not merged\n", group,
longText(into->name));
return False;
return false;
}
for (i = into->numLevels[group]; i < from->numLevels[group]; i++)
into->symsMapIndex[group][i] = -1;
@ -438,7 +438,7 @@ MergeKeyGroups(SymbolsInfo * info,
WSGO("Could not allocate actions for group merge\n");
ACTION("Group %d of key %s not merged\n", group,
longText(into->name));
return False;
return false;
}
for (i = 0; i < resultWidth; i++)
{
@ -507,7 +507,7 @@ MergeKeyGroups(SymbolsInfo * info,
{
WSGO("Could not allocate symbols for group merge\n");
ACTION("Group %d of key %s not merged\n", group, longText(into->name));
return False;
return false;
}
for (i = 0; i < resultWidth; i++)
@ -584,15 +584,15 @@ out:
into->actsDefined |= (1 << group);
from->actsDefined &= ~(1 << group);
return True;
return true;
}
static Bool
static bool
MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from)
{
int i;
unsigned collide = 0;
Bool report;
bool report;
if (from->defs.merge == MergeReplace)
{
@ -606,7 +606,7 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from)
}
*into = *from;
memset(from, 0, sizeof(KeyInfo));
return True;
return true;
}
report = ((warningLevel > 9) ||
((into->defs.fileID == from->defs.fileID)
@ -711,10 +711,10 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from)
ACTION("Using %s definition for conflicting fields\n",
(from->defs.merge == MergeAugment ? "first" : "last"));
}
return True;
return true;
}
static Bool
static bool
AddKeySymbols(SymbolsInfo * info, KeyInfo * key, struct xkb_keymap * xkb)
{
unsigned int i;
@ -742,17 +742,17 @@ AddKeySymbols(SymbolsInfo * info, KeyInfo * key, struct xkb_keymap * xkb)
{
WSGO("Could not allocate key symbols descriptions\n");
ACTION("Some key symbols definitions may be lost\n");
return False;
return false;
}
}
return CopyKeyInfo(key, &info->keys[info->nKeys++], True);
return CopyKeyInfo(key, &info->keys[info->nKeys++], true);
}
static Bool
static bool
AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
{
ModMapEntry *mm;
Bool clobber;
bool clobber;
clobber = (new->defs.merge != MergeAugment);
for (mm = info->modMap; mm != NULL; mm = (ModMapEntry *) mm->defs.next)
@ -781,7 +781,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
XkbcModIndexText(ignore));
mm->modifier = use;
}
return True;
return true;
}
if ((!new->haveSymbol) && (!mm->haveSymbol) &&
(new->u.keyName == mm->u.keyName))
@ -806,7 +806,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
XkbcModIndexText(ignore));
mm->modifier = use;
}
return True;
return true;
}
}
mm = uTypedAlloc(ModMapEntry);
@ -815,12 +815,12 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
WSGO("Could not allocate modifier map entry\n");
ACTION("Modifier map for %s will be incomplete\n",
XkbcModIndexText(new->modifier));
return False;
return false;
}
*mm = *new;
mm->defs.next = &info->modMap->defs;
info->modMap = mm;
return True;
return true;
}
/***====================================================================***/
@ -879,19 +879,19 @@ MergeIncludedSymbols(SymbolsInfo * into, SymbolsInfo * from,
typedef void (*FileHandler) (XkbFile *rtrn, struct xkb_keymap *xkb,
unsigned merge, SymbolsInfo *included);
static Bool
static bool
HandleIncludeSymbols(IncludeStmt * stmt,
struct xkb_keymap * xkb, SymbolsInfo * info, FileHandler hndlr)
{
unsigned newMerge;
XkbFile *rtrn;
SymbolsInfo included;
Bool haveSelf;
bool haveSelf;
haveSelf = False;
haveSelf = false;
if ((stmt->file == NULL) && (stmt->map == NULL))
{
haveSelf = True;
haveSelf = true;
included = *info;
memset(info, 0, sizeof(SymbolsInfo));
}
@ -921,7 +921,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
else
{
info->errorCount += 10;
return False;
return false;
}
if ((stmt->next != NULL) && (included.errorCount < 1))
{
@ -933,7 +933,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
{
if ((next->file == NULL) && (next->map == NULL))
{
haveSelf = True;
haveSelf = true;
MergeIncludedSymbols(&included, info, next->merge, xkb);
FreeSymbolsInfo(info);
}
@ -960,7 +960,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
{
info->errorCount += 10;
FreeSymbolsInfo(&included);
return False;
return false;
}
}
}
@ -981,7 +981,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
#define SYMBOLS 1
#define ACTIONS 2
static Bool
static bool
GetGroupIndex(KeyInfo * key,
ExprDef * arrayNdx, unsigned what, unsigned *ndx_rtrn)
{
@ -1007,26 +1007,26 @@ GetGroupIndex(KeyInfo * key,
if ((defined & (1 << i)) == 0)
{
*ndx_rtrn = i;
return True;
return true;
}
}
ERROR("Too many groups of %s for key %s (max %d)\n", name,
longText(key->name), XkbNumKbdGroups + 1);
ACTION("Ignoring %s defined for extra groups\n", name);
return False;
return false;
}
if (!ExprResolveGroup(arrayNdx, &tmp))
{
ERROR("Illegal group index for %s of key %s\n", name,
longText(key->name));
ACTION("Definition with non-integer array index ignored\n");
return False;
return false;
}
*ndx_rtrn = tmp.uval - 1;
return True;
return true;
}
static Bool
static bool
AddSymbolsToKey(KeyInfo * key,
struct xkb_keymap * xkb,
char *field,
@ -1037,35 +1037,35 @@ AddSymbolsToKey(KeyInfo * key,
long j;
if (!GetGroupIndex(key, arrayNdx, SYMBOLS, &ndx))
return False;
return false;
if (value == NULL)
{
key->symsDefined |= (1 << ndx);
return True;
return true;
}
if (value->op != ExprKeysymList)
{
ERROR("Expected a list of symbols, found %s\n", exprOpText(value->op));
ACTION("Ignoring symbols for group %d of %s\n", ndx + 1,
longText(key->name));
return False;
return false;
}
if (key->sizeSyms[ndx] != 0)
{
ERROR("Symbols for key %s, group %d already defined\n",
longText(key->name), ndx + 1);
ACTION("Ignoring duplicate definition\n");
return False;
return false;
}
nSyms = value->value.list.nSyms;
nLevels = value->value.list.nLevels;
if (((key->numLevels[ndx] < nSyms) || (key->syms[ndx] == NULL)) &&
(!ResizeKeyGroup(key, ndx, nLevels, nSyms, False)))
(!ResizeKeyGroup(key, ndx, nLevels, nSyms, false)))
{
WSGO("Could not resize group %d of key %s to contain %d levels\n",
ndx + 1, longText(key->name), nSyms);
ACTION("Symbols lost\n");
return False;
return false;
}
key->symsDefined |= (1 << ndx);
for (i = 0; i < nLevels; i++) {
@ -1090,10 +1090,10 @@ AddSymbolsToKey(KeyInfo * key,
for (j = key->numLevels[ndx] - 1;
j >= 0 && key->symsMapNumEntries[ndx][j] == 0; j--)
key->numLevels[ndx]--;
return True;
return true;
}
static Bool
static bool
AddActionsToKey(KeyInfo * key,
struct xkb_keymap * xkb,
char *field,
@ -1105,25 +1105,25 @@ AddActionsToKey(KeyInfo * key,
struct xkb_any_action *toAct;
if (!GetGroupIndex(key, arrayNdx, ACTIONS, &ndx))
return False;
return false;
if (value == NULL)
{
key->actsDefined |= (1 << ndx);
return True;
return true;
}
if (value->op != ExprActionList)
{
WSGO("Bad expression type (%d) for action list value\n", value->op);
ACTION("Ignoring actions for group %d of %s\n", ndx,
longText(key->name));
return False;
return false;
}
if (key->acts[ndx] != NULL)
{
WSGO("Actions for key %s, group %d already defined\n",
longText(key->name), ndx);
return False;
return false;
}
for (nActs = 0, act = value->value.child; act != NULL; nActs++)
{
@ -1132,15 +1132,15 @@ AddActionsToKey(KeyInfo * key,
if (nActs < 1)
{
WSGO("Action list but not actions in AddActionsToKey\n");
return False;
return false;
}
if (((key->numLevels[ndx] < nActs) || (key->acts[ndx] == NULL)) &&
(!ResizeKeyGroup(key, ndx, nActs, nActs, True)))
(!ResizeKeyGroup(key, ndx, nActs, nActs, true)))
{
WSGO("Could not resize group %d of key %s\n", ndx,
longText(key->name));
ACTION("Actions lost\n");
return False;
return false;
}
key->actsDefined |= (1 << ndx);
@ -1156,7 +1156,7 @@ AddActionsToKey(KeyInfo * key,
}
act = (ExprDef *) act->common.next;
}
return True;
return true;
}
static const LookupEntry lockingEntries[] = {
@ -1181,13 +1181,13 @@ static const LookupEntry repeatEntries[] = {
{NULL, 0}
};
static Bool
static bool
SetSymbolsField(KeyInfo * key,
struct xkb_keymap * xkb,
char *field,
ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info)
{
Bool ok = True;
bool ok = true;
ExprResult tmp;
if (strcasecmp(field, "type") == 0)
@ -1210,7 +1210,7 @@ SetSymbolsField(KeyInfo * key,
longText(key->name));
ACTION("Definition with non-integer array index ignored\n");
free(tmp.str);
return False;
return false;
}
else
{
@ -1256,7 +1256,7 @@ SetSymbolsField(KeyInfo * key,
{
ERROR("Radio groups not supported\n");
ACTION("Ignoring radio group specification for key %s\n", longText(key->name));
return False;
return false;
}
else if (uStrCasePrefix("overlay", field) ||
uStrCasePrefix("permanentoverlay", field))
@ -1274,7 +1274,7 @@ SetSymbolsField(KeyInfo * key,
ERROR("Illegal repeat setting for %s\n",
longText(key->name));
ACTION("Non-boolean repeat setting ignored\n");
return False;
return false;
}
key->repeat = tmp.uval;
key->defs.defined |= _Key_Repeat;
@ -1288,7 +1288,7 @@ SetSymbolsField(KeyInfo * key,
ERROR("Illegal groupsWrap setting for %s\n",
longText(key->name));
ACTION("Non-boolean value ignored\n");
return False;
return false;
}
if (tmp.uval)
key->groupInfo = XkbWrapIntoRange;
@ -1305,7 +1305,7 @@ SetSymbolsField(KeyInfo * key,
ERROR("Illegal groupsClamp setting for %s\n",
longText(key->name));
ACTION("Non-boolean value ignored\n");
return False;
return false;
}
if (tmp.uval)
key->groupInfo = XkbClampIntoRange;
@ -1321,7 +1321,7 @@ SetSymbolsField(KeyInfo * key,
ERROR("Illegal group index for redirect of key %s\n",
longText(key->name));
ACTION("Definition with non-integer group ignored\n");
return False;
return false;
}
key->groupInfo =
XkbSetGroupInfo(0, XkbRedirectIntoRange, tmp.uval - 1);
@ -1331,7 +1331,7 @@ SetSymbolsField(KeyInfo * key,
{
ERROR("Unknown field %s in a symbol interpretation\n", field);
ACTION("Definition ignored\n");
ok = False;
ok = false;
}
return ok;
}
@ -1345,25 +1345,25 @@ SetGroupName(SymbolsInfo * info, ExprDef * arrayNdx, ExprDef * value)
{
WARN("You must specify an index when specifying a group name\n");
ACTION("Group name definition without array subscript ignored\n");
return False;
return false;
}
if (!ExprResolveGroup(arrayNdx, &tmp))
{
ERROR("Illegal index in group name definition\n");
ACTION("Definition with non-integer array index ignored\n");
return False;
return false;
}
if (!ExprResolveString(value, &name))
{
ERROR("Group name must be a string\n");
ACTION("Illegal name for group %d ignored\n", tmp.uval);
return False;
return false;
}
info->groupNames[tmp.uval - 1 + info->explicit_group] =
xkb_intern_atom(name.str);
free(name.str);
return True;
return true;
}
static int
@ -1371,7 +1371,7 @@ HandleSymbolsVar(VarDef * stmt, struct xkb_keymap * xkb, SymbolsInfo * info)
{
ExprResult elem, field, tmp;
ExprDef *arrayNdx;
Bool ret;
bool ret;
if (ExprResolveLhs(stmt->name, &elem, &field, &arrayNdx) == 0)
return 0; /* internal error, already reported */
@ -1394,14 +1394,14 @@ HandleSymbolsVar(VarDef * stmt, struct xkb_keymap * xkb, SymbolsInfo * info)
{
ERROR("Illegal setting for global groupsWrap\n");
ACTION("Non-boolean value ignored\n");
ret = False;
ret = false;
}
else {
if (tmp.uval)
info->groupInfo = XkbWrapIntoRange;
else
info->groupInfo = XkbClampIntoRange;
ret = True;
ret = true;
}
}
else if ((elem.str == NULL)
@ -1412,14 +1412,14 @@ HandleSymbolsVar(VarDef * stmt, struct xkb_keymap * xkb, SymbolsInfo * info)
{
ERROR("Illegal setting for global groupsClamp\n");
ACTION("Non-boolean value ignored\n");
return False;
return false;
}
else {
if (tmp.uval)
info->groupInfo = XkbClampIntoRange;
else
info->groupInfo = XkbWrapIntoRange;
ret = True;
ret = true;
}
}
else if ((elem.str == NULL)
@ -1430,19 +1430,19 @@ HandleSymbolsVar(VarDef * stmt, struct xkb_keymap * xkb, SymbolsInfo * info)
{
ERROR("Illegal group index for global groupsRedirect\n");
ACTION("Definition with non-integer group ignored\n");
ret = False;
ret = false;
}
else {
info->groupInfo = XkbSetGroupInfo(0, XkbRedirectIntoRange,
tmp.uval);
ret = True;
ret = true;
}
}
else if ((elem.str == NULL) && (strcasecmp(field.str, "allownone") == 0))
{
ERROR("Radio groups not supported\n");
ACTION("Ignoring \"allow none\" specification\n");
ret = False;
ret = false;
}
else {
ret = SetActionField(xkb, elem.str, field.str, arrayNdx, stmt->value,
@ -1454,11 +1454,11 @@ HandleSymbolsVar(VarDef * stmt, struct xkb_keymap * xkb, SymbolsInfo * info)
return ret;
}
static Bool
static bool
HandleSymbolsBody(VarDef * def,
struct xkb_keymap * xkb, KeyInfo * key, SymbolsInfo * info)
{
Bool ok = True;
bool ok = true;
ExprResult tmp, field;
ExprDef *arrayNdx;
@ -1493,13 +1493,13 @@ HandleSymbolsBody(VarDef * def,
return ok;
}
static Bool
static bool
SetExplicitGroup(SymbolsInfo * info, KeyInfo * key)
{
unsigned group = info->explicit_group;
if (group == 0)
return True;
return true;
if ((key->typesDefined | key->symsDefined | key->actsDefined) & ~1)
{
@ -1534,7 +1534,7 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key)
key->acts[0] = NULL;
key->types[group] = key->types[0];
key->types[0] = 0;
return True;
return true;
}
static int
@ -1544,57 +1544,57 @@ HandleSymbolsDef(SymbolsDef * stmt,
KeyInfo key;
InitKeyInfo(&key);
CopyKeyInfo(&info->dflt, &key, False);
CopyKeyInfo(&info->dflt, &key, false);
key.defs.merge = stmt->merge;
key.name = KeyNameToLong(stmt->keyName);
if (!HandleSymbolsBody((VarDef *) stmt->symbols, xkb, &key, info))
{
info->errorCount++;
return False;
return false;
}
if (!SetExplicitGroup(info, &key))
{
info->errorCount++;
return False;
return false;
}
if (!AddKeySymbols(info, &key, xkb))
{
info->errorCount++;
return False;
return false;
}
return True;
return true;
}
static Bool
static bool
HandleModMapDef(ModMapDef * def,
struct xkb_keymap * xkb, unsigned merge, SymbolsInfo * info)
{
ExprDef *key;
ModMapEntry tmp;
ExprResult rtrn;
Bool ok;
bool ok;
if (!LookupModIndex(NULL, def->modifier, TypeInt, &rtrn))
{
ERROR("Illegal modifier map definition\n");
ACTION("Ignoring map for non-modifier \"%s\"\n",
XkbcAtomText(def->modifier));
return False;
return false;
}
ok = True;
ok = true;
tmp.modifier = rtrn.uval;
for (key = def->keys; key != NULL; key = (ExprDef *) key->common.next)
{
if ((key->op == ExprValue) && (key->type == TypeKeyName))
{
tmp.haveSymbol = False;
tmp.haveSymbol = false;
tmp.u.keyName = KeyNameToLong(key->value.keyName);
}
else if (ExprResolveKeySym(key, &rtrn))
{
tmp.haveSymbol = True;
tmp.haveSymbol = true;
tmp.u.keySym = rtrn.uval;
}
else
@ -1671,7 +1671,7 @@ HandleSymbolsFile(XkbFile * file,
}
}
static Bool
static bool
FindKeyForSymbol(struct xkb_keymap * xkb, xkb_keysym_t sym, xkb_keycode_t *kc_rtrn)
{
xkb_keycode_t key;
@ -1687,12 +1687,12 @@ FindKeyForSymbol(struct xkb_keymap * xkb, xkb_keysym_t sym, xkb_keycode_t *kc_rt
(XkbKeySymEntry(xkb, key, group, level))[0] != sym)
continue;
*kc_rtrn = key;
return True;
return true;
}
}
}
return False;
return false;
}
/**
@ -1701,9 +1701,9 @@ FindKeyForSymbol(struct xkb_keymap * xkb, xkb_keysym_t sym, xkb_keycode_t *kc_rt
* @param atom The atom to search for.
* @param type_rtrn Set to the index of the name if found.
*
* @return True if found, False otherwise.
* @return true if found, false otherwise.
*/
static Bool
static bool
FindNamedType(struct xkb_keymap * xkb, xkb_atom_t atom, unsigned *type_rtrn)
{
unsigned n;
@ -1716,11 +1716,11 @@ FindNamedType(struct xkb_keymap * xkb, xkb_atom_t atom, unsigned *type_rtrn)
if (strcmp(xkb->map->types[n].name, name) == 0)
{
*type_rtrn = n;
return True;
return true;
}
}
}
return False;
return false;
}
/**
@ -1737,17 +1737,17 @@ FindNamedType(struct xkb_keymap * xkb, xkb_atom_t atom, unsigned *type_rtrn)
* @param syms The keysyms for the given key (must be size width).
* @param typeNameRtrn Set to the Atom of the type name.
*
* @returns True if a type could be found, False otherwise.
* @returns true if a type could be found, false otherwise.
*/
static Bool
static bool
FindAutomaticType(int width, xkb_keysym_t * syms, xkb_atom_t * typeNameRtrn,
Bool * autoType)
bool * autoType)
{
*autoType = False;
*autoType = false;
if ((width == 1) || (width == 0))
{
*typeNameRtrn = xkb_intern_atom("ONE_LEVEL");
*autoType = True;
*autoType = true;
}
else if (width == 2)
{
@ -1758,12 +1758,12 @@ FindAutomaticType(int width, xkb_keysym_t * syms, xkb_atom_t * typeNameRtrn,
else if (syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])))
{
*typeNameRtrn = xkb_intern_atom("KEYPAD");
*autoType = True;
*autoType = true;
}
else
{
*typeNameRtrn = xkb_intern_atom("TWO_LEVEL");
*autoType = True;
*autoType = true;
}
}
else if (width <= 4)
@ -1792,7 +1792,7 @@ static void
PrepareKeyDef(KeyInfo * key)
{
int i, j, width, defined, lastGroup;
Bool identical;
bool identical;
defined = key->symsDefined | key->actsDefined | key->typesDefined;
/* get highest group number */
@ -1868,13 +1868,13 @@ PrepareKeyDef(KeyInfo * key)
}
/* If all groups are completely identical remove them all */
/* exept the first one. */
identical = True;
identical = true;
for (i = lastGroup; i > 0; i--)
{
if ((key->numLevels[i] != key->numLevels[0]) ||
(key->types[i] != key->types[0]))
{
identical = False;
identical = false;
break;
}
if ((key->syms[i] != key->syms[0]) &&
@ -1883,7 +1883,7 @@ PrepareKeyDef(KeyInfo * key)
memcmp(key->syms[i], key->syms[0],
sizeof(xkb_keysym_t) * key->sizeSyms[0])))
{
identical = False;
identical = false;
break;
}
if ((key->symsMapIndex[i] != key->symsMapIndex[i]) &&
@ -1891,7 +1891,7 @@ PrepareKeyDef(KeyInfo * key)
memcmp(key->symsMapIndex[i], key->symsMapIndex[0],
key->numLevels[0] * sizeof(int))))
{
identical = False;
identical = false;
continue;
}
if ((key->symsMapNumEntries[i] != key->symsMapNumEntries[i]) &&
@ -1900,7 +1900,7 @@ PrepareKeyDef(KeyInfo * key)
memcmp(key->symsMapNumEntries[i], key->symsMapNumEntries[0],
key->numLevels[0] * sizeof(int))))
{
identical = False;
identical = false;
continue;
}
if ((key->acts[i] != key->acts[0]) &&
@ -1908,7 +1908,7 @@ PrepareKeyDef(KeyInfo * key)
memcmp(key->acts[i], key->acts[0],
sizeof(union xkb_action) * key->numLevels[0])))
{
identical = False;
identical = false;
break;
}
}
@ -1939,7 +1939,7 @@ PrepareKeyDef(KeyInfo * key)
*
* This function recurses.
*/
static Bool
static bool
CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
{
unsigned int i;
@ -1947,7 +1947,7 @@ CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
unsigned int sizeSyms = 0;
unsigned width, tmp, nGroups;
struct xkb_key_type * type;
Bool haveActions, autoType, useAlias;
bool haveActions, autoType, useAlias;
unsigned types[XkbNumKbdGroups];
union xkb_action *outActs;
unsigned int symIndex = 0;
@ -1963,10 +1963,10 @@ CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
WARN("Key %s not found in keycodes\n", longText(key->name));
ACTION("Symbols ignored\n");
}
return False;
return false;
}
haveActions = False;
haveActions = false;
for (i = width = nGroups = 0; i < XkbNumKbdGroups; i++)
{
if (((i + 1) > nGroups)
@ -1974,8 +1974,8 @@ CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
|| (key->typesDefined) & (1 << i)))
nGroups = i + 1;
if (key->acts[i])
haveActions = True;
autoType = False;
haveActions = true;
autoType = false;
/* Assign the type to the key, if it is missing. */
if (key->types[i] == XKB_ATOM_NONE)
{
@ -2037,7 +2037,7 @@ CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
{
WSGO("Could not enlarge symbols for %s (keycode %d)\n",
longText(key->name), kc);
return False;
return false;
}
if (haveActions)
{
@ -2046,7 +2046,7 @@ CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
{
WSGO("Could not enlarge actions for %s (key %d)\n",
longText(key->name), kc);
return False;
return false;
}
xkb->server->explicit[kc] |= XkbExplicitInterpretMask;
}
@ -2134,10 +2134,10 @@ CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
/* do the same thing for the next key */
CopySymbolsDef(xkb, key, kc + 1);
return True;
return true;
}
static Bool
static bool
CopyModMapDef(struct xkb_keymap * xkb, ModMapEntry *entry)
{
xkb_keycode_t kc;
@ -2145,7 +2145,7 @@ CopyModMapDef(struct xkb_keymap * xkb, ModMapEntry *entry)
if ((!entry->haveSymbol)
&&
(!FindNamedKey
(xkb, entry->u.keyName, &kc, True, CreateKeyNames(xkb), 0)))
(xkb, entry->u.keyName, &kc, true, CreateKeyNames(xkb), 0)))
{
if (warningLevel >= 5)
{
@ -2154,7 +2154,7 @@ CopyModMapDef(struct xkb_keymap * xkb, ModMapEntry *entry)
ACTION("Modifier map entry for %s not updated\n",
XkbcModIndexText(entry->modifier));
}
return False;
return false;
}
else if (entry->haveSymbol
&& (!FindKeyForSymbol(xkb, entry->u.keySym, &kc)))
@ -2166,10 +2166,10 @@ CopyModMapDef(struct xkb_keymap * xkb, ModMapEntry *entry)
ACTION("Modifier map entry for %s not updated\n",
XkbcModIndexText(entry->modifier));
}
return False;
return false;
}
xkb->map->modmap[kc] |= (1 << entry->modifier);
return True;
return true;
}
/**
@ -2179,7 +2179,7 @@ CopyModMapDef(struct xkb_keymap * xkb, ModMapEntry *entry)
* @param xkb Handle to the keyboard description to store the symbols in.
* @param merge Merge strategy (e.g. MergeOverride).
*/
Bool
bool
CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
unsigned int i;
@ -2192,7 +2192,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
if (info.nKeys == 0) {
FreeSymbolsInfo(&info);
return False;
return false;
}
if (info.errorCount == 0)
@ -2204,26 +2204,26 @@ CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
WSGO("Can not allocate names in CompileSymbols\n");
ACTION("Symbols not added\n");
return False;
return false;
}
if (XkbcAllocClientMap(xkb, XkbKeySymsMask | XkbModifierMapMask, 0)
!= Success)
{
WSGO("Could not allocate client map in CompileSymbols\n");
ACTION("Symbols not added\n");
return False;
return false;
}
if (XkbcAllocServerMap(xkb, XkbAllServerInfoMask, 32) != Success)
{
WSGO("Could not allocate server map in CompileSymbols\n");
ACTION("Symbols not added\n");
return False;
return false;
}
if (XkbcAllocControls(xkb, XkbPerKeyRepeatMask) != Success)
{
WSGO("Could not allocate controls in CompileSymbols\n");
ACTION("Symbols not added\n");
return False;
return false;
}
/* now copy info into xkb. */
@ -2276,9 +2276,9 @@ CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
}
}
FreeSymbolsInfo(&info);
return True;
return true;
}
FreeSymbolsInfo(&info);
return False;
return false;
}

View File

@ -77,7 +77,7 @@ ClearVModInfo(VModInfo * info, struct xkb_keymap * xkb)
* @param stmt The statement specifying the name and (if any the value).
* @param mergeMode Merge strategy (e.g. MergeOverride)
*/
Bool
bool
HandleVModDef(VModDef * stmt, struct xkb_keymap *xkb, unsigned mergeMode,
VModInfo * info)
{
@ -97,7 +97,7 @@ HandleVModDef(VModDef * stmt, struct xkb_keymap *xkb, unsigned mergeMode,
{ /* already defined */
info->available |= bit;
if (stmt->value == NULL)
return True;
return true;
else
{
const char *str1;
@ -106,23 +106,23 @@ HandleVModDef(VModDef * stmt, struct xkb_keymap *xkb, unsigned mergeMode,
{
str1 = XkbcAtomText(stmt->name);
ACTION("Declaration of %s ignored\n", str1);
return False;
return false;
}
if (mod.uval == srv->vmods[i])
return True;
return true;
str1 = XkbcAtomText(stmt->name);
WARN("Virtual modifier %s multiply defined\n", str1);
str1 = XkbcModMaskText(srv->vmods[i], True);
str1 = XkbcModMaskText(srv->vmods[i], true);
if (mergeMode == MergeOverride)
{
str2 = str1;
str1 = XkbcModMaskText(mod.uval, True);
str1 = XkbcModMaskText(mod.uval, true);
}
ACTION("Using %s, ignoring %s\n", str1, str2);
if (mergeMode == MergeOverride)
srv->vmods[i] = mod.uval;
return True;
return true;
}
}
}
@ -133,21 +133,21 @@ HandleVModDef(VModDef * stmt, struct xkb_keymap *xkb, unsigned mergeMode,
{
ERROR("Too many virtual modifiers defined (maximum %d)\n",
XkbNumVirtualMods);
return False;
return false;
}
info->defined |= (1 << nextFree);
info->newlyDefined |= (1 << nextFree);
info->available |= (1 << nextFree);
names->vmods[nextFree] = XkbcAtomGetString(stmt->name);
if (stmt->value == NULL)
return True;
return true;
if (ExprResolveModMask(stmt->value, &mod))
{
srv->vmods[nextFree] = mod.uval;
return True;
return true;
}
ACTION("Declaration of %s ignored\n", XkbcAtomText(stmt->name));
return False;
return false;
}
/**
@ -155,10 +155,10 @@ HandleVModDef(VModDef * stmt, struct xkb_keymap *xkb, unsigned mergeMode,
*
* @param priv Pointer to the xkb data structure.
* @param field The Atom of the modifier's name (e.g. Atom for LAlt)
* @param type Must be TypeInt, otherwise return False.
* @param type Must be TypeInt, otherwise return false.
* @param val_rtrn Set to the index of the modifier that matches.
*
* @return True on success, False otherwise. If False is returned, val_rtrn is
* @return true on success, false otherwise. If false is returned, val_rtrn is
* undefined.
*/
static int
@ -170,7 +170,7 @@ LookupVModIndex(const struct xkb_keymap *xkb, xkb_atom_t field, unsigned type,
if ((xkb == NULL) || (xkb->names == NULL) || (type != TypeInt))
{
return False;
return false;
}
/* For each named modifier, get the name and compare it to the one passed
* in. If we get a match, return the index of the modifier.
@ -182,10 +182,10 @@ LookupVModIndex(const struct xkb_keymap *xkb, xkb_atom_t field, unsigned type,
if (xkb->names->vmods[i] && strcmp(xkb->names->vmods[i], name) == 0)
{
val_rtrn->uval = i;
return True;
return true;
}
}
return False;
return false;
}
/**
@ -195,24 +195,24 @@ LookupVModIndex(const struct xkb_keymap *xkb, xkb_atom_t field, unsigned type,
* @param priv Pointer to xkb data structure.
* @param val_rtrn Member uval is set to the mask returned.
*
* @return True on success, False otherwise. If False is returned, val_rtrn is
* @return true on success, false otherwise. If false is returned, val_rtrn is
* undefined.
*/
int
bool
LookupVModMask(const void * priv, xkb_atom_t field, unsigned type,
ExprResult * val_rtrn)
{
if (LookupModMask(NULL, field, type, val_rtrn))
{
return True;
return true;
}
else if (LookupVModIndex(priv, field, type, val_rtrn))
{
unsigned ndx = val_rtrn->uval;
val_rtrn->uval = (1 << (XkbNumModifiers + ndx));
return True;
return true;
}
return False;
return false;
}
int
@ -229,7 +229,7 @@ FindKeypadVMod(struct xkb_keymap * xkb)
return -1;
}
Bool
bool
ResolveVirtualModifier(ExprDef * def, struct xkb_keymap *xkb,
ExprResult * val_rtrn, VModInfo * info)
{
@ -246,16 +246,16 @@ ResolveVirtualModifier(ExprDef * def, struct xkb_keymap *xkb,
strcmp(names->vmods[i], name) == 0)
{
val_rtrn->uval = i;
return True;
return true;
}
}
}
if (ExprResolveInteger(def, val_rtrn))
{
if (val_rtrn->uval < XkbNumVirtualMods)
return True;
return true;
ERROR("Illegal virtual modifier %d (must be 0..%d inclusive)\n",
val_rtrn->uval, XkbNumVirtualMods - 1);
}
return False;
return false;
}

View File

@ -42,17 +42,17 @@ InitVModInfo(VModInfo *info, struct xkb_keymap *xkb);
extern void
ClearVModInfo(VModInfo *info, struct xkb_keymap *xkb);
extern Bool
extern bool
HandleVModDef(VModDef *stmt, struct xkb_keymap *xkb, unsigned mergeMode,
VModInfo *info);
extern Bool
extern bool
ApplyVModDefs(VModInfo *info, struct xkb_keymap *xkb);
extern int
FindKeypadVMod(struct xkb_keymap *xkb);
extern Bool
extern bool
ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *xkb,
ExprResult *value_rtrn, VModInfo *info);

View File

@ -230,7 +230,7 @@ typedef struct _IndicatorNameDef
unsigned merge;
int ndx;
ExprDef *name;
Bool virtual;
bool virtual;
} IndicatorNameDef;
typedef struct _IndicatorMapDef
@ -251,28 +251,28 @@ typedef struct _XkbFile
ParseCommon *defs;
int id;
unsigned flags;
Bool compiled;
bool compiled;
} XkbFile;
extern struct xkb_keymap *
CompileKeymap(struct xkb_context *context, XkbFile *file, unsigned merge);
extern Bool
extern bool
CompileKeycodes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
extern Bool
extern bool
CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
typedef struct _LEDInfo *LEDInfoPtr;
extern Bool
extern bool
CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
LEDInfoPtr *unboundLEDs);
extern Bool
extern bool
CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
extern Bool
extern bool
UpdateModifiersFromCompat(struct xkb_keymap *xkb);
#endif /* XKBCOMP_H */

View File

@ -456,9 +456,9 @@ IndicatorMapDecl: INDICATOR String OBRACE VarDeclList CBRACE SEMI
;
IndicatorNameDecl: INDICATOR Integer EQUALS Expr SEMI
{ $$= IndicatorNameCreate($2,$4,False); }
{ $$= IndicatorNameCreate($2,$4,false); }
| VIRTUAL INDICATOR Integer EQUALS Expr SEMI
{ $$= IndicatorNameCreate($3,$5,True); }
{ $$= IndicatorNameCreate($3,$5,true); }
;
ShapeDecl : SHAPE String OBRACE OutlineList CBRACE SEMI

View File

@ -41,7 +41,7 @@
* @param nextop_rtrn Set to the next operation in the complete statement.
* @param extra_data Set to the string between ( and ), if any.
*
* @return True if parsing was succcessful, False for an illegal string.
* @return true if parsing was succcessful, false for an illegal string.
*
* Example: "evdev+aliases(qwerty)"
* str_inout = aliases(qwerty)
@ -58,7 +58,7 @@
* nextop_retrn = ""
*
*/
Bool
bool
XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
char *nextop_rtrn, char **extra_data)
{
@ -112,7 +112,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
else if (str[0] == '(')
{
free(*extra_data);
return False;
return false;
}
else
{
@ -124,7 +124,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
{
free(*file_rtrn);
free(*extra_data);
return False;
return false;
}
*tmp++ = '\0';
*map_rtrn = uDupString(str);
@ -135,8 +135,8 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
else if ((*nextop_rtrn == '|') || (*nextop_rtrn == '+'))
*str_inout = next;
else
return False;
return True;
return false;
return true;
}
/***====================================================================***/

View File

@ -27,6 +27,7 @@
#ifndef _XKBPATH_H_
#define _XKBPATH_H_ 1
#include <stdbool.h>
#include <stdio.h>
#include "XKBcommonint.h"
@ -38,7 +39,7 @@ extern FILE *
XkbFindFileInPath(struct xkb_context *context, const char *name,
unsigned type, char **pathRtrn);
extern Bool
extern bool
XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
char *nextop_rtrn, char **extra_data);

View File

@ -27,7 +27,7 @@ authorization from the authors.
#ifndef _XKBMISC_H_
#define _XKBMISC_H_
#include <X11/Xdefs.h>
#include <stdbool.h>
#include <X11/Xfuncproto.h>
#include "xkbcommon/xkbcommon.h"
@ -39,7 +39,7 @@ typedef uint32_t xkb_atom_t;
/***====================================================================***/
extern Bool
extern bool
XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
unsigned char *map_rtrn);
@ -48,7 +48,7 @@ XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
extern int
XkbcInitCanonicalKeyTypes(struct xkb_keymap * xkb, unsigned which, int keypadVMod);
extern Bool
extern bool
XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
unsigned *mask_rtrn);
@ -68,7 +68,7 @@ _XkbcKSCheckCase(xkb_keysym_t sym);
#define XkbKSIsDeadKey(k) \
(((k) >= XK_dead_grave) && ((k) <= XK_dead_semivoiced_sound))
extern Bool
extern bool
XkbcNameMatchesPattern(char *name, char *ptrn);
/***====================================================================***/
@ -94,7 +94,7 @@ extern const char *
XkbcModIndexText(unsigned ndx);
extern const char *
XkbcModMaskText(unsigned mask, Bool cFormat);
XkbcModMaskText(unsigned mask, bool cFormat);
extern const char *
XkbcConfigText(unsigned config);

View File

@ -27,7 +27,8 @@ authorization from the authors.
#ifndef _XKBRULES_H_
#define _XKBRULES_H_
#include <X11/Xdefs.h>
#include <stdbool.h>
#include "xkbcommon/xkbcommon.h"
/* From filecommon */
@ -145,11 +146,11 @@ typedef struct _XkbRF_Rules {
/* Action structures used in the server */
extern Bool
extern bool
XkbcRF_GetComponents(XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs,
struct xkb_component_names * names);
extern Bool
extern bool
XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules);
extern void