KCC - Kayte C Compiler 1.10.0
A C compiler implementation with preprocessor, lexer, parser, and code generator
Loading...
Searching...
No Matches
android.h
1#ifndef ANDROID_H
2#define ANDROID_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8// -------------------------------
9// Basic typedefs
10// -------------------------------
11typedef signed char int8_t;
12typedef unsigned char uint8_t;
13typedef short int16_t;
14typedef unsigned short uint16_t;
15typedef int int32_t;
16typedef unsigned int uint32_t;
17typedef long long int64_t;
18typedef unsigned long long uint64_t;
19
20typedef int32_t pid_t;
21typedef uint32_t uid_t;
22typedef uint32_t gid_t;
23
24// -------------------------------
25// Android Logging (android/log.h)
26// -------------------------------
27enum {
28 ANDROID_LOG_UNKNOWN = 0,
29 ANDROID_LOG_DEFAULT,
30 ANDROID_LOG_VERBOSE,
31 ANDROID_LOG_DEBUG,
32 ANDROID_LOG_INFO,
33 ANDROID_LOG_WARN,
34 ANDROID_LOG_ERROR,
35 ANDROID_LOG_FATAL,
36 ANDROID_LOG_SILENT,
37};
38
39// Stub logging API (replace with real libandroid at link time)
40int __android_log_print(int prio, const char* tag, const char* fmt, ...);
41
42static inline int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
43 (void)prio; (void)tag; (void)fmt;
44 return 0; // no-op if not linked with libandroid
45}
46
47// -------------------------------
48// Android Native Window (android/native_window.h)
49// -------------------------------
50struct ANativeWindow;
52 void* bits;
53 int width;
54 int height;
55 int stride;
56 int format;
57 int reserved[4];
58};
59
60// Pixel format enums
61enum {
62 WINDOW_FORMAT_RGBA_8888 = 1,
63 WINDOW_FORMAT_RGBX_8888 = 2,
64 WINDOW_FORMAT_RGB_565 = 4,
65};
66
67// Window transform enums
68enum {
69 WINDOW_TRANSFORM_IDENTITY = 0x00,
70 WINDOW_TRANSFORM_MIRROR_HORIZONTAL = 0x01,
71 WINDOW_TRANSFORM_MIRROR_VERTICAL = 0x02,
72 WINDOW_TRANSFORM_ROTATE_90 = 0x04,
73 WINDOW_TRANSFORM_ROTATE_180 = 0x03,
74 WINDOW_TRANSFORM_ROTATE_270 = 0x07,
75};
76
77// -------------------------------
78// Native Activity (android/native_activity.h)
79// -------------------------------
81 void* instance;
82 struct ANativeWindow* window;
83 struct AAssetManager* assetManager;
84 const char* internalDataPath;
85 const char* externalDataPath;
86 int sdkVersion;
87};
88
89// Input queue placeholder
90struct AInputQueue;
91
92// -------------------------------
93// Asset Manager (android/asset_manager.h)
94// -------------------------------
95struct AAssetManager;
96struct AAsset;
97
98enum {
99 AASSET_MODE_UNKNOWN = 0,
100 AASSET_MODE_RANDOM = 1,
101 AASSET_MODE_STREAMING = 2,
102 AASSET_MODE_BUFFER = 3
103};
104
105// -------------------------------
106// ALooper (android/looper.h)
107// -------------------------------
108struct ALooper;
109
110// -------------------------------
111// EGL / OpenGL ES basics
112// (Minimal subset to build against)
113// -------------------------------
114typedef int EGLint;
115typedef unsigned int EGLBoolean;
116typedef void* EGLDisplay;
117typedef void* EGLSurface;
118typedef void* EGLContext;
119typedef void* EGLConfig;
120
121#define EGL_FALSE 0
122#define EGL_TRUE 1
123
124#define EGL_DEFAULT_DISPLAY ((EGLDisplay)0)
125#define EGL_NO_DISPLAY ((EGLDisplay)0)
126#define EGL_NO_CONTEXT ((EGLContext)0)
127#define EGL_NO_SURFACE ((EGLSurface)0)
128
129#define EGL_RED_SIZE 0x3024
130#define EGL_GREEN_SIZE 0x3023
131#define EGL_BLUE_SIZE 0x3022
132#define EGL_ALPHA_SIZE 0x3021
133#define EGL_DEPTH_SIZE 0x3025
134#define EGL_STENCIL_SIZE 0x3026
135#define EGL_NONE 0x3038
136#define EGL_RENDERABLE_TYPE 0x3040
137#define EGL_OPENGL_ES2_BIT 0x0004
138
139// -------------------------------
140// OpenGL ES 2.0 basics
141// -------------------------------
142typedef unsigned int GLenum;
143typedef unsigned char GLboolean;
144typedef unsigned int GLbitfield;
145typedef void GLvoid;
146typedef signed char GLbyte;
147typedef short GLshort;
148typedef int GLint;
149typedef unsigned char GLubyte;
150typedef unsigned short GLushort;
151typedef unsigned int GLuint;
152typedef int GLsizei;
153typedef float GLfloat;
154typedef float GLclampf;
155typedef double GLdouble;
156typedef double GLclampd;
157
158// Common GL enums
159#define GL_COLOR_BUFFER_BIT 0x00004000
160#define GL_DEPTH_BUFFER_BIT 0x00000100
161#define GL_STENCIL_BUFFER_BIT 0x00000400
162
163#define GL_TRIANGLES 0x0004
164#define GL_TRIANGLE_STRIP 0x0005
165#define GL_TRIANGLE_FAN 0x0006
166
167#define GL_FLOAT 0x1406
168#define GL_UNSIGNED_SHORT 0x1403
169#define GL_UNSIGNED_INT 0x1405
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif // ANDROID_H