2 # To use type parse.rb in the same folder as gl-abstraction.h
3 # and pipe the output to a file
5 # Assemble the gl function call
7 # turns this: GLBoolean BlendEquation(GLEnum mode);
9 # into an inline function like this:
11 # GLBoolean BlendEquation(GLEnum mode)
13 # return glBlendEquation(mode);
16 f = File.new("x11-gles.h")
17 #scan each line in the file
20 # x is original line, y is the new gl function call
23 y.lstrip! # strip leading white spaces
24 returns = y.index("void"); # see if the function returns void
25 y.gsub!'void',' ' # delete the return types ...
26 y.gsub!(/GL[a-z]*/, '') # remove GL types such as GLenum
27 y.gsub!('const','') # remove const, *
28 y.gsub!('char','') # remove char
29 y.gsub!('*','') # remove pointer *
30 y.gsub!(/\s+/,"") # remove all spaces
31 y.insert(0,' gl') # add gl to function name
33 if (returns != 0) # insert a return if the function returns
35 y.insert(0,' return ')
38 # print the function out