github.com/HaHadaxigua/yaegi@v1.0.1/stdlib/go1_17_fmt.go (about)

     1  // Code generated by 'yaegi extract fmt'. DO NOT EDIT.
     2  
     3  //go:build go1.17
     4  // +build go1.17
     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  		// function, constant and variable definitions
    16  		"Errorf":   reflect.ValueOf(fmt.Errorf),
    17  		"Fprint":   reflect.ValueOf(fmt.Fprint),
    18  		"Fprintf":  reflect.ValueOf(fmt.Fprintf),
    19  		"Fprintln": reflect.ValueOf(fmt.Fprintln),
    20  		"Fscan":    reflect.ValueOf(fmt.Fscan),
    21  		"Fscanf":   reflect.ValueOf(fmt.Fscanf),
    22  		"Fscanln":  reflect.ValueOf(fmt.Fscanln),
    23  		"Print":    reflect.ValueOf(fmt.Print),
    24  		"Printf":   reflect.ValueOf(fmt.Printf),
    25  		"Println":  reflect.ValueOf(fmt.Println),
    26  		"Scan":     reflect.ValueOf(fmt.Scan),
    27  		"Scanf":    reflect.ValueOf(fmt.Scanf),
    28  		"Scanln":   reflect.ValueOf(fmt.Scanln),
    29  		"Sprint":   reflect.ValueOf(fmt.Sprint),
    30  		"Sprintf":  reflect.ValueOf(fmt.Sprintf),
    31  		"Sprintln": reflect.ValueOf(fmt.Sprintln),
    32  		"Sscan":    reflect.ValueOf(fmt.Sscan),
    33  		"Sscanf":   reflect.ValueOf(fmt.Sscanf),
    34  		"Sscanln":  reflect.ValueOf(fmt.Sscanln),
    35  
    36  		// type definitions
    37  		"Formatter":  reflect.ValueOf((*fmt.Formatter)(nil)),
    38  		"GoStringer": reflect.ValueOf((*fmt.GoStringer)(nil)),
    39  		"ScanState":  reflect.ValueOf((*fmt.ScanState)(nil)),
    40  		"Scanner":    reflect.ValueOf((*fmt.Scanner)(nil)),
    41  		"State":      reflect.ValueOf((*fmt.State)(nil)),
    42  		"Stringer":   reflect.ValueOf((*fmt.Stringer)(nil)),
    43  
    44  		// interface wrapper definitions
    45  		"_Formatter":  reflect.ValueOf((*_fmt_Formatter)(nil)),
    46  		"_GoStringer": reflect.ValueOf((*_fmt_GoStringer)(nil)),
    47  		"_ScanState":  reflect.ValueOf((*_fmt_ScanState)(nil)),
    48  		"_Scanner":    reflect.ValueOf((*_fmt_Scanner)(nil)),
    49  		"_State":      reflect.ValueOf((*_fmt_State)(nil)),
    50  		"_Stringer":   reflect.ValueOf((*_fmt_Stringer)(nil)),
    51  	}
    52  }
    53  
    54  // _fmt_Formatter is an interface wrapper for Formatter type
    55  type _fmt_Formatter struct {
    56  	IValue  interface{}
    57  	WFormat func(f fmt.State, verb rune)
    58  }
    59  
    60  func (W _fmt_Formatter) Format(f fmt.State, verb rune) {
    61  	W.WFormat(f, verb)
    62  }
    63  
    64  // _fmt_GoStringer is an interface wrapper for GoStringer type
    65  type _fmt_GoStringer struct {
    66  	IValue    interface{}
    67  	WGoString func() string
    68  }
    69  
    70  func (W _fmt_GoStringer) GoString() string {
    71  	return W.WGoString()
    72  }
    73  
    74  // _fmt_ScanState is an interface wrapper for ScanState type
    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) {
    86  	return W.WRead(buf)
    87  }
    88  func (W _fmt_ScanState) ReadRune() (r rune, size int, err error) {
    89  	return W.WReadRune()
    90  }
    91  func (W _fmt_ScanState) SkipSpace() {
    92  	W.WSkipSpace()
    93  }
    94  func (W _fmt_ScanState) Token(skipSpace bool, f func(rune) bool) (token []byte, err error) {
    95  	return W.WToken(skipSpace, f)
    96  }
    97  func (W _fmt_ScanState) UnreadRune() error {
    98  	return W.WUnreadRune()
    99  }
   100  func (W _fmt_ScanState) Width() (wid int, ok bool) {
   101  	return W.WWidth()
   102  }
   103  
   104  // _fmt_Scanner is an interface wrapper for Scanner type
   105  type _fmt_Scanner struct {
   106  	IValue interface{}
   107  	WScan  func(state fmt.ScanState, verb rune) error
   108  }
   109  
   110  func (W _fmt_Scanner) Scan(state fmt.ScanState, verb rune) error {
   111  	return W.WScan(state, verb)
   112  }
   113  
   114  // _fmt_State is an interface wrapper for State type
   115  type _fmt_State struct {
   116  	IValue     interface{}
   117  	WFlag      func(c int) bool
   118  	WPrecision func() (prec int, ok bool)
   119  	WWidth     func() (wid int, ok bool)
   120  	WWrite     func(b []byte) (n int, err error)
   121  }
   122  
   123  func (W _fmt_State) Flag(c int) bool {
   124  	return W.WFlag(c)
   125  }
   126  func (W _fmt_State) Precision() (prec int, ok bool) {
   127  	return W.WPrecision()
   128  }
   129  func (W _fmt_State) Width() (wid int, ok bool) {
   130  	return W.WWidth()
   131  }
   132  func (W _fmt_State) Write(b []byte) (n int, err error) {
   133  	return W.WWrite(b)
   134  }
   135  
   136  // _fmt_Stringer is an interface wrapper for Stringer type
   137  type _fmt_Stringer struct {
   138  	IValue  interface{}
   139  	WString func() string
   140  }
   141  
   142  func (W _fmt_Stringer) String() string {
   143  	if W.WString == nil {
   144  		return ""
   145  	}
   146  	return W.WString()
   147  }