]> git.saurik.com Git - wxWidgets.git/blame - src/msw/wince/crt.cpp
Polish translations update from Grzegorz Zlotowicz.
[wxWidgets.git] / src / msw / wince / crt.cpp
CommitLineData
e3bf2e8c 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/msw/wince/crt.cpp
e3bf2e8c
VZ
3// Purpose: Implementation of CRT functions missing under Windows CE
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 03.04.04
e3bf2e8c 7// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
65571936 8// Licence: wxWindows licence
e3bf2e8c
VZ
9///////////////////////////////////////////////////////////////////////////////
10
e3bf2e8c
VZ
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
9c56ae5f
VZ
17#ifndef WX_PRECOMP
18 #include "wx/app.h"
19#endif
20
21#include "wx/msw/wince/missing.h"
22
e3bf2e8c
VZ
23extern "C" void *
24bsearch(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
9c56ae5f
VZ
48extern "C"
49void abort()
50{
51 wxString name;
52 if ( wxTheApp )
9cf3d218 53 name = wxTheApp->GetAppDisplayName();
9c56ae5f 54 if ( name.empty() )
77ffb593 55 name = L"wxWidgets Application";
9c56ae5f
VZ
56
57 MessageBox(NULL, L"Abnormal program termination", name, MB_ICONHAND | MB_OK);
58
c1edc08d
RR
59 _exit(3);
60// ::ExitProcess(3);
9c56ae5f
VZ
61}
62
63extern "C"
64char *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}
e3bf2e8c 71
d6f2a891
VZ
72int wxCRT_Rename(const wchar_t *src, const wchar_t *dst)
73{
74 return ::MoveFile(src, dst) ? 0 : -1;
75}
76
77int wxCRT_Remove(const wchar_t *path)
78{
79 return ::DeleteFile(path) ? 0 : -1;
80}
81