Skip to content

Commit

Permalink
add getArg
Browse files Browse the repository at this point in the history
  • Loading branch information
dongfanghong committed Jan 8, 2017
1 parent 73b0a69 commit 6065a31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions UCompile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ compileToC l = header++compileToCS l (Map.fromList []) 0 footer where
\VExp * makeAbs(VExp* abs_val);\n\
\VExp * makeRef(int ref_val);\n\
\VExp * makeApply(VExp * f,VExp * x);\n\
\int executeVExp(VExp * exp);\n\
\int main(){\n\
\int executeVExp(VExp * exp,int argc,char ** argv);\n\
\int main(int argc,char ** argv){\n\
\return executeVExp("
footer=");\n}"
footer=",argc,argv);\n}"
compileToCS :: LExpr -> Map.Map [Char] Int -> Int -> ShowS
compileToCS l names curlevel = case l of
LInt v -> showString ("makeInt("++(show v)++")")
Expand Down
10 changes: 4 additions & 6 deletions simpleruntime.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ typedef struct ValueStack{
}ValueStack;
struct VContext{
Value* val;
//struct VContext * next;
VContext * prev;
int refcount;
};
Expand Down Expand Up @@ -1009,7 +1008,7 @@ VExp * makeBuiltin(const char* func_name){
return NULL;
}

int executeVExp(VExp * exp){
int executeVExp(VExp * exp,int argc,char ** argv){
Value * v = newValue();
VContext * context = newVContext();
Continuation * cont = newContinuation();
Expand All @@ -1019,11 +1018,10 @@ int executeVExp(VExp * exp){
v->r_exp = NULL;
v->r_context = NULL;
v->r_cont = cont;
return executeValue(v, 0, NULL);
return executeValue(v,argc,argv);
}

int main()
{
/*{
int resultcode =executeVExp(makeApply(
makeAbs(
makeRef(0)),
Expand All @@ -1044,5 +1042,5 @@ makeInt(0))))));
//printf("\nhere\n");
//printf("%d",resultcode);
}
}*/

0 comments on commit 6065a31

Please sign in to comment.