parent
f48ee2d2af
commit
70e3e7e5c3
|
@ -114,30 +114,32 @@ siText(SymInterpInfo * si, CompatInfo * info)
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportSINotArray(CompatInfo *info, SymInterpInfo *si, const char *field)
|
ReportSINotArray(CompatInfo *info, SymInterpInfo *si, const char *field)
|
||||||
{
|
{
|
||||||
return ReportNotArray("symbol interpretation", field, siText(si, info));
|
return ReportNotArray(info->keymap, "symbol interpretation", field,
|
||||||
|
siText(si, info));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field,
|
ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field,
|
||||||
const char *wanted)
|
const char *wanted)
|
||||||
{
|
{
|
||||||
return ReportBadType("symbol interpretation", field, siText(si, info),
|
return ReportBadType(info->keymap, "symbol interpretation", field,
|
||||||
wanted);
|
siText(si, info), wanted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportIndicatorBadType(CompatInfo *info, LEDInfo *led,
|
ReportIndicatorBadType(CompatInfo *info, LEDInfo *led,
|
||||||
const char *field, const char *wanted)
|
const char *field, const char *wanted)
|
||||||
{
|
{
|
||||||
return ReportBadType("indicator map", field,
|
return ReportBadType(info->keymap, "indicator map", field,
|
||||||
xkb_atom_text(info->keymap->ctx, led->name), wanted);
|
xkb_atom_text(info->keymap->ctx, led->name),
|
||||||
|
wanted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportIndicatorNotArray(CompatInfo *info, LEDInfo *led,
|
ReportIndicatorNotArray(CompatInfo *info, LEDInfo *led,
|
||||||
const char *field)
|
const char *field)
|
||||||
{
|
{
|
||||||
return ReportNotArray("indicator map", field,
|
return ReportNotArray(info->keymap, "indicator map", field,
|
||||||
xkb_atom_text(info->keymap->ctx, led->name));
|
xkb_atom_text(info->keymap->ctx, led->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,7 +708,8 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, char *field,
|
||||||
return ReportSIBadType(info, si, field, "level specification");
|
return ReportSIBadType(info, si, field, "level specification");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ok = ReportBadField("symbol interpretation", field, siText(si, info));
|
ok = ReportBadField(keymap, "symbol interpretation", field,
|
||||||
|
siText(si, info));
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
|
@ -717,7 +717,8 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
|
||||||
char buf[20];
|
char buf[20];
|
||||||
snprintf(buf, sizeof(buf), "%d", def->ndx);
|
snprintf(buf, sizeof(buf), "%d", def->ndx);
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
return ReportBadType("indicator", "name", buf, "string");
|
return ReportBadType(info->keymap, "indicator", "name", buf,
|
||||||
|
"string");
|
||||||
}
|
}
|
||||||
ii.name = xkb_atom_intern(info->keymap->ctx, tmp.str);
|
ii.name = xkb_atom_intern(info->keymap->ctx, tmp.str);
|
||||||
free(tmp.str);
|
free(tmp.str);
|
||||||
|
|
|
@ -112,14 +112,16 @@ static inline bool
|
||||||
ReportTypeShouldBeArray(KeyTypesInfo *info, KeyTypeInfo *type,
|
ReportTypeShouldBeArray(KeyTypesInfo *info, KeyTypeInfo *type,
|
||||||
const char *field)
|
const char *field)
|
||||||
{
|
{
|
||||||
return ReportShouldBeArray("key type", field, TypeTxt(info, type));
|
return ReportShouldBeArray(info->keymap, "key type", field,
|
||||||
|
TypeTxt(info, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportTypeBadType(KeyTypesInfo *info, KeyTypeInfo *type,
|
ReportTypeBadType(KeyTypesInfo *info, KeyTypeInfo *type,
|
||||||
const char *field, const char *wanted)
|
const char *field, const char *wanted)
|
||||||
{
|
{
|
||||||
return ReportBadType("key type", field, TypeTxt(info, type), wanted);
|
return ReportBadType(info->keymap, "key type", field, TypeTxt(info, type),
|
||||||
|
wanted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
|
|
@ -71,35 +71,46 @@ LongToKeyName(unsigned long val, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportNotArray(const char *type, const char *field, const char *name)
|
ReportNotArray(struct xkb_keymap *keymap, const char *type, const char *field,
|
||||||
|
const char *name)
|
||||||
{
|
{
|
||||||
ERROR("The %s %s field is not an array\n", type, field);
|
log_err(keymap->ctx,
|
||||||
ACTION("Ignoring illegal assignment in %s\n", name);
|
"The %s %s field is not an array; "
|
||||||
|
"Ignoring illegal assignment in %s\n",
|
||||||
|
type, field, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportShouldBeArray(const char *type, const char *field, const char *name)
|
ReportShouldBeArray(struct xkb_keymap *keymap, const char *type,
|
||||||
|
const char *field, const char *name)
|
||||||
{
|
{
|
||||||
ERROR("Missing subscript for %s %s\n", type, field);
|
log_err(keymap->ctx,
|
||||||
ACTION("Ignoring illegal assignment in %s\n", name);
|
"Missing subscript for %s %s; "
|
||||||
|
"Ignoring illegal assignment in %s\n",
|
||||||
|
type, field, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportBadType(const char *type, const char *field,
|
ReportBadType(struct xkb_keymap *keymap, const char *type, const char *field,
|
||||||
const char *name, const char *wanted)
|
const char *name, const char *wanted)
|
||||||
{
|
{
|
||||||
ERROR("The %s %s field must be a %s\n", type, field, wanted);
|
log_err(keymap->ctx,
|
||||||
ACTION("Ignoring illegal assignment in %s\n", name);
|
"The %s %s field must be a %s; "
|
||||||
|
"Ignoring illegal assignment in %s\n",
|
||||||
|
type, field, wanted, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ReportBadField(const char *type, const char *field, const char *name)
|
ReportBadField(struct xkb_keymap *keymap, const char *type, const char *field,
|
||||||
|
const char *name)
|
||||||
{
|
{
|
||||||
ERROR("Unknown %s field %s in %s\n", type, field, name);
|
log_err(keymap->ctx,
|
||||||
ACTION("Ignoring assignment to unknown field in %s\n", name);
|
"Unknown %s field %s in %s; "
|
||||||
|
"Ignoring assignment to unknown field in %s\n",
|
||||||
|
type, field, name, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,8 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
* in the parser.
|
* in the parser.
|
||||||
*/
|
*/
|
||||||
if (file->type != FILE_TYPE_KEYMAP) {
|
if (file->type != FILE_TYPE_KEYMAP) {
|
||||||
ERROR("Cannot compile a %s file alone into a keymap\n",
|
log_err(ctx, "Cannot compile a %s file alone into a keymap\n",
|
||||||
XkbcFileTypeText(file->type));
|
XkbcFileTypeText(file->type));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +100,10 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
for (file = (XkbFile *) file->defs; file;
|
for (file = (XkbFile *) file->defs; file;
|
||||||
file = (XkbFile *) file->common.next) {
|
file = (XkbFile *) file->common.next) {
|
||||||
if (have & file->type) {
|
if (have & file->type) {
|
||||||
ERROR("More than one %s section in a keymap file\n",
|
log_err(ctx,
|
||||||
XkbcFileTypeText(file->type));
|
"More than one %s section in a keymap file; "
|
||||||
ACTION("All sections after the first ignored\n");
|
"All sections after the first ignored\n",
|
||||||
|
XkbcFileTypeText(file->type));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +125,8 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR("Cannot define %s in a keymap file\n",
|
log_err(ctx, "Cannot define %s in a keymap file\n",
|
||||||
XkbcFileTypeText(file->type));
|
XkbcFileTypeText(file->type));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +146,8 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
|
|
||||||
for (bit = 1; missing != 0; bit <<= 1) {
|
for (bit = 1; missing != 0; bit <<= 1) {
|
||||||
if (missing & bit) {
|
if (missing & bit) {
|
||||||
ERROR("Required section %s missing from keymap\n",
|
log_err(ctx, "Required section %s missing from keymap\n",
|
||||||
XkbcFileTypeText(bit));
|
XkbcFileTypeText(bit));
|
||||||
missing &= ~bit;
|
missing &= ~bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,22 +157,22 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
|
|
||||||
ok = CompileKeycodes(keycodes, keymap, MERGE_OVERRIDE);
|
ok = CompileKeycodes(keycodes, keymap, MERGE_OVERRIDE);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ERROR("Failed to compile keycodes\n");
|
log_err(ctx, "Failed to compile keycodes\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ok = CompileKeyTypes(types, keymap, MERGE_OVERRIDE);
|
ok = CompileKeyTypes(types, keymap, MERGE_OVERRIDE);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ERROR("Failed to compile key types\n");
|
log_err(ctx, "Failed to compile key types\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ok = CompileCompatMap(compat, keymap, MERGE_OVERRIDE);
|
ok = CompileCompatMap(compat, keymap, MERGE_OVERRIDE);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ERROR("Failed to compile compat map\n");
|
log_err(ctx, "Failed to compile compat map\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ok = CompileSymbols(symbols, keymap, MERGE_OVERRIDE);
|
ok = CompileSymbols(symbols, keymap, MERGE_OVERRIDE);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ERROR("Failed to compile symbols\n");
|
log_err(ctx, "Failed to compile symbols\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
return keymap;
|
return keymap;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
ACTION("Failed to compile keymap\n");
|
log_err(ctx, "Failed to compile keymap\n");
|
||||||
xkb_map_unref(keymap);
|
xkb_map_unref(keymap);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -196,33 +197,33 @@ xkb_map_new_from_kccgst(struct xkb_context *ctx,
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
if (!kccgst) {
|
if (!kccgst) {
|
||||||
ERROR("No components specified\n");
|
log_err(ctx, "No components specified\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISEMPTY(kccgst->keycodes)) {
|
if (ISEMPTY(kccgst->keycodes)) {
|
||||||
ERROR("Keycodes required to generate XKB keymap\n");
|
log_err(ctx, "Keycodes required to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISEMPTY(kccgst->compat)) {
|
if (ISEMPTY(kccgst->compat)) {
|
||||||
ERROR("Compat map required to generate XKB keymap\n");
|
log_err(ctx, "Compat map required to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISEMPTY(kccgst->types)) {
|
if (ISEMPTY(kccgst->types)) {
|
||||||
ERROR("Types required to generate XKB keymap\n");
|
log_err(ctx, "Types required to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISEMPTY(kccgst->symbols)) {
|
if (ISEMPTY(kccgst->symbols)) {
|
||||||
ERROR("Symbols required to generate XKB keymap\n");
|
log_err(ctx, "Symbols required to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = keymap_file_from_components(ctx, kccgst);
|
file = keymap_file_from_components(ctx, kccgst);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
ERROR("Failed to generate parsed XKB file from components\n");
|
log_err(ctx, "Failed to generate parsed XKB file from components\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,14 +241,14 @@ xkb_map_new_from_names(struct xkb_context *ctx,
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
if (!rmlvo || ISEMPTY(rmlvo->rules) || ISEMPTY(rmlvo->layout)) {
|
if (!rmlvo || ISEMPTY(rmlvo->rules) || ISEMPTY(rmlvo->layout)) {
|
||||||
ERROR("rules and layout required to generate XKB keymap\n");
|
log_err(ctx, "rules and layout required to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
kkctgs = xkb_components_from_rules(ctx, rmlvo);
|
kkctgs = xkb_components_from_rules(ctx, rmlvo);
|
||||||
if (!kkctgs) {
|
if (!kkctgs) {
|
||||||
ERROR("failed to generate XKB components from rules \"%s\"\n",
|
log_err(ctx, "failed to generate XKB components from rules \"%s\"\n",
|
||||||
rmlvo->rules);
|
rmlvo->rules);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,18 +274,18 @@ xkb_map_new_from_string(struct xkb_context *ctx,
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
if (format != XKB_KEYMAP_FORMAT_TEXT_V1) {
|
if (format != XKB_KEYMAP_FORMAT_TEXT_V1) {
|
||||||
ERROR("unsupported keymap format %d\n", format);
|
log_err(ctx, "unsupported keymap format %d\n", format);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string) {
|
if (!string) {
|
||||||
ERROR("No string specified to generate XKB keymap\n");
|
log_err(ctx, "No string specified to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = XKBParseString(ctx, string, "input", &file);
|
ok = XKBParseString(ctx, string, "input", &file);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ERROR("Failed to parse input xkb file\n");
|
log_err(ctx, "Failed to parse input xkb file\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,18 +305,18 @@ xkb_map_new_from_file(struct xkb_context *ctx,
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
||||||
if (format != XKB_KEYMAP_FORMAT_TEXT_V1) {
|
if (format != XKB_KEYMAP_FORMAT_TEXT_V1) {
|
||||||
ERROR("Unsupported keymap format %d\n", format);
|
log_err(ctx, "Unsupported keymap format %d\n", format);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
ERROR("No file specified to generate XKB keymap\n");
|
log_err(ctx, "No file specified to generate XKB keymap\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = XKBParseFile(ctx, file, "(unknown file)", &xkb_file);
|
ok = XKBParseFile(ctx, file, "(unknown file)", &xkb_file);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ERROR("Failed to parse input xkb file\n");
|
log_err(ctx, "Failed to parse input xkb file\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue