Dead code removal and static markup
Signed-off-by: Adam Jackson <ajax@redhat.com>master
parent
fb05ee47bf
commit
73ca959d7b
|
@ -86,7 +86,7 @@ XkbcAllocCompatMap(struct xkb_desc * xkb, unsigned which, unsigned nSI)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeCompatMap(struct xkb_desc * xkb, unsigned which, Bool freeMap)
|
||||
{
|
||||
struct xkb_compat_map * compat;
|
||||
|
@ -203,7 +203,7 @@ XkbcAllocNames(struct xkb_desc * xkb, unsigned which, int nTotalRG, int nTotalAl
|
|||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeNames(struct xkb_desc * xkb, unsigned which, Bool freeMap)
|
||||
{
|
||||
struct xkb_names * names;
|
||||
|
@ -270,7 +270,7 @@ XkbcAllocControls(struct xkb_desc * xkb, unsigned which)
|
|||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeControls(struct xkb_desc * xkb, unsigned which, Bool freeMap)
|
||||
{
|
||||
if (freeMap && xkb && xkb->ctrls) {
|
||||
|
@ -294,7 +294,7 @@ XkbcAllocIndicatorMaps(struct xkb_desc * xkb)
|
|||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeIndicatorMaps(struct xkb_desc * xkb)
|
||||
{
|
||||
if (xkb && xkb->indicators) {
|
||||
|
|
|
@ -92,8 +92,8 @@ static uint32_t lastAtom = None;
|
|||
static NodePtr atomRoot = NULL;
|
||||
static unsigned long tableLength;
|
||||
static NodePtr *nodeTable = NULL;
|
||||
InternAtomFuncPtr do_intern_atom = NULL;
|
||||
GetAtomValueFuncPtr do_get_atom_value = NULL;
|
||||
static InternAtomFuncPtr do_intern_atom = NULL;
|
||||
static GetAtomValueFuncPtr do_get_atom_value = NULL;
|
||||
|
||||
void
|
||||
xkb_init_atoms(InternAtomFuncPtr intern, GetAtomValueFuncPtr get_atom_value)
|
||||
|
|
254
src/galloc.c
254
src/galloc.c
|
@ -127,7 +127,7 @@ _XkbClearProperty(char *prop_in)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomProperties(struct xkb_geometry * geom, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
|
@ -137,7 +137,7 @@ XkbcFreeGeomProperties(struct xkb_geometry * geom, int first, int count, Bool fr
|
|||
_XkbClearProperty);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomKeyAliases(struct xkb_geometry * geom, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomLeafElems(freeAll, first, count,
|
||||
|
@ -155,7 +155,7 @@ _XkbClearColor(char *color_in)
|
|||
free(color->spec);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomColors(struct xkb_geometry * geom, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
|
@ -164,7 +164,7 @@ XkbcFreeGeomColors(struct xkb_geometry * geom, int first, int count, Bool freeAl
|
|||
_XkbClearColor);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomPoints(struct xkb_outline * outline, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomLeafElems(freeAll, first, count,
|
||||
|
@ -181,7 +181,7 @@ _XkbClearOutline(char *outline_in)
|
|||
XkbcFreeGeomPoints(outline, 0, outline->num_points, True);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomOutlines(struct xkb_shape * shape, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
|
@ -199,7 +199,7 @@ _XkbClearShape(char *shape_in)
|
|||
XkbcFreeGeomOutlines(shape, 0, shape->num_outlines, True);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomShapes(struct xkb_geometry * geom, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
|
@ -208,58 +208,7 @@ XkbcFreeGeomShapes(struct xkb_geometry * geom, int first, int count, Bool freeAl
|
|||
_XkbClearShape);
|
||||
}
|
||||
|
||||
void
|
||||
XkbcFreeGeomOverlayKeys(struct xkb_overlay_row * row, int first, int count,
|
||||
Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomLeafElems(freeAll, first, count,
|
||||
&row->num_keys, &row->sz_keys,
|
||||
(char **)&row->keys, sizeof(struct xkb_overlay_key));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_XkbClearOverlayRow(char *row_in)
|
||||
{
|
||||
struct xkb_overlay_row * row = (struct xkb_overlay_row *)row_in;
|
||||
|
||||
if (row->keys)
|
||||
XkbcFreeGeomOverlayKeys(row, 0, row->num_keys, True);
|
||||
}
|
||||
|
||||
void
|
||||
XkbcFreeGeomOverlayRows(struct xkb_overlay * overlay, int first, int count,
|
||||
Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
&overlay->num_rows, &overlay->sz_rows,
|
||||
(char **)&overlay->rows,
|
||||
sizeof(struct xkb_overlay_row),
|
||||
_XkbClearOverlayRow);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_XkbClearOverlay(char *overlay_in)
|
||||
{
|
||||
struct xkb_overlay * overlay = (struct xkb_overlay *)overlay_in;
|
||||
|
||||
if (overlay->rows)
|
||||
XkbcFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True);
|
||||
}
|
||||
|
||||
void
|
||||
XkbcFreeGeomOverlays(struct xkb_section * section, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
§ion->num_overlays, §ion->sz_overlays,
|
||||
(char **)§ion->overlays,
|
||||
sizeof(struct xkb_overlay),
|
||||
_XkbClearOverlay);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XkbcFreeGeomKeys(struct xkb_row * row, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomLeafElems(freeAll, first, count,
|
||||
|
@ -267,7 +216,6 @@ XkbcFreeGeomKeys(struct xkb_row * row, int first, int count, Bool freeAll)
|
|||
(char **)&row->keys, sizeof(struct xkb_key));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_XkbClearRow(char *row_in)
|
||||
{
|
||||
|
@ -277,7 +225,7 @@ _XkbClearRow(char *row_in)
|
|||
XkbcFreeGeomKeys(row, 0, row->num_keys, True);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomRows(struct xkb_section * section, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
|
@ -287,28 +235,6 @@ XkbcFreeGeomRows(struct xkb_section * section, int first, int count, Bool freeAl
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
_XkbClearSection(char *section_in)
|
||||
{
|
||||
struct xkb_section * section = (struct xkb_section *)section_in;
|
||||
|
||||
if (section->rows)
|
||||
XkbcFreeGeomRows(section, 0, section->num_rows, True);
|
||||
if (section->doodads) {
|
||||
XkbcFreeGeomDoodads(section->doodads, section->num_doodads, True);
|
||||
section->doodads = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XkbcFreeGeomSections(struct xkb_geometry * geom, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
&geom->num_sections, &geom->sz_sections,
|
||||
(char **)&geom->sections, sizeof(struct xkb_section),
|
||||
_XkbClearSection);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_XkbClearDoodad(char *doodad_in)
|
||||
|
@ -336,7 +262,7 @@ _XkbClearDoodad(char *doodad_in)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
XkbcFreeGeomDoodads(union xkb_doodad * doodads, int nDoodads, Bool freeAll)
|
||||
{
|
||||
int i;
|
||||
|
@ -350,6 +276,28 @@ XkbcFreeGeomDoodads(union xkb_doodad * doodads, int nDoodads, Bool freeAll)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_XkbClearSection(char *section_in)
|
||||
{
|
||||
struct xkb_section * section = (struct xkb_section *)section_in;
|
||||
|
||||
if (section->rows)
|
||||
XkbcFreeGeomRows(section, 0, section->num_rows, True);
|
||||
if (section->doodads) {
|
||||
XkbcFreeGeomDoodads(section->doodads, section->num_doodads, True);
|
||||
section->doodads = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
XkbcFreeGeomSections(struct xkb_geometry * geom, int first, int count, Bool freeAll)
|
||||
{
|
||||
_XkbFreeGeomNonLeafElems(freeAll, first, count,
|
||||
&geom->num_sections, &geom->sz_sections,
|
||||
(char **)&geom->sections, sizeof(struct xkb_section),
|
||||
_XkbClearSection);
|
||||
}
|
||||
|
||||
void
|
||||
XkbcFreeGeometry(struct xkb_geometry * geom, unsigned which, Bool freeMap)
|
||||
{
|
||||
|
@ -475,92 +423,12 @@ _XkbGeomAlloc(char **old, unsigned short *num, unsigned short *total,
|
|||
&(r)->sz_keys, \
|
||||
(n), sizeof(struct xkb_overlay_key))
|
||||
|
||||
int
|
||||
XkbcAllocGeomProps(struct xkb_geometry * geom, int nProps)
|
||||
{
|
||||
return _XkbAllocProps(geom, nProps);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomColors(struct xkb_geometry * geom, int nColors)
|
||||
{
|
||||
return _XkbAllocColors(geom, nColors);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomKeyAliases(struct xkb_geometry * geom, int nKeyAliases)
|
||||
{
|
||||
return _XkbAllocKeyAliases(geom, nKeyAliases);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomShapes(struct xkb_geometry * geom, int nShapes)
|
||||
{
|
||||
return _XkbAllocShapes(geom, nShapes);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomSections(struct xkb_geometry * geom, int nSections)
|
||||
{
|
||||
return _XkbAllocSections(geom, nSections);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomOverlays(struct xkb_section * section, int nOverlays)
|
||||
{
|
||||
return _XkbAllocOverlays(section, nOverlays);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomOverlayRows(struct xkb_overlay * overlay, int nRows)
|
||||
{
|
||||
return _XkbAllocOverlayRows(overlay, nRows);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomOverlayKeys(struct xkb_overlay_row * row, int nKeys)
|
||||
{
|
||||
return _XkbAllocOverlayKeys(row, nKeys);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomDoodads(struct xkb_geometry * geom, int nDoodads)
|
||||
{
|
||||
return _XkbAllocDoodads(geom, nDoodads);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomSectionDoodads(struct xkb_section * section, int nDoodads)
|
||||
{
|
||||
return _XkbAllocDoodads(section, nDoodads);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomOutlines(struct xkb_shape * shape, int nOL)
|
||||
{
|
||||
return _XkbAllocOutlines(shape, nOL);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomRows(struct xkb_section * section, int nRows)
|
||||
{
|
||||
return _XkbAllocRows(section, nRows);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomPoints(struct xkb_outline * ol, int nPts)
|
||||
{
|
||||
return _XkbAllocPoints(ol, nPts);
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeomKeys(struct xkb_row * row, int nKeys)
|
||||
{
|
||||
int ret = _XkbAllocKeys(row, nKeys);
|
||||
fprintf(stderr, "!!! allocated %d keys at %p\n", nKeys, row->keys);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
XkbcAllocGeometry(struct xkb_desc * xkb, struct xkb_geometry_sizes * sizes)
|
||||
{
|
||||
|
@ -643,33 +511,6 @@ register struct xkb_property * prop;
|
|||
return prop;
|
||||
}
|
||||
|
||||
struct xkb_key_alias *
|
||||
XkbcAddGeomKeyAlias(struct xkb_geometry * geom,const char *aliasStr,const char *realStr)
|
||||
{
|
||||
register int i;
|
||||
register struct xkb_key_alias * alias;
|
||||
|
||||
if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
|
||||
return NULL;
|
||||
for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
|
||||
if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
|
||||
bzero(alias->real,XkbKeyNameLength);
|
||||
strncpy(alias->real,realStr,XkbKeyNameLength);
|
||||
return alias;
|
||||
}
|
||||
}
|
||||
if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
|
||||
(_XkbAllocKeyAliases(geom,1)!=Success)) {
|
||||
return NULL;
|
||||
}
|
||||
alias= &geom->key_aliases[geom->num_key_aliases];
|
||||
bzero(alias,sizeof(struct xkb_key_alias));
|
||||
strncpy(alias->alias,aliasStr,XkbKeyNameLength);
|
||||
strncpy(alias->real,realStr,XkbKeyNameLength);
|
||||
geom->num_key_aliases++;
|
||||
return alias;
|
||||
}
|
||||
|
||||
struct xkb_color *
|
||||
XkbcAddGeomColor(struct xkb_geometry * geom,const char *spec,unsigned int pixel)
|
||||
{
|
||||
|
@ -853,41 +694,6 @@ register int i,nDoodads;
|
|||
return doodad;
|
||||
}
|
||||
|
||||
struct xkb_overlay_key *
|
||||
XkbcAddGeomOverlayKey( struct xkb_overlay * overlay,
|
||||
struct xkb_overlay_row * row,
|
||||
const char * over,
|
||||
const char * under)
|
||||
{
|
||||
register int i;
|
||||
struct xkb_overlay_key * key;
|
||||
struct xkb_section * section;
|
||||
struct xkb_row * row_under;
|
||||
Bool found;
|
||||
|
||||
if ((!overlay)||(!row)||(!over)||(!under))
|
||||
return NULL;
|
||||
section= overlay->section_under;
|
||||
if (row->row_under>=section->num_rows)
|
||||
return NULL;
|
||||
row_under= §ion->rows[row->row_under];
|
||||
for (i=0,found=False;i<row_under->num_keys;i++) {
|
||||
if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
|
||||
found= True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
return NULL;
|
||||
if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
|
||||
return NULL;
|
||||
key= &row->keys[row->num_keys];
|
||||
strncpy(key->under.name,under,XkbKeyNameLength);
|
||||
strncpy(key->over.name,over,XkbKeyNameLength);
|
||||
row->num_keys++;
|
||||
return key;
|
||||
}
|
||||
|
||||
struct xkb_overlay_row *
|
||||
XkbcAddGeomOverlayRow(struct xkb_overlay * overlay,int row_under,int sz_keys)
|
||||
{
|
||||
|
|
32
src/geom.c
32
src/geom.c
|
@ -76,37 +76,7 @@ XkbcComputeShapeBounds(struct xkb_shape * shape)
|
|||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XkbcComputeShapeTop(struct xkb_shape * shape, struct xkb_bounds * bounds)
|
||||
{
|
||||
int p;
|
||||
struct xkb_outline * outline;
|
||||
struct xkb_point * pt;
|
||||
|
||||
if ((!shape) || (shape->num_outlines < 1))
|
||||
return False;
|
||||
|
||||
if (shape->approx)
|
||||
outline = shape->approx;
|
||||
else
|
||||
outline = &shape->outlines[shape->num_outlines - 1];
|
||||
|
||||
if (outline->num_points < 2) {
|
||||
bounds->x1 = bounds->y1 = 0;
|
||||
bounds->x2 = bounds->y2 = 0;
|
||||
}
|
||||
else {
|
||||
bounds->x1 = bounds->y1 = MAXSHORT;
|
||||
bounds->x2 = bounds->y2 = MINSHORT;
|
||||
}
|
||||
|
||||
for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++)
|
||||
_XkbCheckBounds(bounds, pt->x, pt->y);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
XkbcComputeRowBounds(struct xkb_geometry * geom, struct xkb_section * section, struct xkb_row * row)
|
||||
{
|
||||
int k, pos;
|
||||
|
|
|
@ -273,7 +273,7 @@ next1: ;
|
|||
z = best_z;
|
||||
printf("#ifndef KS_TABLES_H\n");
|
||||
printf("#define KS_TABLES_H\n\n");
|
||||
printf("const unsigned char _XkeyTable[] = {\n");
|
||||
printf("static const unsigned char _XkeyTable[] = {\n");
|
||||
printf("0,\n");
|
||||
k = 1;
|
||||
for (i = 0; i < ksnum; i++) {
|
||||
|
|
473
src/malloc.c
473
src/malloc.c
|
@ -278,241 +278,6 @@ XkbcCopyKeyType(struct xkb_key_type * from, struct xkb_key_type * into)
|
|||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
XkbcCopyKeyTypes(struct xkb_key_type * from, struct xkb_key_type * into, int num_types)
|
||||
{
|
||||
int i, rtrn;
|
||||
|
||||
if (!from || !into || (num_types < 0))
|
||||
return BadMatch;
|
||||
|
||||
for (i = 0; i < num_types; i++) {
|
||||
if ((rtrn = XkbcCopyKeyType(from++, into++)) != Success)
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
XkbcResizeKeyType(struct xkb_desc * xkb, int type_ndx, int map_count,
|
||||
Bool want_preserve, int new_num_lvls)
|
||||
{
|
||||
struct xkb_key_type * type;
|
||||
KeyCode matchingKeys[XkbMaxKeyCount], nMatchingKeys;
|
||||
|
||||
if ((type_ndx < 0) || (type_ndx >= xkb->map->num_types) ||
|
||||
(map_count < 0)|| (new_num_lvls < 1))
|
||||
return BadValue;
|
||||
|
||||
switch (type_ndx) {
|
||||
case XkbOneLevelIndex:
|
||||
if (new_num_lvls != 1)
|
||||
return BadMatch;
|
||||
case XkbTwoLevelIndex:
|
||||
case XkbAlphabeticIndex:
|
||||
case XkbKeypadIndex:
|
||||
if (new_num_lvls != 2)
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
type = &xkb->map->types[type_ndx];
|
||||
|
||||
if (map_count == 0) {
|
||||
if (type->map)
|
||||
free(type->map);
|
||||
type->map = NULL;
|
||||
|
||||
if (type->preserve)
|
||||
free(type->preserve);
|
||||
type->preserve = NULL;
|
||||
|
||||
type->map_count = 0;
|
||||
}
|
||||
else {
|
||||
struct xkb_kt_map_entry *prev_map = type->map;
|
||||
|
||||
if ((map_count > type->map_count) || !type->map)
|
||||
type->map = _XkbTypedRealloc(type->map, map_count,
|
||||
struct xkb_kt_map_entry);
|
||||
if (!type->map) {
|
||||
if (prev_map)
|
||||
free(prev_map);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
if (want_preserve) {
|
||||
struct xkb_mods *prev_preserve = type->preserve;
|
||||
|
||||
if ((map_count > type->map_count) || !type->preserve)
|
||||
type->preserve = _XkbTypedRealloc(type->preserve, map_count,
|
||||
struct xkb_mods);
|
||||
if (!type->preserve) {
|
||||
if (prev_preserve)
|
||||
free(prev_preserve);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
else if (type->preserve) {
|
||||
free(type->preserve);
|
||||
type->preserve = NULL;
|
||||
}
|
||||
|
||||
type->map_count = map_count;
|
||||
}
|
||||
|
||||
if ((new_num_lvls > type->num_levels) || !type->level_names) {
|
||||
uint32_t *prev_level_names = type->level_names;
|
||||
|
||||
type->level_names = _XkbTypedRealloc(type->level_names, new_num_lvls,
|
||||
uint32_t);
|
||||
if (!type->level_names) {
|
||||
if (prev_level_names)
|
||||
free(prev_level_names);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Here's the theory:
|
||||
* If the width of the type changed, we might have to resize the symbol
|
||||
* maps for any keys that use the type for one or more groups. This is
|
||||
* expensive, so we'll try to cull out any keys that are obviously okay:
|
||||
* In any case:
|
||||
* - keys that have a group width <= the old width are okay (because
|
||||
* they could not possibly have been associated with the old type)
|
||||
* If the key type increased in size:
|
||||
* - keys that already have a group width >= to the new width are okay
|
||||
* + keys that have a group width >= the old width but < the new width
|
||||
* might have to be enlarged.
|
||||
* If the key type decreased in size:
|
||||
* - keys that have a group width > the old width don't have to be
|
||||
* resized (because they must have some other wider type associated
|
||||
* with some group).
|
||||
* + keys that have a group width == the old width might have to be
|
||||
* shrunk.
|
||||
* The possibilities marked with '+' require us to examine the key types
|
||||
* associated with each group for the key.
|
||||
*/
|
||||
bzero(matchingKeys, XkbMaxKeyCount * sizeof(KeyCode));
|
||||
nMatchingKeys = 0;
|
||||
if (new_num_lvls > type->num_levels) {
|
||||
int nTotal;
|
||||
uint32_t *newSyms;
|
||||
int width, match, nResize = 0;
|
||||
int i, g, nSyms;
|
||||
|
||||
for (nTotal = 1, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
|
||||
width = XkbKeyGroupsWidth(xkb, i);
|
||||
if (width < type->num_levels)
|
||||
continue;
|
||||
|
||||
for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1;
|
||||
(g >= 0) && !match; g--) {
|
||||
if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) {
|
||||
matchingKeys[nMatchingKeys++] = i;
|
||||
match = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!match || (width >= new_num_lvls))
|
||||
nTotal += XkbKeyNumSyms(xkb, i);
|
||||
else {
|
||||
nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls;
|
||||
nResize++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nResize > 0) {
|
||||
int nextMatch;
|
||||
|
||||
xkb->map->size_syms = (nTotal * 12) / 10;
|
||||
newSyms = _XkbTypedCalloc(xkb->map->size_syms, uint32_t);
|
||||
if (!newSyms)
|
||||
return BadAlloc;
|
||||
nextMatch = 0;
|
||||
nSyms = 1;
|
||||
|
||||
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
|
||||
if (matchingKeys[nextMatch] == i) {
|
||||
uint32_t *pOld;
|
||||
|
||||
nextMatch++;
|
||||
width = XkbKeyGroupsWidth(xkb, i);
|
||||
pOld = XkbKeySymsPtr(xkb, i);
|
||||
for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--)
|
||||
memcpy(&newSyms[nSyms+(new_num_lvls * g)],
|
||||
&pOld[width * g], width * sizeof(uint32_t));
|
||||
xkb->map->key_sym_map[i].offset = nSyms;
|
||||
nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls;
|
||||
}
|
||||
else {
|
||||
memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i),
|
||||
XkbKeyNumSyms(xkb, i) * sizeof(uint32_t));
|
||||
xkb->map->key_sym_map[i].offset = nSyms;
|
||||
nSyms += XkbKeyNumSyms(xkb,i);
|
||||
}
|
||||
}
|
||||
|
||||
type->num_levels = new_num_lvls;
|
||||
free(xkb->map->syms);
|
||||
xkb->map->syms = newSyms;
|
||||
xkb->map->num_syms = nSyms;
|
||||
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
else if (new_num_lvls < type->num_levels) {
|
||||
int width,match;
|
||||
int g, i;
|
||||
|
||||
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
|
||||
width = XkbKeyGroupsWidth(xkb, i);
|
||||
if (width < type->num_levels)
|
||||
continue;
|
||||
|
||||
for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1;
|
||||
(g >= 0) && !match; g--) {
|
||||
if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) {
|
||||
matchingKeys[nMatchingKeys++] = i;
|
||||
match = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nMatchingKeys > 0) {
|
||||
int key, firstClear;
|
||||
int i, g;
|
||||
|
||||
if (new_num_lvls > type->num_levels)
|
||||
firstClear = type->num_levels;
|
||||
else
|
||||
firstClear = new_num_lvls;
|
||||
|
||||
for (i = 0; i < nMatchingKeys; i++) {
|
||||
uint32_t *pSyms;
|
||||
int width, nClear;
|
||||
|
||||
key = matchingKeys[i];
|
||||
width = XkbKeyGroupsWidth(xkb, key);
|
||||
nClear = width - firstClear;
|
||||
pSyms = XkbKeySymsPtr(xkb, key);
|
||||
for (g = XkbKeyNumGroups(xkb, key) - 1; g >= 0; g--) {
|
||||
if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) {
|
||||
if (nClear>0)
|
||||
bzero(&pSyms[g * width + firstClear],
|
||||
nClear * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type->num_levels = new_num_lvls;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
uint32_t *
|
||||
XkbcResizeKeySyms(struct xkb_desc * xkb, int key, int needed)
|
||||
{
|
||||
|
@ -577,244 +342,6 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, int key, int needed)
|
|||
return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
|
||||
}
|
||||
|
||||
static unsigned
|
||||
_ExtendRange(unsigned int old_flags, unsigned int flag, KeyCode newKC,
|
||||
KeyCode *old_min, unsigned char *old_num)
|
||||
{
|
||||
if ((old_flags & flag) == 0) {
|
||||
old_flags |= flag;
|
||||
*old_min = newKC;
|
||||
*old_num = 1;
|
||||
}
|
||||
else {
|
||||
int last = (*old_min) + (*old_num) - 1;
|
||||
|
||||
if (newKC < *old_min) {
|
||||
*old_min = newKC;
|
||||
*old_num = last - newKC + 1;
|
||||
}
|
||||
else if (newKC > last) {
|
||||
*old_num = newKC - (*old_min) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return old_flags;
|
||||
}
|
||||
|
||||
int
|
||||
XkbcChangeKeycodeRange(struct xkb_desc * xkb, int minKC, int maxKC,
|
||||
struct xkb_changes * changes)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
if (!xkb || (minKC < XkbMinLegalKeyCode) || (maxKC > XkbMaxLegalKeyCode))
|
||||
return BadValue;
|
||||
|
||||
if (minKC > maxKC)
|
||||
return BadMatch;
|
||||
|
||||
if (minKC < xkb->min_key_code) {
|
||||
if (changes)
|
||||
changes->map.min_key_code = minKC;
|
||||
tmp = xkb->min_key_code - minKC;
|
||||
|
||||
if (xkb->map) {
|
||||
if (xkb->map->key_sym_map) {
|
||||
bzero(&xkb->map->key_sym_map[minKC],
|
||||
tmp * sizeof(struct xkb_sym_map));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbKeySymsMask, minKC,
|
||||
&changes->map.first_key_sym,
|
||||
&changes->map.num_key_syms);
|
||||
}
|
||||
|
||||
if (xkb->map->modmap) {
|
||||
bzero(&xkb->map->modmap[minKC], tmp);
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbModifierMapMask, minKC,
|
||||
&changes->map.first_modmap_key,
|
||||
&changes->map.num_modmap_keys);
|
||||
}
|
||||
}
|
||||
|
||||
if (xkb->server) {
|
||||
if (xkb->server->behaviors) {
|
||||
bzero(&xkb->server->behaviors[minKC],
|
||||
tmp * sizeof(struct xkb_behavior));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbKeyBehaviorsMask, minKC,
|
||||
&changes->map.first_key_behavior,
|
||||
&changes->map.num_key_behaviors);
|
||||
}
|
||||
|
||||
if (xkb->server->key_acts) {
|
||||
bzero(&xkb->server->key_acts[minKC],
|
||||
tmp * sizeof(unsigned short));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbKeyActionsMask, minKC,
|
||||
&changes->map.first_key_act,
|
||||
&changes->map.num_key_acts);
|
||||
}
|
||||
|
||||
if (xkb->server->vmodmap) {
|
||||
bzero(&xkb->server->vmodmap[minKC],
|
||||
tmp * sizeof(uint32_t));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbVirtualModMapMask, minKC,
|
||||
&changes->map.first_modmap_key,
|
||||
&changes->map.num_vmodmap_keys);
|
||||
}
|
||||
}
|
||||
|
||||
if (xkb->names && xkb->names->keys) {
|
||||
bzero(&xkb->names->keys[minKC], tmp * sizeof(struct xkb_key_name));
|
||||
if (changes)
|
||||
changes->names.changed = _ExtendRange(changes->names.changed,
|
||||
XkbKeyNamesMask, minKC,
|
||||
&changes->names.first_key,
|
||||
&changes->names.num_keys);
|
||||
}
|
||||
|
||||
xkb->min_key_code = minKC;
|
||||
}
|
||||
|
||||
if (maxKC > xkb->max_key_code) {
|
||||
if (changes)
|
||||
changes->map.max_key_code = maxKC;
|
||||
tmp = maxKC-xkb->max_key_code;
|
||||
|
||||
if (xkb->map) {
|
||||
if (xkb->map->key_sym_map) {
|
||||
struct xkb_sym_map *prev_key_sym_map = xkb->map->key_sym_map;
|
||||
|
||||
xkb->map->key_sym_map = _XkbTypedRealloc(xkb->map->key_sym_map,
|
||||
maxKC + 1,
|
||||
struct xkb_sym_map);
|
||||
if (!xkb->map->key_sym_map) {
|
||||
free(prev_key_sym_map);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
bzero(&xkb->map->key_sym_map[xkb->max_key_code],
|
||||
tmp * sizeof(struct xkb_sym_map));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbKeySymsMask, maxKC,
|
||||
&changes->map.first_key_sym,
|
||||
&changes->map.num_key_syms);
|
||||
}
|
||||
|
||||
if (xkb->map->modmap) {
|
||||
unsigned char *prev_modmap = xkb->map->modmap;
|
||||
|
||||
xkb->map->modmap = _XkbTypedRealloc(xkb->map->modmap,
|
||||
maxKC + 1, unsigned char);
|
||||
if (!xkb->map->modmap) {
|
||||
free(prev_modmap);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
bzero(&xkb->map->modmap[xkb->max_key_code], tmp);
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbModifierMapMask, maxKC,
|
||||
&changes->map.first_modmap_key,
|
||||
&changes->map.num_modmap_keys);
|
||||
}
|
||||
}
|
||||
|
||||
if (xkb->server) {
|
||||
if (xkb->server->behaviors) {
|
||||
struct xkb_behavior *prev_behaviors = xkb->server->behaviors;
|
||||
|
||||
xkb->server->behaviors = _XkbTypedRealloc(xkb->server->behaviors,
|
||||
maxKC + 1,
|
||||
struct xkb_behavior);
|
||||
if (!xkb->server->behaviors) {
|
||||
free(prev_behaviors);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
bzero(&xkb->server->behaviors[xkb->max_key_code],
|
||||
tmp * sizeof(struct xkb_behavior));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbKeyBehaviorsMask, maxKC,
|
||||
&changes->map.first_key_behavior,
|
||||
&changes->map.num_key_behaviors);
|
||||
}
|
||||
|
||||
if (xkb->server->key_acts) {
|
||||
unsigned short *prev_key_acts = xkb->server->key_acts;
|
||||
|
||||
xkb->server->key_acts = _XkbTypedRealloc(xkb->server->key_acts,
|
||||
maxKC + 1,
|
||||
unsigned short);
|
||||
if (!xkb->server->key_acts) {
|
||||
free(prev_key_acts);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
bzero(&xkb->server->key_acts[xkb->max_key_code],
|
||||
tmp * sizeof(unsigned short));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbKeyActionsMask, maxKC,
|
||||
&changes->map.first_key_act,
|
||||
&changes->map.num_key_acts);
|
||||
}
|
||||
|
||||
if (xkb->server->vmodmap) {
|
||||
uint32_t *prev_vmodmap = xkb->server->vmodmap;
|
||||
|
||||
xkb->server->vmodmap = _XkbTypedRealloc(xkb->server->vmodmap,
|
||||
maxKC + 1,
|
||||
uint32_t);
|
||||
if (!xkb->server->vmodmap) {
|
||||
free(prev_vmodmap);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
bzero(&xkb->server->vmodmap[xkb->max_key_code],
|
||||
tmp * sizeof(uint32_t));
|
||||
if (changes)
|
||||
changes->map.changed = _ExtendRange(changes->map.changed,
|
||||
XkbVirtualModMapMask, maxKC,
|
||||
&changes->map.first_modmap_key,
|
||||
&changes->map.num_vmodmap_keys);
|
||||
}
|
||||
}
|
||||
|
||||
if (xkb->names && xkb->names->keys ) {
|
||||
struct xkb_key_name *prev_keys = xkb->names->keys;
|
||||
|
||||
xkb->names->keys = _XkbTypedRealloc(xkb->names->keys, maxKC + 1,
|
||||
struct xkb_key_name);
|
||||
if (!xkb->names->keys) {
|
||||
free(prev_keys);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
bzero(&xkb->names->keys[xkb->max_key_code],
|
||||
tmp * sizeof(struct xkb_key_name));
|
||||
if (changes)
|
||||
changes->names.changed = _ExtendRange(changes->names.changed,
|
||||
XkbKeyNamesMask, maxKC,
|
||||
&changes->names.first_key,
|
||||
&changes->names.num_keys);
|
||||
}
|
||||
|
||||
xkb->max_key_code = maxKC;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
union xkb_action *
|
||||
XkbcResizeKeyActions(struct xkb_desc * xkb, int key, int needed)
|
||||
{
|
||||
|
|
288
src/maprules.c
288
src/maprules.c
|
@ -889,7 +889,7 @@ XkbcRF_GetComponents( XkbRF_RulesPtr rules,
|
|||
names->compat && names->geometry ) || names->keymap;
|
||||
}
|
||||
|
||||
XkbRF_RulePtr
|
||||
static XkbRF_RulePtr
|
||||
XkbcRF_AddRule(XkbRF_RulesPtr rules)
|
||||
{
|
||||
if (rules->sz_rules<1) {
|
||||
|
@ -913,7 +913,7 @@ XkbcRF_AddRule(XkbRF_RulesPtr rules)
|
|||
return &rules->rules[rules->num_rules++];
|
||||
}
|
||||
|
||||
XkbRF_GroupPtr
|
||||
static XkbRF_GroupPtr
|
||||
XkbcRF_AddGroup(XkbRF_RulesPtr rules)
|
||||
{
|
||||
if (rules->sz_groups<1) {
|
||||
|
@ -968,290 +968,6 @@ XkbRF_GroupRec tgroup,*group;
|
|||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XkbcRF_LoadRulesByName(char *base,char *locale,XkbRF_RulesPtr rules)
|
||||
{
|
||||
FILE * file;
|
||||
char buf[PATH_MAX];
|
||||
Bool ok;
|
||||
|
||||
if ((!base)||(!rules))
|
||||
return False;
|
||||
if (locale) {
|
||||
if (strlen(base)+strlen(locale)+2 > PATH_MAX)
|
||||
return False;
|
||||
sprintf(buf,"%s-%s", base, locale);
|
||||
}
|
||||
else {
|
||||
if (strlen(base)+1 > PATH_MAX)
|
||||
return False;
|
||||
strcpy(buf,base);
|
||||
}
|
||||
|
||||
file= fopen(buf, "r");
|
||||
if ((!file)&&(locale)) { /* fallback if locale was specified */
|
||||
strcpy(buf,base);
|
||||
file= fopen(buf, "r");
|
||||
}
|
||||
if (!file)
|
||||
return False;
|
||||
ok= XkbcRF_LoadRules(file,rules);
|
||||
fclose(file);
|
||||
return ok;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
#define HEAD_NONE 0
|
||||
#define HEAD_MODEL 1
|
||||
#define HEAD_LAYOUT 2
|
||||
#define HEAD_VARIANT 3
|
||||
#define HEAD_OPTION 4
|
||||
#define HEAD_EXTRA 5
|
||||
|
||||
XkbRF_VarDescPtr
|
||||
XkbcRF_AddVarDesc(XkbRF_DescribeVarsPtr vars)
|
||||
{
|
||||
if (vars->sz_desc<1) {
|
||||
vars->sz_desc= 16;
|
||||
vars->num_desc= 0;
|
||||
vars->desc= _XkbTypedCalloc(vars->sz_desc,XkbRF_VarDescRec);
|
||||
}
|
||||
else if (vars->num_desc>=vars->sz_desc) {
|
||||
vars->sz_desc*= 2;
|
||||
vars->desc= _XkbTypedRealloc(vars->desc,vars->sz_desc,XkbRF_VarDescRec);
|
||||
}
|
||||
if (!vars->desc) {
|
||||
vars->sz_desc= vars->num_desc= 0;
|
||||
PR_DEBUG("Allocation failure in XkbcRF_AddVarDesc\n");
|
||||
return NULL;
|
||||
}
|
||||
vars->desc[vars->num_desc].name= NULL;
|
||||
vars->desc[vars->num_desc].desc= NULL;
|
||||
return &vars->desc[vars->num_desc++];
|
||||
}
|
||||
|
||||
XkbRF_VarDescPtr
|
||||
XkbcRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars,XkbRF_VarDescPtr from)
|
||||
{
|
||||
XkbRF_VarDescPtr nd;
|
||||
|
||||
if ((nd=XkbcRF_AddVarDesc(vars))!=NULL) {
|
||||
nd->name= _XkbDupString(from->name);
|
||||
nd->desc= _XkbDupString(from->desc);
|
||||
}
|
||||
return nd;
|
||||
}
|
||||
|
||||
XkbRF_DescribeVarsPtr
|
||||
XkbcRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name)
|
||||
{
|
||||
if (rules->sz_extra<1) {
|
||||
rules->num_extra= 0;
|
||||
rules->sz_extra= 1;
|
||||
rules->extra_names= _XkbTypedCalloc(rules->sz_extra,char *);
|
||||
rules->extra= _XkbTypedCalloc(rules->sz_extra, XkbRF_DescribeVarsRec);
|
||||
}
|
||||
else if (rules->num_extra>=rules->sz_extra) {
|
||||
rules->sz_extra*= 2;
|
||||
rules->extra_names= _XkbTypedRealloc(rules->extra_names,rules->sz_extra,
|
||||
char *);
|
||||
rules->extra=_XkbTypedRealloc(rules->extra, rules->sz_extra,
|
||||
XkbRF_DescribeVarsRec);
|
||||
}
|
||||
if ((!rules->extra_names)||(!rules->extra)) {
|
||||
PR_DEBUG("allocation error in extra parts\n");
|
||||
rules->sz_extra= rules->num_extra= 0;
|
||||
rules->extra_names= NULL;
|
||||
rules->extra= NULL;
|
||||
return NULL;
|
||||
}
|
||||
rules->extra_names[rules->num_extra]= _XkbDupString(name);
|
||||
bzero(&rules->extra[rules->num_extra],sizeof(XkbRF_DescribeVarsRec));
|
||||
return &rules->extra[rules->num_extra++];
|
||||
}
|
||||
|
||||
Bool
|
||||
XkbcRF_LoadDescriptions(FILE *file,XkbRF_RulesPtr rules)
|
||||
{
|
||||
InputLine line;
|
||||
XkbRF_VarDescRec tmp;
|
||||
char *tok;
|
||||
int len,headingtype,extra_ndx = 0;
|
||||
|
||||
bzero((char *)&tmp, sizeof(XkbRF_VarDescRec));
|
||||
headingtype = HEAD_NONE;
|
||||
InitInputLine(&line);
|
||||
for ( ; GetInputLine(file,&line,False); line.num_line= 0) {
|
||||
if (line.line[0]=='!') {
|
||||
tok = strtok(&(line.line[1]), " \t");
|
||||
if (strcmp(tok,"model") == 0)
|
||||
headingtype = HEAD_MODEL;
|
||||
else if (_XkbStrCaseCmp(tok,"layout") == 0)
|
||||
headingtype = HEAD_LAYOUT;
|
||||
else if (_XkbStrCaseCmp(tok,"variant") == 0)
|
||||
headingtype = HEAD_VARIANT;
|
||||
else if (_XkbStrCaseCmp(tok,"option") == 0)
|
||||
headingtype = HEAD_OPTION;
|
||||
else {
|
||||
int i;
|
||||
headingtype = HEAD_EXTRA;
|
||||
extra_ndx= -1;
|
||||
for (i=0;(i<rules->num_extra)&&(extra_ndx<0);i++) {
|
||||
if (_XkbStrCaseCmp(tok,rules->extra_names[i]))
|
||||
extra_ndx= i;
|
||||
}
|
||||
if (extra_ndx<0) {
|
||||
XkbRF_DescribeVarsPtr var;
|
||||
PR_DEBUG1("Extra heading \"%s\" encountered\n",tok);
|
||||
var= XkbcRF_AddVarToDescribe(rules,tok);
|
||||
if (var)
|
||||
extra_ndx= var-rules->extra;
|
||||
else headingtype= HEAD_NONE;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (headingtype == HEAD_NONE) {
|
||||
PR_DEBUG("Must have a heading before first line of data\n");
|
||||
PR_DEBUG("Illegal line of data ignored\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
len = strlen(line.line);
|
||||
if ((tmp.name= strtok(line.line, " \t")) == NULL) {
|
||||
PR_DEBUG("Huh? No token on line\n");
|
||||
PR_DEBUG("Illegal line of data ignored\n");
|
||||
continue;
|
||||
}
|
||||
if (strlen(tmp.name) == len) {
|
||||
PR_DEBUG("No description found\n");
|
||||
PR_DEBUG("Illegal line of data ignored\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
tok = line.line + strlen(tmp.name) + 1;
|
||||
while ((*tok!='\n')&&isspace(*tok))
|
||||
tok++;
|
||||
if (*tok == '\0') {
|
||||
PR_DEBUG("No description found\n");
|
||||
PR_DEBUG("Illegal line of data ignored\n");
|
||||
continue;
|
||||
}
|
||||
tmp.desc= tok;
|
||||
switch (headingtype) {
|
||||
case HEAD_MODEL:
|
||||
XkbcRF_AddVarDescCopy(&rules->models,&tmp);
|
||||
break;
|
||||
case HEAD_LAYOUT:
|
||||
XkbcRF_AddVarDescCopy(&rules->layouts,&tmp);
|
||||
break;
|
||||
case HEAD_VARIANT:
|
||||
XkbcRF_AddVarDescCopy(&rules->variants,&tmp);
|
||||
break;
|
||||
case HEAD_OPTION:
|
||||
XkbcRF_AddVarDescCopy(&rules->options,&tmp);
|
||||
break;
|
||||
case HEAD_EXTRA:
|
||||
XkbcRF_AddVarDescCopy(&rules->extra[extra_ndx],&tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
FreeInputLine(&line);
|
||||
if ((rules->models.num_desc==0) && (rules->layouts.num_desc==0) &&
|
||||
(rules->variants.num_desc==0) && (rules->options.num_desc==0) &&
|
||||
(rules->num_extra==0)) {
|
||||
return False;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XkbcRF_LoadDescriptionsByName(char *base,char *locale,XkbRF_RulesPtr rules)
|
||||
{
|
||||
FILE * file;
|
||||
char buf[PATH_MAX];
|
||||
Bool ok;
|
||||
|
||||
if ((!base)||(!rules))
|
||||
return False;
|
||||
if (locale) {
|
||||
if (strlen(base)+strlen(locale)+6 > PATH_MAX)
|
||||
return False;
|
||||
sprintf(buf,"%s-%s.lst", base, locale);
|
||||
}
|
||||
else {
|
||||
if (strlen(base)+5 > PATH_MAX)
|
||||
return False;
|
||||
sprintf(buf,"%s.lst", base);
|
||||
}
|
||||
|
||||
file= fopen(buf, "r");
|
||||
if ((!file)&&(locale)) { /* fallback if locale was specified */
|
||||
sprintf(buf,"%s.lst", base);
|
||||
|
||||
file= fopen(buf, "r");
|
||||
}
|
||||
if (!file)
|
||||
return False;
|
||||
ok= XkbcRF_LoadDescriptions(file,rules);
|
||||
fclose(file);
|
||||
return ok;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
XkbRF_RulesPtr
|
||||
XkbcRF_Load(char *base,char *locale,Bool wantDesc,Bool wantRules)
|
||||
{
|
||||
XkbRF_RulesPtr rules;
|
||||
|
||||
if ((!base)||((!wantDesc)&&(!wantRules)))
|
||||
return NULL;
|
||||
if ((rules=_XkbTypedCalloc(1,XkbRF_RulesRec))==NULL)
|
||||
return NULL;
|
||||
if (wantDesc&&(!XkbcRF_LoadDescriptionsByName(base,locale,rules))) {
|
||||
XkbcRF_Free(rules,True);
|
||||
return NULL;
|
||||
}
|
||||
if (wantRules&&(!XkbcRF_LoadRulesByName(base,locale,rules))) {
|
||||
XkbcRF_Free(rules,True);
|
||||
return NULL;
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
XkbRF_RulesPtr
|
||||
XkbcRF_Create(int szRules,int szExtra)
|
||||
{
|
||||
XkbRF_RulesPtr rules;
|
||||
|
||||
if ((rules=_XkbTypedCalloc(1,XkbRF_RulesRec))==NULL)
|
||||
return NULL;
|
||||
if (szRules>0) {
|
||||
rules->sz_rules= szRules;
|
||||
rules->rules= _XkbTypedCalloc(rules->sz_rules,XkbRF_RuleRec);
|
||||
if (!rules->rules) {
|
||||
free(rules);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (szExtra>0) {
|
||||
rules->sz_extra= szExtra;
|
||||
rules->extra= _XkbTypedCalloc(rules->sz_extra,XkbRF_DescribeVarsRec);
|
||||
if (!rules->extra) {
|
||||
if (rules->rules)
|
||||
free(rules->rules);
|
||||
free(rules);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
static void
|
||||
XkbRF_ClearVarDescriptions(XkbRF_DescribeVarsPtr var)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ tbGetBuffer(unsigned int size)
|
|||
return rtrn;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
XkbcVModIndexText(struct xkb_desc * xkb, unsigned ndx)
|
||||
{
|
||||
int len;
|
||||
|
|
|
@ -34,28 +34,16 @@ authorization from the authors.
|
|||
extern int
|
||||
XkbcAllocCompatMap(struct xkb_desc * xkb, unsigned which, unsigned nSI);
|
||||
|
||||
extern void
|
||||
XkbcFreeCompatMap(struct xkb_desc * xkb, unsigned which, Bool freeMap);
|
||||
|
||||
extern int
|
||||
XkbcAllocNames(struct xkb_desc * xkb, unsigned which, int nTotalRG,
|
||||
int nTotalAliases);
|
||||
|
||||
extern void
|
||||
XkbcFreeNames(struct xkb_desc * xkb, unsigned which, Bool freeMap);
|
||||
|
||||
extern int
|
||||
XkbcAllocControls(struct xkb_desc * xkb, unsigned which);
|
||||
|
||||
extern void
|
||||
XkbcFreeControls(struct xkb_desc * xkb, unsigned which, Bool freeMap);
|
||||
|
||||
extern int
|
||||
XkbcAllocIndicatorMaps(struct xkb_desc * xkb);
|
||||
|
||||
extern void
|
||||
XkbcFreeIndicatorMaps(struct xkb_desc * xkb);
|
||||
|
||||
extern struct xkb_desc *
|
||||
XkbcAllocKeyboard(void);
|
||||
|
||||
|
@ -73,20 +61,9 @@ XkbcAllocServerMap(struct xkb_desc * xkb, unsigned which, unsigned nNewActions);
|
|||
extern int
|
||||
XkbcCopyKeyType(struct xkb_key_type * from, struct xkb_key_type *into);
|
||||
|
||||
extern int
|
||||
XkbcCopyKeyTypes(struct xkb_key_type * from, struct xkb_key_type *into, int num_types);
|
||||
|
||||
extern int
|
||||
XkbcResizeKeyType(struct xkb_desc * xkb, int type_ndx, int map_count,
|
||||
Bool want_preserve, int new_num_lvls);
|
||||
|
||||
extern uint32_t *
|
||||
XkbcResizeKeySyms(struct xkb_desc * xkb, int key, int needed);
|
||||
|
||||
extern int
|
||||
XkbcChangeKeycodeRange(struct xkb_desc * xkb, int minKC, int maxKC,
|
||||
struct xkb_changes * changes);
|
||||
|
||||
extern union xkb_action *
|
||||
XkbcResizeKeyActions(struct xkb_desc * xkb, int key, int needed);
|
||||
|
||||
|
|
|
@ -1286,6 +1286,8 @@ ApplyActionFactoryDefaults(union xkb_action * action)
|
|||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
ActionsInit(void);
|
||||
|
||||
int
|
||||
HandleActionDef(ExprDef * def,
|
||||
|
@ -1448,7 +1450,7 @@ SetActionField(struct xkb_desc * xkb,
|
|||
|
||||
/***====================================================================***/
|
||||
|
||||
void
|
||||
static void
|
||||
ActionsInit(void)
|
||||
{
|
||||
if (!actionsInitialized)
|
||||
|
|
|
@ -79,8 +79,6 @@ extern int SetActionField(struct xkb_desc * /* xkb */ ,
|
|||
ActionInfo ** /* info_rtrn */
|
||||
);
|
||||
|
||||
extern void ActionsInit(void);
|
||||
|
||||
extern LookupEntry ctrlNames[];
|
||||
|
||||
#endif /* ACTION_H */
|
||||
|
|
|
@ -95,7 +95,7 @@ exprOpText(unsigned type)
|
|||
return buf;
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
exprTypeText(unsigned type)
|
||||
{
|
||||
static char buf[20];
|
||||
|
@ -210,32 +210,6 @@ RadioLookup(char * priv,
|
|||
return True;
|
||||
}
|
||||
|
||||
int
|
||||
TableLookup(char * priv,
|
||||
uint32_t elem, uint32_t field, unsigned type, ExprResult * val_rtrn)
|
||||
{
|
||||
LookupTable *tbl = (LookupTable *) priv;
|
||||
const char *str;
|
||||
|
||||
if ((priv == NULL) || (field == None) || (type != TypeInt))
|
||||
return False;
|
||||
str = XkbcAtomText(elem);
|
||||
while (tbl)
|
||||
{
|
||||
if (((str == NULL) && (tbl->element == NULL)) ||
|
||||
((str != NULL) && (tbl->element != NULL) &&
|
||||
(uStrCaseCmp(str, tbl->element) == 0)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
tbl = tbl->nextElement;
|
||||
}
|
||||
if (tbl == NULL) /* didn't find a matching element */
|
||||
return False;
|
||||
priv = (char *) tbl->entries;
|
||||
return SimpleLookup(priv, (uint32_t) None, field, type, val_rtrn);
|
||||
}
|
||||
|
||||
static LookupEntry modIndexNames[] = {
|
||||
{"shift", ShiftMapIndex},
|
||||
{"control", ControlMapIndex},
|
||||
|
@ -257,7 +231,7 @@ LookupModIndex(char * priv,
|
|||
val_rtrn);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
LookupModMask(char * priv,
|
||||
uint32_t elem, uint32_t field, unsigned type, ExprResult * val_rtrn)
|
||||
{
|
||||
|
@ -289,83 +263,6 @@ LookupModMask(char * priv,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveModIndex(ExprDef * expr,
|
||||
ExprResult * val_rtrn,
|
||||
IdentLookupFunc lookup, char * lookupPriv)
|
||||
{
|
||||
int ok = 0;
|
||||
char *bogus = NULL;
|
||||
|
||||
switch (expr->op)
|
||||
{
|
||||
case ExprValue:
|
||||
if (expr->type != TypeInt)
|
||||
{
|
||||
ERROR
|
||||
("Found constant of type %s where a modifier mask was expected\n",
|
||||
exprTypeText(expr->type));
|
||||
return False;
|
||||
}
|
||||
else if ((expr->value.ival >= XkbNumModifiers)
|
||||
|| (expr->value.ival < 0))
|
||||
{
|
||||
ERROR("Illegal modifier index (%d, must be 0..%d)\n",
|
||||
expr->value.ival, XkbNumModifiers - 1);
|
||||
return False;
|
||||
}
|
||||
val_rtrn->ival = expr->value.ival;
|
||||
return True;
|
||||
case ExprIdent:
|
||||
if (LookupModIndex(lookupPriv, (uint32_t) None, expr->value.str,
|
||||
(unsigned) TypeInt, val_rtrn))
|
||||
{
|
||||
return True;
|
||||
}
|
||||
if (lookup)
|
||||
{
|
||||
ok = (*lookup) (lookupPriv,
|
||||
None, expr->value.str, TypeInt, val_rtrn);
|
||||
}
|
||||
if (!ok)
|
||||
ERROR("Cannot determine modifier index for \"%s\"\n",
|
||||
XkbcAtomText(expr->value.str));
|
||||
break;
|
||||
case ExprFieldRef:
|
||||
bogus = "field reference";
|
||||
break;
|
||||
case ExprArrayRef:
|
||||
bogus = "array reference";
|
||||
break;
|
||||
case ExprActionDecl:
|
||||
bogus = "function";
|
||||
break;
|
||||
case OpAdd:
|
||||
case OpSubtract:
|
||||
case OpMultiply:
|
||||
case OpDivide:
|
||||
case OpInvert:
|
||||
case OpNegate:
|
||||
case OpNot:
|
||||
case OpUnaryPlus:
|
||||
bogus = "arithmetic operations";
|
||||
break;
|
||||
case OpAssign:
|
||||
bogus = "assignment";
|
||||
break;
|
||||
default:
|
||||
WSGO("Unknown operator %d in ResolveModIndex\n", expr->op);
|
||||
return False;
|
||||
}
|
||||
if (bogus)
|
||||
{
|
||||
ERROR("Modifier index must be a name or number, %s ignored\n",
|
||||
bogus);
|
||||
return False;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
int
|
||||
ExprResolveModMask(ExprDef * expr,
|
||||
ExprResult * val_rtrn,
|
||||
|
|
|
@ -42,9 +42,6 @@ typedef Bool(*IdentLookupFunc) (char * /* priv */ ,
|
|||
ExprResult * /* val_rtrn */
|
||||
);
|
||||
|
||||
extern char *exprTypeText(unsigned /* type */
|
||||
);
|
||||
|
||||
extern int ExprResolveLhs(ExprDef * /* expr */ ,
|
||||
ExprResult * /* elem_rtrn */ ,
|
||||
ExprResult * /* field_rtrn */ ,
|
||||
|
@ -89,13 +86,6 @@ extern int SimpleLookup(char * /* priv */ ,
|
|||
ExprResult * /* val_rtrn */
|
||||
);
|
||||
|
||||
extern int TableLookup(char * /* priv */ ,
|
||||
uint32_t /* elem */ ,
|
||||
uint32_t /* field */ ,
|
||||
unsigned /* type */ ,
|
||||
ExprResult * /* val_rtrn */
|
||||
);
|
||||
|
||||
extern int LookupModIndex(char * /* priv */ ,
|
||||
uint32_t /* elem */ ,
|
||||
uint32_t /* field */ ,
|
||||
|
@ -103,19 +93,6 @@ extern int LookupModIndex(char * /* priv */ ,
|
|||
ExprResult * /* val_rtrn */
|
||||
);
|
||||
|
||||
extern int LookupModMask(char * /* priv */ ,
|
||||
uint32_t /* elem */ ,
|
||||
uint32_t /* field */ ,
|
||||
unsigned /* type */ ,
|
||||
ExprResult * /* val_rtrn */
|
||||
);
|
||||
|
||||
extern int ExprResolveModIndex(ExprDef * /* expr */ ,
|
||||
ExprResult * /* val_rtrn */ ,
|
||||
IdentLookupFunc /* lookup */ ,
|
||||
char * /* lookupPriv */
|
||||
);
|
||||
|
||||
extern int ExprResolveModMask(ExprDef * /* expr */ ,
|
||||
ExprResult * /* val_rtrn */ ,
|
||||
IdentLookupFunc /* lookup */ ,
|
||||
|
|
|
@ -846,13 +846,9 @@ CompileKeycodes(XkbFile *file, struct xkb_desc * xkb, unsigned merge)
|
|||
{
|
||||
register int i;
|
||||
xkb->names->keycodes = XkbcInternAtom(info.name, False);
|
||||
uDEBUG2(1, "key range: %d..%d\n", xkb->min_key_code,
|
||||
xkb->max_key_code);
|
||||
for (i = info.computedMin; i <= info.computedMax; i++)
|
||||
{
|
||||
LongToKeyName(info.names[i], xkb->names->keys[i].name);
|
||||
uDEBUG2(2, "key %d = %s\n", i,
|
||||
XkbcKeyNameText(xkb->names->keys[i].name));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -80,7 +80,7 @@ typedef struct _KeyTypesInfo
|
|||
|
||||
uint32_t tok_ONE_LEVEL;
|
||||
uint32_t tok_TWO_LEVEL;
|
||||
uint32_t tok_ALPHABETIC;
|
||||
static uint32_t tok_ALPHABETIC;
|
||||
uint32_t tok_KEYPAD;
|
||||
|
||||
/***====================================================================***/
|
||||
|
@ -92,27 +92,6 @@ uint32_t tok_KEYPAD;
|
|||
|
||||
/***====================================================================***/
|
||||
|
||||
extern Bool AddMapEntry(struct xkb_desc * /* xkb */ ,
|
||||
KeyTypeInfo * /* type */ ,
|
||||
struct xkb_kt_map_entry * /* new */ ,
|
||||
Bool /* clobber */ ,
|
||||
Bool /* report */
|
||||
);
|
||||
|
||||
extern Bool AddPreserve(struct xkb_desc * /* xkb */ ,
|
||||
KeyTypeInfo * /* type */ ,
|
||||
PreserveInfo * /* new */ ,
|
||||
Bool /* clobber */ ,
|
||||
Bool /* report */
|
||||
);
|
||||
|
||||
extern Bool AddLevelName(KeyTypeInfo * /* type */ ,
|
||||
unsigned /* level */ ,
|
||||
uint32_t /* name */ ,
|
||||
Bool /* clobber */ ,
|
||||
Bool /* report */
|
||||
);
|
||||
|
||||
#define MapEntryTxt(x, e) \
|
||||
XkbcVModMaskText((x), (e)->mods.real_mods, (e)->mods.vmods)
|
||||
#define PreserveIndexTxt(x, p) \
|
||||
|
@ -540,7 +519,7 @@ NextMapEntry(KeyTypeInfo * type)
|
|||
return &type->entries[type->nEntries++];
|
||||
}
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
AddPreserve(struct xkb_desc * xkb,
|
||||
KeyTypeInfo * type, PreserveInfo * new, Bool clobber, Bool report)
|
||||
{
|
||||
|
@ -612,7 +591,7 @@ AddPreserve(struct xkb_desc * xkb,
|
|||
* @param clobber Overwrite existing entry.
|
||||
* @param report True if a warning is to be printed on.
|
||||
*/
|
||||
Bool
|
||||
static Bool
|
||||
AddMapEntry(struct xkb_desc * xkb,
|
||||
KeyTypeInfo * type,
|
||||
struct xkb_kt_map_entry * new, Bool clobber, Bool report)
|
||||
|
@ -781,7 +760,7 @@ SetPreserve(KeyTypeInfo * type,
|
|||
|
||||
/***====================================================================***/
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
AddLevelName(KeyTypeInfo * type,
|
||||
unsigned level, uint32_t name, Bool clobber, Bool report)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,6 @@ SOFTWARE.
|
|||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#define DEBUG_VAR listingDebug
|
||||
#include "xkbcomp.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -127,8 +126,6 @@ SOFTWARE.
|
|||
#define DFLT_XKB_CONFIG_ROOT "/usr/share/X11/xkb"
|
||||
#endif
|
||||
|
||||
unsigned int listingDebug;
|
||||
|
||||
typedef struct _CompPair {
|
||||
int num;
|
||||
int sz;
|
||||
|
|
|
@ -150,15 +150,6 @@ ReportBadType(const char *type, const char *field,
|
|||
return False;
|
||||
}
|
||||
|
||||
int
|
||||
ReportBadIndexType(const char *type, const char *field,
|
||||
const char *name, const char *wanted)
|
||||
{
|
||||
ERROR("Index for the %s %s field must be a %s\n", type, field, wanted);
|
||||
ACTION("Ignoring assignment to illegal field in %s\n", name);
|
||||
return False;
|
||||
}
|
||||
|
||||
int
|
||||
ReportBadField(const char *type, const char *field, const char *name)
|
||||
{
|
||||
|
@ -167,14 +158,6 @@ ReportBadField(const char *type, const char *field, const char *name)
|
|||
return False;
|
||||
}
|
||||
|
||||
int
|
||||
ReportMultipleDefs(const char *type, const char *field, const char *name)
|
||||
{
|
||||
WARN("Multiple definitions of %s in %s \"%s\"\n", field, type, name);
|
||||
ACTION("Using last definition\n");
|
||||
return False;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
Bool
|
||||
|
@ -202,23 +185,6 @@ UseNewField(unsigned field,
|
|||
return useNew;
|
||||
}
|
||||
|
||||
Bool
|
||||
MergeNewField(unsigned field,
|
||||
CommonInfo * oldDefs, CommonInfo * newDefs, unsigned *pCollide)
|
||||
{
|
||||
if ((oldDefs->defined & field) && (newDefs->defined & field))
|
||||
{
|
||||
if (((oldDefs->fileID == newDefs->fileID) && (warningLevel > 0)) ||
|
||||
(warningLevel > 9))
|
||||
{
|
||||
*pCollide |= field;
|
||||
}
|
||||
if (newDefs->merge == MergeAugment)
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
char *
|
||||
ClearCommonInfo(CommonInfo * cmn)
|
||||
{
|
||||
|
@ -263,189 +229,6 @@ typedef struct _KeyNameDesc
|
|||
Bool used;
|
||||
} KeyNameDesc;
|
||||
|
||||
static KeyNameDesc dfltKeys[] = {
|
||||
{XK_Escape, NoSymbol, "ESC\0"},
|
||||
{XK_quoteleft, XK_asciitilde, "TLDE"},
|
||||
{XK_1, XK_exclam, "AE01"},
|
||||
{XK_2, XK_at, "AE02"},
|
||||
{XK_3, XK_numbersign, "AE03"},
|
||||
{XK_4, XK_dollar, "AE04"},
|
||||
{XK_5, XK_percent, "AE05"},
|
||||
{XK_6, XK_asciicircum, "AE06"},
|
||||
{XK_7, XK_ampersand, "AE07"},
|
||||
{XK_8, XK_asterisk, "AE08"},
|
||||
{XK_9, XK_parenleft, "AE09"},
|
||||
{XK_0, XK_parenright, "AE10"},
|
||||
{XK_minus, XK_underscore, "AE11"},
|
||||
{XK_equal, XK_plus, "AE12"},
|
||||
{XK_BackSpace, NoSymbol, "BKSP"},
|
||||
{XK_Tab, NoSymbol, "TAB\0"},
|
||||
{XK_q, XK_Q, "AD01"},
|
||||
{XK_w, XK_W, "AD02"},
|
||||
{XK_e, XK_E, "AD03"},
|
||||
{XK_r, XK_R, "AD04"},
|
||||
{XK_t, XK_T, "AD05"},
|
||||
{XK_y, XK_Y, "AD06"},
|
||||
{XK_u, XK_U, "AD07"},
|
||||
{XK_i, XK_I, "AD08"},
|
||||
{XK_o, XK_O, "AD09"},
|
||||
{XK_p, XK_P, "AD10"},
|
||||
{XK_bracketleft, XK_braceleft, "AD11"},
|
||||
{XK_bracketright, XK_braceright, "AD12"},
|
||||
{XK_Return, NoSymbol, "RTRN"},
|
||||
{XK_Caps_Lock, NoSymbol, "CAPS"},
|
||||
{XK_a, XK_A, "AC01"},
|
||||
{XK_s, XK_S, "AC02"},
|
||||
{XK_d, XK_D, "AC03"},
|
||||
{XK_f, XK_F, "AC04"},
|
||||
{XK_g, XK_G, "AC05"},
|
||||
{XK_h, XK_H, "AC06"},
|
||||
{XK_j, XK_J, "AC07"},
|
||||
{XK_k, XK_K, "AC08"},
|
||||
{XK_l, XK_L, "AC09"},
|
||||
{XK_semicolon, XK_colon, "AC10"},
|
||||
{XK_quoteright, XK_quotedbl, "AC11"},
|
||||
{XK_Shift_L, NoSymbol, "LFSH"},
|
||||
{XK_z, XK_Z, "AB01"},
|
||||
{XK_x, XK_X, "AB02"},
|
||||
{XK_c, XK_C, "AB03"},
|
||||
{XK_v, XK_V, "AB04"},
|
||||
{XK_b, XK_B, "AB05"},
|
||||
{XK_n, XK_N, "AB06"},
|
||||
{XK_m, XK_M, "AB07"},
|
||||
{XK_comma, XK_less, "AB08"},
|
||||
{XK_period, XK_greater, "AB09"},
|
||||
{XK_slash, XK_question, "AB10"},
|
||||
{XK_backslash, XK_bar, "BKSL"},
|
||||
{XK_Control_L, NoSymbol, "LCTL"},
|
||||
{XK_space, NoSymbol, "SPCE"},
|
||||
{XK_Shift_R, NoSymbol, "RTSH"},
|
||||
{XK_Alt_L, NoSymbol, "LALT"},
|
||||
{XK_space, NoSymbol, "SPCE"},
|
||||
{XK_Control_R, NoSymbol, "RCTL"},
|
||||
{XK_Alt_R, NoSymbol, "RALT"},
|
||||
{XK_F1, NoSymbol, "FK01"},
|
||||
{XK_F2, NoSymbol, "FK02"},
|
||||
{XK_F3, NoSymbol, "FK03"},
|
||||
{XK_F4, NoSymbol, "FK04"},
|
||||
{XK_F5, NoSymbol, "FK05"},
|
||||
{XK_F6, NoSymbol, "FK06"},
|
||||
{XK_F7, NoSymbol, "FK07"},
|
||||
{XK_F8, NoSymbol, "FK08"},
|
||||
{XK_F9, NoSymbol, "FK09"},
|
||||
{XK_F10, NoSymbol, "FK10"},
|
||||
{XK_F11, NoSymbol, "FK11"},
|
||||
{XK_F12, NoSymbol, "FK12"},
|
||||
{XK_Print, NoSymbol, "PRSC"},
|
||||
{XK_Scroll_Lock, NoSymbol, "SCLK"},
|
||||
{XK_Pause, NoSymbol, "PAUS"},
|
||||
{XK_Insert, NoSymbol, "INS\0"},
|
||||
{XK_Home, NoSymbol, "HOME"},
|
||||
{XK_Prior, NoSymbol, "PGUP"},
|
||||
{XK_Delete, NoSymbol, "DELE"},
|
||||
{XK_End, NoSymbol, "END"},
|
||||
{XK_Next, NoSymbol, "PGDN"},
|
||||
{XK_Up, NoSymbol, "UP\0\0"},
|
||||
{XK_Left, NoSymbol, "LEFT"},
|
||||
{XK_Down, NoSymbol, "DOWN"},
|
||||
{XK_Right, NoSymbol, "RGHT"},
|
||||
{XK_Num_Lock, NoSymbol, "NMLK"},
|
||||
{XK_KP_Divide, NoSymbol, "KPDV"},
|
||||
{XK_KP_Multiply, NoSymbol, "KPMU"},
|
||||
{XK_KP_Subtract, NoSymbol, "KPSU"},
|
||||
{NoSymbol, XK_KP_7, "KP7\0"},
|
||||
{NoSymbol, XK_KP_8, "KP8\0"},
|
||||
{NoSymbol, XK_KP_9, "KP9\0"},
|
||||
{XK_KP_Add, NoSymbol, "KPAD"},
|
||||
{NoSymbol, XK_KP_4, "KP4\0"},
|
||||
{NoSymbol, XK_KP_5, "KP5\0"},
|
||||
{NoSymbol, XK_KP_6, "KP6\0"},
|
||||
{NoSymbol, XK_KP_1, "KP1\0"},
|
||||
{NoSymbol, XK_KP_2, "KP2\0"},
|
||||
{NoSymbol, XK_KP_3, "KP3\0"},
|
||||
{XK_KP_Enter, NoSymbol, "KPEN"},
|
||||
{NoSymbol, XK_KP_0, "KP0\0"},
|
||||
{XK_KP_Delete, NoSymbol, "KPDL"},
|
||||
{XK_less, XK_greater, "LSGT"},
|
||||
{XK_KP_Separator, NoSymbol, "KPCO"},
|
||||
{XK_Find, NoSymbol, "FIND"},
|
||||
{NoSymbol, NoSymbol, "\0\0\0\0"}
|
||||
};
|
||||
|
||||
int
|
||||
ComputeKbdDefaults(struct xkb_desc * xkb)
|
||||
{
|
||||
int rtrn;
|
||||
register int i, tmp, nUnknown;
|
||||
KeyNameDesc *name;
|
||||
uint32_t *syms;
|
||||
|
||||
if ((xkb->names == NULL) || (xkb->names->keys == NULL))
|
||||
{
|
||||
if ((rtrn = XkbcAllocNames(xkb, XkbKeyNamesMask, 0, 0)) != Success)
|
||||
return rtrn;
|
||||
}
|
||||
for (name = dfltKeys; (name->name[0] != '\0'); name++)
|
||||
{
|
||||
name->used = False;
|
||||
}
|
||||
nUnknown = 0;
|
||||
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++)
|
||||
{
|
||||
tmp = XkbKeyNumSyms(xkb, i);
|
||||
if ((xkb->names->keys[i].name[0] == '\0') && (tmp > 0))
|
||||
{
|
||||
tmp = XkbKeyGroupsWidth(xkb, i);
|
||||
syms = XkbKeySymsPtr(xkb, i);
|
||||
for (name = dfltKeys; (name->name[0] != '\0'); name++)
|
||||
{
|
||||
Bool match = True;
|
||||
if (((name->level1 != syms[0])
|
||||
&& (name->level1 != NoSymbol))
|
||||
|| ((name->level2 != NoSymbol) && (tmp < 2))
|
||||
|| ((name->level2 != syms[1])
|
||||
&& (name->level2 != NoSymbol)))
|
||||
{
|
||||
match = False;
|
||||
}
|
||||
if (match)
|
||||
{
|
||||
if (!name->used)
|
||||
{
|
||||
memcpy(xkb->names->keys[i].name, name->name,
|
||||
XkbKeyNameLength);
|
||||
name->used = True;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (warningLevel > 2)
|
||||
{
|
||||
WARN
|
||||
("Several keys match pattern for %s\n",
|
||||
XkbcKeyNameText(name->name));
|
||||
ACTION("Using <U%03d> for key %d\n",
|
||||
nUnknown, i);
|
||||
}
|
||||
sprintf(xkb->names->keys[i].name, "U%03d",
|
||||
nUnknown++);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (xkb->names->keys[i].name[0] == '\0')
|
||||
{
|
||||
if (warningLevel > 2)
|
||||
{
|
||||
WARN("Key %d does not match any defaults\n", i);
|
||||
ACTION("Using name <U%03d>\n", nUnknown);
|
||||
sprintf(xkb->names->keys[i].name, "U%03d", nUnknown++);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the key with the given name and return its keycode in kc_rtrn.
|
||||
*
|
||||
|
|
|
@ -41,12 +41,6 @@ extern Bool UseNewField(unsigned /* field */ ,
|
|||
unsigned * /* pCollide */
|
||||
);
|
||||
|
||||
extern Bool MergeNewField(unsigned /* field */ ,
|
||||
CommonInfo * /* oldDefs */ ,
|
||||
CommonInfo * /* newDefs */ ,
|
||||
unsigned * /* pCollide */
|
||||
);
|
||||
|
||||
extern char * ClearCommonInfo(CommonInfo * /* cmn */
|
||||
);
|
||||
|
||||
|
@ -70,31 +64,17 @@ extern int ReportBadType(const char * /* type */ ,
|
|||
const char * /* wanted */
|
||||
);
|
||||
|
||||
extern int ReportBadIndexType(const char * /* type */ ,
|
||||
const char * /* field */ ,
|
||||
const char * /* name */ ,
|
||||
const char * /* wanted */
|
||||
);
|
||||
|
||||
extern int ReportBadField(const char * /* type */ ,
|
||||
const char * /* field */ ,
|
||||
const char * /* name */
|
||||
);
|
||||
|
||||
extern int ReportMultipleDefs(const char * /* type */ ,
|
||||
const char * /* field */ ,
|
||||
const char * /* which */
|
||||
);
|
||||
|
||||
extern Bool ProcessIncludeFile(IncludeStmt * /* stmt */ ,
|
||||
unsigned /* file_type */ ,
|
||||
XkbFile ** /* file_rtrn */ ,
|
||||
unsigned * /* merge_rtrn */
|
||||
);
|
||||
|
||||
extern int ComputeKbdDefaults(struct xkb_desc * /* xkb */
|
||||
);
|
||||
|
||||
extern Bool FindNamedKey(struct xkb_desc * /* xkb */ ,
|
||||
unsigned long /* name */ ,
|
||||
unsigned int * /* kc_rtrn */ ,
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
********************************************************/
|
||||
|
||||
#define DEBUG_VAR parseDebug
|
||||
#include "parseutils.h"
|
||||
#include "xkbmisc.h"
|
||||
#include "xkbpath.h"
|
||||
|
@ -482,16 +481,6 @@ KeyDeclCreate(char *name, ExprDef * expr)
|
|||
return key;
|
||||
}
|
||||
|
||||
KeyDef *
|
||||
KeyDeclMerge(KeyDef * into, KeyDef * from)
|
||||
{
|
||||
into->expr =
|
||||
(ExprDef *) AppendStmt(&into->expr->common, &from->expr->common);
|
||||
from->expr = NULL;
|
||||
free(from);
|
||||
return into;
|
||||
}
|
||||
|
||||
RowDef *
|
||||
RowDeclCreate(KeyDef * keys)
|
||||
{
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#ifndef XKBPARSE_H
|
||||
#define XKBPARSE_H 1
|
||||
|
||||
#ifndef DEBUG_VAR
|
||||
#define DEBUG_VAR parseDebug
|
||||
#endif
|
||||
|
||||
#include "xkbcomp.h"
|
||||
|
||||
extern char scanBuf[1024];
|
||||
|
@ -136,10 +132,6 @@ extern KeyDef *KeyDeclCreate(char * /* name */ ,
|
|||
ExprDef * /* expr */
|
||||
);
|
||||
|
||||
extern KeyDef *KeyDeclMerge(KeyDef * /* into */ ,
|
||||
KeyDef * /* from */
|
||||
);
|
||||
|
||||
extern RowDef *RowDeclCreate(KeyDef * /* keys */
|
||||
);
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@
|
|||
|
||||
extern uint32_t tok_ONE_LEVEL;
|
||||
extern uint32_t tok_TWO_LEVEL;
|
||||
extern uint32_t tok_ALPHABETIC;
|
||||
extern uint32_t tok_KEYPAD;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,138 +48,9 @@ recalloc(void * old, unsigned nOld, unsigned nNew, unsigned itemSize)
|
|||
return (void *) rtrn;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
/*** FUNCTION ENTRY TRACKING ***/
|
||||
/***====================================================================***/
|
||||
|
||||
static FILE *entryFile = NULL;
|
||||
int uEntryLevel;
|
||||
|
||||
Boolean
|
||||
uSetEntryFile(char *name)
|
||||
{
|
||||
if ((entryFile != NULL) && (entryFile != stderr))
|
||||
{
|
||||
fprintf(entryFile, "switching to %s\n", name ? name : "stderr");
|
||||
fclose(entryFile);
|
||||
}
|
||||
if (name != NullString)
|
||||
entryFile = fopen(name, "w");
|
||||
else
|
||||
entryFile = stderr;
|
||||
if (entryFile == NULL)
|
||||
{
|
||||
entryFile = stderr;
|
||||
return (False);
|
||||
}
|
||||
return (True);
|
||||
}
|
||||
|
||||
void
|
||||
uEntry(int l, char *s, ...)
|
||||
{
|
||||
int i;
|
||||
va_list args;
|
||||
|
||||
if (!entryFile)
|
||||
return;
|
||||
|
||||
for (i = 0; i < uEntryLevel; i++)
|
||||
{
|
||||
putc(' ', entryFile);
|
||||
}
|
||||
va_start(args, s);
|
||||
vfprintf(entryFile, s, args);
|
||||
va_end(args);
|
||||
uEntryLevel += l;
|
||||
}
|
||||
|
||||
void
|
||||
uExit(int l, char *rtVal)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!entryFile)
|
||||
return;
|
||||
|
||||
uEntryLevel -= l;
|
||||
if (uEntryLevel < 0)
|
||||
uEntryLevel = 0;
|
||||
for (i = 0; i < uEntryLevel; i++)
|
||||
{
|
||||
putc(' ', entryFile);
|
||||
}
|
||||
fprintf(entryFile, "---> %p\n", rtVal);
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
/*** PRINT FUNCTIONS ***/
|
||||
/***====================================================================***/
|
||||
|
||||
FILE *uDebugFile = NULL;
|
||||
int uDebugIndentLevel = 0;
|
||||
int uDebugIndentSize = 4;
|
||||
|
||||
Boolean
|
||||
uSetDebugFile(char *name)
|
||||
{
|
||||
if ((uDebugFile != NULL) && (uDebugFile != stderr))
|
||||
{
|
||||
fprintf(uDebugFile, "switching to %s\n", name ? name : "stderr");
|
||||
fclose(uDebugFile);
|
||||
}
|
||||
if (name != NullString)
|
||||
uDebugFile = fopen(name, "w");
|
||||
else
|
||||
uDebugFile = stderr;
|
||||
if (uDebugFile == NULL)
|
||||
{
|
||||
uDebugFile = stderr;
|
||||
return (False);
|
||||
}
|
||||
return (True);
|
||||
}
|
||||
|
||||
void
|
||||
uDebug(char *s, ...)
|
||||
{
|
||||
int i;
|
||||
va_list args;
|
||||
|
||||
if (!uDebugFile)
|
||||
return;
|
||||
|
||||
for (i = (uDebugIndentLevel * uDebugIndentSize); i > 0; i--)
|
||||
{
|
||||
putc(' ', uDebugFile);
|
||||
}
|
||||
va_start(args, s);
|
||||
vfprintf(uDebugFile, s, args);
|
||||
va_end(args);
|
||||
fflush(uDebugFile);
|
||||
}
|
||||
|
||||
void
|
||||
uDebugNOI(char *s, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!uDebugFile)
|
||||
return;
|
||||
|
||||
va_start(args, s);
|
||||
vfprintf(uDebugFile, s, args);
|
||||
va_end(args);
|
||||
fflush(uDebugFile);
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
static FILE *errorFile = NULL;
|
||||
static int outCount = 0;
|
||||
static char *preMsg = NULL;
|
||||
static char *postMsg = NULL;
|
||||
static char *prefix = NULL;
|
||||
|
||||
Boolean
|
||||
|
@ -326,36 +197,6 @@ uInternalError(const char *s, ...)
|
|||
outCount++;
|
||||
}
|
||||
|
||||
void
|
||||
uSetPreErrorMessage(char *msg)
|
||||
{
|
||||
outCount = 0;
|
||||
preMsg = msg;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
uSetPostErrorMessage(char *msg)
|
||||
{
|
||||
postMsg = msg;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
uSetErrorPrefix(char *pre)
|
||||
{
|
||||
prefix = pre;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
uFinishUp(void)
|
||||
{
|
||||
if (errorFile && (outCount > 0) && (postMsg != NULL))
|
||||
fprintf(errorFile, "%s\n", postMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
|
|
|
@ -123,19 +123,6 @@ uFatalError(const char *s, ...);
|
|||
extern __ATTR_PRINTF(1, 2) void
|
||||
uInternalError(const char *s, ...);
|
||||
|
||||
extern void
|
||||
uSetPreErrorMessage(char *msg);
|
||||
|
||||
extern void
|
||||
uSetPostErrorMessage(char *msg);
|
||||
|
||||
extern void
|
||||
uSetErrorPrefix(char *pre);
|
||||
|
||||
extern void
|
||||
uFinishUp(void);
|
||||
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
#define NullString ((char *)NULL)
|
||||
|
@ -173,109 +160,4 @@ uStrCasePrefix(const char *p, char *str);
|
|||
|
||||
extern unsigned int DEBUG_VAR;
|
||||
|
||||
extern __ATTR_PRINTF(1, 2) void
|
||||
uDebug(char *s, ...);
|
||||
|
||||
extern __ATTR_PRINTF(1, 2) void
|
||||
uDebugNOI(char *s, ...);
|
||||
|
||||
extern Boolean
|
||||
uSetDebugFile(char *name);
|
||||
|
||||
extern FILE *uDebugFile;
|
||||
extern int uDebugIndentLevel;
|
||||
extern int uDebugIndentSize;
|
||||
|
||||
#define uDebugIndent(l) (uDebugIndentLevel+=(l))
|
||||
#define uDebugOutdent(l) (uDebugIndentLevel-=(l))
|
||||
#ifdef DEBUG_ON
|
||||
#define uDEBUG(f,s) { if (DEBUG_VAR&(f)) uDebug(s);}
|
||||
#define uDEBUG1(f,s,a) { if (DEBUG_VAR&(f)) uDebug(s,a);}
|
||||
#define uDEBUG2(f,s,a,b) { if (DEBUG_VAR&(f)) uDebug(s,a,b);}
|
||||
#define uDEBUG3(f,s,a,b,c) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c);}
|
||||
#define uDEBUG4(f,s,a,b,c,d) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c,d);}
|
||||
#define uDEBUG5(f,s,a,b,c,d,e) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c,d,e);}
|
||||
#define uDEBUG_NOI(f,s) { if (DEBUG_VAR&(f)) uDebug(s);}
|
||||
#define uDEBUG_NOI1(f,s,a) { if (DEBUG_VAR&(f)) uDebugNOI(s,a);}
|
||||
#define uDEBUG_NOI2(f,s,a,b) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b);}
|
||||
#define uDEBUG_NOI3(f,s,a,b,c) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b,c);}
|
||||
#define uDEBUG_NOI4(f,s,a,b,c,d) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b,c,d);}
|
||||
#define uDEBUG_NOI5(f,s,a,b,c,d,e) { if (DEBUG_VAR&(f)) uDebugNOI(s,a,b,c,d,e);}
|
||||
#else
|
||||
#define uDEBUG(f,s)
|
||||
#define uDEBUG1(f,s,a)
|
||||
#define uDEBUG2(f,s,a,b)
|
||||
#define uDEBUG3(f,s,a,b,c)
|
||||
#define uDEBUG4(f,s,a,b,c,d)
|
||||
#define uDEBUG5(f,s,a,b,c,d,e)
|
||||
#define uDEBUG_NOI(f,s)
|
||||
#define uDEBUG_NOI1(f,s,a)
|
||||
#define uDEBUG_NOI2(f,s,a,b)
|
||||
#define uDEBUG_NOI3(f,s,a,b,c)
|
||||
#define uDEBUG_NOI4(f,s,a,b,c,d)
|
||||
#define uDEBUG_NOI5(f,s,a,b,c,d,e)
|
||||
#endif
|
||||
|
||||
extern Boolean
|
||||
uSetEntryFile(char *name);
|
||||
|
||||
extern __ATTR_PRINTF(2, 3) void
|
||||
uEntry(int l, char *s, ...);
|
||||
|
||||
extern void
|
||||
uExit(int l, char *rtVal);
|
||||
|
||||
#ifdef ENTRY_TRACKING_ON
|
||||
#define ENTRY_BIT 0x10
|
||||
#define LOW_ENTRY_BIT 0x1000
|
||||
#define ENTER (DEBUG_VAR&ENTRY_BIT)
|
||||
#define FLAG(fLag) (DEBUG_VAR&(fLag))
|
||||
|
||||
extern int uEntryLevel;
|
||||
|
||||
#define uENTRY(s) { if (ENTER) uEntry(1,s);}
|
||||
#define uENTRY1(s,a) { if (ENTER) uEntry(1,s,a);}
|
||||
#define uENTRY2(s,a,b) { if (ENTER) uEntry(1,s,a,b);}
|
||||
#define uENTRY3(s,a,b,c) { if (ENTER) uEntry(1,s,a,b,c);}
|
||||
#define uENTRY4(s,a,b,c,d) { if (ENTER) uEntry(1,s,a,b,c,d);}
|
||||
#define uENTRY5(s,a,b,c,d,e) { if (ENTER) uEntry(1,s,a,b,c,d,e);}
|
||||
#define uENTRY6(s,a,b,c,d,e,f) { if (ENTER) uEntry(1,s,a,b,c,d,e,f);}
|
||||
#define uENTRY7(s,a,b,c,d,e,f,g) { if (ENTER) uEntry(1,s,a,b,c,d,e,f,g);}
|
||||
#define uRETURN(v) { if (ENTER) uEntryLevel--; return(v); }
|
||||
#define uVOIDRETURN { if (ENTER) uEntryLevel--; return; }
|
||||
|
||||
#define uFLAG_ENTRY(w,s) { if (FLAG(w)) uEntry(0,s);}
|
||||
#define uFLAG_ENTRY1(w,s,a) { if (FLAG(w)) uEntry(0,s,a);}
|
||||
#define uFLAG_ENTRY2(w,s,a,b) { if (FLAG(w)) uEntry(0,s,a,b);}
|
||||
#define uFLAG_ENTRY3(w,s,a,b,c) { if (FLAG(w)) uEntry(0,s,a,b,c);}
|
||||
#define uFLAG_ENTRY4(w,s,a,b,c,d) { if (FLAG(w)) uEntry(0,s,a,b,c,d);}
|
||||
#define uFLAG_ENTRY5(w,s,a,b,c,d,e) { if (FLAG(w)) uEntry(0,s,a,b,c,d,e);}
|
||||
#define uFLAG_ENTRY6(w,s,a,b,c,d,e,f) { if (FLAG(w)) uEntry(0,s,a,b,c,d,e,f);}
|
||||
#define uFLAG_ENTRY7(w,s,a,b,c,d,e,f,g) { if(FLAG(w))uEntry(0,s,a,b,c,d,e,f,g);}
|
||||
#define uFLAG_RETURN(v) { return(v);}
|
||||
#define uFLAG_VOIDRETURN { return; }
|
||||
#else
|
||||
#define uENTRY(s)
|
||||
#define uENTRY1(s,a)
|
||||
#define uENTRY2(s,a1,a2)
|
||||
#define uENTRY3(s,a1,a2,a3)
|
||||
#define uENTRY4(s,a1,a2,a3,a4)
|
||||
#define uENTRY5(s,a1,a2,a3,a4,a5)
|
||||
#define uENTRY6(s,a1,a2,a3,a4,a5,a6)
|
||||
#define uENTRY7(s,a1,a2,a3,a4,a5,a6,a7)
|
||||
#define uRETURN(v) { return(v); }
|
||||
#define uVOIDRETURN { return; }
|
||||
|
||||
#define uFLAG_ENTRY(f,s)
|
||||
#define uFLAG_ENTRY1(f,s,a)
|
||||
#define uFLAG_ENTRY2(f,s,a,b)
|
||||
#define uFLAG_ENTRY3(f,s,a,b,c)
|
||||
#define uFLAG_ENTRY4(f,s,a,b,c,d)
|
||||
#define uFLAG_ENTRY5(f,s,a,b,c,d,e)
|
||||
#define uFLAG_ENTRY6(f,s,a,b,c,d,e,g)
|
||||
#define uFLAG_ENTRY7(f,s,a,b,c,d,e,g,h)
|
||||
#define uFLAG_RETURN(v) { return(v);}
|
||||
#define uFLAG_VOIDRETURN { return; }
|
||||
#endif
|
||||
|
||||
#endif /* UTILS_H */
|
||||
|
|
|
@ -161,7 +161,7 @@ HandleVModDef(VModDef * stmt, unsigned mergeMode, VModInfo * info)
|
|||
* @return True on success, False otherwise. If False is returned, val_rtrn is
|
||||
* undefined.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
LookupVModIndex(char * priv,
|
||||
uint32_t elem, uint32_t field, unsigned type, ExprResult * val_rtrn)
|
||||
{
|
||||
|
|
|
@ -53,13 +53,6 @@ extern Bool ApplyVModDefs(VModInfo * /* info */ ,
|
|||
struct xkb_desc * /* xkb */
|
||||
);
|
||||
|
||||
extern int LookupVModIndex(char * /* priv */ ,
|
||||
uint32_t /* elem */ ,
|
||||
uint32_t /* field */ ,
|
||||
unsigned /* type */ ,
|
||||
ExprResult * /* val_rtrn */
|
||||
);
|
||||
|
||||
extern int LookupVModMask(char * /* priv */ ,
|
||||
uint32_t /* elem */ ,
|
||||
uint32_t /* field */ ,
|
||||
|
|
|
@ -92,15 +92,12 @@
|
|||
#ifdef DEBUG
|
||||
#define YYDEBUG 1
|
||||
#endif
|
||||
#define DEBUG_VAR parseDebug
|
||||
#include "parseutils.h"
|
||||
#include "xkbmisc.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
unsigned int parseDebug;
|
||||
|
||||
%}
|
||||
%right EQUALS
|
||||
%left PLUS MINUS
|
||||
|
|
|
@ -157,10 +157,13 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
|||
return True;
|
||||
}
|
||||
|
||||
static void
|
||||
XkbAddDefaultDirectoriesToPath(void);
|
||||
|
||||
/**
|
||||
* Init memory for include paths.
|
||||
*/
|
||||
Bool
|
||||
static Bool
|
||||
XkbInitIncludePath(void)
|
||||
{
|
||||
if (includePath)
|
||||
|
@ -175,20 +178,10 @@ XkbInitIncludePath(void)
|
|||
return True;
|
||||
}
|
||||
|
||||
void
|
||||
XkbAddDefaultDirectoriesToPath(void)
|
||||
{
|
||||
if (!XkbInitIncludePath())
|
||||
return;
|
||||
if (noDefaultPath)
|
||||
return;
|
||||
XkbAddDirectoryToPath(DFLT_XKB_CONFIG_ROOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all entries from the global includePath.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
XkbClearIncludePath(void)
|
||||
{
|
||||
register int i;
|
||||
|
@ -213,7 +206,7 @@ XkbClearIncludePath(void)
|
|||
* Add the given path to the global includePath variable.
|
||||
* If dir is NULL, the includePath is emptied.
|
||||
*/
|
||||
Bool
|
||||
static Bool
|
||||
XkbAddDirectoryToPath(const char *dir)
|
||||
{
|
||||
int len;
|
||||
|
@ -256,6 +249,16 @@ XkbAddDirectoryToPath(const char *dir)
|
|||
return True;
|
||||
}
|
||||
|
||||
static void
|
||||
XkbAddDefaultDirectoriesToPath(void)
|
||||
{
|
||||
if (!XkbInitIncludePath())
|
||||
return;
|
||||
if (noDefaultPath)
|
||||
return;
|
||||
XkbAddDirectoryToPath(DFLT_XKB_CONFIG_ROOT);
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,15 +31,6 @@
|
|||
#include <X11/X.h>
|
||||
#include <X11/Xdefs.h>
|
||||
|
||||
extern Bool XkbInitIncludePath(void);
|
||||
|
||||
extern void XkbClearIncludePath(void);
|
||||
|
||||
extern void XkbAddDefaultDirectoriesToPath(void);
|
||||
|
||||
extern Bool XkbAddDirectoryToPath(const char * /* dir */
|
||||
);
|
||||
|
||||
extern char *XkbDirectoryForInclude(unsigned /* type */
|
||||
);
|
||||
|
||||
|
|
|
@ -29,12 +29,9 @@
|
|||
#include <X11/Xos.h>
|
||||
|
||||
#include "tokens.h"
|
||||
#define DEBUG_VAR scanDebug
|
||||
#include "utils.h"
|
||||
#include "parseutils.h"
|
||||
|
||||
unsigned int scanDebug;
|
||||
|
||||
FILE *yyin = NULL;
|
||||
|
||||
static char scanFileBuf[1024] = {0};
|
||||
|
|
|
@ -31,101 +31,18 @@ authorization from the authors.
|
|||
#include <X11/Xdefs.h>
|
||||
#include "X11/extensions/XKBcommon.h"
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomProperties(struct xkb_geometry * geom, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomKeyAliases(struct xkb_geometry * geom, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomColors(struct xkb_geometry * geom, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomPoints(struct xkb_outline * outline, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomOutlines(struct xkb_shape * shape, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomShapes(struct xkb_geometry * geom, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomOverlayKeys(struct xkb_overlay_row * row, int first, int count,
|
||||
Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomOverlayRows(struct xkb_overlay * overlay, int first, int count,
|
||||
Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomOverlays(struct xkb_section * section, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomKeys(struct xkb_row * row, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomRows(struct xkb_section * section, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomSections(struct xkb_geometry * geom, int first, int count, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeomDoodads(union xkb_doodad * doodads, int nDoodads, Bool freeAll);
|
||||
|
||||
extern void
|
||||
XkbcFreeGeometry(struct xkb_geometry * geom, unsigned which, Bool freeMap);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomProps(struct xkb_geometry * geom, int nProps);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomColors(struct xkb_geometry * geom, int nColors);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomKeyAliases(struct xkb_geometry * geom, int nKeyAliases);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomShapes(struct xkb_geometry * geom, int nShapes);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomSections(struct xkb_geometry * geom, int nSections);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomOverlays(struct xkb_section * section, int nOverlays);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomOverlayRows(struct xkb_overlay * overlay, int nRows);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomOverlayKeys(struct xkb_overlay_row * row, int nKeys);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomDoodads(struct xkb_geometry * geom, int nDoodads);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomSectionDoodads(struct xkb_section * section, int nDoodads);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomOutlines(struct xkb_shape * shape, int nOL);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomRows(struct xkb_section * section, int nRows);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomPoints(struct xkb_outline * ol, int nPts);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeomKeys(struct xkb_row * row, int nKeys);
|
||||
|
||||
extern int
|
||||
XkbcAllocGeometry(struct xkb_desc * xkb, struct xkb_geometry_sizes * sizes);
|
||||
|
||||
extern struct xkb_property *
|
||||
XkbcAddGeomProperty(struct xkb_geometry * geom, const char *name, const char *value);
|
||||
|
||||
extern struct xkb_key_alias *
|
||||
XkbcAddGeomKeyAlias(struct xkb_geometry * geom, const char *aliasStr, const char *realStr);
|
||||
|
||||
extern struct xkb_color *
|
||||
XkbcAddGeomColor(struct xkb_geometry * geom, const char *spec, unsigned int pixel);
|
||||
|
||||
|
@ -148,10 +65,6 @@ XkbcAddGeomSection(struct xkb_geometry * geom, uint32_t name,
|
|||
extern union xkb_doodad *
|
||||
XkbcAddGeomDoodad(struct xkb_geometry * geom, struct xkb_section * section, uint32_t name);
|
||||
|
||||
extern struct xkb_overlay_key *
|
||||
XkbcAddGeomOverlayKey(struct xkb_overlay * overlay, struct xkb_overlay_row * row,
|
||||
const char *over, const char *under);
|
||||
|
||||
extern struct xkb_overlay_row *
|
||||
XkbcAddGeomOverlayRow(struct xkb_overlay * overlay, int row_under, int sz_keys);
|
||||
|
||||
|
@ -163,12 +76,6 @@ XkbcAddGeomOverlay(struct xkb_section * section, uint32_t name, int sz_rows);
|
|||
extern Bool
|
||||
XkbcComputeShapeBounds(struct xkb_shape * shape);
|
||||
|
||||
extern Bool
|
||||
XkbcComputeShapeTop(struct xkb_shape * shape, struct xkb_bounds * bounds);
|
||||
|
||||
extern Bool
|
||||
XkbcComputeRowBounds(struct xkb_geometry * geom, struct xkb_section * section, struct xkb_row * row);
|
||||
|
||||
extern Bool
|
||||
XkbcComputeSectionBounds(struct xkb_geometry * geom, struct xkb_section * section);
|
||||
|
||||
|
|
|
@ -78,9 +78,6 @@ XkbcInternAtom(const char *name, Bool onlyIfExists);
|
|||
extern const char *
|
||||
XkbcAtomText(uint32_t atm);
|
||||
|
||||
extern char *
|
||||
XkbcVModIndexText(struct xkb_desc * xkb, unsigned ndx);
|
||||
|
||||
extern char *
|
||||
XkbcVModMaskText(struct xkb_desc * xkb, unsigned modMask, unsigned mask);
|
||||
|
||||
|
|
|
@ -152,39 +152,9 @@ extern Bool
|
|||
XkbcRF_GetComponents(XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs,
|
||||
struct xkb_component_names * names);
|
||||
|
||||
extern XkbRF_RulePtr
|
||||
XkbcRF_AddRule(XkbRF_RulesPtr rules);
|
||||
|
||||
extern XkbRF_GroupPtr
|
||||
XkbcRF_AddGroup(XkbRF_RulesPtr rules);
|
||||
|
||||
extern Bool
|
||||
XkbcRF_LoadRules(FILE *file, XkbRF_RulesPtr rules);
|
||||
|
||||
extern Bool
|
||||
XkbcRF_LoadRulesByName(char *base, char *locale, XkbRF_RulesPtr rules);
|
||||
|
||||
extern XkbRF_VarDescPtr
|
||||
XkbcRF_AddVarDesc(XkbRF_DescribeVarsPtr vars);
|
||||
|
||||
extern XkbRF_VarDescPtr
|
||||
XkbcRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars, XkbRF_VarDescPtr from);
|
||||
|
||||
extern XkbRF_DescribeVarsPtr
|
||||
XkbcRF_AddVarToDescribe(XkbRF_RulesPtr rules, char *name);
|
||||
|
||||
extern Bool
|
||||
XkbcRF_LoadDescriptions(FILE *file, XkbRF_RulesPtr rules);
|
||||
|
||||
extern Bool
|
||||
XkbcRF_LoadDescriptionsByName(char *base, char *locale, XkbRF_RulesPtr rules);
|
||||
|
||||
extern XkbRF_RulesPtr
|
||||
XkbcRF_Load(char *base, char *locale, Bool wantDesc, Bool wantRules);
|
||||
|
||||
extern XkbRF_RulesPtr
|
||||
XkbcRF_Create(int szRules, int szExtra);
|
||||
|
||||
extern void
|
||||
XkbcRF_Free(XkbRF_RulesPtr rules, Bool freeRules);
|
||||
|
||||
|
|
Loading…
Reference in New Issue