commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r890181 - in /commons/sandbox/runtime/trunk/src/main/native: ./ include/arch/windows/ os/win32/
Date Mon, 14 Dec 2009 05:16:27 GMT
Author: mturk
Date: Mon Dec 14 05:16:26 2009
New Revision: 890181

URL: http://svn.apache.org/viewvc?rev=890181&view=rev
Log:
Make code consistent

Added:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_gui.h   (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dhtml.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dso.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fasync.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/gui.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/tfs.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Mon Dec 14 05:16:26 2009
@@ -98,6 +98,7 @@
 has_sysv_mutex=no
 has_posix_mutex=no
 has_unicode=no
+has_cygwin=no
 
 has_embedded_sqlite=no
 has_sqlite=no
@@ -329,7 +330,11 @@
     do
         if [ -x "$p/$1.exe" ]; then
             if [ ".`$p/$1.exe -version 2>/dev/null | head -1 | grep Microsoft`" != . ];
then
-                cygpath -w "$p/$1.exe" | sed 's/\\/\\\\/g'
+                if [ ".$has_cygwin" = .yes ]; then
+                    cygpath -w "$p/$1.exe" | sed 's;\\;\\\\;g'
+                else
+                    echo "`echo "$p/$1.exe" | sed 's;^/\([c-zC-Z]\)/;\1\:/;'`" | sed 's;/;\\\\;g'
+                fi
                 return
             fi
         fi
@@ -395,6 +400,7 @@
         platform=WINDOWS
         host=windows
         test ".$cc_set" = .no && cc=cl
+        has_cygwin=yes
     ;;
     mingw* )
         platform=WINDOWS
@@ -547,7 +553,7 @@
         varadds cxxopts -TP
         varadds ldflags kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib
         varadds ldflags shell32.lib rpcrt4.lib user32.lib gdi32.lib userenv.lib wtsapi32.lib
-        varadds ldflags psapi.lib shlwapi.lib wldap32.lib netapi32.lib iphlpapi.lib
+        varadds ldflags psapi.lib shlwapi.lib wldap32.lib netapi32.lib iphlpapi.lib urlmon.lib
         varadds shflags /NOLOGO /OPT:REF
         arflags=/NOLOGO
         so=.dll
@@ -743,7 +749,7 @@
 EOF
         rc=0
         if [ ".$host" = .windows ]; then
-            co="`$cc $ccflags $cppopts $test.c /link /out:$test$exe 2>&1`"
+            co="`$cc $ccflags $cppopts $test.c -link -out:$test$exe 2>&1`"
         else
             co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
         fi
@@ -789,7 +795,7 @@
     fi
     rc=0
     if [ ".$host" = .windows ]; then
-        co="`$cc $ccflags $cppopts $test.c /link /out:$test$exe $1 2>&1`"
+        co="`$cc $ccflags $cppopts $test.c -link -out:$test$exe $1 2>&1`"
     else
         co="`$cc $ccflags $cppopts $test.c -o $test$exe -l$1 2>&1`"
     fi
@@ -825,7 +831,7 @@
 EOF
     rc=0
     if [ ".$host" = .windows ]; then
-        co="`$cc $ccflags $cppopts $ldflags $test.c /link /out:$test$exe 2>&1`"
+        co="`$cc $ccflags $cppopts $ldflags $test.c -link -out:$test$exe 2>&1`"
     else
         co="`$cc $ccflags $cppopts $ldflags $test.c -o $test$exe 2>&1`"
     fi
@@ -880,7 +886,7 @@
 EOF
         rc=0
         if [ ".$host" = .windows ]; then
-            co="`$cc $ccflags $cppopts $test.c /link /out:$test$exe 2>&1`"
+            co="`$cc $ccflags $cppopts $test.c -link -out:$test$exe 2>&1`"
         else
             co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
         fi
@@ -914,7 +920,7 @@
 EOF
     rc=0
     if [ ".$host" = .windows ]; then
-        co="`$cc $ccflags $cppopts $test.c /link /out:$test$exe 2>&1`"
+        co="`$cc $ccflags $cppopts $test.c -link -out:$test$exe 2>&1`"
     else
         co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
     fi
@@ -945,7 +951,7 @@
 EOF
     rc=0
     if [ ".$host" = .windows ]; then
-        $cc $ccflags $cppopts $ldflags $test.c /link /out:$test$exe >/dev/null 2>&1
+        $cc $ccflags $cppopts $ldflags $test.c -link -out:$test$exe >/dev/null 2>&1
     else
         $cc $ccflags $cppopts $ldflags $test.c -o $test$exe >/dev/null 2>&1
     fi

Added: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_gui.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_gui.h?rev=890181&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_gui.h (added)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_gui.h Mon Dec 14
05:16:26 2009
@@ -0,0 +1,75 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACR_GUI_H
+#define _ACR_GUI_H
+
+#define MGUI_WINDOWS 32
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ACR_DECLARE(BOOL)   GuiInitialize(void);
+ACR_DECLARE(BOOL)   GuiTerminate(void);
+ACR_DECLARE(int)    GuiRegisterWindow(HWND hWnd);
+ACR_DECLARE(void)   GuiUnregisterWindow(int nIndex);
+
+/**
+ * Create a dialog
+ */
+ACR_DECLARE(LPVOID) DHTMLDialogInit(HINSTANCE hResInstance,
+                                    LPCSTR    szHtml);
+
+/**
+ * Run the HTML dialog
+ * @param hParent HANDLE to the parent window.
+ * @param hHtmlDlg Pointer to the dialog created by DHTMLDialogInit
+ * @param szTitle Dialog title.
+ * @param dwWidth Dialog width in pixels
+ * @param dwHeight Dialog height in pixels
+ * @param dwFlags Dialog flags
+ * @param dwTimeout Timeout in miliseconds.
+ * @param szArgumentst Arguments passed to the dialog. Use scripting
+ *        to populate dialog objects.
+ */
+ACR_DECLARE(BOOL)   DHTMLDialogRun(HWND   hParent,
+                                   LPVOID hHtmlDlg,
+                                   LPCSTR szTitle,
+                                   DWORD  dwWidth,
+                                   DWORD  dwHeight,
+                                   DWORD  dwFlags,
+                                   DWORD  dwTimeout,
+                                   LPCSTR szArguments);
+
+/**
+ * Get the dialog retun value. Dialog return value is
+ * constructed by dialog script.
+ */
+ACR_DECLARE(LPSTR)  DHTMLDialogResult(LPVOID hHtmlDlg);
+
+/**
+ * Close the dialog and free system allocated resources
+ */
+ACR_DECLARE(void)   DHTMLDialogClose(LPVOID hHtmlDlg);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ACR_GUI_H */

Propchange: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_gui.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dhtml.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dhtml.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dhtml.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dhtml.c Mon Dec 14 05:16:26 2009
@@ -21,9 +21,242 @@
 #include "acr_clazz.h"
 #include "acr_error.h"
 #include "acr_memory.h"
+#include "acr_port.h"
 #include "acr_string.h"
 #include "acr_tlsd.h"
 #include "acr_vm.h"
+#include "acr_gui.h"
 
 /* HTML Dialogs
  */
+#include <urlmon.h>
+#include <mshtmhst.h>
+
+typedef struct _MC_HTML_DIALOG {
+    IMoniker       *lpImk;
+    CHAR            szReturnVal[ACR_HBUFF_SIZ];
+} MC_HTML_DIALOG, *LPMC_HTML_DIALOG;
+
+typedef struct _DHTML_THREAD_PARAMS {
+    BOOL             bDone;
+    HWND             hParent;
+    LPMC_HTML_DIALOG hHtmlDlg;
+    WCHAR            szOptions[ACR_SBUFF_SIZ];
+    WCHAR            szArguments[ACR_PBUFF_SIZ];
+} DHTML_THREAD_PARAMS, *LPDHTML_THREAD_PARAMS;
+
+extern HICON    gui_h16Icon;
+static SHOWHTMLDIALOGEXFN  *pfnShowHTMLDialog = NULL;
+
+ACR_DECLARE(LPVOID)
+DHTMLDialogInit(
+    HINSTANCE hResInstance,
+    LPCSTR    szHtml)
+{
+    LPMC_HTML_DIALOG hDlg;
+    OLECHAR  bstr[MAX_PATH];
+
+    hDlg = (LPMC_HTML_DIALOG)x_calloc(sizeof(MC_HTML_DIALOG));
+
+    if (!hDlg)
+        return INVALID_HANDLE_VALUE;
+
+    if (!pfnShowHTMLDialog) {
+        HMODULE gui_hMSHTML;
+
+        gui_hMSHTML = LoadLibraryA("mshtml.dll");
+        if (IS_INVALID_HANDLE(gui_hMSHTML))
+            goto cleanup;
+
+        pfnShowHTMLDialog = (SHOWHTMLDIALOGEXFN*)GetProcAddress(
+                                gui_hMSHTML,
+                                "ShowHTMLDialogEx");
+    }
+    if (IS_INVALID_HANDLE(pfnShowHTMLDialog))
+        goto cleanup;
+
+    if (hResInstance) {
+        CHAR szTemp[MAX_PATH];
+        strcpy(szTemp, "res://");
+        GetModuleFileNameA(hResInstance, szTemp + strlen(szTemp),
+                           ARRAYSIZE(szTemp) - strlen(szTemp));
+        if (*szHtml != '/')
+            strcat(szTemp, "/");
+        strlcat(szTemp, szHtml, MAX_PATH);
+
+        MbsToWcs(CP_UTF8, szTemp, bstr, ARRAYSIZE(bstr));
+    }
+    else
+        MbsToWcs(CP_UTF8, szHtml, bstr, ARRAYSIZE(bstr));
+    CreateURLMoniker(NULL, bstr, &hDlg->lpImk);
+
+    if (!hDlg->lpImk)
+        goto cleanup;
+    return hDlg;
+
+cleanup:
+
+    x_free(hDlg);
+    return INVALID_HANDLE_VALUE;
+}
+
+ACR_DECLARE(void)
+DHTMLDialogClose(LPVOID hHtmlDlg)
+{
+
+    LPMC_HTML_DIALOG hDlg = (LPMC_HTML_DIALOG)hHtmlDlg;
+    if (IS_INVALID_HANDLE(hHtmlDlg))
+        return;
+    hDlg->lpImk->lpVtbl->Release(hDlg->lpImk);
+    x_free(hDlg);
+}
+
+static DWORD WINAPI
+dhtmlRunThread(LPVOID lpParam)
+{
+    DWORD    rv = ERROR_SUCCESS;
+    HRESULT  hr;
+    VARIANT  varArgs, varReturn;
+    DHTML_THREAD_PARAMS *pD = (DHTML_THREAD_PARAMS *)lpParam;
+    LPMC_HTML_DIALOG hDlg   = pD->hHtmlDlg;
+
+    if (IS_INVALID_HANDLE(pD->hHtmlDlg)) {
+        rv = ERROR_INVALID_HANDLE;
+        goto cleanup;
+    }
+    VariantInit(&varReturn);
+    varArgs.vt = VT_BSTR;
+    varArgs.bstrVal = SysAllocString(pD->szArguments);
+    hr = (*pfnShowHTMLDialog)(pD->hParent,
+                              hDlg->lpImk,
+                              HTMLDLG_MODAL | HTMLDLG_VERIFY,
+                              &varArgs,
+                              pD->szOptions,
+                              &varReturn);
+    VariantClear(&varArgs);
+    if (SUCCEEDED(hr)) {
+        switch(varReturn.vt) {
+            case VT_BSTR:
+                WcsToMbs(CP_UTF8, varReturn.bstrVal,
+                         hDlg->szReturnVal, ACR_HBUFF_SIZ);
+            break;
+        }
+        VariantClear(&varReturn);
+        rv = ERROR_SUCCESS;
+    }
+    else
+        rv = GetLastError();
+cleanup:
+    pD->bDone = TRUE;
+    ExitThread(rv);
+    return rv;
+}
+
+ACR_DECLARE(BOOL)
+DHTMLDialogRun(
+    HWND   hParent,
+    LPVOID hHtmlDlg,
+    LPCSTR szTitle,
+    DWORD  dwWidth,
+    DWORD  dwHeight,
+    DWORD  dwFlags,
+    DWORD  dwTimeout,
+    LPCSTR szArguments)
+{
+    DWORD  dwThreadId;
+    HANDLE hThread;
+    HWND   hWnd = NULL;
+    DWORD  i;
+    BOOL   rv = FALSE;
+    DHTML_THREAD_PARAMS pD;
+    int    w = -1;
+    int    ws, rc;
+
+    if (IS_INVALID_HANDLE(hHtmlDlg))
+        return FALSE;
+    pD.hParent  = hParent;
+    pD.hHtmlDlg = hHtmlDlg;
+    swprintf(pD.szOptions, ACR_SBUFF_SIZ,
+             L"scroll: no; status: no; help: no; dialogHeight: %dpx; dialogWidth: %dpx",
+             dwHeight, dwWidth);
+    if (dwFlags == 1)
+        wcscat(pD.szOptions, L"; unadorned:yes");
+    if (szArguments)
+        MbsToWcs(CP_UTF8, szArguments, pD.szArguments, ACR_PBUFF_SIZ);
+
+    hThread = CreateThread(NULL,
+                           0,
+                           dhtmlRunThread,
+                           &pD,
+                           0,
+                           &dwThreadId);
+    if (IS_INVALID_HANDLE(hThread))
+        return FALSE;
+
+    /* Hack to change the Icon of HTML Dialog */
+    for (i = 0; i < 1000; i++) {
+        if ((hWnd = FindWindowEx(hParent, NULL, NULL, szTitle))) {
+            w = GuiRegisterWindow(hWnd);
+            SetClassLong(hWnd, GCL_HICONSM, (LONG)gui_h16Icon);
+            break;
+        }
+        if (pD.bDone)
+            break;
+        Sleep(1);
+    }
+    do {
+        rc = 0;
+        ws = ACR_WaitForObjectOrSignal(hThread, dwTimeout);
+        switch (ws) {
+            case WAIT_IO_COMPLETION:
+            case WAIT_ABANDONED_0:
+            case WAIT_ABANDONED_1:
+            case WAIT_OBJECT_0:
+                /* Signal event is set.
+                 * Get it's satus.
+                 */
+                rc = ACR_DeliverSignals();
+            break;
+            case WAIT_OBJECT_1:
+                /* Dialog ended */
+                rc = 0;
+            break;
+            case WAIT_FAILED:
+                /* We got the error while waiting
+                 */
+                rc = ACR_GET_OS_ERROR();
+            break;
+            case WAIT_TIMEOUT:
+                rc = ACR_TIMEUP;
+            break;
+            default:
+                rc = ACR_EINVAL;
+            break;
+        }
+    } while (rc == ACR_EINTR);
+
+    if (rc && hWnd) {
+        SendMessage(hWnd, WM_CLOSE, 0, 0);
+        WaitForSingleObject(hThread, INFINITE);
+    }
+    if (GetExitCodeThread(hThread, &rc) && rc == 0) {
+        rv = TRUE;
+    }
+    else
+        SetLastError(rc);
+    CloseHandle(hThread);
+    GuiUnregisterWindow(w);
+
+    return rv;
+}
+
+ACR_DECLARE(LPSTR)
+DHTMLDialogResult(LPVOID hHtmlDlg)
+{
+
+    LPMC_HTML_DIALOG hDlg = (LPMC_HTML_DIALOG)hHtmlDlg;
+    if (IS_INVALID_HANDLE(hHtmlDlg))
+        return NULL;
+
+    return hDlg->szReturnVal;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dso.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dso.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dso.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dso.c Mon Dec 14 05:16:26 2009
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_memory.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c Mon Dec 14 05:16:26 2009
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_memory.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fasync.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fasync.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fasync.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fasync.c Mon Dec 14 05:16:26 2009
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c Mon Dec 14 05:16:26 2009
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_memory.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c Mon Dec 14 05:16:26 2009
@@ -14,8 +14,10 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
+#include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_string.h"
 #include "acr_memory.h"
@@ -23,9 +25,6 @@
 #include "acr_pointer.h"
 #include "acr_file.h"
 #include "acr_fileio.h"
-
-#define ACR_WANT_LATE_DLL
-#include "acr_arch.h"
 #include "acr_port.h"
 
 static int file_cleanup(void *file, int type, unsigned int flags)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c Mon Dec 14 05:16:26 2009
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_error.h"
@@ -23,8 +24,6 @@
 #include "acr_pointer.h"
 #include "acr_file.h"
 #include "acr_fileio.h"
-
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_port.h"
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/gui.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/gui.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/gui.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/gui.c Mon Dec 14 05:16:26 2009
@@ -24,6 +24,7 @@
 #include "acr_string.h"
 #include "acr_tlsd.h"
 #include "acr_vm.h"
+#include "acr_gui.h"
 
 #include <commdlg.h>
 #include <commctrl.h>
@@ -39,7 +40,6 @@
 /* GUI Windows functions
  */
 #define IDI_MAINICON 101
-#define MGUI_WINDOWS 32
 
 HICON            gui_h16Icon    = NULL;
 HICON            gui_h32Icon    = NULL;
@@ -51,28 +51,35 @@
 static UINT      gui_ucNumLines = 3;
 static CHAR      gui_szWndClass[MAX_PATH];
 
-
+static CRITICAL_SECTION gui_cLock;
 static HWND     gui_Windows[MGUI_WINDOWS];
 
-int GuiRegisterWindow(HWND hWnd)
+ACR_DECLARE(int) GuiRegisterWindow(HWND hWnd)
 {
     int i;
+    EnterCriticalSection(&gui_cLock);
     for (i = 0; i < MGUI_WINDOWS; i++) {
         if (!gui_Windows[i]) {
             gui_Windows[i] = hWnd;
+            LeaveCriticalSection(&gui_cLock);
             return i;
         }
     }
+    LeaveCriticalSection(&gui_cLock);
+
     return -1;
 }
 
-void GuiUnregisterWindow(int nIndex)
+ACR_DECLARE(void) GuiUnregisterWindow(int nIndex)
 {
+    EnterCriticalSection(&gui_cLock);
     if (nIndex >= 0 && nIndex < MGUI_WINDOWS)
         gui_Windows[nIndex] = NULL;
+    LeaveCriticalSection(&gui_cLock);
+
 }
 
-BOOL GuiInitialize()
+ACR_DECLARE(BOOL) GuiInitialize()
 {
     int i;
     INITCOMMONCONTROLSEX stCmn;
@@ -96,18 +103,23 @@
                          &gui_ucNumLines, 0);
     for (i = 0; i < MGUI_WINDOWS; i++)
         gui_Windows[i] = NULL;
+    InitializeCriticalSection(&gui_cLock);
+
     return TRUE;
 }
 
-BOOL GuiTerminate()
+
+ACR_DECLARE(BOOL) GuiTerminate()
 {
     int i;
+    EnterCriticalSection(&gui_cLock);
     for (i = 0; i < MGUI_WINDOWS; i++) {
         if (gui_Windows[i]) {
             SendMessage(gui_Windows[i], WM_CLOSE, 0, 0);
             gui_Windows[i] = NULL;
         }
     }
+    DeleteCriticalSection(&gui_cLock);
     return TRUE;
 }
 
@@ -116,7 +128,8 @@
  * pointer to it.  Notice that the buffer is common memory so
  * the string must be used before this call is made a second time.
  */
-LPSTR GuiLoadResource(
+ACR_DECLARE(LPSTR)
+GuiLoadResource(
     UINT wID,
     UINT nBuf)
 {
@@ -129,7 +142,7 @@
         return "";
 }
 
-void GuiCenterWindow(HWND hWnd)
+ACR_DECLARE(void) GuiCenterWindow(HWND hWnd)
 {
    RECT    rc, rw;
    int     cw, ch;
@@ -157,8 +170,9 @@
                 SWP_NOSIZE | SWP_SHOWWINDOW);
 }
 
-BOOL GuiBrowseForFolderW(HWND hWnd, LPCWSTR szTitle,
-                         LPWSTR szPath, int iFlags)
+ACR_DECLARE(BOOL)
+GuiBrowseForFolderW(HWND hWnd, LPCWSTR szTitle,
+                    LPWSTR szPath, int iFlags)
 {
     BOOL rv = FALSE;
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Mon Dec 14 05:16:26 2009
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"
@@ -22,8 +23,6 @@
 #include "acr_signals.h"
 #include "acr_tlsd.h"
 #include "acr_vm.h"
-
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 
 /**

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c Mon Dec 14 05:16:26 2009
@@ -14,15 +14,13 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_string.h"
 
-#define ACR_WANT_LATE_DLL
-#include "acr_arch.h"
-
 static const char unknown[] = "unknown";
 
 ACR_JNI_EXPORT_DECLARE(jint, Os, type)(ACR_JNISTDARGS)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c Mon Dec 14 05:16:26 2009
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_clazz.h"
 #include "acr_error.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/posix.c Mon Dec 14 05:16:26 2009
@@ -14,13 +14,15 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_memory.h"
 #include "acr_string.h"
-
+#include "acr_port.h"
+#include "acr_env.h"
 
 /* Something that is missing from CRT
  */

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c Mon Dec 14 05:16:26 2009
@@ -23,9 +23,9 @@
  *
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_port.h"
 #include "acr_clazz.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c Mon Dec 14 05:16:26 2009
@@ -14,15 +14,13 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"
 #include "acr_error.h"
 #include "acr_string.h"
 
-#define ACR_WANT_LATE_DLL
-#include "acr_arch.h"
-
 #define LOG_MSG_EMERG           0xC0000001L
 #define LOG_MSG_ERROR           0xC0000002L
 #define LOG_MSG_NOTICE          0x80000003L

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c Mon Dec 14 05:16:26 2009
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_error.h"
@@ -22,8 +23,6 @@
 #include "acr_descriptor.h"
 #include "acr_env.h"
 #include "acr_file.h"
-
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 #include "acr_port.h"
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/tfs.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/tfs.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/tfs.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/tfs.c Mon Dec 14 05:16:26 2009
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c?rev=890181&r1=890180&r2=890181&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c Mon Dec 14 05:16:26 2009
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#define ACR_WANT_LATE_DLL
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_clazz.h"
@@ -22,8 +23,6 @@
 #include "acr_string.h"
 #include "acr_descriptor.h"
 #include "acr_crypto.h"
-
-#define ACR_WANT_LATE_DLL
 #include "acr_arch.h"
 
 #include <direct.h>



Mime
View raw message