Skip to content

Commit 0247ef9

Browse files
authored
Merge pull request #92 from gtker/main
Convert CONSTANT to anonymous enums
2 parents 83fbd06 + 042faee commit 0247ef9

File tree

9 files changed

+232
-90
lines changed

9 files changed

+232
-90
lines changed

aarch64/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,30 @@
1616
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19-
// CONSTANT stdin 0
20-
// CONSTANT stdout 1
21-
// CONSTANT stderr 2
22-
// CONSTANT EOF 0xFFFFFFFF
23-
// CONSTANT NULL 0
24-
// CONSTANT EXIT_FAILURE 1
25-
// CONSTANT EXIT_SUCCESS 0
26-
// CONSTANT TRUE 1
27-
// CONSTANT FALSE 0
19+
enum
20+
{
21+
stdin = 0,
22+
stdout = 1,
23+
stderr = 2,
24+
};
25+
26+
enum
27+
{
28+
EOF = 0xFFFFFFFF,
29+
NULL = 0,
30+
};
31+
32+
enum
33+
{
34+
EXIT_FAILURE = 1,
35+
EXIT_SUCCESS = 0,
36+
};
37+
38+
enum
39+
{
40+
TRUE = 1,
41+
FALSE = 0,
42+
};
2843

2944

3045
int fgetc(FILE* f)

amd64/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@
1515
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// CONSTANT stdin 0
19-
// CONSTANT stdout 1
20-
// CONSTANT stderr 2
21-
// CONSTANT EOF 0xFFFFFFFF
22-
// CONSTANT NULL 0
23-
// CONSTANT EXIT_FAILURE 1
24-
// CONSTANT EXIT_SUCCESS 0
25-
// CONSTANT TRUE 1
26-
// CONSTANT FALSE 0
18+
enum
19+
{
20+
stdin = 0,
21+
stdout = 1,
22+
stderr = 2,
23+
};
24+
25+
enum
26+
{
27+
EOF = 0xFFFFFFFF,
28+
NULL = 0,
29+
};
30+
31+
enum
32+
{
33+
EXIT_FAILURE = 1,
34+
EXIT_SUCCESS = 0,
35+
};
36+
37+
enum
38+
{
39+
TRUE = 1,
40+
FALSE = 0,
41+
};
2742

2843

2944
int fgetc(FILE* f)

amd64/uefi/bootstrap.c

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,48 @@
1515
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// CONSTANT stdin 0
19-
// CONSTANT stdout 1
20-
// CONSTANT stderr 2
21-
// CONSTANT EOF 0xFFFFFFFF
22-
// CONSTANT NULL 0
23-
// CONSTANT EXIT_FAILURE 1
24-
// CONSTANT EXIT_SUCCESS 0
25-
// CONSTANT TRUE 1
26-
// CONSTANT FALSE 0
18+
enum
19+
{
20+
stdin = 0,
21+
stdout = 1,
22+
stderr = 2,
23+
};
24+
25+
enum
26+
{
27+
EOF = 0xFFFFFFFF,
28+
NULL = 0,
29+
};
30+
31+
enum
32+
{
33+
EXIT_FAILURE = 1,
34+
EXIT_SUCCESS = 0,
35+
};
36+
37+
enum
38+
{
39+
TRUE = 1,
40+
FALSE = 0,
41+
};
2742

2843
/* UEFI */
29-
// CONSTANT PAGE_SIZE 4096
30-
// CONSTANT PAGE_NUM 16384
31-
// CONSTANT USER_STACK_SIZE 8388608
32-
// CONSTANT EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 1
33-
// CONSTANT EFI_FILE_MODE_READ 1
34-
// CONSTANT EFI_FILE_MODE_WRITE 2
35-
// CONSTANT EFI_FILE_READ_ONLY 1
36-
// CONSTANT EFI_ALLOCATE_ANY_PAGES 0
37-
// CONSTANT EFI_LOADER_DATA 2
44+
enum
45+
{
46+
PAGE_SIZE = 4096,
47+
PAGE_NUM = 16384,
48+
USER_STACK_SIZE = 8388608,
49+
};
50+
51+
enum
52+
{
53+
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL = 1,
54+
EFI_FILE_MODE_READ = 1,
55+
EFI_FILE_MODE_WRITE = 2,
56+
EFI_FILE_READ_ONLY = 1,
57+
EFI_ALLOCATE_ANY_PAGES = 0,
58+
EFI_LOADER_DATA = 2,
59+
};
3860

3961
void exit(unsigned value);
4062

armv7l/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@
1515
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// CONSTANT stdin 0
19-
// CONSTANT stdout 1
20-
// CONSTANT stderr 2
21-
// CONSTANT EOF 0xFFFFFFFF
22-
// CONSTANT NULL 0
23-
// CONSTANT EXIT_FAILURE 1
24-
// CONSTANT EXIT_SUCCESS 0
25-
// CONSTANT TRUE 1
26-
// CONSTANT FALSE 0
18+
enum
19+
{
20+
stdin = 0,
21+
stdout = 1,
22+
stderr = 2,
23+
};
24+
25+
enum
26+
{
27+
EOF = 0xFFFFFFFF,
28+
NULL = 0,
29+
};
30+
31+
enum
32+
{
33+
EXIT_FAILURE = 1,
34+
EXIT_SUCCESS = 0,
35+
};
36+
37+
enum
38+
{
39+
TRUE = 1,
40+
FALSE = 0,
41+
};
2742

2843

2944
int fgetc(FILE* f)

knight/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@
1515
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// CONSTANT stdin 0
19-
// CONSTANT stdout 1
20-
// CONSTANT stderr 2
21-
// CONSTANT EOF 0xFFFFFFFF
22-
// CONSTANT NULL 0
23-
// CONSTANT EXIT_FAILURE 1
24-
// CONSTANT EXIT_SUCCESS 0
25-
// CONSTANT TRUE 1
26-
// CONSTANT FALSE 0
18+
enum
19+
{
20+
stdin = 0,
21+
stdout = 1,
22+
stderr = 2,
23+
};
24+
25+
enum
26+
{
27+
EOF = 0xFFFFFFFF,
28+
NULL = 0,
29+
};
30+
31+
enum
32+
{
33+
EXIT_FAILURE = 1,
34+
EXIT_SUCCESS = 0,
35+
};
36+
37+
enum
38+
{
39+
TRUE = 1,
40+
FALSE = 0,
41+
};
2742

2843

2944
int fgetc(FILE* f)

knight/native/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@
1515
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// CONSTANT stdin 0x1100
19-
// CONSTANT stdout 0x1101
20-
// CONSTANT stderr 0
21-
// CONSTANT EOF 0xFFFFFFFF
22-
// CONSTANT NULL 0
23-
// CONSTANT EXIT_FAILURE 1
24-
// CONSTANT EXIT_SUCCESS 0
25-
// CONSTANT TRUE 1
26-
// CONSTANT FALSE 0
18+
enum
19+
{
20+
stdin = 0x1100,
21+
stdout = 0x1101,
22+
stderr = 0,
23+
};
24+
25+
enum
26+
{
27+
EOF = 0xFFFFFFFF,
28+
NULL = 0,
29+
};
30+
31+
enum
32+
{
33+
EXIT_FAILURE = 1,
34+
EXIT_SUCCESS = 0,
35+
};
36+
37+
enum
38+
{
39+
TRUE = 1,
40+
FALSE = 0,
41+
};
2742

2843

2944
int fgetc(FILE* f)

riscv32/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,30 @@
1616
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19-
// CONSTANT stdin 0
20-
// CONSTANT stdout 1
21-
// CONSTANT stderr 2
22-
// CONSTANT EOF 0xFFFFFFFF
23-
// CONSTANT NULL 0
24-
// CONSTANT EXIT_FAILURE 1
25-
// CONSTANT EXIT_SUCCESS 0
26-
// CONSTANT TRUE 1
27-
// CONSTANT FALSE 0
19+
enum
20+
{
21+
stdin = 0,
22+
stdout = 1,
23+
stderr = 2,
24+
};
25+
26+
enum
27+
{
28+
EOF = 0xFFFFFFFF,
29+
NULL = 0,
30+
};
31+
32+
enum
33+
{
34+
EXIT_FAILURE = 1,
35+
EXIT_SUCCESS = 0,
36+
};
37+
38+
enum
39+
{
40+
TRUE = 1,
41+
FALSE = 0,
42+
};
2843

2944

3045
int fgetc(FILE* f)

riscv64/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,30 @@
1616
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19-
// CONSTANT stdin 0
20-
// CONSTANT stdout 1
21-
// CONSTANT stderr 2
22-
// CONSTANT EOF 0xFFFFFFFF
23-
// CONSTANT NULL 0
24-
// CONSTANT EXIT_FAILURE 1
25-
// CONSTANT EXIT_SUCCESS 0
26-
// CONSTANT TRUE 1
27-
// CONSTANT FALSE 0
19+
enum
20+
{
21+
stdin = 0,
22+
stdout = 1,
23+
stderr = 2,
24+
};
25+
26+
enum
27+
{
28+
EOF = 0xFFFFFFFF,
29+
NULL = 0,
30+
};
31+
32+
enum
33+
{
34+
EXIT_FAILURE = 1,
35+
EXIT_SUCCESS = 0,
36+
};
37+
38+
enum
39+
{
40+
TRUE = 1,
41+
FALSE = 0,
42+
};
2843

2944

3045
int fgetc(FILE* f)

x86/linux/bootstrap.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@
1515
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// CONSTANT stdin 0
19-
// CONSTANT stdout 1
20-
// CONSTANT stderr 2
21-
// CONSTANT EOF 0xFFFFFFFF
22-
// CONSTANT NULL 0
23-
// CONSTANT EXIT_FAILURE 1
24-
// CONSTANT EXIT_SUCCESS 0
25-
// CONSTANT TRUE 1
26-
// CONSTANT FALSE 0
18+
enum
19+
{
20+
stdin = 0,
21+
stdout = 1,
22+
stderr = 2,
23+
};
24+
25+
enum
26+
{
27+
EOF = 0xFFFFFFFF,
28+
NULL = 0,
29+
};
30+
31+
enum
32+
{
33+
EXIT_FAILURE = 1,
34+
EXIT_SUCCESS = 0,
35+
};
36+
37+
enum
38+
{
39+
TRUE = 1,
40+
FALSE = 0,
41+
};
2742

2843

2944
int fgetc(FILE* f)

0 commit comments

Comments
 (0)