Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tom Niget
typon
Commits
1ecb0d28
Commit
1ecb0d28
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stat module
parent
bb7f4cfb
Changes
2
Show 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 @
1ecb0d28
//
// 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 @
1ecb0d28
# 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