source: trunk/include/stdlib_unified.h @ 1505

Revision 1505, 1.2 KB checked in by reyalp, 17 months ago (diff)

merge tsvstar module code from reyalp-flt branch, + fixups for r1499, see http://chdk.setepontos.com/index.php?topic=847.msg77690#msg77690 and following posts
NOTE modules in CHDK/MODULES are now required for CHDK to work properly. On multi-partition cards, this goes on the large card.
Adds tetris and snake, originally contributed by elektro255 in http://chdk.setepontos.com/index.php?topic=2925.0

Line 
1#ifndef STDLIB_UNIFIED_H
2#define STDLIB_UNIFIEDH
3
4// This is header of unified wrapper platform-dependend io functions
5
6// Stopwords.
7
8
9// Common values
10#define STD_O_TRUNC         0x400
11#define STD_O_CREAT         0x200
12
13
14// Readonly structure.
15// So get simpliest structure
16struct  STD_stat
17    {
18    unsigned long       st_unknown_1;
19    unsigned long       st_attrib;
20    unsigned long       st_size;
21    unsigned long       st_ctime;
22    unsigned long       st_mtime;
23    unsigned long       st_unknown_2;
24};
25
26
27// Universal struct of directory entry
28struct STD_dirent {
29    char            d_name[100];
30    unsigned long       unk1;
31    unsigned char       attrib;
32    unsigned long       size;
33    unsigned long       time1;
34    unsigned long       time2;
35    unsigned long       time3;
36};
37
38
39// This is directory handler.
40typedef struct {
41        void* dh;
42    struct STD_dirent de;
43} STD_DIR;
44
45
46
47
48// Unified wrapper for platform-dependent IO functions
49
50extern int                                                      safe_open (const char *name, int flags, int mode );
51extern int                                      safe_stat (const char *name, struct STD_stat *pStat);
52
53extern STD_DIR*                 safe_opendir (const char* name);
54extern struct STD_dirent*       safe_readdir (STD_DIR*);
55extern int                      safe_closedir (STD_DIR*);
56extern void                     safe_rewinddir (STD_DIR*);
57
58
59#endif
Note: See TracBrowser for help on using the repository browser.