version 1.1.1.2, 2000/01/22 14:16:02 |
version 1.1.1.3, 2003/09/15 07:09:27 |
|
|
|
|
} |
} |
|
|
|
/* Our own version of strdup() |
|
* Make copy of string into gp_alloc'd memory |
|
* As with all conforming str*() functions, |
|
* it is the caller's responsibility to pass |
|
* valid parameters! |
|
*/ |
|
char * |
|
gp_strdup(s) |
|
char *s; |
|
{ |
|
char *d; |
|
|
|
#ifndef HAVE_STRDUP |
|
d = gp_alloc(strlen(s) + 1, "gp_strdup"); |
|
if (d) |
|
memcpy (d, s, strlen(s) + 1); |
|
#else |
|
d = strdup(s); |
|
#endif |
|
return d; |
|
} |
|
|
void convert(val_ptr, t_num) |
void convert(val_ptr, t_num) |
struct value *val_ptr; |
struct value *val_ptr; |
int t_num; |
int t_num; |
Line 413 struct value *val; |
|
Line 434 struct value *val; |
|
{ |
{ |
switch (val->type) { |
switch (val->type) { |
case INTGR: |
case INTGR: |
return ((val->v.int_val >= 0) ? 0.0 : Pi); |
return ((val->v.int_val >= 0) ? 0.0 : M_PI); |
case CMPLX: |
case CMPLX: |
if (val->v.cmplx_val.imag == 0.0) { |
if (val->v.cmplx_val.imag == 0.0) { |
if (val->v.cmplx_val.real >= 0.0) |
if (val->v.cmplx_val.real >= 0.0) |
return (0.0); |
return (0.0); |
else |
else |
return (Pi); |
return (M_PI); |
} |
} |
return (atan2(val->v.cmplx_val.imag, |
return (atan2(val->v.cmplx_val.imag, |
val->v.cmplx_val.real)); |
val->v.cmplx_val.real)); |