]>
Commit | Line | Data |
---|---|---|
e3bf2e8c VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 | // RCS-ID: | |
8 | // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org> | |
65571936 | 9 | // Licence: wxWindows licence |
e3bf2e8c VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
e3bf2e8c VZ |
12 | #include "wx/wxprec.h" |
13 | ||
14 | #ifdef __BORLANDC__ | |
15 | #pragma hdrstop | |
16 | #endif | |
17 | ||
9c56ae5f VZ |
18 | #ifndef WX_PRECOMP |
19 | #include "wx/app.h" | |
20 | #endif | |
21 | ||
22 | #include "wx/msw/wince/missing.h" | |
23 | ||
e3bf2e8c VZ |
24 | extern "C" void * |
25 | bsearch(const void *key, const void *base, size_t num, size_t size, | |
26 | int (wxCMPFUNC_CONV *cmp)(const void *, const void *)) | |
27 | { | |
28 | int res; | |
29 | char *mid; | |
30 | ||
31 | char *lo = (char *)base; | |
32 | char *hi = lo + num*size; | |
33 | while ( lo < hi ) | |
34 | { | |
35 | mid = lo + (hi - lo)/2; | |
36 | ||
37 | res = (*cmp)(key, mid); | |
38 | if ( res < 0 ) | |
39 | hi = mid; | |
40 | else if ( res > 0 ) | |
41 | lo = mid + size; | |
42 | else // res == 0 | |
43 | return mid; | |
44 | } | |
45 | ||
46 | return NULL; | |
47 | } | |
48 | ||
9c56ae5f VZ |
49 | extern "C" |
50 | void abort() | |
51 | { | |
52 | wxString name; | |
53 | if ( wxTheApp ) | |
54 | name = wxTheApp->GetAppName(); | |
55 | if ( name.empty() ) | |
77ffb593 | 56 | name = L"wxWidgets Application"; |
9c56ae5f VZ |
57 | |
58 | MessageBox(NULL, L"Abnormal program termination", name, MB_ICONHAND | MB_OK); | |
59 | ||
c1edc08d RR |
60 | _exit(3); |
61 | // ::ExitProcess(3); | |
9c56ae5f VZ |
62 | } |
63 | ||
64 | extern "C" | |
65 | char *getenv(const char * WXUNUSED(name)) | |
66 | { | |
67 | // no way to implement it in Unicode-only environment without using | |
68 | // wxCharBuffer and it is of no use in C code which uses this function | |
69 | // (libjpeg) | |
70 | return NULL; | |
71 | } | |
e3bf2e8c | 72 | |
d6f2a891 VZ |
73 | int wxCRT_Rename(const wchar_t *src, const wchar_t *dst) |
74 | { | |
75 | return ::MoveFile(src, dst) ? 0 : -1; | |
76 | } | |
77 | ||
78 | int wxCRT_Remove(const wchar_t *path) | |
79 | { | |
80 | return ::DeleteFile(path) ? 0 : -1; | |
81 | } | |
82 |