From 6bf0191fb01f4c0b65bcd444bb5381013c627f95 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sun, 29 Apr 2012 03:38:29 -0400 Subject: progress. still not working. this is incredibly difficult. --- nexgb/xgbgen/context.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'nexgb/xgbgen/context.go') diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go index e5acb12..712cad4 100644 --- a/nexgb/xgbgen/context.go +++ b/nexgb/xgbgen/context.go @@ -5,7 +5,6 @@ import ( "encoding/xml" "fmt" "log" - "strings" ) type Context struct { @@ -33,31 +32,6 @@ func (c *Context) Put(format string, v ...interface{}) { } } -// TypePrefix searches the parsed XML for a type matching 'needle'. -// It then returns the appropriate prefix to be used in source code. -// Note that the core X protocol *is* a namespace, but does not have a prefix. -// Also note that you should probably check the BaseTypeMap and TypeMap -// before calling this function. -func (c *Context) TypePrefix(needle Type) string { - // If this is xproto, quit. No prefixes needed. - if c.xml.Header == "xproto" { - return "" - } - - // First check for the type in the current namespace. - if c.xml.HasType(needle) { - return strings.Title(c.xml.Header) - } - - // Now check each of the imports... - for _, imp := range c.xml.Imports { - if imp.xml.Header != "xproto" && imp.xml.HasType(needle) { - return strings.Title(imp.xml.Header) - } - } - - return "" -} // Translate is the big daddy of them all. It takes in an XML byte slice // and writes Go code to the 'out' buffer. @@ -76,14 +50,4 @@ func (c *Context) Translate(xmlBytes []byte) { // It's Morphin' Time! c.xml.Morph(c) - - // for _, req := range c.xml.Requests { - // if req.Name != "CreateContext" && req.Name != "MakeCurrent" { - // continue - // } - // log.Println(req.Name) - // for _, field := range req.Fields { - // log.Println("\t", field.XMLName.Local, field.Type.Morph(c)) - // } - // } } -- cgit v1.2.3