changeset 2991:81f9399b11c8

Mac/iOS: Fix exported API function definitions reported by Xcode. Added missing APIs on functions, not necessary on Mac and iOS technically but for consistence they should be there and for future use.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 04 Apr 2023 12:05:14 +0000
parents 9220cbf90ed3
children c8bee3b6e7ce
files ios/dw.m mac/dw.m
diffstat 2 files changed, 71 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Tue Apr 04 08:13:03 2023 +0000
+++ b/ios/dw.m	Tue Apr 04 12:05:14 2023 +0000
@@ -4319,7 +4319,7 @@
  * current user directory.  Or the root directory (C:\ on
  * OS/2 and Windows).
  */
-char *dw_user_dir(void)
+char * API dw_user_dir(void)
 {
     static char _user_dir[PATH_MAX+1] = { 0 };
 
@@ -4507,7 +4507,7 @@
  *       Pointer to an allocated string of text or NULL if clipboard empty or contents could not
  *       be converted to text.
  */
-char *dw_clipboard_get_text()
+char * API dw_clipboard_get_text(void)
 {
     UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
     NSString *str = [pasteboard string];
@@ -4521,7 +4521,7 @@
  * Parameters:
  *       Text.
  */
-void dw_clipboard_set_text(const char *str, int len)
+void API dw_clipboard_set_text(const char *str, int len)
 {
     UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
 
@@ -8038,7 +8038,7 @@
  * Parameters:
  *       handle: Handle to the window (widget) to be optimized.
  */
-void dw_container_optimize(HWND handle)
+void API dw_container_optimize(HWND handle)
 {
     /* TODO: Not sure if we need to implement this on iOS */
 }
@@ -10473,7 +10473,7 @@
  *          This will create a system notification that will show in the notifaction panel
  *          on supported systems, which may be clicked to perform another task.
  */
-HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...)
+HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...)
 {
     char outbuf[1025] = {0};
     HWND retval = NULL;
@@ -10524,7 +10524,7 @@
  * Returns:
  *         DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported.
  */
-int dw_notification_send(HWND notification)
+int API dw_notification_send(HWND notification)
 {
     if(notification)
     {
@@ -10553,7 +10553,7 @@
  * Parameters:
  *       env: Pointer to a DWEnv struct.
  */
-void dw_environment_query(DWEnv *env)
+void API dw_environment_query(DWEnv *env)
 {
     memset(env, '\0', sizeof(DWEnv));
     strcpy(env->osName, "iOS");
@@ -11082,7 +11082,7 @@
  *         handle: Pointer to a module handle,
  *                 will be filled in with the handle.
  */
-int dw_module_load(const char *name, HMOD *handle)
+int API dw_module_load(const char *name, HMOD *handle)
 {
    int len;
    char *newname;
@@ -11125,7 +11125,7 @@
  *         func: A pointer to a function pointer, to obtain
  *               the address.
  */
-int dw_module_symbol(HMOD handle, const char *name, void**func)
+int API dw_module_symbol(HMOD handle, const char *name, void**func)
 {
    if(!func || !name)
       return   -1;
@@ -11141,7 +11141,7 @@
  * Parameters:
  *         handle: Module handle returned by dw_module_load()
  */
-int dw_module_close(HMOD handle)
+int API dw_module_close(HMOD handle)
 {
    if(handle)
       return dlclose(handle);
@@ -11151,7 +11151,7 @@
 /*
  * Returns the handle to an unnamed mutex semaphore.
  */
-HMTX dw_mutex_new(void)
+HMTX API dw_mutex_new(void)
 {
     HMTX mutex = malloc(sizeof(pthread_mutex_t));
 
@@ -11164,7 +11164,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_close(HMTX mutex)
+void API dw_mutex_close(HMTX mutex)
 {
    if(mutex)
    {
@@ -11178,7 +11178,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_lock(HMTX mutex)
+void API dw_mutex_lock(HMTX mutex)
 {
     /* We need to handle locks from the main thread differently...
      * since we can't stop message processing... otherwise we
@@ -11218,7 +11218,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_unlock(HMTX mutex)
+void API dw_mutex_unlock(HMTX mutex)
 {
    pthread_mutex_unlock(mutex);
 }
@@ -11226,7 +11226,7 @@
 /*
  * Returns the handle to an unnamed event semaphore.
  */
-HEV dw_event_new(void)
+HEV API dw_event_new(void)
 {
    HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event));
 
@@ -11253,7 +11253,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_reset (HEV eve)
+int API dw_event_reset(HEV eve)
 {
    if(!eve)
       return DW_ERROR_NON_INIT;
@@ -11272,7 +11272,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_post (HEV eve)
+int API dw_event_post(HEV eve)
 {
    if(!eve)
       return FALSE;
@@ -11290,7 +11290,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_wait(HEV eve, unsigned long timeout)
+int API dw_event_wait(HEV eve, unsigned long timeout)
 {
     int rc;
 
@@ -11330,7 +11330,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_close(HEV *eve)
+int API dw_event_close(HEV *eve)
 {
    if(!eve || !(*eve))
       return DW_ERROR_NON_INIT;
@@ -11509,7 +11509,7 @@
  *         name: Name given to semaphore which can be opened
  *               by other processes.
  */
-HEV dw_named_event_new(const char *name)
+HEV API dw_named_event_new(const char *name)
 {
     struct sockaddr_un un;
     int ev, *tmpsock = (int *)malloc(sizeof(int)*2);
@@ -11570,7 +11570,7 @@
  *         name: Name given to semaphore which can be opened
  *               by other processes.
  */
-HEV dw_named_event_get(const char *name)
+HEV API dw_named_event_get(const char *name)
 {
     struct sockaddr_un un;
     HEV eve;
@@ -11601,7 +11601,7 @@
  *         eve: Handle to the semaphore obtained by
  *              an open or create call.
  */
-int dw_named_event_reset(HEV eve)
+int API dw_named_event_reset(HEV eve)
 {
    /* signal reset */
    char tmp = (char)0;
@@ -11620,7 +11620,7 @@
  *         eve: Handle to the semaphore obtained by
  *              an open or create call.
  */
-int dw_named_event_post(HEV eve)
+int API dw_named_event_post(HEV eve)
 {
 
    /* signal post */
@@ -11642,7 +11642,7 @@
  *         timeout: Number of milliseconds before timing out
  *                  or -1 if indefinite.
  */
-int dw_named_event_wait(HEV eve, unsigned long timeout)
+int API dw_named_event_wait(HEV eve, unsigned long timeout)
 {
    fd_set rd;
    struct timeval tv, *useme = NULL;
@@ -11692,7 +11692,7 @@
  *         eve: Handle to the semaphore obtained by
  *              an open or create call.
  */
-int dw_named_event_close(HEV eve)
+int API dw_named_event_close(HEV eve)
 {
    /* Finally close the domain socket,
     * cleanup will continue in _dw_handle_sem.
@@ -11954,7 +11954,7 @@
  *         size: Size in bytes of the shared memory region to allocate.
  *         name: A string pointer to a unique memory name.
  */
-HSHM dw_named_memory_new(void **dest, int size, const char *name)
+HSHM API dw_named_memory_new(void **dest, int size, const char *name)
 {
    char namebuf[1025] = {0};
    struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
@@ -11995,7 +11995,7 @@
  *         size: Size in bytes of the shared memory region to requested.
  *         name: A string pointer to a unique memory name.
  */
-HSHM dw_named_memory_get(void **dest, int size, const char *name)
+HSHM API dw_named_memory_get(void **dest, int size, const char *name)
 {
    char namebuf[1025];
    struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
@@ -12033,7 +12033,7 @@
  *         handle: Handle obtained from DB_named_memory_allocate.
  *         ptr: The memory address aquired with DB_named_memory_allocate.
  */
-int dw_named_memory_free(HSHM handle, void *ptr)
+int API dw_named_memory_free(HSHM handle, void *ptr)
 {
    struct _dw_unix_shm *h = handle;
    int rc = munmap(ptr, h->size);
@@ -12058,7 +12058,7 @@
  *       data: Parameter(s) passed to the function.
  *       stack: Stack size of new thread (OS/2 and Windows only).
  */
-DWTID dw_thread_new(void *func, void *data, int stack)
+DWTID API dw_thread_new(void *func, void *data, int stack)
 {
     DWTID thread;
     void **tmp = malloc(sizeof(void *) * 2);
@@ -12076,7 +12076,7 @@
 /*
  * Ends execution of current thread immediately.
  */
-void dw_thread_end(void)
+void API dw_thread_end(void)
 {
    pthread_exit(NULL);
 }
@@ -12084,7 +12084,7 @@
 /*
  * Returns the current thread's ID.
  */
-DWTID dw_thread_id(void)
+DWTID API dw_thread_id(void)
 {
    return (DWTID)pthread_self();
 }
@@ -12121,7 +12121,7 @@
  * Parameters:
  *       url: Uniform resource locator.
  */
-int dw_browse(const char *url)
+int API dw_browse(const char *url)
 {
     NSURL *myurl = [NSURL URLWithString:[NSString stringWithUTF8String:url]];
     [DWApp openURL:myurl options:@{}
--- a/mac/dw.m	Tue Apr 04 08:13:03 2023 +0000
+++ b/mac/dw.m	Tue Apr 04 12:05:14 2023 +0000
@@ -4310,7 +4310,7 @@
  * current user directory.  Or the root directory (C:\ on
  * OS/2 and Windows).
  */
-char *dw_user_dir(void)
+char * API dw_user_dir(void)
 {
     static char _user_dir[PATH_MAX+1] = { 0 };
 
@@ -4351,7 +4351,7 @@
  *          The appname is only required on Windows.  If NULL is passed the detected
  *          application name will be used, but a prettier name may be desired.
  */
-int dw_app_id_set(const char *appid, const char *appname)
+int API dw_app_id_set(const char *appid, const char *appname)
 {
     strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE);
     return DW_ERROR_NONE;
@@ -4687,7 +4687,7 @@
  *       Pointer to an allocated string of text or NULL if clipboard empty or contents could not
  *       be converted to text.
  */
-char *dw_clipboard_get_text()
+char * API dw_clipboard_get_text(void)
 {
     NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
     NSString *str = [pasteboard stringForType:DWPasteboardTypeString];
@@ -4703,7 +4703,7 @@
  * Parameters:
  *       Text.
  */
-void dw_clipboard_set_text(const char *str, int len)
+void API dw_clipboard_set_text(const char *str, int len)
 {
     NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
     SEL scc = NSSelectorFromString(@"clearContents");
@@ -9343,7 +9343,7 @@
  *       handle: The handle to the calendar returned by dw_calendar_new().
  *       year...
  */
-void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day)
+void API dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day)
 {
     DWCalendar *calendar = handle;
     NSDate *date;
@@ -9366,7 +9366,7 @@
  * Parameters:
  *       handle: The handle to the calendar returned by dw_calendar_new().
  */
-void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
+void API dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
 {
     DWCalendar *calendar = handle;
     DW_LOCAL_POOL_IN;
@@ -9463,7 +9463,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
+int API dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
 {
     DWWebView *html = handle;
     DW_LOCAL_POOL_IN;
@@ -11408,7 +11408,7 @@
  *          This will create a system notification that will show in the notifaction panel
  *          on supported systems, which may be clicked to perform another task.
  */
-HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...)
+HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...)
 {
 #ifdef BUILDING_FOR_MOUNTAIN_LION
     char outbuf[1025] = {0};
@@ -11481,7 +11481,7 @@
  * Returns:
  *         DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported.
  */
-int dw_notification_send(HWND notification)
+int API dw_notification_send(HWND notification)
 {
 #ifdef BUILDING_FOR_MOUNTAIN_LION
     if(notification)
@@ -11523,7 +11523,7 @@
  * Parameters:
  *       env: Pointer to a DWEnv struct.
  */
-void dw_environment_query(DWEnv *env)
+void API dw_environment_query(DWEnv *env)
 {
     memset(env, '\0', sizeof(DWEnv));
     strcpy(env->osName, "MacOS");
@@ -11667,7 +11667,7 @@
  *       dataname: A string pointer identifying which signal to be hooked.
  *       data: User data to be passed to the handler function.
  */
-void dw_window_set_data(HWND window, const char *dataname, void *data)
+void API dw_window_set_data(HWND window, const char *dataname, void *data)
 {
     id object = window;
     if([object isMemberOfClass:[DWWindow class]])
@@ -11722,7 +11722,7 @@
  *       dataname: A string pointer identifying which signal to be hooked.
  *       data: User data to be passed to the handler function.
  */
-void *dw_window_get_data(HWND window, const char *dataname)
+void * API dw_window_get_data(HWND window, const char *dataname)
 {
     id object = window;
     if([object isMemberOfClass:[DWWindow class]])
@@ -12041,7 +12041,7 @@
  *         handle: Pointer to a module handle,
  *                 will be filled in with the handle.
  */
-int dw_module_load(const char *name, HMOD *handle)
+int API dw_module_load(const char *name, HMOD *handle)
 {
    int len;
    char *newname;
@@ -12084,7 +12084,7 @@
  *         func: A pointer to a function pointer, to obtain
  *               the address.
  */
-int dw_module_symbol(HMOD handle, const char *name, void**func)
+int API dw_module_symbol(HMOD handle, const char *name, void**func)
 {
    if(!func || !name)
       return   -1;
@@ -12100,7 +12100,7 @@
  * Parameters:
  *         handle: Module handle returned by dw_module_load()
  */
-int dw_module_close(HMOD handle)
+int API dw_module_close(HMOD handle)
 {
    if(handle)
       return dlclose(handle);
@@ -12110,7 +12110,7 @@
 /*
  * Returns the handle to an unnamed mutex semaphore.
  */
-HMTX dw_mutex_new(void)
+HMTX API dw_mutex_new(void)
 {
     HMTX mutex = malloc(sizeof(pthread_mutex_t));
 
@@ -12123,7 +12123,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_close(HMTX mutex)
+void API dw_mutex_close(HMTX mutex)
 {
    if(mutex)
    {
@@ -12137,7 +12137,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_lock(HMTX mutex)
+void API dw_mutex_lock(HMTX mutex)
 {
     /* We need to handle locks from the main thread differently...
      * since we can't stop message processing... otherwise we
@@ -12180,7 +12180,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_unlock(HMTX mutex)
+void API dw_mutex_unlock(HMTX mutex)
 {
    pthread_mutex_unlock(mutex);
 }
@@ -12188,7 +12188,7 @@
 /*
  * Returns the handle to an unnamed event semaphore.
  */
-HEV dw_event_new(void)
+HEV API dw_event_new(void)
 {
    HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event));
 
@@ -12215,7 +12215,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_reset (HEV eve)
+int API dw_event_reset(HEV eve)
 {
    if(!eve)
       return DW_ERROR_NON_INIT;
@@ -12234,7 +12234,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_post (HEV eve)
+int API dw_event_post(HEV eve)
 {
    if(!eve)
       return FALSE;
@@ -12252,7 +12252,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_wait(HEV eve, unsigned long timeout)
+int API dw_event_wait(HEV eve, unsigned long timeout)
 {
     int rc;
 
@@ -12292,7 +12292,7 @@
  * Parameters:
  *       eve: The handle to the event returned by dw_event_new().
  */
-int dw_event_close(HEV *eve)
+int API dw_event_close(HEV *eve)
 {
    if(!eve || !(*eve))
       return DW_ERROR_NON_INIT;
@@ -12471,7 +12471,7 @@
  *         name: Name given to semaphore which can be opened
  *               by other processes.
  */
-HEV dw_named_event_new(const char *name)
+HEV API dw_named_event_new(const char *name)
 {
     struct sockaddr_un un;
     int ev, *tmpsock = (int *)malloc(sizeof(int)*2);
@@ -12532,7 +12532,7 @@
  *         name: Name given to semaphore which can be opened
  *               by other processes.
  */
-HEV dw_named_event_get(const char *name)
+HEV API dw_named_event_get(const char *name)
 {
     struct sockaddr_un un;
     HEV eve;
@@ -12563,7 +12563,7 @@
  *         eve: Handle to the semaphore obtained by
  *              an open or create call.
  */
-int dw_named_event_reset(HEV eve)
+int API dw_named_event_reset(HEV eve)
 {
    /* signal reset */
    char tmp = (char)0;
@@ -12582,7 +12582,7 @@
  *         eve: Handle to the semaphore obtained by
  *              an open or create call.
  */
-int dw_named_event_post(HEV eve)
+int API dw_named_event_post(HEV eve)
 {
 
    /* signal post */
@@ -12604,7 +12604,7 @@
  *         timeout: Number of milliseconds before timing out
  *                  or -1 if indefinite.
  */
-int dw_named_event_wait(HEV eve, unsigned long timeout)
+int API dw_named_event_wait(HEV eve, unsigned long timeout)
 {
    fd_set rd;
    struct timeval tv, *useme = NULL;
@@ -12654,7 +12654,7 @@
  *         eve: Handle to the semaphore obtained by
  *              an open or create call.
  */
-int dw_named_event_close(HEV eve)
+int API dw_named_event_close(HEV eve)
 {
    /* Finally close the domain socket,
     * cleanup will continue in _dw_handle_sem.
@@ -12901,7 +12901,7 @@
  *         size: Size in bytes of the shared memory region to allocate.
  *         name: A string pointer to a unique memory name.
  */
-HSHM dw_named_memory_new(void **dest, int size, const char *name)
+HSHM API dw_named_memory_new(void **dest, int size, const char *name)
 {
    char namebuf[1025] = {0};
    struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
@@ -12942,7 +12942,7 @@
  *         size: Size in bytes of the shared memory region to requested.
  *         name: A string pointer to a unique memory name.
  */
-HSHM dw_named_memory_get(void **dest, int size, const char *name)
+HSHM API dw_named_memory_get(void **dest, int size, const char *name)
 {
    char namebuf[1025];
    struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
@@ -12980,7 +12980,7 @@
  *         handle: Handle obtained from DB_named_memory_allocate.
  *         ptr: The memory address aquired with DB_named_memory_allocate.
  */
-int dw_named_memory_free(HSHM handle, void *ptr)
+int API dw_named_memory_free(HSHM handle, void *ptr)
 {
    struct _dw_unix_shm *h = handle;
    int rc = munmap(ptr, h->size);
@@ -13005,7 +13005,7 @@
  *       data: Parameter(s) passed to the function.
  *       stack: Stack size of new thread (OS/2 and Windows only).
  */
-DWTID dw_thread_new(void *func, void *data, int stack)
+DWTID API dw_thread_new(void *func, void *data, int stack)
 {
     DWTID thread;
     void **tmp = malloc(sizeof(void *) * 2);
@@ -13023,7 +13023,7 @@
 /*
  * Ends execution of current thread immediately.
  */
-void dw_thread_end(void)
+void API dw_thread_end(void)
 {
    pthread_exit(NULL);
 }
@@ -13031,7 +13031,7 @@
 /*
  * Returns the current thread's ID.
  */
-DWTID dw_thread_id(void)
+DWTID API dw_thread_id(void)
 {
    return (DWTID)pthread_self();
 }
@@ -13218,7 +13218,7 @@
  * Parameters:
  *       url: Uniform resource locator.
  */
-int dw_browse(const char *url)
+int API dw_browse(const char *url)
 {
     NSURL *myurl = [NSURL URLWithString:[NSString stringWithUTF8String:url]];
     [[NSWorkspace sharedWorkspace] openURL:myurl];
@@ -13371,11 +13371,11 @@
         {
            /* Internal representation is flipped... so flip again so we can print */
            _dw_flip_image(image, rep2, size);
-   #ifdef DEBUG_PRINT
+#ifdef DEBUG_PRINT
            /* Save it to file to see what we have */
            NSData *data = [rep2 representationUsingType: NSPNGFileType properties: nil];
            [data writeToFile: @"print.png" atomically: NO];
-   #endif
+#endif
            /* Print the image view */
            [po runOperation];
            /* Fill the pixmap with white in case we are printing more pages */