The R Project SVN R

Rev

Rev 81952 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 81952 Rev 83755
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1998--2022  R Core Team
3
 *  Copyright (C) 1998--2023  R Core Team
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
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
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
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 69... Line 69...
69
 
69
 
70
int main (int argc, char **argv)
70
int main (int argc, char **argv)
71
{
71
{
72
    structRstart rp;
72
    structRstart rp;
73
    Rstart Rp = &rp;
73
    Rstart Rp = &rp;
74
    char Rversion[25], *RHome;
74
    char Rversion[25], *RHome, *RUser;
75
 
75
 
76
    snprintf(Rversion, 25, "%s.%s", R_MAJOR, R_MINOR);
76
    snprintf(Rversion, 25, "%s.%s", R_MAJOR, R_MINOR);
77
    if(strcmp(getDLLVersion(), Rversion) != 0) {
77
    if(strcmp(getDLLVersion(), Rversion) != 0) {
78
        fprintf(stderr, "Error: R.DLL version does not match\n");
78
        fprintf(stderr, "Error: R.DLL version does not match\n");
79
        exit(1);
79
        exit(1);
Line 85... Line 85...
85
	fprintf(stderr, 
85
	fprintf(stderr, 
86
		"R_HOME must be set in the environment or Registry\n");
86
		"R_HOME must be set in the environment or Registry\n");
87
	exit(1);
87
	exit(1);
88
    }
88
    }
89
    Rp->rhome = RHome;
89
    Rp->rhome = RHome;
-
 
90
    RUser = getRUser();
90
    Rp->home = getRUser();
91
    Rp->home = RUser;
91
    Rp->CharacterMode = LinkDLL;
92
    Rp->CharacterMode = LinkDLL;
92
    Rp->EmitEmbeddedUTF8 = FALSE;
93
    Rp->EmitEmbeddedUTF8 = FALSE;
93
    Rp->ReadConsole = myReadConsole;
94
    Rp->ReadConsole = myReadConsole;
94
    Rp->WriteConsole = NULL; /* for illustration purposes we use more flexible WriteConsoleEx */
95
    Rp->WriteConsole = NULL; /* for illustration purposes we use more flexible WriteConsoleEx */
95
    Rp->WriteConsoleEx = myWriteConsoleEx;
96
    Rp->WriteConsoleEx = myWriteConsoleEx;
Line 101... Line 102...
101
    Rp->R_Quiet = TRUE;
102
    Rp->R_Quiet = TRUE;
102
    Rp->R_Interactive = FALSE;
103
    Rp->R_Interactive = FALSE;
103
    Rp->RestoreAction = SA_RESTORE;
104
    Rp->RestoreAction = SA_RESTORE;
104
    Rp->SaveAction = SA_NOSAVE;
105
    Rp->SaveAction = SA_NOSAVE;
105
    R_SetParams(Rp);
106
    R_SetParams(Rp);
-
 
107
    freeRUser(RUser);
-
 
108
    free_R_HOME(RHome);
106
    R_set_command_line_arguments(argc, argv);
109
    R_set_command_line_arguments(argc, argv);
107
 
110
 
108
    FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
111
    FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
109
 
112
 
110
    signal(SIGBREAK, my_onintr);
113
    signal(SIGBREAK, my_onintr);