aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/xml.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-06 02:21:31 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-06 02:21:31 -0400
commit18b2d420b092d71313f0c05210c3038ff32483e7 (patch)
treee934f6bddd11863e82d591fb2a168d60be382f9d /nexgb/xgbgen/xml.go
parent99bc76de54729df5494faa944d4da96a8885d51e (diff)
downloadhaven-18b2d420b092d71313f0c05210c3038ff32483e7.tar.gz
haven-18b2d420b092d71313f0c05210c3038ff32483e7.tar.xz
haven-18b2d420b092d71313f0c05210c3038ff32483e7.zip
added documentation and did some slight restructuring. it's party time.
Diffstat (limited to 'nexgb/xgbgen/xml.go')
-rw-r--r--nexgb/xgbgen/xml.go64
1 files changed, 27 insertions, 37 deletions
diff --git a/nexgb/xgbgen/xml.go b/nexgb/xgbgen/xml.go
index 1b2f89a..df21433 100644
--- a/nexgb/xgbgen/xml.go
+++ b/nexgb/xgbgen/xml.go
@@ -18,19 +18,19 @@ type XML struct {
// Types for all top-level elements.
// First are the simple ones.
Imports XMLImports `xml:"import"`
- Enums XMLEnums `xml:"enum"`
- Xids XMLXids `xml:"xidtype"`
- XidUnions XMLXids `xml:"xidunion"`
- TypeDefs XMLTypeDefs `xml:"typedef"`
- EventCopies XMLEventCopies `xml:"eventcopy"`
- ErrorCopies XMLErrorCopies `xml:"errorcopy"`
+ Enums []*XMLEnum `xml:"enum"`
+ Xids []*XMLXid `xml:"xidtype"`
+ XidUnions []*XMLXid `xml:"xidunion"`
+ TypeDefs []*XMLTypeDef `xml:"typedef"`
+ EventCopies []*XMLEventCopy `xml:"eventcopy"`
+ ErrorCopies []*XMLErrorCopy `xml:"errorcopy"`
// Here are the complex ones, i.e., anything with "structure contents"
- Structs XMLStructs `xml:"struct"`
- Unions XMLUnions `xml:"union"`
- Requests XMLRequests `xml:"request"`
- Events XMLEvents `xml:"event"`
- Errors XMLErrors `xml:"error"`
+ Structs []*XMLStruct `xml:"struct"`
+ Unions []*XMLUnion `xml:"union"`
+ Requests []*XMLRequest `xml:"request"`
+ Events []*XMLEvent `xml:"event"`
+ Errors []*XMLError `xml:"error"`
}
type XMLImports []*XMLImport
@@ -60,8 +60,6 @@ type XMLImport struct {
xml *XML `xml:"-"`
}
-type XMLEnums []XMLEnum
-
type XMLEnum struct {
Name string `xml:"name,attr"`
Items []*XMLEnumItem `xml:"item"`
@@ -72,77 +70,69 @@ type XMLEnumItem struct {
Expr *XMLExpression `xml:",any"`
}
-type XMLXids []*XMLXid
-
type XMLXid struct {
XMLName xml.Name
Name string `xml:"name,attr"`
}
-type XMLTypeDefs []*XMLTypeDef
-
type XMLTypeDef struct {
Old string `xml:"oldname,attr"`
New string `xml:"newname,attr"`
}
-type XMLEventCopies []*XMLEventCopy
-
type XMLEventCopy struct {
Name string `xml:"name,attr"`
Number int `xml:"number,attr"`
Ref string `xml:"ref,attr"`
}
-type XMLErrorCopies []*XMLErrorCopy
-
type XMLErrorCopy struct {
Name string `xml:"name,attr"`
Number int `xml:"number,attr"`
Ref string `xml:"ref,attr"`
}
-type XMLStructs []*XMLStruct
-
type XMLStruct struct {
Name string `xml:"name,attr"`
- Fields XMLFields `xml:",any"`
+ Fields []*XMLField `xml:",any"`
}
-type XMLUnions []*XMLUnion
-
type XMLUnion struct {
Name string `xml:"name,attr"`
- Fields XMLFields `xml:",any"`
+ Fields []*XMLField `xml:",any"`
}
-type XMLRequests []*XMLRequest
-
type XMLRequest struct {
Name string `xml:"name,attr"`
Opcode int `xml:"opcode,attr"`
Combine bool `xml:"combine-adjacent,attr"`
- Fields XMLFields `xml:",any"`
+ Fields []*XMLField `xml:",any"`
Reply *XMLReply `xml:"reply"`
}
type XMLReply struct {
- Fields XMLFields `xml:",any"`
+ Fields []*XMLField `xml:",any"`
}
-type XMLEvents []*XMLEvent
-
type XMLEvent struct {
Name string `xml:"name,attr"`
Number int `xml:"number,attr"`
NoSequence bool `xml:"no-sequence-number,attr"`
- Fields XMLFields `xml:",any"`
+ Fields []*XMLField `xml:",any"`
}
-type XMLErrors []*XMLError
-
type XMLError struct {
Name string `xml:"name,attr"`
Number int `xml:"number,attr"`
- Fields XMLFields `xml:",any"`
+ Fields []*XMLField `xml:",any"`
+}
+
+type XMLExpression struct {
+ XMLName xml.Name
+
+ Exprs []*XMLExpression `xml:",any"`
+
+ Data string `xml:",chardata"`
+ Op string `xml:"op,attr"`
+ Ref string `xml:"ref,attr"`
}