Commit e26f85d5 authored by Sarah Spall's avatar Sarah Spall Committed by Vikram Narayanan

committing to switch branch

parent ded1cd32
......@@ -9,7 +9,6 @@ Typedef::Typedef(const char* alias, Type* type)
void Typedef::accept(ASTVisitor* worker)
{
printf("in typedef accept\n");
worker->visit(this);
}
......@@ -27,7 +26,6 @@ IntegerType::IntegerType(const char* type, bool un, int size)
void IntegerType::accept(ASTVisitor* worker)
{
printf("in integertype accept\n");
worker->visit(this);
}
......@@ -48,7 +46,6 @@ PointerType::PointerType(Type* type)
void PointerType::accept(ASTVisitor* worker)
{
printf("pointer type accept\n");
worker->visit(this);
}
......@@ -94,7 +91,6 @@ ProjectionType::ProjectionType(const char* id, const char* real_type, std::vecto
void ProjectionType::accept(ASTVisitor* worker)
{
printf("in projectype accept\n");
worker->visit(this);
}
......@@ -129,11 +125,24 @@ const char* Parameter::name()
return this->name_;
}
char* Parameter::marshal()
{
std::ostringstream ret;
ret <<
}
char* Parameter::unmarshal()
{
}
Rpc::Rpc(Type* return_type, const char* name, std::vector<Parameter* >* parameters)
{
this->ret_type_ = return_type;
this->name_ = name;
this->params_ = parameters;
this->marshal_caller = new M_rpc();
this->marshal_callee = new M_rpc();
}
const char* Rpc::name()
......@@ -148,7 +157,6 @@ Type* Rpc::return_type()
void Rpc::accept(ASTVisitor* worker)
{
printf("in rpc accpet\n");
worker->visit(this);
}
......@@ -166,8 +174,6 @@ File::File(const char* verbatim, FileScope* fs, std::vector<Rpc* >* rpc_definiti
void File::accept(ASTVisitor* worker)
{
printf("in accept and trying to print size %lu\n", this->rpc_defs_->size());
printf("in accept\n");
worker->visit(this);
}
......
......@@ -35,8 +35,12 @@ void SourceVisitor::visit(Rpc* r)
fprintf(this->out_f_, ", ");
}
fprintf(this->out_f_, ") {\n");
// print body
// TODO
for(std::vector<Parameter*>::iterator it = r->parameters()->begin(); it != r->parameters()->end(); it++)
{
Parameter* p = (Parameter*) *it;
fprintf(this->out_f_, "%s\n", p->marshal());
}
fprintf(this->out_f_, "}\n");
}
......
......@@ -16,6 +16,7 @@ class Base
class Type : public Base
{
M_type* marshal_info_;
public:
virtual void accept(ASTVisitor *worker) = 0;
virtual int num() = 0;
......@@ -137,17 +138,20 @@ class Parameter : public Base
{
Type* type_;
const char* name_;
//M_info m;
public:
Parameter(Type* type, const char* name);
~Parameter();
virtual void accept(ASTVisitor *worker);
Type* type();
const char* name();
char* marshal();
char* unmarshal();
};
class Rpc : public Base
{
M_rpc* marshal_caller;
M_rpc* marshal_callee;
Type* ret_type_;
const char* name_;
std::vector<Parameter* >* params_;
......
......@@ -8,44 +8,21 @@ class M_info
class M_rpc : public M_info
{
/*
bool regs[LCD_MAX_REGS];
bool cap_regs[LCD_MAX_CAP_REGS]; */
bool cap_regs[LCD_MAX_CAP_REGS];
public:
M_rpc();
};
class M_proj : public M_info
{
public:
M_proj(size_t size) { size_ = size; }
};
class M_param : public M_info
{
int reg;
int size;
public:
M_param();
init(int size, int reg);
};
class M_projType : public M_info
{
public:
M_projType(size_t size) { size_ = size; }
};
class M_intType : public M_info
{
public:
M_intType(size_t size) {size_ = size; }
int allocate_register(int reg);
int next_free_register();
};
class M_pointerType : public M_info
{
class M_type : public M_info
{
int register_;
// can add more necessary info later
public:
M_pointerType(size_t size) { size_ = size; }
M_type();
void set_size(size_t s);
};
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