Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
b9840c4e
Commit
b9840c4e
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stat module
parent
6a257d04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
rt/include/python/stat.hpp
rt/include/python/stat.hpp
+25
-0
trans/stdlib/stat.py
trans/stdlib/stat.py
+14
-0
No files found.
rt/include/python/stat.hpp
0 → 100644
View file @
b9840c4e
//
// Created by Tom on 04/07/2023.
//
#ifndef TYPON_STAT_HPP
#define TYPON_STAT_HPP
#include "builtins.hpp"
#include <sys/stat.h>
#undef S_ISDIR
#undef S_ISREG
#undef S_ISLNK
namespace
py_stat
{
struct
stat_t
{
FUNCTION
(
bool
,
S_ISDIR
,
(
int
mode
),
{
return
(
mode
&
S_IFMT
)
==
S_IFDIR
;
})
FUNCTION
(
bool
,
S_ISREG
,
(
int
mode
),
{
return
(
mode
&
S_IFMT
)
==
S_IFREG
;
})
FUNCTION
(
bool
,
S_ISLNK
,
(
int
mode
),
{
return
(
mode
&
S_IFMT
)
==
S_IFLNK
;
})
}
all
;
auto
&
get_all
()
{
return
all
;
}
}
// namespace py_stat
#endif // TYPON_STAT_HPP
trans/stdlib/stat.py
0 → 100644
View file @
b9840c4e
# coding: utf-8
def
S_IMODE
(
mode
:
int
)
->
int
:
...
def
S_IFMT
(
mode
:
int
)
->
int
:
...
def
S_ISBLK
(
mode
:
int
)
->
bool
:
...
def
S_ISCHR
(
mode
:
int
)
->
bool
:
...
def
S_ISDIR
(
mode
:
int
)
->
bool
:
...
def
S_ISDOOR
(
mode
:
int
)
->
bool
:
...
def
S_ISFIFO
(
mode
:
int
)
->
bool
:
...
def
S_ISLNK
(
mode
:
int
)
->
bool
:
...
def
S_ISPORT
(
mode
:
int
)
->
bool
:
...
def
S_ISREG
(
mode
:
int
)
->
bool
:
...
def
S_ISSOCK
(
mode
:
int
)
->
bool
:
...
def
S_ISWHT
(
mode
:
int
)
->
bool
:
...
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment