The R Project SVN R

Rev

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

Rev 33297 Rev 33494
Line 418... Line 418...
418
    switch (saveact) {
418
    switch (saveact) {
419
    case SA_SAVE:
419
    case SA_SAVE:
420
	if(runLast) R_dot_Last();
420
	if(runLast) R_dot_Last();
421
	if(R_DirtyImage) R_SaveGlobalEnv();
421
	if(R_DirtyImage) R_SaveGlobalEnv();
422
	if (CharacterMode == RGui ||
422
	if (CharacterMode == RGui ||
423
	    (R_Interactive && CharacterMode == RTerm))
423
	    (R_Interactive && CharacterMode == RTerm)) {
-
 
424
	    R_setupHistory(); /* re-read the history size and filename */
424
	    gl_savehistory(R_HistoryFile);
425
	    gl_savehistory(R_HistoryFile, R_HistorySize);
-
 
426
	}
425
	break;
427
	break;
426
    case SA_NOSAVE:
428
    case SA_NOSAVE:
427
	if(runLast) R_dot_Last();
429
	if(runLast) R_dot_Last();
428
	break;
430
	break;
429
    case SA_SUICIDE:
431
    case SA_SUICIDE:
Line 716... Line 718...
716
    strcat(msg, msg3);
718
    strcat(msg, msg3);
717
    if(CharacterMode == RTerm) strcat(msg, msg4);
719
    if(CharacterMode == RTerm) strcat(msg, msg4);
718
    return msg;
720
    return msg;
719
}
721
}
720
 
722
 
-
 
723
void R_setupHistory()
-
 
724
{
-
 
725
    int value, ierr;
-
 
726
    char *p;
721
 
727
 
-
 
728
    if ((R_HistoryFile = getenv("R_HISTFILE")) == NULL)
-
 
729
        R_HistoryFile = ".Rhistory";
-
 
730
    R_HistorySize = 512;
-
 
731
    if ((p = getenv("R_HISTSIZE"))) {
-
 
732
        value = R_Decode2Long(p, &ierr);
-
 
733
        if (ierr != 0 || value < 0)
-
 
734
            R_ShowMessage("WARNING: invalid R_HISTSIZE ignored;");
-
 
735
        else
-
 
736
            R_HistorySize = value;
-
 
737
    }
-
 
738
}
722
 
739
 
723
int cmdlineoptions(int ac, char **av)
740
int cmdlineoptions(int ac, char **av)
724
{
741
{
725
    int   i, ierr;
742
    int   i, ierr;
726
    R_size_t value;
743
    R_size_t value;
Line 925... Line 942...
925
    if (InThreadReadConsole &&
942
    if (InThreadReadConsole &&
926
        (!(EhiWakeUp = CreateEvent(NULL, FALSE, FALSE, NULL)) ||
943
        (!(EhiWakeUp = CreateEvent(NULL, FALSE, FALSE, NULL)) ||
927
	 (_beginthread(ReaderThread, 0, NULL) == -1)))
944
	 (_beginthread(ReaderThread, 0, NULL) == -1)))
928
      R_Suicide(_("impossible to create 'reader thread'; you must free some system resources"));
945
      R_Suicide(_("impossible to create 'reader thread'; you must free some system resources"));
929
 
946
 
930
    if ((R_HistoryFile = getenv("R_HISTFILE")) == NULL)
-
 
931
	R_HistoryFile = ".Rhistory";
-
 
932
    R_HistorySize = 512;
947
    R_setupHistory();
933
    if ((p = getenv("R_HISTSIZE"))) {
-
 
934
	int value, ierr;
-
 
935
	value = R_Decode2Long(p, &ierr);
-
 
936
	if (ierr != 0 || value < 0)
-
 
937
	    REprintf(_("WARNING: invalid R_HISTSIZE ignored;"));
-
 
938
	else
-
 
939
	    R_HistorySize = value;
-
 
940
    }
-
 
941
    return 0;
948
    return 0;
942
}
949
}
943
 
950
 
944
void setup_term_ui()
951
void setup_term_ui()
945
{
952
{