]> git.saurik.com Git - wxWidgets.git/blob - src/msw/wince/crt.cpp
Make mouse capture checking asserts stronger and more detailed.
[wxWidgets.git] / src / msw / wince / crt.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/wince/crt.cpp
3 // Purpose: Implementation of CRT functions missing under Windows CE
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 03.04.04
7 // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #ifndef WX_PRECOMP
18 #include "wx/app.h"
19 #endif
20
21 #include "wx/msw/wince/missing.h"
22
23 extern "C" void *
24 bsearch(const void *key, const void *base, size_t num, size_t size,
25 int (wxCMPFUNC_CONV *cmp)(const void *, const void *))
26 {
27 int res;
28 char *mid;
29
30 char *lo = (char *)base;
31 char *hi = lo + num*size;
32 while ( lo < hi )
33 {
34 mid = lo + (hi - lo)/2;
35
36 res = (*cmp)(key, mid);
37 if ( res < 0 )
38 hi = mid;
39 else if ( res > 0 )
40 lo = mid + size;
41 else // res == 0
42 return mid;
43 }
44
45 return NULL;
46 }
47
48 extern "C"
49 void abort()
50 {
51 wxString name;
52 if ( wxTheApp )
53 name = wxTheApp->GetAppDisplayName();
54 if ( name.empty() )
55 name = L"wxWidgets Application";
56
57 MessageBox(NULL, L"Abnormal program termination", name, MB_ICONHAND | MB_OK);
58
59 _exit(3);
60 // ::ExitProcess(3);
61 }
62
63 extern "C"
64 char *getenv(const char * WXUNUSED(name))
65 {
66 // no way to implement it in Unicode-only environment without using
67 // wxCharBuffer and it is of no use in C code which uses this function
68 // (libjpeg)
69 return NULL;
70 }
71
72 int wxCRT_Rename(const wchar_t *src, const wchar_t *dst)
73 {
74 return ::MoveFile(src, dst) ? 0 : -1;
75 }
76
77 int wxCRT_Remove(const wchar_t *path)
78 {
79 return ::DeleteFile(path) ? 0 : -1;
80 }
81