1
0

skeleton.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. /*
  2. * Skeleton platform-dependent support routines for PhysicsFS.
  3. *
  4. * Please see the file LICENSE.txt in the source's root directory.
  5. *
  6. * This file written by Ryan C. Gordon.
  7. */
  8. #error DO NOT COMPILE THIS. IT IS JUST A SKELETON EXAMPLE FILE.
  9. #define __PHYSICSFS_INTERNAL__
  10. #include "physfs_platforms.h"
  11. #ifdef PHYSFS_PLATFORM_SKELETON
  12. #include "physfs_internal.h"
  13. const char *__PHYSFS_platformDirSeparator = ":";
  14. int __PHYSFS_platformInit(void)
  15. {
  16. return(1); /* always succeed. */
  17. } /* __PHYSFS_platformInit */
  18. int __PHYSFS_platformDeinit(void)
  19. {
  20. return(1); /* always succeed. */
  21. } /* __PHYSFS_platformDeinit */
  22. void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
  23. {
  24. } /* __PHYSFS_platformDetectAvailableCDs */
  25. char *__PHYSFS_platformCalcBaseDir(const char *argv0)
  26. {
  27. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  28. } /* __PHYSFS_platformCalcBaseDir */
  29. char *__PHYSFS_platformGetUserName(void)
  30. {
  31. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  32. } /* __PHYSFS_platformGetUserName */
  33. char *__PHYSFS_platformGetUserDir(void)
  34. {
  35. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  36. } /* __PHYSFS_platformGetUserDir */
  37. PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
  38. {
  39. return(1); /* single threaded. */
  40. } /* __PHYSFS_platformGetThreadID */
  41. int __PHYSFS_platformStricmp(const char *x, const char *y)
  42. {
  43. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  44. } /* __PHYSFS_platformStricmp */
  45. int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 l)
  46. {
  47. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  48. } /* __PHYSFS_platformStrnicmp */
  49. int __PHYSFS_platformExists(const char *fname)
  50. {
  51. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  52. } /* __PHYSFS_platformExists */
  53. int __PHYSFS_platformIsSymLink(const char *fname)
  54. {
  55. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  56. } /* __PHYSFS_platformIsSymlink */
  57. int __PHYSFS_platformIsDirectory(const char *fname)
  58. {
  59. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  60. } /* __PHYSFS_platformIsDirectory */
  61. char *__PHYSFS_platformCvtToDependent(const char *prepend,
  62. const char *dirName,
  63. const char *append)
  64. {
  65. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  66. } /* __PHYSFS_platformCvtToDependent */
  67. void __PHYSFS_platformTimeslice(void)
  68. {
  69. } /* __PHYSFS_platformTimeslice */
  70. void __PHYSFS_platformEnumerateFiles(const char *dirname,
  71. int omitSymLinks,
  72. PHYSFS_EnumFilesCallback callback,
  73. const char *origdir,
  74. void *callbackdata)
  75. {
  76. } /* __PHYSFS_platformEnumerateFiles */
  77. char *__PHYSFS_platformCurrentDir(void)
  78. {
  79. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  80. } /* __PHYSFS_platformCurrentDir */
  81. char *__PHYSFS_platformRealPath(const char *path)
  82. {
  83. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  84. } /* __PHYSFS_platformRealPath */
  85. int __PHYSFS_platformMkDir(const char *path)
  86. {
  87. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  88. } /* __PHYSFS_platformMkDir */
  89. void *__PHYSFS_platformOpenRead(const char *filename)
  90. {
  91. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  92. } /* __PHYSFS_platformOpenRead */
  93. void *__PHYSFS_platformOpenWrite(const char *filename)
  94. {
  95. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  96. } /* __PHYSFS_platformOpenWrite */
  97. void *__PHYSFS_platformOpenAppend(const char *filename)
  98. {
  99. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  100. } /* __PHYSFS_platformOpenAppend */
  101. PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
  102. PHYSFS_uint32 size, PHYSFS_uint32 count)
  103. {
  104. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  105. } /* __PHYSFS_platformRead */
  106. PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
  107. PHYSFS_uint32 size, PHYSFS_uint32 count)
  108. {
  109. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  110. } /* __PHYSFS_platformWrite */
  111. int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
  112. {
  113. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  114. } /* __PHYSFS_platformSeek */
  115. PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
  116. {
  117. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  118. } /* __PHYSFS_platformTell */
  119. PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
  120. {
  121. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  122. } /* __PHYSFS_platformFileLength */
  123. int __PHYSFS_platformEOF(void *opaque)
  124. {
  125. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  126. } /* __PHYSFS_platformEOF */
  127. int __PHYSFS_platformFlush(void *opaque)
  128. {
  129. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  130. } /* __PHYSFS_platformFlush */
  131. int __PHYSFS_platformClose(void *opaque)
  132. {
  133. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  134. } /* __PHYSFS_platformClose */
  135. int __PHYSFS_platformDelete(const char *path)
  136. {
  137. BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0);
  138. } /* __PHYSFS_platformDelete */
  139. void *__PHYSFS_platformCreateMutex(void)
  140. {
  141. BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
  142. } /* __PHYSFS_platformCreateMutex */
  143. void __PHYSFS_platformDestroyMutex(void *mutex)
  144. {
  145. } /* __PHYSFS_platformDestroyMutex */
  146. int __PHYSFS_platformGrabMutex(void *mutex)
  147. {
  148. /* not implemented, but can't call __PHYSFS_setError! */
  149. return(0);
  150. } /* __PHYSFS_platformGrabMutex */
  151. void __PHYSFS_platformReleaseMutex(void *mutex)
  152. {
  153. /* not implemented, but can't call __PHYSFS_setError! */
  154. } /* __PHYSFS_platformReleaseMutex */
  155. PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
  156. {
  157. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
  158. } /* __PHYSFS_platformGetLastModTime */
  159. int __PHYSFS_platformAllocatorInit(void)
  160. {
  161. return(1); /* always succeeds. */
  162. } /* __PHYSFS_platformAllocatorInit */
  163. void __PHYSFS_platformAllocatorDeinit(void)
  164. {
  165. /* no-op */
  166. } /* __PHYSFS_platformAllocatorInit */
  167. void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
  168. {
  169. BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
  170. #undef malloc
  171. return(malloc((size_t) s));
  172. } /* __PHYSFS_platformMalloc */
  173. void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
  174. {
  175. BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
  176. #undef realloc
  177. return(realloc(ptr, (size_t) s));
  178. } /* __PHYSFS_platformRealloc */
  179. void __PHYSFS_platformAllocatorFree(void *ptr)
  180. {
  181. #undef free
  182. free(ptr);
  183. } /* __PHYSFS_platformAllocatorFree */
  184. #endif /* PHYSFS_PLATFORM_SKELETON */
  185. /* end of skeleton.c ... */