summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/opengl/GenerateGLExtensionDef.pl
blob: 81310df61fc0e2c1a93fe27dabeb28cb82655d1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

use strict;
use warnings;

open FH, "GLExtensionDefs.txt" or die $_;

my$ output = "// This file is automatically generated with Runtime/GfxDevice/opengl/GenerateGLExtensionDef.pl.\n// It is generated from GLExtensionDefs.txt\n";

LINE: 
while (<FH>)
{	
	my $line = $_;
	chomp ($line);
	
	if ($line =~ /^\s*\/\/\s*(.*)/)
	{
		$output = $output . "$line\n";
	}
	elsif ($line =~ /^\s*\#\s*(.*)/)
	{
		$output = $output . "$line\n";
	}
	elsif ($line =~ /^\s* s*(.*)/)
	{
		$output = $output . "$line\n";
	}
	elsif ($line =~ /^\s*$/)
	{
		$output = $output . "$line\n";
	}
	else
	{
		my$ name = $line;
		my$ pfn = uc ($line);
		if ($line =~ /^(.+)->(.+)/)
		{
			$name = $1;
			$pfn = uc ($2);
		}
		my $upperLine = uc ($line);
		$output = $output . "DEF (PFN" . $pfn . "PROC, $name);\n";
		$output = $output . "#define $name UNITYGL_$name\n";
	}
}

open OUT, "> GLExtensionDefs.h";
print OUT $output;