1# -*- coding: utf-8 -*-
2
3import os
4import string
5
6from common import *
7from khr_util.format import indentLines, normalizeConstant
8
9TYPED_VALUES = [
10	"EGL_DONT_CARE",
11	"EGL_UNKNOWN",
12	"EGL_NO_CONTEXT",
13	"EGL_NO_DISPLAY",
14	"EGL_DEFAULT_DISPLAY",
15	"EGL_NO_SURFACE",
16	"EGL_NO_IMAGE",
17	"EGL_NO_SYNC",
18	"EGL_NO_IMAGE_KHR",
19	"EGL_NO_SYNC_KHR"
20]
21
22def enumValue (enum, typePrefix = ""):
23	if enum.name in TYPED_VALUES:
24		return enum.value.replace("(EGL", "(%sEGL" % typePrefix)
25	else:
26		return normalizeConstant(enum.value)
27
28def enumDefinition (enum):
29	return "#define %s\t%s" % (enum.name, enumValue(enum, "eglw::"))
30
31def gen (iface):
32	writeInlFile(os.path.join(EGL_WRAPPER_DIR, "eglwEnums.inl"), indentLines(map(enumDefinition, iface.enums)))
33