Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and (char *STRING, int LENGTH) - Java patch is from Volker Grabsch. Elements of the primitive_types.i testcase for this moved into char_binary.i. Documentation for this enhanced.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12393 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9adb494558
commit
ef865e06d5
15 changed files with 194 additions and 37 deletions
|
|
@ -538,7 +538,7 @@ $result = C_SCHEME_UNDEFINED;
|
|||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH) {
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
if ($input == C_SCHEME_FALSE) {
|
||||
swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Cannot use a null/#f string for a char*, int arguments");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ typedef unsigned long SCM;
|
|||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH) {
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
size_t temp;
|
||||
$1 = ($1_ltype) gh_scm2newstr($input, &temp);
|
||||
$2 = ($2_ltype) temp;
|
||||
|
|
|
|||
|
|
@ -1290,6 +1290,21 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
||||
/* String & length */
|
||||
%typemap(jni) (char *STRING, size_t LENGTH) "jbyteArray"
|
||||
%typemap(jtype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(jstype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(javain) (char *STRING, size_t LENGTH) "$javainput"
|
||||
%typemap(freearg) (char *STRING, size_t LENGTH) ""
|
||||
%typemap(in) (char *STRING, size_t LENGTH) {
|
||||
$1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0);
|
||||
$2 = (size_t) JCALL1(GetArrayLength, jenv, $input);
|
||||
}
|
||||
%typemap(argout) (char *STRING, size_t LENGTH) {
|
||||
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
}
|
||||
%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
|
||||
|
||||
/* java keywords */
|
||||
%include <javakw.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@
|
|||
$1 = ($1_ltype) Z_STRVAL_PP($input);
|
||||
}
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH)
|
||||
{
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
convert_to_string_ex($input);
|
||||
$1 = ($1_ltype) Z_STRVAL_PP($input);
|
||||
$2 = ($2_ltype) Z_STRLEN_PP($input);
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ extern "C" {
|
|||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in, pikedesc="tStr") (char *STRING, int LENGTH) {
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
if ($input.type != T_STRING)
|
||||
Pike_error("Bad argument: Expected a string.\n");
|
||||
$1 = ($1_ltype) STR0($input.u.string);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue