removed parameter passing of globals and fixed expression evaluator some
This commit is contained in:
31
yabFunctions.cpp
Normal file
31
yabFunctions.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
** Yab2Cpp
|
||||
**
|
||||
** Transpiler by Samuel D. Crow
|
||||
**
|
||||
** Based on Yab
|
||||
**
|
||||
*/
|
||||
#include "yab2cpp.h"
|
||||
|
||||
/* function definitions */
|
||||
fn *fn::getCurrentSub()
|
||||
{
|
||||
return callStack.back;
|
||||
}
|
||||
|
||||
void fn::generateOnNSub(expression *e)
|
||||
{
|
||||
this->ret=new label();
|
||||
fn::callStack.push_back(this);
|
||||
label::generateOnNTo(e);
|
||||
output_cpp << "case " << ret->getID() << ":\n";
|
||||
}
|
||||
|
||||
void fn::generateGosub(shared_ptr<label> sub)
|
||||
{
|
||||
this->ret=new label();
|
||||
fn::callStack.push_back(this);
|
||||
output_cpp << "state=" << sub->getID() << ";\nbreak;\n";
|
||||
output_cpp << "case " << ret->getID() << ":\n";
|
||||
}
|
||||
Reference in New Issue
Block a user