mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-05 06:53:57 +00:00
It is patch 3/5 of a series that refactors matching input and output devices to classes and extends possibilities to describe them, in particular, it allows use of regular expressions. This patch defines a function MatchAddrToken that actually matches an attribute against a list of pattern groups (in fact, Match... lines). It is used to check whether a particular input/optput class should be applied to a device, thus replacing the tangled and difficult to control code in InputClass.c and OutputClass.c. Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
/* SPDX-License-Identifier: MIT OR X11
|
|
*
|
|
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
|
|
* Copyright © 1997 Metro Link Incorporated
|
|
*/
|
|
#ifndef _XSERVER_XF86_PARSER_PRIV
|
|
#define _XSERVER_XF86_PARSER_PRIV
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "xf86Parser.h"
|
|
|
|
void xf86initConfigFiles(void);
|
|
char *xf86openConfigFile(const char *path,
|
|
const char *cmdline,
|
|
const char *projroot);
|
|
char *xf86openConfigDirFiles(const char *path,
|
|
const char *cmdline,
|
|
const char *projroot);
|
|
void xf86setBuiltinConfig(const char *config[]);
|
|
XF86ConfigPtr xf86readConfigFile(void);
|
|
void xf86closeConfigFile(void);
|
|
XF86ConfigPtr xf86allocateConfig(void);
|
|
void xf86freeConfig(XF86ConfigPtr p);
|
|
int xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr);
|
|
int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout);
|
|
|
|
static inline void xf86freeMatchGroup(xf86MatchGroup *group)
|
|
{
|
|
xorg_list_del(&group->entry);
|
|
xf86MatchPattern *pattern, *next_pattern;
|
|
xorg_list_for_each_entry_safe(pattern, next_pattern, &group->patterns, entry) {
|
|
xorg_list_del(&pattern->entry);
|
|
if (pattern->str)
|
|
free(pattern->str);
|
|
free(pattern);
|
|
}
|
|
free(group);
|
|
}
|
|
|
|
static inline void xf86freeMatchGroupList(struct xorg_list *grouplist) {
|
|
xf86MatchGroup *group, *next;
|
|
xorg_list_for_each_entry_safe(group, next, grouplist, entry) {
|
|
xf86freeMatchGroup(group);
|
|
}
|
|
}
|
|
|
|
#endif /* _XSERVER_XF86_PARSER_PRIV */
|