www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/01/07/14:59:46

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Date: Wed, 7 Jan 2004 14:18:35 +0200 (EET)
From: Esa A E Peuha <peuha AT cc DOT helsinki DOT fi>
Sender: peuha AT sirppi DOT helsinki DOT fi
To: djgpp-workers AT delorie DOT com
Subject: stdbool.h and complex.h
Message-ID: <Pine.OSF.4.58.0401071356580.26260@sirppi.helsinki.fi>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

I have written the headers stdbool.h and complex.h that C99 requires.
stdbool.h doesn't define any functions and is independent of any choice
in compiler (in other words, whatever way gcc chooses to support Boolean
type, it can't affect the contents of stdbool.h), so it could be checked
in at any time:

#ifndef __dj_stdbool__h_
#define __dj_stdbool__h_

#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
  || !defined(__STRICT_ANSI__)

#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1

#endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */

#endif /* !__dj_stdbool__h_ */

complex.h is different: it defines a lot of functions and its contents
do depend on how gcc supports complex math.  Actually gcc now has
sufficient support of complex types, but the functions need to be
written, and some of them are highly nontrivial.  Can I commit complex.h
now and the functions later as I write them, or should I wait until I
have all of them and then commit at the same time?

#ifndef __dj_complex__h_
#define __dj_complex__h_

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __dj_ENFORCE_ANSI_FREESTANDING

#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
  || !defined(__STRICT_ANSI__)

#define complex _Complex
#define _Complex_I 1.0i

#define I _Complex_I

double complex      conj(double complex _z);
float complex       conjf(float complex _z);
long double complex conjl(long double complex _z);
double              creal(double complex _z);
float               crealf(float complex _z);
long double         creall(long double complex _z);
double              cimag(double complex _z);
float               cimagf(float complex _z);
long double         cimagl(long double complex _z);

double complex      cproj(double complex _z);
float complex       cprojf(float complex _z);
long double complex cprojl(long double complex _z);

double              cabs(double complex _z);
float               cabsf(float complex _z);
long double         cabsl(long double complex _z);
double              carg(double complex _z);
float               cargf(float complex _z);
long double         cargl(long double complex _z);

double complex      cpow(double complex _x, double complex _y);
float complex       cpowf(float complex _x, float complex _y);
long double complex cpowl(long double complex _x, long double complex _y);
double complex      csqrt(double complex _z);
float complex       csqrtf(float complex _z);
long double complex csqrtl(long double complex _z);

double complex      cexp(double complex _z);
float complex       cexpf(float complex _z);
long double complex cexpl(long double complex _z);
double complex      clog(double complex _z);
float complex       clogf(float complex _z);
long double complex clogl(long double complex _z);

double complex      cacosh(double complex _z);
float complex       cacoshf(float complex _z);
long double complex cacoshl(long double complex _z);
double complex      casinh(double complex _z);
float complex       casinhf(float complex _z);
long double complex casinhl(long double complex _z);
double complex      catanh(double complex _z);
float complex       catanhf(float complex _z);
long double complex catanhl(long double complex _z);
double complex      ccosh(double complex _z);
float complex       ccoshf(float complex _z);
long double complex ccoshl(long double complex _z);
double complex      csinh(double complex _z);
float complex       csinhf(float complex _z);
long double complex csinhl(long double complex _z);
double complex      ctanh(double complex _z);
float complex       ctanhf(float complex _z);
long double complex ctanhl(long double complex _z);

double complex      cacos(double complex _z);
float complex       cacosf(float complex _z);
long double complex cacosl(long double complex _z);
double complex      casin(double complex _z);
float complex       casinf(float complex _z);
long double complex casinl(long double complex _z);
double complex      catan(double complex _z);
float complex       catanf(float complex _z);
long double complex catanl(long double complex _z);
double complex      ccos(double complex _z);
float complex       ccosf(float complex _z);
long double complex ccosl(long double complex _z);
double complex      csin(double complex _z);
float complex       csinf(float complex _z);
long double complex csinl(long double complex _z);
double complex      ctan(double complex _z);
float complex       ctanf(float complex _z);
long double complex ctanl(long double complex _z);

#endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */

#ifndef __STRICT_ANSI__

#ifndef _POSIX_SOURCE

#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */

#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */

#ifdef __cplusplus
}
#endif

#endif /* !__dj_complex__h_ */

-- 
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019