1#!/usr/bin/env python 2# 3# Copyright (c) 2017 The Khronos Group Inc. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# nextfree.py - determine the next unused extension numbers. 18# Use this when registering a new ARB, vendor, and/or OpenGL ES extension. 19# 20# Use: nextfree.py 21 22import copy, os, re, string, sys 23 24def write(*args, **kwargs): 25 file = kwargs.pop('file', sys.stdout) 26 end = kwargs.pop('end', '\n') 27 file.write(' '.join([str(arg) for arg in args])) 28 file.write(end) 29 30# Load the registry 31file = 'registry.py' 32exec(open(file).read()) 33 34# Track each number separately 35keys = { 'arbnumber', 'number', 'esnumber' } 36max = {} 37for k in keys: 38 max[k] = 0 39 40# Loop over all extensions updating the max value 41for name,v in registry.items(): 42 for k in keys: 43 if k in v.keys(): 44 n = v[k] 45 if (n > max[k]): 46 max[k] = n 47 48# Report next free values 49for k in keys: 50 write('Next free', k, '=', max[k] + 1) 51