Debian Codegraph @

Xpjproject/pjmedia/src/test/wince_main.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include "test.h"
20 #include <windows.h>
21 #include <stdio.h>
22
23 #define TITLE "PJMEDIA Test"
24 #define CAPTION "This will start pjmedia test. Please do not use the PDA while the test is in progress. The test may take couple of minutes to complete, and you will be notified again when it completes"
25
26 static FILE *fLog;
27
28 static void log_writer_cb(int level, const char *data, int len)
29 {
30 PJ_UNUSED_ARG(level);
31
32 fwrite(data, len, 1, fLog);
33 }
34
35
36 int WINAPI WinMain(HINSTANCE hInstance,
37 HINSTANCE hPrevInstance,
38 LPTSTR lpCmdLine,
39 int nCmdShow)
40 {
41 int rc;
42
43 PJ_UNUSED_ARG(hInstance);
44 PJ_UNUSED_ARG(hPrevInstance);
45 PJ_UNUSED_ARG(lpCmdLine);
46 PJ_UNUSED_ARG(nCmdShow);
47
48 rc = MessageBox(0, TEXT(CAPTION), TEXT(TITLE), MB_OKCANCEL);
49 if (rc != IDOK)
50 return TRUE;
51
52 fLog = fopen("\\pjmedia-test.txt", "wt");
53 if (fLog == NULL) {
54 MessageBox(0, TEXT("Unable to create result file"), TEXT(TITLE), MB_OK);
55 return TRUE;
56 }
57 pj_log_set_log_func(&log_writer_cb);
58 rc = test_main();
59
60 fclose(fLog);
61
62 if (rc != 0) {
63 MessageBox(0, TEXT("Test failed"), TEXT(TITLE), MB_OK);
64 return TRUE;
65 }
66
67 MessageBox(0, TEXT("Test has been successful. Please see the result in \"\\pjmedia-test.txt\" file"),
68 TEXT(TITLE), 0);
69 return TRUE;
70 }
71