Implemented extern functions
This commit is contained in:
@ -1,10 +1,16 @@
|
||||
read(fd Int, address *Any, length Int) -> Int {
|
||||
kernel32.ReadFile(fd, address, length)
|
||||
extern kernel32 {
|
||||
GetStdHandle(handle Int) -> Int
|
||||
WriteConsoleA(fd Int, buffer *Any, length Int, written *Int) -> Bool
|
||||
ReadFile(fd Int, buffer *Any, length Int) -> Bool
|
||||
}
|
||||
|
||||
read(fd Int, buffer *Any, length Int) -> Int {
|
||||
kernel32.ReadFile(fd, buffer, length)
|
||||
return length
|
||||
}
|
||||
|
||||
write(fd Int, address *Any, length Int) -> Int {
|
||||
write(fd Int, buffer *Any, length Int) -> Int {
|
||||
fd = kernel32.GetStdHandle(-10 - fd)
|
||||
kernel32.WriteConsoleA(fd, address, length, 0)
|
||||
kernel32.WriteConsoleA(fd, buffer, length, 0)
|
||||
return length
|
||||
}
|
Reference in New Issue
Block a user