The R Project SVN R

Rev

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

Rev 10740 Rev 12976
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Langage for Statistical Data Analysis
2
 *  R : A Computer Langage 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) 2001  The R Development Core Team
4
 *
5
 *
5
 *  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
6
 *  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
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 106... Line 107...
106
/*             name inserted in the name field  */
107
/*             name inserted in the name field  */
107
 
108
 
108
static int ddVal(SEXP name)
109
static int ddVal(SEXP name)
109
{
110
{
110
    char *buf, *endp;
111
    char *buf, *endp;
111
    int rval;
-
 
112
 
112
 
113
    buf = CHAR(name);
113
    buf = CHAR(name);
114
    if( !strncmp(buf,"..",2) && strlen(buf) > 2 ) {
114
    if( !strncmp(buf,"..",2) && strlen(buf) > 2 ) {
115
        buf += 2;
115
        buf += 2;
116
	rval = strtol(buf, &endp, 10);
116
	strtol(buf, &endp, 10);
117
        if( *endp != '\0')
117
        if( *endp != '\0')
118
		return 0;
118
	    return 0;
119
	else
119
	else
120
		return 1;
120
	    return 1;
121
    }
121
    }
122
    return 0;
122
    return 0;
123
}
123
}
124
 
124
 
125
SEXP mkSYMSXP(SEXP name, SEXP value)
125
SEXP mkSYMSXP(SEXP name, SEXP value)
126
 
126
 
127
{
127
{
128
	SEXP c;
128
    SEXP c;
129
	int i;
129
    int i;
130
	PROTECT(name);
130
    PROTECT(name);
131
	PROTECT(value);
131
    PROTECT(value);
132
	i = ddVal(name);
132
    i = ddVal(name);
133
	c = allocSExp(SYMSXP);
133
    c = allocSExp(SYMSXP);
134
	SET_PRINTNAME(c, name);
134
    SET_PRINTNAME(c, name);
135
	SET_SYMVALUE(c, value);
135
    SET_SYMVALUE(c, value);
136
	SET_DDVAL(c, i);
136
    SET_DDVAL(c, i);
137
	UNPROTECT(2);
137
    UNPROTECT(2);
138
	return c;
138
    return c;
139
}
139
}
140
 
140
 
141
 
141
 
142
/*  length - length of objects  */
142
/*  length - length of objects  */
143
 
143