@@ -99,7 +99,14 @@ pub struct Registry {
99
99
100
100
impl Registry {
101
101
/// Generate a registry from the supplied XML string
102
- pub fn new ( api : Api , filter : Filter ) -> Registry {
102
+ pub fn new ( api : Api , fallbacks : Fallbacks , extensions : Vec < String > , version : & str , profile : Profile ) -> Registry {
103
+ let filter = Filter {
104
+ fallbacks : fallbacks,
105
+ extensions : extensions,
106
+ version : version. to_string ( ) ,
107
+ profile : profile,
108
+ } ;
109
+
103
110
let src = match api {
104
111
Api :: Gl | Api :: GlCore | Api :: Gles1 | Api :: Gles2 => khronos_api:: GL_XML ,
105
112
Api :: Glx => self :: khronos_api:: GLX_XML ,
@@ -251,16 +258,15 @@ pub struct GlxOpcode {
251
258
}
252
259
253
260
struct RegistryParser < R : io:: Read > {
254
- pub api : Api ,
255
- pub reader : XmlEventReader < R > ,
261
+ api : Api ,
262
+ reader : XmlEventReader < R > ,
256
263
}
257
264
258
- pub struct Filter {
259
- pub api : Api ,
260
- pub fallbacks : Fallbacks ,
261
- pub extensions : Vec < String > ,
262
- pub profile : Profile ,
263
- pub version : String ,
265
+ struct Filter {
266
+ fallbacks : Fallbacks ,
267
+ extensions : Vec < String > ,
268
+ profile : Profile ,
269
+ version : String ,
264
270
}
265
271
266
272
/// A big, ugly, imperative impl with methods that accumulates a Registry struct
@@ -379,7 +385,7 @@ impl<R: io::Read> RegistryParser<R> {
379
385
let mut found_feature = false ;
380
386
for f in features. iter ( ) {
381
387
// XXX: verify that the string comparison with <= actually works as desired
382
- if f. api == filter . api && f. number <= filter. version {
388
+ if f. api == api && f. number <= filter. version {
383
389
for req in f. requires . iter ( ) {
384
390
desired_enums. extend ( req. enums . iter ( ) . map ( |x| x. clone ( ) ) ) ;
385
391
desired_cmds. extend ( req. commands . iter ( ) . map ( |x| x. clone ( ) ) ) ;
@@ -393,7 +399,7 @@ impl<R: io::Read> RegistryParser<R> {
393
399
// remove the things that should be removed
394
400
for f in features. iter ( ) {
395
401
// XXX: verify that the string comparison with <= actually works as desired
396
- if f. api == filter . api && f. number <= filter. version {
402
+ if f. api == api && f. number <= filter. version {
397
403
for rem in f. removes . iter ( ) {
398
404
if rem. profile == filter. profile {
399
405
for enm in rem. enums . iter ( ) {
@@ -415,8 +421,8 @@ impl<R: io::Read> RegistryParser<R> {
415
421
416
422
for extension in extensions. iter ( ) {
417
423
if filter. extensions . iter ( ) . any ( |x| x == & extension. name ) {
418
- if !extension. supported . iter ( ) . any ( |x| x == & filter . api ) {
419
- panic ! ( "Requested {}, which doesn't support the {} API" , extension. name, filter . api) ;
424
+ if !extension. supported . iter ( ) . any ( |x| x == & api) {
425
+ panic ! ( "Requested {}, which doesn't support the {} API" , extension. name, api) ;
420
426
}
421
427
for req in extension. requires . iter ( ) {
422
428
desired_enums. extend ( req. enums . iter ( ) . map ( |x| x. clone ( ) ) ) ;
0 commit comments