skeleton.c 6.0 KB

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