Small corrections for handling C99 _Complex
This commit is contained in:
parent
13260f95b0
commit
1adc7dac5d
7 changed files with 6 additions and 18 deletions
|
|
@ -72,15 +72,15 @@
|
|||
|
||||
%inline
|
||||
{
|
||||
complex Conj(complex a)
|
||||
double complex Conj(complex a)
|
||||
{
|
||||
return conj(a);
|
||||
}
|
||||
|
||||
|
||||
complex float Conjf(float complex a)
|
||||
float complex Conjf(float complex a)
|
||||
{
|
||||
return conj(a);
|
||||
return conjf(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
|
||||
%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
|
||||
|
||||
/* declaring the typemaps */
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
|
||||
%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
|
||||
|
||||
/* declaring the typemaps */
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
|
||||
%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
|
||||
|
||||
/* declaring the typemaps */
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
|
||||
|
|
|
|||
|
|
@ -908,10 +908,6 @@ int yylex(void) {
|
|||
if (strcmp(yytext, "class") == 0) {
|
||||
Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");
|
||||
}
|
||||
if (strcmp(yytext, "complex") == 0) {
|
||||
yylval.type = NewSwigType(T_COMPLEX);
|
||||
return (TYPE_COMPLEX);
|
||||
}
|
||||
if (strcmp(yytext, "_Complex") == 0) {
|
||||
yylval.type = NewSwigType(T_COMPLEX);
|
||||
return (TYPE_COMPLEX);
|
||||
|
|
|
|||
|
|
@ -6232,18 +6232,18 @@ primitive_type_list : type_specifier {
|
|||
} else if (Cmp($1.type,"double") == 0) {
|
||||
if (Cmp($2.type,"long") == 0) {
|
||||
$$.type = NewString("long double");
|
||||
} else if (Cmp($2.type,"complex") == 0 || Cmp($2.type,"_Complex") == 0) {
|
||||
} else if (Cmp($2.type,"_Complex") == 0) {
|
||||
$$.type = NewString("double _Complex");
|
||||
} else {
|
||||
err = 1;
|
||||
}
|
||||
} else if (Cmp($1.type,"float") == 0) {
|
||||
if (Cmp($2.type,"complex") == 0 || Cmp($2.type,"_Complex") == 0) {
|
||||
if (Cmp($2.type,"_Complex") == 0) {
|
||||
$$.type = NewString("float _Complex");
|
||||
} else {
|
||||
err = 1;
|
||||
}
|
||||
} else if (Cmp($1.type,"complex") == 0 || Cmp($1.type,"_Complex") == 0) {
|
||||
} else if (Cmp($1.type,"_Complex") == 0) {
|
||||
$$.type = NewStringf("%s _Complex", $2.type);
|
||||
} else {
|
||||
err = 1;
|
||||
|
|
|
|||
|
|
@ -1457,8 +1457,6 @@ int SwigType_type(const SwigType *t) {
|
|||
return T_FLTCPLX;
|
||||
if (!cparse_cplusplus && (strcmp(c, "double _Complex") == 0))
|
||||
return T_DBLCPLX;
|
||||
if (!cparse_cplusplus && (strcmp(c, "complex") == 0))
|
||||
return T_COMPLEX;
|
||||
if (strcmp(c, "void") == 0)
|
||||
return T_VOID;
|
||||
if (strcmp(c, "bool") == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue