Can compile "loader" and "layers" on Windows and Linux ...

These directories build and are partially turned-on on Windows, using the "tri"
demo (follow-on commit) and a "NULL driver" that was created out of the
sample/Intel driver.  The GetProcAddress() is not yet finding symbols in the
NULL driver.

For now:

- "C:\Windows\System32" is the default XGL driver directory.  The getenv()
  isn't yet working.  I suggest creating your own #define in order to point to
  where a driver is.

- In order to recognize a Windows driver, we must look at both its prefix and
  suffix (i.e. it is named "XGL_*.dll", e.g. "XGL_i965.dll).

- We autogenerate Windows ".def" files for the layers.  Additional info is:

  - This is necessary in order for a DLL to export symbols that can be queried
    using GetProcAddress().  We can't use the normal Windows approach of
    declaring these functions using "__declspec(dllexport)", because these
    functions are declared in "xgl.h".

  - This involves adding and running the new "xgl-win-def-file-generate.py"
    file.

  - NOTE: Layers don't have the xglInitAndEnumerateGpus() entrypoint, just the
    xglGetProcAddr() entrypoint (and now the xglEnumerateLayers() entrypoint).
    Generating them is pretty simple.

NOTE: In order to build on a 64-bit Windows 7/8 system, I did the following:

- Install VisualStudio 2013 Professional

- Install CMake from: http://www.cmake.org/cmake/resources/software.html

  - I let it add itself to the system PATH environment variable.

- Install Python 3 from: https://www.python.org/downloads

  - I let it add itself to the system PATH environment variable.

- Obtain the Git repository, checkout the "ian-150127-WinBuild" branch.

- Using a Cygwin shell: I did the following:

  - "cd" to the top-level directory (i.e. the one that contains the ".git"
    directory).

  - "mkdir _out64"

  - "cd _out64"

  - "cmake -G "Visual Studio 12 Win64" .."

- At this point, I used WindowsExplorer to open the "XGL.sln" file.  I can
  build.  CMake causes the build shortcut to be "Ctrl-Shift-B" instead of the
  normal "F7".  I had to right-click the "ALL_BUILD" project, go to
  Properties->Debugging and change the debug Command and Working Directory to
  point to "tri.exe" and where the executable are.  At this point, I can debug
  (using the normal "F5" shortcut).
diff --git a/xgl-generate.py b/xgl-generate.py
index 2c5b7db..2fe51b0 100755
--- a/xgl-generate.py
+++ b/xgl-generate.py
@@ -119,6 +119,8 @@
         for proto in self.protos:
             if not self._is_dispatchable(proto):
                 continue
+            if 'WsiX11AssociateConnection' == proto.name:
+                funcs.append("#if !defined(_WIN32)")
             decl = proto.c_func(prefix="xgl", attr="XGLAPI")
             stmt = "(*disp)->%s" % proto.c_call()
             if proto.name == "CreateDevice":
@@ -196,6 +198,7 @@
                          "    %s;\n"
                              "}" % (qual, decl, proto.params[0].name, proto.params[0].name, stmt))
 
+        funcs.append("#endif")
         return "\n\n".join(funcs)
 
     def generate_body(self):
@@ -215,20 +218,24 @@
     def generate_header(self):
         return "\n".join(["#include <xgl.h>",
                           "#include <xglLayer.h>",
-                          "#include <string.h>"])
+                          "#include <string.h>",
+                          "#include \"loader_platform.h\""])
 
     def _generate_init(self):
         stmts = []
         for proto in self.protos:
+            if 'WsiX11AssociateConnection' == proto.name:
+                stmts.append("#if !defined(_WIN32)")
             if proto.name == "GetProcAddr":
                 stmts.append("table->%s = gpa; /* direct assignment */" %
                         proto.name)
             else:
                 stmts.append("table->%s = (xgl%sType) gpa(gpu, \"xgl%s\");" %
                         (proto.name, proto.name, proto.name))
+        stmts.append("#endif")
 
         func = []
-        func.append("static inline void %s_initialize_dispatch_table(XGL_LAYER_DISPATCH_TABLE *table,"
+        func.append("STATIC_INLINE void %s_initialize_dispatch_table(XGL_LAYER_DISPATCH_TABLE *table,"
                 % self.prefix)
         func.append("%s                                              xglGetProcAddrType gpa,"
                 % (" " * len(self.prefix)))
@@ -243,12 +250,15 @@
     def _generate_lookup(self):
         lookups = []
         for proto in self.protos:
+            if 'WsiX11AssociateConnection' == proto.name:
+                lookups.append("#if !defined(_WIN32)")
             lookups.append("if (!strcmp(name, \"%s\"))" % (proto.name))
             lookups.append("    return (void *) table->%s;"
                     % (proto.name))
+        lookups.append("#endif")
 
         func = []
-        func.append("static inline void *%s_lookup_dispatch_table(const XGL_LAYER_DISPATCH_TABLE *table,"
+        func.append("STATIC_INLINE void *%s_lookup_dispatch_table(const XGL_LAYER_DISPATCH_TABLE *table,"
                 % self.prefix)
         func.append("%s                                           const char *name)"
                 % (" " * len(self.prefix)))
@@ -316,10 +326,13 @@
 
         lookups = []
         for proto in self.protos:
+            if 'WsiX11AssociateConnection' == proto.name:
+                lookups.append("#if !defined(_WIN32)")
             lookups.append("if (!strcmp(%s, \"%s\"))" %
                     (gpa_pname, proto.name))
             lookups.append("    return (%s) %s%s;" %
                     (gpa_proto.ret, self.prefix, proto.name))
+        lookups.append("#endif")
 
         body = []
         body.append("%s %s" % (self.qual, gpa_decl))
@@ -358,12 +371,15 @@
                 lookups.append("/* no %s%s */" % (self.prefix, proto.name))
                 continue
 
+            if 'WsiX11AssociateConnection' == proto.name:
+                lookups.append("#if !defined(_WIN32)")
             lookups.append("if (!strcmp(name, \"%s\"))" % proto.name)
             lookups.append("    return (%s) %s%s;" %
                     (self.gpa.ret, self.prefix, proto.name))
+        lookups.append("#endif")
 
         body = []
-        body.append("static inline %s layer_intercept_proc(const char *name)" %
+        body.append("STATIC_INLINE %s layer_intercept_proc(const char *name)" %
                 self.gpa.ret)
         body.append("{")
         body.append(generate_get_proc_addr_check("name"))