progress on x11
This commit is contained in:
+4
-4
@@ -23,7 +23,7 @@ double com_std_fabs(double v) { return fabs(v); }
|
||||
double com_std_sin(double v) { return sin(v); }
|
||||
double com_std_cos(double v) { return cos(v); }
|
||||
|
||||
com_std_fd com_std_open(char *path, uint32_t flags) {
|
||||
com_std_fd com_std_open(char const *path, uint32_t flags) {
|
||||
com_std_assert(flags != 0);
|
||||
char *mode = flags & COM_STD_OPEN_READ && flags & COM_STD_OPEN_WRITE ? "r+"
|
||||
: flags & COM_STD_OPEN_READ ? "r"
|
||||
@@ -31,14 +31,14 @@ com_std_fd com_std_open(char *path, uint32_t flags) {
|
||||
return fopen(path, mode);
|
||||
}
|
||||
|
||||
bool com_std_write(com_std_fd fd, char *data, uint32_t bytes) {
|
||||
bool com_std_write(com_std_fd fd, void const *data, uint32_t bytes) {
|
||||
com_std_assert(fd != NULL && data != NULL && bytes != 0);
|
||||
bool s = fwrite(data, 1, bytes, fd) == bytes;
|
||||
fflush(fd);
|
||||
return s;
|
||||
}
|
||||
|
||||
int32_t com_std_read(com_std_fd fd, char *data, uint32_t upto) {
|
||||
int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto) {
|
||||
com_std_assert(fd != NULL && data != NULL && upto != 0);
|
||||
return fread(data, 1, upto, fd);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ com_std_fd com_std_socket(bool isnetwork) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool com_std_connect(com_std_fd fd, bool isnetwork, char *address) {
|
||||
bool com_std_connect(com_std_fd fd, bool isnetwork, char const *address) {
|
||||
com_std_assert(address != NULL);
|
||||
if (!isnetwork) {
|
||||
struct sockaddr_un addr = {.sun_family = AF_UNIX};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
inline com_std_fd com_std_open(char *path, uint32_t flags) {
|
||||
inline com_std_fd com_std_open(char const *path, uint32_t flags) {
|
||||
com_std_assert(flags != 0);
|
||||
uint32_t mode = flags & COM_STD_OPEN_READ && flags & COM_STD_OPEN_WRITE
|
||||
? O_RDWR
|
||||
@@ -26,7 +26,7 @@ inline com_std_fd com_std_open(char *path, uint32_t flags) {
|
||||
return (void *)ret;
|
||||
}
|
||||
|
||||
inline bool com_std_write(com_std_fd fd, char const *data, uint32_t bytes) {
|
||||
inline bool com_std_write(com_std_fd fd, void const *data, uint32_t bytes) {
|
||||
long ret;
|
||||
__asm__ volatile("syscall"
|
||||
: "=a"(ret)
|
||||
@@ -35,7 +35,7 @@ inline bool com_std_write(com_std_fd fd, char const *data, uint32_t bytes) {
|
||||
return ret == bytes;
|
||||
}
|
||||
|
||||
inline int32_t com_std_read(com_std_fd fd, char *data, uint32_t upto) {
|
||||
inline int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto) {
|
||||
long ret;
|
||||
__asm__ volatile("syscall"
|
||||
: "=a"(ret)
|
||||
@@ -67,7 +67,8 @@ inline com_std_fd com_std_socket(bool isnetwork) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline bool com_std_connect(com_std_fd fd, bool isnetwork, char *address) {
|
||||
inline bool com_std_connect(com_std_fd fd, bool isnetwork,
|
||||
char const *address) {
|
||||
com_std_assert(address != NULL);
|
||||
if (!isnetwork) {
|
||||
struct sockaddr_un addr = {.sun_family = AF_UNIX};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
inline com_std_fd com_std_open(char *path, uint32_t flags) {
|
||||
inline com_std_fd com_std_open(char const *path, uint32_t flags) {
|
||||
com_std_assert(flags != 0);
|
||||
uint32_t mode = flags & COM_STD_OPEN_READ && flags & COM_STD_OPEN_WRITE
|
||||
? O_RDWR
|
||||
@@ -26,7 +26,7 @@ inline com_std_fd com_std_open(char *path, uint32_t flags) {
|
||||
return (void *)ret;
|
||||
}
|
||||
|
||||
inline bool com_std_write(com_std_fd fd, char const *data, uint32_t bytes) {
|
||||
inline bool com_std_write(com_std_fd fd, void const *data, uint32_t bytes) {
|
||||
long ret;
|
||||
__asm__ volatile("int $0x80"
|
||||
: "=a"(ret)
|
||||
@@ -35,7 +35,7 @@ inline bool com_std_write(com_std_fd fd, char const *data, uint32_t bytes) {
|
||||
return ret == bytes;
|
||||
}
|
||||
|
||||
inline int32_t com_std_read(com_std_fd fd, char *data, uint32_t upto) {
|
||||
inline int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto) {
|
||||
long ret;
|
||||
__asm__ volatile("int $0x80"
|
||||
: "=a"(ret)
|
||||
@@ -67,7 +67,8 @@ inline com_std_fd com_std_socket(bool isnetwork) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline bool com_std_connect(com_std_fd fd, bool isnetwork, char *address) {
|
||||
inline bool com_std_connect(com_std_fd fd, bool isnetwork,
|
||||
char const *address) {
|
||||
com_std_assert(address != NULL);
|
||||
if (!isnetwork) {
|
||||
struct sockaddr_un addr = {.sun_family = AF_UNIX};
|
||||
|
||||
+4
-4
@@ -18,14 +18,14 @@ double com_std_sin(double v) { return 0; }
|
||||
double com_std_cos(double v) { return 0; }
|
||||
#endif
|
||||
|
||||
com_std_fd com_std_open(char *path, uint32_t flags) { return NULL; }
|
||||
bool com_std_write(com_std_fd fd, char const *data, uint32_t bytes) {
|
||||
com_std_fd com_std_open(char const *path, uint32_t flags) { return NULL; }
|
||||
bool com_std_write(com_std_fd fd, void const *data, uint32_t bytes) {
|
||||
return false;
|
||||
}
|
||||
int32_t com_std_read(com_std_fd fd, char *data, uint32_t upto) { return -1; }
|
||||
int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto) { return -1; }
|
||||
bool com_std_sfwd(com_std_fd fd, uint32_t bytes) { return false; }
|
||||
com_std_fd com_std_socket(bool isnetwork) { return NULL; }
|
||||
bool com_std_connect(com_std_fd fd, bool isnetwork, char *address) {
|
||||
bool com_std_connect(com_std_fd fd, bool isnetwork, char const *address) {
|
||||
return false;
|
||||
}
|
||||
void com_std_exit(uint32_t status) {
|
||||
|
||||
+4
-4
@@ -14,12 +14,12 @@
|
||||
typedef void *com_std_fd;
|
||||
#define COM_STD_OPEN_READ (1 << 0)
|
||||
#define COM_STD_OPEN_WRITE (1 << 1)
|
||||
com_std_fd com_std_open(char *path, uint32_t flags);
|
||||
bool com_std_write(com_std_fd fd, char const *data, uint32_t bytes);
|
||||
int32_t com_std_read(com_std_fd fd, char *data, uint32_t upto);
|
||||
com_std_fd com_std_open(char const *path, uint32_t flags);
|
||||
bool com_std_write(com_std_fd fd, void const *data, uint32_t bytes);
|
||||
int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto);
|
||||
bool com_std_sfwd(com_std_fd fd, uint32_t bytes);
|
||||
com_std_fd com_std_socket(bool isnetwork);
|
||||
bool com_std_connect(com_std_fd sock, bool isnetwork, char *address);
|
||||
bool com_std_connect(com_std_fd sock, bool isnetwork, char const *address);
|
||||
void com_std_exit(uint32_t status) __attribute__((noreturn));
|
||||
void com_std_close(com_std_fd fd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user