skeleton.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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_StringCallback callback,
  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(size_t s)
  168. {
  169. #undef malloc
  170. return(malloc(s));
  171. } /* __PHYSFS_platformMalloc */
  172. void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
  173. {
  174. #undef realloc
  175. return(realloc(ptr, 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 ... */