]> git.tdb.fi Git - libs/gl.git/commitdiff
For a few lingering whitespace issues
authorMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2012 19:18:09 +0000 (22:18 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2012 19:18:09 +0000 (22:18 +0300)
The scripts had been ignored entirely in the previous conversion.  As a
result, a few newly generated extensions didn't have proper whitespace.
Pure virtual functions in headers had also slipped through.

scripts/extgen.py
scripts/makefont.py
scripts/maketex.py
source/effect.h
source/ext_framebuffer_blit.cpp
source/ext_framebuffer_multisample.cpp
source/nv_primitive_restart.cpp
source/primitivebuilder.h
source/uniform.h

index 2c515f22ecee971f234796924428376d58f80c8f..f349d5251473a8f147d3af9edf082a636e89a6fd 100755 (executable)
@@ -2,23 +2,23 @@
 
 import sys
 
-ext=sys.argv[1]
+ext = sys.argv[1]
 
-funcs=[]
-cur_func=None
+funcs = []
+cur_func = None
 for line in file("gl.spec"):
        if line[0]=='#' or line.find(':')>=0:
                continue
        elif line[0]=='\t' and cur_func:
-               parts=line.split()
+               parts = line.split()
                if parts[0]=="category" and parts[1]==ext:
                        funcs.append(cur_func)
        else:
-               paren=line.find('(')
+               paren = line.find('(')
                if paren>0:
-                       cur_func=line[:paren]
+                       cur_func = line[:paren]
 
-out=file(ext.lower()+".h", "w")
+out = file(ext.lower()+".h", "w")
 out.write("#ifndef MSP_GL_%s_\n"%ext.upper())
 out.write("#define MSP_GL_%s_\n"%ext.upper())
 
@@ -43,7 +43,7 @@ out.write("""
 #endif
 """)
 
-out=file(ext.lower()+".cpp", "w")
+out = file(ext.lower()+".cpp", "w")
 out.write("#include \"extension.h\"\n")
 out.write("#include \"%s.h\"\n"%ext.lower())
 
@@ -54,11 +54,11 @@ namespace GL {
 """)
 
 for f in funcs:
-       out.write("PFNGL%sPROC gl%s=0;\n"%(f.upper(), f))
+       out.write("PFNGL%sPROC gl%s = 0;\n"%(f.upper(), f))
 
 out.write("\nvoid init_%s()\n{\n"%ext.lower())
 for f in funcs:
-       out.write("\tgl%s=reinterpret_cast<PFNGL%sPROC>(get_proc_address(\"gl%s\"));\n"%(f, f.upper(), f))
+       out.write("\tgl%s = reinterpret_cast<PFNGL%sPROC>(get_proc_address(\"gl%s\"));\n"%(f, f.upper(), f))
 out.write("}\n")
 
 out.write("""
index e0b587938a5b80a85187a5e21c75a5c6f364df6e..ad12fee828405860b91159401466ffc47b48eafd 100755 (executable)
@@ -1,23 +1,23 @@
 #!/usr/bin/python
 
 def convert_def(fn):
-       src=file(fn)
+       src = file(fn)
 
-       line=src.readline()
-       tw,th,fh,fa,fd=map(int, line.split())
+       line = src.readline()
+       tw, th, fh, fa, fd = map(int, line.split())
 
-       result="native_size %d;\n"%fh
-       result+="ascent %.3f;\n"%(float(fa)/fh)
-       result+="descent %.3f;\n"%(float(fd)/fh)
+       result = "native_size %d;\n"%fh
+       result += "ascent %.3f;\n"%(float(fa)/fh)
+       result += "descent %.3f;\n"%(float(fd)/fh)
 
        for line in src.readlines():
-               g,x,y,w,h,ox,oy,a=map(int, line.split())
-               result+="glyph %d\n{\n"%g
-               result+="\ttexcoords %f %f %f %f;\n"%(float(x)/tw, float(th-y-h)/th, float(x+w)/tw, float(th-y)/th)
-               result+="\tsize %.3f %.3f;\n"%(float(w)/fh, float(h)/fh)
-               result+="\toffset %.3f %.3f;\n"%(float(ox)/fh, float(oy)/fh)
-               result+="\tadvance %.3f;\n"%(float(a)/fh)
-               result+="};\n"
+               g, x, y, w, h, ox, oy, a = map(int, line.split())
+               result += "glyph %d\n{\n"%g
+               result += "\ttexcoords %f %f %f %f;\n"%(float(x)/tw, float(th-y-h)/th, float(x+w)/tw, float(th-y)/th)
+               result += "\tsize %.3f %.3f;\n"%(float(w)/fh, float(h)/fh)
+               result += "\toffset %.3f %.3f;\n"%(float(ox)/fh, float(oy)/fh)
+               result += "\tadvance %.3f;\n"%(float(a)/fh)
+               result += "};\n"
 
        return result
 
@@ -28,11 +28,11 @@ def make_font(fn, size):
        if os.system("ttf2png \"%s\" -o makefont-tmp.png -d makefont-tmp.def -t -p -s %d"%(fn, size)):
                raise Exception("Could not execute ttf2png")
 
-       result="texture\n{\n"
-       result+="wrap CLAMP_TO_EDGE;\n"
-       result+=maketex.make_tex("makefont-tmp.png")
-       result+="};\n"
-       result+=convert_def("makefont-tmp.def")
+       result = "texture\n{\n"
+       result += "wrap CLAMP_TO_EDGE;\n"
+       result += maketex.make_tex("makefont-tmp.png")
+       result += "};\n"
+       result += convert_def("makefont-tmp.def")
 
        os.unlink("makefont-tmp.png")
        os.unlink("makefont-tmp.def")
@@ -46,5 +46,5 @@ if __name__=="__main__":
                import os
                print "Usage: %s <font.ttf> <outfile> <size>"%os.path.basename(sys.argv[0])
        else:
-               out=file(sys.argv[2], "w")
+               out = file(sys.argv[2], "w")
                out.write(make_font(sys.argv[1], int(sys.argv[3])))
index 92a284215796b1021ce8ca55f8098a668cc658e6..8c7d5a199def423855c23e6d4f7cad0738ed8036 100755 (executable)
@@ -1,37 +1,37 @@
 #!/usr/bin/python
 
 def escape(str):
-       result=""
+       result = ""
        for c in str:
                if c=='"':
-                       result+='\\"'
+                       result += '\\"'
                elif c=='\\':
-                       result+='\\\\'
+                       result += '\\\\'
                elif ord(c)<0x20:
-                       result+="\\%03o"%ord(c)
+                       result += "\\%03o"%ord(c)
                else:
-                       result+=c
+                       result += c
        return result;
 
 def make_tex(fn):
        import Image
 
-       img=Image.open(fn)
+       img = Image.open(fn)
 
-       fmt="".join(img.getbands())
+       fmt = "".join(img.getbands())
        if fmt=="LA":
-               fmt="LUMINANCE_ALPHA"
+               fmt = "LUMINANCE_ALPHA"
        elif fmt=="L":
-               fmt="LUMINANCE"
+               fmt = "LUMINANCE"
 
-       result="storage %s %d %d;\n"%(fmt, img.size[0], img.size[1])
-       result+="min_filter LINEAR;\n"
-       result+="raw_data \""
-       data=list(img.getdata())
+       result = "storage %s %d %d;\n"%(fmt, img.size[0], img.size[1])
+       result += "min_filter LINEAR;\n"
+       result += "raw_data \""
+       data = list(img.getdata())
        for y in range(img.size[1]):
-               i=(img.size[1]-1-y)*img.size[0]
-               result+=escape("".join(["".join([chr(v) for v in p]) for p in data[i:i+img.size[0]]]))
-       result+="\";\n"
+               i = (img.size[1]-1-y)*img.size[0]
+               result += escape("".join(["".join([chr(v) for v in p]) for p in data[i:i+img.size[0]]]))
+       result += "\";\n"
 
        return result
 
@@ -42,5 +42,5 @@ if __name__=="__main__":
        if len(sys.argv)<2:
                print "Usage: %s <image>"%sys.argv[0]
        else:
-               out=file(os.path.splitext(sys.argv[1])[0]+".tex", "w")
+               out = file(os.path.splitext(sys.argv[1])[0]+".tex", "w")
                out.write(make_tex(sys.argv[1]))
index 2f9c56d2572f2703723044c25e058df995b7fec8..f5c740ff5eb0d328a0125b8cb251cab4d4fe43af 100644 (file)
@@ -9,8 +9,8 @@ class Effect
 public:
        virtual ~Effect() { }
 
-       virtual void prepare() =0;
-       virtual void cleanup() =0;
+       virtual void prepare() = 0;
+       virtual void cleanup() = 0;
 };
 
 } // namespace GL
index 613f514aacd15a6194ad2692525ccb714d3a80c3..7519e13cf24e3663870b22c24c7711fab9f89094 100644 (file)
@@ -4,11 +4,11 @@
 namespace Msp {
 namespace GL {
 
-PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT=0;
+PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT = 0;
 
 void init_ext_framebuffer_blit()
 {
-       glBlitFramebufferEXT=reinterpret_cast<PFNGLBLITFRAMEBUFFEREXTPROC>(get_proc_address("glBlitFramebufferEXT"));
+       glBlitFramebufferEXT = reinterpret_cast<PFNGLBLITFRAMEBUFFEREXTPROC>(get_proc_address("glBlitFramebufferEXT"));
 }
 
 } // namespace GL
index 22b00a9edf0086abfc57aa2fd47cd081c2578e4a..a0f3930c1948c3e65e557425d74c1bd83e08ecda 100644 (file)
@@ -4,11 +4,11 @@
 namespace Msp {
 namespace GL {
 
-PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT=0;
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT = 0;
 
 void init_ext_framebuffer_multisample()
 {
-       glRenderbufferStorageMultisampleEXT=reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC>(get_proc_address("glRenderbufferStorageMultisampleEXT"));
+       glRenderbufferStorageMultisampleEXT = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC>(get_proc_address("glRenderbufferStorageMultisampleEXT"));
 }
 
 } // namespace GL
index 9a5139f58d41cb2fcbb42f234b91d25df91a9365..b685e340740f91ee03dc7ffd08c489d4d59c4161 100644 (file)
@@ -4,13 +4,13 @@
 namespace Msp {
 namespace GL {
 
-PFNGLPRIMITIVERESTARTNVPROC glPrimitiveRestartNV=0;
-PFNGLPRIMITIVERESTARTINDEXNVPROC glPrimitiveRestartIndexNV=0;
+PFNGLPRIMITIVERESTARTNVPROC glPrimitiveRestartNV = 0;
+PFNGLPRIMITIVERESTARTINDEXNVPROC glPrimitiveRestartIndexNV = 0;
 
 void init_nv_primitive_restart()
 {
-       glPrimitiveRestartNV=reinterpret_cast<PFNGLPRIMITIVERESTARTNVPROC>(get_proc_address("glPrimitiveRestartNV"));
-       glPrimitiveRestartIndexNV=reinterpret_cast<PFNGLPRIMITIVERESTARTINDEXNVPROC>(get_proc_address("glPrimitiveRestartIndexNV"));
+       glPrimitiveRestartNV = reinterpret_cast<PFNGLPRIMITIVERESTARTNVPROC>(get_proc_address("glPrimitiveRestartNV"));
+       glPrimitiveRestartIndexNV = reinterpret_cast<PFNGLPRIMITIVERESTARTINDEXNVPROC>(get_proc_address("glPrimitiveRestartIndexNV"));
 }
 
 } // namespace GL
index b41366e883b6d1962f3b48287e7db0af3ce56e3f..0ffd170cd3e82659cef26528b0bfaf341f2d634e 100644 (file)
@@ -34,9 +34,9 @@ public:
        PrimitiveType get_type() const;
 protected:
        virtual void vertex_(const Vector4 &);
-       virtual void begin_() =0;
-       virtual void end_() =0;
-       virtual void element_(unsigned) =0;
+       virtual void begin_() = 0;
+       virtual void end_() = 0;
+       virtual void element_(unsigned) = 0;
 };
 
 } // namespace GL
index 97a4e9ddf212074eb1e0c093d7cfddcabe40e187..70db91dfe0d93fbb8e19eff6a2494214258d37e9 100644 (file)
@@ -16,8 +16,8 @@ private:
 public:
        virtual ~Uniform() { }
 
-       virtual void apply(int) const =0;
-       virtual Uniform *clone() const =0;
+       virtual void apply(int) const = 0;
+       virtual Uniform *clone() const = 0;
 };