diff --git a/src/fileHandle.c b/src/fileHandle.c deleted file mode 100644 index 3a1ef40..0000000 --- a/src/fileHandle.c +++ /dev/null @@ -1,33 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "stdWullie.h" -#include "localheader.h" - -// it should be set to W for wumbo -// opens files -long Wopen(const char *pathname, int flags, int mode){ - if(pathname == NULL || flags == NULL || mode == NULL){ - safeError(NULL); - } - syscall3(SYS_open, (long)pathname, flags, mode); -} - -// named like this to not cause compat issues with glibc -long closeFile(long fd){ - if(fd == NULL){ - safeError(NULL); - } - syscall2(SYS_close, fd, 0); -} - -// read whats in the file descripter and move it into a buffer -long reader(long fd, char *string){ - syscall3(SYS_read, fd, (long)string, sizeof(string)-1); - -} -// does that it say on the tin -long mkdir(const char *filePath, int mode){ - syscall2(SYS_mkdir, (long)filePath, mode); -} diff --git a/src/funcs.c b/src/funcs.c deleted file mode 100644 index 6ce99e6..0000000 --- a/src/funcs.c +++ /dev/null @@ -1,43 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "stdWullie.h" -#include "localheader.h" - -// generic functions that dont need a file of there own - -// our own exit LINUX ONLY -void exit(int code){ - syscall1(SYS_exit, code); - for(;;) {} -} - -// safty last -void safeError(char *error){ - if(error != NULL){ - print(error); - ColorPrint("exiting with code -1\n", RED); - exit(-1); - } - - print("something went wrong "); - ColorPrint("exiting with code -1\n", RED); - exit(-1); -} - -// only use this when something will work but not as intended -void riskyError(){ - print("not critical error was found\n"); -} - - -// #Schlaf mein Kindlein, schlaf doch ein, der Rabe hat nach dir gerufen.# -void sleeper(long seconds){ - timespec duration = {0}; - duration.tv_sec = seconds; - - syscall2(SYS_sleep, (long)(&duration), 0); - - -} diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 9517c7a..0000000 --- a/src/main.c +++ /dev/null @@ -1,77 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "stdWullie.h" -#include "localheader.h" - -int main(int argc, char *argv[]){ - - if(argc != 2){ - print("test functions for stdWullie use agruments 1 - 3 to test features\n"); - return 0; - } - - char *rawArg = argv[1]; - long argNum = intParser(rawArg); - - switch(argNum){ - case 1: - print("look Ma no stdlib\n"); - ColorPrint("NOW WITH COLORS\n", RED); - BackgroundPrint("and backgrounds\n", BBLUE); - break; - - case 2: - print("test for safe exit\n"); - safeError(NULL); - break; - - case 3: - print("sleep for 2 seconds before exit\n"); - sleeper(2); - break; - - case 4: - char string[] = "contvers to upper then to lower\n"; - upper(string); - print(string); - lower(string); - print(string); - break; - - case 5: - print("making a test dir with the name test\n"); - mkdir("test", 0); - break; - - case 6: - print("turning a int to string: "); - int num = 8001; - char *str = intCon(num); - print(str); - print("\n"); - break; - - default: - print("no args given or arg is out of range\n"); - break; - } - - return 0; -} - -// #I say softly to myself "FUCK YOUR STDLIB"# -// handles the main loop -__attribute__((naked)) void _start(){ - __asm__ __volatile__( - "xor %ebp, %ebp\n" - "mov (%rsp), %rdi\n" - "lea 8(%rsp), %rsi\n" - "and $-16, %rsp\n" - "call main\n" - "mov %rax, %rdi\n" - "call exit\n" - ); - -} diff --git a/src/math.c b/src/math.c deleted file mode 100644 index 5ab3824..0000000 --- a/src/math.c +++ /dev/null @@ -1,62 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "stdWullie.h" - -// int parser basicly atol -int intParser(char *rawInt){ - int result = 0; - char *cursor = rawInt; - - while(*cursor >= '0' && *cursor <= '9'){ - result = result * 10 + (*cursor - '0'); - cursor++; - } - return result; -} - -// fast inverse square root why: bc this is my lib -float invSqrt(float x){ - float xhalf = 0.5f * x; - int i = *(int*)&x; - i = 0x5f3759df - (i >> 1); // bit fuck magic - x = *(float*)&i; - x = x*(1.5f - xhalf*x*x); - return x; -} - - -// power of for floats -float floatPow(float base, int exponant){ - float result; - - if(base == 0.0f || exponant == 0){ - result = 0.0f; - return result; - - } - while(exponant > 0){ - result = base * base; - exponant --; - } - -} - - -// power of for int -int intPow(int base, int exponant){ - int result; - - if(base == 0 || exponant == 0){ - result = 0; - return result; - } - - result = base ^ exponant; - return result; -} - -float Sqrt(){ - -} diff --git a/src/string/input.c b/src/string/input.c deleted file mode 100644 index 3f797f6..0000000 --- a/src/string/input.c +++ /dev/null @@ -1,10 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "string.h" -#include "localheader.h" - -void input(){ - -} diff --git a/src/string/printing.c b/src/string/printing.c deleted file mode 100644 index 29b4f9f..0000000 --- a/src/string/printing.c +++ /dev/null @@ -1,63 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "stdWullie.h" -#include "localheader.h" - -// handles the length of a string for print -long unsigned lengthStr(char *string){ - if(string == NULL){ - safeError("error: a string was passed with a null value terminating program"); - } - char *cursor = string; - while(*cursor){ - cursor++; - } - long unsigned result = cursor - string; - return result; -} - -// its print what do you expect? for it to read? -void print(char *string){ - syscall3(SYS_write, 1, (long)string, lengthStr(string)); -} - -// it can do everythig print can but better -void ColorPrint(char *string, char *color){ - syscall3(SYS_write, 1, (long)color, lengthStr(color)); - syscall3(SYS_write, 1, (long)string, lengthStr(string)); - syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1); -} - -// instead of changing the foreground it changes the background -void BackgroundPrint(char *string, char *Bcolor){ - syscall3(SYS_write, 1, (long)Bcolor, lengthStr(Bcolor)); - syscall3(SYS_write, 1, (long)string, lengthStr(string)); - syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1); -} - -// converts a sting to uppercase -void upper(char string[]){ - int i = 0; - while(string[i] != '\0'){ - if(string[i] >= 'a' && string[i] <= 'z') { - string[i] = string[i] - 32; - } - i++; - } -} - -// does the same but to lower case instead -void lower(char string[]){ - int cursor = 0; - while(string[cursor] != '\0'){ - if(string[cursor] >= 'A' && string[cursor] <= 'Z'){ - string[cursor] = string[cursor] + 32; - } - cursor++; - } -} - - - diff --git a/src/string/typeConvert.c b/src/string/typeConvert.c deleted file mode 100644 index 9c2318d..0000000 --- a/src/string/typeConvert.c +++ /dev/null @@ -1,45 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "string.h" - - -// converts int to string -const char *intCon(int number){ - int i = 0, isNegative = 0; - static char string[34]; - - if(number < 0){ - isNegative = 1; - number = -number; - } - while(number){ - string[i++] = (number % 10) + '0'; - number /= 10; - } - - if(isNegative){ - string[i++] = '-'; - } - - string[i] = '\0'; - - int start = 0, end = i -1; - while(start < end){ - char tempStr = string[start]; - string[start] = string[end]; - string[end] = tempStr; - start ++; - end --; - } - - return string; -} - -const char *floatCon(float number){ - int i = 0, isNegative = 0; - static char string[32]; - - -} diff --git a/src/syscall.c b/src/syscall.c deleted file mode 100644 index eb37a31..0000000 --- a/src/syscall.c +++ /dev/null @@ -1,68 +0,0 @@ -// this code is licenced under Wrathmark licence -// © 2026 wullie wulliestudio.com -// please see attached licence for full usage and rights - -#include "localheader.h" - - -// look at me I am the handler now - -// syscall1 -long syscall1(long number, long arg1){ - long result; - - // asm for a system call with one arg - __asm__ __volatile( - "syscall" - : "=a"(result) - : "a"(number), "D"(arg1) - : "rcx", "r11", "memory" - ); - - return result; -} - -// syscall2 -long syscall2(long number, long arg1, long arg2){ - long result; - - // asm for system call with 2 args - __asm__ __volatile( - "syscall" - : "=a"(result) - : "a"(number), "D"(arg1), "S"(arg2) - : "rcx", "r11","memory" - ); - return result; -} - - -// syscall3 -long syscall3(long number, long arg1, long arg2, long arg3){ - long result; - - // asm for a system call with 3 args - __asm__ __volatile( - "syscall" - : "=a"(result) - : "a"(number), "D"(arg1), "S"(arg2), "d"(arg3) - : "rcx", "r11", "memory" - ); - - return result; -} - -// syscall4 -long syscall4(long number, long arg1, long arg2, long arg3, long arg4){ - long result; - - __asm__ __volatile( - "syscall" - : "=a"(result) - : "a"(number), "D"(arg1), "S"(arg2), "d"(arg3), "b"(arg4) - : "rcx", "r11", "memory" - - ); - return result; -} -