1 | // This file is a part of the Framsticks GDK. |
---|
2 | // Copyright (C) 1999-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 | bool isAbsolutePath(const char* fname); |
---|
11 | |
---|
12 | #ifdef _WIN32 |
---|
13 | |
---|
14 | |
---|
15 | #ifndef _MSC_VER |
---|
16 | #include <dir.h> |
---|
17 | #else |
---|
18 | #ifndef MOBILE2D |
---|
19 | #include <direct.h> |
---|
20 | #endif |
---|
21 | #define mkdir _mkdir |
---|
22 | #endif |
---|
23 | |
---|
24 | #ifndef MOBILE2D |
---|
25 | #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.? |
---|
26 | #define makeDirectory(name) mkdir(name) |
---|
27 | #endif |
---|
28 | |
---|
29 | |
---|
30 | #else |
---|
31 | |
---|
32 | #include <unistd.h> |
---|
33 | #include <sys/stat.h> |
---|
34 | #define makeDirectory(name) mkdir(name,0777) |
---|
35 | #define _unlink unlink //_unlink jest ISO-conformant, unlink jest POSIX-deprecated |
---|
36 | |
---|
37 | #endif |
---|
38 | |
---|
39 | |
---|
40 | #include <stdio.h> |
---|
41 | |
---|
42 | #if (defined SHP && defined BADA_API_1) || defined __ANDROID__ |
---|
43 | |
---|
44 | #ifdef __ANDROID__ |
---|
45 | #include <nv_file/nv_file.h> |
---|
46 | struct rwFILE //jedno z dwoch pol jest zainicjowane w zaleznosci od tego gdzie jest plik |
---|
47 | { |
---|
48 | NvFile *rfile; //umie tylko czytac |
---|
49 | FILE *rwfile; |
---|
50 | rwFILE() {rfile=rwfile=NULL;} |
---|
51 | }; |
---|
52 | typedef rwFILE MFILE; |
---|
53 | #else //SHP: |
---|
54 | //z <stdio.h> wzielismy sprintfy i inne ktore dzia³aj¹... |
---|
55 | #include <FIo.h> |
---|
56 | // wklejone z sailora w ramach integracji frams+engine |
---|
57 | // ale to nie sprawia ze framsy korzystaja z mfile - potrzebna jest implementacja virtfile dla bady! (patrz: stdiofile.h) |
---|
58 | // i wtedy bedzie mozna mfile wywalic tez z sailora |
---|
59 | typedef Osp::Io::File MFILE; |
---|
60 | #endif |
---|
61 | |
---|
62 | MFILE *mfopen(const char*path,const char*mode); |
---|
63 | void mfclose(MFILE *f); |
---|
64 | int mfread(void *ptr, int size, int n, MFILE *f); |
---|
65 | int mfwrite(const void *ptr, int size, int n, MFILE *f); |
---|
66 | int mfputs(const char *, MFILE *); |
---|
67 | int mfseek(MFILE *, long, int); |
---|
68 | long mftell(MFILE *); |
---|
69 | char *mfgets(char *str, int num, MFILE *f); |
---|
70 | int mfeof(MFILE *f); |
---|
71 | |
---|
72 | //#define SEEK_SET 0 /* set file offset to offset */ |
---|
73 | //#define SEEK_CUR 1 /* set file offset to current plus offset */ |
---|
74 | //#define SEEK_END 2 /* set file offset to EOF plus offset */ |
---|
75 | //int sprintf(char *, const char *, ...); |
---|
76 | //int vsnprintf(char *,int, const char *, ...); |
---|
77 | |
---|
78 | #else |
---|
79 | typedef FILE MFILE; |
---|
80 | #define mfopen fopen |
---|
81 | #define mfclose fclose |
---|
82 | #define mfread fread |
---|
83 | #define mfwrite fwrite |
---|
84 | #define mfputs fputs |
---|
85 | #define mfgets fgets |
---|
86 | #define mfeof feof |
---|
87 | #define mfseek fseek |
---|
88 | #define mftell ftell |
---|
89 | #endif |
---|
90 | |
---|
91 | |
---|
92 | #ifndef _WIN32 |
---|
93 | #define _strdup strdup //_strdup jest ISO-conformant, strdup jest POSIX deprecated |
---|
94 | #include <string.h> //strdup |
---|
95 | #endif |
---|
96 | |
---|
97 | #endif |
---|