The R Project SVN R

Rev

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

Rev 9147 Rev 9317
Line 1816... Line 1816...
1816
	    long *lengths, char **names, long nres, char **results)
1816
	    long *lengths, char **names, long nres, char **results)
1817
{
1817
{
1818
    SEXP call, pcall, s;
1818
    SEXP call, pcall, s;
1819
    SEXPTYPE type;
1819
    SEXPTYPE type;
1820
    int i, j, n;
1820
    int i, j, n;
-
 
1821
    char **cptr;
-
 
1822
 
1821
    if (!isFunction((SEXP)func))
1823
    if (!isFunction((SEXP)func))
1822
	error("invalid function in call_R");
1824
	error("invalid function in call_R");
1823
    if (nargs < 0)
1825
    if (nargs < 0)
1824
	error("invalid argument count in call_R");
1826
	error("invalid argument count in call_R");
1825
    if (nres < 0)
1827
    if (nres < 0)
Line 1849... Line 1851...
1849
	    LENGTH(CAR(pcall)) = lengths[i];
1851
	    LENGTH(CAR(pcall)) = lengths[i];
1850
	    break;
1852
	    break;
1851
	case STRSXP:
1853
	case STRSXP:
1852
	    n = lengths[i];
1854
	    n = lengths[i];
1853
	    CAR(pcall) = allocVector(STRSXP, n);
1855
	    CAR(pcall) = allocVector(STRSXP, n);
1854
	    for (j = 0 ; j < n ; j++) {
-
 
1855
		s = allocSExp(CHARSXP);
-
 
1856
		CHAR(s) = (char*)(arguments[i]);
1856
	    cptr = (char**)arguments[i];
1857
		LENGTH(s) = strlen(CHAR(s));
1857
 	    for (j = 0 ; j < n ; j++) {
1858
		STRING(CAR(pcall))[i] = s;
1858
		STRING(CAR(pcall))[j] = mkChar(cptr[j]);
1859
	    }
1859
 	    }
-
 
1860
	    LENGTH(CAR(pcall)) = n;
1860
	    break;
1861
	    break;
1861
	    /* FIXME : This copy is unnecessary! */
1862
	    /* FIXME : This copy is unnecessary! */
-
 
1863
	    /* FIXME : This is obviously incorrect so disable
1862
	case VECSXP:
1864
	case VECSXP:
1863
	    n = lengths[i];
1865
	    n = lengths[i];
1864
	    CAR(pcall) = allocVector(VECSXP, n);
1866
	    CAR(pcall) = allocVector(VECSXP, n);
1865
	    for (j = 0 ; j < n ; j++) {
1867
	    for (j = 0 ; j < n ; j++) {
1866
		VECTOR(s)[i] = (SEXP)(arguments[i]);
1868
		VECTOR(s)[i] = (SEXP)(arguments[i]);
1867
	    }
1869
	    }
1868
	    break;
1870
	    break; */
-
 
1871
	default:
-
 
1872
	    error("Mode `%s' is not supported in call_R", modes[i]);
1869
	}
1873
	}
1870
	if(names && names[i])
1874
	if(names && names[i])
1871
	    TAG(pcall) = install(names[i]);
1875
	    TAG(pcall) = install(names[i]);
1872
	NAMED(CAR(pcall)) = 2;
1876
	NAMED(CAR(pcall)) = 2;
1873
    }
1877
    }