Skip to content

Commit

Permalink
fix example code
Browse files Browse the repository at this point in the history
  • Loading branch information
hidetatz committed Sep 9, 2023
1 parent 77ebdb7 commit 50a972e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
BIN = shiba

SRCS = $(shell find . -type f -name '*.go' -print)
STDSRCS = $(shell find ./std -type f -name '*.sb' -print)

$(BIN): $(SRCS) go.mod go.sum
$(BIN): $(SRCS) $(STDSRCS) go.mod go.sum
go mod tidy
go build -o $(BIN) $(SRCS)

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Below code works.
```
import os
fd, errno := os.open("/home/hidetatz/shiba/main.go")
fd, errno := os.Open("/home/hidetatz/shiba/main.go")
if errno != 0 {
print("failed to open")
return
}
result, errno := os.read(fd, 100)
result, errno := os.Read(fd, 100)
if errno != 0 {
print("failed to read")
return
Expand All @@ -33,7 +33,6 @@ Installation:
Author: [@hidetatz](https://github.com/hidetatz)

TODO (@hidetatz):
- struct and method
- error handling
- easy and simple concurrency like Go
- formatter
Expand Down
6 changes: 3 additions & 3 deletions std/os.sb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
def chmod(filepath) {
def Chmod(filepath) {
sys_chmod = 90
mode = 511 # 0777
r1, r2, errno := syscall(sys_chmod, filepath, mode, 0)
return errno
}

def open(filepath) {
def Open(filepath) {
sys_open = 2
flag = 0
mode = 511 # 0777
Expand All @@ -14,7 +14,7 @@ def open(filepath) {
return [fd, errno]
}

def read(fd, count) {
def Read(fd, count) {
sys_read = 0
buf = " " * count

Expand Down

0 comments on commit 50a972e

Please sign in to comment.