Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
08dc654e
Commit
08dc654e
authored
9 years ago
by
Adam Welc
Browse files
Options
Downloads
Patches
Plain Diff
Implemented some native functions related to type/string conversions.
parent
40f65275
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
com.oracle.truffle.r.native/fficall/src/common/util_fastr.c
+63
-0
63 additions, 0 deletions
com.oracle.truffle.r.native/fficall/src/common/util_fastr.c
com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c
+0
-11
0 additions, 11 deletions
com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c
with
63 additions
and
11 deletions
com.oracle.truffle.r.native/fficall/src/common/util_fastr.c
+
63
−
0
View file @
08dc654e
...
...
@@ -18,6 +18,69 @@
// selected functions from util.c:
const
static
struct
{
const
char
*
const
str
;
const
int
type
;
}
TypeTable
[]
=
{
{
"NULL"
,
NILSXP
},
/* real types */
{
"symbol"
,
SYMSXP
},
{
"pairlist"
,
LISTSXP
},
{
"closure"
,
CLOSXP
},
{
"environment"
,
ENVSXP
},
{
"promise"
,
PROMSXP
},
{
"language"
,
LANGSXP
},
{
"special"
,
SPECIALSXP
},
{
"builtin"
,
BUILTINSXP
},
{
"char"
,
CHARSXP
},
{
"logical"
,
LGLSXP
},
{
"integer"
,
INTSXP
},
{
"double"
,
REALSXP
},
/*- "real", for R <= 0.61.x */
{
"complex"
,
CPLXSXP
},
{
"character"
,
STRSXP
},
{
"..."
,
DOTSXP
},
{
"any"
,
ANYSXP
},
{
"expression"
,
EXPRSXP
},
{
"list"
,
VECSXP
},
{
"externalptr"
,
EXTPTRSXP
},
{
"bytecode"
,
BCODESXP
},
{
"weakref"
,
WEAKREFSXP
},
{
"raw"
,
RAWSXP
},
{
"S4"
,
S4SXP
},
/* aliases : */
{
"numeric"
,
REALSXP
},
{
"name"
,
SYMSXP
},
{
(
char
*
)
NULL
,
-
1
}
};
const
char
*
Rf_type2char
(
SEXPTYPE
t
)
{
int
i
;
for
(
i
=
0
;
TypeTable
[
i
].
str
;
i
++
)
{
if
(
TypeTable
[
i
].
type
==
t
)
return
TypeTable
[
i
].
str
;
}
warning
(
_
(
"type %d is unimplemented in '%s'"
),
t
,
"type2char"
);
static
char
buf
[
50
];
snprintf
(
buf
,
50
,
"unknown type #%d"
,
t
);
return
buf
;
}
SEXP
Rf_type2str
(
SEXPTYPE
t
)
{
// implementation copied (almost) verbatim from util.c
int
i
;
for
(
i
=
0
;
TypeTable
[
i
].
str
;
i
++
)
{
if
(
TypeTable
[
i
].
type
==
t
)
return
mkChar
(
TypeTable
[
i
].
str
);
}
warning
(
_
(
"type %d is unimplemented in '%s'"
),
t
,
"type2str"
);
char
buf
[
50
];
snprintf
(
buf
,
50
,
"unknown type #%d"
,
t
);
return
Rf_mkChar
(
buf
);
}
void
init_util
()
{
}
...
...
This diff is collapsed.
Click to expand it.
com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c
+
0
−
11
View file @
08dc654e
...
...
@@ -574,17 +574,6 @@ const char *Rf_translateCharUTF8(SEXP x) {
return
NULL
;
}
const
char
*
Rf_type2char
(
SEXPTYPE
x
)
{
unimplemented
(
"Rf_type2char"
);
return
NULL
;
}
SEXP
Rf_type2str
(
SEXPTYPE
x
)
{
unimplemented
(
"Rf_type2str"
);
return
R_NilValue
;
return
NULL
;
}
SEXP
R_FindNamespace
(
SEXP
info
)
{
JNIEnv
*
thisenv
=
getEnv
();
SEXP
result
=
(
*
thisenv
)
->
CallStaticObjectMethod
(
thisenv
,
CallRFFIHelperClass
,
R_FindNamespaceMethodID
,
info
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment