os_platform.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _OS_INTERFACE_H
  2. #define _OS_INTERFACE_H
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "PikaObj.h"
  6. #include "PikaStdData_List.h"
  7. #include "TinyObj.h"
  8. #ifdef _WIN32
  9. #include <io.h>
  10. #include <direct.h>
  11. #include <windows.h>
  12. #elif defined(__linux) || PIKA_LINUX_COMPATIBLE
  13. #include <dirent.h>
  14. #include <sys/stat.h>
  15. #include <sys/types.h>
  16. #include "unistd.h"
  17. #endif
  18. enum {
  19. FILE_RDONLY = 0x00,
  20. FILE_WRONLY = 0x01,
  21. FILE_RDWR = 0x02,
  22. FILE_CREAT = 0x0100,
  23. FILE_APPEND = 0x02000,
  24. };
  25. PikaObj* os_open_platform(char* filename, int flags);
  26. char* os_read_platform(PikaObj* self, PikaObj* fd, int len);
  27. int os_write_platform(uint8_t* buf, size_t len, PikaObj* fd);
  28. int os_lseek_platform(PikaObj* fd, int how, int pos);
  29. int os_close_platform(PikaObj* fd);
  30. char* os_getcwd_platform(PikaObj* self);
  31. PikaObj* os_listdir_platform(char* path);
  32. int os_mkdir_platform(int mode, char* path);
  33. int os_chdir_platform(char* path);
  34. int os_rmdir_platform(char* path);
  35. int os_remove_platform(char* filename);
  36. int os_getFileSize(PikaObj* fd);
  37. int os_rename_platform(char* old, char* new);
  38. #endif