1 | // This file is a part of the Framsticks GDK. |
---|
2 | // Copyright (C) 2002-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. |
---|
3 | // Refer to http://www.framsticks.com/ for further information. |
---|
4 | |
---|
5 | #ifndef _NONSTD_STDIO_H_ |
---|
6 | #define _NONSTD_STDIO_H_ |
---|
7 | |
---|
8 | bool fileExists(const char* path); |
---|
9 | bool removeFile(const char* path); |
---|
10 | |
---|
11 | #ifdef _WIN32 |
---|
12 | |
---|
13 | |
---|
14 | #ifndef _MSC_VER |
---|
15 | #include <dir.h> |
---|
16 | #else |
---|
17 | #ifndef MOBILE2D |
---|
18 | #include <direct.h> |
---|
19 | #endif |
---|
20 | #define mkdir _mkdir |
---|
21 | #endif |
---|
22 | |
---|
23 | #ifndef MOBILE2D |
---|
24 | #include <io.h> //borland compiler: include <io.h> before <dir.h> causes the SimWorld class in "simul.h" be unrecognized, for unknown reason :O moreover, this problem is only pertinent to the CLI project, not GUI. Maybe this is caused by global defines like NOVCL, NO_STRICT etc.? |
---|
25 | #define makeDirectory(name) mkdir(name) |
---|
26 | #endif |
---|
27 | |
---|
28 | |
---|
29 | #else |
---|
30 | |
---|
31 | #include <unistd.h> |
---|
32 | #include <sys/stat.h> |
---|
33 | #define makeDirectory(name) mkdir(name,0777) |
---|
34 | #define _unlink unlink //_unlink jest ISO-conformant, unlink jest POSIX-deprecated |
---|
35 | |
---|
36 | #endif |
---|
37 | |
---|
38 | |
---|
39 | #include <stdio.h> |
---|
40 | |
---|
41 | #if (defined SHP && defined BADA_API_1) || defined __ANDROID__ |
---|
42 | |
---|
43 | #ifdef __ANDROID__ |
---|
44 | #include <nv_file/nv_file.h> |
---|
45 | struct rwFILE //jedno z dwoch pol jest zainicjowane w zaleznosci od tego gdzie jest plik |
---|
46 | { |
---|
47 | NvFile *rfile; //umie tylko czytac |
---|
48 | FILE *rwfile; |
---|
49 | rwFILE() {rfile=rwfile=NULL;} |
---|
50 | }; |
---|
51 | typedef rwFILE MFILE; |
---|
52 | #else //SHP: |
---|
53 | //z <stdio.h> wzielismy sprintfy i inne ktore dzia³aj¹... |
---|
54 | #include <FIo.h> |
---|
55 | // wklejone z sailora w ramach integracji frams+engine |
---|
56 | // ale to nie sprawia ze framsy korzystaja z mfile - potrzebna jest implementacja virtfile dla bady! (patrz: stdiofile.h) |
---|
57 | // i wtedy bedzie mozna mfile wywalic tez z sailora |
---|
58 | typedef Osp::Io::File MFILE; |
---|
59 | #endif |
---|
60 | |
---|
61 | MFILE *mfopen(const char*path,const char*mode); |
---|
62 | void mfclose(MFILE *f); |
---|
63 | int mfread(void *ptr, int size, int n, MFILE *f); |
---|
64 | int mfwrite(const void *ptr, int size, int n, MFILE *f); |
---|
65 | int mfputs(const char *, MFILE *); |
---|
66 | int mfseek(MFILE *, long, int); |
---|
67 | long mftell(MFILE *); |
---|
68 | char *mfgets(char *str, int num, MFILE *f); |
---|
69 | int mfeof(MFILE *f); |
---|
70 | |
---|
71 | //#define SEEK_SET 0 /* set file offset to offset */ |
---|
72 | //#define SEEK_CUR 1 /* set file offset to current plus offset */ |
---|
73 | //#define SEEK_END 2 /* set file offset to EOF plus offset */ |
---|
74 | //int sprintf(char *, const char *, ...); |
---|
75 | //int vsnprintf(char *,int, const char *, ...); |
---|
76 | |
---|
77 | #else |
---|
78 | typedef FILE MFILE; |
---|
79 | #define mfopen fopen |
---|
80 | #define mfclose fclose |
---|
81 | #define mfread fread |
---|
82 | #define mfwrite fwrite |
---|
83 | #define mfputs fputs |
---|
84 | #define mfgets fgets |
---|
85 | #define mfeof feof |
---|
86 | #define mfseek fseek |
---|
87 | #define mftell ftell |
---|
88 | #endif |
---|
89 | |
---|
90 | |
---|
91 | #ifndef _WIN32 |
---|
92 | #define _strdup strdup //_strdup jest ISO-conformant, strdup jest POSIX deprecated |
---|
93 | #include <string.h> //strdup |
---|
94 | #endif |
---|
95 | |
---|
96 | #endif |
---|