Commit f3bacb47 authored by Bernhard Link's avatar Bernhard Link

start support for generic event extension

parent 9a9e0f97
......@@ -8,6 +8,7 @@ NEEDS "bigrequest.proto"
NEEDS "damage.proto"
NEEDS "dpms.proto"
NEEDS "fixes.proto"
NEEDS "genericevents.proto"
NEEDS "glx.proto"
NEEDS "mitshm.proto"
NEEDS "randr.proto"
......
# This file is part of "xtrace"
# Copyright (C) 2008 Bernhard R. Link
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
EXTENSION "Generic Event Extension" ge
USE core
REQUESTS
QueryVersion RESPONDS
END
EVENTS
Generic SPECIAL
END
ERRORS
END
REQUEST QueryVersion
4 "major version" UINT16
6 "minor version" UINT16
END
RESPONSE QueryVersion
8 "major version" UINT16
10 "minor version" UINT16
END
EVENT Generic
1 extension CARD8
4 length UINT32
32 data LISTofCARD8
END
EOF
......@@ -183,6 +183,7 @@ struct namespace {
const char *name;
int number;
bool unsupported;
bool special;
struct variable *event;
} *events;
int num_errors;
......@@ -1442,7 +1443,11 @@ static void parse_events(struct parser *parser) {
}
}
while( (attribute = get_const_token(parser, true)) != NULL ) {
if( strcmp(attribute, "UNSUPPORTED") == 0 )
if( strcmp(attribute, "SPECIAL") == 0 ) {
if( event.name == NULL )
error(parser, "SPECIAL not possible with UNKNOWN!");
event.special = true;
} else if( strcmp(attribute, "UNSUPPORTED") == 0 )
event.unsupported = true;
else if( attribute[0] == '/' && attribute[1] == '*' ) {
char *e;
......@@ -2295,9 +2300,11 @@ static const struct request *finalize_requests(struct parser *parser, struct nam
if( !ns->requests[i].special )
continue;
assert( rs[i].name != NULL );
if( strcmp(ns->name, "core") != 0 )
continue;
if( strcmp(rs[i].name, "QueryExtension") == 0 ) {
if( strcmp(ns->name, "core") != 0 ) {
fprintf(stderr, "No specials available in namespace '%s'!\n",
ns->name);
parser->error = true;
} else if( strcmp(rs[i].name, "QueryExtension") == 0 ) {
rs[i].request_func = requestQueryExtension;
rs[i].reply_func = replyQueryExtension;
} else if( strcmp(rs[i].name, "InternAtom") == 0 ) {
......@@ -2336,6 +2343,20 @@ static const struct event *finalize_events(struct parser *parser, struct namespa
es[i].name = ns->events[i].name;
es[i].parameters = variable_finalize(parser,
ns->events[i].event);
if( !ns->events[i].special )
continue;
assert( es[i].name != NULL );
if( strcmp(ns->name, "ge") != 0 ) {
fprintf(stderr, "No specials available in namespace '%s'!\n",
ns->name);
parser->error = true;
} else if( strcmp(es[i].name, "Generic") == 0 ) {
// TODO: ...
} else {
fprintf(stderr, "No specials available for '%s::%s'!\n",
ns->name, es[i].name);
parser->error = true;
}
}
f = finalize_data(es, ns->num_events * sizeof(struct event),
__alignof__(struct event));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment