| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
package stdlib |
| 7 |
|
| 8 |
import ( |
| 9 |
"go/constant" |
| 10 |
"go/token" |
| 11 |
"io/fs" |
| 12 |
"os" |
| 13 |
"reflect" |
| 14 |
"time" |
| 15 |
) |
| 16 |
|
| 17 |
func init() { |
| 18 |
Symbols["os/os"] = map[string]reflect.Value{ |
| 19 |
|
| 20 |
"Args": reflect.ValueOf(&os.Args).Elem(), |
| 21 |
"Chdir": reflect.ValueOf(os.Chdir), |
| 22 |
"Chmod": reflect.ValueOf(os.Chmod), |
| 23 |
"Chown": reflect.ValueOf(os.Chown), |
| 24 |
"Chtimes": reflect.ValueOf(os.Chtimes), |
| 25 |
"Clearenv": reflect.ValueOf(os.Clearenv), |
| 26 |
"Create": reflect.ValueOf(os.Create), |
| 27 |
"CreateTemp": reflect.ValueOf(os.CreateTemp), |
| 28 |
"DevNull": reflect.ValueOf(constant.MakeFromLiteral("\"/dev/null\"", token.STRING, 0)), |
| 29 |
"DirFS": reflect.ValueOf(os.DirFS), |
| 30 |
"Environ": reflect.ValueOf(os.Environ), |
| 31 |
"ErrClosed": reflect.ValueOf(&os.ErrClosed).Elem(), |
| 32 |
"ErrDeadlineExceeded": reflect.ValueOf(&os.ErrDeadlineExceeded).Elem(), |
| 33 |
"ErrExist": reflect.ValueOf(&os.ErrExist).Elem(), |
| 34 |
"ErrInvalid": reflect.ValueOf(&os.ErrInvalid).Elem(), |
| 35 |
"ErrNoDeadline": reflect.ValueOf(&os.ErrNoDeadline).Elem(), |
| 36 |
"ErrNotExist": reflect.ValueOf(&os.ErrNotExist).Elem(), |
| 37 |
"ErrPermission": reflect.ValueOf(&os.ErrPermission).Elem(), |
| 38 |
"ErrProcessDone": reflect.ValueOf(&os.ErrProcessDone).Elem(), |
| 39 |
"Executable": reflect.ValueOf(os.Executable), |
| 40 |
"Exit": reflect.ValueOf(osExit), |
| 41 |
"Expand": reflect.ValueOf(os.Expand), |
| 42 |
"ExpandEnv": reflect.ValueOf(os.ExpandEnv), |
| 43 |
"FindProcess": reflect.ValueOf(osFindProcess), |
| 44 |
"Getegid": reflect.ValueOf(os.Getegid), |
| 45 |
"Getenv": reflect.ValueOf(os.Getenv), |
| 46 |
"Geteuid": reflect.ValueOf(os.Geteuid), |
| 47 |
"Getgid": reflect.ValueOf(os.Getgid), |
| 48 |
"Getgroups": reflect.ValueOf(os.Getgroups), |
| 49 |
"Getpagesize": reflect.ValueOf(os.Getpagesize), |
| 50 |
"Getpid": reflect.ValueOf(os.Getpid), |
| 51 |
"Getppid": reflect.ValueOf(os.Getppid), |
| 52 |
"Getuid": reflect.ValueOf(os.Getuid), |
| 53 |
"Getwd": reflect.ValueOf(os.Getwd), |
| 54 |
"Hostname": reflect.ValueOf(os.Hostname), |
| 55 |
"Interrupt": reflect.ValueOf(&os.Interrupt).Elem(), |
| 56 |
"IsExist": reflect.ValueOf(os.IsExist), |
| 57 |
"IsNotExist": reflect.ValueOf(os.IsNotExist), |
| 58 |
"IsPathSeparator": reflect.ValueOf(os.IsPathSeparator), |
| 59 |
"IsPermission": reflect.ValueOf(os.IsPermission), |
| 60 |
"IsTimeout": reflect.ValueOf(os.IsTimeout), |
| 61 |
"Kill": reflect.ValueOf(&os.Kill).Elem(), |
| 62 |
"Lchown": reflect.ValueOf(os.Lchown), |
| 63 |
"Link": reflect.ValueOf(os.Link), |
| 64 |
"LookupEnv": reflect.ValueOf(os.LookupEnv), |
| 65 |
"Lstat": reflect.ValueOf(os.Lstat), |
| 66 |
"Mkdir": reflect.ValueOf(os.Mkdir), |
| 67 |
"MkdirAll": reflect.ValueOf(os.MkdirAll), |
| 68 |
"MkdirTemp": reflect.ValueOf(os.MkdirTemp), |
| 69 |
"ModeAppend": reflect.ValueOf(os.ModeAppend), |
| 70 |
"ModeCharDevice": reflect.ValueOf(os.ModeCharDevice), |
| 71 |
"ModeDevice": reflect.ValueOf(os.ModeDevice), |
| 72 |
"ModeDir": reflect.ValueOf(os.ModeDir), |
| 73 |
"ModeExclusive": reflect.ValueOf(os.ModeExclusive), |
| 74 |
"ModeIrregular": reflect.ValueOf(os.ModeIrregular), |
| 75 |
"ModeNamedPipe": reflect.ValueOf(os.ModeNamedPipe), |
| 76 |
"ModePerm": reflect.ValueOf(os.ModePerm), |
| 77 |
"ModeSetgid": reflect.ValueOf(os.ModeSetgid), |
| 78 |
"ModeSetuid": reflect.ValueOf(os.ModeSetuid), |
| 79 |
"ModeSocket": reflect.ValueOf(os.ModeSocket), |
| 80 |
"ModeSticky": reflect.ValueOf(os.ModeSticky), |
| 81 |
"ModeSymlink": reflect.ValueOf(os.ModeSymlink), |
| 82 |
"ModeTemporary": reflect.ValueOf(os.ModeTemporary), |
| 83 |
"ModeType": reflect.ValueOf(os.ModeType), |
| 84 |
"NewFile": reflect.ValueOf(os.NewFile), |
| 85 |
"NewSyscallError": reflect.ValueOf(os.NewSyscallError), |
| 86 |
"O_APPEND": reflect.ValueOf(os.O_APPEND), |
| 87 |
"O_CREATE": reflect.ValueOf(os.O_CREATE), |
| 88 |
"O_EXCL": reflect.ValueOf(os.O_EXCL), |
| 89 |
"O_RDONLY": reflect.ValueOf(os.O_RDONLY), |
| 90 |
"O_RDWR": reflect.ValueOf(os.O_RDWR), |
| 91 |
"O_SYNC": reflect.ValueOf(os.O_SYNC), |
| 92 |
"O_TRUNC": reflect.ValueOf(os.O_TRUNC), |
| 93 |
"O_WRONLY": reflect.ValueOf(os.O_WRONLY), |
| 94 |
"Open": reflect.ValueOf(os.Open), |
| 95 |
"OpenFile": reflect.ValueOf(os.OpenFile), |
| 96 |
"PathListSeparator": reflect.ValueOf(constant.MakeFromLiteral("58", token.INT, 0)), |
| 97 |
"PathSeparator": reflect.ValueOf(constant.MakeFromLiteral("47", token.INT, 0)), |
| 98 |
"Pipe": reflect.ValueOf(os.Pipe), |
| 99 |
"ReadDir": reflect.ValueOf(os.ReadDir), |
| 100 |
"ReadFile": reflect.ValueOf(os.ReadFile), |
| 101 |
"Readlink": reflect.ValueOf(os.Readlink), |
| 102 |
"Remove": reflect.ValueOf(os.Remove), |
| 103 |
"RemoveAll": reflect.ValueOf(os.RemoveAll), |
| 104 |
"Rename": reflect.ValueOf(os.Rename), |
| 105 |
"SEEK_CUR": reflect.ValueOf(os.SEEK_CUR), |
| 106 |
"SEEK_END": reflect.ValueOf(os.SEEK_END), |
| 107 |
"SEEK_SET": reflect.ValueOf(os.SEEK_SET), |
| 108 |
"SameFile": reflect.ValueOf(os.SameFile), |
| 109 |
"Setenv": reflect.ValueOf(os.Setenv), |
| 110 |
"StartProcess": reflect.ValueOf(os.StartProcess), |
| 111 |
"Stat": reflect.ValueOf(os.Stat), |
| 112 |
"Stderr": reflect.ValueOf(&os.Stderr).Elem(), |
| 113 |
"Stdin": reflect.ValueOf(&os.Stdin).Elem(), |
| 114 |
"Stdout": reflect.ValueOf(&os.Stdout).Elem(), |
| 115 |
"Symlink": reflect.ValueOf(os.Symlink), |
| 116 |
"TempDir": reflect.ValueOf(os.TempDir), |
| 117 |
"Truncate": reflect.ValueOf(os.Truncate), |
| 118 |
"Unsetenv": reflect.ValueOf(os.Unsetenv), |
| 119 |
"UserCacheDir": reflect.ValueOf(os.UserCacheDir), |
| 120 |
"UserConfigDir": reflect.ValueOf(os.UserConfigDir), |
| 121 |
"UserHomeDir": reflect.ValueOf(os.UserHomeDir), |
| 122 |
"WriteFile": reflect.ValueOf(os.WriteFile), |
| 123 |
|
| 124 |
|
| 125 |
"DirEntry": reflect.ValueOf((*os.DirEntry)(nil)), |
| 126 |
"File": reflect.ValueOf((*os.File)(nil)), |
| 127 |
"FileInfo": reflect.ValueOf((*os.FileInfo)(nil)), |
| 128 |
"FileMode": reflect.ValueOf((*os.FileMode)(nil)), |
| 129 |
"LinkError": reflect.ValueOf((*os.LinkError)(nil)), |
| 130 |
"PathError": reflect.ValueOf((*os.PathError)(nil)), |
| 131 |
"ProcAttr": reflect.ValueOf((*os.ProcAttr)(nil)), |
| 132 |
"Process": reflect.ValueOf((*os.Process)(nil)), |
| 133 |
"ProcessState": reflect.ValueOf((*os.ProcessState)(nil)), |
| 134 |
"Signal": reflect.ValueOf((*os.Signal)(nil)), |
| 135 |
"SyscallError": reflect.ValueOf((*os.SyscallError)(nil)), |
| 136 |
|
| 137 |
|
| 138 |
"_DirEntry": reflect.ValueOf((*_os_DirEntry)(nil)), |
| 139 |
"_FileInfo": reflect.ValueOf((*_os_FileInfo)(nil)), |
| 140 |
"_Signal": reflect.ValueOf((*_os_Signal)(nil)), |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
type _os_DirEntry struct { |
| 146 |
IValue interface{} |
| 147 |
WInfo func() (fs.FileInfo, error) |
| 148 |
WIsDir func() bool |
| 149 |
WName func() string |
| 150 |
WType func() fs.FileMode |
| 151 |
} |
| 152 |
|
| 153 |
func (W _os_DirEntry) Info() (fs.FileInfo, error) { return W.WInfo() } |
| 154 |
func (W _os_DirEntry) IsDir() bool { return W.WIsDir() } |
| 155 |
func (W _os_DirEntry) Name() string { return W.WName() } |
| 156 |
func (W _os_DirEntry) Type() fs.FileMode { return W.WType() } |
| 157 |
|
| 158 |
|
| 159 |
type _os_FileInfo struct { |
| 160 |
IValue interface{} |
| 161 |
WIsDir func() bool |
| 162 |
WModTime func() time.Time |
| 163 |
WMode func() fs.FileMode |
| 164 |
WName func() string |
| 165 |
WSize func() int64 |
| 166 |
WSys func() any |
| 167 |
} |
| 168 |
|
| 169 |
func (W _os_FileInfo) IsDir() bool { return W.WIsDir() } |
| 170 |
func (W _os_FileInfo) ModTime() time.Time { return W.WModTime() } |
| 171 |
func (W _os_FileInfo) Mode() fs.FileMode { return W.WMode() } |
| 172 |
func (W _os_FileInfo) Name() string { return W.WName() } |
| 173 |
func (W _os_FileInfo) Size() int64 { return W.WSize() } |
| 174 |
func (W _os_FileInfo) Sys() any { return W.WSys() } |
| 175 |
|
| 176 |
|
| 177 |
type _os_Signal struct { |
| 178 |
IValue interface{} |
| 179 |
WSignal func() |
| 180 |
WString func() string |
| 181 |
} |
| 182 |
|
| 183 |
func (W _os_Signal) Signal() { W.WSignal() } |
| 184 |
func (W _os_Signal) String() string { |
| 185 |
if W.WString == nil { |
| 186 |
return "" |
| 187 |
} |
| 188 |
return W.WString() |
| 189 |
} |