Brian Paul <[email protected]> writes: > String literals cannot exceed 65535 characters for MSVC. Instead of > emiting a string, emit an array of characters. > --- > src/mapi/glapi/gen/gl_enums.py | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py > index 6e18f15..7c6c51f 100644 > --- a/src/mapi/glapi/gen/gl_enums.py > +++ b/src/mapi/glapi/gen/gl_enums.py > @@ -156,14 +156,17 @@ _mesa_lookup_prim_by_nr(GLuint nr) > print '# define LONGSTRING' > print '#endif' > print '' > - print 'LONGSTRING static const char enum_string_table[] = ' > + print 'LONGSTRING static const char enum_string_table[] = {' > for enum in sorted_enum_values: > (name, pri) = self.enum_table[enum] > - print ' "%s\\0"' % (name) > + for ch in name: > + print "'%c'," % ch, > + print "'\\0'," > + > string_offsets[ enum ] = i > i += len(name) + 1 > > - print ' ;' > + print '};' > print ''
For others reading the patch, the generated code is:
LONGSTRING static const char enum_string_table[] = {
'G', 'L', '_', 'N', 'O', '_', 'E', 'R', 'R', 'O', 'R', '\0',
'G', 'L', '_', 'T', 'R', 'U', 'E', '\0',
'G', 'L', '_', 'L', 'I', 'N', 'E', '_', 'L', 'O', 'O', 'P', '\0',
'G', 'L', '_', 'L', 'I', 'N', 'E', '_', 'S', 'T', 'R', 'I', 'P', '\0',
.....
'G', 'L', '_', 'F', 'O', 'G', '_', 'C', 'O', 'O', 'R', 'D', 'I', 'N', 'A', 'T',
'E', '_', 'A', 'R', 'R', 'A', 'Y', '_', 'L', 'I', 'S', 'T', '_', 'S', 'T', 'R',
'I', 'D', 'E', '_', 'I', 'B', 'M', '\0',
'G', 'L', '_', 'S', 'E', 'C', 'O', 'N', 'D', 'A', 'R', 'Y', '_', 'C', 'O', 'L',
'O', 'R', '_', 'A', 'R', 'R', 'A', 'Y', '_', 'L', 'I', 'S', 'T', '_', 'S', 'T',
'R', 'I', 'D', 'E', '_', 'I', 'B', 'M', '\0',
};
I'd love a comment in the .py about the MSVC limitation, and for reading
the generated file it would be nice to keep the indentation before each
line, but regardless:
Reviewed-by: Eric Anholt <[email protected]>
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
