Skip to content

Commit 6414a08

Browse files
committed
Update documents.
1 parent 483fc21 commit 6414a08

File tree

5 files changed

+180
-77
lines changed

5 files changed

+180
-77
lines changed

doc/architectures.md

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# Architectures
2+
23
## Source
3-
src/architectures.h
4-
## Content
4+
5+
[src/architectures.h](https://github.com/cppp-project/cppp-platform/blob/main/src/architectures.h)
6+
7+
## Contents
8+
59
### \_\_arch\_\_
6-
#### Type
7-
macros
8-
#### Description
9-
Represents the processor architecture type
10-
If the judgment fails, the value is '\_\_arch_unknown\_\_'
11-
#### We provide preset architecture macros
10+
11+
#### The type of \_\_arch\_\_
12+
13+
macro
14+
15+
#### Description of \_\_arch\_\_
16+
17+
Represents the processor architecture type. If the judgment fails, the value is set to '\_\_arch_unknown\_\_'.
18+
19+
#### Value of \_\_arch\_\_
20+
1221
| Architecture | Macro |
1322
| :----: | :----: |
1423
| Alpha | \_\_arch_alpha\_\_ |
@@ -31,40 +40,60 @@ If the judgment fails, the value is '\_\_arch_unknown\_\_'
3140
| TMS470 | \_\_arch_tms470\_\_8 |
3241
| Unknown architecture | \_\_arch_unknown\_\_ |
3342

34-
#### Usage
43+
#### Example of \_\_arch\_\_
44+
3545
```c
3646
#include <cppp/cppp-platform.h>
47+
3748
#if (__arch__ == __arch_x86__)
38-
#pragma message "Build in x86 arch"
49+
#pragma message "Build in x86."
3950
#elif (__arch__ == __arch_arm__)
40-
#pragma message "Build in arm arch"
51+
#pragma message "Build in arm."
4152
#elif
42-
#pragma message "Build in other arch"
53+
#pragma message "Build in other."
4354
#endif
44-
int main(){}
55+
56+
int main()
57+
{
58+
return 0;
59+
}
4560
```
61+
4662
### \_\_arch_name\_\_
47-
#### Type
63+
64+
#### Type of \_\_arch_name\_\_
65+
4866
macro
49-
#### Description
50-
Architecture name, like 'uname -m'
51-
If the judgment fails, the value is "unknown"
52-
#### Usage
67+
68+
#### Description of \_\_arch_name\_\_
69+
70+
Architecture name, like `uname -m`. If the judgment fails, the value is `"Unknown"`.
71+
72+
#### Example of \_\_arch_name\_\_
73+
5374
```c
5475
#include <cppp/cppp-platform.h>
76+
5577
#include <stdio.h>
78+
5679
int main()
5780
{
5881
printf("Arch name: %s\n", __arch_name__);
5982
}
6083
```
84+
6185
### \_\_POINTER_WIDTH\_\_
62-
#### Type
86+
87+
#### Type of \_\_POINTER_WIDTH\_\_
88+
6389
macro
64-
#### Description
65-
This represents the calculation formula for pointer length
66-
The value is generally 32 or 64
67-
#### Usage
90+
91+
#### Description of \_\_POINTER_WIDTH\_\_
92+
93+
This represents the pointer length. The value is generally 32 or 64.
94+
95+
#### Example of \_\_POINTER_WIDTH\_\_
96+
6897
```c
6998
#include <cppp/cppp-platform.h>
7099
#include <stdio.h>

doc/compilers.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Compilers
2+
23
## Source
3-
src/compilers.h
4+
5+
[src/compilers.h](https://github.com/cppp-project/cppp-platform/blob/main/src/compilers.h)
6+
47
## Content
8+
59
### \_\_has_xxx_compiler\_\_
6-
#### Type
7-
macros
8-
#### Description
9-
1 if there is a corresponding compiler, otherwise 0.
10-
The 'xxx' here refers to the compiler name, and details can be found in the 'src/compilers.h' source code.
11-
12-
**Note: An environment may contain multiple compiler environments.**
13-
#### Usage
14-
```c
15-
#include <cppp/cppp-platform.h>
16-
#if __has_msvc_compiler__
17-
#error "This project do not support MSVC!"
18-
#endif
19-
int main(){}
20-
```
21-
#### We provide preset compiler macros
10+
11+
#### Type of \_\_has_xxx_compiler\_\_
12+
13+
macro
14+
15+
#### Description of \_\_has_xxx_compiler\_\_
16+
17+
`1` if there is a corresponding compiler, otherwise `0`.
18+
19+
The 'xxx' here refers to the compiler name, and details can be found in the `src/compilers.h` source code.
20+
21+
**Note: An environment may contain multiple compiler environments, so multiple compiler macros may be defined at the same time. e.g. `__has_gcc_compiler__`, `__has_clang_compiler__`.**
22+
23+
#### Compiler List
24+
2225
| Compiler | Macro |
2326
| :----: | :----: |
2427
| ACC | \_\_has_acc_compiler\_\_ |
@@ -92,3 +95,18 @@ int main(){}
9295
| VBCC | \_\_has_vbcc_compiler\_\_ |
9396
| Watcom C++ | \_\_has_watcom_compiler\_\_ |
9497
| Zortech C++ | \_\_has_zortech_compiler\_\_ |
98+
99+
#### Example of \_\_has_xxx_compiler\_\_
100+
101+
```c
102+
#include <cppp/cppp-platform.h>
103+
104+
#if __has_msvc_compiler__
105+
#error "This project do not support MSVC!"
106+
#endif
107+
108+
int main()
109+
{
110+
return 0;
111+
}
112+
```

doc/doc.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# cppp-platform Manual
1+
# cppp-platform Documentation
2+
23
[Architectures](./architectures.md)
34

45
[Compilers](./compilers.md)

doc/languagestandards.md

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,81 @@
11
# C/C++ Standards
2+
23
## Source
3-
src/languagestandards.h
4+
5+
[src/languagestandards.h](https://github.com/cppp-project/cppp-platform/blob/main/src/languagestandards.h)
6+
47
## Content
5-
## \_\_has_cXX\_\_
6-
#### Type
7-
macros
8-
#### Description
8+
9+
### \_\_has_cXX\_\_
10+
11+
#### Type of \_\_has_cXX\_\_
12+
13+
macro
14+
15+
#### Description of \_\_has_cXX\_\_
16+
917
The 'XX' here refers to the C standard, and details can be found in the 'src/languagestandards.h' source code.
18+
1019
#### Usage
20+
1121
```c
1222
#include <cppp/cppp-platform.h>
23+
1324
#if __has_c11__
1425
#pragma message "You are in C11."
1526
#endif
16-
int main(){}
27+
28+
int main()
29+
{
30+
return 0;
31+
}
1732
```
18-
## \_\_has_cppXX\_\_
19-
#### Type
20-
macros
21-
#### Description
22-
The 'XX' here refers to the C++ standard, and details can be found in the 'src/languagestandards.h' source code.
23-
#### Usage
33+
34+
### \_\_has_cppXX\_\_
35+
36+
#### Type of \_\_has_cppXX\_\_
37+
38+
macro
39+
40+
#### Description of \_\_has_cppXX\_\_
41+
42+
The 'XX' here refers to the C++ standard, and details can be found in the `src/languagestandards.h` source code.
43+
44+
#### Usage of \_\_has_cppXX\_\_
45+
2446
```c
2547
#include <cppp/cppp-platform.h>
48+
2649
#if __has_cpp17__
2750
#pragma message "You are in C++17."
2851
#endif
29-
int main(){}
52+
53+
int main()
54+
{
55+
return 0;
56+
}
3057
```
31-
## \_\_cpp_version\_\_
32-
#### Type
58+
59+
### \_\_cpp_version\_\_
60+
61+
#### Type of \_\_cpp_version\_\_
62+
3363
macro
34-
#### Description
64+
65+
#### Description of \_\_cpp_version\_\_
66+
3567
C++ standard for fixing issues with '\_MSVC_LANG'
36-
### Usage
68+
69+
### Usage of \_\_cpp_version\_\_
70+
3771
```cpp
3872
#include <cppp/cppp-platform.h>
73+
3974
#include <iostream>
75+
4076
int main()
4177
{
42-
std::cout<<__cpp_version__<<"\n";
78+
std::cout << __cpp_version__ << std::endl;
79+
return EXIT_SUCCESS;
4380
}
4481
```

doc/platforms.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Platforms
2+
23
## Source
3-
src/platforms.h
4+
5+
[src/platforms.h](https://github.com/cppp-project/cppp-platform/blob/main/src/platforms.h)
6+
47
## Content
5-
## \_\_has_xxx\_\_
6-
#### Type
7-
macros
8-
#### Description
9-
If there is a corresponding OS environment, it is 1, otherwise it is 0.
10-
The 'xxx' here refers to the OS name, and details can be found in the 'src/platforms.h' source code.
11-
12-
**Note: An compile environment may contain multiple environments**
13-
#### Usage
14-
```c
15-
#include <cppp/cppp-platform.h>
16-
#if __has_windows__
17-
#error "We do not support Windows!"
18-
#endif
19-
int main(){}
20-
```
8+
9+
### \_\_has_xxx\_\_
10+
11+
#### Type of \_\_has_xxx\_\_
12+
13+
macro
14+
15+
#### Description of \_\_has_xxx\_\_
16+
17+
If there is a corresponding OS environment, it is `1`, otherwise it is `0`.
18+
19+
The 'xxx' here refers to the OS name, and details can be found in the `src/platforms.h` source code.
20+
21+
**Note: An compile environment may contain multiple environments at the same time. e.g. Cygwin Environment is a Unix-like environment, but it is also a Windows environment.**
22+
2123
#### We provide preset compiler macros
24+
2225
| Platform | Macro |
2326
| :----: | :----: |
2427
| AIX | \_\_has_aix\_\_ |
@@ -51,7 +54,7 @@ int main(){}
5154
| MinGW | \_\_has_mingw\_\_ |
5255
| MorphOS | \_\_has_morph_os\_\_ |
5356
| MPE/iX | \_\_has_mpe_ix\_\_ |
54-
| MSDOS (C++ Plus C unsupport platform) | \_\_has_dos\_\_ |
57+
| MSDOS | \_\_has_dos\_\_ |
5558
| NonStop | \_\_has_non_stop\_\_ |
5659
| Nucleus RTOS | \_\_has_nucleus\_\_ |
5760
| OS/2 | \_\_has_os2\_\_ |
@@ -80,3 +83,18 @@ int main(){}
8083
| Windows CE | \_\_has_windows_ce\_\_ |
8184
| Wind/U Environment | \_\_has_windu\_\_ |
8285
| z/OS | \_\_has_zos\_\_ |
86+
87+
#### Example of \_\_has_xxx\_\_
88+
89+
```c
90+
#include <cppp/cppp-platform.h>
91+
92+
#if __has_windows__
93+
#error "We do not support Windows!"
94+
#endif
95+
96+
int main()
97+
{
98+
return 0;
99+
}
100+
```

0 commit comments

Comments
 (0)