Now calls main() if one has been defined, and not if one hasn't.
git-svn-id: http://picoc.googlecode.com/svn/trunk@460 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
fd3fad1784
commit
a365e1e993
5
picoc.c
5
picoc.c
|
@ -38,8 +38,11 @@ void Cleanup()
|
||||||
void CallMain(int argc, char **argv)
|
void CallMain(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* check if the program wants arguments */
|
/* check if the program wants arguments */
|
||||||
struct Value *FuncValue;
|
struct Value *FuncValue = NULL;
|
||||||
|
|
||||||
|
if (!VariableDefined(TableStrRegister("main")))
|
||||||
|
return;
|
||||||
|
|
||||||
VariableGet(NULL, TableStrRegister("main"), &FuncValue);
|
VariableGet(NULL, TableStrRegister("main"), &FuncValue);
|
||||||
if (FuncValue->Typ->Base != TypeFunction)
|
if (FuncValue->Typ->Base != TypeFunction)
|
||||||
ProgramFail(NULL, "main is not a function - can't call it");
|
ProgramFail(NULL, "main is not a function - can't call it");
|
||||||
|
|
|
@ -77,5 +77,4 @@ void main()
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
main();
|
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,3 @@ main()
|
||||||
Hanoi(N,A,B,C);
|
Hanoi(N,A,B,C);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main();
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ TESTS= 00_assignment.test \
|
||||||
then \
|
then \
|
||||||
../picoc $*.c - arg1 arg2 arg3 arg4 2>&1 >$*.output; \
|
../picoc $*.c - arg1 arg2 arg3 arg4 2>&1 >$*.output; \
|
||||||
else \
|
else \
|
||||||
../picoc -m $*.c 2>&1 >$*.output; \
|
../picoc $*.c 2>&1 >$*.output; \
|
||||||
fi
|
fi
|
||||||
@if [ "x`diff -qbu $*.expect $*.output`" != "x" ]; \
|
@if [ "x`diff -qbu $*.expect $*.output`" != "x" ]; \
|
||||||
then \
|
then \
|
||||||
|
|
Loading…
Reference in a new issue