Updated organization file functions, env naming.

This commit is contained in:
Christoffer Lerno
2023-06-23 22:59:57 +02:00
committed by Christoffer Lerno
parent 0ab0f727ad
commit 68f6cb1286
43 changed files with 751 additions and 561 deletions

View File

@@ -1,4 +1,4 @@
module std::os::macos::cf @if(DARWIN_LIBC);
module std::os::macos::cf @if(env::DARWIN);
def CFAllocatorRef = distinct void*;
def CFAllocatorContextRef = distinct void*;

View File

@@ -1,4 +1,4 @@
module std::os::macos::cf @if(DARWIN_LIBC);
module std::os::macos::cf @if(env::DARWIN);
def CFArrayRef = distinct void*;
def CFArrayCallBacksRef = distinct void*;

View File

@@ -1,4 +1,4 @@
module std::os::macos::cf @if(DARWIN_LIBC);
module std::os::macos::cf @if(env::DARWIN);
def CFTypeRef = distinct void*;
def CFIndex = isz;

View File

@@ -1,4 +1,4 @@
module std::os::macos::objc @if(DARWIN_LIBC);
module std::os::macos::objc @if(env::DARWIN);
def Class = distinct void*;
def Method = distinct void*;

View File

@@ -1,11 +1,72 @@
module std::os::posix @if(POSIX_LIBC);
module std::os::posix @if(env::POSIX);
import libc;
def Mode_t = uint;
def DIRPtr = distinct void*;
struct DarwinTimespec @private
{
long tv_sec;
long tv_nsec;
}
struct Darwin64Stat @private
{
int st_dev;
ushort st_mode;
ushort st_nlink;
ulong st_ino;
uint st_uid;
uint st_gid;
int st_rdev;
DarwinTimespec st_atimespec; // time of last access
DarwinTimespec st_mtimespec; // time of last data modification
DarwinTimespec st_ctimespec; // time of last status change
DarwinTimespec st_birthtimespec; // time of file creation(birth)
long st_size;
long st_blocks;
int st_blocksize;
uint st_flags;
uint st_gen;
int st_lspare;
long[2] st_qspare;
}
struct Posix_dirent
{
Ino_t d_fileno;
Off_t d_off;
ushort d_reclen;
ushort d_namelen @if(env::DARWIN);
char d_type;
char d_namelen @if(env::FREEBSD || env::OPENBSD);
uint d_pad0 @if(env::FREEBSD);
char[4] d_pad0 @if(env::OPENBSD);
char[1024] name @if(env::DARWIN);
char[*] name @if(!env::DARWIN);
}
extern fn int rmdir(ZString);
extern fn int mkdir(ZString, ushort mode_t);
extern fn int chdir(ZString);
extern fn ZString getcwd(char* pwd, usz len);
def Mode_t = uint;
def Pid_t = int;
extern fn CInt pipe(CInt[2]* pipes);
extern fn CFile fdopen(CInt fd, ZString mode);
extern fn CInt access(ZString path, CInt mode);
extern fn Posix_dirent* readdir(DIRPtr) @extern("readdir") @if(!USE_DARWIN_INODE64) ;
extern fn DIRPtr opendir(ZString);
extern fn void closedir(DIRPtr);
const DT_UNKNOWN = 0;
const DT_FIFO = 1;
const DT_CHR = 2;
const DT_DIR = 4;
const DT_BLK = 6;
const DT_REG = 8;
const DT_LNK = 10;
const DT_SOCK = 12;
const DT_WHT = 14;
const USE_DARWIN_INODE64 = env::DARWIN && env::ARCH_TYPE == X86_64;
extern fn Posix_dirent* readdir(DIRPtr) @extern("readdir$INODE64") @if(USE_DARWIN_INODE64);

View File

@@ -1,5 +1,5 @@
module std::os::posix @if(POSIX_LIBC);
module std::os::posix @if(env::POSIX);
import libc;
struct Posix_spawn_file_actions_t
{
int __allocated;

View File

@@ -1,4 +1,4 @@
module std::os::win32 @if(WIN32_LIBC);
module std::os::win32 @if(env::WIN32);
import libc;
enum Win32_GET_FILEEX_INFO_LEVELS
{
@@ -96,7 +96,8 @@ extern fn usz wcslen(Char16* str);
extern fn int _open_osfhandle(iptr osfhandle, int flags);
extern fn iptr _get_osfhandle(int fd);
extern fn CFile _fdopen(int fd, ZString mode);
extern fn CInt _access(ZString path, CInt mode);
extern fn CInt _waccess(Char16* path, CInt mode);
/*
extern ulong _win32_GetCurrentDirectoryW(ulong, Char16* buffer) @extern("GetCurrentDirectoryW");

View File

@@ -1,4 +1,4 @@
module std::os::win32 @if(WIN32_LIBC);
module std::os::win32 @if(env::WIN32);
extern fn Win32_DWORD getLastError() @extern("GetLastError");

View File

@@ -1,4 +1,4 @@
module std::os::win32 @if(WIN32_LIBC);
module std::os::win32 @if(env::WIN32);
const Win32_DWORD STARTF_USESTDHANDLES = 0x00000100;
const Win32_DWORD CREATE_NO_WINDOW = 0x08000000;

View File

@@ -1,4 +1,4 @@
module std::os::win32 @if(WIN32_LIBC);
module std::os::win32 @if(env::WIN32);
def WSAError = distinct int;