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,231 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <array.h>
int array_length( array * this ) {
return this->total;
}
void * * array_data( array * this ) {
return this->items;
}
void * array_get( array * this, int index ) {
if ( index >= 0 && index < this->total ){
return this->items[index];
}
return NULL;
}
void array_set( array * this, int index, void * item ) {
if ( index >= 0 && index < this->total ){
this->items[ index ] = item;
}
}
void array_resize( array * this, int capacity ) {
void * * items = realloc( this->items, sizeof( void * ) * capacity );
this->items = items;
this->capacity = capacity;
}
void array_add( array * this, void * item ) {
if ( this->capacity == this->total ){
array_resize( this, this->capacity * 2 );
}
this->items[ this->total++ ] = item;
}
char * array_join( array * this, char * separator ) {
int count = array_length( this );
text * result = text_newPointer( "" );
for (int i = 0; i < count; ++i)
{
char * currentPart = this->items[ i ];
if( i > 0 ) {
text_append( result, separator );
}
text_append( result, currentPart );
}
return result->value;
}
void array_delete( array * this, int index ) {
if ( index < 0 || index >= this->total ){
return;
}
this->items[index] = NULL;
for ( int i = index; i < this->total - 1; i++ ) {
this->items[i] = this->items[i + 1];
this->items[i + 1] = NULL;
}
this->total--;
if ( this->total > 0 && this->total == this->capacity / 4 ){
array_resize( this, this->capacity / 2 );
}
}
int array_array_push( array * this, void * item ) {
array_add( this, item );
return this->total;
}
void array_unshift( array * this, void * item ) {
int length = this->total;
this->total++;
if ( this->capacity == this->total ){
array_resize( this, this->capacity * 2 );
}
for ( int i = length - 1; i >= 0; --i ) {
this->items[ i + 1 ] = this->items[ i ];
}
this->items[ 0 ] = item;
}
void * array_pop( array * this ) {
int length = this->total;
int lastIndex = length - 1;
void * lastItem = array_get( this, lastIndex );
array_delete( this, lastIndex );
return lastItem;
}
bool array_includes( array * this, char * value ) {
int count = array_length( this );
for ( int index = 0; index < count; ++index )
{
char * currentText = array_get( this, index);
if( char_operator_compare( currentText , value) ) {
return true;
}
}
return false;
}
array array_new() {
array instance;
instance.capacity = 10;
instance.total = 0;
instance.items = malloc( 10000000 );
return instance;
}
array * array_newPointer() {
struct array * pointer = malloc( sizeof ( struct array ) );
pointer->capacity = 10;
pointer->total = 0;
pointer->items = malloc( 10000000 );
return pointer;
}

View File

@@ -0,0 +1,71 @@
#ifndef _array
#define _array
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
#include <text.h>
#include <char.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct array{
int capacity;
int total;
void * * items;
} array;
int array_length( array * this );
void * * array_data( array * this );
void * array_get( array * this, int index );
void array_set( array * this, int index, void * item );
void array_resize( array * this, int capacity );
void array_add( array * this, void * item );
char * array_join( array * this, char * separator );
void array_delete( array * this, int index );
int array_array_push( array * this, void * item );
void array_unshift( array * this, void * item );
void * array_pop( array * this );
bool array_includes( array * this, char * value );
array array_new( );
array * array_newPointer( );
#endif
typedef struct array array;

View File

@@ -0,0 +1,169 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <char.h>
int char_operator_compare( char * this, char * b ) {
return char_compare( this, b );
}
void char_operator_add( char * this, char * b ) {
strcat( this, b );
}
char * char_operator_plus( char * this, char * b ) {
return char_concatenate( this, b );
}
int char_compare( char * this, char * b ) {
return strcmp( this, b ) == 0;
}
char * char_concatenate( char * this, char * b ) {
int lengthA = strlen( this );
int lengthB = strlen( b );
char * pointer = this;
char * copy = ( char * ) malloc( ( lengthA + lengthB + 1 ) * sizeof( char ) );
int idx = 0;
while ( * pointer != '\0' ){
copy[idx++] = *pointer++;
}
pointer = &b[0];
while ( * pointer != '\0' ){
copy[idx++] = *pointer++;
}
copy[ idx++ ] = '\0';
return &copy[0];
}
int char_includes( char * this, char * compare ) {
if ( strstr( this, compare ) != NULL ) {
return 1;
} else {
return 0;
}
}
char * char_clone( char * this ) {
char * newCopy = malloc( sizeof( char ) * strlen( this ) );
strcpy( newCopy, this );
return newCopy;
}
char * char_copy( char * this ) {
char * newCopy = malloc( sizeof( char ) * strlen( this ) );
strcpy( newCopy, this );
return newCopy;
}
struct array * char_split( char * this, char * needle ) {
char * haystack = char_clone( this );
struct array * keys = array_newPointer();
int count = 0;
char * tmp = haystack;
char * token = strtok( haystack, needle );
int i = 0;
while ( token ) {
array_add( keys, token );
token = (char *) strtok( NULL, needle );
}
return keys;
}
char * char_removeWhitespaceLeft( char * this ) {
char * s = this;
while(isspace(*s)) s++;
return s;
}
char * char_removeWhitespaceRight( char * this ) {
char * s = this;
char* back = s + strlen(s);
while( isspace( *--back ) );
*( back + 1 ) = '\0';
return s;
}
char * char_removeWhitespace( char * this ) {
return char_removeWhitespaceRight(char_removeWhitespaceLeft( this ) );
}

View File

@@ -0,0 +1,56 @@
#ifndef _char
#define _char
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
#include <string.h>
#include <ctype.h>
#include <dirent.h>
#include <array.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int char_operator_compare( char * this, char * b );
void char_operator_add( char * this, char * b );
char * char_operator_plus( char * this, char * b );
int char_compare( char * this, char * b );
char * char_concatenate( char * this, char * b );
int char_includes( char * this, char * compare );
char * char_clone( char * this );
char * char_copy( char * this );
struct array * char_split( char * this, char * needle );
char * char_removeWhitespaceLeft( char * this );
char * char_removeWhitespaceRight( char * this );
char * char_removeWhitespace( char * this );
#endif

View File

@@ -0,0 +1,394 @@
#include <classConfiguration.h>
char * __ClassNames[TOTAL_CLASS_COUNT] = { "array", "text", "char", "user", "address", "consoleManager", "vector2" };
int __ClassMethodCount[TOTAL_CLASS_COUNT] = { 12, 12, 12, 1, 1, 5, 6 };
int __ClassPropertyCount[TOTAL_CLASS_COUNT] = { 3, 4, 0, 5, 2, 0, 2 };
char * __ClassPropertyNames[TOTAL_CLASS_COUNT][30] = {
{ "capacity" , "total" , "items" },
{ "value" , "usevalue" , "length" , "capacity" },
{ },
{ "username" , "id" , "userlevel" , "hash" , "addresses" },
{ "street" , "number" },
{ },
{ "x" , "y" }
};
char * __ClassMethodNames[TOTAL_CLASS_COUNT][30] = {
{ "length" , "data" , "get" , "set" , "resize" , "add" , "join" , "delete" , "array_push" , "unshift" , "pop" , "includes" },
{ "operator_compare" , "operator_add" , "constructor" , "get" , "resize" , "append" , "appendBinary" , "appendObject" , "concatenate" , "toNative" , "whiteSpace" , "free" },
{ "operator_compare" , "operator_add" , "operator_plus" , "compare" , "concatenate" , "includes" , "clone" , "copy" , "split" , "removeWhitespaceLeft" , "removeWhitespaceRight" , "removeWhitespace" },
{ "constructor" },
{ "someMethod" },
{ "whiteSpace" , "logObject" , "log" , "error" , "createHorisontalLine" },
{ "constructor" , "operator_plus" , "operator_add" , "add" , "subtract" , "length" }
};
int __ClassPropertyOffsets[TOTAL_CLASS_COUNT][30] = {
{ offsetof( array, capacity ) , offsetof( array, total ) , offsetof( array, items ) },
{ offsetof( text, value ) , offsetof( text, usevalue ) , offsetof( text, length ) , offsetof( text, capacity ) },
{ },
{ offsetof( user, username ) , offsetof( user, id ) , offsetof( user, userlevel ) , offsetof( user, hash ) , offsetof( user, addresses ) },
{ offsetof( address, street ) , offsetof( address, number ) },
{ },
{ offsetof( vector2, x ) , offsetof( vector2, y ) }
};
int __ClassPropertyDatatypeIndices[TOTAL_CLASS_COUNT][30] = {
{-5 , -5 , 1 },
{-3 , -5 , -5 , -5 },
{ },
{-3 , -5 , -5 , -3 , 0 },
{-3 , -5 },
{ },
{1 , 1 }
};
void getArrayByClassIndex( int size, void * * voidArray, int * structByteSize, int classIndex ) {
switch( classIndex ) {
case 0:
voidArray = ( void ** ) ( struct array * ) malloc( sizeof( struct array ) * size );
*structByteSize = sizeof( struct array );
break;
case 1:
voidArray = ( void ** ) ( struct text * ) malloc( sizeof( struct text ) * size );
*structByteSize = sizeof( struct text );
break;
case 3:
voidArray = ( void ** ) ( struct user * ) malloc( sizeof( struct user ) * size );
*structByteSize = sizeof( struct user );
break;
case 4:
voidArray = ( void ** ) ( struct address * ) malloc( sizeof( struct address ) * size );
*structByteSize = sizeof( struct address );
break;
case 5:
voidArray = ( void ** ) ( struct consoleManager * ) malloc( sizeof( struct consoleManager ) * size );
*structByteSize = sizeof( struct consoleManager );
break;
case 6:
voidArray = ( void ** ) ( struct vector2 * ) malloc( sizeof( struct vector2 ) * size );
*structByteSize = sizeof( struct vector2 );
break;
}
}
void callMethodOfClass( int classIndex, int methodIndex, void * object ) {
switch( classIndex ) {
case 0:
switch( methodIndex ) {
case 0:
array_length( object );
break;
case 1:
array_data( object );
break;
case 10:
array_pop( object );
break;
}
break;
case 1:
switch( methodIndex ) {
case 9:
text_toNative( object );
break;
case 11:
text_free( object );
break;
}
break;
case 3:
switch( methodIndex ) {
case 0:
user_constructor( object );
break;
}
break;
case 4:
switch( methodIndex ) {
case 0:
address_someMethod( object );
break;
}
break;
case 5:
switch( methodIndex ) {
case 4:
consoleManager_createHorisontalLine( object );
break;
}
break;
case 6:
switch( methodIndex ) {
case 5:
vector2_length( object );
break;
}
break;
}
}
// #include "sqlite.h"
int getPropertyIndexOfClassIndex( int propertyCount, char ** propertyNames ) {
int propertyIdOfIndex = -1;
for ( int i = 0; i < propertyCount; ++i )
{
char * propertyName = propertyNames[i];
//printf("propertyName: %s\n", propertyName);
if( strcmp( propertyName, "id" ) == 0 ) {
propertyIdOfIndex = i;
break;
}
}
return propertyIdOfIndex;
}
/*
void getArrayByClassIndex( int items, void * * voidArray, int * structByteSize, int classIndex ) {
struct user * array;
switch( classIndex ) {
case 8:
array = ( struct user * ) malloc( sizeof( struct user ) * 1000 );
voidArray = ( void ** ) array;
*structByteSize = sizeof( struct user );
break;
default:
array = ( struct user * ) malloc( sizeof( struct user ) * 1000 );
voidArray = ( void ** ) array;
*structByteSize = sizeof( struct user );
}
}*/
char * getClassName( int classIndex ) {
return __ClassNames[ classIndex ];
}
int getClassIndexByClassName( char * className ) {
for (int i = 0; i < TOTAL_CLASS_COUNT; ++i)
{
char * currentClassName = __ClassNames[ i ];
if( strcmp( className, currentClassName ) == 0 ) {
//printf("find classname: %s\n", className);
return i;
}
}
return -1;
}
int getPropertyCountByClassIndex( int classIndex ) {
return __ClassPropertyCount[ classIndex ];
}
char * * getPropertiesByClassIndex( int classIndex ) {
return __ClassPropertyNames[ classIndex ];
}
int * getPropertyOffsetsByClassIndex( int classIndex ) {
return __ClassPropertyOffsets[ classIndex ];
}
int getPropertyOffsetByPropertyIndex( int * propertyOffsets, int propertyIndex ) {
return propertyOffsets[ propertyIndex ];
}
int * getPropertyDatatypeIndexesByClassIndex( int classIndex ) {
return __ClassPropertyDatatypeIndices[ classIndex ];
}
int getPropertyDatatypeIndex( int * propertyDatatypeIndices, int propertyIndex ) {
return propertyDatatypeIndices[ propertyIndex ];
}
int getPropertyIndexByPropertyName( int classID, char * propertyName ) {
int propertyCount = getPropertyCountByClassIndex( classID );
char * * propertyNames = getPropertiesByClassIndex( classID );
for (int i = 0; i < propertyCount; ++i)
{
char * propertyNameCompare = propertyNames[i];
if( strcmp( propertyName, propertyNameCompare ) == 0 ) {
return i;
}
}
return -1;
}
int getMethodCountByClassIndex( int classIndex ) {
return __ClassMethodCount[ classIndex ];
}
char * * getMethodNamesByClassIndex( int classIndex ) {
return __ClassMethodNames[ classIndex ];
}
int getMethodIndexByPropertyName( int classID, char * propertyName ) {
int methodCount = getMethodCountByClassIndex( classID );
char * * methodNames = getMethodNamesByClassIndex( classID );
for (int i = 0; i < methodCount; ++i)
{
char * propertyNameCompare = methodNames[i];
if( strcmp( propertyName, propertyNameCompare ) == 0 ) {
return i;
}
}
return -1;
}

View File

@@ -0,0 +1,61 @@
#ifndef __classConfiguration
#define __classConfiguration
#include <stddef.h>
#include <array.h>
#include <text.h>
#include <char.h>
#include <user.h>
#include <street.h>
#include <console.h>
#include <vector2.h>
#define TOTAL_CLASS_COUNT 7
extern char * __ClassNames[TOTAL_CLASS_COUNT];
extern int __ClassPropertyCount[TOTAL_CLASS_COUNT];
extern char * __ClassPropertyNames[TOTAL_CLASS_COUNT][30];
extern int __ClassPropertyOffsets[TOTAL_CLASS_COUNT][30];
extern int __ClassPropertyOffsets[TOTAL_CLASS_COUNT][30];
#include <string.h>
int getPropertyIndexOfClassIndex( int propertyCount, char ** propertyNames );
void getArrayByClassIndex( int size, void * * voidArray, int * structByteSize, int classIndex );
int getClassIndexByClassName( char * className );
char * getClassName( int classIndex );
int getPropertyCountByClassIndex( int classIndex );
char * * getPropertiesByClassIndex( int classIndex );
int * getPropertyOffsetsByClassIndex( int classIndex );
int getPropertyOffsetByPropertyIndex( int * propertyOffsets, int propertyIndex );
int getPropertyIndexByPropertyName( int classID, char * propertyName );
int * getPropertyDatatypeIndexesByClassIndex( int classIndex );
int getPropertyDatatypeIndex( int * propertyDatatypeIndices, int propertyIndex );
int getMethodCountByClassIndex( int classIndex );
char * * getMethodNamesByClassIndex( int classIndex );
int getMethodIndexByPropertyName( int classID, char * propertyName );
void callMethodOfClass( int classIndex, int methodIndex, void * object );
#endif

View File

@@ -0,0 +1,269 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <console.h>
struct consoleManager * console;
char * consoleManager_whiteSpace( consoleManager * this, int whiteSpaceCount ) {
char * output = malloc( whiteSpaceCount + 1 );
for (int i = 0; i < whiteSpaceCount; ++i)
{
strcat( output, " " );
}
output[whiteSpaceCount] = 0;
return output;
}
void consoleManager_logObject( consoleManager * this, void * voidPointer, int classIndex, int level ) {
char * whiteSpace = consoleManager_whiteSpace( this, level );
level++;
char * className = getClassName( classIndex );
printf( "\n\n" );
printf( whiteSpace );
printf(" %s : {\n", className );
char * * propertyNames = getPropertiesByClassIndex( classIndex );
int propertyCount = getPropertyCountByClassIndex( classIndex );
int * propertyOffsets = getPropertyOffsetsByClassIndex( classIndex );
int * datatypeIndices = getPropertyDatatypeIndexesByClassIndex( classIndex );
char * pointer = voidPointer;
for (int propertyIndex = 0; propertyIndex < propertyCount; ++propertyIndex)
{
char * propertyName = propertyNames[propertyIndex];
printf( whiteSpace );
printf(" %-20s : ", propertyName);
int propertyDatatypeIndex = getPropertyDatatypeIndex( datatypeIndices, propertyIndex );
int propertyOffset = getPropertyOffsetByPropertyIndex( propertyOffsets, propertyIndex );
if( propertyDatatypeIndex == -5 ) {
int value = *( int * )(pointer + propertyOffset);
printf( whiteSpace );
printf("%-20i ", value );
} else if( propertyDatatypeIndex == -3 ) {
uintptr_t * value = ( uintptr_t * ) ( pointer + propertyOffset );
printf( whiteSpace );
printf( "%-20s", ( char * ) * value );
} else if( propertyDatatypeIndex > 0 ) {
char * memberClassName = getClassName( propertyDatatypeIndex );
if( strcmp( memberClassName, "array" ) == 0 ) {
struct array * memberArray = *(struct array ** )(pointer + propertyOffset) ;
if( memberArray == NULL ) {
printf(" this has to be fixed, array is not created.\n");
continue;
}
int numberRows = array_length( memberArray );
int * arrayPointer = ( int * ) memberArray->items;
for (int k = 0; k < numberRows; ++k)
{
void * pointer = array_get( memberArray, k );
short * row = (short*)(pointer);
consoleManager_logObject( this, pointer, (int) *row, level );
}
}
}
printf("\n");
}
printf( whiteSpace );
printf( " }\n" );
}
void consoleManager_log( consoleManager * this, int count, int datatypes[], ... ) {
int level = 0;
va_list args;
va_start( args, count );
for (int i = 0; i < count; ++i)
{
int datatype = datatypes[i];
if( datatype == -2 ) {
char * message = va_arg( args, char * );
printf("%s", message);
}
if( datatype == -1 ) {
int message = va_arg( args, int );
printf("%i", message);
}
if( datatype > 0 ) {
void * voidPointer = va_arg( args, void * );
consoleManager_logObject( this, voidPointer, datatype, level++ );
}
printf(" ");
}
printf("\n");
va_end( args);
}
void consoleManager_error( consoleManager * this, char * message ) {
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_DIM_YELLOW "\x1b[33m"
#define ANSI_COLOR_BLUE "\x1b[34m"
#define ANSI_COLOR_MAGENTA "\x1b[35m"
#define ANSI_COLOR_CYAN "\x1b[36m"
#define ANSI_COLOR_RESET "\x1b[0m"
#define ANSI_COLOR_BRIGHT_YELLOW "\x1b[93m"
printf( ANSI_COLOR_RED );
printf( "\n\n Error: " );
printf( "%s\n\n", message );
printf( ANSI_COLOR_RESET );
exit( 0 );
}
void consoleManager_createHorisontalLine( consoleManager * this ) {
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
for (int i = 0; i < w.ws_col; ++i)
{
printf("-");
};
printf("\n");
}
consoleManager consoleManager_new() {
consoleManager instance;
return instance;
}
consoleManager * consoleManager_newPointer() {
struct consoleManager * pointer = malloc( sizeof ( struct consoleManager ) );
return pointer;
}

View File

@@ -0,0 +1,66 @@
#ifndef _console
#define _console
// Macros
#define isCompatible(x, type) _Generic(x, type: true, default: false)
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
#include <vector2.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdbool.h>
#include <classConfiguration.h>
typedef struct consoleManager{
} consoleManager;
char * consoleManager_whiteSpace( consoleManager * this, int whiteSpaceCount );
void consoleManager_logObject( consoleManager * this, void * voidPointer, int classIndex, int level );
void consoleManager_log( consoleManager * this, int count, int datatypes[], ... );
void consoleManager_error( consoleManager * this, char * message );
void consoleManager_createHorisontalLine( consoleManager * this );
extern struct consoleManager * console;
consoleManager consoleManager_new( );
consoleManager * consoleManager_newPointer( );
#endif
typedef struct consoleManager consoleManager;

View File

@@ -0,0 +1,76 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <examples/example.console.log.h>
void main( ) {
struct user * newUser = user_newPointer();
newUser->id = 1;
newUser->username = "peter";
newUser->userlevel = 2134;
newUser->hash = "#234234325";
struct array * addresses = newUser->addresses;
address * someAddress = address_newPointer();
someAddress->street = "HiLane";
someAddress->number = 1234;
array_add( addresses, someAddress );
address * otherAddress = address_newPointer();
otherAddress->street = "OtherLane";
otherAddress->number = 4567;
array_add( addresses, otherAddress );
printf("adresses count: %i\n\n", array_length( addresses ) );
char * something = "this is from an char * ";
int somethingElse = 123;
consoleManager_log( console, 10, (int[10]){ -2,-1,-2,-2,-1,-2,-2,-1,3,-2 }, "Goedendag",
123456,
"en een andere text.",
something,
somethingElse,
"something en something",
"in native c",
23456,
newUser,
"and some text again" );
}
void abort( ) {
}

View File

@@ -0,0 +1,30 @@
#ifndef _example_console_log
#define _example_console_log
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
#include "../array.h"
#include "../user.h"
#include "../street.h"
#include "../console.h"
void abort( );
void main( );
#endif

View File

@@ -0,0 +1,30 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <street.h>
void address_someMethod( address * this ) {
}
address address_new() {
address instance;
return instance;
}
address * address_newPointer() {
struct address * pointer = malloc( sizeof ( struct address ) );
return pointer;
}

View File

@@ -0,0 +1,39 @@
#ifndef _street
#define _street
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
typedef struct address{
char * street;
int number;
} address;
void address_someMethod( address * this );
address address_new( );
address * address_newPointer( );
#endif
typedef struct address address;

View File

@@ -0,0 +1,205 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <text.h>
int text_operator_compare( text * this, text * b ) {
if( strcmp( this->value, b->value ) == 0 ) {
return 1;
} else {
return 0;
}
}
text * text_operator_add( text * this, char * b ) {
text_append( this, b );
return this;
}
void text_constructor( text * this, char * value ) {
this->length = strlen( value );
if( this->length > this->capacity ) {
this->capacity = this->length * 2;
}
this->value = malloc( sizeof( char ) * this->capacity );
strcpy( this->value, value );
}
char text_get( text * this, int index ) {
return this->value[ index ];
}
void text_resize( text * this, int size ) {
this->value = realloc( this->value, size );
this->capacity = size;
}
text * text_append( text * this, char * value ) {
int originalLength = this->length;
int newValueLength = strlen( value );
this->length += newValueLength;
if( this->length > this->capacity ) {
text_resize( this, this->length * 2 );
}
memcpy( this->value + originalLength, value, newValueLength + 1 );
return this;
}
text * text_appendBinary( text * this, char * value, int size ) {
int originalLength = this->length;
int newValueLength = size;
this->length += newValueLength;
if( this->length > this->capacity ) {
text_resize( this, this->length * 2 );
}
memcpy( this->value + originalLength, value, newValueLength + 1 );
return this;
}
text * text_appendObject( text * this, text * object ) {
int originalLength = this->length;
int newValueLength = object->length;
this->length += newValueLength;
if( this->length > this->capacity ) {
text_resize( this, this->length * 2 );
}
memcpy(this->value + originalLength, object->value, newValueLength + 1);
return this;
}
text * text_concatenate( text * this, char * value ) {
text * copy = text_newPointer( this->value );
strcat( copy->value, value );
return copy;
}
char * text_toNative( text * this ) {
return this->value;
}
char * text_whiteSpace( text * this, int whiteSpaceCount ) {
char * output = malloc( 400 );
for (int i = 0; i < whiteSpaceCount; ++i)
{
strcat( output, " " );
}
return output;
}
void text_free( text * this ) {
free( this->value );
free( this );
}
text text_new(char * value) {
text instance;
instance.usevalue = -1;
instance.capacity = 500;
text_constructor( &instance, value);
return instance;
}
text * text_newPointer(char * value) {
struct text * pointer = malloc( sizeof ( struct text ) );
pointer->usevalue = -1;
pointer->capacity = 500;
text_constructor( pointer , value);
return pointer;
}

View File

@@ -0,0 +1,75 @@
#ifndef _text
#define _text
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
#include <dirent.h>
#include <array.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct text{
char * value;
int usevalue;
int length;
int capacity;
} text;
int text_operator_compare( text * this, text * b );
text * text_operator_add( text * this, char * b );
void text_constructor( text * this, char * value );
char text_get( text * this, int index );
void text_resize( text * this, int size );
text * text_append( text * this, char * value );
text * text_appendBinary( text * this, char * value, int size );
text * text_appendObject( text * this, text * object );
text * text_concatenate( text * this, char * value );
char * text_toNative( text * this );
char * text_whiteSpace( text * this, int whiteSpaceCount );
void text_free( text * this );
text text_new( char * value );
text * text_newPointer( char * value );
#endif
typedef struct text text;

View File

@@ -0,0 +1,47 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <user.h>
void user_constructor( user * this ) {
}
user user_new() {
user instance;
instance.addresses = array_newPointer();
user_constructor( &instance);
return instance;
}
user * user_newPointer() {
struct user * pointer = malloc( sizeof ( struct user ) );
pointer->addresses = array_newPointer();
user_constructor( pointer );
return pointer;
}

View File

@@ -0,0 +1,47 @@
#ifndef _user
#define _user
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
#include <array.h>
typedef struct user{
char * username;
int id;
int userlevel;
char * hash;
struct array * addresses;
} user;
void user_constructor( user * this );
user user_new( );
user * user_newPointer( );
#endif
typedef struct user user;

View File

@@ -0,0 +1,88 @@
/*
* This file is automaticaly generated, Please dont edit this file!
*/
#include <vector2.h>
void vector2_constructor( vector2 * this, float x, float y ) {
this->x = x;
this->y = y;
}
vector2 * vector2_operator_plus( vector2 * this, vector2 * b ) {
vector2_add( this, b );
return this;
}
vector2 * vector2_operator_add( vector2 * this, struct vector2 * b ) {
return b;
}
void vector2_add( vector2 * this, vector2 * a ) {
this->x += a->x;
this->y += a->y;
}
void vector2_subtract( vector2 * this, vector2 * a ) {
this->x -= a->x;
this->y -= a->y;
}
int vector2_length( vector2 * this ) {
return this->x + this->y;
}
vector2 vector2_new(float x, float y) {
vector2 instance;
vector2_constructor( &instance, x, y);
return instance;
}
vector2 * vector2_newPointer(float x, float y) {
struct vector2 * pointer = malloc( sizeof ( struct vector2 ) );
vector2_constructor( pointer , x, y);
return pointer;
}

View File

@@ -0,0 +1,49 @@
#ifndef _vector2
#define _vector2
// Macros
#include "stdlib.h"
extern char * __ClassNames[];
// Includes
typedef struct vector2{
float x;
float y;
} vector2;
void vector2_constructor( vector2 * this, float x, float y );
vector2 * vector2_operator_plus( vector2 * this, vector2 * b );
vector2 * vector2_operator_add( vector2 * this, struct vector2 * b );
void vector2_add( vector2 * this, vector2 * a );
void vector2_subtract( vector2 * this, vector2 * a );
int vector2_length( vector2 * this );
vector2 vector2_new( float x, float y );
vector2 * vector2_newPointer( float x, float y );
#endif
typedef struct vector2 vector2;