Compare commits

3 Commits

Author SHA1 Message Date
wullie 79bc676f49 feture match with master 2026-09-11 03:50:43 +01:00
wullie bcaf026ef5 added file handling again 2026-08-20 16:40:32 +01:00
wullie ee00f3ee3d Initial commit 2026-08-19 00:38:08 +01:00
39 changed files with 745 additions and 457 deletions
-25
View File
@@ -1,25 +0,0 @@
CC = gcc
CFLAGS = -I./include
SRC = $(wildcard src/*.c) $(wildcard src/*/*.c)
OBJ_BUILD = build/
BIN_DIR = bin/
HED_DIR = include/
TEST_DIR = test/
OBJ = $(SRC:.c=.o)
stdWullie: $(OBJ)
mkdir $(OBJ_BUILD)
mkdir $(BIN_DIR)
$(CC) -nostdlib -shared -o libstdWullie.so -fno-stack-protector -fPIC $(OBJ)
mv $(OBJ) $(OBJ_BUILD)
mv libstdWullie.so $(BIN_DIR)
cp $(HED_DIR)stdWullie.h $(BIN_DIR)
clean:
rm -rf $(OBJ_BUILD) $(BIN_DIR)
$(MAKE) stdWullie
-47
View File
@@ -1,47 +0,0 @@
# StdWullie
this lib is an attempt to make some better functions without the use of glibC
# OS support
x64 Linux
x64 freebsd(not tested yet)
## features
- print: just prints text to console
- ColorPrint: changes the foreground color of text to an ANSI color
- BackgroundPrint: changs the background color of text to an ANSI color
- safeError: calls exit -1 and prints a brief description
- riskyError: prints error but continues
- Wopen: opens a file
- closeFile: closes an open file
- mkdir: does what it says on the tin
- sleeper: forces a system interupt for X number of seconds
- lengthStr: gets the length of a string
- parseInt: takes the ascii numbers and converst them into an int e.g '1' into 1
- invSqrt: fast inverse square root
## how to build
to build all thats needed is the gcc compiler and a version of linux
there is 2 version that can be built a shared lib and an executable, the latter is for testing the functions
### commands
these first command are the same for both versions
- git clone https://git.wulliestudio.com/wullie/libstdwullie
- cd libstdwullie
#### executable
- gcc -I ./include src/*.c -nostdlib -fno-stack-protector -o stdwullie
- ./stdwullie
#### sharedlib
- make clean
## license
this sofware is licensed under wrathmark license see [licence](license/) folder for more info
## words of wisdom
do not stare at the abyss for to long for not only does it stare back it screams
+11 -14
View File
@@ -1,11 +1,12 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#ifndef LOCALHEADER_H #ifndef LOCALHEADER_H
#define LOCALHEADER_H #define LOCALHEADER_H
// syscall macros // syscall macros, replaces the number based on system
#ifdef __linux__ #ifdef __linux__
#define SYS_read 0 #define SYS_read 0
#define SYS_write 1 #define SYS_write 1
@@ -14,7 +15,7 @@
#define SYS_sleep 35 #define SYS_sleep 35
#define SYS_exit 60 #define SYS_exit 60
#define SYS_mkdir 83 #define SYS_mkdir 83
#define SYS_getTime 228
#elif __FreeBSD__ #elif __FreeBSD__
#define SYS_read 3 #define SYS_read 3
@@ -24,20 +25,16 @@
#define SYS_sleep 244 #define SYS_sleep 244
#define SYS_exit 1 #define SYS_exit 1
#define SYS_mkdir 136 #define SYS_mkdir 136
#define SYS_getTime 232
#endif #endif
// local functions // functions that SHOULD NOT be exposed to a dev using the library
void exit(int code); void exit(int code);
// time spec for sleep long syscall1(long number, long args1);
typedef struct timespec { long syscall2(long number, long args1, long args2);
long tv_sec; long syscall3(long number, long args1, long args2, long args3);
long tv_nsec; long syscall4(long number, long args1, long args2, long args3, long args4);
} timespec;
// syscalls go here i dont want them exposed to the user
long syscall1(long number, long arg1);
long syscall2(long number, long arg1, long arg2);
long syscall3(long number, long arg1, long arg2, long arg3);
long syscall4(long number, long arg1, long arg2, long arg3, long arg4);
#endif #endif
-15
View File
@@ -1,15 +0,0 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef FILES_h
#define FILES_h
// file handling
long Wopen(const char *pathname, int flags, int mode);
long closeFile(long fd);
long reader(long fd, char *string);
long mkdir(const char *filePath, int mode);
#endif
BIN
View File
Binary file not shown.
+30 -34
View File
@@ -1,41 +1,37 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#ifndef MAIN_h #ifndef STDWULLIE_H
#define MAIN_h #define STDWULLIE_H
// import everything
//types
#include "stdWullie/definitions/int.h"
#include "stdWullie/definitions/typeNull.h"
#include "stdWullie/definitions/typeBool.h"
// namespaces
#include "stdWullie/namespaces/print.h"
#include "stdWullie/namespaces/convert.h"
#include "stdWullie/namespaces/random.h"
// errors & exits
#include "stdWullie/exit.h"
// time
#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"
// gay ass glibc shit why in the fuck does this exist like that // string
#undef NULL #include "stdWullie/String/colours.h"
#define NULL 0
#define bool _Bool
#define true 1
#define false 0
// import tree
#include "string.h"
#include "files.h"
// memory
void Wmalloc();
// error handling
void safeError(char *error);
void riskyError();
// math
int intParser(char *rawInt);
float invSqrt(float x);
float floatPow(float base, int exponant);
int intPow(int base, int exponant0);
// misc
void sleeper(long seconds);
// congtates youse have made it to the end
#endif #endif
@@ -1,11 +1,16 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#ifndef STRING_h #ifndef STRCOLOUR_h
#define STRING_h #define STRCOLOUR_h
// ANSI colours
// Normal value not white as normal could be something else on other systems
#define NORMAL "\x1b[m"
// ANSI colors
// foreground // foreground
#define BLACK "\x1b[30m" #define BLACK "\x1b[30m"
#define RED "\x1b[31m" #define RED "\x1b[31m"
@@ -15,7 +20,6 @@
#define MAGENTA "\x1b[35m" #define MAGENTA "\x1b[35m"
#define CYAN "\x1b[36m" #define CYAN "\x1b[36m"
#define WHITE "\x1b[37m" #define WHITE "\x1b[37m"
#define NORMAL "\x1b[m"
// background // background
#define BBLACK "\x1b[40m" #define BBLACK "\x1b[40m"
@@ -26,21 +30,4 @@
#define BMAGENTA "\x1b[45m" #define BMAGENTA "\x1b[45m"
#define BCYAN "\x1b[46m" #define BCYAN "\x1b[46m"
#define BWHITE "\x1b[47m" #define BWHITE "\x1b[47m"
// printing
void ColorPrint(char *string, char *color);
void BackgroundPrint(char *string, char *Bcolor);
void print(char *string);
long unsigned lengthStr(char *string);
// conversion
void upper(char string[]);
void lower(char string[]);
const char *intCon(int num);
void input();
#endif #endif
+54
View File
@@ -0,0 +1,54 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
//defined like stdint to avoid confilict
#ifndef _STDINT_H
#define _STDINT_H 1
// create the types for signed ints using base structures
typedef signed char int8_t;
typedef signed short int int16_t;
typedef signed int int32_t;
typedef signed long long int int64_t;
// same as above but unsigned
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
// misc int types
typedef unsigned long size_t;
// macros for long long, unsigned and unsigned long long
#define U unsigned
#define LL long long
#define ULL unsigned long long
// int max values
#define INT8_MAX ((int8_t)0x7F)
#define INT16_MAX ((int16_t)0x7FFF)
#define INT32_MAX ((int32_t)0xFFFFFFFF)
#define INT64_MAX ((int64_t)0xFFFFFFFFFFFFFFFFLL)
// max values for uint's
#define UINT8_MAX ((uint8_t)0xFF)
#define UINT16_MAX ((uint16_t)0xFFFF)
#define UINT32_MAX ((uint32_t)0xFFFFFFFFU)
#define UINT64_MAX ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
// min values for uint
#define UINT8_MIN ((uint8_t)0)
#define UINT16_MIN ((uint16_t)0)
#define UINT32_MIN ((uint32_t)0)
#define UINT64_MIN ((uint64_t)0)
//min values for int
#define INT8_MIN ((int8_t)(-INT8_MAX - 1))
#define INT16_MIN ((int16_t)(-INT16_MAX - 1))
#define INT32_MIN ((int32_t)(-INT32_MAX - 1))
#define INT64_MIN ((int64_t)(-INT64_MAX - 1))
#endif
+14
View File
@@ -0,0 +1,14 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef TIMESPEC_H
#define TIMESPEC_H
// storage for seconds and nano seconds
typedef struct timespec{
long tv_sec;
long tv_nsec;
}timespec;
#endif
+13
View File
@@ -0,0 +1,13 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef TYPEBOOL_h
#define TYPEBOOL_h
// just 3 lines but its cleaner here
#define bool _Bool
#define false 0
#define true 1
#endif
+12
View File
@@ -0,0 +1,12 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef TYPENULL_h
#define TYPENULL_h
// 2 line of gay shit maybe more if i do pointers
#undef NULL
#define NULL 0
#endif
@@ -0,0 +1,15 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef UMODETYPES_H
#define UMODETYPES_H
#ifdef __linux__
#define DefaultMode 255
#elif __FreeBSD__
#define DefaultMode 255
#endif
#endif
+11
View File
@@ -0,0 +1,11 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef ERROR_H
#define ERROR_H
void safeError(char *error);
void riskyError();
#endif
+9
View File
@@ -0,0 +1,9 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef CLOSEOPEN_H
#define CLOSEOPEN_H
long Wopen(const char *pathname, int flags, int mode);
long closeFile(int fd);
#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);
+12
View File
@@ -0,0 +1,12 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef READWRITE_H
#define READWRITE_H
long reader(long fd, char *string, size_t buflen);
long writer(long fd, const char *string, size_t buflen);
#endif
+27
View File
@@ -0,0 +1,27 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef TYPECONVERSION_H
#define TYPECONVERSION_H
#include "stdWullie/definitions/int.h"
typedef struct{
// string manipulation
void (*toUpper)(char string[]);
void (*toLower)(char string[]);
// the numbers mason, what do they mean
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);
}ConversionNameSpace;
extern const ConversionNameSpace convert;
#endif
+17
View File
@@ -0,0 +1,17 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#ifndef PRINT_H
#define PRINT_H
typedef struct{
void (*text)(char *string);
void (*nl)(char *string);
void (*colour)(char *string, char *colour);
void (*background)(char *string, char *Bcolour);
}PrintNameSpace;
extern const PrintNameSpace print;
#endif
+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
+15
View File
@@ -0,0 +1,15 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
// deals with time shit like sleeping and getting the unix epoch
#ifndef TIME_H
#define TIME_H
#include "stdWullie/definitions/timespec.h"
void sleeper(long seconds);
int unixTime();
#endif
-27
View File
@@ -1,27 +0,0 @@
Copyright (C) 2026, wullie, https://wulliestudio.com
This license grants the right to copy modify and distribute the source at will under the following conditions:
I) The source must not be used to train AI(Artificial Intelligence)
II) If this license is packaged with a compiled binary a copy of source code must be provided along side said binary
III) In the case of selling original source by the copyright holder the holder does not have to immediately post the source how ever the source must be published with in 3 months
IV) For digital media e.g. Digital art and video no raw export(source) needs to be provided.
Dual or multi license:
In the case of multiple licenses this license will only apply to work made by the holder in separate projects that include other licensed content
Warranty for software:
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Warranty for digital media:
THE MEDIA IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MEDIA OR THE USE OR OTHER DEALINGS IN THE MEDIA
+38
View File
@@ -0,0 +1,38 @@
// 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/exit.h"
#include "stdWullie/definitions/typeNull.h"
#include "stdWullie/namespaces/print.h"
#include "stdWullie/String/colours.h"
// exit not ment to be used in other programs
void exit(int code){
syscall1(SYS_exit, code);
for(;;){}
}
// safty last
// errors out with either an error message or generic, and exits
void safeError(char *error){
// if the user does provide an error message
if(error == NULL){
print.text(error);
print.colour("exiting program with code -1\n", RED);
exit(-1);
}
// if no error was provided
print.text("something went wrong: ");
print.colour("exiting with code -1\n", RED);
exit(-1);
}
// safty??
void riskyError(){
print.text("there was an error\n");
return;
}
-33
View File
@@ -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);
}
+30
View File
@@ -0,0 +1,30 @@
// 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/exit.h"
#include "stdWullie/filehandle/closeOpen.h"
// hanles operations for opening and closeing files
// it should be set to W for wumbo
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");
}
syscall3(SYS_open, (long)pathname, flags, mode);
}
long closeFile(int fd){
if(fd == NULL){
safeError("A null file descriptor was passed");
syscall2(SYS_close, fd, 0);
}
}
+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);
}
+26
View File
@@ -0,0 +1,26 @@
// 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/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");
}
syscall3(SYS_read, fd, (long)string, (long)buflen);
}
long writer(long fd, const char *string, size_t buflen){
if(buflen <=0){
safeError("can not write 0 characters to a file");
}
syscall3(SYS_write, fd, (long)string, (long)buflen);
}
-43
View File
@@ -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);
}
+51 -31
View File
@@ -1,70 +1,91 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#include "LocalHeader.h"
#include "stdWullie.h" #include "stdWullie.h"
#include "localheader.h"
// decleration for random
int randomTest();
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
if(argc != 2){ if(argc != 2){
print("test functions for stdWullie use agruments 1 - 3 to test features\n"); print.nl("to many or to few arguments were provided");
print.nl("the test functions for StdWullie use 1 - 7");
return 0; return 0;
} }
char *rawArg = argv[1]; long argNumb = convert.toInt(argv[1]);
long argNum = intParser(rawArg);
switch(argNum){ switch(argNumb){
case 1: case 1:
print("look Ma no stdlib\n"); print.text("look Ma no stdlib\n");
ColorPrint("NOW WITH COLORS\n", RED); print.colour("NOW WITH COLOURS\n", RED);
BackgroundPrint("and backgrounds\n", BBLUE); print.background("and with backgrounds\n", BBLUE);
break; break;
case 2: case 2:
print("test for safe exit\n"); print.nl("test for safe exit, should close the program");
safeError(NULL); safeError(NULL);
break; break;
case 3: case 3:
print("sleep for 2 seconds before exit\n"); print.nl("sleeps for 2 seconds: program will terminate like other test cases");
sleeper(2); sleeper(2);
break; break;
case 4: case 4:
char string[] = "contvers to upper then to lower\n"; char string[] = "converts to upper then to lower\n";
upper(string); convert.toUpper(string);
print(string); print.text(string);
lower(string); convert.toLower(string);
print(string); print.text(string);
break; break;
case 5: case 5:
print("making a test dir with the name test\n"); print.nl("makes a test directory with user permissions");
mkdir("test", 0); mkdir("test", DefaultMode);
break; break;
case 6: case 6:
print("turning a int to string: "); print.nl("numbers into string i fucking give up");
int num = 8001; int cunt = 68;
char *str = intCon(num); char *output = convert.I32toStr(cunt);
print(str); print.nl(output);
print("\n"); break;
case 7:
print.nl("tests for random number generation: xor shift32 64 and choice");
randomTest();
break; break;
default: default:
print("no args given or arg is out of range\n"); print.nl("args is out or range or is NAN please check avaible args with ./stdwullie");
break; break;
} }
return 0; return 0;
} }
// #I say softly to myself "FUCK YOUR STDLIB"# int randomTest(){
// handles the main loop 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(){ __attribute__((naked)) void _start(){
__asm__ __volatile__( __asm__ __volatile(
"xor %ebp, %ebp\n" "xor %ebp, %ebp\n"
"mov (%rsp), %rdi\n" "mov (%rsp), %rdi\n"
"lea 8(%rsp), %rsi\n" "lea 8(%rsp), %rsi\n"
@@ -72,6 +93,5 @@ __attribute__((naked)) void _start(){
"call main\n" "call main\n"
"mov %rax, %rdi\n" "mov %rax, %rdi\n"
"call exit\n" "call exit\n"
); );
} }
-62
View File
@@ -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(){
}
+28
View File
@@ -0,0 +1,28 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#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,
};
+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
#include "stdWullie/namespaces/print.h"
void printText(char *string);
void printReturn(char *string);
void ColourPrint(char *string, char *colour);
void BackgroundPrint(char *string, char *Bcolour);
const PrintNameSpace print = {
.text = printText,
.nl = printReturn,
.colour = ColourPrint,
.background = BackgroundPrint,
};
+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;
}
-10
View File
@@ -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(){
}
+35 -32
View File
@@ -1,15 +1,17 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#include "stdWullie.h" #include "LocalHeader.h"
#include "localheader.h" #include "stdWullie/definitions/typeNull.h"
#include "stdWullie/String/colours.h"
// handles the length of a string for print #include "stdWullie/exit.h"
long unsigned lengthStr(char *string){ long unsigned lengthStr(char *string){
if(string == NULL){ if(string == NULL){
safeError("error: a string was passed with a null value terminating program"); safeError("a string was passed with a lenght of 0");
} }
char *cursor = string; char *cursor = string;
while(*cursor){ while(*cursor){
cursor++; cursor++;
@@ -18,46 +20,47 @@ long unsigned lengthStr(char *string){
return result; return result;
} }
// its print what do you expect? for it to read? // its print what did you expect? for it to read?
void print(char *string){ void printText(char *string){
syscall3(SYS_write, 1, (long)string, lengthStr(string)); syscall3(SYS_write, 1, (long)string, lengthStr(string));
} }
// it can do everythig print can but better void printReturn(char *string){
void ColorPrint(char *string, char *color){ syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)color, lengthStr(color)); syscall3(SYS_write, 1, (long)"\n", 6);
}
// it can do everything that print can but better
void ColourPrint(char *string, char *colour){
syscall3(SYS_write, 1, (long)colour, lengthStr(colour));
syscall3(SYS_write, 1, (long)string, lengthStr(string)); syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1); syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
} }
// instead of changing the foreground it changes the background // changes background instead of foreground
void BackgroundPrint(char *string, char *Bcolor){ void BackgroundPrint(char *string, char *Bcolour){
syscall3(SYS_write, 1, (long)Bcolor, lengthStr(Bcolor)); syscall3(SYS_write, 1, (long)Bcolour, lengthStr(Bcolour));
syscall3(SYS_write, 1, (long)string, lengthStr(string)); syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1); syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
} }
// converts a sting to uppercase // changes all letters to upper or lower depending on whats called
void upper(char string[]){ void upper(char string[]){
int i = 0; int i = 0;
while(string[i] != '\0'){ while(string[i] != '\0'){
if(string[i] >= 'a' && string[i] <= 'z') { if(string[i] >= 'a' && string[i] <= 'z'){
string[i] = string[i] - 32; 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++; i++;
} }
} }
void lower(char string[]){
int i = 0;
while(string[i] != '\0'){
if(string[i] >= 'A' && string[i] <= 'Z'){
string[i] = string[i] + 32;
}
i++;
}
}
+138 -35
View File
@@ -1,45 +1,148 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#include "string.h" #include "stdWullie/definitions/int.h"
#include "stdWullie/definitions/typeNull.h"
// turns strings into numbers
int intParser(char *rawInt){
int result = 0; char *cursor = rawInt;
// converts int to string while(*cursor >= '0' && *cursor <= '9'){
const char *intCon(int number){ result = result * 10 + (*cursor - '0');
int i = 0, isNegative = 0; cursor++;
static char string[34]; }
if(number < 0){ return result;
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){ // reverser
int i = 0, isNegative = 0; void reverseString(char string[], int index){
static char string[32]; 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;
}
+12 -24
View File
@@ -1,68 +1,56 @@
// this code is licenced under Wrathmark licence // this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com // © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights // please see attached licence for full usage and rights
#include "localheader.h" #include "LocalHeader.h"
// look at me I am the handler now // look at me I am the handler now
// syscall1
// each numbered syscall take that amount of arguments eg syscall1 takes one arg
long syscall1(long number, long arg1){ long syscall1(long number, long arg1){
long result; long result;
// asm for a system call with one arg
__asm__ __volatile( __asm__ __volatile(
"syscall" "syscall"
: "=a"(result) : "=a"(result)
: "a"(number), "D"(arg1) : "a"(number), "D"(arg1)
: "rcx", "r11", "memory" : "rcx", "r11", "memory"
); );
return result; return result;
} }
// syscall2
long syscall2(long number, long arg1, long arg2){ long syscall2(long number, long arg1, long arg2){
long result; long result;
// asm for system call with 2 args
__asm__ __volatile( __asm__ __volatile(
"syscall" "syscall"
: "=a"(result) : "=a"(result)
: "a"(number), "D"(arg1), "S"(arg2) : "a"(number), "D"(arg1), "S"(arg2)
: "rcx", "r11","memory" : "rcx", "r11", "memory"
); );
return result; return result;
} }
// syscall3
long syscall3(long number, long arg1, long arg2, long arg3){ long syscall3(long number, long arg1, long arg2, long arg3){
long result; long result;
// asm for a system call with 3 args
__asm__ __volatile( __asm__ __volatile(
"syscall" "syscall"
: "=a"(result) : "=a"(result)
: "a"(number), "D"(arg1), "S"(arg2), "d"(arg3) : "a"(number), "D"(arg1), "S"(arg2), "d"(arg3)
: "rcx", "r11", "memory" : "rcx", "r11", "memory"
); );
return result; return result;
} }
// syscall4
long syscall4(long number, long arg1, long arg2, long arg3, long arg4){ long syscall4(long number, long arg1, long arg2, long arg3, long arg4){
long result; long result;
register long r10 __asm__("r10") = arg4;
__asm__ __volatile( __asm__ __volatile(
"syscall" "syscall"
: "=a"(result) : "=a"(result)
: "a"(number), "D"(arg1), "S"(arg2), "d"(arg3), "b"(arg4) : "a"(number), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10)
: "rcx", "r11", "memory" : "rcx", "r11", "memory"
); );
return result; return result;
} }
+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/time.h"
#include "LocalHeader.h"
// #you out of touch, im out of time when youre not a round#
// # Schlaft mine Kindlein, schlaft doch ein, der Rabe hat nach der gerufen #
void sleeper(long seconds){
timespec duration = {0};
duration.tv_sec = seconds;
syscall2(SYS_sleep, (long)(&duration), 0);
}
int unixTime(){
timespec seconds = {0};
syscall2(SYS_getTime, 0, (long)(&seconds));
return seconds.tv_sec;
}