ej_api_base.h
3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef ej_API_BASE_H_2013_0523_DFHDSK
#define ej_API_BASE_H_2013_0523_DFHDSK
// 类型声明
typedef signed char* mystr;
typedef short* mystrw;
#define ej_true (~0)
#define ej_false (0)
typedef int ej_bool;
typedef signed char ej_s8;
typedef unsigned char ej_u8;
typedef short ej_s16;
typedef unsigned short ej_u16;
typedef int ej_s32;
typedef unsigned int ej_u32;
typedef void* ej_handler;
typedef void(*SKY_VOID_FUNC)(void);
/************************************************************************************
* 内存API
************************************************************************************/
// osl内存分配,大小必须小于2048字节
void *ej_osl_malloc(ej_u32 size);
void ej_osl_free(void *p);
// 屏幕内存分配,可以分配大块内存,不过在进入一个新屏幕之前,必须释放所有申请的内存。
void *ej_scrmem_malloc(ej_u32 size);
void ej_scrmem_free(void *p);
// 多媒体内存,可以分配大块内存
void *ej_med_malloc(ej_u32 size);
void ej_med_free(void **p);
void *ej_memcpy(void *d, const void *s, ej_s32 n);
void *ej_memmove(void *d, const void *s, ej_s32 n);
void ej_memset(void *buf,ej_s32 value,ej_u32 size);
/************************************************************************************
* 文件系统API
************************************************************************************/
#define ej_FILE int
#define MYF_READ_ONLY 0x0001
#define MYF_READ_WRITE 0x0002
#define MYF_CREATE 0x0004
#define MYF_CREATE_ALWAYS 0x0008
enum{
ej_SEEK_SET,
ej_SEEK_CUR,
ej_SEEK_END
};
ej_FILE *ej_fopen(const ej_u16 *upath, ej_u32 type);
ej_s32 ej_fseek(ej_FILE *fid, ej_u32 offset, ej_u32 pos);
ej_s32 ej_fread(void *buffer, ej_u32 size, ej_u32 count, ej_FILE *fid);
ej_s32 ej_fwrite(void *buffer, ej_u32 size, ej_u32 count, ej_FILE *fid);
ej_s32 ej_ftell(ej_FILE *fid);
ej_s32 ej_fclose(ej_FILE *fid);
ej_s32 ej_fgetfilesize(ej_FILE *fid,ej_s32 *size);
ej_s32 ej_mkdir(const ej_u16 *upath);
ej_s32 ej_removedir(const ej_u16 *upath);
ej_s32 ej_remove(const ej_u16 *upath);
ej_s32 ej_rename(const ej_u16 *uold, const ej_u16 *unew);
ej_s32 ej_find_first(ej_u16 *path, ej_u16 *filename, ej_u32 len);
ej_s32 ej_find_next(ej_s32 handle, ej_u16 *filename, ej_u32 len);
ej_s32 ej_find_close(ej_s32 handle);
// 时间
typedef struct tagMyTime
{
unsigned short nYear;
unsigned char nMonth;
unsigned char nDay;
unsigned char nHour;
unsigned char nMin;
unsigned char nSec;
unsigned char DayIndex; /* 0=Sunday */
} MyTime;
void ej_get_time(MyTime *time);
/**********************************************************************************
* 字符串操作相关
***********************************************************************************/
ej_s32 ej_strlen(const ej_s8* text);
ej_s8* ej_strcpy(ej_s8* text1 ,const ej_s8* text2);
ej_s8* ej_strncpy(ej_s8* text1 ,const ej_s8* text2,ej_s32 n);
ej_s8* ej_strcat(ej_s8* text1 ,const ej_s8* text2);
ej_s32 ej_strcmp(const ej_s8* text1 ,const ej_s8* text2);
ej_s32 ej_strncmp(const ej_s8* text1 ,const ej_s8* text2,ej_s32 n);
ej_s32 ej_atoi(const ej_s8* s);
ej_s8* ej_itoa_ext(ej_s32 value , ej_s8* s , ej_s32 radix);
ej_s8* ej_strstr(ej_s8 *p1, ej_s8 *p2);
ej_s8* ej_strchr(ej_s8 *s, ej_s8 c);
ej_u16* ej_ucs2_strcat(ej_u16 *strDestination, const ej_u16 *strSource);
ej_u16* ej_ucs2_strcpy(ej_u16 *strDestination, const ej_u16 *strSource);
ej_s32 ej_ucs2_strcmp(const ej_u16 *string1, const ej_u16 *string2);
ej_s32 ej_ucs2_strncmp(const ej_u16* str1, const ej_u16* str2, ej_u32 size);
ej_s32 ej_ucs2_strlen(const ej_u16 *arrOut);
ej_u16* ej_ucs2_strstr(ej_u16 *p1, ej_u16 *p2);
ej_u16 ej_asc_to_ucs2(ej_u16 *pOutBuffer, ej_s8 *pInBuffer);
ej_s8* ej_ucs2_to_asc(ej_s8 *asic, ej_u16 *ucs2);
// 系统盘符号
char ej_get_sys_symbol(void);
// 存储卡盘符号
char ej_get_flash_symbol(void);
// 手机盘符号
char ej_get_phone_symbol(void);
#define ej_BLT_ALL gui_BLT_double_buffer(0,0,ej_get_device_width(),ej_get_device_height())
#endif // ej_API_BASE_H_2013_0523_DFHDSK