From ea83398f54678a2b072bad5afb0f570a94973250 Mon Sep 17 00:00:00 2001 From: Salvo Cristaldi Date: Wed, 17 Jun 2020 13:16:34 +0200 Subject: [PATCH 01/16] add utime --- ppu/crt/crt1.c | 3 +++ ppu/include/utime.h | 18 ++++++++++++++++++ ppu/librt/Makefile | 3 ++- ppu/librt/utime.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 ppu/include/utime.h create mode 100644 ppu/librt/utime.c diff --git a/ppu/crt/crt1.c b/ppu/crt/crt1.c index 6c3826ac..cfd58583 100644 --- a/ppu/crt/crt1.c +++ b/ppu/crt/crt1.c @@ -4,6 +4,7 @@ #include #include #include +#include extern void _init(); @@ -34,6 +35,7 @@ extern void __librt_seekdir_r(struct _reent *r,DIR *dirp,long int loc); extern int __librt_rmdir_r(struct _reent *r,const char *dirname); extern int __librt_unlink_r(struct _reent *r,const char *path); extern int __librt_access_r(struct _reent *r,const char *path,int amode); +extern int __librt_utime_r(struct _reent *r,const char *filename, const struct utimbuf *times); extern int __librt_usleep_r(struct _reent *r,useconds_t usec); extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds); @@ -80,6 +82,7 @@ static void __syscalls_init(void) __syscalls.rmdir_r = __librt_rmdir_r; __syscalls.unlink_r = __librt_unlink_r; __syscalls.access_r = __librt_access_r; + __syscalls.utime_r = __librt_utime_r; __syscalls.sleep_r = __librt_sleep_r; __syscalls.usleep_r = __librt_usleep_r; diff --git a/ppu/include/utime.h b/ppu/include/utime.h new file mode 100644 index 00000000..ab668b36 --- /dev/null +++ b/ppu/include/utime.h @@ -0,0 +1,18 @@ +#ifndef _UTIME_H +#define _UTIME_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct utimbuf { + time_t actime; /* access time */ + time_t modtime; /* modification time */ + }; + +int utime(const char *filename, const struct utimbuf *times); + +#ifdef __cplusplus +}; +#endif +#endif diff --git a/ppu/librt/Makefile b/ppu/librt/Makefile index ea5892b0..1d92d0d0 100644 --- a/ppu/librt/Makefile +++ b/ppu/librt/Makefile @@ -45,7 +45,8 @@ VPATH := $(BASEDIR) OBJS := \ sbrk.o exit.o close.o lseek.o read.o open.o sleep.o write.o fstat.o \ socket.o lock.o dirent.o mkdir.o times.o umask.o lv2errno.o heap.o \ - chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o + chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o \ + utime.o all: ppu diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c new file mode 100644 index 00000000..ff0f68bc --- /dev/null +++ b/ppu/librt/utime.c @@ -0,0 +1,30 @@ +#include +#include +#include <_ansi.h> +#include <_syslist.h> +#include +#include +#include +#include + +#include +#include +#include +#include + +int +_DEFUN(__librt_utime_r,(r,filename,times), + struct _reent *r _AND + const char *filename _AND + const struct utimbuf *times) +{ + if (times == NULL) { + struct utimbuf now_time; + time_t now; + now = time(NULL); + now_time.actime = now; + now_time.modtime = now; + return lv2errno_r(r,sysLv2FsUtime(filename,(const struct sysFSUtimbuf *)&now_time)); + } + return lv2errno_r(r,sysLv2FsUtime(filename,(const struct sysFSUtimbuf *)times)); +} \ No newline at end of file From d7d9bafabd970f7850a74b437e0c5abe1783e5c7 Mon Sep 17 00:00:00 2001 From: Salvo Cristaldi Date: Thu, 18 Jun 2020 10:18:12 +0200 Subject: [PATCH 02/16] Addedd sysLv2FsUtime and utime --- ppu/sprx/libsysfs/exports.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ppu/sprx/libsysfs/exports.h b/ppu/sprx/libsysfs/exports.h index 90f8d08b..efd19a0b 100644 --- a/ppu/sprx/libsysfs/exports.h +++ b/ppu/sprx/libsysfs/exports.h @@ -16,6 +16,7 @@ EXPORT(sysFsOpendir, 0x3F61245C); EXPORT(sysFsClosedir, 0xFF42DCC3); EXPORT(sysFsReaddir, 0x5C74903D); EXPORT(sysFsAccess, 0x06E681ED); +//EXPORT(sysFsUtime, 0xBEF554A4); EXPORT(sysFsAioInit, 0xDB869F20); EXPORT(sysFsAioReadEx, 0xC1C507E7); EXPORT(sysFsAioWriteEx, 0x4CEF342E); From 5cf4d297786fd2b70e981a25c0fb1b9969e27f5d Mon Sep 17 00:00:00 2001 From: Salvo Cristaldi Date: Thu, 18 Jun 2020 10:24:43 +0200 Subject: [PATCH 03/16] Restored without unnecessary sysFsUtime --- ppu/sprx/libsysfs/exports.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ppu/sprx/libsysfs/exports.h b/ppu/sprx/libsysfs/exports.h index efd19a0b..90f8d08b 100644 --- a/ppu/sprx/libsysfs/exports.h +++ b/ppu/sprx/libsysfs/exports.h @@ -16,7 +16,6 @@ EXPORT(sysFsOpendir, 0x3F61245C); EXPORT(sysFsClosedir, 0xFF42DCC3); EXPORT(sysFsReaddir, 0x5C74903D); EXPORT(sysFsAccess, 0x06E681ED); -//EXPORT(sysFsUtime, 0xBEF554A4); EXPORT(sysFsAioInit, 0xDB869F20); EXPORT(sysFsAioReadEx, 0xC1C507E7); EXPORT(sysFsAioWriteEx, 0x4CEF342E); From e8624e9cd17f7da70671c17dac23bce44e58171b Mon Sep 17 00:00:00 2001 From: Salvo Cristaldi Date: Thu, 18 Jun 2020 13:16:10 +0200 Subject: [PATCH 04/16] update utime with errno --- ppu/crt/crt1.c | 3 --- ppu/include/utime.h | 14 +++++++++++++ ppu/librt/utime.c | 51 ++++++++++++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/ppu/crt/crt1.c b/ppu/crt/crt1.c index cfd58583..6c3826ac 100644 --- a/ppu/crt/crt1.c +++ b/ppu/crt/crt1.c @@ -4,7 +4,6 @@ #include #include #include -#include extern void _init(); @@ -35,7 +34,6 @@ extern void __librt_seekdir_r(struct _reent *r,DIR *dirp,long int loc); extern int __librt_rmdir_r(struct _reent *r,const char *dirname); extern int __librt_unlink_r(struct _reent *r,const char *path); extern int __librt_access_r(struct _reent *r,const char *path,int amode); -extern int __librt_utime_r(struct _reent *r,const char *filename, const struct utimbuf *times); extern int __librt_usleep_r(struct _reent *r,useconds_t usec); extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds); @@ -82,7 +80,6 @@ static void __syscalls_init(void) __syscalls.rmdir_r = __librt_rmdir_r; __syscalls.unlink_r = __librt_unlink_r; __syscalls.access_r = __librt_access_r; - __syscalls.utime_r = __librt_utime_r; __syscalls.sleep_r = __librt_sleep_r; __syscalls.usleep_r = __librt_usleep_r; diff --git a/ppu/include/utime.h b/ppu/include/utime.h index ab668b36..ad387f94 100644 --- a/ppu/include/utime.h +++ b/ppu/include/utime.h @@ -1,6 +1,20 @@ #ifndef _UTIME_H #define _UTIME_H +#define SYS_FS_OK 0 +#define SYS_FS_ENOTMOUNTED -2147418054 /* 0x8001003A */ +#define SYS_FS_ENOENT -2147418106 /* 0x80010006 */ +#define SYS_FS_ENOTSUP -2147418057 /* 0x80010037 */ +#define SYS_FS_EIO -2147418069 /* 0x8001002B */ +#define SYS_FS_ENOMEM -2147418108 /* 0x80010004 */ +#define SYS_FS_ENOTDIR -2147418066 /* 0x8001002E */ +#define SYS_FS_ENAMETOOLONG -2147418060 /* 0x80010034 */ +#define SYS_FS_EFSSPECIFIC -2147418056 /* 0x80010038 */ +#define SYS_FS_EINVAL -2147418110 /* 0x80010002 */ +#define SYS_FS_EROFS -2147418074 /* 0x80010026 */ +#define SYS_FS_EFAULT -2147418099 /* 0x8001000D */ +#define SYS_FS_EACCES -2147418071 /* 0x80010029 */ + #ifdef __cplusplus extern "C" { #endif diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index ff0f68bc..f05599cf 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -1,30 +1,47 @@ -#include -#include -#include <_ansi.h> -#include <_syslist.h> -#include -#include -#include -#include - #include -#include #include #include +#include -int -_DEFUN(__librt_utime_r,(r,filename,times), - struct _reent *r _AND - const char *filename _AND - const struct utimbuf *times) +extern int errno; + +int __attribute__((weak)) utime(const char *filename, const struct utimbuf *times) { + s32 ret; if (times == NULL) { struct utimbuf now_time; time_t now; now = time(NULL); now_time.actime = now; now_time.modtime = now; - return lv2errno_r(r,sysLv2FsUtime(filename,(const struct sysFSUtimbuf *)&now_time)); + ret = sysLv2FsUtime(filename,(sysFSUtimbuf *)&now_time); + } + else ret = sysLv2FsUtime(filename,(sysFSUtimbuf *)times); + if (ret != SYS_FS_OK ) { + switch (ret) { + case SYS_FS_EACCES: + errno = EACCES; + break; + case SYS_FS_ENOTDIR: + errno = ENOTDIR; + break; + case SYS_FS_ENOENT: + errno = ENOENT; + break; + case SYS_FS_ENAMETOOLONG: + errno = ENAMETOOLONG; + break; + case SYS_FS_EROFS: + errno = EROFS; + break; + case SYS_FS_ENOTSUP: + errno = EPERM; + break; + + default: + errno = ENOENT; + } + return - 1; } - return lv2errno_r(r,sysLv2FsUtime(filename,(const struct sysFSUtimbuf *)times)); + return ret; } \ No newline at end of file From dc1592378e3a52013c16a46b4bdbddb01a1e8707 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Jun 2020 22:21:27 +0200 Subject: [PATCH 05/16] Update utime --- ppu/include/utime.h | 32 ---------------------------- ppu/librt/utime.c | 51 ++++++++++++++------------------------------- 2 files changed, 16 insertions(+), 67 deletions(-) delete mode 100644 ppu/include/utime.h diff --git a/ppu/include/utime.h b/ppu/include/utime.h deleted file mode 100644 index ad387f94..00000000 --- a/ppu/include/utime.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _UTIME_H -#define _UTIME_H - -#define SYS_FS_OK 0 -#define SYS_FS_ENOTMOUNTED -2147418054 /* 0x8001003A */ -#define SYS_FS_ENOENT -2147418106 /* 0x80010006 */ -#define SYS_FS_ENOTSUP -2147418057 /* 0x80010037 */ -#define SYS_FS_EIO -2147418069 /* 0x8001002B */ -#define SYS_FS_ENOMEM -2147418108 /* 0x80010004 */ -#define SYS_FS_ENOTDIR -2147418066 /* 0x8001002E */ -#define SYS_FS_ENAMETOOLONG -2147418060 /* 0x80010034 */ -#define SYS_FS_EFSSPECIFIC -2147418056 /* 0x80010038 */ -#define SYS_FS_EINVAL -2147418110 /* 0x80010002 */ -#define SYS_FS_EROFS -2147418074 /* 0x80010026 */ -#define SYS_FS_EFAULT -2147418099 /* 0x8001000D */ -#define SYS_FS_EACCES -2147418071 /* 0x80010029 */ - -#ifdef __cplusplus -extern "C" { -#endif - -struct utimbuf { - time_t actime; /* access time */ - time_t modtime; /* modification time */ - }; - -int utime(const char *filename, const struct utimbuf *times); - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index f05599cf..e638a6ee 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -1,47 +1,28 @@ -#include -#include -#include +#include +#include +#include <_ansi.h> +#include <_syslist.h> +#include #include +#include +#include -extern int errno; +#include +#include -int __attribute__((weak)) utime(const char *filename, const struct utimbuf *times) +int +_DEFUN(__librt_access_r,(r,filename,times), + struct _reent *r _AND + const char *filename _AND + const struct utimbuf *times) { - s32 ret; if (times == NULL) { struct utimbuf now_time; time_t now; now = time(NULL); now_time.actime = now; now_time.modtime = now; - ret = sysLv2FsUtime(filename,(sysFSUtimbuf *)&now_time); - } - else ret = sysLv2FsUtime(filename,(sysFSUtimbuf *)times); - if (ret != SYS_FS_OK ) { - switch (ret) { - case SYS_FS_EACCES: - errno = EACCES; - break; - case SYS_FS_ENOTDIR: - errno = ENOTDIR; - break; - case SYS_FS_ENOENT: - errno = ENOENT; - break; - case SYS_FS_ENAMETOOLONG: - errno = ENAMETOOLONG; - break; - case SYS_FS_EROFS: - errno = EROFS; - break; - case SYS_FS_ENOTSUP: - errno = EPERM; - break; - - default: - errno = ENOENT; - } - return - 1; + return lv2errno_r(sysLv2FsUtime(filename,(sysFSUtimbuf *)&now_time)); } - return ret; + else return lv2errno_r(sysLv2FsUtime(filename,(sysFSUtimbuf *)times)); } \ No newline at end of file From ba0fe2f64c1f16e2d587f68062ea8b376fc6aeba Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Jun 2020 22:55:40 +0200 Subject: [PATCH 06/16] Added utime and sysFsUtime --- ppu/crt/crt1.c | 3 +++ ppu/include/lv2/sysfs.h | 1 + ppu/librt/Makefile | 2 +- ppu/librt/utime.c | 8 ++++---- ppu/sprx/libsysfs/exports.h | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ppu/crt/crt1.c b/ppu/crt/crt1.c index fdca7b25..b9204451 100644 --- a/ppu/crt/crt1.c +++ b/ppu/crt/crt1.c @@ -4,6 +4,7 @@ #include #include #include +#include extern void _init(); @@ -38,6 +39,7 @@ extern int __librt_rmdir_r(struct _reent *r,const char *dirname); extern int __librt_link_r(struct _reent *r,const char *old,const char *new); extern int __librt_unlink_r(struct _reent *r,const char *path); extern int __librt_access_r(struct _reent *r,const char *path,int amode); +extern int __librt_utime_r(struct _reentr,const char *path,const struct utimbuf *times); extern int __librt_usleep_r(struct _reent *r,useconds_t usec); extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds); @@ -88,6 +90,7 @@ static void __syscalls_init(void) __syscalls.link_r = __librt_link_r; __syscalls.unlink_r = __librt_unlink_r; __syscalls.access_r = __librt_access_r; + __syscalls.utime_r = __librt_utime_r; __syscalls.sleep_r = __librt_sleep_r; __syscalls.usleep_r = __librt_usleep_r; diff --git a/ppu/include/lv2/sysfs.h b/ppu/include/lv2/sysfs.h index 327e9c4c..a6798e54 100644 --- a/ppu/include/lv2/sysfs.h +++ b/ppu/include/lv2/sysfs.h @@ -71,6 +71,7 @@ s32 sysFsMkdir(const char* path, s32 mode); s32 sysFsRmdir(const char *path); s32 sysFsUnlink(const char *path); s32 sysFsAccess(const char *path,s32 amode); +s32 sysFsUtime(const char *path, sysFSUtimbuf *times); s32 sysFsOpendir(const char *path, s32 *fd); s32 sysFsClosedir(s32 fd); diff --git a/ppu/librt/Makefile b/ppu/librt/Makefile index f1c73525..ae153d87 100644 --- a/ppu/librt/Makefile +++ b/ppu/librt/Makefile @@ -46,7 +46,7 @@ OBJS := \ sbrk.o exit.o close.o lseek.o read.o open.o sleep.o write.o fstat.o \ socket.o lock.o dirent.o mkdir.o times.o umask.o lv2errno.o heap.o \ chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o \ - link.o truncate.o fsync.o + link.o truncate.o fsync.o utime.o all: ppu diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index e638a6ee..8d2433a2 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -11,9 +11,9 @@ #include int -_DEFUN(__librt_access_r,(r,filename,times), +_DEFUN(__librt_utime_r,(r,path,times), struct _reent *r _AND - const char *filename _AND + const char *path _AND const struct utimbuf *times) { if (times == NULL) { @@ -22,7 +22,7 @@ _DEFUN(__librt_access_r,(r,filename,times), now = time(NULL); now_time.actime = now; now_time.modtime = now; - return lv2errno_r(sysLv2FsUtime(filename,(sysFSUtimbuf *)&now_time)); + return lv2errno_r(sysLv2FsUtime(path,(sysFSUtimbuf *)&now_time)); } - else return lv2errno_r(sysLv2FsUtime(filename,(sysFSUtimbuf *)times)); + else return lv2errno_r(sysLv2FsUtime(path,(sysFSUtimbuf *)times)); } \ No newline at end of file diff --git a/ppu/sprx/libsysfs/exports.h b/ppu/sprx/libsysfs/exports.h index 90f8d08b..e55a207c 100644 --- a/ppu/sprx/libsysfs/exports.h +++ b/ppu/sprx/libsysfs/exports.h @@ -16,6 +16,7 @@ EXPORT(sysFsOpendir, 0x3F61245C); EXPORT(sysFsClosedir, 0xFF42DCC3); EXPORT(sysFsReaddir, 0x5C74903D); EXPORT(sysFsAccess, 0x06E681ED); +EXPORT(sysFsUtime, 0xBEF554A4); EXPORT(sysFsAioInit, 0xDB869F20); EXPORT(sysFsAioReadEx, 0xC1C507E7); EXPORT(sysFsAioWriteEx, 0x4CEF342E); From 1fbcbca8da94760e4e08a47b11993cd868aefc6a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 20 Jun 2020 00:09:00 +0200 Subject: [PATCH 07/16] Added utime and sysFsUtime --- ppu/crt/crt1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppu/crt/crt1.c b/ppu/crt/crt1.c index b9204451..df2aa9c2 100644 --- a/ppu/crt/crt1.c +++ b/ppu/crt/crt1.c @@ -39,7 +39,7 @@ extern int __librt_rmdir_r(struct _reent *r,const char *dirname); extern int __librt_link_r(struct _reent *r,const char *old,const char *new); extern int __librt_unlink_r(struct _reent *r,const char *path); extern int __librt_access_r(struct _reent *r,const char *path,int amode); -extern int __librt_utime_r(struct _reentr,const char *path,const struct utimbuf *times); +extern int __librt_utime_r(struct _reent *r,const char *path,const struct utimbuf *times); extern int __librt_usleep_r(struct _reent *r,useconds_t usec); extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds); @@ -89,7 +89,7 @@ static void __syscalls_init(void) __syscalls.rmdir_r = __librt_rmdir_r; __syscalls.link_r = __librt_link_r; __syscalls.unlink_r = __librt_unlink_r; - __syscalls.access_r = __librt_access_r; + //__syscalls.access_r = __librt_access_r; __syscalls.utime_r = __librt_utime_r; __syscalls.sleep_r = __librt_sleep_r; From 7a901c6baec06cd59a3d08d3ffa478d10e221d76 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 20 Jun 2020 00:13:48 +0200 Subject: [PATCH 08/16] Added utime and sysFsUtime --- ppu/librt/utime.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index 8d2433a2..18abdc98 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -10,19 +10,26 @@ #include #include -int -_DEFUN(__librt_utime_r,(r,path,times), - struct _reent *r _AND - const char *path _AND - const struct utimbuf *times) + +int _utime(const char *path, const struct utimbuf *times, int* _errno) { - if (times == NULL) { + printf("CIAO\n"); +if (times == NULL) { struct utimbuf now_time; time_t now; now = time(NULL); now_time.actime = now; now_time.modtime = now; - return lv2errno_r(sysLv2FsUtime(path,(sysFSUtimbuf *)&now_time)); + return lv2errno(sysLv2FsUtime(path,(sysFSUtimbuf *)&now_time)); } - else return lv2errno_r(sysLv2FsUtime(path,(sysFSUtimbuf *)times)); + else return lv2errno(sysLv2FsUtime(path,(sysFSUtimbuf *)times)); +} + +int +_DEFUN(__librt_utime_r,(r,path,times), + struct _reent *r _AND + const char *path _AND + const struct utimbuf *times) +{ + return _utime(path,times,&r->_errno); } \ No newline at end of file From 6741f1b385cea9bef1ae95fb9d2260ad6e077168 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 20 Jun 2020 00:15:38 +0200 Subject: [PATCH 09/16] Added utime and sysFsUtime --- ppu/librt/utime.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index 18abdc98..9eefe9a1 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -13,7 +13,6 @@ int _utime(const char *path, const struct utimbuf *times, int* _errno) { - printf("CIAO\n"); if (times == NULL) { struct utimbuf now_time; time_t now; From cd7f6e0282a98f966b4d4daaa52234c12f75afda Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-2FII39V\\crystal" Date: Sat, 20 Jun 2020 16:10:24 +0200 Subject: [PATCH 10/16] gcomp fixed for CGYWIN --- tools/cgcomp/Makefile | 1 + tools/cgcomp/source/main.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/tools/cgcomp/Makefile b/tools/cgcomp/Makefile index 7ccd1c9b..c36b7e9e 100644 --- a/tools/cgcomp/Makefile +++ b/tools/cgcomp/Makefile @@ -41,6 +41,7 @@ endif ifneq (,$(findstring CYGWIN,$(UNAME))) LDFLAGS += -s EXEEXT := .exe + CXXFLAGS += -DWIN32 OS := win32 endif diff --git a/tools/cgcomp/source/main.cpp b/tools/cgcomp/source/main.cpp index 2f4c8aaf..5d9b422e 100644 --- a/tools/cgcomp/source/main.cpp +++ b/tools/cgcomp/source/main.cpp @@ -4,10 +4,19 @@ #include "compiler.h" #include "compilerfp.h" +#ifdef __CYGWIN__ + #include + #include + char currdir[1024]; + char destfile[1026]; +#endif + #if !defined(WIN32) #include #endif + + #define PROG_TYPE_NONE 0 #define PROG_TYPE_VP 1 #define PROG_TYPE_FP 2 @@ -119,6 +128,21 @@ void readoptions(struct _options *options,int argc,char *argv[]) options->src_file = argv[i]; options->dst_file = argv[i+1]; +#ifdef __CYGWIN__ + if (options->src_file[0] == '/') { //workaround to solve full path file source problem with cgywin + getcwd(currdir, sizeof(currdir)); + char *fname, *path; + if (options->dst_file[0] != '/') { + sprintf(destfile, "%s/%s",currdir, options->dst_file); + options->dst_file = destfile; + printf("destfile %s\n", options->dst_file); + } + fname = basename((char *)options->src_file); + path = (char *)dirname((char *)options->src_file); + chdir(path); + options->src_file = fname; + } +#endif } char* readfile(const char *filename) From 42dd076e01315abbb0ce9bb0ebbb74fadd6c4592 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-2FII39V\\crystal" Date: Sat, 20 Jun 2020 16:13:01 +0200 Subject: [PATCH 11/16] cgcomp fixed for CGYWIN --- tools/cgcomp/source/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/cgcomp/source/main.cpp b/tools/cgcomp/source/main.cpp index 5d9b422e..5a1159c0 100644 --- a/tools/cgcomp/source/main.cpp +++ b/tools/cgcomp/source/main.cpp @@ -128,6 +128,7 @@ void readoptions(struct _options *options,int argc,char *argv[]) options->src_file = argv[i]; options->dst_file = argv[i+1]; + #ifdef __CYGWIN__ if (options->src_file[0] == '/') { //workaround to solve full path file source problem with cgywin getcwd(currdir, sizeof(currdir)); From 76970e6228939bcd4e3928fc26606c44d6cad565 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-2FII39V\\crystal" Date: Sat, 20 Jun 2020 16:14:13 +0200 Subject: [PATCH 12/16] cgcomp fixed for CYGWIN --- tools/cgcomp/source/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/cgcomp/source/main.cpp b/tools/cgcomp/source/main.cpp index 5a1159c0..5d9b422e 100644 --- a/tools/cgcomp/source/main.cpp +++ b/tools/cgcomp/source/main.cpp @@ -128,7 +128,6 @@ void readoptions(struct _options *options,int argc,char *argv[]) options->src_file = argv[i]; options->dst_file = argv[i+1]; - #ifdef __CYGWIN__ if (options->src_file[0] == '/') { //workaround to solve full path file source problem with cgywin getcwd(currdir, sizeof(currdir)); From 01a12cd3e7fbbd8b22dc202673f5518d281faf9d Mon Sep 17 00:00:00 2001 From: crystalct Date: Sun, 21 Jun 2020 08:41:53 +0200 Subject: [PATCH 13/16] Update Makefile --- tools/cgcomp/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/cgcomp/Makefile b/tools/cgcomp/Makefile index c36b7e9e..7ccd1c9b 100644 --- a/tools/cgcomp/Makefile +++ b/tools/cgcomp/Makefile @@ -41,7 +41,6 @@ endif ifneq (,$(findstring CYGWIN,$(UNAME))) LDFLAGS += -s EXEEXT := .exe - CXXFLAGS += -DWIN32 OS := win32 endif From a4c04029ac592928aa5f16219c0091abe9f47614 Mon Sep 17 00:00:00 2001 From: crystalct Date: Sun, 21 Jun 2020 08:45:30 +0200 Subject: [PATCH 14/16] Update main.cpp --- tools/cgcomp/source/main.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/tools/cgcomp/source/main.cpp b/tools/cgcomp/source/main.cpp index 5d9b422e..2f4c8aaf 100644 --- a/tools/cgcomp/source/main.cpp +++ b/tools/cgcomp/source/main.cpp @@ -4,19 +4,10 @@ #include "compiler.h" #include "compilerfp.h" -#ifdef __CYGWIN__ - #include - #include - char currdir[1024]; - char destfile[1026]; -#endif - #if !defined(WIN32) #include #endif - - #define PROG_TYPE_NONE 0 #define PROG_TYPE_VP 1 #define PROG_TYPE_FP 2 @@ -128,21 +119,6 @@ void readoptions(struct _options *options,int argc,char *argv[]) options->src_file = argv[i]; options->dst_file = argv[i+1]; -#ifdef __CYGWIN__ - if (options->src_file[0] == '/') { //workaround to solve full path file source problem with cgywin - getcwd(currdir, sizeof(currdir)); - char *fname, *path; - if (options->dst_file[0] != '/') { - sprintf(destfile, "%s/%s",currdir, options->dst_file); - options->dst_file = destfile; - printf("destfile %s\n", options->dst_file); - } - fname = basename((char *)options->src_file); - path = (char *)dirname((char *)options->src_file); - chdir(path); - options->src_file = fname; - } -#endif } char* readfile(const char *filename) From 0071293b343d17f43c2419bd39d161ef3c88bb99 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-2FII39V\\crystal" Date: Sun, 21 Jun 2020 08:57:33 +0200 Subject: [PATCH 15/16] Update utime --- ppu/crt/crt1.c | 3 +-- ppu/librt/utime.c | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/ppu/crt/crt1.c b/ppu/crt/crt1.c index df2aa9c2..278f680a 100644 --- a/ppu/crt/crt1.c +++ b/ppu/crt/crt1.c @@ -4,7 +4,6 @@ #include #include #include -#include extern void _init(); @@ -89,7 +88,7 @@ static void __syscalls_init(void) __syscalls.rmdir_r = __librt_rmdir_r; __syscalls.link_r = __librt_link_r; __syscalls.unlink_r = __librt_unlink_r; - //__syscalls.access_r = __librt_access_r; + __syscalls.access_r = __librt_access_r; __syscalls.utime_r = __librt_utime_r; __syscalls.sleep_r = __librt_sleep_r; diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index 9eefe9a1..5d4c00fb 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -8,21 +8,6 @@ #include #include -#include - - -int _utime(const char *path, const struct utimbuf *times, int* _errno) -{ -if (times == NULL) { - struct utimbuf now_time; - time_t now; - now = time(NULL); - now_time.actime = now; - now_time.modtime = now; - return lv2errno(sysLv2FsUtime(path,(sysFSUtimbuf *)&now_time)); - } - else return lv2errno(sysLv2FsUtime(path,(sysFSUtimbuf *)times)); -} int _DEFUN(__librt_utime_r,(r,path,times), @@ -30,5 +15,18 @@ _DEFUN(__librt_utime_r,(r,path,times), const char *path _AND const struct utimbuf *times) { - return _utime(path,times,&r->_errno); + sysFSUtimbuf t; + if (times) + { + t.actime = times->actime; + t.modtime = times->modtime; + } + else + { + time_t now = time(NULL); + t.actime = now; + t.modtime = now; + } + + return lv2errno_r(r,sysLv2FsUtime(path,&t)); } \ No newline at end of file From 247f74db8ad9be6d8490d589b7d15ed7e8972a58 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-2FII39V\\crystal" Date: Sun, 21 Jun 2020 08:59:48 +0200 Subject: [PATCH 16/16] Update utime --- ppu/librt/utime.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ppu/librt/utime.c b/ppu/librt/utime.c index 5d4c00fb..23bad626 100644 --- a/ppu/librt/utime.c +++ b/ppu/librt/utime.c @@ -8,6 +8,7 @@ #include #include +#include int _DEFUN(__librt_utime_r,(r,path,times),