Switch: to freestanding stdint and stdbool headers

This commit is contained in:
xamidev
2024-08-24 16:26:14 +02:00
parent 0146613ce7
commit a03bb42790
26 changed files with 31 additions and 48 deletions

View File

@@ -1,4 +1,4 @@
#include "../libc/stdint.h"
#include <stdint.h>
#include "../kernel/io.h"
#include "../libc/stdio.h"

View File

@@ -1,6 +1,8 @@
#ifndef ATA_H
#define ATA_H
#include <stdint.h>
void ata_read_sector(uint32_t lba, uint8_t* buffer);
void test_read_sector();

View File

@@ -1,4 +1,4 @@
#include "../libc/stdint.h"
#include <stdint.h>
#include "framebuffer.h"
#include "serial.h"
#include "../kernel/system.h"

View File

@@ -1,6 +1,8 @@
#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
#include <stdint.h>
#define PSF1_FONT_MAGIC 0x0436
typedef struct {
@@ -9,7 +11,6 @@ typedef struct {
uint8_t characterSize; // PSF character size.
} PSF1_Header;
#define PSF_FONT_MAGIC 0x864ab572
typedef struct {

View File

@@ -1,7 +1,7 @@
#ifndef INCLUDE_IO_H
#define INCLUDE_IO_H
#include "../libc/stdint.h"
#include <stdint.h>
void outb(unsigned short port, unsigned char data);
unsigned char inb(unsigned short port);

View File

@@ -1,6 +1,6 @@
#include "kheap.h"
#include "../libc/stdint.h"
#include <stdint.h>
extern uint32_t end;
uint32_t placement_address = (uint32_t)&end;

View File

@@ -1,7 +1,7 @@
#ifndef KHEAP_H
#define KHEAP_H
#include "../libc/stdint.h"
#include <stdint.h>
uint32_t kmalloc_a(uint32_t sz);
uint32_t kmalloc_p(uint32_t sz, uint32_t *phys);

View File

@@ -5,7 +5,7 @@
#include "system.h"
#include "paging.h"
#include "../drivers/ata.h"
#include "../libc/stdint.h"
#include <stdint.h>
#include "../drivers/framebuffer.h"
typedef struct {

View File

@@ -1,4 +1,4 @@
#include "../libc/stdint.h"
#include <stdint.h>
#include "paging.h"
#include "../libc/stdio.h"
#include "system.h"

View File

@@ -2,7 +2,7 @@
#define PAGING_H
#include "system.h"
#include "../libc/stdint.h"
#include <stdint.h>
typedef struct
{
uint32_t present : 1;

View File

@@ -2,7 +2,7 @@
#include "../libc/stdio.h"
#include "../libc/string.h"
#include "../programs/programs.h"
#include "../libc/stdint.h"
#include <stdint.h>
#define BUFFER_SIZE 256
#define MAX_COMMANDS 16

View File

@@ -1,5 +1,5 @@
#include "system.h"
#include "../libc/stdint.h"
#include <stdint.h>
void *memset(void *dest, char val, size_t count)
{

View File

@@ -1,9 +1,10 @@
#ifndef SYSTEM_H
#define SYSTEM_H
#include "../libc/stdint.h"
#include <stdint.h>
typedef int size_t;
#define NULL ((void*)0)
void *memset(void *dest, char val, size_t count);
void *memmove(void* dest, const void* src, size_t n);

View File

@@ -1,5 +1,5 @@
#include "crypto.h"
#include "../libc/stdint.h"
#include <stdint.h>
int lcg(int seed)
{

View File

@@ -3,7 +3,7 @@
#define RAND_MAX 1024
#include "../libc/stdint.h"
#include <stdint.h>
int lcg(int seed);
int randint(int seed);

View File

@@ -1,5 +1,6 @@
#include "stdint.h"
#include <stdint.h>
#include <stdbool.h>
bool isdigit(char c)
{

View File

@@ -1,7 +1,7 @@
#ifndef CTYPE_H
#define CTYPE_H
#include "stdint.h"
#include <stdbool.h>
bool isdigit(char c);
bool isspace(char c);

View File

@@ -1,24 +0,0 @@
#ifndef INCLUDE_STDINT_H
#define INCLUDE_STDINT_H
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int int32_t;
typedef unsigned long int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;
typedef uint8_t bool;
#define true 1
#define false 0
#define NULL ((void*)0)
typedef unsigned int uintptr_t;
#endif

View File

@@ -1,7 +1,7 @@
#include "../kernel/io.h"
#include "stdio.h"
#include "string.h"
#include "stdint.h"
#include <stdint.h>
#include "../kernel/system.h"
#include "../drivers/framebuffer.h"
#include "../drivers/serial.h"

View File

@@ -1,7 +1,8 @@
#ifndef INCLUDE_STDIO_H
#define INCLUDE_STDIO_H
#include "stdint.h"
#include <stdint.h>
#include <stdbool.h>
#define FB_GREEN 2
#define FB_DARK_GREY 8

View File

@@ -1,4 +1,5 @@
#include "stdint.h"
#include <stdint.h>
#include "../kernel/system.h"
int strlen(const char* str)
{

View File

@@ -33,7 +33,7 @@ void program_rot13()
}
#include "../libc/string.h"
#include "../libc/stdint.h"
#include <stdint.h>
const char* morse_alphabet[] = {
".-", // A

View File

@@ -2,7 +2,7 @@
#include "../libc/stdio.h"
#include "../kernel/system.h"
#include "../libc/crypto.h"
#include "../libc/stdint.h"
#include <stdint.h>
#include "../drivers/serial.h"
#include "../libc/string.h"

View File

@@ -1,6 +1,6 @@
// Math expression lexer and parser
#include "../libc/stdint.h"
#include <stdint.h>
#include "../kernel/system.h"
#include "../libc/stdio.h"
#include "../libc/ctype.h"

View File

@@ -1,4 +1,4 @@
#include "../libc/stdint.h"
#include <stdint.h>
#include "../libc/stdio.h"
#include "../kernel/system.h"