コード例 #1
0
// Print current Haxe date and time using the Haxe "target".Lib.println() API if one exists
func main() {

	dateNow := _haxeapi.XDate_now()

	sDate := dateNow.XtoString()

	fTime := dateNow.XgetTime()

	sTime := _haxeapi.XStd_string(fTime)

	s := tardisgolib.Platform() + " says it is " + sDate + "; timstamp= " + sTime

	switch tardisgolib.Platform() {
	case "neko":
		_haxeapi.Nneko_Lib_println(s)

	case "cpp":
		_haxeapi.Pcpp_Lib_println(s)

	case "php":
		_haxeapi.Hphp_Lib_println(s)

	default:
		// print using the built-in trace-style println() for other platforms
		println(s)
	}

}
コード例 #2
0
ファイル: test.go プロジェクト: pombredanne/tardisgo-samples
func main() {
	println("Start test running in: " + tardisgolib.Platform())
	testManyGoroutines()
	testChanSelect()
	tourfib()
	testCaseSensitivity()
	testInit()
	testConst()
	testUTF()
	testFloat()
	testMultiRet()
	testAppend()
	testStruct()
	testHeader()
	testCopy()
	testInFuncPtr()
	testCallBy()
	testMap()
	testNamed()
	testFuncPtr()
	testIntOverflow()
	testSlices()
	testChan()
	testComplex()
	testUTF8()
	testString()
	testClosure()
	testVariadic(42)
	testVariadic(40, 2)
	testVariadic(42, -5, 3, 2)
	testInterface()
	testInterfaceMethods()
	testStrconv()
	testTour64()
	testUintDiv32()
	testUintDiv64()
	testDefer()
	aGrWG.Wait()
	TEQint32(tardisgolib.CPos()+" testManyGoroutines() sync/atomic counter:", aGrCtr, 0)
	if tardisgolib.Host() == "haxe" {
		TEQ(tardisgolib.CPos(), int(tardisgolib.HAXE("42;")), int(42))
		TEQ(tardisgolib.CPos(), string(tardisgolib.HAXE("'test';")), "test")
		TEQ(tardisgolib.CPos()+"Num Haxe GR post-wait", tardisgolib.NumGoroutine(), 1)
	} else {
		TEQ(tardisgolib.CPos()+"Num Haxe GR post-wait", tardisgolib.NumGoroutine(), 2)
	}
	println("End test running in: " + tardisgolib.Platform())
	println("再见!Previous two chinese characters should say goodbye! (testing unicode output)")
	println()
}
コード例 #3
0
// Print tardisgo web site LICENSE in the simplest way possible
// (this particular formulation does not work for JavaScript, C# or Flash)
func main() {

	s := string(_haxeapi.Xhaxe_Http_requestUrl("http://tardisgo.github.io/LICENSE"))

	switch tardisgolib.Platform() {
	case "neko":
		_haxeapi.Nneko_Lib_println(s)

	case "cpp":
		_haxeapi.Pcpp_Lib_println(s)

	case "php":
		_haxeapi.Hphp_Lib_println(s)

	default:
		// print using the built-in trace-style println() for other platforms
		println(s)
	}
}