• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.org Installation Manager Tool


Commit MetaInfo

Revision796e8c58993d9c3ea8430b4cbc1477eb5303b946 (tree)
Time2008-11-02 09:18:02
AuthorJohn E. <tdragon@user...>
CommiterJohn E.

Log Message

Remove renamed or deprecated sources

Change Summary

  • delete: download.cpp
  • delete: getbindir.cpp
  • delete: inst_manager.cpp
  • delete: inst_manager.hpp
  • delete: instselect.cpp
  • delete: main.cpp
  • delete: pkg_index.cpp
  • delete: pkg_index.hpp
  • delete: versioning.c
  • delete: wxtest.cpp

Incremental Difference

--- a/download.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
1-
2-#include <curl/curl.h>
3-#include "ref.hpp"
4-
5-
6-struct CallbackInfo
7-{
8- void (*next_callback)(size_t);
9- int total_sent;
10-};
11-
12-extern "C" int DLCallback
13- (void* clientp,
14- double dltotal,
15- double dlnow,
16- double ultotal,
17- double ulnow)
18-{
19- CallbackInfo* cbi = reinterpret_cast< CallbackInfo* >(clientp);
20- if (!cbi->total_sent)
21- {
22- cbi->next_callback((size_t)dltotal);
23- cbi->total_sent = 1;
24- }
25- cbi->next_callback((size_t)dlnow);
26- return 0;
27-}
28-
29-
30-size_t DownloadFile
31- (const char* url,
32- const char* local,
33- void (*prog_callback)(size_t) = 0)
34-{
35- CURL* curl = curl_easy_init();
36- if (!curl)
37- return 0;
38- RefType< CURL >::Ref curl_closer(curl, curl_easy_cleanup);
39-
40- curl_easy_setopt(curl, CURLOPT_URL, url);
41- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
42-
43- FILE* outfile = fopen(local, "wb");
44- if (!outfile)
45- return 0;
46- RefType< FILE >::Ref fcloser(outfile, fclose);
47- curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
48-
49- if (prog_callback)
50- {
51- curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, DLCallback);
52- CallbackInfo info;
53- info.next_callback = prog_callback;
54- info.total_sent = 0;
55- curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &info);
56- }
57- else
58- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
59-
60- CURLcode success = curl_easy_perform(curl);
61-
62- if (success != 0)
63- {
64- fcloser = RefType< FILE >::Ref();
65- DeleteFile(local);
66- return 0;
67- }
68-
69- double dltotal = 0.0;
70- curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dltotal);
71- return (size_t)dltotal;
72-}
--- a/getbindir.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
1-/** \file getbindir.cpp
2- *
3- * Created: JohnE, 2008-10-09
4- */
5-
6-
7-#define WIN32_LEAN_AND_MEAN
8-#include <windows.h>
9-#include <string>
10-
11-
12-std::string GetBinDir()
13-{
14- char path[1024];
15- GetModuleFileName(0, path, 1024);
16- for (int i = strlen(path) - 1; i >= 0; --i)
17- {
18- if (path[i] == '/' || path[i] == '\\')
19- {
20- path[i] = '\0';
21- break;
22- }
23- path[i] = '\0';
24- }
25- return path;
26-}
--- a/inst_manager.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
1-
2-#include "inst_manager.hpp"
3-
4-#include <cstdarg>
5-#include "tracked_install.hpp"
6-#include "ref.hpp"
7-#include "package.hpp"
8-#include "ui.hpp"
9-
10-
11-char InstManager::sm_lasterror[2048] = {0};
12-std::string InstManager::sm_inst_loc;
13-
14-
15-const char* InstManager::GetError()
16-{
17- return sm_lasterror;
18-}
19-
20-
21-struct DirCreated
22-{
23- std::string rdir;
24- DirCreated(const std::string& dir)
25- : rdir(dir)
26- {
27- }
28- bool Revert()
29- {
30- return RemoveDirectory(rdir.c_str());
31- }
32-};
33-struct FileCreated
34-{
35- std::string rfile;
36- FileCreated(const std::string& file)
37- : rfile(file)
38- {
39- }
40- bool Revert()
41- {
42- return DeleteFile(rfile.c_str());
43- }
44-};
45-
46-size_t DownloadFile
47- (const char*,
48- const char*,
49- void (*)(size_t) = 0);
50-std::string GetBinDir();
51-
52-bool InstManager::Load(const std::string& inst_loc, bool create)
53-{
54- sm_inst_loc = inst_loc;
55- if (sm_inst_loc[sm_inst_loc.length() - 1] == '\\'
56- || sm_inst_loc[sm_inst_loc.length() - 1] == '/')
57- sm_inst_loc.erase(sm_inst_loc.length() - 1);
58-
59- ChangeSet::Ref changes(new ChangeSet);
60- do
61- {
62- if (create)
63- {
64- if (!CreateDirectory(sm_inst_loc.c_str(), 0)
65- && ::GetLastError() != ERROR_ALREADY_EXISTS)
66- {
67- SetError("Couldn't create the directory '%s'",
68- sm_inst_loc.c_str());
69- break;
70- }
71- changes->Push(DirCreated(sm_inst_loc));
72-
73-#if 0
74- if (DownloadFile("http://localhost:1330/mingwinst/mingw_avail.mft",
75- (GetBinDir() + "\\mingw_avail.mft").c_str(), 0) <= 0)
76- {
77- SetError("Couldn't download the following file:\r\n%s",
78- "http://localhost:1330/mingwinst/mingw_avail.mft");
79- break;
80- }
81-#endif
82-
83- return true;
84- }
85- else
86- {
87- return true;
88- }
89- } while (0);
90-
91- // Error
92- changes->RevertAll();
93- return false;
94-}
95-
96-
97-void InstManager::Save()
98-{
99-}
100-
101-
102-void InstManager::SetError(const char* fmt, ...)
103-{
104- va_list ap;
105- va_start(ap, fmt);
106- vsnprintf(sm_lasterror, 2048, fmt, ap);
107- va_end(ap);
108-}
--- a/inst_manager.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
1-#ifndef INST_MANAGER_HPP_INC
2-#define INST_MANAGER_HPP_INC
3-
4-
5-#define WIN32_LEAN_AND_MEAN
6-#include <windows.h>
7-#include <string>
8-#include <map>
9-#include <vector>
10-#include "tinyxml/tinyxml.h"
11-#include "ref.hpp"
12-
13-
14-struct Package;
15-
16-
17-class InstManager
18-{
19-public:
20- static const char* GetError();
21-
22- static bool Load
23- (const std::string& inst_loc,
24- bool create = false);
25- static void Save();
26-
27-private:
28- static void SetError(const char* fmt, ...);
29-
30- static char sm_lasterror[];
31- static std::string sm_inst_loc;
32-};
33-
34-
35-#endif // INST_MANAGER_HPP_INC
--- a/instselect.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
1-
2-#define WIN32_LEAN_AND_MEAN
3-#include <windows.h>
4-#include <windowsx.h>
5-#include <shlobj.h>
6-#include <sys/stat.h>
7-#include <string>
8-#include <map>
9-#include "resource.h"
10-#include "inst_manager.hpp"
11-
12-
13-extern "C" {
14-char g_inst_loc[MAX_PATH] = {0};
15-}
16-
17-
18-static HWND g_hdlg = 0;
19-static BOOL g_createinst = FALSE;
20-
21-struct CmpStrI
22-{
23- bool operator () (const std::string& s1, const std::string& s2)
24- {
25- return (stricmp(s1.c_str(), s2.c_str()) < 0);
26- }
27-};
28-typedef std::map< std::string, int, CmpStrI > InstIndexMap;
29-static InstIndexMap prev_insts;
30-
31-
32-static void ValidateInstPath(HWND hdlg, const std::string& path)
33-{
34- int valid = 0;
35- if (path.length() > 0)
36- {
37- size_t i = path.find_last_of("/\\", path.length() - 2);
38- if (path[1] == ':' && i != std::string::npos)
39- {
40- std::string pdir = (i >= 4) ? path.substr(0, i) : path.substr(0, i + 1);
41- struct _stat st;
42- if (_stat(pdir.c_str(), &st) == 0
43- && _S_ISDIR(st.st_mode))
44- {
45- std::string dpath = path;
46- if (dpath[dpath.length() - 1] == '/'
47- || dpath[dpath.length() - 1] == '\\')
48- dpath.erase(dpath.length() - 1);
49- if (_stat(dpath.c_str(), &st) == 0)
50- {
51- if (_S_ISDIR(st.st_mode))
52- {
53- if (_stat((dpath + "\\mingwpkg.mft").c_str(),
54- &st) == 0)
55- {
56- valid = 1;
57- g_createinst = FALSE;
58- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
59- "This is an existing installation");
60- Button_SetCheck(GetDlgItem(hdlg, IDC_EXISTMANAGE),
61- BST_CHECKED);
62- EnableWindow(GetDlgItem(hdlg, IDC_PREVINSTLIST),
63- TRUE);
64- InstIndexMap::iterator found =
65- prev_insts.find(dpath);
66- if (found != prev_insts.end())
67- {
68- (void)ListBox_SetCurSel(
69- GetDlgItem(hdlg, IDC_PREVINSTLIST),
70- found->second
71- );
72- }
73- else
74- {
75- (void)ListBox_SetCurSel(
76- GetDlgItem(hdlg, IDC_PREVINSTLIST), -1
77- );
78- }
79- }
80- else
81- {
82- valid = 1;
83- g_createinst = TRUE;
84- Button_SetCheck(GetDlgItem(hdlg, IDC_EXISTMANAGE),
85- BST_UNCHECKED);
86- EnableWindow(GetDlgItem(hdlg, IDC_PREVINSTLIST),
87- FALSE);
88- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
89- "This path exists");
90- }
91- }
92- else
93- {
94- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
95- "This path is not a directory");
96- }
97- }
98- else
99- {
100- valid = 1;
101- g_createinst = TRUE;
102- Button_SetCheck(GetDlgItem(hdlg, IDC_EXISTMANAGE),
103- BST_UNCHECKED);
104- EnableWindow(GetDlgItem(hdlg, IDC_PREVINSTLIST), FALSE);
105- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
106- "This directory will be created");
107- }
108- }
109- else
110- {
111- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
112- "The parent directory doesn't exist");
113- }
114- }
115- else
116- {
117- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
118- "Not a valid installation path");
119- }
120- }
121- else
122- {
123- Static_SetText(GetDlgItem(hdlg, IDC_VALTEXT),
124- "Please enter an installation path");
125- }
126- EnableWindow(GetDlgItem(hdlg, IDOK), valid ? TRUE : FALSE);
127-}
128-
129-
130-extern "C" int GetPrevInstalls(void (*)(const char*));
131-
132-extern "C" void PrevInstCallback(const char* path)
133-{
134- int index = ListBox_AddString(GetDlgItem(g_hdlg, IDC_PREVINSTLIST), path);
135- prev_insts[path] = index;
136-}
137-
138-static int CALLBACK InstBrowseProc
139- (HWND hwnd,
140- UINT uMsg,
141- LPARAM lParam,
142- LPARAM lpData)
143-{
144- if (uMsg == BFFM_INITIALIZED)
145- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
146- return 0;
147-}
148-
149-static BOOL CALLBACK InstSelProc
150- (HWND hwndDlg,
151- UINT uMsg,
152- WPARAM wParam,
153- LPARAM lParam)
154-{
155- switch(uMsg)
156- {
157- case WM_INITDIALOG:
158- {
159- g_hdlg = hwndDlg;
160- if (!g_inst_loc[0])
161- strcpy(g_inst_loc, "C:\\mingwgettest");
162- if (GetPrevInstalls(PrevInstCallback) > 0)
163- {
164- SendMessage(GetDlgItem(hwndDlg, IDC_PREVINSTLIST), LB_SETCURSEL,
165- 0, 0);
166- SendMessage(hwndDlg, WM_COMMAND,
167- MAKEWPARAM(IDC_PREVINSTLIST, LBN_SELCHANGE),
168- (LPARAM)GetDlgItem(hwndDlg, IDC_PREVINSTLIST));
169- EnableWindow(GetDlgItem(hwndDlg, IDC_PREVINSTLIST), TRUE);
170- }
171- else
172- {
173- EnableWindow(GetDlgItem(hwndDlg, IDC_PREVINSTLIST), FALSE);
174- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
175- Edit_SetText(GetDlgItem(hwndDlg, IDC_INSTPATH), g_inst_loc);
176- }
177- SetFocus(GetDlgItem(hwndDlg, IDC_INSTPATH));
178- }
179- return FALSE;
180-
181- case WM_COMMAND:
182- switch(LOWORD(wParam))
183- {
184- case IDOK:
185- {
186- g_inst_loc[0] = 0;
187- Edit_GetText(GetDlgItem(hwndDlg, IDC_INSTPATH), g_inst_loc,
188- MAX_PATH);
189- EndDialog(hwndDlg, 1);
190- }
191- return TRUE;
192- case IDCANCEL:
193- EndDialog(hwndDlg, 0);
194- return TRUE;
195- case IDC_EXISTMANAGE:
196- EnableWindow(GetDlgItem(hwndDlg, IDC_PREVINSTLIST),
197- Button_GetCheck((HWND)lParam) == BST_CHECKED);
198- return TRUE;
199- case IDC_BROWSENEWINST:
200- {
201- char path[MAX_PATH];
202- path[0] = 0;
203- Edit_GetText(GetDlgItem(hwndDlg, IDC_INSTPATH), path, MAX_PATH);
204- if (!path[0])
205- strcpy(path, "C:\\");
206- BROWSEINFO bi;
207- bi.hwndOwner = hwndDlg;
208- bi.pidlRoot = 0;
209- bi.pszDisplayName = 0;
210- bi.lpszTitle = "Select a Folder";
211- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
212- bi.lpfn = InstBrowseProc;
213- bi.lParam = reinterpret_cast< LPARAM >(path);
214- bi.iImage = 0;
215- LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
216- if (pidl)
217- {
218- char cpath[MAX_PATH];
219- if (SHGetPathFromIDList(pidl, cpath))
220- {
221- std::string path = cpath;
222- if (path.length() < 5
223- || stricmp(path.c_str() + path.length() - 5, "mingw")
224- != 0)
225- {
226- if (path[path.length() - 1] != '\\')
227- path += '\\';
228- Edit_SetText(GetDlgItem(hwndDlg, IDC_INSTPATH),
229- (path + "MinGW").c_str());
230- }
231- else
232- {
233- Edit_SetText(GetDlgItem(hwndDlg, IDC_INSTPATH),
234- path.c_str());
235- }
236- }
237- CoTaskMemFree(pidl);
238- }
239- }
240- return TRUE;
241- case IDC_INSTPATH:
242- if (HIWORD(wParam) == EN_CHANGE)
243- {
244- char path[MAX_PATH];
245- path[0] = 0;
246- Edit_GetText((HWND)lParam, path, MAX_PATH);
247- ValidateInstPath(hwndDlg, path);
248- return TRUE;
249- }
250- break;
251- case IDC_PREVINSTLIST:
252- if (HIWORD(wParam) == LBN_SELCHANGE)
253- {
254- int sel = ListBox_GetCurSel((HWND)lParam);
255- int len = ListBox_GetTextLen((HWND)lParam, sel);
256- char* txt = (char*)malloc(len + 1);
257- if (ListBox_GetText((HWND)lParam, sel, txt) > 0)
258- Edit_SetText(GetDlgItem(hwndDlg, IDC_INSTPATH), txt);
259- free(txt);
260- return TRUE;
261- }
262- break;
263- }
264- break;
265-
266- case WM_CLOSE:
267- EndDialog(hwndDlg, 0);
268- return TRUE;
269- }
270-
271- return FALSE;
272-}
273-
274-
275-extern "C" void SelectInst(HINSTANCE hinstance, HWND hparent)
276-{
277- if (!DialogBox(hinstance, MAKEINTRESOURCE(IDD_INSTSEL), hparent,
278- InstSelProc) || !g_inst_loc[0])
279- return;
280- if (!InstManager::Load(g_inst_loc, g_createinst))
281- {
282- MessageBox(hparent, InstManager::GetError(),
283- "Installation Failure", MB_OK | MB_ICONEXCLAMATION);
284- return;
285- }
286- char title[1024];
287- snprintf(title, 1024, "mingw-get: %s", g_inst_loc);
288- SetWindowText(hparent, title);
289-}
--- a/main.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
1-
2-#define WIN32_LEAN_AND_MEAN
3-#include <windows.h>
4-#include <string>
5-#include "pkg_index.hpp"
6-
7-
8-extern "C" HWND CreateMainWnd(HINSTANCE);
9-extern "C" int MainMessageLoop(HWND);
10-std::string GetBinDir();
11-extern "C" void SelectInst(HINSTANCE, HWND);
12-
13-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
14-{
15- HWND mainwnd = CreateMainWnd(hInstance);
16- if (!mainwnd)
17- return 1;
18-
19- PkgIndex::LoadManifest(GetBinDir() + "\\mingw_avail.mft");
20-
21- SelectInst(hInstance, mainwnd);
22-
23- return MainMessageLoop(mainwnd);
24-}
--- a/pkg_index.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
1-/** \file pkg_index.cpp
2- *
3- * Created: JohnE, 2008-10-09
4- */
5-
6-
7-#include "pkg_index.hpp"
8-
9-#include <string>
10-#include <cstdarg>
11-#include "tinyxml/tinyxml.h"
12-#include "ui.hpp"
13-#include "package.hpp"
14-
15-
16-char PkgIndex::sm_lasterror[2048] = {0};
17-std::vector< std::string > PkgIndex::sm_index_categories;
18-PkgIndex::StringIntMap PkgIndex::sm_id_categories;
19-PkgIndex::StringPackageMap PkgIndex::sm_id_packages;
20-
21-
22-static const char* NonEmptyAttribute(const TiXmlElement* el, const char* name)
23-{
24- const char* attr = el->Attribute(name);
25- if (attr && attr[0])
26- return attr;
27- return 0;
28-}
29-
30-
31-int PkgIndex::NumCategories()
32-{
33- return sm_index_categories.size();
34-}
35-
36-
37-const char* PkgIndex::GetCategory(int cat)
38-{
39- return sm_index_categories[cat].c_str();
40-}
41-
42-
43-int PkgIndex::CategoryIndex(const char* cat_id)
44-{
45- StringIntMap::iterator found = sm_id_categories.find(cat_id);
46- if (found == sm_id_categories.end())
47- return -1;
48- return found->second;
49-}
50-
51-
52-PkgIndex::PackageIter PkgIndex::Packages_Begin()
53-{
54- return sm_id_packages.begin();
55-}
56-
57-
58-PkgIndex::PackageIter PkgIndex::Packages_End()
59-{
60- return sm_id_packages.end();
61-}
62-
63-
64-bool PkgIndex::LoadManifest(const std::string& mfile)
65-{
66- TiXmlDocument doc(mfile.c_str());
67- if (!doc.LoadFile())
68- {
69- SetError("Couldn't load '%s' as XML", mfile.c_str());
70- return false;
71- }
72- for (TiXmlElement* cat_el =
73- TiXmlHandle(doc.RootElement()->FirstChildElement("package-categories")).
74- FirstChildElement("category").ToElement();
75- cat_el;
76- cat_el = cat_el->NextSiblingElement("category"))
77- {
78- const char* id = NonEmptyAttribute(cat_el, "id");
79- if (!id)
80- continue;
81- const char* name = NonEmptyAttribute(cat_el, "name");
82- if (!name)
83- continue;
84- sm_id_categories[id] = sm_index_categories.size();
85- sm_index_categories.push_back(name);
86- }
87- for (TiXmlElement* package_el =
88- TiXmlHandle(doc.RootElement()->FirstChildElement("package-collection")).
89- FirstChildElement("package").ToElement();
90- package_el;
91- package_el = package_el->NextSiblingElement("package"))
92- {
93- const char* id = NonEmptyAttribute(package_el, "id");
94- if (!id)
95- continue;
96- StringPackageMap::iterator found = sm_id_packages.find(id);
97- if (found != sm_id_packages.end())
98- continue;
99- Package::Ref newpkg(new Package(id, package_el));
100- InsertPackage(newpkg);
101- }
102- return true;
103-}
104-
105-
106-void PkgIndex::ClearAll()
107-{
108- sm_index_categories.clear();
109- sm_id_categories.clear();
110- sm_id_packages.clear();
111-}
112-
113-
114-void PkgIndex::InsertPackage(Package::Ref ins)
115-{
116- sm_id_packages.insert(std::make_pair(ins->m_id, ins));
117-}
118-
119-
120-void PkgIndex::SetError(const char* fmt, ...)
121-{
122- va_list ap;
123- va_start(ap, fmt);
124- vsnprintf(sm_lasterror, 2048, fmt, ap);
125- va_end(ap);
126-}
--- a/pkg_index.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
1-/** \file pkg_index.hpp
2- *
3- * Created: JohnE, 2008-10-09
4- */
5-#ifndef PKG_INDEX_HPP_INC
6-#define PKG_INDEX_HPP_INC
7-
8-
9-#include <list>
10-#include <map>
11-#include <vector>
12-#include "ref.hpp"
13-
14-
15-struct Package;
16-
17-
18-class PkgIndex
19-{
20-public:
21- static void ClearAll();
22- static bool LoadManifest(const std::string& mfile);
23-
24- static int NumCategories();
25- static const char* GetCategory(int cat);
26- static int CategoryIndex(const char* cat_id);
27-
28- typedef std::map< std::string, RefType< Package >::Ref > StringPackageMap;
29- typedef StringPackageMap::const_iterator PackageIter;
30- static PackageIter Packages_Begin();
31- static PackageIter Packages_End();
32-
33-private:
34- static void SetError(const char* fmt, ...);
35- static void InsertPackage(RefType< Package >::Ref ins);
36-
37- static char sm_lasterror[];
38- static std::vector< std::string > sm_index_categories;
39- typedef std::map< std::string, int > StringIntMap;
40- static StringIntMap sm_id_categories;
41- static StringPackageMap sm_id_packages;
42-};
43-
44-
45-#endif // PKG_INDEX_HPP_INC
--- a/versioning.c
+++ /dev/null
@@ -1,44 +0,0 @@
1-
2-#include <string.h>
3-
4-static int IsDigit(char ch)
5-{
6- return (ch >= '0' && ch <= '9');
7-}
8-
9-int VersionCompare(const char* v1, const char* v2)
10-{
11- static int at1, at2, num1, num2;
12- at1 = 0, at2 = 0;
13- while (v1[at1] && v2[at2])
14- {
15- if (v1[at1] != v2[at2])
16- {
17- if (IsDigit(v1[at1]) && IsDigit(v2[at2]))
18- {
19- num1 = 0;
20- while (IsDigit(v1[at1]))
21- {
22- num1 = num1 * 10 + v1[at1] - '0';
23- ++at1;
24- }
25- num2 = 0;
26- while (IsDigit(v2[at2]))
27- {
28- num2 = num2 * 10 + v2[at2] - '0';
29- ++at2;
30- }
31- if (num1 != num2)
32- return num1 - num2;
33- }
34- else
35- return v1[at1] - v2[at2];
36- }
37- else
38- {
39- ++at1;
40- ++at2;
41- }
42- }
43- return v1[at1] - v2[at2];
44-}
--- a/wxtest.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
1-
2-#include <wx/app.h>
3-#include <wx/dialog.h>
4-
5-extern "C" int ShowMainWnd2
6- (HINSTANCE hInstance,
7- HINSTANCE hPrevInstance,
8- LPSTR lpCmdLine,
9- int nShowCmd)
10-{
11- return ::wxEntry(hInstance, hPrevInstance, lpCmdLine, nShowCmd);
12-}
13-
14-class TestDialog : public wxDialog
15-{
16-public:
17- TestDialog()
18- : wxDialog(0, -1, wxString("Hello"))
19- {
20- }
21-
22-private:
23- void OnClose(wxCloseEvent&)
24- {
25- Destroy();
26- }
27-
28- DECLARE_EVENT_TABLE() //macro
29-};
30-
31-BEGIN_EVENT_TABLE(TestDialog, wxDialog)
32- EVT_CLOSE(TestDialog::OnClose)
33-END_EVENT_TABLE()
34-
35-
36-class MyApp : public wxApp
37-{
38- virtual bool OnInit()
39- {
40- TestDialog* dlg = new TestDialog;
41- dlg->Show();
42- return true;
43- }
44-};
45-
46-IMPLEMENT_APP_NO_MAIN(MyApp) //macro