--- /dev/null
+#!/usr/bin/python2\r
+\r
+# Mesa 3-D graphics library\r
+# Version: 6.3\r
+# \r
+# Copyright (C) 2005 Brian Paul All Rights Reserved.\r
+# \r
+# Permission is hereby granted, free of charge, to any person obtaining a\r
+# copy of this software and associated documentation files (the "Software"),\r
+# to deal in the Software without restriction, including without limitation\r
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+# and/or sell copies of the Software, and to permit persons to whom the\r
+# Software is furnished to do so, subject to the following conditions:\r
+# \r
+# The above copyright notice and this permission notice shall be included\r
+# in all copies or substantial portions of the Software.\r
+# \r
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+# author: Michal Krol\r
+\r
+# converts slang source file into a C header containing one big string\r
+# comments and trailing whitespaces are stripped\r
+# C style comments are not supported, only C++ style ones are\r
+# empty lines are kept to maintain line numbers correlation\r
+# escape characters are not handled except for newlines\r
+\r
+# example:\r
+# -- source file\r
+# // some comment\r
+# \r
+# attribute vec4 myPosition; // my vertex data\r
+# -- output file\r
+# "\n"\r
+# "\n"\r
+# "attribute vec4 myPosition;\n"\r
+\r
+# usage: gc_to_string.py filename.gc > filename_gc.h\r
+\r
+import sys\r
+\r
+f = open (sys.argv[1], 'r')\r
+s = f.readline ()\r
+while s != '':\r
+ s = s[0:s.find ('//')].rstrip ()\r
+ # output empty lines, too, so line numbers can be tracked\r
+ print '\"' + s + '\\n\"'\r
+ s = f.readline ()\r
+f.close ()\r
+\r