Files

165 lines
5.3 KiB
C
Raw Permalink Normal View History

2025-11-17 10:28:09 +01:00
#ifndef _file
#define _file
#include "class.h"
#include "application.h"
#include "lexer.h"
#include "fileSystem.h"
#include "string.h"
#include "text.h"
#include "template.h"
#include "array.h"
#include "stdbool.h"
#include "include.h"
typedef struct application application;
struct file{
char * filename;
char * source;
char * path;
char * dirname;
struct array * classes;
struct array * functions;
struct array * includes;
struct array * macros;
struct array * globals;
};
struct file * file_new();
void file_parseClassBody( lexer * currentLexer,
int fromKey,
int toIndex,
char * source,
struct file * fileInstance,
struct class * classInstance );
char * file_getFileNameFromIncludeFixed( char * include );
void file_parseMacros( struct file * fileInstance, struct array * files );
void file_composeFunctions( struct array * , struct array *, struct text * classHeader );
void file_extendClasses( struct file * fileInstance );
void file_compose( struct file * fileInstance, application * applicationInstance );
void file_instanciateTemplates( struct file * fileInstance );
void file_composeHeaderMacros( struct file * fileInstance, struct text * classHeader );
void file_addIncludesToHeader( struct text * classHeader, struct file * currentFile );
void file_preventDoubleLoadingHeader( struct text * classHeader, char * filename );
struct text * file_composeHeaderIncludes( struct file * currentFile );
void file_extractMethodsAndProperties( struct file * fileInstance );
void file_extractFunctions( struct file * fileInstance );
void file_extractInnerClass( lexer * currentLexer, int i, int key, struct file * fileInstance, char * source, int bodyCloseIndex );
char * file_extractFunctionDecleration( lexer * currentLexer, int key, int i, char * source );
void file_extractFunction( lexer * currentLexer, int i, int key, struct file * fileInstance, char * source, int bodyCloseIndex, struct array * classesArray );
void file_removeComments( struct file * fileInstance );
void file_extractGlobalVariable( lexer * currentLexer, int key, int i, struct file * fileInstance, char * source );
void file_extractClasses( struct file * fileInstance );
void file_extractClass( lexer * currentLexer, int key, int i, struct array * classesArray, int depth, char * source );
void file_composeFunctionArguments( struct functionLayout * currentFunction, struct text * methodSource, struct text * classHeader );
void file_composeFunction( struct functionLayout * currentFunction, struct array * sourceArray, struct text * classHeader );
void file_extractTemplates( struct file * fileInstance );
void file_composeConfigInformation( struct array * files, struct application * applicationInstance );
char * file_composePath( char * path, char * filename, char * extension );
void file_composeNewPointerFunction( struct text * finalSourceCode, int hasConstructor, struct array * constructorArguments, struct class * classInstance );
void file_composeConstructorCall( struct text * finalSourceCode, char * className, struct array * constructorArguments, int usePointer );
void file_composePropertieInitiations( struct text * finalSourceCode, int usePointers, struct class * classInstance );
void file_composeNewFunction( struct text * finalSourceCode, int hasConstructor, struct array * constructorArguments, struct class * classInstance );
void file_composeNewFunctions( struct text * finalSourceCode, struct class * classInstance, int hasConstructor, struct array * constructorArguments );
void file_composeNewHeaderDeclerations( struct text * classHeader, char * className, struct array * contructorArguments );
struct array * file_getConstructorArguments( struct class * classInstance, int * hasConstructor );
void file_composeClass( struct class * classInstance, struct text * classHeader, struct text * finalSourceCode );
void file_addLineBreaks( struct text * finalSourceCode, struct array * sourceArray );
void file_composeSourceHeader( struct text * finalSourceCode, char * filename );
void file_writeAll( struct array * sourceArray, struct text * classHeader, char * filename, array * classesArray, array * globals, char * relativePath, struct application * applicationInstance );
void file_parseFunctions( struct file * fileInstance, array * files );
void file_parseMethods( struct file * fileInstance, array * files );
void file_addVariablesFromFile( struct file * fileInstance, struct array * variables );
struct file * file_getFileByFileName( struct array * files, char * includeFileName );
char * file_getFileNameFromInclude( char * include );
char * file_extractInclude( struct file * fileInstance, char * source, lexer * currentLexer, int key, int i );
char * file_eraseDefine( char * source, int key, int lineBreakIndex );
char * file_extractDefine( struct file * fileInstance, char * source, int key, int i );
void file_extractMacros( struct file * fileInstance );
char * file_getBaseNameFromFileName( char * filename );
char * file_getPathFrom( char * filename );
int file_isLibCFileName( char * baseName );
char * file_removeExtensionFromFileName( char * path );
int file_hasLoadedFileName( char * fileName, struct array * loadedFileNames );
void file_loadUnloadedFiles( struct array * unloadedFileNames, struct array * loadedFileNames, char * path );
char * file_getSource( char * filename );
#endif