File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env xonsh
2
+ #
3
+ $RAISE_SUBPROC_ERROR = True
4
+ trace on
5
+
1
6
# Run some simple compilation tests, works everywhere:
2
7
src / bin / lpython - - version
3
8
# Compile and link separately
Original file line number Diff line number Diff line change 1
1
from ltypes import i64
2
- from os import (open , read , close )
2
+ from os import (open , read , close , O_RDONLY )
3
3
4
4
def test ():
5
5
path : str
6
6
path = "integration_tests/test_os.py"
7
7
fd : i64
8
8
n : i64
9
- fd = open (path , "r" )
9
+ fd = open (path , O_RDONLY )
10
10
n = 100
11
11
print (read (fd , n ))
12
12
close (fd )
Original file line number Diff line number Diff line change 1
1
from ltypes import i32 , i64 , ccall
2
2
3
- def open (path : str , flag : str ) -> i64 :
3
+ O_RDONLY : i32 # = 0 FIXME: Assign the value 0 to O_RDONLY
4
+ # O_WRONLY: i32 = 1
5
+ # O_RDWR : i32 = 2
6
+ # O_CREAT : i32 = 64
7
+ # O_APPEND: i32 = 1024
8
+
9
+
10
+ def open (path : str , flag : i32 ) -> i64 :
4
11
"""
5
12
Returns the file descriptor for the newly opened file
6
13
"""
7
- return _lpython_open (path , flag )
14
+ sflag : str
15
+ if flag == O_RDONLY :
16
+ sflag = "r"
17
+ else :
18
+ quit (1 ) # not implemented yet
19
+ return _lpython_open (path , sflag )
8
20
9
21
@ccall
10
22
def _lpython_open (path : str , flag : str ) -> i64 :
You can’t perform that action at this time.
0 commit comments