Skip to content

Commit

Permalink
Bug fixes and more changes to FB_List and FB_Array_list
Browse files Browse the repository at this point in the history
+ FB_List and FB_Array_List
   - The bSuccess output parameter, an indicator for whether an operation is successful, was not implemented on the Resize(...) method.
   - Removed type match checking on the Get_Generic Method. This checked if the Return_Item parameter was the same type  as the one being retrieved. That parameter was an output and there is no point in type checking since you're retrieving a generic.

+ FB_List
   - Changed how the Set(...) method works. Set method used to only set a value if its the same type. Now  it just replaced the value in that location with whatever typed value you set the location to be.
  • Loading branch information
fisothemes committed Mar 10, 2023
1 parent d47d1d4 commit 96cda15
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 29 deletions.
Binary file added builds/0.3.1.0/TcDynCollections.library
Binary file not shown.
4 changes: 2 additions & 2 deletions src/TwinCat Dynamic Collections.project.~u
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Goodwill
DESKTOP-AB1V0FA
8460
638096116331663471
17864
638140155274868719
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ END_VAR
<Implementation>
<ST><![CDATA[Get_Generic := THIS^;
IF THIS^.EmptyListException() OR THIS^.OutOfBoundsException(nIndex) THEN RETURN; END_IF
IF THIS^.TypeMismatchException(Return_Item, THIS^.pData[nIndex]) THEN RETURN; END_IF
Return_Item := THIS^.pData[nIndex];
bSuccess := TRUE;]]></ST>
</Implementation>
Expand Down Expand Up @@ -798,7 +797,9 @@ FOR i := 0 TO nSize - 1 DO
THIS^.Free_Value(pOld_Data[i]);
END_FOR
__DELETE(pOld_Data);
THIS^.nCount := nSize;]]></ST>
THIS^.nCount := nSize;
bSuccess := TRUE;]]></ST>
</Implementation>
</Method>
<Method Name="Reverse" Id="{c7bb1663-8a1d-412d-ac93-00cfb818cee8}">
Expand Down Expand Up @@ -948,7 +949,8 @@ TypeMismatchException := stError.bSTATUS;]]></ST>
</LineIds>
<LineIds Name="FB_Array_List.Get_Generic">
<LineId Id="12" Count="0" />
<LineId Id="14" Count="2" />
<LineId Id="14" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="13" Count="0" />
</LineIds>
<LineIds Name="FB_Array_List.Get_Last">
Expand Down Expand Up @@ -1060,6 +1062,8 @@ TypeMismatchException := stError.bSTATUS;]]></ST>
<LineId Id="136" Count="6" />
<LineId Id="135" Count="0" />
<LineId Id="144" Count="0" />
<LineId Id="189" Count="0" />
<LineId Id="188" Count="0" />
</LineIds>
<LineIds Name="FB_Array_List.Reverse">
<LineId Id="5" Count="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,7 @@ IF THIS^.EmptyListException() THEN RETURN; END_IF
IF THIS^.OutOfBoundsException(nIndex) THEN RETURN; END_IF
IF nIndex = THIS^._Count - 1 THEN pTemp := pTail; ELSE pTemp := THIS^.Iterate(nIndex); END_IF
IF THIS^.TypeMismatchException(Return_Item, pTemp^.Data) THEN RETURN; END_IF
Return_Item.diSize := pTemp^.Data.diSize;
Return_Item.pValue := pTemp^.Data.pValue;
Return_Item.TypeClass := pTemp^.Data.TypeClass;
Return_Item := pTemp^.Data;
bSuccess := TRUE;]]></ST>
</Implementation>
</Method>
Expand Down Expand Up @@ -742,7 +738,9 @@ IF nSize > THIS^._Count THEN
FOR i := nCount TO nSize - 1 DO
THIS^.Add_Back(Data, bSuccess => bSuccess);
END_FOR
END_IF]]></ST>
END_IF
bSuccess := TRUE;]]></ST>
</Implementation>
</Method>
<Method Name="Reverse" Id="{163b036d-4e69-4b74-8841-8d30b26b2230}">
Expand Down Expand Up @@ -795,7 +793,13 @@ ELSE
pTemp := Iterate(nIndex);
END_IF
IF THIS^.TypeMismatchException(pTemp^.Data, Item) THEN RETURN; END_IF
__DELETE(pTemp^.Data.pValue);
pTemp^.Data.sValue := THIS^.GetValueAsString(Item);
pTemp^.Data.pValue := __NEW(BYTE, TO_UDINT(Item.diSize)); // Allocate space in memory to store data value.
pTemp^.Data.diSize := Item.diSize;
pTemp^.Data.TypeClass := Item.TypeClass;
THIS^.CopyValueTo(pTemp^.Data, Item);
bSuccess := TRUE;
Expand Down Expand Up @@ -910,11 +914,7 @@ TypeMismatchException := stError.bSTATUS;]]></ST>
<LineId Id="10" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="23" Count="0" />
<LineId Id="22" Count="0" />
<LineId Id="15" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="18" Count="1" />
<LineId Id="21" Count="0" />
<LineId Id="47" Count="1" />
<LineId Id="35" Count="0" />
</LineIds>
<LineIds Name="FB_List.Get_Last">
Expand Down Expand Up @@ -1021,6 +1021,7 @@ TypeMismatchException := stError.bSTATUS;]]></ST>
<LineId Id="23" Count="1" />
<LineId Id="27" Count="2" />
<LineId Id="26" Count="0" />
<LineId Id="57" Count="1" />
</LineIds>
<LineIds Name="FB_List.Reverse">
<LineId Id="21" Count="0" />
Expand All @@ -1034,8 +1035,15 @@ TypeMismatchException := stError.bSTATUS;]]></ST>
<LineId Id="73" Count="1" />
<LineId Id="90" Count="0" />
<LineId Id="89" Count="0" />
<LineId Id="91" Count="4" />
<LineId Id="76" Count="1" />
<LineId Id="91" Count="3" />
<LineId Id="129" Count="1" />
<LineId Id="122" Count="0" />
<LineId Id="125" Count="0" />
<LineId Id="128" Count="0" />
<LineId Id="127" Count="0" />
<LineId Id="123" Count="0" />
<LineId Id="121" Count="0" />
<LineId Id="77" Count="0" />
<LineId Id="108" Count="0" />
<LineId Id="78" Count="0" />
<LineId Id="43" Count="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[F_GetVersion.iMajor := 0;
F_GetVersion.iMinor := 3;
F_GetVersion.iBuild := 0;
F_GetVersion.iBuild := 1;
F_GetVersion.iRevision := 0;
]]></ST>
</Implementation>
<LineIds Name="F_GetVersion">
<LineId Id="75" Count="3" />
<LineId Id="93" Count="3" />
<LineId Id="2" Count="0" />
</LineIds>
</POU>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Title>TwinCat Dynamic Collections</Title>
<Author>Goodwill Mzumala</Author>
<DefaultNamespace>TcDynCollections</DefaultNamespace>
<ProjectVersion>0.3.0.0</ProjectVersion>
<ProjectVersion>0.3.1.0</ProjectVersion>
<DocFormat>reStructuredText</DocFormat>
<Description>A library for handling collections of data dynamically.</Description>
</PropertyGroup>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// This function has been automatically generated from the project information.
VAR_GLOBAL CONSTANT
{attribute 'const_non_replaced'}
stLibVersion_TwinCat_Dynamic_Collections : ST_LibVersion := (iMajor := 0, iMinor := 3, iBuild := 0, iRevision := 0, nFlags := 0, sVersion := '0.3.0.0');
stLibVersion_TwinCat_Dynamic_Collections : ST_LibVersion := (iMajor := 0, iMinor := 3, iBuild := 1, iRevision := 0, nFlags := 0, sVersion := '0.3.1.0');
END_VAR
]]></Declaration>
</GVL>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.10">
<Project ProjectGUID="{AA44BF3E-9AE7-4A37-9C2A-219EE971CF2F}" Target64Bit="true" ShowHideConfigurations="#x106">
<System>
<Settings MaxCpus="12" NonWinCpus="1">
<Cpu CpuId="11"/>
</Settings>
<Tasks>
<Task Id="3" Priority="20" CycleTime="100000" AmsPort="350" AdtTasks="true">
<Name>PlcTask</Name>
</Task>
</Tasks>
</System>
<Plc>
<Project GUID="{1C1CF391-AD49-4301-B41D-3891FAA7DC78}" Name="TcDynCollections" PrjFilePath="TcDynCollections\TcDynCollections.plcproj" TmcFilePath="TcDynCollections\TcDynCollections.tmc" ReloadTmc="true" AmsPort="851" FileArchiveSettings="#x000e" SymbolicMapping="true">
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="TcDynCollections\TcDynCollections.tmc">
<Name>TcDynCollections Instance</Name>
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
<Contexts>
<Context>
<Id NeedCalleeCall="true">0</Id>
<Name>PlcTask</Name>
<ManualConfig>
<OTCID>#x02010030</OTCID>
</ManualConfig>
<Priority>20</Priority>
<CycleTime>10000000</CycleTime>
</Context>
</Contexts>
<TaskPouOids>
<TaskPouOid Prio="20" OTCID="#x08502001"/>
</TaskPouOids>
</Instance>
</Project>
</Plc>
</Project>
</TcSmProject>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Version>3</Version>
<Revision>1</Revision>
<Build>4024</Build>
<Subbuild>10</Subbuild>
<Subbuild>35</Subbuild>
</TargetVersion>
</TcTargetDesc>

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
�Z�{�� �������
q�"��1���F;u �l
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 96cda15

Please sign in to comment.