FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/integration_tests/expr_13.py at main · sak-codes/lpython · GitHub
sak-codes
/
lpython
Public
forked from
lcompilers/lpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lpython
/
integration_tests
/
expr_13.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (21 loc) · 606 Bytes
Breadcrumbs
lpython
/
integration_tests
/
expr_13.py
Copy path
File metadata and controls
28 lines (21 loc) · 606 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from
ltypes
import
CPtr
,
empty_c_void_p
,
i32
,
Pointer
,
ccall
,
Const
@
ccall
def
deref_array
(
x
:
Pointer
[
CPtr
],
idx
:
i32
)
->
CPtr
:
pass
@
ccall
def
get_arrays
(
num_arrays
:
i32
)
->
Pointer
[
CPtr
]:
pass
@
ccall
def
sum_array
(
x
:
CPtr
,
size
:
i32
)
->
i32
:
pass
def
sum_array_python
(
x
:
Const
[
CPtr
],
size
:
i32
)
->
i32
:
return
sum_array
(
x
,
size
)
def
test_pointer_to_cptr
():
x
:
Pointer
[
CPtr
]
=
empty_c_void_p
()
x
=
get_arrays
(
2
)
i
:
i32
sums
:
i32
[
2
]
for
i
in
range
(
2
):
sums
[
i
]
=
sum_array_python
(
deref_array
(
x
,
i
),
10
)
assert
sums
[
0
]
==
sums
[
1
]
test_pointer_to_cptr
()
Back
|
FazBrowse Home
|
New Git URL