feture match with master

This commit is contained in:
2026-09-11 03:50:43 +01:00
parent bcaf026ef5
commit 79bc676f49
16 changed files with 293 additions and 11 deletions
+5 -1
View File
@@ -15,6 +15,7 @@
// namespaces
#include "stdWullie/namespaces/print.h"
#include "stdWullie/namespaces/convert.h"
#include "stdWullie/namespaces/random.h"
// errors & exits
#include "stdWullie/exit.h"
@@ -23,11 +24,14 @@
#include "stdWullie/time.h"
// file handling
#include "stdWullie/definitions/umodetypes.h"
#include "stdWullie/filehandle/closeOpen.h"
#include "stdWullie/filehandle/readWrite.h"
#include "stdWullie/filehandle/mkdir.h"
// string extras
// string
#include "stdWullie/String/colours.h"
// congtates youse have made it to the end
#endif
+1 -2
View File
@@ -3,7 +3,6 @@
// please see attached licence for full usage and rights
//defined like stdint to avoid confilict
#ifdef _WrathINT
#ifndef _STDINT_H
#define _STDINT_H 1
@@ -52,4 +51,4 @@ typedef unsigned long size_t;
#define INT32_MIN ((int32_t)(-INT32_MAX - 1))
#define INT64_MIN ((int64_t)(-INT64_MAX - 1))
#endif
#endif
+2 -2
View File
@@ -6,9 +6,9 @@
#define UMODETYPES_H
#ifdef __linux__
#define DefaultMode 255
#elif __FreeBSD__
#define DefaultMode 255
#endif
#endif
+6
View File
@@ -0,0 +1,6 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
// why i continue to do this i have no fucking clue
long mkdir(const char *filePath, int mode);
+6 -1
View File
@@ -5,6 +5,8 @@
#ifndef TYPECONVERSION_H
#define TYPECONVERSION_H
#include "stdWullie/definitions/int.h"
typedef struct{
// string manipulation
@@ -12,7 +14,10 @@ typedef struct{
void (*toLower)(char string[]);
// the numbers mason, what do they mean
const char *(*ItoStr)(int number);
const char *(*I32toStr)(int number);
const char *(*I64toStr)(int64_t number);
const char *(*U32toStr)(uint32_t number);
const char *(*U64toStr)(uint64_t number);
const char *(*FtoStr)(float number);
int (*toInt)(char *rawInt);
+18
View File
@@ -0,0 +1,18 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef WRATHRANDOM_H
#define WRATHRANDOM_H
#include "stdWullie/definitions/int.h"
typedef struct{
uint32_t (*xor32)(void);
uint64_t (*xor64)(void);
int (*choice)(int min, int max)
}RandomNameSpace;
extern const RandomNameSpace random;
#endif
+2 -2
View File
@@ -10,7 +10,7 @@
// hanles operations for opening and closeing files
// it should be set to W for wumbo
long wopen(const char *pathname, int flag, int mode){
long wopen(const char *pathname, int flags, int mode){
if(pathname || flags || mode == NULL){
safeError("A Null value was passed into this function, for proper prems nothing should be NULL");
}
@@ -18,7 +18,7 @@ long wopen(const char *pathname, int flag, int mode){
}
long closeFile(long fd){
long closeFile(int fd){
if(fd == NULL){
safeError("A null file descriptor was passed");
+19
View File
@@ -0,0 +1,19 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#include "LocalHeader.h"
#include "stdWullie/definitions/typeNull.h"
#include "stdWullie/definitions/umodetypes.h"
#include "stdWullie/exit.h"
// does what is says on the tin
long mkdir(const char *filePath, int mode){
if(mode == NULL){
riskyError();
return NULL;
}
syscall2(SYS_mkdir, (long)filePath, mode);
}
+5 -1
View File
@@ -4,8 +4,12 @@
#include "LocalHeader.h"
#include "stdWullie/definitions/typeNull.h"
#include "stdWullie/definitions/int.h"
#include "stdWullie/exit.h"
#include "stdWullie/filehandle/readWrite.h"
#define WrathINT
long reader(long fd, char *string, size_t buflen){
if(buflen <= 0){
safeError("can not parse 0 characters");
@@ -15,7 +19,7 @@ long reader(long fd, char *string, size_t buflen){
}
long writer(long fd, const char *string, size_t buflen){
if(bufflen <=0){
if(buflen <=0){
safeError("can not write 0 characters to a file");
}
syscall3(SYS_write, fd, (long)string, (long)buflen);
+33 -1
View File
@@ -4,6 +4,10 @@
#include "LocalHeader.h"
#include "stdWullie.h"
// decleration for random
int randomTest();
int main(int argc, char *argv[]){
if(argc != 2){
@@ -40,7 +44,20 @@ int main(int argc, char *argv[]){
break;
case 5:
print.nl("makes a test directory with user permissions");
print.nl("makes a test directory with user permissions");
mkdir("test", DefaultMode);
break;
case 6:
print.nl("numbers into string i fucking give up");
int cunt = 68;
char *output = convert.I32toStr(cunt);
print.nl(output);
break;
case 7:
print.nl("tests for random number generation: xor shift32 64 and choice");
randomTest();
break;
default:
@@ -50,6 +67,21 @@ int main(int argc, char *argv[]){
return 0;
}
int randomTest(){
uint32_t x = random.xor32();
char *output32 = convert.U32toStr(x);
print.nl(output32);
uint64_t y = random.xor64();
char *output64 = convert.U64toStr(y);
print.nl(output64);
int z = random.choice(1, 10);
char *outputChoice = convert.I32toStr(z);
print.nl(outputChoice);
return 0;
}
// #I say softly to my self "FUCK your STDLIB"#
// hadles the entry point of code and calls main when registary is set
__attribute__((naked)) void _start(){
+13
View File
@@ -4,12 +4,25 @@
#include "stdWullie/namespaces/convert.h"
// to number
int intParser(char *rawInt);
// string stuff
void upper(char string[]);
void lower(char string[]);
// to string defines
const char *IntCon(int number);
const char *I64Con(int64_t number);
const char *U32Con(uint32_t number);
const char *U64Con(uint64_t number);
const ConversionNameSpace convert = {
.toInt = intParser,
.toLower = lower,
.toUpper = upper,
.I32toStr = IntCon,
.I64toStr = I64Con,
.U32toStr = U32Con,
.U64toStr = U64Con,
};
+16
View File
@@ -0,0 +1,16 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#include "stdWullie/definitions/int.h"
#include "stdWullie/namespaces/random.h"
uint32_t xshift32();
uint64_t xshift64();
int randomChoice(int min, int max);
const RandomNameSpace random = {
.xor32 = xshift32,
.xor64 = xshift64,
.choice = randomChoice,
};
+10
View File
@@ -0,0 +1,10 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#include "stdWullie/namespaces/random.h"
int randomChoice(int min, int max){
int ranged = min + (random.xor32() % (max - min + 1));
return ranged;
}
+24
View File
@@ -0,0 +1,24 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#include "stdWullie/definitions/int.h"
#include "stdWullie/time.h"
uint32_t xshift32(){
uint32_t x = unixTime();
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
return x;
}
uint64_t xshift64(){
uint32_t x = unixTime();
uint32_t y = unixTime();
uint64_t z = x + y;
z ^= z << 13;
z ^= z >> 7;
z ^= z << 15;
return z;
}
+1 -1
View File
@@ -27,7 +27,7 @@ void printText(char *string){
void printReturn(char *string){
syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)"\n", 8);
syscall3(SYS_write, 1, (long)"\n", 6);
}
// it can do everything that print can but better
+132
View File
@@ -2,6 +2,9 @@
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#include "stdWullie/definitions/int.h"
#include "stdWullie/definitions/typeNull.h"
// turns strings into numbers
int intParser(char *rawInt){
int result = 0; char *cursor = rawInt;
@@ -14,3 +17,132 @@ int intParser(char *rawInt){
return result;
}
// reverser
void reverseString(char string[], int index){
int start = 0, end = index -1;
while(start < end){
char tempStr = string[start];
string[start] = string[end];
string[end] = tempStr;
start ++;
end --;
}
}
// turns 32bit numebrs into strings
const char *IntCon(int number){
int index = 0, isNegative = 0;
static char string[12];
// handles a value of 0
if(number == 0){
string[index] = '0';
return string;
}
if(number < 0){
isNegative = 1;
number = -number;
}
while(number){
string[index++] = (number % 10)+ '0';
number /= 10;
}
if(isNegative){
string[index++] = '-';
}
string[index] = '\0';
reverseString(string, index);
return string;
}
// same but 64 bit
const char *I64Con(int64_t number){
int index = 0, isNegative = 0;
static char string[21];
// handles a value of 0
if(number == 0){
string[index] = '0';
return string;
}
if(number < 0){
isNegative = 1;
number = -number;
}
while(number){
string[index++] = (number % 10)+ '0';
number /= 10;
}
if(isNegative){
string[index++] = '-';
}
string[index] = '\0';
reverseString(string, index);
return string;
}
// handle for unsigned 32
const char *U32Con(uint32_t number){
int index = 0, isNegative = 0;
static char string[12];
// handles a value of 0
if(number == 0){
string[index] = '0';
return string;
}
if(number < 0){
isNegative = 1;
number = -number;
}
while(number){
string[index++] = (number % 10)+ '0';
number /= 10;
}
if(isNegative){
string[index++] = '-';
}
string[index] = '\0';
reverseString(string, index);
return string;
}
// handle for unsigned 64
const char *U64Con(uint64_t number){
int index = 0, isNegative = 0;
static char string[21];
// handles a value of 0
if(number == 0){
string[index] = '0';
return string;
}
if(number < 0){
isNegative = 1;
number = -number;
}
while(number){
string[index++] = (number % 10)+ '0';
number /= 10;
}
if(isNegative){
string[index++] = '-';
}
string[index] = '\0';
reverseString(string, index);
return string;
}