The R Project SVN R

Rev

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

Rev 43238 Rev 45070
Line 44... Line 44...
44
    int i, count, len;
44
    int i, count, len;
45
 
45
 
46
    len = strlen(buf);
46
    len = strlen(buf);
47
    count = 8 - (offset + *loc) % 8;
47
    count = 8 - (offset + *loc) % 8;
48
    for (i=len; i >= *loc; i--)
48
    for (i=len; i >= *loc; i--)
49
        buf[i+count] = buf[i];
49
	buf[i+count] = buf[i];
50
    for (i=0; i < count; i++)
50
    for (i=0; i < count; i++)
51
        buf[*loc+i] = ' ';
51
	buf[*loc+i] = ' ';
52
    i = *loc;
52
    i = *loc;
53
    *loc = i + count;
53
    *loc = i + count;
54
    return i;
54
    return i;
55
}
55
}
56
 
56
 
Line 62... Line 62...
62
    char *pline, *cmd;
62
    char *pline, *cmd;
63
    SEXP cmdSexp, cmdexpr, ans = R_NilValue;
63
    SEXP cmdSexp, cmdexpr, ans = R_NilValue;
64
    ParseStatus status;
64
    ParseStatus status;
65
 
65
 
66
    if(!completion_available) return gl_tab(buf, offset, loc);
66
    if(!completion_available) return gl_tab(buf, offset, loc);
67
    
67
 
68
    if(completion_available < 0) {
68
    if(completion_available < 0) {
69
	char *p = getenv("R_COMPLETION");
69
	char *p = getenv("R_COMPLETION");
70
	if(p && strcmp(p, "FALSE") == 0) {
70
	if(p && strcmp(p, "FALSE") == 0) {
71
	    completion_available = 0;
71
	    completion_available = 0;
72
	    return gl_tab(buf, offset, loc);   
72
	    return gl_tab(buf, offset, loc);
73
	}
73
	}
74
	/* First check if namespace is loaded */
74
	/* First check if namespace is loaded */
75
	if(findVarInFrame(R_NamespaceRegistry, install("utils"))
75
	if(findVarInFrame(R_NamespaceRegistry, install("utils"))
76
	   != R_UnboundValue) completion_available = 1;
76
	   != R_UnboundValue) completion_available = 1;
77
	else { /* Then try to load it */
77
	else { /* Then try to load it */
Line 113... Line 113...
113
    }
113
    }
114
    /* Loop is needed here as EXPRSEXP will be of length > 1 */
114
    /* Loop is needed here as EXPRSEXP will be of length > 1 */
115
    for(i = 0; i < length(cmdexpr); i++)
115
    for(i = 0; i < length(cmdexpr); i++)
116
	ans = eval(VECTOR_ELT(cmdexpr, i), R_GlobalEnv);
116
	ans = eval(VECTOR_ELT(cmdexpr, i), R_GlobalEnv);
117
    UNPROTECT(2);
117
    UNPROTECT(2);
118
    
118
 
119
    /* ans has the form list(addition, possible), where 'addition' is
119
    /* ans has the form list(addition, possible), where 'addition' is
120
       unique additional text if any, and 'possible' is a character
120
       unique additional text if any, and 'possible' is a character
121
       vector holding possible completions if any (already formatted
121
       vector holding possible completions if any (already formatted
122
       for linewise printing in the current implementation).  If
122
       for linewise printing in the current implementation).  If
123
       'possible' has any content, we want to print those (or show in
123
       'possible' has any content, we want to print those (or show in