sys.go 3.58 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.


package foop	// rename to avoid redeclaration

8
func	mal(uint32) *any;
9
func	breakpoint();
10 11
func	throwindex();
func	throwreturn();
12 13 14 15 16 17
func	panicl(int32);

func	printbool(bool);
func	printfloat(double);
func	printint(int64);
func	printstring(string);
Ken Thompson's avatar
Ken Thompson committed
18
func	printpointer(*any);
19 20 21 22 23 24 25

func	catstring(string, string) string;
func	cmpstring(string, string) int32;
func	slicestring(string, int32, int32) string;
func	indexstring(string, int32) byte;
func	intstring(int64) string;
func	byteastring(*byte, int32) string;
Ken Thompson's avatar
Ken Thompson committed
26 27 28 29

func	ifaceT2I(sigi *byte, sigt *byte, elem any) (ret interface{});
func	ifaceI2T(sigt *byte, iface interface{}) (ret any);
func	ifaceI2I(sigi *byte, iface any) (ret any);
30

Rob Pike's avatar
Rob Pike committed
31 32 33 34 35
func	argc() int32;
func	envc() int32;
func	argv(int32) string;
func	envv(int32) string;

36 37
func	frexp(float64) (float64, int32);	// break fp into exp,fract
func	ldexp(float64, int32) float64;		// make fp from exp,fract
Ken Thompson's avatar
Ken Thompson committed
38
func	modf(float64) (float64, float64);	// break fp into double.double
Ken Thompson's avatar
Ken Thompson committed
39 40 41 42
func	isInf(float64, int32) bool;		// test for infinity
func	isNaN(float64) bool;			// test for not-a-number
func	Inf(int32) float64;			// return signed Inf
func	NaN() float64;				// return a NaN
Ken Thompson's avatar
Ken Thompson committed
43

44 45 46 47 48
func	newmap(keysize uint32, valsize uint32,
		keyalg uint32, valalg uint32,
		hint uint32) (hmap *map[any]any);
func	mapaccess1(hmap *map[any]any, key any) (val any);
func	mapaccess2(hmap *map[any]any, key any) (val any, pres bool);
Ken Thompson's avatar
maps  
Ken Thompson committed
49 50
func	mapassign1(hmap *map[any]any, key any, val any);
func	mapassign2(hmap *map[any]any, key any, val any, pres bool);
51

Ken Thompson's avatar
Ken Thompson committed
52
func	newchan(elemsize uint32, elemalg uint32, hint uint32) (hchan *chan any);
Ken Thompson's avatar
chan  
Ken Thompson committed
53 54
func	chanrecv1(hchan *chan any) (elem any);
func	chanrecv2(hchan *chan any) (elem any, pres bool);
Ken Thompson's avatar
Ken Thompson committed
55
func	chanrecv3(hchan *chan any, elem *any) (pres bool);
Ken Thompson's avatar
Ken Thompson committed
56 57
func	chansend1(hchan *chan any, elem any);
func	chansend2(hchan *chan any, elem any) (pres bool);
Ken Thompson's avatar
Ken Thompson committed
58

Ken Thompson's avatar
Ken Thompson committed
59 60 61 62 63
func	newselect(size uint32) (sel *byte);
func	selectsend(sel *byte, hchan *chan any, elem any) (selected bool);
func	selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool);
func	selectgo(sel *byte);

Ken Thompson's avatar
Ken Thompson committed
64 65 66 67 68
func	newarray(nel uint32, cap uint32, width uint32) (ary *[]any);
func	arraysliced(old *[]any, lb uint32, hb uint32, width uint32) (ary *[]any);
func	arrayslices(old *any, nel uint32, lb uint32, hb uint32, width uint32) (ary *[]any);
func	arrays2d(old *any, nel uint32) (ary *[]any);

69 70 71
func	gosched();
func	goexit();

Rob Pike's avatar
Rob Pike committed
72
func	readfile(string) (string, bool);	// read file into string; boolean status
73
func	writefile(string, string) (bool);	// write string into file; boolean status
74 75
func	bytestorune(*byte, int32, int32) (int32, int32);	// convert bytes to runes	
func	stringtorune(string, int32, int32) (int32, int32);	// convert bytes to runes	
Rob Pike's avatar
Rob Pike committed
76

77
func	sleep(ms int64);
78
func	exit(int32);
Rob Pike's avatar
Rob Pike committed
79

80 81 82
export
	mal
	breakpoint
83 84
	throwindex
	throwreturn
85

86 87
	// print panic
	panicl
88 89 90 91 92 93
	printbool
	printfloat
	printint
	printstring
	printpointer

94
	// op string
95 96 97 98 99 100
	catstring
	cmpstring
	slicestring
	indexstring
	intstring
	byteastring
Ken Thompson's avatar
Ken Thompson committed
101 102 103 104 105

	// interface
	ifaceT2I
	ifaceI2T
	ifaceI2I
Ken Thompson's avatar
Ken Thompson committed
106

Rob Pike's avatar
Rob Pike committed
107 108 109 110 111 112 113
	// args
	argc
	envc
	argv
	envv

	// fp
Ken Thompson's avatar
Ken Thompson committed
114 115 116
	frexp
	ldexp
	modf
117 118 119 120
	isInf,
	isNaN,
	Inf,
	NaN,
121

Ken Thompson's avatar
Ken Thompson committed
122
	// map
123 124 125
	newmap
	mapaccess1
	mapaccess2
Ken Thompson's avatar
maps  
Ken Thompson committed
126 127
	mapassign1
	mapassign2
128

Ken Thompson's avatar
Ken Thompson committed
129 130
	// chan
	newchan
Ken Thompson's avatar
chan  
Ken Thompson committed
131 132
	chanrecv1
	chanrecv2
Ken Thompson's avatar
Ken Thompson committed
133 134 135
	chanrecv3
	chansend1
	chansend2
Ken Thompson's avatar
Ken Thompson committed
136

Ken Thompson's avatar
Ken Thompson committed
137 138 139 140 141 142
	// select
	newselect
	selectsend
	selectrecv
	selectgo

Ken Thompson's avatar
Ken Thompson committed
143 144 145 146 147 148
	// dynamic arrays
	newarray
	arraysliced
	arrayslices
	arrays2d

149 150 151 152
	// go routines
	gosched
	goexit

Rob Pike's avatar
Rob Pike committed
153 154
	// files
	readfile
155
	writefile
Rob Pike's avatar
Rob Pike committed
156

157 158 159 160
	// runes and utf-8
	bytestorune
	stringtorune

Rob Pike's avatar
Rob Pike committed
161
	// system calls
162
	sleep
Rob Pike's avatar
Rob Pike committed
163
	exit
164
	;