67 lines
1.7 KiB
C
67 lines
1.7 KiB
C
// 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/String/colours.h"
|
|
#include "stdWullie/exit.h"
|
|
long unsigned lengthStr(char *string){
|
|
|
|
if(string == NULL){
|
|
safeError("a string was passed with a lenght of 0");
|
|
}
|
|
|
|
char *cursor = string;
|
|
while(*cursor){
|
|
cursor++;
|
|
}
|
|
long unsigned result = cursor - string;
|
|
return result;
|
|
}
|
|
|
|
// its print what did you expect? for it to read?
|
|
void printText(char *string){
|
|
syscall3(SYS_write, 1, (long)string, lengthStr(string));
|
|
}
|
|
|
|
void printReturn(char *string){
|
|
syscall3(SYS_write, 1, (long)string, lengthStr(string));
|
|
syscall3(SYS_write, 1, (long)"\n", 8);
|
|
}
|
|
|
|
// 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)NORMAL, sizeof(NORMAL)-1);
|
|
}
|
|
|
|
// changes background instead of foreground
|
|
void BackgroundPrint(char *string, char *Bcolour){
|
|
syscall3(SYS_write, 1, (long)Bcolour, lengthStr(Bcolour));
|
|
syscall3(SYS_write, 1, (long)string, lengthStr(string));
|
|
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
|
|
}
|
|
|
|
// changes all letters to upper or lower depending on whats called
|
|
void upper(char string[]){
|
|
int i = 0;
|
|
while(string[i] != '\0'){
|
|
if(string[i] >= 'a' && string[i] <= 'z'){
|
|
string[i] = string[i] - 32;
|
|
}
|
|
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++;
|
|
}
|
|
}
|