The R Project SVN R

Rev

Rev 59039 | Rev 68956 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59039 Rev 61977
Line 48... Line 48...
48
#include <wincon.h>
48
#include <wincon.h>
49
typedef BOOL (*AC)(DWORD);
49
typedef BOOL (*AC)(DWORD);
50
 
50
 
51
int AppMain(int argc, char **argv)
51
int AppMain(int argc, char **argv)
52
{
52
{
53
    AC entry;
-
 
54
 
-
 
55
    CharacterMode = RGui;
53
    CharacterMode = RGui;
56
    if(strcmp(getDLLVersion(), getRVersion()) != 0) {
54
    if(strcmp(getDLLVersion(), getRVersion()) != 0) {
57
	MessageBox(0, "R.DLL version does not match", "Terminating",
55
	MessageBox(0, "R.DLL version does not match", "Terminating",
58
		   MB_TASKMODAL | MB_ICONSTOP | MB_OK);
56
		   MB_TASKMODAL | MB_ICONSTOP | MB_OK);
59
	exit(1);
57
	exit(1);
Line 63... Line 61...
63
        MessageBox(0, "Error setting up console.  Try --vanilla option.",
61
        MessageBox(0, "Error setting up console.  Try --vanilla option.",
64
                      "Terminating", MB_TASKMODAL | MB_ICONSTOP | MB_OK);
62
                      "Terminating", MB_TASKMODAL | MB_ICONSTOP | MB_OK);
65
        GA_exitapp();
63
        GA_exitapp();
66
    }
64
    }
67
 
65
 
68
/* If we have this, C writes to stdout/stderr would get set to the 
66
/* C writes to stdout/stderr get set to the launching terminal (if
69
   launching terminal (if there was one).  Unfortunately needs XP, and
-
 
70
   works for C but not Fortran. */
67
   there was one).  Needs XP, and works for C but not Fortran. */
71
 
68
 
72
    entry = (AC) GetProcAddress((HMODULE)GetModuleHandle("KERNEL32"),
-
 
73
				"AttachConsole");
-
 
74
    if (entry && entry(ATTACH_PARENT_PROCESS))
69
    if (AttachConsole(ATTACH_PARENT_PROCESS))
75
    {
70
    {
76
	freopen("CONIN$", "r", stdin);
71
	freopen("CONIN$", "r", stdin);
77
	freopen("CONOUT$", "w", stdout);
72
	freopen("CONOUT$", "w", stdout);
78
	freopen("CONOUT$", "w", stderr);
73
	freopen("CONOUT$", "w", stderr);
79
    }
74
    }