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,7 @@
// Simple brainfuck interpreter program
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "../kernel/system.h"
#include "../libc/stdio.h"

View File

@@ -1,5 +1,12 @@
// Cipher programs
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "../libc/stdio.h"
#include "ciphers.h"
#include "../libc/string.h"
#include <stdint.h>
void rot13(char* input, char* output)
{
@@ -32,9 +39,6 @@ void program_rot13()
printf("\n%s\n", output);
}
#include "../libc/string.h"
#include <stdint.h>
const char* morse_alphabet[] = {
".-", // A
"-...", // B

View File

@@ -1,3 +1,8 @@
// Cipher programs header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef CIPHERS_H
#define CIPHERS_H

View File

@@ -1,3 +1,8 @@
// Conway's Game of Life program
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "conway.h"
#include "../libc/stdio.h"
#include "../kernel/system.h"

View File

@@ -1,3 +1,8 @@
// Conway's Game of Life program header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef CONWAY_H
#define CONWAY_H

View File

@@ -1,4 +1,7 @@
// Math expression lexer and parser
// Basic math expression lexer and parser program
// 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,4 +1,7 @@
// Miscellaneous small programs
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "../libc/stdio.h"
#include "../kernel/system.h"
@@ -30,7 +33,7 @@ void program_rainbow()
void program_clear()
{
for (int i=0; i<ROWS; i++) scroll();
clear();
}
// Get uptime in ticks
@@ -38,7 +41,7 @@ void program_clear()
void program_uptime()
{
int ticks = uptime();
double seconds = ticks/18.2065; // PIC channel 0 freq
double seconds = ticks/18.2065; // PIT channel 0 freq
printf("%d ticks\t%f seconds\n", ticks, seconds);
}

View File

@@ -1,3 +1,8 @@
// Prime number computation program
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include <stdint.h>
#include "../libc/stdio.h"
#include "../kernel/system.h"

View File

@@ -1,3 +1,8 @@
// Global program entry points header
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#ifndef PROGRAMS_H
#define PROGRAMS_H
@@ -22,4 +27,5 @@ void program_uptime();
void program_panic();
void program_help();
void program_echo();
#endif

View File

@@ -1,3 +1,7 @@
// System information program
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "../kernel/sysinfo.h"
#include "../libc/stdio.h"

View File

@@ -1,3 +1,7 @@
// Pseudo-random word generation program
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https//github.com/xamidev/blankos
#include "../libc/stdio.h"
#include "../libc/crypto.h"
@@ -37,7 +41,7 @@ char* words[] =
int words_size = sizeof(words)/sizeof(words[0]);
// Generates 5 random words
// Generates random words
void program_words()
{
for (int i=0; i<10; i++)