add %typemap(LANG,..) warning 1387184

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8220 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-05 19:48:55 +00:00
commit aca35dbcde
5 changed files with 19 additions and 15 deletions

View file

@ -15,9 +15,9 @@ extern int squareCubed (int n, int *OUTPUT);
extern int gcd(int x, int y);
%typemap(perl5,arginit) (int argc, char *argv[]) "$2 = 0;";
%typemap(arginit) (int argc, char *argv[]) "$2 = 0;";
%typemap(perl5,in) (int argc, char *argv[]) {
%typemap(in) (int argc, char *argv[]) {
AV *tempav;
SV **tv;
I32 len;
@ -39,13 +39,13 @@ extern int gcd(int x, int y);
$2[i] = 0;
}
%typemap(perl5,freearg) (int argc, char *argv[]) {
%typemap(freearg) (int argc, char *argv[]) {
free($2);
}
extern int gcdmain(int argc, char *argv[]);
%typemap(perl5,in) (char *bytes, int len) {
%typemap(in) (char *bytes, int len) {
STRLEN temp;
$1 = (char *) SvPV($input, temp);
$2 = (int) temp;
@ -56,7 +56,7 @@ extern int count(char *bytes, int len, char c);
/* This example shows how to wrap a function that mutates a string */
%typemap(perl5,in) (char *str, int len) {
%typemap(in) (char *str, int len) {
STRLEN templen;
char *temp;
temp = (char *) SvPV($input,templen);
@ -67,7 +67,7 @@ extern int count(char *bytes, int len, char c);
/* Return the mutated string as a new object. */
%typemap(perl5,argout) (char *str, int len) {
%typemap(argout) (char *str, int len) {
if (argvi >= items) {
EXTEND(sp,1);
}

View file

@ -38,7 +38,7 @@ extern int gcd(int x, int y);
extern int gcdmain(int argc, char *argv[]);
%typemap(python,in) (char *bytes, int len) {
%typemap(in) (char *bytes, int len) {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_ValueError,"Expected a string");
return NULL;
@ -55,7 +55,7 @@ extern int count(char *bytes, int len, char c);
/* Since str is modified, we make a copy of the Python object
so that we don't violate it's mutability */
%typemap(python,in) (char *str, int len) {
%typemap(in) (char *str, int len) {
$2 = PyString_Size($input);
$1 = (char *) malloc($2+1);
memmove($1,PyString_AsString($input),$2);
@ -65,7 +65,7 @@ extern int count(char *bytes, int len, char c);
function takes an object and appends it to the output object
to create a tuple */
%typemap(python,argout) (char *str, int len) {
%typemap(argout) (char *str, int len) {
PyObject *o;
o = PyString_FromStringAndSize($1,$2);
$result = t_output_helper($result,o);

View file

@ -14,9 +14,9 @@ extern int squareCubed (int n, int *OUTPUT);
extern int gcd(int x, int y);
%typemap(tcl8,arginit) (int argc, char *argv[]) "$2 = 0;";
%typemap(arginit) (int argc, char *argv[]) "$2 = 0;";
%typemap(tcl8,in) (int argc, char *argv[]) {
%typemap(in) (int argc, char *argv[]) {
Tcl_Obj **listobjv = 0;
int i;
if (Tcl_ListObjGetElements(interp,$input, &$1, &listobjv) == TCL_ERROR) {
@ -30,7 +30,7 @@ extern int gcd(int x, int y);
$2[i] = 0;
}
%typemap(tcl8,freearg) char *argv[] {
%typemap(freearg) char *argv[] {
if ($1) {
free($1);
}
@ -38,7 +38,7 @@ extern int gcd(int x, int y);
extern int gcdmain(int argc, char *argv[]);
%typemap(tcl8,in) (char *bytes, int len) {
%typemap(in) (char *bytes, int len) {
$1 = Tcl_GetStringFromObj($input,&$2);
}
@ -47,7 +47,7 @@ extern int count(char *bytes, int len, char c);
/* This example shows how to wrap a function that mutates a string */
%typemap(tcl8,in) (char *str, int len) {
%typemap(in) (char *str, int len) {
char *temp;
temp = Tcl_GetStringFromObj($input,&$2);
$1 = (char *) malloc($2+1);
@ -56,7 +56,7 @@ extern int count(char *bytes, int len, char c);
/* Return the mutated string as a new object. */
%typemap(tcl8,argout) (char *str, int len) {
%typemap(argout) (char *str, int len) {
Tcl_Obj *o;
o = Tcl_NewStringObj($1,$2);
Tcl_ListObjAppendElement(interp,$result,o);

View file

@ -2333,6 +2333,9 @@ typemap_type : kwargs {
String *name;
p = nextSibling($1);
if (p && (!Getattr(p,k_value))) {
/* this is the deprecated two argument typemap form */
Swig_warning(WARN_DEPRECATED_TYPEMAP_LANG,cparse_file, cparse_line,
"Specifying the language name in %%typemap is deprecated - use #ifdef SWIG<LANG> instead.\n");
/* two argument typemap form */
name = Getattr($1,k_name);
if (!name || (Strcmp(name,typemap_lang))) {

View file

@ -45,6 +45,7 @@
#define WARN_DEPRECATED_NAME 121
#define WARN_DEPRECATED_NOEXTERN 122
#define WARN_DEPRECATED_NODEFAULT 123
#define WARN_DEPRECATED_TYPEMAP_LANG 124
/* -- Preprocessor -- */