parser, symbols: drop unnecessary casts
[platform/upstream/libxkbcommon.git] / src / context.h
index 1a87815..c9bb277 100644 (file)
@@ -28,9 +28,6 @@
 
 #include "atom.h"
 
-unsigned
-xkb_context_take_file_id(struct xkb_context *ctx);
-
 unsigned int
 xkb_context_num_failed_include_paths(struct xkb_context *ctx);
 
@@ -46,11 +43,14 @@ xkb_atom_t
 xkb_atom_lookup(struct xkb_context *ctx, const char *string);
 
 xkb_atom_t
-xkb_atom_intern(struct xkb_context *ctx, const char *string);
+xkb_atom_intern(struct xkb_context *ctx, const char *string, size_t len);
+
+#define xkb_atom_intern_literal(ctx, literal) \
+    xkb_atom_intern((ctx), (literal), sizeof(literal) - 1)
 
 /**
- * If @string is dynamically allocated, free'd immediately after
- * being interned, and not used afterwards, use this function
+ * If @string is dynamically allocated, NUL-terminated, free'd immediately
+ * after being interned, and not used afterwards, use this function
  * instead of xkb_atom_intern to avoid some unnecessary allocations.
  * The caller should not use or free the passed in string afterwards.
  */
@@ -63,20 +63,38 @@ xkb_atom_strdup(struct xkb_context *ctx, xkb_atom_t atom);
 const char *
 xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
 
+char *
+xkb_context_get_buffer(struct xkb_context *ctx, size_t size);
+
 ATTR_PRINTF(3, 4) void
 xkb_log(struct xkb_context *ctx, enum xkb_log_level level,
         const char *fmt, ...);
 
 #define xkb_log_cond_level(ctx, level, ...) do { \
-    if (xkb_get_log_level(ctx) >= (level)) \
+    if (xkb_context_get_log_level(ctx) >= (level)) \
     xkb_log((ctx), (level), __VA_ARGS__); \
 } while (0)
 
 #define xkb_log_cond_verbosity(ctx, level, vrb, ...) do { \
-    if (xkb_get_log_verbosity(ctx) >= (vrb)) \
+    if (xkb_context_get_log_verbosity(ctx) >= (vrb)) \
     xkb_log_cond_level((ctx), (level), __VA_ARGS__); \
 } while (0)
 
+const char *
+xkb_context_get_default_rules(struct xkb_context *ctx);
+
+const char *
+xkb_context_get_default_model(struct xkb_context *ctx);
+
+const char *
+xkb_context_get_default_layout(struct xkb_context *ctx);
+
+const char *
+xkb_context_get_default_variant(struct xkb_context *ctx);
+
+const char *
+xkb_context_get_default_options(struct xkb_context *ctx);
+
 /*
  * The format is not part of the argument list in order to avoid the
  * "ISO C99 requires rest arguments to be used" warning when only the
@@ -96,4 +114,14 @@ xkb_log(struct xkb_context *ctx, enum xkb_log_level level,
 #define log_vrb(ctx, vrb, ...) \
     xkb_log_cond_verbosity((ctx), XKB_LOG_LEVEL_WARNING, (vrb), __VA_ARGS__)
 
+/*
+ * Variants which are prefixed by the name of the function they're
+ * called from.
+ * Here we must have the silly 1 variant.
+ */
+#define log_err_func(ctx, fmt, ...) \
+    log_err(ctx, "%s: " fmt, __func__, __VA_ARGS__)
+#define log_err_func1(ctx, fmt) \
+    log_err(ctx, "%s: " fmt, __func__)
+
 #endif