From 4814f333fe7fc80d8ae033fafb482621e983ac4d Mon Sep 17 00:00:00 2001 From: wullie Date: Fri, 27 Mar 2026 01:00:31 +0000 Subject: [PATCH] Upload files to "string" --- string/input.c | 10 +++++++ string/printing.c | 63 ++++++++++++++++++++++++++++++++++++++++++++ string/typeConvert.c | 45 +++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 string/input.c create mode 100644 string/printing.c create mode 100644 string/typeConvert.c diff --git a/string/input.c b/string/input.c new file mode 100644 index 0000000..3f797f6 --- /dev/null +++ b/string/input.c @@ -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 "string.h" +#include "localheader.h" + +void input(){ + +} diff --git a/string/printing.c b/string/printing.c new file mode 100644 index 0000000..29b4f9f --- /dev/null +++ b/string/printing.c @@ -0,0 +1,63 @@ +// 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/string/typeConvert.c b/string/typeConvert.c new file mode 100644 index 0000000..9c2318d --- /dev/null +++ b/string/typeConvert.c @@ -0,0 +1,45 @@ +// 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]; + + +}