| 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) 1995, 1996 Robert Gentleman and Ross Ihaka
|
3 |
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
|
| 4 |
* Copyright (C) 1998--2012 The R Core Team
|
4 |
* Copyright (C) 1998--2013 The R Core Team
|
| 5 |
*
|
5 |
*
|
| 6 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* This program is free software; you can redistribute it and/or modify
|
| 7 |
* it under the terms of the GNU General Public License as published by
|
7 |
* it under the terms of the GNU General Public License as published by
|
| 8 |
* the Free Software Foundation; either version 2 of the License, or
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
| 9 |
* (at your option) any later version.
|
9 |
* (at your option) any later version.
|
| Line 29... |
Line 29... |
| 29 |
void attribute_hidden PrintGreeting(void)
|
29 |
void attribute_hidden PrintGreeting(void)
|
| 30 |
{
|
30 |
{
|
| 31 |
char buf[384];
|
31 |
char buf[384];
|
| 32 |
|
32 |
|
| 33 |
Rprintf("\n");
|
33 |
Rprintf("\n");
|
| 34 |
PrintVersion_part_1(buf);
|
34 |
PrintVersion_part_1(buf, 384);
|
| 35 |
Rprintf("%s\n", buf);
|
35 |
Rprintf("%s\n", buf);
|
| 36 |
|
36 |
|
| 37 |
Rprintf(_("R is free software and comes with ABSOLUTELY NO WARRANTY.\n\
|
37 |
Rprintf(_("R is free software and comes with ABSOLUTELY NO WARRANTY.\n\
|
| 38 |
You are welcome to redistribute it under certain conditions.\n\
|
38 |
You are welcome to redistribute it under certain conditions.\n\
|
| 39 |
Type 'license()' or 'licence()' for distribution details.\n\n"));
|
39 |
Type 'license()' or 'licence()' for distribution details.\n\n"));
|
| Line 59... |
Line 59... |
| 59 |
SET_STRING_ELT(names, 1, mkChar("arch"));
|
59 |
SET_STRING_ELT(names, 1, mkChar("arch"));
|
| 60 |
SET_VECTOR_ELT(value, 1, mkString(R_CPU));
|
60 |
SET_VECTOR_ELT(value, 1, mkString(R_CPU));
|
| 61 |
SET_STRING_ELT(names, 2, mkChar("os"));
|
61 |
SET_STRING_ELT(names, 2, mkChar("os"));
|
| 62 |
SET_VECTOR_ELT(value, 2, mkString(R_OS));
|
62 |
SET_VECTOR_ELT(value, 2, mkString(R_OS));
|
| 63 |
|
63 |
|
| 64 |
sprintf(buf,"%s, %s", R_CPU, R_OS);
|
64 |
snprintf(buf, 128, "%s, %s", R_CPU, R_OS);
|
| 65 |
SET_STRING_ELT(names, 3, mkChar("system"));
|
65 |
SET_STRING_ELT(names, 3, mkChar("system"));
|
| 66 |
SET_VECTOR_ELT(value, 3, mkString(buf));
|
66 |
SET_VECTOR_ELT(value, 3, mkString(buf));
|
| 67 |
|
67 |
|
| 68 |
SET_STRING_ELT(names, 4, mkChar("status"));
|
68 |
SET_STRING_ELT(names, 4, mkChar("status"));
|
| 69 |
SET_VECTOR_ELT(value, 4, mkString(R_STATUS));
|
69 |
SET_VECTOR_ELT(value, 4, mkString(R_STATUS));
|
| Line 77... |
Line 77... |
| 77 |
SET_VECTOR_ELT(value, 8, mkString(R_MONTH));
|
77 |
SET_VECTOR_ELT(value, 8, mkString(R_MONTH));
|
| 78 |
SET_STRING_ELT(names, 9, mkChar("day"));
|
78 |
SET_STRING_ELT(names, 9, mkChar("day"));
|
| 79 |
SET_VECTOR_ELT(value, 9, mkString(R_DAY));
|
79 |
SET_VECTOR_ELT(value, 9, mkString(R_DAY));
|
| 80 |
SET_STRING_ELT(names, 10, mkChar("svn rev"));
|
80 |
SET_STRING_ELT(names, 10, mkChar("svn rev"));
|
| 81 |
|
81 |
|
| 82 |
sprintf(buf,"%d", R_SVN_REVISION);
|
82 |
snprintf(buf, 128, "%d", R_SVN_REVISION);
|
| 83 |
SET_VECTOR_ELT(value, 10, mkString(buf));
|
83 |
SET_VECTOR_ELT(value, 10, mkString(buf));
|
| 84 |
SET_STRING_ELT(names, 11, mkChar("language"));
|
84 |
SET_STRING_ELT(names, 11, mkChar("language"));
|
| 85 |
SET_VECTOR_ELT(value, 11, mkString("R"));
|
85 |
SET_VECTOR_ELT(value, 11, mkString("R"));
|
| 86 |
|
86 |
|
| 87 |
PrintVersionString(buf);
|
87 |
PrintVersionString(buf, 128);
|
| 88 |
SET_STRING_ELT(names, 12, mkChar("version.string"));
|
88 |
SET_STRING_ELT(names, 12, mkChar("version.string"));
|
| 89 |
SET_VECTOR_ELT(value, 12, mkString(buf));
|
89 |
SET_VECTOR_ELT(value, 12, mkString(buf));
|
| 90 |
SET_STRING_ELT(names, 13, mkChar("nickname"));
|
90 |
SET_STRING_ELT(names, 13, mkChar("nickname"));
|
| 91 |
SET_VECTOR_ELT(value, 13, mkString(R_NICK));
|
91 |
SET_VECTOR_ELT(value, 13, mkString(R_NICK));
|
| 92 |
|
92 |
|
| 93 |
setAttrib(value, R_NamesSymbol, names);
|
93 |
setAttrib(value, R_NamesSymbol, names);
|
| 94 |
UNPROTECT(2);
|
94 |
UNPROTECT(2);
|
| 95 |
return value;
|
95 |
return value;
|
| 96 |
}
|
96 |
}
|
| 97 |
|
97 |
|
| 98 |
void attribute_hidden PrintVersion(char *s)
|
98 |
void attribute_hidden PrintVersion(char *s, size_t len)
|
| 99 |
{
|
99 |
{
|
| 100 |
PrintVersion_part_1(s);
|
100 |
PrintVersion_part_1(s, len);
|
| 101 |
|
101 |
|
| 102 |
strcat(s, "\n"
|
102 |
strcat(s, "\n"
|
| 103 |
"R is free software and comes with ABSOLUTELY NO WARRANTY.\n"
|
103 |
"R is free software and comes with ABSOLUTELY NO WARRANTY.\n"
|
| 104 |
"You are welcome to redistribute it under the terms of the\n"
|
104 |
"You are welcome to redistribute it under the terms of the\n"
|
| 105 |
"GNU General Public License versions 2 or 3.\n"
|
105 |
"GNU General Public License versions 2 or 3.\n"
|
| 106 |
"For more information about these matters see\n"
|
106 |
"For more information about these matters see\n"
|
| 107 |
"http://www.gnu.org/licenses/.\n");
|
107 |
"http://www.gnu.org/licenses/.\n");
|
| 108 |
}
|
108 |
}
|
| 109 |
|
109 |
|
| 110 |
void attribute_hidden PrintVersionString(char *s)
|
110 |
void attribute_hidden PrintVersionString(char *s, size_t len)
|
| 111 |
{
|
111 |
{
|
| 112 |
if(R_SVN_REVISION <= 0) {// 'svn info' failed in ../../Makefile.in
|
112 |
if(R_SVN_REVISION <= 0) {// 'svn info' failed in ../../Makefile.in
|
| 113 |
sprintf(s, "R version %s.%s %s (%s-%s-%s)",
|
113 |
snprintf(s, len, "R version %s.%s %s (%s-%s-%s)",
|
| 114 |
R_MAJOR, R_MINOR, R_STATUS, R_YEAR, R_MONTH, R_DAY);
|
114 |
R_MAJOR, R_MINOR, R_STATUS, R_YEAR, R_MONTH, R_DAY);
|
| 115 |
} else if(strlen(R_STATUS) == 0) {
|
115 |
} else if(strlen(R_STATUS) == 0) {
|
| 116 |
sprintf(s, "R version %s.%s (%s-%s-%s)",
|
116 |
snprintf(s, len, "R version %s.%s (%s-%s-%s)",
|
| 117 |
R_MAJOR, R_MINOR, R_YEAR, R_MONTH, R_DAY);
|
117 |
R_MAJOR, R_MINOR, R_YEAR, R_MONTH, R_DAY);
|
| 118 |
} else if(strcmp(R_STATUS, "Under development (unstable)") == 0) {
|
118 |
} else if(strcmp(R_STATUS, "Under development (unstable)") == 0) {
|
| 119 |
sprintf(s, "R %s (%s-%s-%s r%d)",
|
119 |
snprintf(s, len, "R %s (%s-%s-%s r%d)",
|
| 120 |
R_STATUS, R_YEAR, R_MONTH, R_DAY, R_SVN_REVISION);
|
120 |
R_STATUS, R_YEAR, R_MONTH, R_DAY, R_SVN_REVISION);
|
| 121 |
} else {
|
121 |
} else {
|
| 122 |
sprintf(s, "R version %s.%s %s (%s-%s-%s r%d)",
|
122 |
snprintf(s, len, "R version %s.%s %s (%s-%s-%s r%d)",
|
| 123 |
R_MAJOR, R_MINOR, R_STATUS, R_YEAR, R_MONTH, R_DAY,
|
123 |
R_MAJOR, R_MINOR, R_STATUS, R_YEAR, R_MONTH, R_DAY,
|
| 124 |
R_SVN_REVISION);
|
124 |
R_SVN_REVISION);
|
| 125 |
}
|
125 |
}
|
| 126 |
}
|
126 |
}
|
| 127 |
|
127 |
|
| 128 |
void attribute_hidden PrintVersion_part_1(char *s)
|
128 |
void attribute_hidden PrintVersion_part_1(char *s, size_t len)
|
| 129 |
{
|
129 |
{
|
| 130 |
#define SPRINTF_2(_FMT, _OBJ) sprintf(tmp, _FMT, _OBJ); strcat(s, tmp)
|
130 |
#define SPRINTF_2(_FMT, _OBJ) snprintf(tmp, 128, _FMT, _OBJ); strcat(s, tmp)
|
| 131 |
char tmp[128];
|
131 |
char tmp[128];
|
| 132 |
|
132 |
|
| 133 |
PrintVersionString(s);
|
133 |
PrintVersionString(s, len);
|
| 134 |
if(strlen(R_NICK) != 0) {
|
134 |
if(strlen(R_NICK) != 0) {
|
| 135 |
char nick[64];
|
135 |
char nick[128];
|
| 136 |
sprintf(nick, " -- \"%s\"", R_NICK);
|
136 |
snprintf(nick, 128, " -- \"%s\"", R_NICK);
|
| 137 |
strcat(s, nick);
|
137 |
strcat(s, nick);
|
| 138 |
}
|
138 |
}
|
| 139 |
SPRINTF_2("\nCopyright (C) %s The R Foundation for Statistical Computing\n",
|
139 |
SPRINTF_2("\nCopyright (C) %s The R Foundation for Statistical Computing\n",
|
| 140 |
R_YEAR);
|
140 |
R_YEAR);
|
| 141 |
/* strcat(s, "ISBN 3-900051-07-0\n"); */
|
141 |
/* strcat(s, "ISBN 3-900051-07-0\n"); */
|