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

88
source/argument.c Normal file
View File

@@ -0,0 +1,88 @@
#include "argument.h"
int argument_determineDatatypeOfArgument( char * argumentDeclaration, struct array * variables ) {
// int
if( text_isValidNumber( argumentDeclaration ) == 1 ) {
return -1;
}
// single quote
if( strchr( argumentDeclaration, 39) != NULL ) {
return -2;
}
// text
if( strchr( argumentDeclaration, '"') != NULL ) {
return -2;
}
struct variable * variableInstance = variable_getByName( variables, argumentDeclaration );
if( strcmp( variableInstance->datatype, "this_variable_is_missing" ) == 0 ) {
return 0;
}
if( strcmp( variableInstance->datatype, "int" ) == 0 ) {
return -1;
}
if( (strcmp(variableInstance->datatype, "char" ) == 0) && variableInstance->isPointer == 1 ) {
return -2;
}
//printf(" -----------check if this is an variable: %s %s\n\n", argumentDeclaration, variableInstance->datatype);
struct class * classInstance = application_getClassByClassName( allClasses, variableInstance->datatype );
if( classInstance == NULL ) {
printf(ANSI_COLOR_RED "\n\n\n\n ERROR class '%s' does not exist!!, The file containing the class '%s' is not included.\n\n\n\n" ANSI_COLOR_RESET, variableInstance->datatype, variableInstance->datatype );
return 0;
}
return ( int ) classInstance->classIndex;
}
struct array * argument_getArgumentDatatypes( struct array * arguments, struct array * variables ) {
int argumentCount = array_length( arguments );
struct array * argumentDatatypes = array_new();
for (int i = 0; i < argumentCount; ++i)
{
char * currentArgument = text_removeWhiteSpaces( array_get( arguments, i ) );
uintptr_t datatype = argument_determineDatatypeOfArgument( currentArgument, variables );
array_add( argumentDatatypes, (void *) datatype );
}
return argumentDatatypes;
}