aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/size.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-04-30 02:40:55 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-04-30 02:40:55 -0400
commit05d8ec6a16acf88c5ae7521d86131f5ea7f9b4e4 (patch)
tree028bfcc345c02afad9a6201e2af63ed638a3e8d9 /nexgb/xgbgen/size.go
parent3115c13e88badfd3b6b1762f2239edbf9d0b8951 (diff)
downloadhaven-05d8ec6a16acf88c5ae7521d86131f5ea7f9b4e4.tar.gz
haven-05d8ec6a16acf88c5ae7521d86131f5ea7f9b4e4.tar.xz
haven-05d8ec6a16acf88c5ae7521d86131f5ea7f9b4e4.zip
complete and total overhaul like i promised. things are much easier to reason about. still not working yet though.
Diffstat (limited to 'nexgb/xgbgen/size.go')
-rw-r--r--nexgb/xgbgen/size.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/nexgb/xgbgen/size.go b/nexgb/xgbgen/size.go
new file mode 100644
index 0000000..d00e297
--- /dev/null
+++ b/nexgb/xgbgen/size.go
@@ -0,0 +1,22 @@
+package main
+
+type Size struct {
+ Expression
+}
+
+func newFixedSize(fixed uint) Size {
+ return Size{&Value{v: fixed}}
+}
+
+func newExpressionSize(variable Expression) Size {
+ return Size{variable}
+}
+
+func (s1 Size) Add(s2 Size) Size {
+ return Size{newBinaryOp("+", s1, s2)}
+}
+
+func (s1 Size) Multiply(s2 Size) Size {
+ return Size{newBinaryOp("*", s1, s2)}
+}
+