1 /* |
1 /* |
2 * stdio/physfs abstraction layer 2002-12-03 |
2 * stdio/physfs abstraction layer 2003-04-02 |
3 * |
3 * |
4 * Adam D. Moss <adam@gimp.org> <aspirin@icculus.org> |
4 * Adam D. Moss <adam@gimp.org> <aspirin@icculus.org> |
5 * |
5 * |
6 * These wrapper macros and functions are designed to allow a program |
6 * These wrapper macros and functions are designed to allow a program |
7 * to perform file I/O with identical semantics and syntax regardless |
7 * to perform file I/O with identical semantics and syntax regardless |
13 PLEASE NOTE: This license applies to abs-file.h ONLY (to make it clear that |
13 PLEASE NOTE: This license applies to abs-file.h ONLY (to make it clear that |
14 you may embed this wrapper code within commercial software); PhysicsFS itself |
14 you may embed this wrapper code within commercial software); PhysicsFS itself |
15 is (at the time of writing) released under a different license with |
15 is (at the time of writing) released under a different license with |
16 additional restrictions. |
16 additional restrictions. |
17 |
17 |
18 Copyright (C) 2002 Adam D. Moss (the "Author"). All Rights Reserved. |
18 Copyright (C) 2002-2003 Adam D. Moss (the "Author"). All Rights Reserved. |
19 |
19 |
20 Permission is hereby granted, free of charge, to any person obtaining a copy |
20 Permission is hereby granted, free of charge, to any person obtaining a copy |
21 of this software and associated documentation files (the "Software"), to deal |
21 of this software and associated documentation files (the "Software"), to deal |
22 in the Software without restriction, including without limitation the rights |
22 in the Software without restriction, including without limitation the rights |
23 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
23 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
138 } |
140 } |
139 return str; |
141 return str; |
140 } |
142 } |
141 #define MY_CLOSE(fp) PHYSFS_close(fp) |
143 #define MY_CLOSE(fp) PHYSFS_close(fp) |
142 #define MY_ATEOF(fp) PHYSFS_eof(fp) |
144 #define MY_ATEOF(fp) PHYSFS_eof(fp) |
143 #define MY_REWIND(fp) PHYSFS_seek(fp,0) |
145 #define MY_TELL(fp) PHYSFS_tell(fp) |
|
146 #define MY_SEEK(fp,o) PHYSFS_seek(fp,o) |
|
147 #define MY_REWIND(fp) MY_SEEK(fp,0) |
144 |
148 |
145 #else |
149 #else |
146 |
150 |
147 #define MY_FILETYPE FILE |
151 #define MY_FILETYPE FILE |
148 #define MY_READ(p,s,n,fp) fread(p,s,n,fp) |
152 #define MY_READ(p,s,n,fp) fread(p,s,n,fp) |
149 #define MY_OPEN_FOR_READ(n) fopen(n, "rb") |
153 #define MY_OPEN_FOR_READ(n) fopen(n, "rb") |
150 #define MY_GETC(fp) fgetc(fp) |
154 #define MY_GETC(fp) fgetc(fp) |
151 #define MY_GETS(str,size,fp) fgets(str,size,fp) |
155 #define MY_GETS(str,size,fp) fgets(str,size,fp) |
152 #define MY_CLOSE(fp) fclose(fp) |
156 #define MY_CLOSE(fp) fclose(fp) |
153 #define MY_ATEOF(fp) feof(fp) |
157 #define MY_ATEOF(fp) feof(fp) |
|
158 #define MY_TELL(fp) ftell(fp) |
|
159 #define MY_SEEK(fp,o) fseek(fp,o, SEEK_SET) |
154 #define MY_REWIND(fp) rewind(fp) |
160 #define MY_REWIND(fp) rewind(fp) |
155 static void MY_SETBUFFER(const MY_FILETYPE *const file, const int num) { } |
161 /*static void MY_SETBUFFER(const MY_FILETYPE *const file, const int num) { }*/ |
|
162 #define MY_SETBUFFER(fp,size) |
156 #endif |
163 #endif |
157 |
164 |
158 #endif |
165 #endif |