Commit 5680e04e authored by Sarah Spall's avatar Sarah Spall Committed by Vikram Narayanan

testing initial printing of marshal calls, need improvement

parent 8cdd4871
......@@ -6,7 +6,7 @@ idl = parser/lcd_idl.cpp include/lcd_idl.h
CXXFLAGS = -g -Iinclude/
CXX = g++
objects = lcd_ast.o main.o lcd_idl.o scope.o header_gen.o error.o marshal_op.o
objects = lcd_ast.o main.o lcd_idl.o scope.o header_gen.o source_gen.o error.o marshal_op.o
$(bin): $(objects)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
......@@ -17,6 +17,9 @@ main.o: main/main.cpp include/lcd_ast.h include/lcd_idl.h include/gen_visitor.h
error.o: error/error.cpp include/error.h
$(CXX) $(CXXFLAGS) -c -o $@ $(filter-out %.h,$^)
source_gen.o: gen/source_gen.cpp include/gen_visitor.h
$(CXX) $(CXXFLAGS) -c -o $@ $(filter-out %.h,$^)
header_gen.o: gen/header_gen.cpp include/gen_visitor.h
$(CXX) $(CXXFLAGS) -c -o $@ $(filter-out %.h,$^)
......
#include "gen_visitor.h"
SourceVisitor::SourceVisitor(FILE* out, int stub_proxy)
SourceVisitor::SourceVisitor(FILE* out)
{
this->out_f_ = out;
this->stub_or_proxy_ = stub_proxy;
}
void SourceVisitor::visit(File* f)
......@@ -70,7 +69,7 @@ void SourceVisitor::visit(IntegerType *it)
void SourceVisitor::visit(PointerType *pt)
{
pt->type()->accept(this);
pt->p_type()->accept(this);
fprintf(this->out_f_, "* ");
}
......@@ -79,19 +78,3 @@ void SourceVisitor::visit(Typedef* td)
fprintf(this->out_f_, "%s", td->alias());
}
void SourceVisitor::exec_loop(void)
{
// while truee
// switch statement
// switch on what?
// cases are: callee functions in file.
//
}
void SourceVisitor::gen_case_switch(void)
{
// switch
// case just callee functions, how are these identified from others?
}
......@@ -36,9 +36,9 @@ class HeaderVisitor : public GenVisitor
class SourceVisitor : public GenVisitor
{
FILE* out_f_;
int stub_or_proxy_; // 1 equals stub, 2 equals proxy
// int stub_or_proxy_; // 1 equals stub, 2 equals proxy
public:
SourceVisitor(FILE* out, int stub_proxy);
SourceVisitor(FILE* out);
virtual void visit(File *f);
virtual void visit(Rpc *rpc);
virtual void visit(Parameter * p);
......
......@@ -10,7 +10,7 @@
int main(int argc, char ** argv)
{
if(argc != 5)
if(argc != 4)
{
printf("error in number of args\n");
exit(0);
......@@ -26,8 +26,8 @@ int main(int argc, char ** argv)
// cleanup?
exit(0);
}
char* out_option = argv[3];
char* out_file = argv[4];
// char* out_option = argv[3];
char* out_file = argv[3];
FILE* of = fopen(out_file, "w");
if(!of)
{
......@@ -45,7 +45,10 @@ int main(int argc, char ** argv)
}
else if(!strcmp(argv[1],"-source"))
{
// TODO
printf("in source\n");
SourceVisitor* sv = new SourceVisitor(of);
tree->accept(sv);
printf("have finished sv\n");
}
else
{
......
rpc int foo(int cpa, char v1, int v2);
rpc int bar(projection super_block* rp);
rpc int bar(int r, int a, int c, char b);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment