forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsys.py
More file actions
32 lines (25 loc) · 702 Bytes
/
Copy pathsys.py
File metadata and controls
32 lines (25 loc) · 702 Bytes
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
29
30
31
32
from lpython import i32
def exit(error_code: i32):
"""
Exits the program with an error code `error_code`.
"""
quit(error_code)
# >----------------------------------- argv ----------------------------------->
@ccall
def _lpython_get_argc() -> i32:
pass
@ccall
def _lpython_get_argv(index: i32) -> str:
pass
def _lpython_argv() -> list[str]:
"""
Gets the list of command line arguments
"""
argc: i32 = _lpython_get_argc()
argv: list[str] = []
i: i32
for i in range(argc):
argv.append(_lpython_get_argv(i))
return argv
argv: list[str] = _lpython_argv()
# <----------------------------------- argv -----------------------------------<