Clean: harmonizing & header-commenting code

This commit is contained in:
xamidev
2024-08-24 17:17:53 +02:00
parent a915ac15a1
commit fbd4fa6089
46 changed files with 339 additions and 130 deletions

View File

@@ -1,3 +1,8 @@
// Cryptography routines for blankos/libc
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "crypto.h"
#include <stdint.h>

View File

@@ -1,3 +1,8 @@
// Cryptography routines for blankos/libc header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef CRYPTO_H
#define CRYPTO_H

View File

@@ -1,3 +1,7 @@
// Ctype implementation for blankos/libc
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include <stdint.h>
#include <stdbool.h>
@@ -7,7 +11,6 @@ bool isdigit(char c)
return c >= '0' && c <= '9';
}
bool isspace(char c)
{
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';

View File

@@ -1,3 +1,8 @@
// Ctype implementation for blankos/libc header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef CTYPE_H
#define CTYPE_H

View File

@@ -1,3 +1,8 @@
// Standard input/output implementation for blankos/libc
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "../kernel/io.h"
#include "stdio.h"
#include "string.h"
@@ -10,9 +15,6 @@ extern uint32_t* framebuffer;
extern uint32_t VGA_WIDTH;
extern uint32_t VGA_HEIGHT;
unsigned int VGA_X = 0, VGA_Y = 0;
#define CURSOR_WIDTH 8
#define CURSOR_HEIGHT 16
extern int scanline;
void draw_cursor(uint32_t color)

View File

@@ -1,17 +1,24 @@
#ifndef INCLUDE_STDIO_H
#define INCLUDE_STDIO_H
// Standard input/output implementation for blankos/libc header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef STDIO_H
#define STDIO_H
#include <stdint.h>
#include <stdbool.h>
#define FB_GREEN 2
#define FB_DARK_GREY 8
#define FB_GREEN 2
#define FB_DARK_GREY 8
#define FB_CMD_PORT 0x3D4
#define FB_DATA_PORT 0x3D5
#define FB_HIGH_BYTE_CMD 14
#define FB_LOW_BYTE_CMD 15
#define CURSOR_WIDTH 8
#define CURSOR_HEIGHT 16
void draw_cursor(uint32_t color);
void erase_cursor();
@@ -27,24 +34,23 @@ unsigned int getcolor(int x, int y);
void putc(char c);
void colorputc(char c, uint32_t fg, uint32_t bg);
#define PRINTF_STATE_START 0
#define PRINTF_STATE_START 0
#define PRINTF_STATE_LENGTH 1
#define PRINTF_STATE_SHORT 2
#define PRINTF_STATE_LONG 3
#define PRINTF_STATE_SPEC 4
#define PRINTF_STATE_WIDTH 5
#define PRINTF_STATE_SHORT 2
#define PRINTF_STATE_LONG 3
#define PRINTF_STATE_SPEC 4
#define PRINTF_STATE_WIDTH 5
#define PRINTF_LENGTH_START 0
#define PRINTF_LENGTH_SHORT_SHORT 1
#define PRINTF_LENGTH_SHORT 2
#define PRINTF_LENGTH_LONG 3
#define PRINTF_LENGTH_LONG 3
#define PRINTF_LENGTH_LONG_LONG 4
void printf(const char* fmt, ...);
int* printf_number(int* argp, int length, bool sign, int radix, int width, char pad_char);
int getch();
void get_input(char *buffer, int size);
void dtostrf(double val, char *buffer, int precision);
enum Colors

View File

@@ -1,3 +1,8 @@
// String operations implementation for blankos/libc
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include <stdint.h>
#include "../kernel/system.h"

View File

@@ -1,5 +1,10 @@
#ifndef INCLUDE_STRING_H
#define INCLUDE_STRING_H
// String operations implementation for blankos/libc header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef STRING_H
#define STRING_H
int strlen(const char* str);
int strcmp(const char* str1, const char* str2);