예제 #1
0
파일: shortcuts.c 프로젝트: DBane/sdk
struct Expression * QBrackets(struct Expression * exp)
{
struct __ecereNameSpace__ecere__sys__OldList * expList = MkList();

ListAdd(expList, exp);
return MkExpBrackets(expList);
}
예제 #2
0
파일: copy.c 프로젝트: tcsilver/ecere-sdk
struct Expression * CopyExpression(struct Expression * exp)
{
struct Expression * result = (((void *)0));

if(exp)
switch(exp->type)
{
case 16:
result = MkExpDummy();
break;
case 0:
result = MkExpIdentifier(CopyIdentifier(exp->identifier));
break;
case 1:
result = MkExpInstance(CopyInstantiation(exp->instance));
break;
case 2:
result = MkExpConstant(exp->string);
break;
case 3:
result = MkExpString(exp->string);
break;
case 4:
result = MkExpOp(CopyExpression(exp->op.exp1), exp->op.op, CopyExpression(exp->op.exp2));
break;
case 5:
{
struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
struct Expression * e;

for(e = (*exp->list).first; e; e = e->next)
ListAdd(list, CopyExpression(e));
result = MkExpBrackets(list);
break;
}
case 6:
{
struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
struct Expression * e;

for(e = (*exp->index.index).first; e; e = e->next)
ListAdd(list, CopyExpression(e));
result = MkExpIndex(CopyExpression(exp->index.exp), list);
break;
}
case 7:
{
struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
struct Expression * arg;

if(exp->call.arguments)
{
for(arg = (*exp->call.arguments).first; arg; arg = arg->next)
ListAdd(list, CopyExpression(arg));
}
result = MkExpCall(CopyExpression(exp->call.exp), list);
break;
}
case 8:
result = MkExpMember(CopyExpression(exp->member.exp), CopyIdentifier(exp->member.member));
result->member.memberType = exp->member.memberType;
result->member.thisPtr = exp->member.thisPtr;
break;
case 9:
result = MkExpPointer(CopyExpression(exp->member.exp), CopyIdentifier(exp->member.member));
break;
case 10:
result = MkExpTypeSize(CopyTypeName(exp->typeName));
break;
case 38:
result = MkExpTypeAlign(CopyTypeName(exp->typeName));
break;
case 11:
result = MkExpCast(CopyTypeName(exp->cast.typeName), CopyExpression(exp->cast.exp));
break;
case 12:
{
struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
struct Expression * e;

for(e = (*exp->cond.exp).first; e; e = e->next)
ListAdd(list, CopyExpression(e));
result = MkExpCondition(CopyExpression(exp->cond.cond), list, CopyExpression(exp->cond.elseExp));
break;
}
case 36:
result = MkExpVaArg(CopyExpression(exp->vaArg.exp), CopyTypeName(exp->vaArg.typeName));
break;
case 25:
result = MkExpExtensionCompound(CopyStatement(exp->compound));
break;
}
if(result)
{
result->expType = exp->expType;
if(exp->expType)
exp->expType->refCount++;
result->destType = exp->destType;
if(exp->destType)
exp->destType->refCount++;
result->loc = exp->loc;
result->isConstant = exp->isConstant;
result->byReference = exp->byReference;
}
return result;
}