Example #1
0
func init() {
	s := dynamics.ExpectQuestion(term.InitS(), GetState, "Q")
	dynamics.AddNative(s, dynamics.Args0(getState))

	s = dynamics.ExpectQuestion(term.InitS(), SetState, "Q", "s")
	dynamics.AddNative(s, dynamics.Args1(setState), "s")
}
Example #2
0
func init() {
	QNames := []term.TemplateID{Plus, Times, Minus, Equal, Less, More,
		LessOrEqual, MoreOrEqual,
		Divide,
	}
	QFuncs := [](func(dynamics.Dwimmer, *term.SettingT, ...term.T) term.T){
		dynamics.Args2(addNative),
		dynamics.Args2(multiplyNative),
		dynamics.Args2(subtractNative),
		dynamics.Args2(testEquality),
		dynamics.Args2(testLess),
		dynamics.Args2(testMore),
		dynamics.Args2(testLessOrEqual),
		dynamics.Args2(testMoreOrEqual),
		dynamics.Args2(divideNative),
	}

	for i := range QNames {
		s := term.InitS()
		s = dynamics.ExpectQuestion(s, QNames[i], "Q", "a", "b")
		s = dynamics.AddSimple(s, term.ViewS(term.Sr("a")))
		s.AppendTemplate(term.Int(0).Head())
		s = dynamics.AddSimple(s, term.ViewS(term.Sr("b")))
		s.AppendTemplate(term.Int(0).Head())
		dynamics.AddNative(s, QFuncs[i], "a", "b")
	}
}
Example #3
0
func init() {
	s := term.InitS()
	s = dynamics.ExpectQuestion(s, Explicit, "Q", "t")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("t")))
	s.AppendTemplate(term.Quoted{}.Head())
	dynamics.AddNative(s, dynamics.Args1(makeExplicit), "t")
}
Example #4
0
func init() {
	s := term.InitS()
	s = dynamics.ExpectQuestion(s, Len, "Q", "s")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("s")))
	s.AppendTemplate(term.Str("").Head())
	dynamics.AddNative(s, dynamics.Args1(length), "s")

	s = term.InitS()
	s = dynamics.ExpectQuestion(s, Bracketed, "Q", "s")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("s")))
	s.AppendTemplate(term.Str("").Head())
	dynamics.AddNative(s, dynamics.Args1(bracketed), "s")

	s = term.InitS()
	s = dynamics.ExpectQuestion(s, Concat, "Q", "a", "b")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("a")))
	s.AppendTemplate(term.Str("").Head())
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("b")))
	s.AppendTemplate(term.Str("").Head())
	dynamics.AddNative(s, dynamics.Args2(concat), "a", "b")

	dynamics.AddNativeResponse(GetChar, 2, dynamics.Args2(getChar))
}
Example #5
0
func init() {
	var s *term.SettingS
	s = dynamics.ExpectQuestion(term.InitS(), PutChar, "Q", "char", "x", "y")
	dynamics.AddNative(s, dynamics.Args3(nativePutChar), "char", "x", "y")

	s = dynamics.ExpectQuestion(term.InitS(), SetCursor, "Q", "x", "y")
	dynamics.AddNative(s, dynamics.Args2(nativeSetCursor), "x", "y")

	/*
		s = dynamics.ExpectQuestion(term.InitS(), GetCursor, "Q")
		dynamics.AddNative(s, dynamics.Args0(nativeGetCursor))
	*/

	s = dynamics.ExpectQuestion(term.InitS(), Clear, "Q")
	dynamics.AddNative(s, dynamics.Args0(nativeClear))

	s = dynamics.ExpectQuestion(term.InitS(), Size, "Q")
	dynamics.AddNative(s, dynamics.Args0(nativeSize))

	/*
		s = dynamics.ExpectQuestion(term.InitS(), GetChar, "Q")
		dynamics.AddNative(s, dynamics.Args0(nativeGetChar))
	*/
}
Example #6
0
func init() {
	s := term.InitS()
	s = dynamics.ExpectQuestion(s, RepresentSetting, "Q", "s")
	dynamics.AddNative(s, dynamics.Args1(quote), "s")
}
Example #7
0
func init() {
	s := dynamics.ExpectQuestion(term.InitS(), SettingForChannel, "Q", "c")
	s = dynamics.AddSimple(s, term.ViewS(term.Sr("c")))
	s = s.AppendTemplate(term.Channel{}.Head())
	dynamics.AddNative(s, dynamics.Args1(settingForChannel), "c")
}