Messages: merge macros with and without message code
[platform/upstream/libxkbcommon.git] / src / xkbcomp / xkbcomp-priv.h
index dd2e4df..3de8d8d 100644 (file)
@@ -37,20 +37,24 @@ struct xkb_component_names {
     char *symbols;
 };
 
-bool
-XkbParseFile(struct xkb_context *ctx, FILE *file, const char *file_name,
-             XkbFile **out);
+char *
+text_v1_keymap_get_as_string(struct xkb_keymap *keymap);
 
-bool
-XkbParseString(struct xkb_context *context, const char *string,
-               const char *file_name, XkbFile **out);
+XkbFile *
+XkbParseFile(struct xkb_context *ctx, FILE *file,
+             const char *file_name, const char *map);
+
+XkbFile *
+XkbParseString(struct xkb_context *ctx,
+               const char *string, size_t len,
+               const char *file_name, const char *map);
 
 void
 FreeXkbFile(XkbFile *file);
 
 XkbFile *
 XkbFileFromComponents(struct xkb_context *ctx,
-                      struct xkb_component_names *kkctgs);
+                      const struct xkb_component_names *kkctgs);
 
 bool
 CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
@@ -72,16 +76,14 @@ bool
 CompileKeymap(XkbFile *file, struct xkb_keymap *keymap,
               enum merge_mode merge);
 
-bool
-LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn);
-
 /***====================================================================***/
 
 static inline bool
-ReportNotArray(struct xkb_keymap *keymap, const char *type, const char *field,
+ReportNotArray(struct xkb_context *ctx, const char *type, const char *field,
                const char *name)
 {
-    log_err(keymap->ctx,
+    log_err(ctx,
+            XKB_ERROR_WRONG_FIELD_TYPE,
             "The %s %s field is not an array; "
             "Ignoring illegal assignment in %s\n",
             type, field, name);
@@ -89,10 +91,11 @@ ReportNotArray(struct xkb_keymap *keymap, const char *type, const char *field,
 }
 
 static inline bool
-ReportShouldBeArray(struct xkb_keymap *keymap, const char *type,
+ReportShouldBeArray(struct xkb_context *ctx, const char *type,
                     const char *field, const char *name)
 {
-    log_err(keymap->ctx,
+    log_err(ctx,
+            XKB_ERROR_EXPECTED_ARRAY_ENTRY,
             "Missing subscript for %s %s; "
             "Ignoring illegal assignment in %s\n",
             type, field, name);
@@ -100,20 +103,21 @@ ReportShouldBeArray(struct xkb_keymap *keymap, const char *type,
 }
 
 static inline bool
-ReportBadType(struct xkb_context *ctx, const char *type, const char *field,
-              const char *name, const char *wanted)
+ReportBadType(struct xkb_context *ctx, xkb_message_code_t code, const char *type,
+              const char *field, const char *name, const char *wanted)
 {
-    log_err(ctx, "The %s %s field must be a %s; "
+    log_err(ctx, code,
+            "The %s %s field must be a %s; "
             "Ignoring illegal assignment in %s\n",
             type, field, wanted, name);
     return false;
 }
 
 static inline bool
-ReportBadField(struct xkb_keymap *keymap, const char *type, const char *field,
+ReportBadField(struct xkb_context *ctx, const char *type, const char *field,
                const char *name)
 {
-    log_err(keymap->ctx,
+    log_err(ctx, XKB_LOG_MESSAGE_NO_ID,
             "Unknown %s field %s in %s; "
             "Ignoring assignment to unknown field in %s\n",
             type, field, name, name);