mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
ZoneCodeGenerator: Make arraypointer work with temp block
This commit is contained in:
parent
b25fe9a9f7
commit
79848b4631
@ -2,22 +2,38 @@ delimiters "$", "$"
|
||||
|
||||
// Everything related to loading a pointer with a count that can be larger than 1
|
||||
|
||||
LoadArrayPointer_Loading(context, structure, member, reference) ::= <%
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));
|
||||
// $member.Member.VariableType.Type.Alignment$
|
||||
$\n$
|
||||
LoadArrayPointer_Loading(context, structure, member, reference) ::= <<
|
||||
$if(member.Computations.IsTempBlock)$
|
||||
$member.Member.VariableType.Type.FullName$* ptr = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;
|
||||
$endif$$\\$
|
||||
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$)); $\\$
|
||||
// $member.Member.VariableType.Type.Alignment$$\\$
|
||||
$\\$
|
||||
$\\$
|
||||
$if(member.Computations.IsTempBlock)$
|
||||
|
||||
$member.Member.VariableType.Type.FullName$** toInsert = nullptr;
|
||||
if(ptr == PTR_INSERT)
|
||||
toInsert = m_stream->InsertPointer<$member.Member.VariableType.Type.FullName$>();
|
||||
|
||||
$endif$$\\$
|
||||
$\\$
|
||||
$\\$
|
||||
$if(member.StructureType && !member.StructureType.IsLeaf && !member.Computations.IsRuntimeBlock)$
|
||||
|
||||
$TypeVarName(member.Member.VariableType.Type)$ = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||
LoadArray_$member.Member.VariableType.Type.Name$(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||
|
||||
$else$
|
||||
m_stream->Load<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);$\\$
|
||||
$endif$$\\$
|
||||
$\\$
|
||||
$if(member.Computations.IsTempBlock)$
|
||||
|
||||
m_stream->Load<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||
|
||||
if(toInsert != nullptr)
|
||||
*toInsert = $TypeVarName(structure.Type)$->$member.Member.Name$;$\\$
|
||||
$endif$
|
||||
%>
|
||||
>>
|
||||
|
||||
LoadArrayPointer_ScriptString(context, structure, member, reference) ::= <%
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));
|
||||
@ -37,18 +53,33 @@ $LoadArrayPointer_Loading(context, structure, member, reference)$
|
||||
$endif$
|
||||
%>
|
||||
|
||||
LoadArrayPointer_Reuse(context, structure, member, reference) ::= <<
|
||||
$if(member.Computations.IsTempBlock)$
|
||||
if($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING || $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_INSERT)
|
||||
{
|
||||
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
||||
}
|
||||
else
|
||||
{
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToAlias($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||
}$\\$
|
||||
$else$
|
||||
if($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING)
|
||||
{
|
||||
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
||||
}
|
||||
else
|
||||
{
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToPointer($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||
}$\\$
|
||||
$endif$
|
||||
>>
|
||||
|
||||
LoadArrayPointer_PointerCheck(context, structure, member, reference) ::= <<
|
||||
if ($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$)
|
||||
{
|
||||
$if(member.IsReusable)$
|
||||
if($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING)
|
||||
{
|
||||
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
||||
}
|
||||
else
|
||||
{
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToPointer($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||
}
|
||||
$LoadArrayPointer_Reuse(context, structure, member, reference)$
|
||||
$else$
|
||||
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
||||
$endif$
|
||||
|
@ -7,7 +7,7 @@ $if(member.Computations.IsTempBlock)$
|
||||
$member.Member.VariableType.Type.FullName$* ptr = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;
|
||||
$endif$$\\$
|
||||
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$)); // $member.Member.VariableType.Type.Alignment$$\\$
|
||||
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$)); // $member.Member.VariableType.Type.Alignment$$\\$
|
||||
$\\$
|
||||
$\\$
|
||||
$if(member.Computations.IsTempBlock)$
|
||||
|
Loading…
x
Reference in New Issue
Block a user