draw2d/postscript-go/src/pkg/postscript/operators_relational.go

30 lines
728 B
Go
Raw Normal View History

2010-12-13 12:01:24 +00:00
// Copyright 2010 The postscript-go Authors. All rights reserved.
// created: 13/12/2010 by Laurent Le Goff
package postscript
func eq(interpreter *Interpreter) {
value1 := interpreter.Pop()
value2 := interpreter.Pop()
interpreter.Push(value1 == value2)
}
2010-12-13 19:13:10 +00:00
func ne(interpreter *Interpreter) {
value1 := interpreter.Pop()
value2 := interpreter.Pop()
interpreter.Push(value1 != value2)
}
func lt(interpreter *Interpreter) {
f2 := interpreter.PopFloat()
f1 := interpreter.PopFloat()
interpreter.Push(f1 < f2)
}
func initRelationalOperators(interpreter *Interpreter) {
interpreter.SystemDefine("eq", NewOperator(eq))
2010-12-13 19:13:10 +00:00
interpreter.SystemDefine("ne", NewOperator(ne))
interpreter.SystemDefine("lt", NewOperator(lt))
2010-12-13 12:01:24 +00:00
}