18c9fbc29Smrg#ifndef _XKBRULES_H_
28c9fbc29Smrg#define	_XKBRULES_H_ 1
38c9fbc29Smrg
48c9fbc29Smrg/************************************************************
58c9fbc29Smrg Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
68c9fbc29Smrg
78c9fbc29Smrg Permission to use, copy, modify, and distribute this
88c9fbc29Smrg software and its documentation for any purpose and without
98c9fbc29Smrg fee is hereby granted, provided that the above copyright
108c9fbc29Smrg notice appear in all copies and that both that copyright
118c9fbc29Smrg notice and this permission notice appear in supporting
124cd6a3aeSmrg documentation, and that the name of Silicon Graphics not be
134cd6a3aeSmrg used in advertising or publicity pertaining to distribution
148c9fbc29Smrg of the software without specific prior written permission.
154cd6a3aeSmrg Silicon Graphics makes no representation about the suitability
168c9fbc29Smrg of this software for any purpose. It is provided "as is"
178c9fbc29Smrg without any express or implied warranty.
184cd6a3aeSmrg
194cd6a3aeSmrg SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
204cd6a3aeSmrg SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
218c9fbc29Smrg AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
224cd6a3aeSmrg GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
234cd6a3aeSmrg DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
244cd6a3aeSmrg DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
258c9fbc29Smrg OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
268c9fbc29Smrg THE USE OR PERFORMANCE OF THIS SOFTWARE.
278c9fbc29Smrg
288c9fbc29Smrg ********************************************************/
298c9fbc29Smrg
308c9fbc29Smrg/***====================================================================***/
318c9fbc29Smrg
328c9fbc29Smrgtypedef struct _XkbRF_VarDefs {
338c9fbc29Smrg	char *			model;
348c9fbc29Smrg	char *			layout;
358c9fbc29Smrg	char *			variant;
368c9fbc29Smrg	char *			options;
378c9fbc29Smrg	unsigned short		sz_extra;
388c9fbc29Smrg	unsigned short		num_extra;
398c9fbc29Smrg	char *			extra_names;
408c9fbc29Smrg	char **			extra_values;
418c9fbc29Smrg} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr;
428c9fbc29Smrg
438c9fbc29Smrgtypedef struct _XkbRF_VarDesc {
448c9fbc29Smrg	char *			name;
458c9fbc29Smrg	char *			desc;
468c9fbc29Smrg} XkbRF_VarDescRec, *XkbRF_VarDescPtr;
478c9fbc29Smrg
488c9fbc29Smrgtypedef struct _XkbRF_DescribeVars {
498c9fbc29Smrg	int			sz_desc;
508c9fbc29Smrg	int			num_desc;
518c9fbc29Smrg	XkbRF_VarDescPtr	desc;
528c9fbc29Smrg} XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr;
538c9fbc29Smrg
548c9fbc29Smrgtypedef struct _XkbRF_Rule {
558c9fbc29Smrg	int			number;
568c9fbc29Smrg        int			layout_num;
578c9fbc29Smrg        int			variant_num;
588c9fbc29Smrg	char *			model;
598c9fbc29Smrg	char *			layout;
608c9fbc29Smrg	char *			variant;
618c9fbc29Smrg	char *			option;
628c9fbc29Smrg	/* yields */
638c9fbc29Smrg	char *			keycodes;
648c9fbc29Smrg	char *			symbols;
658c9fbc29Smrg	char *			types;
668c9fbc29Smrg	char *			compat;
678c9fbc29Smrg	char *			geometry;
688c9fbc29Smrg	char *			keymap;
698c9fbc29Smrg	unsigned		flags;
708c9fbc29Smrg} XkbRF_RuleRec,*XkbRF_RulePtr;
718c9fbc29Smrg
728c9fbc29Smrgtypedef struct _XkbRF_Group {
738c9fbc29Smrg	int			number;
748c9fbc29Smrg	char *			name;
758c9fbc29Smrg	char *			words;
768c9fbc29Smrg} XkbRF_GroupRec, *XkbRF_GroupPtr;
778c9fbc29Smrg
788c9fbc29Smrg#define	XkbRF_PendingMatch	(1L<<1)
798c9fbc29Smrg#define	XkbRF_Option		(1L<<2)
808c9fbc29Smrg#define	XkbRF_Append		(1L<<3)
818c9fbc29Smrg#define	XkbRF_Normal		(1L<<4)
828c9fbc29Smrg#define	XkbRF_Invalid		(1L<<5)
838c9fbc29Smrg
848c9fbc29Smrgtypedef struct _XkbRF_Rules {
858c9fbc29Smrg	XkbRF_DescribeVarsRec	models;
868c9fbc29Smrg	XkbRF_DescribeVarsRec	layouts;
878c9fbc29Smrg	XkbRF_DescribeVarsRec	variants;
888c9fbc29Smrg	XkbRF_DescribeVarsRec	options;
898c9fbc29Smrg	unsigned short		sz_extra;
908c9fbc29Smrg	unsigned short		num_extra;
918c9fbc29Smrg	char **			extra_names;
928c9fbc29Smrg	XkbRF_DescribeVarsPtr	extra;
938c9fbc29Smrg
948c9fbc29Smrg	unsigned short		sz_rules;
958c9fbc29Smrg	unsigned short		num_rules;
968c9fbc29Smrg	XkbRF_RulePtr		rules;
978c9fbc29Smrg	unsigned short		sz_groups;
988c9fbc29Smrg	unsigned short		num_groups;
998c9fbc29Smrg        XkbRF_GroupPtr		groups;
1008c9fbc29Smrg} XkbRF_RulesRec, *XkbRF_RulesPtr;
1018c9fbc29Smrg
1028c9fbc29Smrg/***====================================================================***/
1038c9fbc29Smrg
1048c9fbc29Smrg_XFUNCPROTOBEGIN
1058c9fbc29Smrg
1068c9fbc29Smrgextern Bool	XkbRF_GetComponents(
1078c9fbc29Smrg    XkbRF_RulesPtr		/* rules */,
1088c9fbc29Smrg    XkbRF_VarDefsPtr		/* var_defs */,
1098c9fbc29Smrg    XkbComponentNamesPtr	/* names */
1108c9fbc29Smrg);
1118c9fbc29Smrg
1128c9fbc29Smrgextern XkbRF_RulePtr	XkbRF_AddRule(
1138c9fbc29Smrg    XkbRF_RulesPtr	/* rules */
1148c9fbc29Smrg);
1158c9fbc29Smrg
1168c9fbc29Smrgextern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr  rules);
1178c9fbc29Smrg
1188c9fbc29Smrgextern Bool	XkbRF_LoadRules(
1198c9fbc29Smrg    FILE *		/* file */,
1208c9fbc29Smrg    XkbRF_RulesPtr	/* rules */
1218c9fbc29Smrg);
1228c9fbc29Smrg
1238c9fbc29Smrgextern Bool XkbRF_LoadRulesByName(
1248c9fbc29Smrg    char *		/* base */,
1258c9fbc29Smrg    char *		/* locale */,
1268c9fbc29Smrg    XkbRF_RulesPtr	/* rules */
1278c9fbc29Smrg);
1288c9fbc29Smrg
1298c9fbc29Smrg/***====================================================================***/
1308c9fbc29Smrg
1318c9fbc29Smrgextern XkbRF_VarDescPtr	XkbRF_AddVarDesc(
1328c9fbc29Smrg    XkbRF_DescribeVarsPtr	/* vars */
1338c9fbc29Smrg);
1348c9fbc29Smrg
1358c9fbc29Smrgextern XkbRF_VarDescPtr	XkbRF_AddVarDescCopy(
1368c9fbc29Smrg    XkbRF_DescribeVarsPtr	/* vars */,
1378c9fbc29Smrg    XkbRF_VarDescPtr		/* copy_from */
1388c9fbc29Smrg);
1398c9fbc29Smrg
1408c9fbc29Smrgextern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe(
1418c9fbc29Smrg    XkbRF_RulesPtr		/* rules */,
1428c9fbc29Smrg    char *			/* name */
1438c9fbc29Smrg);
1448c9fbc29Smrg
1458c9fbc29Smrgextern Bool	XkbRF_LoadDescriptions(
1468c9fbc29Smrg    FILE *		/* file */,
1478c9fbc29Smrg    XkbRF_RulesPtr	/* rules */
1488c9fbc29Smrg);
1498c9fbc29Smrg
1508c9fbc29Smrgextern Bool XkbRF_LoadDescriptionsByName(
1518c9fbc29Smrg    char *		/* base */,
1528c9fbc29Smrg    char *		/* locale */,
1538c9fbc29Smrg    XkbRF_RulesPtr	/* rules */
1548c9fbc29Smrg);
1558c9fbc29Smrg
1568c9fbc29Smrgextern XkbRF_RulesPtr XkbRF_Load(
1578c9fbc29Smrg    char *		/* base */,
1588c9fbc29Smrg    char *		/* locale */,
1598c9fbc29Smrg    Bool		/* wantDesc */,
1608c9fbc29Smrg    Bool		/* wantRules */
1618c9fbc29Smrg);
1628c9fbc29Smrg
1638c9fbc29Smrgextern XkbRF_RulesPtr XkbRF_Create(
1648c9fbc29Smrg    int			/* sz_rules */,
1658c9fbc29Smrg    int			/* sz_extra */
1668c9fbc29Smrg);
1678c9fbc29Smrg
1688c9fbc29Smrg/***====================================================================***/
1698c9fbc29Smrg
1708c9fbc29Smrgextern void XkbRF_Free(
1718c9fbc29Smrg    XkbRF_RulesPtr	/* rules */,
1728c9fbc29Smrg    Bool		/* freeRules */
1738c9fbc29Smrg);
1748c9fbc29Smrg
1758c9fbc29Smrg
1768c9fbc29Smrg/***====================================================================***/
1778c9fbc29Smrg
1788c9fbc29Smrg#define	_XKB_RF_NAMES_PROP_ATOM		"_XKB_RULES_NAMES"
1798c9fbc29Smrg#define	_XKB_RF_NAMES_PROP_MAXLEN	1024
1808c9fbc29Smrg
1818c9fbc29Smrg
1828c9fbc29Smrgextern Bool XkbRF_GetNamesProp(
1838c9fbc29Smrg   Display *		/* dpy */,
1848c9fbc29Smrg   char **		/* rules_file_rtrn */,
1858c9fbc29Smrg   XkbRF_VarDefsPtr	/* var_defs_rtrn */
1868c9fbc29Smrg);
1878c9fbc29Smrg
1888c9fbc29Smrgextern Bool XkbRF_SetNamesProp(
1898c9fbc29Smrg   Display *		/* dpy */,
1908c9fbc29Smrg   char *		/* rules_file */,
1918c9fbc29Smrg   XkbRF_VarDefsPtr	/* var_defs */
1928c9fbc29Smrg);
1938c9fbc29Smrg
1948c9fbc29Smrg
1958c9fbc29Smrg_XFUNCPROTOEND
1968c9fbc29Smrg
1978c9fbc29Smrg#endif /* _XKBRULES_H_ */
198