aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/misc.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-04-29 03:38:29 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-04-29 03:38:29 -0400
commit6bf0191fb01f4c0b65bcd444bb5381013c627f95 (patch)
treef83d00c55a92568e8345849c6753253d17bc393d /nexgb/xgbgen/misc.go
parent52a21b415ad95b2c4649254447388cb329cee1a4 (diff)
downloadhaven-6bf0191fb01f4c0b65bcd444bb5381013c627f95.tar.gz
haven-6bf0191fb01f4c0b65bcd444bb5381013c627f95.tar.xz
haven-6bf0191fb01f4c0b65bcd444bb5381013c627f95.zip
progress. still not working. this is incredibly difficult.
Diffstat (limited to 'nexgb/xgbgen/misc.go')
-rw-r--r--nexgb/xgbgen/misc.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/nexgb/xgbgen/misc.go b/nexgb/xgbgen/misc.go
index 9adcf5d..13c4cc2 100644
--- a/nexgb/xgbgen/misc.go
+++ b/nexgb/xgbgen/misc.go
@@ -21,6 +21,11 @@ func popCount(mask uint) uint {
return n
}
+// pad makes sure 'n' aligns on 4 bytes.
+func pad(n int) int {
+ return (n + 3) & ^3
+}
+
// splitAndTitle takes a string, splits it by underscores, capitalizes the
// first letter of each chunk, and smushes'em back together.
func splitAndTitle(s string) string {
@@ -29,9 +34,9 @@ func splitAndTitle(s string) string {
return strings.Title(strings.ToLower(s))
}
- // If the string has no underscores, leave it be.
+ // If the string has no underscores, capitalize it and leave it be.
if i := strings.Index(s, "_"); i == -1 {
- return s
+ return strings.Title(s)
}
// Now split the name at underscores, capitalize the first