On 12/01/2015 12:04 PM, Brian Paul wrote:
> 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',"
> +

Good times.  There are a couple other generators that do similar things.
 I *think* the other scripts detect whether or not the work-around is
necessary so that we get readable output on non-MSVC builds.  I have a
vague recollection of doing that anyway.

We could refactor this to a common function emit_really_long_C_string()
that could be used everywhere.  That would be a good janitor task for
someone with Python skillz.

Either way, this patch is also

Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

>              string_offsets[ enum ] = i
>              i += len(name) + 1
>  
> -        print '   ;'
> +        print '};'
>          print ''
>  
>  
> 

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to