'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.]
#ifndef _XKBCOMMONINT_H_
#define _XKBCOMMONINT_H_
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "xkbcommon/xkbcommon.h"
-#ifndef True
-#define True 1
-#define False 0
-#endif
-
-typedef int Bool;
-
/* From XKM.h */
#define XkmFileVersion 15
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,
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 *
(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++;
}
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)) {
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) {
}
}
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;
}
/***====================================================================***/
int ndx;
char *strtok_buf;
#ifdef DEBUG
- Bool found;
+ bool found;
#endif
remap->number = len;
while ((tok = strtok_r(str, " ", &strtok_buf)) != NULL) {
#ifdef DEBUG
- found= False;
+ found= false;
#endif
str= NULL;
if (strcmp(tok,"=")==0)
ndx = 0;
}
#ifdef DEBUG
- found= True;
+ found= true;
#endif
if (present&(1<<i)) {
if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
remap->number++;
}
-static Bool
+static bool
MatchOneOf(char *wanted,char *vals_defined)
{
char *str, *next;
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,
int nread, i;
FileSpec tmp;
char *strtok_buf;
- Bool append = False;
+ bool append = false;
if (line->line[0]=='!') {
if (line->line[1] == '$' ||
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++) {
}
}
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;
}
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;
rule->variant_num = remap->remap[i].index;
}
}
- return True;
+ return true;
}
static char *
*p1 = '\0';
}
-static Bool
+static bool
MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
{
memset(mdefs, 0, sizeof(XkbRF_MultiDefsRec));
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++) {
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++) {
*p = '\0';
}
}
- return True;
+ return true;
}
static void
Apply(rule->keymap, &names->keymap);
}
-static Bool
+static bool
CheckGroup( XkbRF_RulesPtr rules,
const char * group_name,
const char * name)
}
}
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
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))
*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,
*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,
/***====================================================================***/
-Bool
+bool
XkbcRF_GetComponents( XkbRF_RulesPtr rules,
XkbRF_VarDefsPtr defs,
struct xkb_component_names * names)
return &rules->groups[rules->num_groups++];
}
-Bool
+bool
XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules)
{
InputLine line;
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) {
line.num_line= 0;
}
FreeInputLine(&line);
- return True;
+ return true;
}
static void
#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[]= {
#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] = {
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);
return Success;
}
-Bool
+bool
XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
unsigned *mask_rtrn)
{
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)
}
*mask_rtrn = mask;
- return True;
+ return true;
}
/*
#define UNMATCHABLE(c) ((c) == '(' || (c) == ')' || (c) == '/')
-Bool
+bool
XkbcNameMatchesPattern(char *name, char *ptrn)
{
while (ptrn[0] != '\0') {
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++;
return "none";
if (modMask != 0)
- mm = XkbcModMaskText(modMask, False);
+ mm = XkbcModMaskText(modMask, false);
str = buf;
buf[0]= '\0';
}
const char *
-XkbcModMaskText(unsigned mask, Bool cFormat)
+XkbcModMaskText(unsigned mask, bool cFormat)
{
int i, rem, bit;
char *str, *buf;
static char *preMsg = NULL;
static char *prefix = NULL;
-Bool
+bool
uSetErrorFile(char *name)
{
if ((errorFile != NULL) && (errorFile != stderr))
if (errorFile == NULL)
{
errorFile = stderr;
- return (False);
+ return false;
}
- return (True);
+ return true;
}
void
/***====================================================================***/
+#include <stdbool.h>
#include <stdio.h>
-#include <X11/Xdefs.h>
+
#include <X11/Xfuncproto.h>
extern void *
/***====================================================================***/
-extern Bool
+extern bool
uSetErrorFile(char *name);
#define INFO uInformation
old ? old->types : NULL);
}
-Bool
+bool
XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
unsigned char *map_rtrn)
{
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;
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;
}
}
map_rtrn[type->map[i].mods.mask] = type->map[i].level;
}
- return True;
+ return true;
}
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 *
#include "action.h"
#include "misc.h"
-static Bool actionsInitialized;
+static bool actionsInitialized;
static ExprDef constTrue;
static ExprDef constFalse;
{ 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 *
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);
/***====================================================================***/
-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)
return ReportIllegal(action->type, field);
}
-static Bool
+static bool
CheckLatchLockFlags(unsigned action,
unsigned field, ExprDef * value, unsigned *flags_inout)
{
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,
*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)
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))
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)
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)
{
*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)
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)
{
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)))
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)
act->flags |= XkbSA_MoveAbsoluteY;
act->y = rtrn.ival;
}
- return True;
+ return true;
}
else if (field == F_Accel)
{
{NULL, 0}
};
-static Bool
+static bool
HandlePtrBtn(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
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))
{
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)
{
{
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);
}
{NULL, 0}
};
-static Bool
+static bool
HandleSetPtrDflt(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
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))
{
{
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);
}
{NULL, 0},
};
-static Bool
+static bool
HandleISOLock(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
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);
{
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)
{
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)
{
act->flags &= ~XkbSA_SwitchApplication;
else
act->flags |= XkbSA_SwitchApplication;
- return True;
+ return true;
}
return ReportIllegal(action->type, field);
}
{NULL, 0}
};
-static Bool
+static bool
HandleSetLockControls(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
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);
}
{NULL, 0}
};
-static Bool
+static bool
HandleActionMessage(struct xkb_keymap * xkb,
struct xkb_any_action * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
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);
act->flags |= XkbSA_MessageGenKeyEvent;
else
act->flags &= ~XkbSA_MessageGenKeyEvent;
- return True;
+ return true;
case F_Data:
if (array_ndx == NULL)
{
}
strncpy((char *) act->message, rtrn.str, 6);
}
- return True;
+ return true;
}
else
{
{
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");
{
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)
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;
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)
{
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))
{
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)
{
{
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)
{
{
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)
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)
{
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)
{
{
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
{
{
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");
{
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);
{
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)
info->array_ndx,
info->value))
{
- return False;
+ return false;
}
}
info = info->next;
}
}
if (!ExprResolveLhs(field, &elemRtrn, &fieldRtrn, &arrayRtrn))
- return False; /* internal error -- already reported */
+ return false; /* internal error -- already reported */
if (elemRtrn.str != NULL)
{
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;
}
/***====================================================================***/
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;
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;
*info_rtrn = new;
else
old->next = new;
- return True;
+ return true;
}
/***====================================================================***/
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;
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
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)
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
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;
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)
{
continue;
}
lname = KeyNameToLong(info->alias);
- if (FindNamedKey(xkb, lname, &kc, False, False, 0))
+ if (FindNamedKey(xkb, lname, &kc, false, false, 0))
{
if (warningLevel > 4)
{
{
ClearCommonInfo(&(*info_in)->def);
*info_in = NULL;
- return True;
+ return true;
}
status = XkbcAllocNames(xkb, XkbKeyAliasesMask, nOld + nNew);
if (xkb->names)
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)
#endif
ClearCommonInfo(&(*info_in)->def);
*info_in = NULL;
- return True;
+ return true;
}
extern void
ClearAliases(AliasInfo **info);
-extern Bool
+extern bool
MergeAliases(AliasInfo **into, AliasInfo **merge, unsigned how_merge);
extern int
{
unsigned char fileID;
unsigned char merge;
- Bool defined;
+ bool defined;
unsigned char real_mods;
xkb_atom_t vmods;
} GroupCompatInfo;
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;
}
return NULL;
}
-static Bool
+static bool
AddInterp(CompatInfo * info, SymInterpInfo * new)
{
unsigned collide;
}
*old = *new;
old->defs.next = &next->defs;
- return True;
+ return true;
}
if (UseNewField(_SI_VirtualMod, &old->defs, &new->defs, &collide))
{
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;
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))
}
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)
{
*pred_rtrn = XkbSI_AnyOfOrNone;
*mods_rtrn = ~0;
- return True;
+ return true;
}
*pred_rtrn = XkbSI_Exactly;
{
ERROR("Illegal modifier predicate \"%s\"\n", pred_txt);
ACTION("Ignored\n");
- return False;
+ return false;
}
expr = expr->value.action.args;
}
{
*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;
}
/***====================================================================***/
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));
}
else
{
info->errorCount += 10;
- return False;
+ return false;
}
if ((stmt->next != NULL) && (included.errorCount < 1))
{
{
if ((next->file == NULL) && (next->map == NULL))
{
- haveSelf = True;
+ haveSelf = true;
MergeIncludedCompatMaps(&included, info, next->merge);
ClearCompatInfo(info, xkb);
}
else
{
info->errorCount += 10;
- return False;
+ return false;
}
}
}
{
ERROR("Couldn't determine matching modifiers\n");
ACTION("Symbol interpretation ignored\n");
- return False;
+ return false;
}
if (def->merge != MergeDefault)
merge = def->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
XkbNumKbdGroups + 1);
ACTION("Compatibility map for illegal group %d ignored\n",
def->group);
- return False;
+ return false;
}
tmp.fileID = info->fileID;
tmp.merge = merge;
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);
}
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;
}
}
-Bool
+bool
CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
LEDInfoPtr *unboundLEDs)
{
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++)
info.leds = NULL;
}
ClearCompatInfo(&info, xkb);
- return True;
+ return true;
}
free(info.interps);
- return False;
+ return false;
}
static uint32_t
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)
found = (interp->mods == mods);
break;
default:
- found = False;
+ found = false;
break;
}
/**
*/
-static Bool
+static bool
ApplyInterpsToKey(struct xkb_keymap *xkb, xkb_keycode_t key)
{
#define INTERP_SIZE (8 * 4)
/* 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;
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++;
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++) {
if (!(xkb->server->explicit[key] & XkbExplicitVModMapMask))
xkb->server->vmodmap[key] = vmodmask;
- return True;
+ return true;
#undef INTERP_SIZE
}
* 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;
* 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++)
led->mask = led->real_mods | VModsToReal(xkb, led->vmods);
}
- return True;
+ return true;
}
/***====================================================================***/
-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);
/***====================================================================***/
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)
{
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++)
if (strcasecmp(str, entry->name) == 0)
{
val_rtrn->uval = entry->result;
- return True;
+ return true;
}
}
- return False;
+ return false;
}
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)
else if (LookupModIndex(priv, field, type, val_rtrn))
val_rtrn->uval = (1 << val_rtrn->uval);
else
- ret = False;
+ ret = false;
return ret;
}
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)
(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);
WSGO("Unknown operator %d in ResolveBoolean\n", expr->op);
break;
}
- return False;
+ return false;
}
int
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));
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:
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;
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);
WSGO("Unknown operator %d in ResolveFloat\n", expr->op);
break;
}
- return False;
+ return false;
}
int
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:
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);
WSGO("Unknown operator %d in ResolveKeyCode\n", expr->op);
break;
}
- return False;
+ return false;
}
/**
{
case 0:
val_rtrn->uval = 0;
- return True;
+ return true;
case 1:
val_rtrn->uval = str[0];
- return True;
+ return true;
default:
break;
}
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)
{
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:
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;
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);
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
break;
}
- return False;
+ return false;
}
int
};
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
};
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
{
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;
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";
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
{
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";
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;
}
/***====================================================================***/
{
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))
{
nOut++;
}
INFO(")\n");
- return False;
+ return false;
}
- return True;
+ return true;
}
static int
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)
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:
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:
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;
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:
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
sym = xkb_string_to_keysym(str);
if (sym != XKB_KEYSYM_NO_SYMBOL) {
val_rtrn->uval = sym;
- return True;
+ return true;
}
}
}
#ifndef EXPR_H
#define EXPR_H 1
+#include <stdbool.h>
+
typedef union _ExprResult
{
char *str;
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);
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))
{
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;
ERROR("Unknown field %s in map for %s indicator\n", field,
XkbcAtomText(led->name));
ACTION("Definition ignored\n");
- ok = False;
+ ok = false;
}
return ok;
}
{
LEDInfo led, *rtrn;
VarDef *var;
- Bool ok;
+ bool ok;
if (def->merge != MergeDefault)
merge = def->merge;
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)
("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
{
return NULL;
}
-Bool
+bool
CopyIndicatorMapDefs(struct xkb_keymap * xkb, LEDInfo *leds, LEDInfo **unboundRtrn)
{
LEDInfo *led, *next;
{
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))
{
*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;
free(led);
}
}
- return True;
+ return true;
}
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 */
CommonInfo defs;
int ndx;
xkb_atom_t name;
- Bool virtual;
+ bool virtual;
} IndicatorNameInfo;
typedef struct _KeyNamesInfo
ii->defs.next = NULL;
ii->ndx = 0;
ii->name = XKB_ATOM_NONE;
- ii->virtual = False;
+ ii->virtual = false;
}
static void
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);
{
ACTION("Identical definitions ignored\n");
}
- return True;
+ return true;
}
else
{
old->name = new->name;
old->virtual = new->virtual;
}
- return True;
+ return true;
}
old = new;
new = NextIndicatorName(info);
{
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
* 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;
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;
{
if (info->has_alt_forms[kc] || (merge == MergeAltForm))
{
- info->has_alt_forms[kc] = True;
+ info->has_alt_forms[kc] = true;
}
else if (reportCollisions)
{
ACTION("Later occurences of \"<%s> = %d\" ignored\n",
buf, kc);
}
- return True;
+ return true;
}
if (merge == MergeAugment)
{
WARN("Multiple names for keycode %d\n", kc);
ACTION("Using <%s>, ignoring <%s>\n", buf, name);
}
- return True;
+ return true;
}
else
{
{
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);
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;
}
/***====================================================================***/
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)
* @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));
}
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))
{
if ((next->file == NULL) && (next->map == NULL))
{
- haveSelf = True;
+ haveSelf = true;
MergeIncludedKeycodes(&included, info, next->merge);
ClearKeyNamesInfo(info);
}
{
info->errorCount += 10; /* XXX: Why 10?? */
ClearKeyNamesInfo(&included);
- return False;
+ return false;
}
}
}
merge = stmt->merge;
}
return AddKeyName(info, stmt->value, stmt->name, merge, info->fileID,
- True);
+ true);
}
#define MIN_KEYCODE_DEF 0
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;
free(tmp.str);
ii.virtual = def->virtual;
if (!AddIndicatorName(info, &ii))
- return False;
- return True;
+ return false;
+ return true;
}
/**
* @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 */
else
{
WSGO("Cannot create struct xkb_names in CompileKeycodes\n");
- return False;
+ return false;
}
if (info.leds)
{
if (info.aliases)
ApplyAliases(xkb, &info.aliases);
ClearKeyNamesInfo(&info);
- return True;
+ return true;
}
ClearKeyNamesInfo(&info);
- return False;
+ return false;
}
CompileKeymap(struct xkb_context *context, XkbFile *file, unsigned merge)
{
unsigned have;
- Bool ok;
+ bool ok;
unsigned required, legal;
unsigned mainType;
const char *mainName;
default:
ERROR("Cannot compile %s alone into an XKM file\n",
XkbcConfigText(mainType));
- return False;
+ return false;
}
have = 0;
ok = 1;
xkb->defined = have;
- ok = BindIndicators(xkb, True, unbound, NULL);
+ ok = BindIndicators(xkb, true, unbound, NULL);
if (!ok)
goto err;
int fileID;
unsigned mask;
unsigned vmask;
- Bool groupInfo;
+ bool groupInfo;
unsigned numLevels;
unsigned nEntries;
unsigned szEntries;
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;
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;
old = FindMatchingKeyType(info, new);
if (old != NULL)
{
- Bool report;
+ bool report;
if ((new->defs.merge == MergeReplace)
|| (new->defs.merge == MergeOverride))
{
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)
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;
new->szNames = 0;
new->lvlNames = NULL;
new->preserve = NULL;
- return True;
+ return true;
}
/***====================================================================***/
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));
}
else
{
info->errorCount += 10;
- return False;
+ return false;
}
if ((stmt->next != NULL) && (included.errorCount < 1))
{
{
if ((next->file == NULL) && (next->map == NULL))
{
- haveSelf = True;
+ haveSelf = true;
MergeIncludedKeyTypes(&included, info, next->merge, xkb);
FreeKeyTypesInfo(info);
}
{
info->errorCount += 10;
FreeKeyTypesInfo(&included);
- return False;
+ return false;
}
}
}
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;
PreserveIndexTxt(xkb, old), TypeTxt(type));
ACTION("Ignored\n");
}
- return True;
+ return true;
}
if (report && (warningLevel > 0))
{
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;
}
/**
* 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;
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)
{
{
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)
{
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;
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))
{
TypeTxt(type));
ACTION("Level names lost\n");
type->szNames = 0;
- return False;
+ return false;
}
type->szNames = level + 1;
}
level + 1, TypeTxt(type));
ACTION("Ignored\n");
}
- return True;
+ return true;
}
else if (type->lvlNames[level] != XKB_ATOM_NONE)
{
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;
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);
}
/***====================================================================***/
*
* @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,
{
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 */
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)
{
}
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);
uStringText(field.str));
ACTION("Ignored\n");
}
- return False;
+ return false;
}
static int
if (!HandleKeyTypeBody(def->body, xkb, &type, info))
{
info->errorCount++;
- return False;
+ return false;
}
/* now copy any appropriate map, preserve or level names from the */
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)
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;
}
{
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;
}
/**
}
}
-static Bool
+static bool
CopyDefToKeyType(struct xkb_keymap * xkb, struct xkb_key_type * type, KeyTypeInfo * def)
{
unsigned int i;
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;
}
return XkbcComputeEffectiveMap(xkb, type, NULL);
}
-Bool
+bool
CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge)
{
KeyTypesInfo info;
{
FreeKeyTypesInfo(&info);
WSGO("Couldn't allocate client map\n");
- return False;
+ return false;
}
xkb->map->num_types = i;
if (XkbAllRequiredTypes & (~info.stdPresent))
{
FreeKeyTypesInfo(&info);
WSGO("Couldn't initialize canonical key types\n");
- return False;
+ return false;
}
if (missing & XkbOneLevelMask)
xkb->map->types[XkbOneLevelIndex].name =
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;
}
* @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,
{
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);
{
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))
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;
}
/***====================================================================***/
{
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
{
ERROR("Missing subscript for %s %s\n", type, field);
ACTION("Ignoring illegal assignment in %s\n", name);
- return False;
+ return false;
}
int
{
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
{
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)
*pCollide |= field;
}
if (newDefs->merge != MergeAugment)
- useNew = True;
+ useNew = true;
}
}
else if (newDefs->defined & field)
- useNew = True;
+ useNew = true;
return useNew;
}
*
* @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;
}
else if (start_from > xkb->max_key_code)
{
- return False;
+ return false;
}
*kc_rtrn = 0; /* some callers rely on this */
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)
ACTION("Key \"%s\" not automatically created\n",
longText(name));
}
- return False;
+ return false;
}
}
/* Find first unused keycode and store our key here */
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)
{
if (strncmp(name, a->alias, XkbKeyNameLength) == 0)
{
*real_name = KeyNameToLong(a->real);
- return True;
+ return true;
}
}
}
- return False;
+ return false;
}
struct _CommonInfo *next;
} CommonInfo;
-extern Bool
+extern bool
UseNewField(unsigned field, CommonInfo *oldDefs, CommonInfo *newDefs,
unsigned *pCollide);
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);
#include "xkbmisc.h"
#include "xkbpath.h"
#include "xkbparse.h"
+
#include <X11/keysym.h>
-#include <X11/Xalloca.h>
ParseCommon *
AppendStmt(ParseCommon * to, ParseCommon * append)
}
IndicatorNameDef *
-IndicatorNameCreate(int ndx, ExprDef * name, Bool virtual)
+IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
{
IndicatorNameDef *def;
return NULL;
}
-static Bool
+static bool
ResizeKeysymList(ExprDef *list, unsigned int extra)
{
int i;
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)
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,
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 *
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;
{
if (haveSelf)
goto BAIL;
- haveSelf = True;
+ haveSelf = true;
}
if (first == NULL)
first = incl = uTypedAlloc(IncludeStmt);
file->name = name;
file->defs = defs;
file->id = fileID++;
- file->compiled = False;
+ file->compiled = false;
file->flags = flags;
}
return file;
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);
* 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;
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));
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));
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));
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;
}
/***====================================================================***/
typedef struct _ModMapEntry
{
CommonInfo defs;
- Bool haveSymbol;
+ bool haveSymbol;
int modifier;
union
{
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;
xkb_keysym_t);
if (!key->syms[group]) {
key->sizeSyms[group] = 0;
- return False;
+ return false;
}
key->sizeSyms[group] = sizeSyms;
}
numLevels,
int);
if (!key->symsMapIndex[group])
- return False;
+ return false;
for (i = key->numLevels[group]; i < numLevels; i++)
key->symsMapIndex[group][i] = -1;
}
numLevels,
unsigned int);
if (!key->symsMapNumEntries[group])
- return False;
+ return false;
}
if ((forceActions &&
(key->numLevels[group] < numLevels || (key->acts[group] == NULL))) ||
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)
{
unsigned int resultSize = 0;
int cur_idx = 0;
int i;
- Bool report, clobber;
+ bool report, clobber;
clobber = (from->defs.merge != MergeAugment);
report = (warningLevel > 9) ||
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;
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++)
{
{
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++)
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)
{
}
*into = *from;
memset(from, 0, sizeof(KeyInfo));
- return True;
+ return true;
}
report = ((warningLevel > 9) ||
((into->defs.fileID == from->defs.fileID)
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;
{
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)
XkbcModIndexText(ignore));
mm->modifier = use;
}
- return True;
+ return true;
}
if ((!new->haveSymbol) && (!mm->haveSymbol) &&
(new->u.keyName == mm->u.keyName))
XkbcModIndexText(ignore));
mm->modifier = use;
}
- return True;
+ return true;
}
}
mm = uTypedAlloc(ModMapEntry);
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;
}
/***====================================================================***/
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));
}
else
{
info->errorCount += 10;
- return False;
+ return false;
}
if ((stmt->next != NULL) && (included.errorCount < 1))
{
{
if ((next->file == NULL) && (next->map == NULL))
{
- haveSelf = True;
+ haveSelf = true;
MergeIncludedSymbols(&included, info, next->merge, xkb);
FreeSymbolsInfo(info);
}
{
info->errorCount += 10;
FreeSymbolsInfo(&included);
- return False;
+ return false;
}
}
}
#define SYMBOLS 1
#define ACTIONS 2
-static Bool
+static bool
GetGroupIndex(KeyInfo * key,
ExprDef * arrayNdx, unsigned what, unsigned *ndx_rtrn)
{
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,
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++) {
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,
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++)
{
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);
}
act = (ExprDef *) act->common.next;
}
- return True;
+ return true;
}
static const LookupEntry lockingEntries[] = {
{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)
longText(key->name));
ACTION("Definition with non-integer array index ignored\n");
free(tmp.str);
- return False;
+ return false;
}
else
{
{
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))
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;
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;
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;
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);
{
ERROR("Unknown field %s in a symbol interpretation\n", field);
ACTION("Definition ignored\n");
- ok = False;
+ ok = false;
}
return ok;
}
{
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
{
ExprResult elem, field, tmp;
ExprDef *arrayNdx;
- Bool ret;
+ bool ret;
if (ExprResolveLhs(stmt->name, &elem, &field, &arrayNdx) == 0)
return 0; /* internal error, already reported */
{
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)
{
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)
{
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,
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;
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)
{
key->acts[0] = NULL;
key->types[group] = key->types[0];
key->types[0] = 0;
- return True;
+ return true;
}
static int
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
}
}
-static Bool
+static bool
FindKeyForSymbol(struct xkb_keymap * xkb, xkb_keysym_t sym, xkb_keycode_t *kc_rtrn)
{
xkb_keycode_t key;
(XkbKeySymEntry(xkb, key, group, level))[0] != sym)
continue;
*kc_rtrn = key;
- return True;
+ return true;
}
}
}
- return False;
+ return false;
}
/**
* @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;
if (strcmp(xkb->map->types[n].name, name) == 0)
{
*type_rtrn = n;
- return True;
+ return true;
}
}
}
- return False;
+ return false;
}
/**
* @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)
{
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)
PrepareKeyDef(KeyInfo * key)
{
int i, j, width, defined, lastGroup;
- Bool identical;
+ bool identical;
defined = key->symsDefined | key->actsDefined | key->typesDefined;
/* get highest group number */
}
/* 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]) &&
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]) &&
memcmp(key->symsMapIndex[i], key->symsMapIndex[0],
key->numLevels[0] * sizeof(int))))
{
- identical = False;
+ identical = false;
continue;
}
if ((key->symsMapNumEntries[i] != key->symsMapNumEntries[i]) &&
memcmp(key->symsMapNumEntries[i], key->symsMapNumEntries[0],
key->numLevels[0] * sizeof(int))))
{
- identical = False;
+ identical = false;
continue;
}
if ((key->acts[i] != key->acts[0]) &&
memcmp(key->acts[i], key->acts[0],
sizeof(union xkb_action) * key->numLevels[0])))
{
- identical = False;
+ identical = false;
break;
}
}
*
* This function recurses.
*/
-static Bool
+static bool
CopySymbolsDef(struct xkb_keymap * xkb, KeyInfo *key, int start_from)
{
unsigned int i;
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;
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)
|| (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)
{
{
WSGO("Could not enlarge symbols for %s (keycode %d)\n",
longText(key->name), kc);
- return False;
+ return false;
}
if (haveActions)
{
{
WSGO("Could not enlarge actions for %s (key %d)\n",
longText(key->name), kc);
- return False;
+ return false;
}
xkb->server->explicit[kc] |= XkbExplicitInterpretMask;
}
/* 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;
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)
{
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)))
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;
}
/**
* @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;
if (info.nKeys == 0) {
FreeSymbolsInfo(&info);
- return False;
+ return false;
}
if (info.errorCount == 0)
{
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. */
}
}
FreeSymbolsInfo(&info);
- return True;
+ return true;
}
FreeSymbolsInfo(&info);
- return False;
+ return false;
}
* @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)
{
{ /* already defined */
info->available |= bit;
if (stmt->value == NULL)
- return True;
+ return true;
else
{
const char *str1;
{
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;
}
}
}
{
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;
}
/**
*
* @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
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.
if (xkb->names->vmods[i] && strcmp(xkb->names->vmods[i], name) == 0)
{
val_rtrn->uval = i;
- return True;
+ return true;
}
}
- return False;
+ return false;
}
/**
* @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
return -1;
}
-Bool
+bool
ResolveVirtualModifier(ExprDef * def, struct xkb_keymap *xkb,
ExprResult * val_rtrn, VModInfo * info)
{
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;
}
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);
unsigned merge;
int ndx;
ExprDef *name;
- Bool virtual;
+ bool virtual;
} IndicatorNameDef;
typedef struct _IndicatorMapDef
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 */
;
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
* @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)
* nextop_retrn = ""
*
*/
-Bool
+bool
XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
char *nextop_rtrn, char **extra_data)
{
else if (str[0] == '(')
{
free(*extra_data);
- return False;
+ return false;
}
else
{
{
free(*file_rtrn);
free(*extra_data);
- return False;
+ return false;
}
*tmp++ = '\0';
*map_rtrn = uDupString(str);
else if ((*nextop_rtrn == '|') || (*nextop_rtrn == '+'))
*str_inout = next;
else
- return False;
- return True;
+ return false;
+ return true;
}
/***====================================================================***/
#ifndef _XKBPATH_H_
#define _XKBPATH_H_ 1
+#include <stdbool.h>
#include <stdio.h>
#include "XKBcommonint.h"
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);
#ifndef _XKBMISC_H_
#define _XKBMISC_H_
-#include <X11/Xdefs.h>
+#include <stdbool.h>
#include <X11/Xfuncproto.h>
#include "xkbcommon/xkbcommon.h"
/***====================================================================***/
-extern Bool
+extern bool
XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
unsigned char *map_rtrn);
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);
#define XkbKSIsDeadKey(k) \
(((k) >= XK_dead_grave) && ((k) <= XK_dead_semivoiced_sound))
-extern Bool
+extern bool
XkbcNameMatchesPattern(char *name, char *ptrn);
/***====================================================================***/
XkbcModIndexText(unsigned ndx);
extern const char *
-XkbcModMaskText(unsigned mask, Bool cFormat);
+XkbcModMaskText(unsigned mask, bool cFormat);
extern const char *
XkbcConfigText(unsigned config);
#ifndef _XKBRULES_H_
#define _XKBRULES_H_
-#include <X11/Xdefs.h>
+#include <stdbool.h>
+
#include "xkbcommon/xkbcommon.h"
/* From filecommon */
/* 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