Initial commit

This commit is contained in:
2025-11-17 10:28:09 +01:00
parent 7bff81691f
commit 6ee36e26be
391 changed files with 110253 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <cache.h>
text * cache_getFile( cache * this, char * filePath ) {
struct file * currentFile = cache_getCachedFileByPath( this, filePath );
if( currentFile == NULL ) {
struct text * content = fileSystem_readFile( filesystem, filePath, "binary" );
cache_addFile( this, filePath, content );
return content;
} else {
return currentFile->content;
}
}
void cache_addFile( cache * this, char * filePath, struct text * content ) {
struct file * newFile = file_newPointer();
newFile->filePath = filePath;
newFile->content = content;
array_add( this->files, newFile );
}
struct file * cache_getCachedFileByPath( cache * this, char * filePath ) {
struct array * files = this->files;
int count = array_length( files );
for (int i = 0; i < count; ++i)
{
file * currentFile = array_get( files, i );
if( char_operator_compare( currentFile->filePath , filePath) ) {
return currentFile;
}
}
return NULL;
}
cache cache_new() {
cache instance;
instance.files = array_newPointer();
return instance;
}
cache * cache_newPointer() {
struct cache * pointer = malloc( sizeof ( struct cache ) );
pointer->files = array_newPointer();
return pointer;
}