comparison dw.h @ 2474:a13e6db064f4

Android: Implement thread, semaphore, shared memory API functions. Implement dwmain() entrypoint and include dwtest.c in the build. Like on iOS dw_main() doesn't actually run the message loop... So wait for dw_main() to be called and return to the JVM.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Apr 2021 23:06:25 +0000
parents aa420e366b2b
children 16d195d46f2a
comparison
equal deleted inserted replaced
2473:aa420e366b2b 2474:a13e6db064f4
727 #if defined(__ANDROID__) 727 #if defined(__ANDROID__)
728 #include <stdio.h> 728 #include <stdio.h>
729 #include <stdlib.h> 729 #include <stdlib.h>
730 #include <stdarg.h> 730 #include <stdarg.h>
731 #include <limits.h> 731 #include <limits.h>
732 #include <pthread.h>
732 733
733 /* Can remove this for your port when you know where MAX_PATH is */ 734 /* Can remove this for your port when you know where MAX_PATH is */
734 #ifndef MAX_PATH 735 #ifndef MAX_PATH
735 #define MAX_PATH 260 736 #define MAX_PATH 260
736 #endif 737 #endif
748 typedef short WORD ; 749 typedef short WORD ;
749 typedef unsigned char UCHAR; 750 typedef unsigned char UCHAR;
750 typedef char CHAR; 751 typedef char CHAR;
751 typedef unsigned UINT; 752 typedef unsigned UINT;
752 typedef int INT; 753 typedef int INT;
753 typedef void *HMTX; 754 typedef pthread_mutex_t *HMTX;
754 typedef void *HEV; 755 typedef struct _dw_unix_event {
756 pthread_mutex_t mutex;
757 pthread_cond_t event;
758 pthread_t thread;
759 int alive;
760 int posted;
761 } *HEV;
762 typedef pthread_t DWTID;
763 typedef void * HMOD;
764 struct _dw_unix_shm {
765 int fd;
766 char *path;
767 int sid;
768 int size;
769 };
755 typedef void *HSHM; 770 typedef void *HSHM;
756 typedef void *HMOD;
757 typedef void *HTREEITEM; 771 typedef void *HTREEITEM;
758 typedef HWND HMENUI; 772 typedef HWND HMENUI;
759 typedef int DWTID;
760 typedef unsigned long HICN; 773 typedef unsigned long HICN;
761 774
762 typedef struct _window_data { 775 typedef struct _window_data {
763 UserData *root; 776 UserData *root;
764 HWND clickdefault; 777 HWND clickdefault;
1859 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {\ 1872 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {\
1860 int argc; \ 1873 int argc; \
1861 char **argv = _dw_convertargs(&argc, lpCmdLine, hInstance); \ 1874 char **argv = _dw_convertargs(&argc, lpCmdLine, hInstance); \
1862 return _dwmain(argc, argv); } \ 1875 return _dwmain(argc, argv); } \
1863 int _dwmain(a, b) 1876 int _dwmain(a, b)
1877 #elif defined(__ANDROID__)
1878 int dwmain(int argc, char *argv[]);
1864 #else 1879 #else
1865 #define dwmain(a, b) main(a, b) 1880 #define dwmain(a, b) main(a, b)
1866 #endif 1881 #endif
1867 1882
1868 /* Public function prototypes */ 1883 /* Public function prototypes */