The R Project SVN R-packages

Rev

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

Rev 1363 Rev 1499
Line 27... Line 27...
27
 *  Suite 330, Boston, MA  02111-1307  USA.
27
 *  Suite 330, Boston, MA  02111-1307  USA.
28
 */
28
 */
29
 
29
 
30
#import "CodeCompletion.h"
30
#import "CodeCompletion.h"
31
#import "../REngine/REngine.h"
31
#import "../REngine/REngine.h"
-
 
32
#import "RGUI.h"
32
 
33
 
33
@implementation CodeCompletion
34
@implementation CodeCompletion
34
 
35
 
35
+ (NSString*) complete: (NSString*) part {
36
+ (NSString*) complete: (NSString*) part {
-
 
37
	if (preventReentrance && insideR>0) {
-
 
38
		SLog(@"CodeCompletion.complete: returning nil completion to prevent R re-entrance [***]");
-
 
39
		return nil;
-
 
40
	}
36
    REngine *re = [REngine mainEngine];
41
    REngine *re = [REngine mainEngine];
37
    // first get the length of the search path so we can go environment by environment
42
    // first get the length of the search path so we can go environment by environment
38
    RSEXP *x = [re evaluateString:@"length(search())"];
43
    RSEXP *x = [re evaluateString:@"length(search())"];
39
    int pos=1, maxpos;
44
    int pos=1, maxpos;
40
    if (x==nil) return nil;
45
    if (x==nil) return nil;
Line 84... Line 89...
84
    }
89
    }
85
    return nil;
90
    return nil;
86
}
91
}
87
 
92
 
88
+ (NSArray*) completeAll: (NSString*) part cutPrefix: (int) prefix {
93
+ (NSArray*) completeAll: (NSString*) part cutPrefix: (int) prefix {
-
 
94
	if (preventReentrance && insideR>0) {
-
 
95
		SLog(@"CodeCompletion.completeAll: returning nil completion to prevent R re-entrance [***]");
-
 
96
		return nil;
-
 
97
	}
89
    REngine *re = [REngine mainEngine];
98
    REngine *re = [REngine mainEngine];
90
    // first get the length of the search path so we can go environment by environment
99
    // first get the length of the search path so we can go environment by environment
91
    RSEXP *x = [re evaluateString:@"length(search())"];
100
    RSEXP *x = [re evaluateString:@"length(search())"];
92
    int pos=1, maxpos, matches=0;
101
    int pos=1, maxpos, matches=0;
93
	NSMutableArray *ca = nil;
102
	NSMutableArray *ca = nil;