| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
package stdlib |
| 7 |
|
| 8 |
import ( |
| 9 |
"fmt" |
| 10 |
"reflect" |
| 11 |
) |
| 12 |
|
| 13 |
func init() { |
| 14 |
Symbols["fmt/fmt"] = map[string]reflect.Value{ |
| 15 |
|
| 16 |
"Append": reflect.ValueOf(fmt.Append), |
| 17 |
"Appendf": reflect.ValueOf(fmt.Appendf), |
| 18 |
"Appendln": reflect.ValueOf(fmt.Appendln), |
| 19 |
"Errorf": reflect.ValueOf(fmt.Errorf), |
| 20 |
"FormatString": reflect.ValueOf(fmt.FormatString), |
| 21 |
"Fprint": reflect.ValueOf(fmt.Fprint), |
| 22 |
"Fprintf": reflect.ValueOf(fmt.Fprintf), |
| 23 |
"Fprintln": reflect.ValueOf(fmt.Fprintln), |
| 24 |
"Fscan": reflect.ValueOf(fmt.Fscan), |
| 25 |
"Fscanf": reflect.ValueOf(fmt.Fscanf), |
| 26 |
"Fscanln": reflect.ValueOf(fmt.Fscanln), |
| 27 |
"Print": reflect.ValueOf(fmt.Print), |
| 28 |
"Printf": reflect.ValueOf(fmt.Printf), |
| 29 |
"Println": reflect.ValueOf(fmt.Println), |
| 30 |
"Scan": reflect.ValueOf(fmt.Scan), |
| 31 |
"Scanf": reflect.ValueOf(fmt.Scanf), |
| 32 |
"Scanln": reflect.ValueOf(fmt.Scanln), |
| 33 |
"Sprint": reflect.ValueOf(fmt.Sprint), |
| 34 |
"Sprintf": reflect.ValueOf(fmt.Sprintf), |
| 35 |
"Sprintln": reflect.ValueOf(fmt.Sprintln), |
| 36 |
"Sscan": reflect.ValueOf(fmt.Sscan), |
| 37 |
"Sscanf": reflect.ValueOf(fmt.Sscanf), |
| 38 |
"Sscanln": reflect.ValueOf(fmt.Sscanln), |
| 39 |
|
| 40 |
|
| 41 |
"Formatter": reflect.ValueOf((*fmt.Formatter)(nil)), |
| 42 |
"GoStringer": reflect.ValueOf((*fmt.GoStringer)(nil)), |
| 43 |
"ScanState": reflect.ValueOf((*fmt.ScanState)(nil)), |
| 44 |
"Scanner": reflect.ValueOf((*fmt.Scanner)(nil)), |
| 45 |
"State": reflect.ValueOf((*fmt.State)(nil)), |
| 46 |
"Stringer": reflect.ValueOf((*fmt.Stringer)(nil)), |
| 47 |
|
| 48 |
|
| 49 |
"_Formatter": reflect.ValueOf((*_fmt_Formatter)(nil)), |
| 50 |
"_GoStringer": reflect.ValueOf((*_fmt_GoStringer)(nil)), |
| 51 |
"_ScanState": reflect.ValueOf((*_fmt_ScanState)(nil)), |
| 52 |
"_Scanner": reflect.ValueOf((*_fmt_Scanner)(nil)), |
| 53 |
"_State": reflect.ValueOf((*_fmt_State)(nil)), |
| 54 |
"_Stringer": reflect.ValueOf((*_fmt_Stringer)(nil)), |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
type _fmt_Formatter struct { |
| 60 |
IValue interface{} |
| 61 |
WFormat func(f fmt.State, verb rune) |
| 62 |
} |
| 63 |
|
| 64 |
func (W _fmt_Formatter) Format(f fmt.State, verb rune) { W.WFormat(f, verb) } |
| 65 |
|
| 66 |
|
| 67 |
type _fmt_GoStringer struct { |
| 68 |
IValue interface{} |
| 69 |
WGoString func() string |
| 70 |
} |
| 71 |
|
| 72 |
func (W _fmt_GoStringer) GoString() string { return W.WGoString() } |
| 73 |
|
| 74 |
|
| 75 |
type _fmt_ScanState struct { |
| 76 |
IValue interface{} |
| 77 |
WRead func(buf []byte) (n int, err error) |
| 78 |
WReadRune func() (r rune, size int, err error) |
| 79 |
WSkipSpace func() |
| 80 |
WToken func(skipSpace bool, f func(rune) bool) (token []byte, err error) |
| 81 |
WUnreadRune func() error |
| 82 |
WWidth func() (wid int, ok bool) |
| 83 |
} |
| 84 |
|
| 85 |
func (W _fmt_ScanState) Read(buf []byte) (n int, err error) { return W.WRead(buf) } |
| 86 |
func (W _fmt_ScanState) ReadRune() (r rune, size int, err error) { return W.WReadRune() } |
| 87 |
func (W _fmt_ScanState) SkipSpace() { W.WSkipSpace() } |
| 88 |
func (W _fmt_ScanState) Token(skipSpace bool, f func(rune) bool) (token []byte, err error) { |
| 89 |
return W.WToken(skipSpace, f) |
| 90 |
} |
| 91 |
func (W _fmt_ScanState) UnreadRune() error { return W.WUnreadRune() } |
| 92 |
func (W _fmt_ScanState) Width() (wid int, ok bool) { return W.WWidth() } |
| 93 |
|
| 94 |
|
| 95 |
type _fmt_Scanner struct { |
| 96 |
IValue interface{} |
| 97 |
WScan func(state fmt.ScanState, verb rune) error |
| 98 |
} |
| 99 |
|
| 100 |
func (W _fmt_Scanner) Scan(state fmt.ScanState, verb rune) error { return W.WScan(state, verb) } |
| 101 |
|
| 102 |
|
| 103 |
type _fmt_State struct { |
| 104 |
IValue interface{} |
| 105 |
WFlag func(c int) bool |
| 106 |
WPrecision func() (prec int, ok bool) |
| 107 |
WWidth func() (wid int, ok bool) |
| 108 |
WWrite func(b []byte) (n int, err error) |
| 109 |
} |
| 110 |
|
| 111 |
func (W _fmt_State) Flag(c int) bool { return W.WFlag(c) } |
| 112 |
func (W _fmt_State) Precision() (prec int, ok bool) { return W.WPrecision() } |
| 113 |
func (W _fmt_State) Width() (wid int, ok bool) { return W.WWidth() } |
| 114 |
func (W _fmt_State) Write(b []byte) (n int, err error) { return W.WWrite(b) } |
| 115 |
|
| 116 |
|
| 117 |
type _fmt_Stringer struct { |
| 118 |
IValue interface{} |
| 119 |
WString func() string |
| 120 |
} |
| 121 |
|
| 122 |
func (W _fmt_Stringer) String() string { |
| 123 |
if W.WString == nil { |
| 124 |
return "" |
| 125 |
} |
| 126 |
return W.WString() |
| 127 |
} |