Made ChrisTest for testing numerical library
This commit is contained in:
BIN
ChrisTest/.ChrisVec.krak.un~
Normal file
BIN
ChrisTest/.ChrisVec.krak.un~
Normal file
Binary file not shown.
BIN
ChrisTest/.ChrisVecTest.krak.un~
Normal file
BIN
ChrisTest/.ChrisVecTest.krak.un~
Normal file
Binary file not shown.
BIN
ChrisTest/.ErrorLog.txt.un~
Normal file
BIN
ChrisTest/.ErrorLog.txt.un~
Normal file
Binary file not shown.
BIN
ChrisTest/.HelloWorld.krak.un~
Normal file
BIN
ChrisTest/.HelloWorld.krak.un~
Normal file
Binary file not shown.
BIN
ChrisTest/.SupressOut.sh.un~
Normal file
BIN
ChrisTest/.SupressOut.sh.un~
Normal file
Binary file not shown.
50
ChrisTest/ChrisVec.krak
Normal file
50
ChrisTest/ChrisVec.krak
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
../build/kraken InputFile.krak ../krakGrammer(tab complete) OutputFile
|
||||||
|
*/
|
||||||
|
import vector:*;
|
||||||
|
import io:*;
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
* Functions
|
||||||
|
****************************/
|
||||||
|
|
||||||
|
|double| dot(|vector<double>| a, |vector<double>| b)
|
||||||
|
{
|
||||||
|
if(a.size < b.size)
|
||||||
|
{
|
||||||
|
println("Error: Vectors not of same size");
|
||||||
|
print("Vector a is of size: ");
|
||||||
|
println(a.size);
|
||||||
|
print("Vector b is of size: ");
|
||||||
|
println(b.size);
|
||||||
|
println("Did you know that Grover Cleveland served two seperate terms as President of the United States, four years apart?");
|
||||||
|
}
|
||||||
|
|
||||||
|
|double| ans = 0;
|
||||||
|
for(|int| i = 0; i < lesser<int>(a.size, b.size); i++;)
|
||||||
|
{
|
||||||
|
ans = ans + a.at(i) * b.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
println(ans);
|
||||||
|
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
28
ChrisTest/ChrisVecTest.krak
Normal file
28
ChrisTest/ChrisVecTest.krak
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
../build/kraken InputFile.krak ../krakGrammer(tabComplete) OutputFile
|
||||||
|
*/
|
||||||
|
|
||||||
|
import vector:*;
|
||||||
|
import ChrisVec:*;
|
||||||
|
|
||||||
|
|int| main()
|
||||||
|
{
|
||||||
|
|
||||||
|
|vector<double>| aVec.construct();
|
||||||
|
|vector<double>| bVec.construct();
|
||||||
|
|
||||||
|
|
||||||
|
|double| j;
|
||||||
|
for(|int| i = 0; i < 4; i++;)
|
||||||
|
{
|
||||||
|
j = i + 0.0;
|
||||||
|
aVec.addEnd(j);
|
||||||
|
bVec.addEnd(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
bVec.addEnd(12.3);
|
||||||
|
|
||||||
|
|double| dotProd = dot(aVec, bVec);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
ChrisTest/DotProdTest/DotProdTest
Executable file
BIN
ChrisTest/DotProdTest/DotProdTest
Executable file
Binary file not shown.
362
ChrisTest/DotProdTest/DotProdTest.c
Normal file
362
ChrisTest/DotProdTest/DotProdTest.c
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
#include "DotProdTest.h"
|
||||||
|
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/**
|
||||||
|
* Variable Declarations
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
double dot_vector_lessthan_double_greaterthan__vector_lessthan_double_greaterthan_(vector_lessthan_double_greaterthan_ a, vector_lessthan_double_greaterthan_ b)
|
||||||
|
{
|
||||||
|
if (((((a).size))<(((b).size))))
|
||||||
|
{
|
||||||
|
println_char_P__("Error: Vectors not of same size") ;
|
||||||
|
print_char_P__("Vector a is of size: ") ;
|
||||||
|
println_int(((a).size)) ;
|
||||||
|
print_char_P__("Vector b is of size: ") ;
|
||||||
|
println_int(((b).size)) ;
|
||||||
|
println_char_P__("Did you know that Grover Cleveland served two seperate terms as President of the United States, four years apart?") ;
|
||||||
|
};
|
||||||
|
;
|
||||||
|
double ans = 0;;
|
||||||
|
for ( int i = 0;((i)<(lesser_lessthan_int_greaterthan__int_int(((a).size), ((b).size)) )); i++)
|
||||||
|
{
|
||||||
|
ans = ((ans)+(((vector_lessthan_double_greaterthan___at_int(&a,i) )*(vector_lessthan_double_greaterthan___at_int(&b,i) ))));
|
||||||
|
};
|
||||||
|
;
|
||||||
|
println_double(ans) ;
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
vector_lessthan_double_greaterthan_ aVec; vector_lessthan_double_greaterthan___construct(&aVec) /*Init Position Call*/;
|
||||||
|
vector_lessthan_double_greaterthan_ bVec; vector_lessthan_double_greaterthan___construct(&bVec) /*Init Position Call*/;
|
||||||
|
double j;;
|
||||||
|
for ( int i = 0;((i)<(4)); i++)
|
||||||
|
{
|
||||||
|
j = ((i)+(0.0));
|
||||||
|
vector_lessthan_double_greaterthan___addEnd_double(&aVec,j) ;
|
||||||
|
vector_lessthan_double_greaterthan___addEnd_double(&bVec,j) ;
|
||||||
|
};
|
||||||
|
;
|
||||||
|
vector_lessthan_double_greaterthan___addEnd_double(&bVec,12.3) ;
|
||||||
|
double dotProd = dot_vector_lessthan_double_greaterthan__vector_lessthan_double_greaterthan_(aVec, bVec) ;;
|
||||||
|
return 0;
|
||||||
|
vector_lessthan_double_greaterthan___destruct(&aVec);
|
||||||
|
vector_lessthan_double_greaterthan___destruct(&bVec);
|
||||||
|
}
|
||||||
|
void print_char_P__(char* toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf(toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void print_string(string toPrint)
|
||||||
|
{
|
||||||
|
print_char_P__(string__toCharArray(&toPrint) ) ;
|
||||||
|
}
|
||||||
|
void print_int(int toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%d", toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void print_float(float toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%f", toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void print_double(double toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%f", toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void println()
|
||||||
|
{
|
||||||
|
print_char_P__("\n") ;
|
||||||
|
}
|
||||||
|
void println_char_P__(char* toPrint)
|
||||||
|
{
|
||||||
|
print_char_P__(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void println_string(string toPrint)
|
||||||
|
{
|
||||||
|
println_char_P__(string__toCharArray(&toPrint) ) ;
|
||||||
|
}
|
||||||
|
void println_int(int toPrint)
|
||||||
|
{
|
||||||
|
print_int(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void println_float(float toPrint)
|
||||||
|
{
|
||||||
|
print_float(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void println_double(double toPrint)
|
||||||
|
{
|
||||||
|
print_double(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void delete_lessthan_char_greaterthan__char_P__(char* toDelete)
|
||||||
|
{
|
||||||
|
free(toDelete) ;
|
||||||
|
}
|
||||||
|
void delete_lessthan_char_greaterthan__char_P___int(char* toDelete, int itemCount)
|
||||||
|
{
|
||||||
|
delete_lessthan_char_greaterthan__char_P__(toDelete) ;
|
||||||
|
}
|
||||||
|
void delete_lessthan_double_greaterthan__double_P__(double* toDelete)
|
||||||
|
{
|
||||||
|
free(toDelete) ;
|
||||||
|
}
|
||||||
|
void delete_lessthan_double_greaterthan__double_P___int(double* toDelete, int itemCount)
|
||||||
|
{
|
||||||
|
delete_lessthan_double_greaterthan__double_P__(toDelete) ;
|
||||||
|
}
|
||||||
|
char* malloc_lessthan_char_greaterthan__int(int size)
|
||||||
|
{
|
||||||
|
char* memPtr = 0;;
|
||||||
|
{
|
||||||
|
|
||||||
|
memPtr = malloc(size);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return memPtr;
|
||||||
|
}
|
||||||
|
double* malloc_lessthan_double_greaterthan__int(int size)
|
||||||
|
{
|
||||||
|
double* memPtr = 0;;
|
||||||
|
{
|
||||||
|
|
||||||
|
memPtr = malloc(size);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return memPtr;
|
||||||
|
}
|
||||||
|
char* new_lessthan_char_greaterthan__int(int count)
|
||||||
|
{
|
||||||
|
return malloc_lessthan_char_greaterthan__int(((sizeof_lessthan_char_greaterthan_() )*(count))) ;
|
||||||
|
}
|
||||||
|
double* new_lessthan_double_greaterthan__int(int count)
|
||||||
|
{
|
||||||
|
return malloc_lessthan_double_greaterthan__int(((sizeof_lessthan_double_greaterthan_() )*(count))) ;
|
||||||
|
}
|
||||||
|
int sizeof_lessthan_char_greaterthan_()
|
||||||
|
{
|
||||||
|
int result = 0;;
|
||||||
|
char testObj;;
|
||||||
|
{
|
||||||
|
|
||||||
|
result = sizeof(testObj);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
int sizeof_lessthan_double_greaterthan_()
|
||||||
|
{
|
||||||
|
int result = 0;;
|
||||||
|
double testObj;;
|
||||||
|
{
|
||||||
|
|
||||||
|
result = sizeof(testObj);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}/* Method Definitions for string */
|
||||||
|
|
||||||
|
string* string__construct(string* this)
|
||||||
|
{
|
||||||
|
vector_lessthan_char_greaterthan___construct(&this->data) ;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
string* string__construct_char_P__(string* this, char* str)
|
||||||
|
{
|
||||||
|
vector_lessthan_char_greaterthan___construct(&this->data) ;
|
||||||
|
while (*(str))
|
||||||
|
{
|
||||||
|
vector_lessthan_char_greaterthan___addEnd_char(&this->data,*(str)) ;
|
||||||
|
str = ((str)+(1));
|
||||||
|
};
|
||||||
|
;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* string__toCharArray(string* this)
|
||||||
|
{
|
||||||
|
char* out = new_lessthan_char_greaterthan__int(((this->data).size)) ;;
|
||||||
|
for ( int i = 0;((i)<(((this->data).size))); i++)
|
||||||
|
(out)[i] = vector_lessthan_char_greaterthan___get_int(&this->data,i) ;
|
||||||
|
;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
/* Done with string */
|
||||||
|
|
||||||
|
int lesser_lessthan_int_greaterthan__int_int(int a, int b)
|
||||||
|
{
|
||||||
|
if (((a)>(b)))
|
||||||
|
return b;
|
||||||
|
;
|
||||||
|
return a;
|
||||||
|
}/* Method Definitions for vector<char> */
|
||||||
|
|
||||||
|
vector_lessthan_char_greaterthan_* vector_lessthan_char_greaterthan___construct(vector_lessthan_char_greaterthan_* this)
|
||||||
|
{
|
||||||
|
this->size = 0;
|
||||||
|
this->available = 8;
|
||||||
|
this->data = new_lessthan_char_greaterthan__int(8) ;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___destruct(vector_lessthan_char_greaterthan_* this)
|
||||||
|
{
|
||||||
|
delete_lessthan_char_greaterthan__char_P__(this->data) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool vector_lessthan_char_greaterthan___resize_int(vector_lessthan_char_greaterthan_* this, int newSize)
|
||||||
|
{
|
||||||
|
char* newData = new_lessthan_char_greaterthan__int(newSize) ;;
|
||||||
|
if (!(newData))
|
||||||
|
return false;
|
||||||
|
;
|
||||||
|
for ( int i = 0;((i)<(lesser_lessthan_int_greaterthan__int_int(this->size, newSize) )); i++)
|
||||||
|
(newData)[i] = (this->data)[i];
|
||||||
|
;
|
||||||
|
delete_lessthan_char_greaterthan__char_P___int(this->data, 0) ;
|
||||||
|
this->data = newData;
|
||||||
|
this->available = newSize;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___at_int(vector_lessthan_char_greaterthan_* this, int index)
|
||||||
|
{
|
||||||
|
return vector_lessthan_char_greaterthan___get_int(this,index) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___get_int(vector_lessthan_char_greaterthan_* this, int index)
|
||||||
|
{
|
||||||
|
if (((((index)<(0)))||(((index)>=(this->size)))))
|
||||||
|
{
|
||||||
|
return (this->data)[0];
|
||||||
|
};
|
||||||
|
;
|
||||||
|
return (this->data)[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
char* vector_lessthan_char_greaterthan___getBackingMemory(vector_lessthan_char_greaterthan_* this)
|
||||||
|
{
|
||||||
|
return this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___set_int_char(vector_lessthan_char_greaterthan_* this, int index, char dataIn)
|
||||||
|
{
|
||||||
|
if (((((index)<(0)))||(((index)>=(this->size)))))
|
||||||
|
return;
|
||||||
|
;
|
||||||
|
(this->data)[index] = dataIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___addEnd_char(vector_lessthan_char_greaterthan_* this, char dataIn)
|
||||||
|
{
|
||||||
|
this->size++;
|
||||||
|
if (((this->size)>=(this->available)))
|
||||||
|
vector_lessthan_char_greaterthan___resize_int(this,((this->size)*(2))) ;
|
||||||
|
;
|
||||||
|
(this->data)[((this->size)-(1))] = dataIn;
|
||||||
|
}
|
||||||
|
/* Done with vector<char> */
|
||||||
|
/* Method Definitions for vector<double> */
|
||||||
|
|
||||||
|
vector_lessthan_double_greaterthan_* vector_lessthan_double_greaterthan___construct(vector_lessthan_double_greaterthan_* this)
|
||||||
|
{
|
||||||
|
this->size = 0;
|
||||||
|
this->available = 8;
|
||||||
|
this->data = new_lessthan_double_greaterthan__int(8) ;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_double_greaterthan___destruct(vector_lessthan_double_greaterthan_* this)
|
||||||
|
{
|
||||||
|
delete_lessthan_double_greaterthan__double_P__(this->data) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool vector_lessthan_double_greaterthan___resize_int(vector_lessthan_double_greaterthan_* this, int newSize)
|
||||||
|
{
|
||||||
|
double* newData = new_lessthan_double_greaterthan__int(newSize) ;;
|
||||||
|
if (!(newData))
|
||||||
|
return false;
|
||||||
|
;
|
||||||
|
for ( int i = 0;((i)<(lesser_lessthan_int_greaterthan__int_int(this->size, newSize) )); i++)
|
||||||
|
(newData)[i] = (this->data)[i];
|
||||||
|
;
|
||||||
|
delete_lessthan_double_greaterthan__double_P___int(this->data, 0) ;
|
||||||
|
this->data = newData;
|
||||||
|
this->available = newSize;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
double vector_lessthan_double_greaterthan___at_int(vector_lessthan_double_greaterthan_* this, int index)
|
||||||
|
{
|
||||||
|
return vector_lessthan_double_greaterthan___get_int(this,index) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
double vector_lessthan_double_greaterthan___get_int(vector_lessthan_double_greaterthan_* this, int index)
|
||||||
|
{
|
||||||
|
if (((((index)<(0)))||(((index)>=(this->size)))))
|
||||||
|
{
|
||||||
|
return (this->data)[0];
|
||||||
|
};
|
||||||
|
;
|
||||||
|
return (this->data)[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
double* vector_lessthan_double_greaterthan___getBackingMemory(vector_lessthan_double_greaterthan_* this)
|
||||||
|
{
|
||||||
|
return this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_double_greaterthan___set_int_double(vector_lessthan_double_greaterthan_* this, int index, double dataIn)
|
||||||
|
{
|
||||||
|
if (((((index)<(0)))||(((index)>=(this->size)))))
|
||||||
|
return;
|
||||||
|
;
|
||||||
|
(this->data)[index] = dataIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_double_greaterthan___addEnd_double(vector_lessthan_double_greaterthan_* this, double dataIn)
|
||||||
|
{
|
||||||
|
this->size++;
|
||||||
|
if (((this->size)>=(this->available)))
|
||||||
|
vector_lessthan_double_greaterthan___resize_int(this,((this->size)*(2))) ;
|
||||||
|
;
|
||||||
|
(this->data)[((this->size)-(1))] = dataIn;
|
||||||
|
}
|
||||||
|
/* Done with vector<double> */
|
||||||
155
ChrisTest/DotProdTest/DotProdTest.h
Normal file
155
ChrisTest/DotProdTest/DotProdTest.h
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/**
|
||||||
|
* Plain Typedefs
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*typedef string */
|
||||||
|
typedef struct __struct_dummy_string__ string;
|
||||||
|
/*typedef vector */
|
||||||
|
/* non instantiated template vector *//*typedef vector<char> */
|
||||||
|
typedef struct __struct_dummy_vector_lessthan_char_greaterthan___ vector_lessthan_char_greaterthan_;
|
||||||
|
/*typedef vector<double> */
|
||||||
|
typedef struct __struct_dummy_vector_lessthan_double_greaterthan___ vector_lessthan_double_greaterthan_;
|
||||||
|
/**
|
||||||
|
* Import Includes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extern Variable Declarations
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Structs
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct __struct_dummy_vector_lessthan_double_greaterthan___ {
|
||||||
|
double* data;
|
||||||
|
int size;
|
||||||
|
int available;
|
||||||
|
};
|
||||||
|
struct __struct_dummy_vector_lessthan_char_greaterthan___ {
|
||||||
|
char* data;
|
||||||
|
int size;
|
||||||
|
int available;
|
||||||
|
};
|
||||||
|
struct __struct_dummy_string__ {
|
||||||
|
vector_lessthan_char_greaterthan_ data;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Function Prototypes
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
double dot_vector_lessthan_double_greaterthan__vector_lessthan_double_greaterthan_(vector_lessthan_double_greaterthan_ a, vector_lessthan_double_greaterthan_ b); /*func*/
|
||||||
|
|
||||||
|
int main(); /*func*/
|
||||||
|
|
||||||
|
void print_char_P__(char* toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_string(string toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_int(int toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_float(float toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_double(double toPrint); /*func*/
|
||||||
|
|
||||||
|
void println(); /*func*/
|
||||||
|
|
||||||
|
void println_char_P__(char* toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_string(string toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_int(int toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_float(float toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_double(double toPrint); /*func*/
|
||||||
|
/* template function delete NoValue */
|
||||||
|
/* template function delete NoValue */
|
||||||
|
/* template function delete NoValue */
|
||||||
|
/* template function delete NoValue */
|
||||||
|
|
||||||
|
void delete_lessthan_char_greaterthan__char_P__(char* toDelete); /*func*/
|
||||||
|
|
||||||
|
void delete_lessthan_char_greaterthan__char_P___int(char* toDelete, int itemCount); /*func*/
|
||||||
|
|
||||||
|
void delete_lessthan_double_greaterthan__double_P__(double* toDelete); /*func*/
|
||||||
|
|
||||||
|
void delete_lessthan_double_greaterthan__double_P___int(double* toDelete, int itemCount); /*func*/
|
||||||
|
/* template function free NoValue */
|
||||||
|
/* template function malloc NoValue */
|
||||||
|
|
||||||
|
char* malloc_lessthan_char_greaterthan__int(int size); /*func*/
|
||||||
|
|
||||||
|
double* malloc_lessthan_double_greaterthan__int(int size); /*func*/
|
||||||
|
/* template function new NoValue */
|
||||||
|
/* template function new NoValue */
|
||||||
|
|
||||||
|
char* new_lessthan_char_greaterthan__int(int count); /*func*/
|
||||||
|
|
||||||
|
double* new_lessthan_double_greaterthan__int(int count); /*func*/
|
||||||
|
/* template function sizeof NoValue */
|
||||||
|
|
||||||
|
int sizeof_lessthan_char_greaterthan_(); /*func*/
|
||||||
|
|
||||||
|
int sizeof_lessthan_double_greaterthan_(); /*func*/
|
||||||
|
/* Method Prototypes for string */
|
||||||
|
|
||||||
|
string* string__construct(string* this);
|
||||||
|
|
||||||
|
string* string__construct_char_P__(string* this, char* str);
|
||||||
|
|
||||||
|
char* string__toCharArray(string* this);
|
||||||
|
/* Done with string */
|
||||||
|
/* template function greater NoValue */
|
||||||
|
/* template function lesser NoValue */
|
||||||
|
|
||||||
|
int lesser_lessthan_int_greaterthan__int_int(int a, int b); /*func*/
|
||||||
|
/* Method Prototypes for vector<char> */
|
||||||
|
|
||||||
|
vector_lessthan_char_greaterthan_* vector_lessthan_char_greaterthan___construct(vector_lessthan_char_greaterthan_* this);
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___destruct(vector_lessthan_char_greaterthan_* this);
|
||||||
|
|
||||||
|
bool vector_lessthan_char_greaterthan___resize_int(vector_lessthan_char_greaterthan_* this, int newSize);
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___at_int(vector_lessthan_char_greaterthan_* this, int index);
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___get_int(vector_lessthan_char_greaterthan_* this, int index);
|
||||||
|
|
||||||
|
char* vector_lessthan_char_greaterthan___getBackingMemory(vector_lessthan_char_greaterthan_* this);
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___set_int_char(vector_lessthan_char_greaterthan_* this, int index, char dataIn);
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___addEnd_char(vector_lessthan_char_greaterthan_* this, char dataIn);
|
||||||
|
/* Done with vector<char> */
|
||||||
|
/* Method Prototypes for vector<double> */
|
||||||
|
|
||||||
|
vector_lessthan_double_greaterthan_* vector_lessthan_double_greaterthan___construct(vector_lessthan_double_greaterthan_* this);
|
||||||
|
|
||||||
|
void vector_lessthan_double_greaterthan___destruct(vector_lessthan_double_greaterthan_* this);
|
||||||
|
|
||||||
|
bool vector_lessthan_double_greaterthan___resize_int(vector_lessthan_double_greaterthan_* this, int newSize);
|
||||||
|
|
||||||
|
double vector_lessthan_double_greaterthan___at_int(vector_lessthan_double_greaterthan_* this, int index);
|
||||||
|
|
||||||
|
double vector_lessthan_double_greaterthan___get_int(vector_lessthan_double_greaterthan_* this, int index);
|
||||||
|
|
||||||
|
double* vector_lessthan_double_greaterthan___getBackingMemory(vector_lessthan_double_greaterthan_* this);
|
||||||
|
|
||||||
|
void vector_lessthan_double_greaterthan___set_int_double(vector_lessthan_double_greaterthan_* this, int index, double dataIn);
|
||||||
|
|
||||||
|
void vector_lessthan_double_greaterthan___addEnd_double(vector_lessthan_double_greaterthan_* this, double dataIn);
|
||||||
|
/* Done with vector<double> */
|
||||||
2
ChrisTest/DotProdTest/DotProdTest.sh
Normal file
2
ChrisTest/DotProdTest/DotProdTest.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cc -std=c99 DotProdTest.c -o DotProdTest
|
||||||
2
ChrisTest/ErrorLog.txt
Normal file
2
ChrisTest/ErrorLog.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
else statements don't work
|
||||||
|
!= doesn't work
|
||||||
14
ChrisTest/HelloWorld.krak
Normal file
14
ChrisTest/HelloWorld.krak
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
../build/kraken InputFile.krak ../krakGrammer(tab complete) OutputFile
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
import io;
|
||||||
|
|
||||||
|
|int| main()
|
||||||
|
{
|
||||||
|
|double| var = 3;
|
||||||
|
io::println(var);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
2
ChrisTest/SupressOut.sh
Executable file
2
ChrisTest/SupressOut.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
rm *krakout*
|
||||||
BIN
stdlib/.io.krak.un~
Normal file
BIN
stdlib/.io.krak.un~
Normal file
Binary file not shown.
@@ -67,3 +67,15 @@ __if_comp__ __C__ __simple_passthrough__ """
|
|||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|void| println(|double| toPrint){
|
||||||
|
print(toPrint);
|
||||||
|
println();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
tests/SupressOut.sh
Executable file
2
tests/SupressOut.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
rm *krakout*
|
||||||
BIN
tests/test_topLevelVarInit/test_topLevelVarInit
Executable file
BIN
tests/test_topLevelVarInit/test_topLevelVarInit
Executable file
Binary file not shown.
225
tests/test_topLevelVarInit/test_topLevelVarInit.c
Normal file
225
tests/test_topLevelVarInit/test_topLevelVarInit.c
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
#include "./test_topLevelVarInit.h"
|
||||||
|
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/**
|
||||||
|
* Variable Declarations
|
||||||
|
*/
|
||||||
|
|
||||||
|
int a; /*identifier*/
|
||||||
|
/**
|
||||||
|
* Function Definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
println_int(a) ;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void print_char_P__(char* toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf(toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void print_string(string toPrint)
|
||||||
|
{
|
||||||
|
print_char_P__(string__toCharArray(&toPrint) ) ;
|
||||||
|
}
|
||||||
|
void print_int(int toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%d", toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void print_float(float toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%f", toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void print_double(double toPrint)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%f", toPrint);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void println()
|
||||||
|
{
|
||||||
|
print_char_P__("\n") ;
|
||||||
|
}
|
||||||
|
void println_char_P__(char* toPrint)
|
||||||
|
{
|
||||||
|
print_char_P__(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void println_string(string toPrint)
|
||||||
|
{
|
||||||
|
println_char_P__(string__toCharArray(&toPrint) ) ;
|
||||||
|
}
|
||||||
|
void println_int(int toPrint)
|
||||||
|
{
|
||||||
|
print_int(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void println_float(float toPrint)
|
||||||
|
{
|
||||||
|
print_float(toPrint) ;
|
||||||
|
println() ;
|
||||||
|
}
|
||||||
|
void delete_lessthan_char_greaterthan__char_P__(char* toDelete)
|
||||||
|
{
|
||||||
|
free(toDelete) ;
|
||||||
|
}
|
||||||
|
void delete_lessthan_char_greaterthan__char_P___int(char* toDelete, int itemCount)
|
||||||
|
{
|
||||||
|
delete_lessthan_char_greaterthan__char_P__(toDelete) ;
|
||||||
|
}
|
||||||
|
char* malloc_lessthan_char_greaterthan__int(int size)
|
||||||
|
{
|
||||||
|
char* memPtr = 0;;
|
||||||
|
{
|
||||||
|
|
||||||
|
memPtr = malloc(size);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return memPtr;
|
||||||
|
}
|
||||||
|
char* mem_scopeop_new_lessthan_char_greaterthan__int(int count)
|
||||||
|
{
|
||||||
|
return malloc_lessthan_char_greaterthan__int(((sizeof_lessthan_char_greaterthan_() )*(count))) ;
|
||||||
|
}
|
||||||
|
char* new_lessthan_char_greaterthan__int(int count)
|
||||||
|
{
|
||||||
|
return malloc_lessthan_char_greaterthan__int(((sizeof_lessthan_char_greaterthan_() )*(count))) ;
|
||||||
|
}
|
||||||
|
int sizeof_lessthan_char_greaterthan_()
|
||||||
|
{
|
||||||
|
int result = 0;;
|
||||||
|
char testObj;;
|
||||||
|
{
|
||||||
|
|
||||||
|
result = sizeof(testObj);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}/* Method Definitions for string */
|
||||||
|
|
||||||
|
string* string__construct(string* this)
|
||||||
|
{
|
||||||
|
vector_lessthan_char_greaterthan___construct(&this->data) ;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
string* string__construct_char_P__(string* this, char* str)
|
||||||
|
{
|
||||||
|
vector_lessthan_char_greaterthan___construct(&this->data) ;
|
||||||
|
while (*(str))
|
||||||
|
{
|
||||||
|
vector_lessthan_char_greaterthan___addEnd_char(&this->data,*(str)) ;
|
||||||
|
str = ((str)+(1));
|
||||||
|
};
|
||||||
|
;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* string__toCharArray(string* this)
|
||||||
|
{
|
||||||
|
char* out = mem_scopeop_new_lessthan_char_greaterthan__int(((this->data).size)) ;;
|
||||||
|
for ( int i = 0;((i)<(((this->data).size))); i++)
|
||||||
|
(out)[i] = vector_lessthan_char_greaterthan___get_int(&this->data,i) ;
|
||||||
|
;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
/* Done with string */
|
||||||
|
|
||||||
|
int lesser_lessthan_int_greaterthan__int_int(int a, int b)
|
||||||
|
{
|
||||||
|
if (((a)>(b)))
|
||||||
|
return b;
|
||||||
|
;
|
||||||
|
return a;
|
||||||
|
}/* Method Definitions for vector<char> */
|
||||||
|
|
||||||
|
vector_lessthan_char_greaterthan_* vector_lessthan_char_greaterthan___construct(vector_lessthan_char_greaterthan_* this)
|
||||||
|
{
|
||||||
|
this->size = 0;
|
||||||
|
this->available = 8;
|
||||||
|
this->data = new_lessthan_char_greaterthan__int(8) ;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___destruct(vector_lessthan_char_greaterthan_* this)
|
||||||
|
{
|
||||||
|
delete_lessthan_char_greaterthan__char_P__(this->data) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool vector_lessthan_char_greaterthan___resize_int(vector_lessthan_char_greaterthan_* this, int newSize)
|
||||||
|
{
|
||||||
|
char* newData = new_lessthan_char_greaterthan__int(newSize) ;;
|
||||||
|
if (!(newData))
|
||||||
|
return false;
|
||||||
|
;
|
||||||
|
for ( int i = 0;((i)<(lesser_lessthan_int_greaterthan__int_int(this->size, newSize) )); i++)
|
||||||
|
(newData)[i] = (this->data)[i];
|
||||||
|
;
|
||||||
|
delete_lessthan_char_greaterthan__char_P___int(this->data, 0) ;
|
||||||
|
this->data = newData;
|
||||||
|
this->available = newSize;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___at_int(vector_lessthan_char_greaterthan_* this, int index)
|
||||||
|
{
|
||||||
|
return vector_lessthan_char_greaterthan___get_int(this,index) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___get_int(vector_lessthan_char_greaterthan_* this, int index)
|
||||||
|
{
|
||||||
|
if (((((index)<(0)))||(((index)>=(this->size)))))
|
||||||
|
{
|
||||||
|
return (this->data)[0];
|
||||||
|
};
|
||||||
|
;
|
||||||
|
return (this->data)[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
char* vector_lessthan_char_greaterthan___getBackingMemory(vector_lessthan_char_greaterthan_* this)
|
||||||
|
{
|
||||||
|
return this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___set_int_char(vector_lessthan_char_greaterthan_* this, int index, char dataIn)
|
||||||
|
{
|
||||||
|
if (((((index)<(0)))||(((index)>=(this->size)))))
|
||||||
|
return;
|
||||||
|
;
|
||||||
|
(this->data)[index] = dataIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___addEnd_char(vector_lessthan_char_greaterthan_* this, char dataIn)
|
||||||
|
{
|
||||||
|
this->size++;
|
||||||
|
if (((this->size)>=(this->available)))
|
||||||
|
vector_lessthan_char_greaterthan___resize_int(this,((this->size)*(2))) ;
|
||||||
|
;
|
||||||
|
(this->data)[((this->size)-(1))] = dataIn;
|
||||||
|
}
|
||||||
|
/* Done with vector<char> */
|
||||||
116
tests/test_topLevelVarInit/test_topLevelVarInit.h
Normal file
116
tests/test_topLevelVarInit/test_topLevelVarInit.h
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/*unknown declaration named translation_unit*/
|
||||||
|
/**
|
||||||
|
* Plain Typedefs
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*typedef string */
|
||||||
|
typedef struct __struct_dummy_string__ string;
|
||||||
|
/*typedef vector */
|
||||||
|
/* non instantiated template vector *//*typedef vector<char> */
|
||||||
|
typedef struct __struct_dummy_vector_lessthan_char_greaterthan___ vector_lessthan_char_greaterthan_;
|
||||||
|
/**
|
||||||
|
* Import Includes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extern Variable Declarations
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int a; /*extern identifier*/
|
||||||
|
/**
|
||||||
|
* Class Structs
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct __struct_dummy_vector_lessthan_char_greaterthan___ {
|
||||||
|
char* data;
|
||||||
|
int size;
|
||||||
|
int available;
|
||||||
|
};
|
||||||
|
struct __struct_dummy_string__ {
|
||||||
|
vector_lessthan_char_greaterthan_ data;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Function Prototypes
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
int main(); /*func*/
|
||||||
|
|
||||||
|
void print_char_P__(char* toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_string(string toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_int(int toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_float(float toPrint); /*func*/
|
||||||
|
|
||||||
|
void print_double(double toPrint); /*func*/
|
||||||
|
|
||||||
|
void println(); /*func*/
|
||||||
|
|
||||||
|
void println_char_P__(char* toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_string(string toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_int(int toPrint); /*func*/
|
||||||
|
|
||||||
|
void println_float(float toPrint); /*func*/
|
||||||
|
/* template function delete NoValue */
|
||||||
|
/* template function delete NoValue */
|
||||||
|
/* template function delete NoValue */
|
||||||
|
/* template function delete NoValue */
|
||||||
|
|
||||||
|
void delete_lessthan_char_greaterthan__char_P__(char* toDelete); /*func*/
|
||||||
|
|
||||||
|
void delete_lessthan_char_greaterthan__char_P___int(char* toDelete, int itemCount); /*func*/
|
||||||
|
/* template function free NoValue */
|
||||||
|
/* template function malloc NoValue */
|
||||||
|
|
||||||
|
char* malloc_lessthan_char_greaterthan__int(int size); /*func*/
|
||||||
|
|
||||||
|
char* mem_scopeop_new_lessthan_char_greaterthan__int(int count); /*func*/
|
||||||
|
/* template function new NoValue */
|
||||||
|
/* template function new NoValue */
|
||||||
|
|
||||||
|
char* new_lessthan_char_greaterthan__int(int count); /*func*/
|
||||||
|
/* template function sizeof NoValue */
|
||||||
|
|
||||||
|
int sizeof_lessthan_char_greaterthan_(); /*func*/
|
||||||
|
/* Method Prototypes for string */
|
||||||
|
|
||||||
|
string* string__construct(string* this);
|
||||||
|
|
||||||
|
string* string__construct_char_P__(string* this, char* str);
|
||||||
|
|
||||||
|
char* string__toCharArray(string* this);
|
||||||
|
/* Done with string */
|
||||||
|
/* template function greater NoValue */
|
||||||
|
/* template function lesser NoValue */
|
||||||
|
|
||||||
|
int lesser_lessthan_int_greaterthan__int_int(int a, int b); /*func*/
|
||||||
|
/* Method Prototypes for vector<char> */
|
||||||
|
|
||||||
|
vector_lessthan_char_greaterthan_* vector_lessthan_char_greaterthan___construct(vector_lessthan_char_greaterthan_* this);
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___destruct(vector_lessthan_char_greaterthan_* this);
|
||||||
|
|
||||||
|
bool vector_lessthan_char_greaterthan___resize_int(vector_lessthan_char_greaterthan_* this, int newSize);
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___at_int(vector_lessthan_char_greaterthan_* this, int index);
|
||||||
|
|
||||||
|
char vector_lessthan_char_greaterthan___get_int(vector_lessthan_char_greaterthan_* this, int index);
|
||||||
|
|
||||||
|
char* vector_lessthan_char_greaterthan___getBackingMemory(vector_lessthan_char_greaterthan_* this);
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___set_int_char(vector_lessthan_char_greaterthan_* this, int index, char dataIn);
|
||||||
|
|
||||||
|
void vector_lessthan_char_greaterthan___addEnd_char(vector_lessthan_char_greaterthan_* this, char dataIn);
|
||||||
|
/* Done with vector<char> */
|
||||||
1
tests/test_topLevelVarInit/test_topLevelVarInit.results
Normal file
1
tests/test_topLevelVarInit/test_topLevelVarInit.results
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0
|
||||||
2
tests/test_topLevelVarInit/test_topLevelVarInit.sh
Executable file
2
tests/test_topLevelVarInit/test_topLevelVarInit.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cc -std=c99 ./test_topLevelVarInit.c -o ./test_topLevelVarInit
|
||||||
Reference in New Issue
Block a user