2021-06-27 09:32:03 +03:00
|
|
|
#pragma once
|
2020-05-18 16:51:10 +03:00
|
|
|
|
2021-06-10 13:24:05 +03:00
|
|
|
#include <stdint.h>
|
2022-09-21 13:13:15 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/stat.h>
|
2023-12-11 15:50:12 +03:00
|
|
|
#include <sys/types.h>
|
2020-05-18 16:51:10 +03:00
|
|
|
|
2021-07-21 16:35:21 +03:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <io.h>
|
2023-12-11 15:50:12 +03:00
|
|
|
#include <processthreadsapi.h>
|
2021-07-21 16:35:21 +03:00
|
|
|
#endif
|
|
|
|
|
2022-09-21 13:13:15 +03:00
|
|
|
FILE *idris2_openFile(char *name, char *mode);
|
|
|
|
void idris2_closeFile(FILE *f);
|
2020-05-18 16:51:10 +03:00
|
|
|
|
2022-09-21 13:13:15 +03:00
|
|
|
int idris2_fileError(FILE *f);
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
// Turn errno into an integer understandable by System.File
|
|
|
|
int idris2_fileErrno();
|
|
|
|
|
2022-09-21 13:13:15 +03:00
|
|
|
int idris2_chmod(const char *path, mode_t mode);
|
2020-05-21 15:32:35 +03:00
|
|
|
int idris2_removeFile(const char *filename);
|
2022-09-21 13:13:15 +03:00
|
|
|
int idris2_fileSize(FILE *h);
|
2020-05-18 16:51:10 +03:00
|
|
|
|
2022-09-21 13:13:15 +03:00
|
|
|
int idris2_fpoll(FILE *f);
|
2020-05-18 16:51:10 +03:00
|
|
|
|
2021-10-08 16:25:26 +03:00
|
|
|
void *idris2_popen(const char *cmd, const char *mode);
|
2021-11-03 18:10:43 +03:00
|
|
|
int idris2_pclose(void *stream);
|
2021-10-08 16:25:26 +03:00
|
|
|
|
2021-02-18 14:13:25 +03:00
|
|
|
// Seek through the next newline without
|
|
|
|
// saving anything along the way
|
2022-09-21 13:13:15 +03:00
|
|
|
int idris2_seekLine(FILE *f);
|
2021-02-18 14:13:25 +03:00
|
|
|
|
2020-05-18 16:51:10 +03:00
|
|
|
// Treat as a Ptr String (might be NULL)
|
2022-09-21 13:13:15 +03:00
|
|
|
char *idris2_readLine(FILE *f);
|
|
|
|
char *idris2_readChars(int num, FILE *f);
|
|
|
|
size_t idris2_readBufferData(FILE *h, char *buffer, size_t loc, size_t max);
|
|
|
|
|
|
|
|
int idris2_writeLine(FILE *f, char *str);
|
|
|
|
size_t idris2_writeBufferData(FILE *h, const char *buffer, size_t loc,
|
|
|
|
size_t len);
|
|
|
|
|
|
|
|
int idris2_eof(FILE *f);
|
2023-08-31 13:55:57 +03:00
|
|
|
|
|
|
|
struct filetime;
|
|
|
|
|
|
|
|
struct filetime *idris2_fileTime(FILE *f);
|
2022-09-21 13:13:15 +03:00
|
|
|
int idris2_fileModifiedTime(FILE *f);
|
2023-08-31 13:55:57 +03:00
|
|
|
|
|
|
|
int idris2_filetimeAccessTimeSec(struct filetime *f);
|
|
|
|
int idris2_filetimeAccessTimeNsec(struct filetime *f);
|
|
|
|
int idris2_filetimeModifiedTimeSec(struct filetime *f);
|
|
|
|
int idris2_filetimeModifiedTimeNsec(struct filetime *f);
|
|
|
|
int idris2_filetimeStatusTimeSec(struct filetime *f);
|
|
|
|
int idris2_filetimeStatusTimeNsec(struct filetime *f);
|
2022-09-21 13:13:15 +03:00
|
|
|
|
|
|
|
FILE *idris2_stdin();
|
|
|
|
FILE *idris2_stdout();
|
|
|
|
FILE *idris2_stderr();
|
2023-04-15 17:39:17 +03:00
|
|
|
|
|
|
|
struct child_process;
|
|
|
|
|
|
|
|
struct child_process *idris2_popen2(char *cmd);
|
2023-12-11 15:50:12 +03:00
|
|
|
|
2023-04-15 17:39:17 +03:00
|
|
|
int idris2_popen2ChildPid(struct child_process *ptr);
|
2023-12-11 15:50:12 +03:00
|
|
|
void *idris2_popen2ChildHandler(struct child_process *ptr);
|
2023-04-15 17:39:17 +03:00
|
|
|
FILE *idris2_popen2FileIn(struct child_process *ptr);
|
|
|
|
FILE *idris2_popen2FileOut(struct child_process *ptr);
|
2023-12-11 15:50:12 +03:00
|
|
|
|
|
|
|
int idris2_popen2WaitByHandler(void *hProcess);
|
|
|
|
int idris2_popen2WaitByPid(pid_t pid);
|