All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

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 ...@@ -6,7 +6,7 @@ idl = parser/lcd_idl.cpp include/lcd_idl.h
CXXFLAGS = -g -Iinclude/ CXXFLAGS = -g -Iinclude/
CXX = g++ 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) $(bin): $(objects)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(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 ...@@ -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 error.o: error/error.cpp include/error.h
$(CXX) $(CXXFLAGS) -c -o $@ $(filter-out %.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 header_gen.o: gen/header_gen.cpp include/gen_visitor.h
$(CXX) $(CXXFLAGS) -c -o $@ $(filter-out %.h,$^) $(CXX) $(CXXFLAGS) -c -o $@ $(filter-out %.h,$^)
......
#include "gen_visitor.h" #include "gen_visitor.h"
SourceVisitor::SourceVisitor(FILE* out, int stub_proxy) SourceVisitor::SourceVisitor(FILE* out)
{ {
this->out_f_ = out; this->out_f_ = out;
this->stub_or_proxy_ = stub_proxy;
} }
void SourceVisitor::visit(File* f) void SourceVisitor::visit(File* f)
...@@ -70,7 +69,7 @@ void SourceVisitor::visit(IntegerType *it) ...@@ -70,7 +69,7 @@ void SourceVisitor::visit(IntegerType *it)
void SourceVisitor::visit(PointerType *pt) void SourceVisitor::visit(PointerType *pt)
{ {
pt->type()->accept(this); pt->p_type()->accept(this);
fprintf(this->out_f_, "* "); fprintf(this->out_f_, "* ");
} }
...@@ -79,19 +78,3 @@ void SourceVisitor::visit(Typedef* td) ...@@ -79,19 +78,3 @@ void SourceVisitor::visit(Typedef* td)
fprintf(this->out_f_, "%s", td->alias()); 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 ...@@ -36,9 +36,9 @@ class HeaderVisitor : public GenVisitor
class SourceVisitor : public GenVisitor class SourceVisitor : public GenVisitor
{ {
FILE* out_f_; FILE* out_f_;
int stub_or_proxy_; // 1 equals stub, 2 equals proxy // int stub_or_proxy_; // 1 equals stub, 2 equals proxy
public: public:
SourceVisitor(FILE* out, int stub_proxy); SourceVisitor(FILE* out);
virtual void visit(File *f); virtual void visit(File *f);
virtual void visit(Rpc *rpc); virtual void visit(Rpc *rpc);
virtual void visit(Parameter * p); virtual void visit(Parameter * p);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
if(argc != 5) if(argc != 4)
{ {
printf("error in number of args\n"); printf("error in number of args\n");
exit(0); exit(0);
...@@ -26,8 +26,8 @@ int main(int argc, char ** argv) ...@@ -26,8 +26,8 @@ int main(int argc, char ** argv)
// cleanup? // cleanup?
exit(0); exit(0);
} }
char* out_option = argv[3]; // char* out_option = argv[3];
char* out_file = argv[4]; char* out_file = argv[3];
FILE* of = fopen(out_file, "w"); FILE* of = fopen(out_file, "w");
if(!of) if(!of)
{ {
...@@ -45,7 +45,10 @@ int main(int argc, char ** argv) ...@@ -45,7 +45,10 @@ int main(int argc, char ** argv)
} }
else if(!strcmp(argv[1],"-source")) 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 else
{ {
......
rpc int foo(int cpa, char v1, int v2); 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