The R Project SVN R

Rev

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

Rev 37001 Rev 37088
Line 98... Line 98...
98
	SET_CLOENV(c, rho);
98
	SET_CLOENV(c, rho);
99
    UNPROTECT(3);
99
    UNPROTECT(3);
100
    return c;
100
    return c;
101
}
101
}
102
 
102
 
103
/* mkChar - make a character (CHARSXP) variable */
103
/* mkChar - make a character (CHARSXP) variable -- see Rinlinedfuns.h */
104
 
-
 
105
SEXP mkChar(const char *name)
-
 
106
{
-
 
107
    SEXP c;
-
 
108
 
-
 
109
#if 0
-
 
110
    if (streql(name, "NA"))
-
 
111
	return (NA_STRING);
-
 
112
#endif
-
 
113
    c = allocString(strlen(name));
-
 
114
    strcpy(CHAR(c), name);
-
 
115
    return c;
-
 
116
}
-
 
117
 
-
 
118
 
104
 
119
/*  mkSYMSXP - return a symsxp with the string  */
105
/*  mkSYMSXP - return a symsxp with the string  */
120
/*             name inserted in the name field  */
106
/*             name inserted in the name field  */
121
 
107
 
122
static int isDDName(SEXP name)
108
static int isDDName(SEXP name)
Line 148... Line 134...
148
    SET_SYMVALUE(c, value);
134
    SET_SYMVALUE(c, value);
149
    SET_DDVAL(c, i);
135
    SET_DDVAL(c, i);
150
    UNPROTECT(2);
136
    UNPROTECT(2);
151
    return c;
137
    return c;
152
}
138
}
153
 
-
 
154
 
-
 
155
/*  length - length of objects  */
-
 
156
 
-
 
157
R_len_t length(SEXP s)
-
 
158
{
-
 
159
    int i;
-
 
160
    switch (TYPEOF(s)) {
-
 
161
    case NILSXP:
-
 
162
	return 0;
-
 
163
    case LGLSXP:
-
 
164
    case INTSXP:
-
 
165
    case REALSXP:
-
 
166
    case CPLXSXP:
-
 
167
    case STRSXP:
-
 
168
    case CHARSXP:
-
 
169
    case VECSXP:
-
 
170
    case EXPRSXP:
-
 
171
    case RAWSXP:
-
 
172
	return LENGTH(s);
-
 
173
    case LISTSXP:
-
 
174
    case LANGSXP:
-
 
175
    case DOTSXP:
-
 
176
	i = 0;
-
 
177
	while (s != NULL && s != R_NilValue) {
-
 
178
	    i++;
-
 
179
	    s = CDR(s);
-
 
180
	}
-
 
181
	return i;
-
 
182
    case ENVSXP:
-
 
183
	return envlength(s);
-
 
184
    default:
-
 
185
	return 1;
-
 
186
    }
-
 
187
}
-