skeleton.c 6.1 KB

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