The R Project SVN R-packages

Rev

Rev 7115 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7115 Rev 8423
Line 26... Line 26...
26
#include <string.h>
26
#include <string.h>
27
#include <math.h>
27
#include <math.h>
28
#include "shapefil.h"
28
#include "shapefil.h"
29
#include <R.h>
29
#include <R.h>
30
#include <Rinternals.h>
30
#include <Rinternals.h>
-
 
31
#include <R_ext/Visibility.h>
31
#include "foreign.h"
32
#include "foreign.h"
32
 
33
 
-
 
34
Rboolean attribute_hidden validString(SEXP x)
-
 
35
{
-
 
36
    return TYPEOF(x) == STRSXP && LENGTH(x) > 0
-
 
37
           && TYPEOF(STRING_ELT(x, 0)) != NILSXP;
-
 
38
}
33
 
39
 
34
static DBFHandle Rdbfwrite(DBFHandle, SEXP, SEXP, SEXP, SEXP);
40
static DBFHandle Rdbfwrite(DBFHandle, SEXP, SEXP, SEXP, SEXP);
35
 
41
 
36
static char* nameMangleOut(char *dbfFldname, int len)
42
static char* nameMangleOut(char *dbfFldname, int len)
37
{
43
{
Line 44... Line 50...
44
 
50
 
45
SEXP DoWritedbf(SEXP file, SEXP df, SEXP pr, SEXP sc, SEXP DataTypes)
51
SEXP DoWritedbf(SEXP file, SEXP df, SEXP pr, SEXP sc, SEXP DataTypes)
46
{
52
{
47
    DBFHandle hDBF;
53
    DBFHandle hDBF;
48
 
54
 
49
    if (!isValidString(file))
55
    if (!validString(file))
50
	error (_("first argument must be a file name"));
56
	error (_("first argument must be a file name"));
51
 
57
 
52
    hDBF = DBFCreate(R_ExpandFileName(CHAR(STRING_ELT(file, 0))));
58
    hDBF = DBFCreate(R_ExpandFileName(CHAR(STRING_ELT(file, 0))));
53
    if (hDBF == NULL) error(_("unable to open file"));
59
    if (hDBF == NULL) error(_("unable to open file"));
54
 
60