Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions libc/docs/complex.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.. include:: check.rst

=========
complex.h
=========

Macros
======

+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section |
+===========+==================+=================+========================+======================+========================+========================+============================+
| CMPLX | | | | | | 7.3.9.3 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

Functions
=========

+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section |
+===========+==================+=================+========================+======================+========================+========================+============================+
| cacos | | | | | | 7.3.5.1 | G.6.2.1 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| casin | | | | | | 7.3.5.2 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| catan | | | | | | 7.3.5.3 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| ccos | | | | | | 7.3.5.4 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| csin | | | | | | 7.3.5.5 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| ctan | | | | | | 7.3.5.6 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| cacosh | | | | | | 7.3.6.1 | G.6.3.1 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| casinh | | | | | | 7.3.6.2 | G.6.3.2 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| catanh | | | | | | 7.3.6.3 | G.6.3.3 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| ccosh | | | | | | 7.3.6.4 | G.6.3.4 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| csinh | | | | | | 7.3.6.5 | G.6.3.5 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| ctanh | | | | | | 7.3.6.6 | G.6.3.6 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| cexp | | | | | | 7.3.7.1 | G.6.4.1 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| clog | | | | | | 7.3.7.2 | G.6.4.2 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| cabs | | | | | | 7.3.8.1 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| cpow | | | | | | 7.3.8.2 | G.6.5.1 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| csqrt | | | | | | 7.3.8.3 | G.6.5.2 |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| carg | | | | | | 7.3.9.1 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| cimag | | | | | | 7.3.9.2 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| conj | | | | | | 7.3.9.4 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| cproj | | | | | | 7.3.9.5 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| creal | | | | | | 7.3.9.6 | N/A |
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
1 change: 1 addition & 0 deletions libc/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ stages there is no ABI stability in any form.
libc_search
c23
ctype
complex
signal
threads
setjmp
Expand Down
11 changes: 11 additions & 0 deletions libc/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@ add_header_macro(
.llvm-libc-macros.assert_macros
)

add_header_macro(
complex
../libc/newhdrgen/yaml/complex.yaml
complex.h.def
complex.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.complex_macros
.llvm-libc-types._Imaginary
)

add_header_macro(
setjmp
../libc/newhdrgen/yaml/setjmp.yaml
Expand Down
17 changes: 17 additions & 0 deletions libc/include/complex.h.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- C standard library header complex.h -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_COMPLEX_H
#define LLVM_LIBC_COMPLEX_H

#include "__llvm-libc-common.h"
#include "llvm-libc-macros/complex-macros.h"

%%public_api()

#endif // LLVM_LIBC_COMPLEX_H
6 changes: 6 additions & 0 deletions libc/include/llvm-libc-macros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ add_macro_header(
fcntl-macros.h
)

add_macro_header(
complex_macros
HDR
complex-macros.h
)

add_macro_header(
features_macros
HDR
Expand Down
30 changes: 30 additions & 0 deletions libc/include/llvm-libc-macros/complex-macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//===-- Definition of macros to be used with complex functions ------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_MACROS_COMPLEX_MACROS_H
#define __LLVM_LIBC_MACROS_COMPLEX_MACROS_H

#ifndef __STDC_NO_COMPLEX__

#define __STDC_VERSION_COMPLEX_H__ 202311L

#define complex _Complex
#define _Complex_I ((float _Complex)1.0fi)

#ifdef _Imaginary
#define imaginary _Imaginary
#define _Imaginary_I ((float _Imaginary)1.0i)

#define I _Imaginary_I
#else
#define I _Complex_I
#endif

#endif

#endif // __LLVM_LIBC_MACROS_COMPLEX_MACROS_H
1 change: 1 addition & 0 deletions libc/include/llvm-libc-types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ add_header(__qsortrcompare_t HDR __qsortrcompare_t.h)
add_header(__sighandler_t HDR __sighandler_t.h)
add_header(__thread_type HDR __thread_type.h)
add_header(blkcnt_t HDR blkcnt_t.h)
add_header(_Imaginary HDR _Imaginary.h)
add_header(blksize_t HDR blksize_t.h)
add_header(cc_t HDR cc_t.h)
add_header(clock_t HDR clock_t.h)
Expand Down
14 changes: 14 additions & 0 deletions libc/include/llvm-libc-types/_Imaginary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of _Imaginary type -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_TYPES__Imaginary_H
#define LLVM_LIBC_TYPES__Imaginary_H

typedef /* TODO */ _Imaginary;

#endif // LLVM_LIBC_TYPES__Imaginary_H
Loading