Commit 427b971a authored by Sarah Spall's avatar Sarah Spall Committed by Vikram Narayanan
Browse files

code to allocate and initialize trampoline structures. fixed bug where regular...

code to allocate and initialize trampoline structures. fixed bug where regular rpcs were beginning ignored if declared in an unnamed scope
parent d87f9b5e
......@@ -53,6 +53,8 @@ GlobalScope::GlobalScope()
, new ProjectionType("dstore", "dstore", fields3)));
std::vector<ProjectionField*> fields4;
fields4.push_back(new ProjectionField(this->lookup("void", &err), "hidden_args", 1));
//fields4.push_back( char trampoline[0]);
this->type_definitions_.insert(std::pair<std::string, Type*>("lcd_trampoline_handle"
, new ProjectionType("lcd_trampoline_handle", "lcd_trampoline_handle", fields4)));
}
......
......@@ -48,7 +48,6 @@ CCSTStatement* Function::accept(TypeVisitor *worker, Variable *v)
int Function::num()
{
printf("num todo for function pointer\n");
return 7;
}
......
......@@ -97,7 +97,7 @@ CCSTCompoundStatement* function_pointer_caller_body(Rpc *f)
if(p->type()->num() == 4 && p->alloc_caller()) {
ProjectionType *pt = dynamic_cast<ProjectionType*>(p->type());
Assert(pt != 0x0, "Error: dynamic cast to Projection type failed!\n");
statements.push_back(alloc_init_containers_driver(pt, f->current_scope(), "caller"));
statements.push_back(alloc_init_containers_driver(p, pt, f->current_scope(), "caller"));
}
}
......@@ -127,10 +127,11 @@ CCSTCompoundStatement* caller_body(Rpc *r)
if(p->type()->num() == 4 && p->alloc_caller()) {
ProjectionType *pt = dynamic_cast<ProjectionType*>(p->type());
Assert(pt != 0x0, "Error: dynamic cast to Projection type failed!\n");
statements.push_back(alloc_init_containers_driver(pt, r->current_scope(), "caller"));
statements.push_back(alloc_init_containers_driver(p, pt, r->current_scope(), "caller"));
}
}
// marshal parameters.
// if function pointer pass reference to container
......
......@@ -86,19 +86,17 @@ const char* parameter_name(const char* name)
/*
* returns a new string with _container on the end.
*/
/*
const char* container_name(const char* name)
const char* trampoline_func_name(const char* name)
{
int length = strlen(name);
int length2 = strlen("_container");
int length2 = strlen("_trampoline");
char *new_str = (char*) malloc(sizeof(char)*(length+length2+1));
std::ostringstream total;
total << name << "_container";
total << name << "_trampoline";
strncpy(new_str, total.str().c_str(), length+length2+1);
return new_str;
}
*/
/*
* takes the vector of global variables with also provides the parameters to the function.
......@@ -643,7 +641,7 @@ CCSTIfStatement* if_cond_fail(CCSTExpression *cond, const char *err_msg)
return new CCSTIfStatement(cond, if_body);
}
CCSTCompoundStatement* alloc_init_containers_driver(ProjectionType *pt, LexicalScope *ls, const char *side)
CCSTCompoundStatement* alloc_init_containers_driver(Variable *v, ProjectionType *pt, LexicalScope *ls, const char *side)
{
std::vector<CCSTDeclaration*> declarations;
std::vector<CCSTStatement*> statements;
......@@ -653,34 +651,28 @@ CCSTCompoundStatement* alloc_init_containers_driver(ProjectionType *pt, LexicalS
CCSTDeclaration *err_variable = new CCSTDeclaration(int_type(), err_decs);
declarations.push_back(err_variable);
statements.push_back(alloc_init_containers(pt, ls, side));
statements.push_back(alloc_init_containers(v, pt, ls, side));
return new CCSTCompoundStatement(declarations, statements);
}
// need to pass scope!
CCSTCompoundStatement* alloc_init_containers(ProjectionType *pt, LexicalScope *ls, const char *side)
CCSTCompoundStatement* alloc_init_containers(Variable *v, ProjectionType *pt, LexicalScope *ls, const char *side)
{
std::vector<CCSTDeclaration*> declarations;
std::vector<CCSTStatement*> statements;
// declare container
int err;
const char* container_name_ = container_name(pt->name());
Type *container_tmp = ls->lookup(container_name_, &err); // fix
Assert(container_tmp != 0x0, "Error: could not find container in environment\n");
declarations.push_back(struct_pointer_declaration(container_name_, container_name_, ls));
int err;
Type* container_tmp = ls->lookup(container_name_, &err);
Assert(container_tmp != 0x0, "Error: could not find type in scope\n");
ProjectionType *container = dynamic_cast<ProjectionType*>(container_tmp);
Assert(container != 0x0, "Error: dynamic cast to Projection type failed!\n");
Assert(container != 0x0, "Error: dynamic cast to projection failed\n");
std::vector<CCSTInitDeclarator*> decs;
decs.push_back(new CCSTDeclarator(new CCSTPointer(), new CCSTDirectDecId(container_name_)));
CCSTDeclaration *container_declaration = new CCSTDeclaration(type2(container), decs);
declarations.push_back(container_declaration);
// alloc
std::vector<CCSTAssignExpr*> kzalloc_args;
kzalloc_args.push_back(new CCSTUnaryExprSizeOf(new CCSTUnaryExprCastExpr(new CCSTUnaryOp(unary_mult_t), new CCSTPrimaryExprId(container_name_))));
kzalloc_args.push_back(new CCSTEnumConst("GFP_KERNEL"));
statements.push_back(new CCSTAssignExpr(new CCSTPrimaryExprId(container_name_), equals(), function_call("kzalloc", kzalloc_args)));
statements.push_back(kzalloc_structure(container_name_, container_name_));
// error check
// if null
......@@ -714,16 +706,17 @@ CCSTCompoundStatement* alloc_init_containers(ProjectionType *pt, LexicalScope *l
std::vector<ProjectionField*> fields = pt->fields();
for(std::vector<ProjectionField*>::iterator it = fields.begin(); it != fields.end(); it ++) {
ProjectionField *pf = *it;
pf->set_accessor(v);
if(pf->type()->num() == 4 && alloc_caller(pf, side)) {
ProjectionType *pt2 = dynamic_cast<ProjectionType*>(pf->type());
Assert(pt2 != 0x0, "Error: dynamic cast to Projection type failed!\n");
statements.push_back(alloc_init_containers(pt2, ls, side));
statements.push_back(alloc_init_containers(pf, pt2, ls, side));
// need to link/init
// need to access this field, but from the container....
Assert(pf->accessor() != 0x0, "Error: field does not have a surrounding variable");
Assert(pf->accessor() != 0x0, "Error: field %s does not have a surrounding variable\n", pf->identifier());
Variable *sv = pf->accessor()->accessor();
pf->accessor()->set_accessor(tmp);
......@@ -750,6 +743,131 @@ CCSTCompoundStatement* alloc_init_containers(ProjectionType *pt, LexicalScope *l
return new CCSTCompoundStatement(declarations, statements);
}
CCSTCompoundStatement* alloc_init_trampoline(Variable *v, ProjectionType *pt, LexicalScope *ls)
{
std::vector<CCSTDeclaration*> declarations;
std::vector<CCSTStatement*> statements;
int err;
Type *container_type = ls->lookup(container_name(pt->name()), &err);
Assert(container_type != 0x0, "Error: could not find projection in scope\n");
ProjectionType *container = dynamic_cast<ProjectionType*>(container_type);
Assert(container != 0x0, "Error: dynamic cast to projection failed\n");
Parameter *tmp_container = new Parameter(container, container_name(pt->name()), 1);
std::vector<ProjectionField*> fields = pt->fields();
for(std::vector<ProjectionField*>::iterator it = fields.begin(); it != fields.end(); it ++) {
ProjectionField *pf = *it;
pf->set_accessor(v);
if (pf->type()->num() == 4) {
ProjectionType *pt = dynamic_cast<ProjectionType*>(pf->type());
Assert(pt != 0x0, "Error: dynamic cast to ProjectionType failed.\n");
statements.push_back(alloc_init_trampoline(pf, pt, ls));
} else if (pf->type()->num() == 7) {
// declare trampoline container
const char* tramp_name = hidden_args_name( pf->type()->name() ); // todo
declarations.push_back(struct_pointer_declaration(tramp_name, tramp_name, ls)); // ls todo
// alloc
statements.push_back(kzalloc_structure(tramp_name, tramp_name));
// error checking
statements.push_back(if_cond_fail(new CCSTUnaryExprCastExpr(Not(), new CCSTPrimaryExprId(tramp_name))
, "kzalloc"));
// dup trampoline
/*
rm_file_hidden_args->t_handle =
LCD_DUP_TRAMPOLINE(rm_file_trampoline);
if (!rm_file_hidden_args->t_handle) {
LIBLCD_ERR("dup trampoline");
lcd_exit(-1);
} */
int err;
Type *tmp_trampoline = ls->lookup(tramp_name, &err);
Assert(tmp_trampoline != 0x0, "Error: could not find trampline in environment\n");
ProjectionType *trampoline = dynamic_cast<ProjectionType*>(tmp_trampoline);
Assert(trampoline != 0x0, "Error: dynamic cast to Projection type failed!\n");
Parameter *tmp = new Parameter(trampoline, tramp_name, 1);
ProjectionField *t_handle_pf = trampoline->get_field("t_handle");
Assert(pf != 0x0, "Error: could not find field in projection\n");
pf->set_accessor(tmp);
std::vector<CCSTAssignExpr*> dup_args;
dup_args.push_back(new CCSTPrimaryExprId(trampoline_func_name( pf->type()->name() )));
statements.push_back(new CCSTAssignExpr(access(t_handle_pf), equals(), function_call("LCD_DUP_TRAMPOLINE", dup_args))); // access t_handle
// error check duplication
statements.push_back(if_cond_fail(access(t_handle_pf), "dup trampoline"));
// link t_handle hidden args with trampoline
Assert(t_handle_pf->type()->num() == 4, "Error: field is not a projection\n");
ProjectionType *tmp_t_handle = dynamic_cast<ProjectionType*>(t_handle_pf->type());
Assert(tmp_t_handle != 0x0, "Error: dynamic cast to projection failed\n");
ProjectionField *ha_tmp = tmp_t_handle->get_field("hidden_args"); // use projeciton type not field.
Assert(ha_tmp != 0x0, "Error: could not find field in projection\n"); // could easily make get field function handle this
statements.push_back(new CCSTAssignExpr(access(ha_tmp), equals(), new CCSTPrimaryExprId(tramp_name))); // todo
// link trampoline container field. with container
ProjectionField *c_tmp = trampoline->get_field(container_name(pt->name())); // todo
Assert(c_tmp != 0x0, "Error: could not find field in projection");
c_tmp->set_accessor(tmp);
statements.push_back(new CCSTAssignExpr(access(c_tmp), equals(), new CCSTPrimaryExprId(container_name(pt->name())))); // todo
// link data store
ProjectionField *d_tmp = trampoline->get_field("dstore"); // todo
Assert(d_tmp != 0x0, "Error: could not find field in projection");
d_tmp->set_accessor(tmp);
statements.push_back(new CCSTAssignExpr(access(d_tmp), equals(), new CCSTPrimaryExprId("dstore_name_todo"))); // todo
// install trampoline in struct container function pointer.?
// todo access field
std::vector<CCSTAssignExpr*> handle_to_tramp_args;
handle_to_tramp_args.push_back(access(t_handle_pf)); // pf defined on line 770
// need to access this field. from its struct's container
Assert(pf->accessor() != 0x0, "Error: accessor field is null\n");
Variable *tmp_var = pf->accessor()->accessor();
pf->accessor()->set_accessor(tmp_container);
statements.push_back(new CCSTAssignExpr(access(pf), equals(), function_call("LCD_HANDLE_TO_TRAMPOLINE", handle_to_tramp_args)));
pf->accessor()->set_accessor(tmp_var);
}
}
return new CCSTCompoundStatement(declarations, statements);
}
/*
* looks up structure and returns a declaration for a variable
* with name var_name that is a pointer to struct with name struct_name
*/
CCSTDeclaration* struct_pointer_declaration(const char* struct_name, const char* var_name, LexicalScope *ls)
{
int err;
Type *struct_tmp = ls->lookup(struct_name, &err); // fix
Assert(struct_tmp != 0x0, "Error: could not find container in environment\n");
ProjectionType *struct_ = dynamic_cast<ProjectionType*>(struct_tmp);
Assert(struct_ != 0x0, "Error: dynamic cast to Projection type failed!\n");
std::vector<CCSTInitDeclarator*> decs;
decs.push_back(new CCSTDeclarator(new CCSTPointer(), new CCSTDirectDecId(var_name)));
return new CCSTDeclaration(type2(struct_), decs);
}
CCSTStatement* kzalloc_structure(const char* struct_name, const char* var_name)
{
// alloc
std::vector<CCSTAssignExpr*> kzalloc_args;
kzalloc_args.push_back(new CCSTUnaryExprSizeOf(new CCSTUnaryExprCastExpr(new CCSTUnaryOp(unary_mult_t)
, new CCSTPrimaryExprId(struct_name))));
kzalloc_args.push_back(new CCSTEnumConst("GFP_KERNEL"));
return new CCSTAssignExpr(new CCSTPrimaryExprId(var_name), equals(), function_call("kzalloc", kzalloc_args));
}
bool alloc_caller(Variable *v, const char *side)
{
if(strcmp(side, "caller") == 0) {
......
......@@ -132,7 +132,38 @@ CCSTCompoundStatement* dispatch_loop_body(std::vector<Rpc*> rps)
*/
CCSTCompoundStatement* callee_body(Rpc *r)
{
printf("callee body todo\n");
std::vector<CCSTDeclaration*> declarations;
std::vector<CCSTStatement*> statements;
// allocate necessary container things
/* code that loops through parameters and allocates/initializes whatever necessary before marshalling*/
// loop through params, declare a tmp and pull out marshal value
std::vector<Parameter*> params = r->parameters();
// for each parameter that is ia projection -- & is alloc
for(std::vector<Parameter*>::iterator it = params.begin(); it != params.end(); it ++)
{
Parameter *p = *it;
if(p->type()->num() == 4 && p->alloc_callee()) {
ProjectionType *pt = dynamic_cast<ProjectionType*>(p->type());
Assert(pt != 0x0, "Error: dynamic cast to Projection type failed!\n");
statements.push_back(alloc_init_containers_driver(p, pt, r->current_scope(), "callee"));
}
}
// trampoline allocation
for(std::vector<Parameter*>::iterator it = params.begin(); it != params.end(); it ++) {
Parameter *p = *it;
if(p->type()->num() == 4) { // may need to check alloc/dealloc in future
ProjectionType *pt = dynamic_cast<ProjectionType*>(p->type());
Assert(pt != 0x0, "Error: dynamic cast to Projection type failed\n");
printf("calling alloc trampoline\n");
statements.push_back(alloc_init_trampoline(p, pt, r->current_scope()));
}
}
return new CCSTCompoundStatement(declarations, statements);
}
......@@ -314,8 +345,8 @@ CCSTFile* generate_server_source(Module *m)
}
}
definitions.push_back( function_definition(dispatch_function_declaration()
, dispatch_loop_body(rps)));
// definitions.push_back( function_definition(dispatch_function_declaration()
// , dispatch_loop_body(rps)));
CCSTFile *c_file = new CCSTFile(definitions);
printf("in server source gen\n");
return c_file;
......
......@@ -36,8 +36,11 @@ const char* struct_name(ProjectionType *pt); // complete
// helper.cpp
CCSTCompoundStatement* alloc_init_containers_driver(ProjectionType *pt, LexicalScope *ls, const char* side); // complete
CCSTCompoundStatement* alloc_init_containers(ProjectionType *pf, LexicalScope *ls, const char* side); // complete
CCSTDeclaration* struct_pointer_declaration(const char* struct_name, const char* var_name, LexicalScope *ls); // complete
CCSTStatement* kzalloc_structure(const char*struct_name, const char* var_name); // complete
CCSTCompoundStatement* alloc_init_containers_driver(Variable *v, ProjectionType *pt, LexicalScope *ls, const char* side); // complete
CCSTCompoundStatement* alloc_init_containers(Variable *v, ProjectionType *pt, LexicalScope *ls, const char* side); // complete
CCSTCompoundStatement* alloc_init_trampoline(Variable *v, ProjectionType *pt, LexicalScope *ls); // complete-ish
bool alloc_caller(Variable *v, const char* side); // complete
CCSTStructUnionSpecifier* struct_declaration(ProjectionType *pt); // complete
CCSTDeclaration* declare_and_initialize_container_struct(Variable *v); // complete
......
......@@ -468,10 +468,12 @@ class Rpc : public Base
const char* name_;
std::vector<Parameter* > parameters_;
std::vector<Parameter* > marshal_parameters_; // wtf is this
bool function_pointer_defined_;
void construct_marshal_parameters();
std::vector<Variable*> construct_projection_parameters(ProjectionType *pt);
public:
Rpc(ReturnVariable *return_var, const char* name, std::vector<Parameter* > parameters, LexicalScope *current_scope);
std::vector<Variable*> marshal_parameters; // wtf is this
void set_function_pointer_defined(bool b);
bool function_pointer_defined();
const char* name();
......
......@@ -112,7 +112,6 @@ File = Spacing i:Include* GlobalScopeDefinitions t:Interface* <eof> {{
}}
GlobalScopeDefinitions = d:Type_Definitions* {{
printf("matched global scope definitions\n");
for(Value::iterator it = d.getValues().begin(); it != d.getValues().end(); it ++) {
const Value & v2 = *it;
Type *type = (Type*) v2.getValue();
......@@ -152,7 +151,6 @@ Identifier = i1:IdentStart i2:IdentCont* {{
}
std::string str = total.str();
value.value = malloc(str.length()+1);
printf("matched identifier %s\n", str.c_str());
strncpy((char*)value.value, str.c_str(), str.length()+1);
}}
......@@ -160,10 +158,17 @@ IdentStart = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]
IdentCont = IdentStart | [0123456789]
unnamed_scope = s:unnamed_scope_special d:Type_Definitions* Rpc* Spacing CLOSEC Spacing {{
printf("matched an unnamed scope\n");
unnamed_scope = s:unnamed_scope_special d:Type_Definitions* r:Rpc* Spacing CLOSEC Spacing {{
std::vector<Rpc*> *rpcs = new std::vector<Rpc*>();
for(Value::iterator it = r.getValues().begin(); it != r.getValues().end(); it ++) {
const Value &v = *it;
Rpc *r = (Rpc*) v.getValue();
rpcs->push_back(r);
}
set_current_scope(get_current_scope()->outer_scope()); // leaving current scope
value = s;
value = rpcs;
}}
unnamed_scope_special = Spacing OPENC Spacing {{
......@@ -186,9 +191,9 @@ pc_unnamed_scope= s:unnamed_scope_special d:Type_Definitions* p:ProjField* Spaci
value = fields;
}}
Interface = m:Interface_special Space+ id:Identifier Spacing OPEN gs:Globals? Spacing CLOSE Spacing OPENC Spacing d:Type_Definitions* r:Rpc* unnamed_scope* Spacing CLOSEC Spacing {{
Interface = m:Interface_special Space+ id:Identifier Spacing OPEN gs:Globals? Spacing CLOSE Spacing OPENC Spacing d:Type_Definitions* r:Rpc* r2:unnamed_scope* Spacing CLOSEC Spacing {{
LexicalScope *module_scope = (LexicalScope*) m.getValue();
std::vector<Rpc*> rpcs;
std::vector<Rpc*> rpcs;
std::vector<GlobalVariable*> *globals = (std::vector<GlobalVariable*>*) gs.getValue();
std::vector<GlobalVariable*> globals2 = *globals;
......@@ -198,6 +203,12 @@ Interface = m:Interface_special Space+ id:Identifier Spacing OPEN gs:Globals?
rpcs.push_back(r2);
}
for(Value::iterator it = r2.getValues().begin(); it != r2.getValues().end(); it ++) {
const Value & v2 = *it;
std::vector<Rpc*> *r_tmp = (std::vector<Rpc*>*) v2.getValue();
rpcs.insert(rpcs.end(), r_tmp->begin(), r_tmp->end());
}
set_current_scope(get_current_scope()->outer_scope()); // leaving current scope
value = new Module((char*) id.getValue(), rpcs, globals2, module_scope);
}}
......@@ -284,7 +295,7 @@ Include = "include" Space+ "<" Spacing p:Pathname Spacing ">" Spacing{{
value = new Include(false, (char*) p.getValue());
}}
FP_Parameter = "rpc" Spacing s:Specification? rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN p:Parameters CLOSE {{
FP_Parameter = "rpc" Spacing s:Specification? rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN Spacing p:Parameters CLOSE {{
std::vector<Parameter*> *params = (std::vector<Parameter*>*) p.getValue();
Function *fp = new Function((char*) id.getValue(), new ReturnVariable((Type*) rt.getValue(), count_pointers(pointers)), *params, get_current_scope());
......@@ -385,7 +396,7 @@ FP_FirstParam = t:Type_form s:Specification? pointers:star* Spacing COMMA Spacin
value = fp;
}}
| "rpc" Space+ rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN p:Parameters CLOSE SEMI Spacing COMMA Spacing {{
| "rpc" Space+ rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN Spacing p:Parameters CLOSE SEMI Spacing COMMA Spacing {{
std::vector<Parameter*> *params = (std::vector<Parameter*>*) p.getValue();
Function *fp = new Function((char*) id.getValue(), new ReturnVariable((Type*) rt.getValue(), count_pointers(pointers)), *params, get_current_scope());
value = new FPParameter(fp, 1);
......@@ -449,7 +460,7 @@ FP_LastParam = t:Type_form s:Specification? pointers:star* Spacing {{
value = fp;
}}
| "rpc" Space+ rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN p:Parameters CLOSE SEMI Spacing {{
| "rpc" Space+ rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN Spacing p:Parameters CLOSE SEMI Spacing {{
// todo change return type to return variable and add pointer
std::vector<Parameter*> *params = (std::vector<Parameter*>*) p.getValue();
Function *fp = new Function((char*) id.getValue(), new ReturnVariable((Type*) rt.getValue(), count_pointers(pointers)), *params, get_current_scope());
......@@ -521,6 +532,7 @@ Rpc = "rpc" Space+ t:Type_form pointers:star* Spacing id1:Identifier Spacing OP
std::vector<Parameter*> params_ = *params;
Rpc* r = new Rpc(new ReturnVariable((Type *) t.getValue(), count_pointers(pointers)), (char *) id1.getValue(), params_, get_current_scope());
printf("creating an rpc\n");
/*
int err = get_current_scope()->insert(r);
if(!err) {
......@@ -531,7 +543,6 @@ Rpc = "rpc" Space+ t:Type_form pointers:star* Spacing id1:Identifier Spacing OP
}}
Projection_constructor = s:Projection_constructor_special Spacing "<" Spacing t:Proj_type Spacing ">" Spacing id:Identifier Spacing OPEN Spacing g:Globals? Spacing CLOSE Spacing OPENC Spacing d:Type_Definitions* p:ProjField* Spacing CLOSEC Spacing {{
printf("matched a projection constructor\n");
std::vector<ProjectionField*> fields;
std::vector<GlobalVariable*> *globals_ = (std::vector<GlobalVariable*>*) g.getValue();
std::vector<GlobalVariable*> globals = *globals_;
......@@ -568,7 +579,6 @@ Projection_constructor_special = "projection" {{
}}
Projection = "projection" Spacing "<" Spacing t:Proj_type Spacing ">" Spacing id:Identifier Spacing OPENC Spacing p:ProjField* CLOSEC Spacing {{
printf("matched a projection\n");
std::vector<ProjectionField *> fields;
for(Value::iterator it = p.getValues().begin(); it != p.getValues().end(); it ++)
{
......@@ -624,7 +634,6 @@ Keyword = "out" {{
value = x;
}}
| "alloc" {{
printf("matched alloc keyword\n");
int *x = (int *) malloc(sizeof(int));
*x = 3;
value = x;
......@@ -703,7 +712,6 @@ ProjField = "projection" Space+ id:Identifier Spacing s:Specification? pointers:
}}
| t:Type_form Spacing s:Specification? pointers:star* Spacing id:Identifier Spacing SEMI Spacing {{
printf("matched a regular projection field\n");
ProjectionField *pf = new ProjectionField((Type *) t.getValue(), (char *) id.getValue(), count_pointers(pointers));
......@@ -734,7 +742,7 @@ ProjField = "projection" Space+ id:Identifier Spacing s:Specification? pointers:
fields->push_back(pf);
value = fields;
}}
| "rpc" Spacing s:Specification? rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN p:Parameters CLOSE SEMI Spacing {{
| "rpc" Spacing s:Specification? rt:Type_form pointers:star* Spacing OPEN Spacing "*" Spacing id:Identifier Spacing CLOSE Spacing OPEN Spacing p:Parameters CLOSE SEMI Spacing {{
printf("matched a function pointer field\n");
std::vector<Parameter*> *params = (std::vector<Parameter*>*) p.getValue();
......@@ -822,7 +830,6 @@ Type_form = "projection" Space+ n:Identifier Spacing {{
value = getType((char*)n.getValue());
}}
| "channel" Spacing {{ // todo
printf("matched a channel type\n");
value = new Channel();
}}
| type
......
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