text:
1IL3" library="resistor" package="C050-050X075" value="" x="80.01" y="62.23" smashed="yes" rot="R90">
<attribute name="NAME" x="77.851" y="66.421" size="1.27" layer="25" ratio="10"/>
<attribute name="VALUE" x="82.169" y="59.055" size="1.27" layer="27" ratio="10" rot="R90"/>
</element>
<element name="C1IL4" library="resistor" package="C050-050X075" value="" x="9.525" y="54.61" smashed="yes" rot="R180">
<attribute name="NAME" x="12.954" y="51.689" size="1.27" layer="25" ratio="10" rot="R180"/>
<attribute name="VALUE" x="12.7" y="56.769" size="1.27" layer="27" ratio="10" rot="R180"/>
</element>
<element name="C4P" library="resistor" package="E5-8,5" value="470u" x="56.515" y="59.69" smashed="yes">
<attribute name="NAME" x="50.4952" y="64.1604" size="1.778" layer="25" ratio="10" rot="R90"/>
<attribute name="VALUE" x="51.943" y="55.753" size="1.778" layer="27" ratio="10"/>
</element>
<element name="R1BATT" library="resistor" package="0207/7" value="20k" x="45.72" y="52.705" smashed="yes" rot="R90">
<attribute name="NAME" x="44.323" y="50.165" size="1.27" layer="25" ratio="10" rot="R90"/>
<attribute name="VALUE" x="46.2788" y="50.419" size="1.27" layer="27" ratio="10" rot="R90"/>
</element>
<element name="R2BATT" library="resistor" package="0207/7" value="10k" x="38.1" y="52.705" smashed="yes" rot="R270">
<attribute name="NAME" x="36.703" y="50.165" size="1.27" layer="25" ratio="10" rot="R90"/>
<attribute name="VALUE" x="37.5412" y="54.991" size="1.27" layer="27" ratio="10" rot="R270"/>
</element>
<element name="B1" library="switch-omron" package="B3F-40XX" value="" x="49.53" y="12.7" smashed="yes">
<attribute name="OC_NEWARK" value="36K3105" x="49.53" y="12.7" size="0.8128" layer="27" display="off"/>
<attribute name="MPN" value="B3F-4000" x="49.53" y="12.7" size="0.8128" layer="27" display="off"/>
<attribute name="MF" value="OMRON COMPONENTS USA" x="49.53" y="12.7" size="0.8128" layer="27" display="off"/>
<attribute name="OC_FARNELL" value="176434" x="49.53" y="12.7" size="0.8128" layer="27" display="off"/>
<attribute name="NAME" x="55.88" y="12.065" size="1.27" layer="25" ratio="10"/>
<attribute name="VALUE" x="46.355" y="7.62" size="1.27" layer="27" ratio="10"/>
</element>
<element name="R1B1" library="resistor" package="0207/7" value="20k" x="33.02" y="15.24" smashed="yes">
<attribute name="NAME" x="30.48" y="16.637" size="1.27" layer="25" ratio="10"/>
<attribute name="VALUE" x="30.734" y="14.6812" size="1.27" layer="27" ratio="10"/>
</element>
<element name="D1B1" library="adafruit" package="DO41-7" value="" x="17.78" y="25.4" smashed="yes" rot="R90">
<attribute name="NAME" x="16.129" y="23.368" size="1.27" layer="25" ratio="10" rot="R90"/>
<attribute name="VALUE" x="20.574" y="23.368" size="1.27" layer="27" ratio="10" rot="R90"/>
</element>
<element name="D2B1" library="adafruit" package="DO41-7" value="" x="28.575" y="27.94" smashed="yes" rot="R90">
<attribute name="NAME" x="26.924" y="25.908" size="1.27" layer="25" ratio="10" rot="R90"/>
<attribute name="VALUE" x="31.369" y="25.908" size="1.27" layer="27" ratio="10" rot="R90"/>
</element>
<element name="R2B1" library="resistor" package="0207/7" value="400" x="43.18" y="26.67" smashed="yes" rot="R90">
<attribute name="NAME" x="41.783" y="24.13" size="1.27" layer="25" ratio="10" rot="R90"/>
<attribute name="VALUE" x="43.7388" y="24.384" size="1.27" layer="27" ratio="10" rot="R90"/>
</element>
<element name="C1B1" library="resistor" package="C050-050X075" value="1u" x="6.35" y="25.4" smashed="yes" rot="R90">
<attribute name="NAME" x="8.509" y="21.209" size="1.27" layer="25" ratio="10" rot="R180"/>
<attribute name="VALUE" x="3.429" y="22.225" size="1.27" layer="27" ratio="10" rot="R90"/>
</element>
<element name="D1P" library="adafruit" package="DO41-10" value="1N4004" x="69.85" y="55.88" smashed="yes" rot="R270">
<attribute name="NAME" x="71.501" y="57.912" size="1.27" layer="25" ratio="10" rot="R270"/>
<attribute name="VALUE" x="67.056" y="57.912" size="1.27" layer="27" ratio="10" rot="R270"/>
</element>
<element name="C2P" library="resistor" package="C050-050X075" value="1u" x="74.93" y="44.45" smashed="yes" rot="R180">
<attribute name="NAME" x="74.549" y="41.529" size="1.27" layer="25" ratio="10" rot="R180"/>
<attribute name="VALUE" x="78.105" y="41.529" size="1.27" layer="27" ratio="10" rot="R180"/>
</element>
</elements>
<signals>
<signal name="GND">
<contactref element="BATT1" pad="2"/>
<contactref element="BATT2" pad="2"/>
<contactref element="J4" pad="1"/>
<contactref element="C1P" pad="2"/>
<contactref element="VR1" pad="GND"/>
<contactref element="J2" pad="GND"/>
<contactref element="J3" pad="GND"/>
<contactref element="L1P" pad="K"/>
<contactref element="C1N" pad="1"/>
<contactref element="S1UR" pad="4"/>
<contactref element="S1UR" pad="3"/>
<contactref element="UC" pad="22"/>
<contactref element="UC" pad="8"/>
<contactref element="C2X" pad="2"/>
<contactref element="C1X" pad="2"/>
<contactref element="J5" pad="GND"/>
<contactref element="C1U" pad="2"/>
<contactref element="L1S" pad="K"/>
<contactref element="Q1IL1" pad="1"/>
<contactref element="Q1IL2" pad="1"/>
<contactref element="Q1IL3" pad="1"/>
<contactref element="Q1IL4" pad="1"/>
<contactref element="C1IL1" pad="2"/>
<contactref element="C1IL2" pad="2"/>
<contactref element="C1IL4" pad="2"/>
<contactref element="C1IL3" pad="2"/>
<contactref element="C4P" pad="-"/>
<contactref element="C3P" pad="-"/>
<contactref element="R2BATT" pad="1"/>
<contactref element="B1" pad="3"/>
<contactref element="B1" pad="4"/>
<contactref element="D2B1" pad="A"/>
<contactref element="C1B1" pad="2"/>
<contactref element="C2P" pad="2"/>
<polygon width="0" layer="1" isolate="0.8128">
<vertex x="-2.54" y="85.09"/>
<vertex x="102.87" y="85.09"/>
<vertex x="102.87" y="-5.08"/>
<vertex x="-2.54" y="-5.08"/>
</polygon>
<wire x1="81.915" y1="76.2" x2="81.915" y2="77.89" width="0.4064" layer="1"/>
<wire x1="81.915" y1="77.89" x2="81.885" y2="77.92" width="0.4064" layer="1"/>
<wire x1="81.915" y1="76.2" x2="81.915" y2="73.66" width="0.8128" layer="1"/>
<wire x1="81.915" y1="73.66" x2="83.185" y2="72.39" width="0.8128" layer="1"/>
<wire x1="66.04" y1="76.835" x2="66.675" y2="76.835" width="0.4064" layer="1"/>
<wire x1="66.675" y1="76.835" x2="68.58" y2="74.93" width="0.4064" layer="1"/>
<wire x1="68.58" y1="74.93" x2="68.58" y2="74.64" width="0.4064" layer="1"/>
<wire x1="68.58" y1="74.64" x2="68.885" y2="74.335" width="0.4064" layer="1"/>
<wire x1="59.055" y1="74.295" x2="61.595" y2="74.295" width="0.8128" layer="16"/>
<wire x1="61.595" y1="74.295" x2="64.135" y2="76.835" width="0.8128" layer="16"/>
<via x="64.135" y="76.835" extent="1-16" drill="1" shape="square"/>
<wire x1="64.135" y1="76.835" x2="66.04" y2="76.835" width="0.8128" layer="1"/>
<wire x1="15.24" y1="60.43" x2="15.77" y2="60.43" width="1.27" layer="16"/>
<wire x1="15.77" y1="60.43" x2="16.51" y2="59.69" width="1.27" layer="16"/>
<wire x1="16.51" y1="59.69" x2="16.51" y2="55.88" width="1.27" layer="16"/>
<wire x1="38.1" y1="60.43" x2="38.1" y2="56.515" width="1.27" layer="16"/>
<wire x1="6.985" y1="46.99" x2="6.985" y2="48.26" width="0.8128" layer="16"/>
<wire x1="6.985" y1="48.26" x2="7.62" y2="48.895" width="0.8128" layer="16"/>
<wire x1="7.62" y1="48.895" x2="14.605" y2="48.895" width="0.8128" layer="16"/>
<wire x1="14.605" y1="48.895" x2="16.51" y2="50.8" width="0.8128" layer="16"/>
<wire x1="16.51" y1="50.8" x2="16.51" y2="55.88" width="0.8128" layer="16"/>
<wire x1="22.225" y1="51.435" x2="17.145" y2="51.435" width="0.8128" layer="16"/>
<wire x1="17.145" y1="51.435" x2="16.51" y2="50.8" width="0.8128" layer="16"/>
<wire x1="6.985" y1="54.61" x2="6.985" y2="57.785" width="1.27" layer="16"/>
<wire x1="6.985" y1="57.785" x2="9.525" y2="60.325" width="1.27" layer="16"/>
<wire x1="9.525" y1="60.325" x2="15.135" y2="60.325" width="1.27" layer="16"/>
<wire x1="15.135" y1="60.325" x2="15.24" y2="60.43" width="1.27" layer="16"/>
<wire x1="59.055" y1="59.69" x2="59.055" y2="74.295" width="0.8128" layer="16"/>
<wire x1="80.01" y1="64.77" x2="78.74" y2="64.77" width="0.8128" layer="16"/>
<wire x1="78.74" y1="64.77" x2="77.47" y2="63.5" width="0.8128" layer="16"/>
<wire x1="77.47" y1="63.5" x2="73.66" y2="63.5" width="0.8128" layer="16"/>
<wire x1="73.66" y1="63.5" x2="71.12" y2="63.5" width="0.8128" layer="16"/>
<via x="71.12" y="63.5" extent="1-16" drill="1" shape="square"/>
<wire x1="72.39" y1="44.45" x2="74.93" y2="41.91" width="0.8128" layer="16"/>
<wire x1="74.93" y1="41.91" x2="81.28" y2="41.91" width="0.8128" layer="16"/>
<via x="81.28" y="41.91" extent="1-16" drill="1" shape="square"/>
<wire x1="48.26" y1="44.45" x2="48.26" y2="46.99" width="0.8128" layer="16"/>
<wire x1="48.26" y1="46.99" x2="59.055" y2="57.785" width="0.8128" layer="16"/>
<wire x1="59.055" y1="57.785" x2="59.055" y2="59.69" width="0.8128" layer="16"/>
<wire x1="50.8" y1="36.83" x2="50.8" y2="40.64" width="0.8128" layer="16"/>
<wire x1="50.8" y1="40.64" x2="48.26" y2="43.18" width="0.8128" layer="16"/>
<wire x1="48.26" y1="43.18" x2="48.26" y2="44.45" width="0.8128" layer="16"/>
<wire x1="53.34" y1="22.86" x2="57.15" y2="22.86" width="0.8128" layer="16"/>
<via x="57.15" y="22.86" extent="1-16" drill="1" shape="square"/>
<wire x1="77.47" y1="11.43" x2="77.47" y2="6.35" width="0.8128" layer="16"/>
<wire x1="88.9" y1="36.83" x2="92.075" y2="36.83" width="0.8128" layer="16"/>
<wire x1="88.9" y1="36.83" x2="88.9" y2="38.1" width="0.8128" layer="16"/>
<wire x1="88.9" y1="38.1" x2="90.805" y2="40.005" width="0.8128" layer="16"/>
<via x="90.805" y="40.005" extent="1-16" drill="1" shape="square"/>
<wire x1="90.805" y1="40.005" x2="90.805" y2="41.275" width="0.8128" layer="1"/>
<wire x1="90.805" y1="41.275" x2="90.17" y2="41.91" width="0.8128" layer="1"/>
<wire x1="90.17" y1="41.91" x2="81.28" y2="41.91" width="0.8128" layer="1"/>
<wire x1="55.7784" y1="10.2108" x2="55.7784" y2="4.9784" width="0.8128" layer="16"/>
<wire x1="55.7784" y1="4.9784" x2="53.34" y2="2.54" width="0.8128" layer="16"/>
<wire x1="53.34" y1="2.54" x2="50.8" y2="2.54" width="0.8128" layer="16"/>
<wire x1="43.2816" y1="10.2108" x2="38.1508" y2="10.2108" width="0.8128" layer="16"/>
<wire x1="38.1508" y1="10.2108" x2="38.1" y2="10.16" width="0.8128" layer="16"/>
<wire x1="55.7784" y1="10.2108" x2="58.3692" y2="10.2108" width="0.8128" layer="16"/>
<wire x1="58.3692" y1="10.2108" x2="59.69" y2="8.89" width="0.8128" layer="16"/>
<via x="38.1" y="10.16" extent="1-16" drill="1" shape="square"/>
<via x="59.69" y="8.89" extent="1-16" drill="1" shape="square"/>
<wire x1="17.78" y1="11.43" x2="22.86" y2="11.43" width="0.8128" layer="16"/>
<via x="22.86" y="11.43" extent="1-16" drill="1" shape="square"/>
<wire x1="6.35" y1="27.94" x2="4.445" y2="27.94" width="0.8128" layer="16"/>
<wire x1="4.445" y1="27.94" x2="3.175" y2="26.67" width="0.8128" layer="16"/>
<wire x1="3.175" y1="26.67" x2="3.175" y2="22.225" width="0.8128" layer="16"/>
<wire x1="3.175" y1="22.225" x2="6.35" y2="19.05" width="0.8128" layer="16"/>
<wire x1="6.35" y1="19.05" x2="8.89" y2="19.05" width="0.8128" layer="16"/>
<wire x1="8.89" y1="19.05" x2="10.16" y2="20.32" width="0.8128" layer="16"/>
<wire x1="10.16" y1="20.32" x2="13.97" y2="20.32" width="0.8128" layer="16"/>
<wire x1="13.97" y1="20.32" x2="15.24" y2="19.05" width="0.8128" layer="16"/>
<wire x1="15.24" y1="19.05" x2="15.24" y2="12.7" width="0.8128" layer="16"/>
<wire x1="15.24" y1="12.7" x2="16.51" y2="11.43" width="0.8128" layer="16"/>
<wire x1="16.51" y1="11.43" x2="17.78" y2="11.43" width="0.8128" layer="16"/>
</signal>
<signal name="V_BATT">
<contactref element="BATT1" pad="1"/>
<contactref element="BATT2" pad="1"/>
<contactref element="SW1P" pad="1"/>
<contactref element="R1BATT" pad="2"/>
<wire x1="76.2" y1="57.15" x2="73.66" y2="54.61" width="0.8128" layer="1"/>
<wire x1="73.66" y1="54.61" x2="73.66" y2="50.165" width="0.8128" layer="1"/>
<wire x1="73.66" y1="50.165" x2="71.755" y2="48.26" width="0.8128" layer="1"/>
<wire x1="71.755" y1="48.26" x2="67.945" y2="48.26" width="0.8128" layer="1"/>
<wire x1="67.945" y1="48.26" x2="67.31" y2="48.895" width="0.8128" layer="1"/>
<wire x1="67.31" y1="48.895" x2="62.865" y2="48.895" width="0.8128" layer="1"/>
<wire x1="76.2" y1="57.15" x2="87.63" y2="57.15" width="0.8128" layer="1"/>
<wire x1="87.63" y1="57.15" x2="88.9" y2="58.42" width="0.8128" layer="1"/>
<via x="88.9" y="58.42" extent="1-16" drill="1" shape="square"/>
<wire x1="88.9" y1="58.42" x2="88.9" y2="59.69" width="0.8128" layer="16"/>
<wire x1="88.9" y1="59.69" x2="90.17" y2="60.96" width="0.8128" layer="16"/>
<wire x1="90.17" y1="60.96" x2="93.155" y2="60.96" width="0.8128" layer="16"/>
<wire x1="93.155" y1="60.96" x2="94.52" y2="62.325" width="0.8128" layer="16"/>
<wire x1="15.24" y1="80.43" x2="38.1" y2="80.43" width="1.27" layer="16"/>
<wire x1="45.72" y1="56.515" x2="45.72" y2="72.81" width="1.27" layer="16"/>
<wire x1="45.72" y1="72.81" x2="38.1" y2="80.43" width="1.27" layer="16"/>
<wire x1="62.865" y1="48.895" x2="60.96" y2="50.8" width="0.8128" layer="1"/>
<wire x1="60.96" y1="50.8" x2="51.435" y2="50.8" width="0.8128" layer="1"/>
<wire x1="51.435" y1="50.8" x2="45.72" y2="56.515" width="0.8128" layer="1"/>
</signal>
<signal name="5V">
<contactref element="J3" pad="VBUS"/>
<contactref element="J2" pad="VBUS"/>
<contactref element="C1P" pad="1"/>
<contactref element="VR1" pad="IN"/>
<contactref element="R1P" pad="2"/>
<contactref element="D1P" pad="C"/>
<wire x1="69.85" y1="60.96" x2="71.12" y2="60.96" width="0.8128" layer="16"/>
<wire x1="71.12" y1="60.96" x2="73.66" y2="58.42" width="0.8128" layer="16"/>
<wire x1="73.66" y1="58.42" x2="77.47" y2="54.61" width="0.8128" layer="16"/>
<wire x1="84.485" y1="77.92" x2="84.485" y2="78.77" width="0.4064" layer="1"/>
<wire x1="64.135" y1="50.8" x2="66.04" y2="50.8" width="0.8128" layer="1"/>
<wire x1="66.04" y1="50.8" x2="69.85" y2="54.61" width="0.8128" layer="1"/>
<wire x1="69.85" y1="54.61" x2="69.85" y2="60.96" width="0.8128" layer="1"/>
<wire x1="64.135" y1="50.8" x2="62.865" y2="52.07" width="0.8128" layer="1"/>
<wire x1="62.865" y1="52.07" x2="62.865" y2="60.96" width="0.8128" layer="1"/>
<wire x1="62.865" y1="60.96" x2="60.325" y2="63.5" width="0.8128" layer="1"/>
<wire x1="60.325" y1="63.5" x2="60.325" y2="69.85" width="0.8128" layer="1"/>
<wire x1="60.325" y1="69.85" x2="62.23" y2="71.755" width="0.8128" layer="1"/>
<wire x1="62.23" y1="71.755" x2="71.12" y2="71.755" width="0.8128" layer="1"/>
<wire x1="71.12" y1="71.755" x2="71.755" y2="71.755" width="0.4064" layer="1"/>
<wire x1="71.755" y1="71.755" x2="72.39" y2="72.39" width="0.4064" layer="1"/>
<wire x1="72.39" y1="72.39" x2="72.39" y2="74.03" width="0.4064" layer="1"/>
<wire x1="72.39" y1="74.03" x2="72.085" y2="74.335" width="0.4064" layer="1"/>
<wire x1="84.485" y1="78.77" x2="84.425" y2="78.77" width="0.4064" layer="1"/>
<wire x1="84.425" y1="78.77" x2="83.82" y2="79.375" width="0.4064" layer="1"/>
<wire x1="83.82" y1="79.375" x2="80.645" y2="79.375" width="0.4064" layer="1"/>
<wire x1="78.105" y1="76.835" x2="74.93" y2="76.835" width="0.8128" layer="1"/>
<wire x1="74.93" y1="76.835" x2="74.295" y2="76.835" width="0.4064" layer="1"/>
<wire x1="74.295" y1="76.835" x2="72.39" y2="74.93" width="0.4064" layer="1"/>
<wire x1="72.39" y1="74.93" x2="72.39" y2="74.64" width="0.4064" layer="1"/>
<wire x1="72.39" y1="74.64" x2="72.085" y2="74.335" width="0.4064" layer="1"/>
<wire x1="77.47" y1="54.61" x2="81.28" y2="54.61" width="0.8128" layer="16"/>
<wire x1="81.28" y1="54.61" x2="84.455" y2="57.785" width="0.8128" layer="16"/>
<wire x1="84.455" y1="57.785" x2="84.455" y2="59.055" width="0.8128" layer="16"/>
<wire x1="80.645" y1="79.375" x2="79.375" y2="78.105" width="0.4064" layer="1"/>
<wire x1="79.375" y1="78.105" x2="78.105" y2="76.835" width="0.8128" layer="1"/>
</signal>
<signal name="VCC">
<contactref element="J4" pad="2"/>
<contactref element="SW1P" pad="2"/>
<contactref element="C3P" pad="+"/>
<contactref element="C1N" pad="2"/>
<contactref element="UC" pad="7"/>
<contactref element="UC" pad="20"/>
<contactref element="R1UR" pad="2"/>
<contactref element="J5" pad="VCC"/>
<contactref element="C1U" pad="1"/>
<contactref element="R2IL1" pad="2"/>
<contactref element="R2IL2" pad="2"/>
<contactref element="R2IL3" pad="2"/>
<contactref element="R2IL4" pad="2"/>
<contactref element="C1IL1" pad="1"/>
<contactref element="C1IL2" pad="1"/>
<contactref element="C1IL4" pad="1"/>
<contactref element="C1IL3" pad="1"/>
<contactref element="C4P" pad="+"/>
<contactref element="R1B1" pad="1"/>
<contactref element="D1B1" pad="C"/>
<polygon width="0" layer="16" isolate="0.8128">
<vertex x="-5.08" y="87.63"/>
<vertex x="100.33" y="87.63"/>
<vertex x="100.33" y="-2.54"/>
<vertex x="-5.08" y="-2.54"/>
</polygon>
<wire x1="92.075" y1="34.29" x2="92.075" y2="20.955" width="0.8128" layer="1"/>
<wire x1="92.075" y1="20.955" x2="95.25" y2="17.78" width="0.8128" layer="1"/>
<wire x1="6.985" y1="41.91" x2="5.08" y2="41.91" width="0.8128" layer="16"/>
<wire x1="5.08" y1="41.91" x2="3.81" y2="43.18" width="0.8128" layer="16"/>
<wire x1="3.81" y1="43.18" x2="3.81" y2="49.53" width="0.8128" layer="16"/>
<wire x1="3.81" y1="49.53" x2="5.08" y2="50.8" width="0.8128" layer="16"/>
<wire x1="5.08" y1="50.8" x2="10.795" y2="50.8" width="0.8128" layer="16"/>
<wire x1="10.795" y1="50.8" x2="12.065" y2="52.07" width="0.8128" layer="16"/>
<wire x1="12.065" y1="52.07" x2="12.065" y2="54.61" width="0.8128" layer="16"/>
<wire x1="53.975" y1="74.295" x2="53.975" y2="59.69" width="0.8128" layer="16"/>
<wire x1="94.965" y1="64.135" x2="94.52" y2="64.325" width="0.8128" layer="16"/>
<wire x1="83.185" y1="62.865" x2="80.01" y2="59.69" width="0.8128" layer="16"/>
<wire x1="83.185" y1="62.865" x2="90.17" y2="62.865" width="0.8128" layer="16"/>
<wire x1="90.17" y1="62.865" x2="91.44" y2="64.135" width="0.8128" layer="16"/>
<wire x1="91.44" y1="64.135" x2="94.965" y2="64.135" width="0.8128" layer="16"/>
</signal>
<signal name="3.3V">
<contactref element="SW1P" pad="3"/>
<contactref element="VR1" pad="OUT"/>
<contactref element="D1P" pad="A"/>
<contactref element="C2P" pad="1"/>
<wire x1="77.47" y1="44.45" x2="77.47" y2="49.53" width="0.8128" layer="16"/>
<wire x1="77.47" y1="49.53" x2="71.12" y2="49.53" width="0.8128" layer="16"/>
<wire x1="71.12" y1="49.53" x2="69.85" y2="50.8" width="0.8128" layer="16"/>
<wire x1="77.47" y1="49.53" x2="80.01" y2="49.53" width="0.8128" layer="16"/>
<wire x1="80.01" y1="49.53" x2="86.36" y2="55.88" width="0.8128" layer="16"/>
<wire x1="78.74" y1="57.15" x2="77.47" y2="58.42" width="0.8128" layer="16"/>
<wire x1="77.47" y1="58.42" x2="77.47" y2="60.96" width="0.8128" layer="16"/>
<wire x1="77.47" y1="60.96" x2="78.74" y2="62.23" width="0.8128" layer="16"/>
<wire x1="78.74" y1="62.23" x2="80.01" y2="62.23" width="0.8128" layer="16"/>
<wire x1="94.87" y1="66.04" x2="94.52" y2="66.325" width="0.8128" layer="16"/>
<wire x1="86.36" y1="55.88" x2="86.36" y2="59.69" width="0.8128" layer="16"/>
<wire x1="86.36" y1="59.69" x2="85.09" y2="60.96" width="0.8128" layer="16"/>
<wire x1="85.09" y1="60.96" x2="83.82" y2="60.96" width="0.8128" layer="16"/>
<wire x1="83.82" y1="60.96" x2="80.01" y2="57.15" width="0.8128" layer="16"/>
<wire x1="80.01" y1="57.15" x2="78.74" y2="57.15" width="0.8128" layer="16"/>
<wire x1="94.87" y1="66.04" x2="89.535" y2="66.04" width="0.8128" layer="16"/>
<wire x1="89.535" y1="66.04" x2="88.265" y2="64.77" width="0.8128" layer="16"/>
<wire x1="88.265" y1="64.77" x2="82.55" y2="64.77" width="0.8128" layer="16"/>
<wire x1="82.55" y1="64.77" x2="80.01" y2="62.23" width="0.8128" layer="16"/>
</signal>
<signal name="N$2">
<contactref element="L1P" pad="A"/>
<contactref element="R1P" pad="1"/>
<wire x1="91.44" y1="71.12" x2="86.995" y2="66.675" width="0.8128" layer="16"/>
<wire x1="86.995" y1="66.675" x2="84.455" y2="66.675" width="0.8128" layer="16"/>
<wire x1="91.44" y1="71.12" x2="94.615" y2="71.12" width="0.8128" layer="16"/>
</signal>
<signal name="XTAL1">
<contactref element="UC" pad="9"/>
<contactref element="C1X" pad="1"/>
<contactref element="XTAL" pad="1"/>
<wire x1="53.34" y1="36.83" x2="53.34" y2="33.528" width="0.8128" layer="16"/>
<wire x1="53.34" y1="33.528" x2="52.197" y2="32.385" width="0.8128" layer="16"/>
<wire x1="50.8" y1="27.94" x2="50.8" y2="30.988" width="0.8128" layer="16"/>
<wire x1="50.8" y1="30.988" x2="52.197" y2="32.385" width="0.8128" layer="16"/>
</signal>
<signal name="XTAL2">
<contactref element="UC" pad="10"/>
<contactref element="XTAL" pad="2"/>
<contactref element="C2X" pad="1"/>
<wire x1="55.88" y1="36.83" x2="55.88" y2="33.528" width="0.8128" layer="16"/>
<wire x1="55.88" y1="33.528" x2="57.023" y2="32.385" width="0.8128" layer="16"/>
<wire x1="57.023" y1="32.385" x2="57.023" y2="30.607" width="0.8128" layer="16"/>
<wire x1="57.023" y1="30.607" x2="58.42" y2="29.21" width="0.8128" layer="16"/>
<wire x1="58.42" y1="29.21" x2="58.42" y2="27.94" width="0.8128" layer="16"/>
</signal>
<signal name="RESET">
<contactref element="R1UR" pad="1"/>
<contactref element="UC" pad="1"/>
<contactref element="S1UR" pad="2"/>
<contactref element="S1UR" pad="1"/>
<contactref element="C1UR" pad="2"/>
<wire x1="23.7744" y1="37.3888" x2="23.7744" y2="39.37" width="0.8128" layer="16"/>
<wire x1="23.7744" y1="39.37" x2="23.7744" y2="43.8912" width="0.8128" layer="16"/>
<wire x1="19.05" y1="37.465" x2="23.6982" y2="37.465" width="0.8128" layer="16"/>
<wire x1="23.6982" y1="37.465" x2="23.7744" y2="37.3888" width="0.8128" layer="16"/>
<wire x1="33.02" y1="36.83" x2="33.02" y2="38.1" width="0.8128" layer="16"/>
<wire x1="33.02" y1="38.1" x2="31.75" y2="39.37" width="0.8128" layer="16"/>
<wire x1="31.75" y1="39.37" x2="23.7744" y2="39.37" width="0.8128" layer="16"/>
<wire x1="19.05" y1="37.465" x2="19.05" y2="39.37" width="0.8128" layer="16"/>
</signal>
<signal name="URX">
<contactref element="UC" pad="2"/>
<contactref element="J5" pad="TXO"/>
<wire x1="6.985" y1="39.37" x2="10.16" y2="39.37" width="0.8128" layer="16"/>
<wire x1="10.16" y1="39.37" x2="11.43" y2="40.64" width="0.8128" layer="16"/>
<wire x1="11.43" y1="40.64" x2="16.51" y2="40.64" width="0.8128" layer="16"/>
<wire x1="16.51" y1="40.64" x2="22.86" y2="46.99" width="0.8128" layer="16"/>
<wire x1="22.86" y1="46.99" x2="29.21" y2="46.99" width="0.8128" layer="16"/>
<wire x1="29.21" y1="46.99" x2="30.48" y2="45.72" width="0.8128" layer="16"/>
<wire x1="30.48" y1="45.72" x2="30.48" y2="43.18" width="0.8128" layer="16"/>
<wire x1="30.48" y1="43.18" x2="35.56" y2="38.1" width="0.8128" layer="16"/>
<wire x1="35.56" y1="38.1" x2="35.56" y2="36.83" width="0.8128" layer="16"/>
</signal>
<signal name="UTX">
<contactref element="UC" pad="3"/>
<contactref element="J5" pad="RXI"/>
<wire x1="6.985" y1="36.83" x2="5.08" y2="36.83" width="0.8128" layer="16"/>
<wire x1="5.08" y1="36.83" x2="3.81" y2="35.56" width="0.8128" layer="16"/>
<wire x1="3.81" y1="35.56" x2="3.81" y2="33.02" width="0.8128" layer="16"/>
<wire x1="38.1" y1="36.195" x2="38.1" y2="36.83" width="0.8128" layer="16"/>
<wire x1="3.81" y1="33.02" x2="5.08" y2="31.75" width="0.8128" layer="16"/>
<wire x1="5.08" y1="31.75" x2="8.89" y2="31.75" width="0.8128" layer="16"/>
<wire x1="8.89" y1="31.75" x2="12.065" y2="34.925" width="0.8128" layer="16"/>
<wire x1="12.065" y1="34.925" x2="29.845" y2="34.925" width="0.8128" layer="16"/>
<wire x1="29.845" y1="34.925" x2="31.115" y2="33.655" width="0.8128" layer="16"/>
<wire x1="31.115" y1="33.655" x2="36.83" y2="33.655" width="0.8128" layer="16"/>
<wire x1="36.83" y1="33.655" x2="38.1" y2="34.925" width="0.8128" layer="16"/>
<wire x1="38.1" y1="34.925" x2="38.1" y2="36.83" width="0.8128" layer="16"/>
</signal>
<signal name="MOSI">
<contactref element="UC" pad="17"/>
<contactref element="J4" pad="6"/>
<wire x1="62.23" y1="41.91" x2="60.96" y2="43.18" width="0.8128" layer="16"/>
<wire x1="60.96" y1="43.18" x2="60.96" y2="44.45" width="0.8128" layer="16"/>
<wire x1="83.82" y1="34.29" x2="83.82" y2="32.385" width="0.8128" layer="16"/>
<wire x1="83.82" y1="32.385" x2="82.55" y2="31.115" width="0.8128" layer="16"/>
<wire x1="73.025" y1="34.925" x2="66.04" y2="41.91" width="0.8128" layer="16"/>
<wire x1="66.04" y1="41.91" x2="62.23" y2="41.91" width="0.8128" layer="16"/>
<wire x1="82.55" y1="31.115" x2="79.375" y2="31.115" width="0.8128" layer="16"/>
<wire x1="79.375" y1="31.115" x2="75.565" y2="34.925" width="0.8128" layer="16"/>
<wire x1="75.565" y1="34.925" x2="73.025" y2="34.925" width="0.8128" layer="16"/>
</signal>
<signal name="SCK">
<contactref element="UC" pad="19"/>
<contactref element="J4" pad="5"/>
<wire x1="55.88" y1="44.45" x2="55.88" y2="48.26" width="0.8128" layer="16"/>
<wire x1="55.88" y1="48.26" x2="58.42" y2="50.8" width="0.8128" layer="16"/>
<wire x1="58.42" y1="50.8" x2="66.04" y2="50.8" width="0.8128" layer="16"/>
<wire x1="66.04" y1="50.8" x2="70.485" y2="46.355" width="0.8128" layer="16"/>
<wire x1="70.485" y1="46.355" x2="70.485" y2="43.18" width="0.8128" layer="16"/>
<wire x1="70.485" y1="43.18" x2="74.295" y2="39.37" width="0.8128" layer="16"/>
<wire x1="74.295" y1="39.37" x2="82.55" y2="39.37" width="0.8128" layer="16"/>
<wire x1="82.55" y1="39.37" x2="83.82" y2="38.1" width="0.8128" layer="16"/>
<wire x1="83.82" y1="38.1" x2="83.82" y2="36.83" width="0.8128" layer="16"/>
</signal>
<signal name="MISO">
<contactref element="UC" pad="18"/>
<contactref element="J4" pad="7"/>
<wire x1="58.42" y1="44.45" x2="58.42" y2="47.625" width="0.8128" layer="16"/>
<wire x1="58.42" y1="47.625" x2="59.69" y2="48.895" width="0.8128" layer="16"/>
<wire x1="59.69" y1="48.895" x2="65.405" y2="48.895" width="0.8128" layer="16"/>
<wire x1="65.405" y1="48.895" x2="68.58" y2="45.72" width="0.8128" layer="16"/>
<wire x1="68.58" y1="45.72" x2="68.58" y2="41.91" width="0.8128" layer="16"/>
<wire x1="68.58" y1="41.91" x2="73.66" y2="36.83" width="0.8128" layer="16"/>
<wire x1="73.66" y1="36.83" x2="81.28" y2="36.83" width="0.8128" layer="16"/>
</signal>
<signal name="CE">
<contactref element="UC" pad="13"/>
<contactref element="J4" pad="3"/>
<wire x1="95.25" y1="33.02" x2="93.98" y2="31.75" width="0.8128" layer="16"/>
<wire x1="93.98" y1="31.75" x2="88.9" y2="31.75" width="0.8128" layer="16"/>
<wire x1="88.9" y1="31.75" x2="84.455" y2="27.305" width="0.8128" layer="16"/>
<wire x1="84.455" y1="27.305" x2="78.105" y2="27.305" width="0.8128" layer="16"/>
<wire x1="78.105" y1="27.305" x2="74.295" y2="31.115" width="0.8128" layer="16"/>
<wire x1="74.295" y1="31.115" x2="71.755" y2="31.115" width="0.8128" layer="16"/>
<wire x1="71.755" y1="31.115" x2="67.945" y2="34.925" width="0.8128" layer="16"/>
<wire x1="67.945" y1="34.925" x2="64.135" y2="34.925" width="0.8128" layer="16"/>
<wire x1="64.135" y1="34.925" x2="63.5" y2="35.56" width="0.8128" layer="16"/>
<wire x1="63.5" y1="35.56" x2="63.5" y2="36.83" width="0.8128" layer="16"/>
<wire x1="86.36" y1="36.83" x2="86.36" y2="41.275" width="0.8128" layer="16"/>
<wire x1="86.36" y1="41.275" x2="87.63" y2="42.545" width="0.8128" layer="16"/>
<wire x1="87.63" y1="42.545" x2="93.98" y2="42.545" width="0.8128" layer="16"/>
<wire x1="93.98" y1="42.545" x2="95.25" y2="41.275" width="0.8128" layer="16"/>
<wire x1="95.25" y1="41.275" x2="95.25" y2="33.02" width="0.8128" layer="16"/>
</signal>
<signal name="2">
<contactref element="UC" pad="4"/>
<contactref element="D1B1" pad="A"/>
<contactref element="D2B1" pad="C"/>
<contactref element="R2B1" pad="2"/>
<contactref element="C1B1" pad="1"/>
<wire x1="40.64" y1="36.83" x2="40.64" y2="33.02" width="0.8128" layer="16"/>
<wire x1="40.64" y1="33.02" x2="43.18" y2="30.48" width="0.8128" layer="16"/>
<wire x1="17.59" y1="29.21" x2="17.78" y2="29.4" width="0.8128" layer="16"/>
<wire x1="6.35" y1="22.86" x2="6.35" y2="24.13" width="0.8128" layer="16"/>
<wire x1="6.35" y1="24.13" x2="10.16" y2="27.94" width="0.8128" layer="16"/>
<wire x1="10.16" y1="27.94" x2="16.32" y2="27.94" width="0.8128" layer="16"/>
<wire x1="16.32" y1="27.94" x2="17.78" y2="29.4" width="0.8128" layer="16"/>
<wire x1="28.575" y1="23.94" x2="26.225" y2="23.94" width="0.8128" layer="16"/>
<wire x1="26.225" y1="23.94" x2="22.225" y2="27.94" width="0.8128" layer="16"/>
<wire x1="22.225" y1="27.94" x2="19.24" y2="27.94" width="0.8128" layer="16"/>
<wire x1="19.24" y1="27.94" x2="17.78" y2="29.4" width="0.8128" layer="16"/>
<wire x1="28.575" y1="23.94" x2="29.4" y2="23.94" width="0.8128" layer="16"/>
<wire x1="29.4" y1="23.94" x2="30.48" y2="22.86" width="0.8128" layer="16"/>
<wire x1="30.48" y1="22.86" x2="35.56" y2="22.86" width="0.8128" layer="16"/>
<wire x1="35.56" y1="22.86" x2="43.18" y2="30.48" width="0.8128" layer="16"/>
</signal>
<signal name="3">
<contactref element="UC" pad="5"/>
<contactref element="R1IL1" pad="1"/>
<wire x1="43.18" y1="36.83" x2="43.18" y2="34.29" width="0.8128" layer="16"/>
<wire x1="43.18" y1="34.29" x2="45.72" y2="31.75" width="0.8128" layer="16"/>
<wire x1="45.72" y1="31.75" x2="45.72" y2="29.845" width="0.8128" layer="16"/>
<wire x1="21.59" y1="25.4" x2="11.43" y2="25.4" width="0.8128" layer="16"/>
<wire x1="21.59" y1="25.4" x2="26.67" y2="20.32" width="0.8128" layer="16"/>
<wire x1="26.67" y1="20.32" x2="36.195" y2="20.32" width="0.8128" layer="16"/>
<wire x1="36.195" y1="20.32" x2="45.72" y2="29.845" width="0.8128" layer="16"/>
</signal>
<signal name="4">
<contactref element="UC" pad="6"/>
</signal>
<signal name="5">
<contactref element="UC" pad="11"/>
<contactref element="R1LS" pad="2"/>
<wire x1="63.5" y1="26.67" x2="63.5" y2="29.845" width="0.8128" layer="16"/>
<wire x1="63.5" y1="29.845" x2="58.42" y2="34.925" width="0.8128" layer="16"/>
<wire x1="58.42" y1="34.925" x2="58.42" y2="36.83" width="0.8128" layer="16"/>
</signal>
<signal name="6">
<contactref element="UC" pad="12"/>
<contactref element="R1IL2" pad="1"/>
<wire x1="85.09" y1="19.05" x2="86.36" y2="17.78" width="0.8128" layer="16"/>
<wire x1="60.96" y1="36.83" x2="60.96" y2="35.56" width="0.8128" layer="16"/>
<wire x1="60.96" y1="35.56" x2="77.47" y2="19.05" width="0.8128" layer="16"/>
<wire x1="77.47" y1="19.05" x2="85.09" y2="19.05" width="0.8128" layer="16"/>
</signal>
<signal name="9">
<contactref element="UC" pad="15"/>
<contactref element="R1IL3" pad="1"/>
<wire x1="64.77" y1="46.99" x2="66.04" y2="45.72" width="0.8128" layer="16"/>
<wire x1="66.04" y1="45.72" x2="66.04" y2="44.45" width="0.8128" layer="16"/>
</signal>
<signal name="10">
<contactref element="UC" pad="16"/>
<contactref element="R1IL4" pad="1"/>
<wire x1="63.5" y1="44.45" x2="63.5" y2="45.085" width="0.8128" layer="16"/>
<wire x1="63.5" y1="45.085" x2="61.595" y2="46.99" width="0.8128" layer="16"/>
<via x="61.595" y="46.99" extent="1-16" drill="1" shape="square"/>
<wire x1="30.48" y1="48.895" x2="30.48" y2="50.8" width="0.8128" layer="1"/>
<wire x1="30.48" y1="50.8" x2="31.75" y2="52.07" width="0.8128" layer="1"/>
<wire x1="31.75" y1="52.07" x2="46.99" y2="52.07" width="0.8128" layer="1"/>
<wire x1="46.99" y1="52.07" x2="50.8" y2="48.26" width="0.8128" layer="1"/>
<wire x1="50.8" y1="48.26" x2="60.325" y2="48.26" width="0.8128" layer="1"/>
<wire x1="60.325" y1="48.26" x2="61.595" y2="46.99" width="0.8128" layer="1"/>
</signal>
<signal name="A0">
<contactref element="UC" pad="23"/>
<contactref element="R2BATT" pad="2"/>
<contactref element="R1BATT" pad="1"/>
<wire x1="38.1" y1="48.895" x2="45.72" y2="48.895" width="1.27" layer="16"/>
<wire x1="45.72" y1="44.45" x2="45.72" y2="48.895" width="1.27" layer="16"/>
</signal>
<signal name="A1">
<contactref element="UC" pad="24"/>
</signal>
<signal name="A2">
<contactref element="UC" pad="25"/>
</signal>
<signal name="A4">
<contactref element="UC" pad="27"/>
</signal>
<signal name="A5">
<contactref element="UC" pad="28"/>
</signal>
<signal name="A3">
<contactref element="UC" pad="26"/>
</signal>
<signal name="CSN">
<contactref element="UC" pad="14"/>
<contactref element="J4" pad="4"/>
<wire x1="86.36" y1="34.29" x2="86.36" y2="31.75" width="0.8128" layer="16"/>
<wire x1="86.36" y1="31.75" x2="83.82" y2="29.21" width="0.8128" layer="16"/>
<wire x1="83.82" y1="29.21" x2="78.74" y2="29.21" width="0.8128" layer="16"/>
<wire x1="78.74" y1="29.21" x2="74.93" y2="33.02" width="0.8128" layer="16"/>
<wire x1="74.93" y1="33.02" x2="72.39" y2="33.02" width="0.8128" layer="16"/>
<wire x1="72.39" y1="33.02" x2="68.58" y2="36.83" width="0.8128" layer="16"/>
<wire x1="68.58" y1="36.83" x2="66.04" y2="36.83" width="0.8128" layer="16"/>
</signal>
<signal name="AREF">
<contactref element="UC" pad="21"/>
</signal>
<signal name="N$7">
<contactref element="J5" pad="DTR"/>
<contactref element="C1UR" pad="1"/>
<wire x1="6.985" y1="34.29" x2="8.89" y2="34.29" width="0.8128" layer="16"/>
<wire x1="8.89" y1="34.29" x2="12.065" y2="37.465" width="0.8128" layer="16"/>
<wire x1="12.065" y1="37.465" x2="13.97" y2="37.465" width="0.8128" layer="16"/>
</signal>
<signal name="N$1">
<contactref element="L1S" pad="A"/>
<contactref element="R1LS" pad="1"/>
<wire x1="48.26" y1="2.54" x2="48.26" y2="5.08" width="0.8128" layer="16"/>
<wire x1="48.26" y1="5.08" x2="46.99" y2="6.35" width="0.8128" layer="16"/>
<wire x1="46.99" y1="6.35" x2="46.99" y2="11.43" width="0.8128" layer="16"/>
<wire x1="46.99" y1="11.43" x2="48.26" y2="12.7" width="0.8128" layer="16"/>
<wire x1="48.26" y1="12.7" x2="62.23" y2="12.7" width="0.8128" layer="16"/>
<wire x1="62.23" y1="12.7" x2="63.5" y2="13.97" width="0.8128" layer="16"/>
<wire x1="63.5" y1="13.97" x2="63.5" y2="19.05" width="0.8128" layer="16"/>
</signal>
<signal name="N$4">
<contactref element="Q1IL1" pad="3"/>
<contactref element="IL1" pad="K"/>
<wire x1="4.894009375" y1="5.1570375" x2="8.8129625" y2="5.1570375" width="0.8128" layer="16"/>
<wire x1="8.8129625" y1="5.1570375" x2="10.16" y2="3.81" width="0.8128" layer="16"/>
</signal>
<signal name="N$5">
<contactref element="IL1" pad="A"/>
<contactref element="R2IL1" pad="1"/>
<wire x1="2.54" y1="11.43" x2="2.54" y2="3.918940625" width="0.8128" layer="16"/>
<wire x1="2.54" y1="3.918940625" x2="3.09795625" y2="3.360984375" width="0.8128" layer="16"/>
</signal>
<signal name="N$6">
<contactref element="R1IL1" pad="2"/>
<contactref element="Q1IL1" pad="2"/>
<wire x1="11.43" y1="5.715" x2="11.43" y2="17.78" width="0.8128" layer="16"/>
</signal>
<signal name="N$8">
<contactref element="Q1IL2" pad="3"/>
<contactref element="IL2" pad="K"/>
<wire x1="92.895984375" y1="5.1570375" x2="88.9770375" y2="5.1570375" width="0.8128" layer="16"/>
<wire x1="88.9770375" y1="5.1570375" x2="87.63" y2="3.81" width="0.8128" layer="16"/>
</signal>
<signal name="N$9">
<contactref element="IL2" pad="A"/>
<contactref element="R2IL2" pad="1"/>
<wire x1="95.25" y1="10.16" x2="95.25" y2="3.918946875" width="0.8128" layer="16"/>
<wire x1="95.25" y1="3.918946875" x2="94.6920375" y2="3.360984375" width="0.8128" layer="16"/>
</signal>
<signal name="N$10">
<contactref element="R1IL2" pad="2"/>
<contactref element="Q1IL2" pad="2"/>
<wire x1="86.36" y1="1.905" x2="84.455" y2="1.905" width="0.8128" layer="16"/>
<wire x1="84.455" y1="1.905" x2="82.55" y2="3.81" width="0.8128" layer="16"/>
<wire x1="82.55" y1="3.81" x2="82.55" y2="8.255" width="0.8128" layer="16"/>
<wire x1="82.55" y1="8.255" x2="84.455" y2="10.16" width="0.8128" layer="16"/>
<wire x1="84.455" y1="10.16" x2="86.36" y2="10.16" width="0.8128" layer="16"/>
</signal>
<signal name="N$11">
<contactref element="Q1IL3" pad="3"/>
<contactref element="IL3" pad="K"/>
<wire x1="92.895984375" y1="77.76493125" x2="91.09993125" y2="77.76493125" width="0.8128" layer="16"/>
<wire x1="91.09993125" y1="77.76493125" x2="85.725" y2="72.39" width="0.8128" layer="16"/>
</signal>
<signal name="N$12">
<contactref element="IL3" pad="A"/>
<contactref element="R2IL3" pad="1"/>
<wire x1="71.755" y1="66.675" x2="80.645" y2="66.675" width="0.8128" layer="16"/>
<wire x1="80.645" y1="66.675" x2="82.55" y2="68.58" width="0.8128" layer="16"/>
<wire x1="94.6920375" y1="79.560984375" x2="94.6920375" y2="79.2979625" width="0.8128" layer="16"/>
<wire x1="94.6920375" y1="79.2979625" x2="95.25" y2="78.74" width="0.8128" layer="16"/>
<wire x1="95.25" y1="78.74" x2="95.25" y2="76.835" width="0.8128" layer="16"/>
<wire x1="95.25" y1="76.835" x2="93.98" y2="75.565" width="0.8128" layer="16"/>
<wire x1="93.98" y1="75.565" x2="92.075" y2="75.565" width="0.8128" layer="16"/>
<wire x1="92.075" y1="75.565" x2="85.09" y2="68.58" width="0.8128" layer="16"/>
<wire x1="85.09" y1="68.58" x2="82.55" y2="68.58" width="0.8128" layer="16"/>
</signal>
<signal name="N$13">
<contactref element="R1IL3" pad="2"/>
<contactref element="Q1IL3" pad="2"/>
<wire x1="63.5" y1="69.85" x2="62.23" y2="68.58" width="0.8128" layer="1"/>
<wire x1="62.23" y1="68.58" x2="62.23" y2="64.77" width="0.8128" layer="1"/>
<wire x1="62.23" y1="64.77" x2="64.77" y2="62.23" width="0.8128" layer="1"/>
<wire x1="64.77" y1="62.23" x2="64.77" y2="54.61" width="0.8128" layer="1"/>
<wire x1="63.5" y1="69.85" x2="83.82" y2="69.85" width="0.8128" layer="1"/>
<wire x1="83.82" y1="69.85" x2="84.455" y2="70.485" width="0.8128" layer="1"/>
</signal>
<signal name="N$14">
<contactref element="Q1IL4" pad="3"/>
<contactref element="IL4" pad="K"/>
<wire x1="22.225" y1="53.975" x2="22.225" y2="60.324996875" width="1.27" layer="16"/>
<wire x1="4.708025" y1="77.841971875" x2="4.708025" y2="68.951975" width="0.8128" layer="16"/>
<wire x1="4.708025" y1="68.951975" x2="8.89" y2="64.77" width="0.8128" layer="16"/>
<wire x1="8.89" y1="64.77" x2="17.779996875" y2="64.77" width="0.8128" layer="16"/>
<wire x1="17.779996875" y1="64.77" x2="22.225" y2="60.324996875" width="0.8128" layer="16"/>
</signal>
<signal name="N$15">
<contactref element="IL4" pad="A"/>
<contactref element="R2IL4" pad="1"/>
<wire x1="2.54" y1="63.5" x2="2.54" y2="79.266053125" width="0.8128" layer="16"/>
<wire x1="2.54" y1="79.266053125" x2="2.911971875" y2="79.638025" width="0.8128" layer="16"/>
</signal>
<signal name="N$16">
<contactref element="R1IL4" pad="2"/>
<contactref element="Q1IL4" pad="2"/>
<wire x1="30.48" y1="56.515" x2="27.94" y2="56.515" width="1.27" layer="16"/>
<wire x1="27.94" y1="56.515" x2="24.13" y2="52.705" width="1.27" layer="16"/>
</signal>
<signal name="N$17">
<contactref element="R1B1" pad="2"/>
<contactref element="B1" pad="2"/>
<contactref element="B1" pad="1"/>
<contactref element="R2B1" pad="1"/>
<wire x1="55.7784" y1="15.1892" x2="43.2816" y2="15.1892" width="0.8128" layer="16"/>
<wire x1="36.83" y1="15.24" x2="43.2308" y2="15.24" width="0.8128" layer="16"/>
<wire x1="43.2308" y1="15.24" x2="43.2816" y2="15.1892" width="0.8128" layer="16"/>
<wire x1="43.18" y1="22.86" x2="43.18" y2="15.2908" width="0.8128" layer="16"/>
<wire x1="43.18" y1="15.2908" x2="43.2816" y2="15.1892" width="0.8128" layer="16"/>
</signal>
<signal name="N$3">
</signal>
<signal name="N$18">
<via x="77.47" y="6.35" extent="1-16" drill="1" shape="square"/>
</signal>
</signals>
<errors>
<approved hash="4,1,1e503d123fd10b74"/>
<approved hash="4,1,7efea77fa3889f45"/>
<approved hash="4,1,e7f66f33667635e9"/>
<approved hash="4,1,a24af5701e422ef8"/>
<approved hash="4,1,b646f01e7172581b"/>
<approved hash="4,1,36d67e8271a52e16"/>
<approved hash="4,1,9f7d49ac4d99a852"/>
<approved hash="4,1,edd7a5ddb31476b2"/>
<approved hash="4,1,e4ee98aef8030c6d"/>
<approved hash="3,1,b8b920775edcc612"/>
<approved hash="3,16,e25f2a9154079cc9"/>
<approved hash="3,1,da48e7989bd9a609"/>
<approved hash="3,16,06072bdb571a7ac6"/>
<approved hash="3,16,2938a6c22634a9ce"/>
<approved hash="3,16,25d0a5615af9da48"/>
<approved hash="3,16,7fd1f1c1995a174a"/>
<approved hash="3,16,4fc6cef48e2f0f1d"/>
<approved hash="3,16,fad246f9baad0686"/>
<approved hash="3,1,b1f7e1521ec54e60"/>
<approved hash="3,1,f5b4f94d858f8976"/>
<approved hash="3,1,f1673e41408f8fa9"/>
<approved hash="3,1,36cd524daeb1ca31"/>
<approved hash="3,1,3c4b9072dc397000"/>
<approved hash="3,1,0e91a29b20508c5a"/>
<approved hash="3,1,3de891e2d1497d43"/>
<approved hash="3,1,0f32a30b2d208119"/>
<approved hash="3,1,23b7c98c37a0dd9b"/>
<approved hash="3,1,4b4eb5904bbdb563"/>
<approved hash="3,1,872ce5a119d37b5e"/>
<approved hash="3,1,866f50bc2cddfa0e"/>
<approved hash="3,1,9e3972d6f2d41e3b"/>
<approved hash="3,1,eab41e5b9e596ab6"/>
<approved hash="3,1,3937cdd84ddeb931"/>
<approved hash="3,1,43be4751c750c3bf"/>
<approved hash="3,1,77229bcd1bd3f73c"/>
<approved hash="3,1,d17bd379d379d17b"/>
<approved hash="1,20,17ba98da99cf16af"/>
<approved hash="1,20,5d82926297845864"/>
<approved hash="3,16,d770d572d572d770"/>
<approved hash="1,20,6462650262226342"/>
<approved hash="19,1,e972b38e86c1220e"/>
<approved hash="19,1,d16e83a632e352ce"/>
<approved hash="19,1,830027e094400244"/>
<approved hash="19,1,29fd712f6892724b"/>
<approved hash="5,1,8de6c8204784c842"/>
<approved hash="19,1,e6012ee52cf0e414"/>
<approved hash="19,1,1579c4022264d9e9"/>
<approved hash="19,1,3e8e7c48b1ebdbd9"/>
<approved hash="19,1,227e1f821d882074"/>
<approved hash="19,1,de0ff3174446b362"/>
<approved hash="19,1,0efa023101a77c73"/>
<approved hash="19,1,6415ecdc298d1b50"/>
<approved hash="5,1,e3eb9a21c37f4441"/>
<approved hash="19,1,a6005e005c17a417"/>
<approved hash="19,1,5463dd01e46223f2"/>
<approved hash="19,1,8a8e8051e8f5b2de"/>
<approved hash="19,1,ef2602ab8d327c3f"/>
<approved hash="5,1,59d15ecd162abcef"/>
<approved hash="5,1,1afac3d64098fb08"/>
<approved hash="4,1,b9e1fecae2378038"/>
<approved hash="19,1,b3e4ab9fab99b3e2"/>
<approved hash="5,1,5f28b3d31de3199d"/>
<approved hash="5,1,cfadfcd09a00ce51"/>
<approved hash="5,1,f05eceea3b877e05"/>
<approved hash="5,1,e2afbcaadeb3f553"/>
<approved hash="5,1,cfadfcd09a00ce51"/>
<approved hash="19,1,76b2570fa930cbe1"/>
<approved hash="5,1,a63a2b32db402eb3"/>
<approved hash="5,1,6bb5dfd4b08dd194"/>
<approved hash="5,1,7eb9880b78ae7a38"/>
<approved hash="5,1,fdde6d6cd3f6f551"/>
<approved hash="5,1,963867d07629d12b"/>
<approved hash="5,1,7f1e93dd25f17d38"/>
<approved hash="5,1,993ca64e7039710f"/>
<approved hash="5,1,f813bc8c6c7d642d"/>
<approved hash="5,1,9e41844092537b72"/>
<approved hash="5,1,2fa971a551427ae4"/>
<approved hash="4,1,39f2ead7f7010101"/>
<approved hash="4,1,9a7b5ddb34b3340d"/>
<approved hash="4,1,2fb9176ef2f5d756"/>
<approved hash="4,1,b60e47ccbc8c0c6a"/>
<approved hash="4,1,34e3558bba61cab3"/>
<approved hash="4,1,72d5eae72c24b542"/>
<approved hash="19,1,893929e44168ee1f"/>
<approved hash="19,1,fef8e974cf87e7e1"/>
<approved hash="19,1,5a9b95dbf5325a40"/>
<approved hash="19,1,c26afa5efaa9c29d"/>
<approved hash="19,1,467e71e771a147b1"/>
<approved hash="5,1,77fde86531d04eea"/>
<approved hash="5,1,37494ad85f792607"/>
<approved hash="5,1,6a0dc8f7c20e6729"/>
<approved hash="5,1,cbccb65856792f02"/>
<approved hash="5,1,9e4fe3d85d792401"/>
<approved hash="5,1,390a616e0f577e49"/>
<approved hash="4,1,e58a954ef145a390"/>
<approved hash="5,1,e6a69c28fe202994"/>
<approved hash="5,1,fb295f96293e327a"/>
<approved hash="5,1,b2c2cf585a79230c"/>
<approved hash="4,1,38d11702f0c24d45"/>
<approved hash="4,1,e4451eb3562b2c7f"/>
<approved hash="4,1,f6ed95fb51c86f69"/>
</errors>
</board>
</drawing>
<compatibility>
<note version="6.3" minversion="6.2.2" severity="warning">
Since Version 6.2.2 text objects can contain more than one line,
which will not be processed correctly with this version.
</note>
</compatibility>
</eagle>

extension: brd


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.IO;
using DwrUtility.Trees;
using KellermanSoftware.CompareNetObjects;
using Newtonsoft.Json;

namespace DwrUtility.Test
{
    [TestClass]
    public class ParentChildTest
    {
        private static readonly string FileDir = Path.GetFullPath($"{AppDomain.CurrentDomain.BaseDirectory}/../../DataFiles/");

        [TestMethod]
        public void TestMethod1()
        {
            //待验证
            var path = $"{FileDir}test_20.json";
            var json = File.ReadAllText(path);
            var list = JsonConvert.DeserializeObject<List<Team>>(json);

            var result = list.GetChildNodes(1, p => p.Id, p => p.ParentId, true);
            var s = JsonConvert.SerializeObject(result);

            //正确结果
            var pathResult = $"{FileDir}test_20_result.json";
            var resultOk = JsonConvert.DeserializeObject<List<Team>>(File.ReadAllText(pathResult));

            var eq = new CompareLogic().Compare(result, resultOk);
            Assert.IsTrue(eq.AreEqual, JsonConvert.SerializeObject(eq.Differences));
        }

        [TestMethod]
        public void TestMethod2()
        {
            //待验证
            var path = $"{FileDir}test_21.json";
            var json = File.ReadAllText(path);
            var list = JsonConvert.DeserializeObject<List<Team>>(json);

            var result = list.GetChildNodes(1, p => p.Id, p => p.ParentId, false);
            var s = JsonConvert.SerializeObject(result);

            //正确结果
            var pathResult = $"{FileDir}test_21_result.json";
            var resultOk = JsonConvert.DeserializeObject<List<Team>>(File.ReadAllText(pathResult));

            var eq = new CompareLogic().Compare(result, resultOk);
            Assert.IsTrue(eq.AreEqual, JsonConvert.SerializeObject(eq.Differences));
        }

        [TestMethod]
        public void TestMethod3()
        {
            //待验证
            var path = $"{FileDir}test_23.json";
            var json = File.ReadAllText(path);
            var list = JsonConvert.DeserializeObject<List<Team>>(json);

            var result = list.GetParentNodes(4, p => p.Id, p => p.ParentId, true);
            var s = JsonConvert.SerializeObject(result);

            //正确结果
            var pathResult = $"{FileDir}test_23_result.json";
            var resultOk = JsonConvert.DeserializeObject<List<Team>>(File.ReadAllText(pathResult));

            var eq = new CompareLogic().Compare(result, resultOk);
            Assert.IsTrue(eq.AreEqual, JsonConvert.SerializeObject(eq.Differences));
        }

        [TestMethod]
        public void TestMethod4()
        {
            //待验证
            var path = $"{FileDir}test_24.json";
            var json = File.ReadAllText(path);
            var list = JsonConvert.DeserializeObject<List<Team>>(json);

            var result = list.GetParentNodes(4, p => p.Id, p => p.ParentId, false);
            var s = JsonConvert.SerializeObject(result);

            //正确结果
            var pathResult = $"{FileDir}test_24_result.json";
            var resultOk = JsonConvert.DeserializeObject<List<Team>>(File.ReadAllText(pathResult));

            var eq = new CompareLogic().Compare(result, resultOk);
            Assert.IsTrue(eq.AreEqual, JsonConvert.SerializeObject(eq.Differences));
        }

        public class Team
        {
            public int Id { get; set; }

            public int ParentId { get; set; }
            public string Name { get; set; }
        }
    }
}

license: MIT

repository: colindcli/DwrUtility

license_type: permissive

repo_name: colindcli/DwrUtility

branch_name: refs/heads/master

gha_license_id: MIT

gha_language: C#

extension: cs


text:
package kubectl

import (
    "io/ioutil"
    "os"
    "testing"

    ct "github.com/jtyr/gbt/pkg/core/testing"
)

func TestInit(t *testing.T) {
    ct.ResetEnv()

    tests := []struct {
        config                   string
        expectedDisplay          bool
        expectedContext          string
        expectedCluster          string
        expectedAuthInfo         string
        expectedNamespace        string
    }{
        {
            config:            "{apiVersion: v1, kind: Config, current-context: kubename, contexts: [{name: kubename, context: {cluster: kubecluster, user: kubeauth}}], clusters: [{name: kubecluster}], users: [{name: kubeauth}]}",
            expectedDisplay:   true,
            expectedContext:   "kubename",
            expectedCluster:   "kubecluster",
            expectedAuthInfo:  "kubeauth",
            expectedNamespace: "default",
        },
        {
            config:            "{apiVersion: v1, kind: Config, current-context: context, contexts: [{name: context, context: {cluster: cluster, user: authinfo, namespace: namespace}}], clusters: [{name: cluster}], users: [{name: authinfo}]}",
            expectedDisplay:   true,
            expectedContext:   "context",
            expectedCluster:   "cluster",
            expectedAuthInfo:  "authinfo",
            expectedNamespace: "namespace",
        },
        {
            config:            ": : :",
            expectedDisplay:   false,
            expectedContext:   "",
            expectedCluster:   "",
            expectedAuthInfo:  "",
            expectedNamespace: "",
        },
        {
            config:            "",
            expectedDisplay:   false,
            expectedContext:   "",
            expectedCluster:   "",
            expectedAuthInfo:  "",
            expectedNamespace: "",
        },
        {
            config:            "",
            expectedDisplay:   false,
            expectedContext:   "",
            expectedCluster:   "",
            expectedAuthInfo:  "",
            expectedNamespace: "",
        },
    }

    for i, test := range tests {
        config, err := ioutil.TempFile("", "")
        if err != nil {
            t.Errorf("failed to create config file: %s", err)
        }

        if err := ioutil.WriteFile(config.Name(), []byte(test.config), 0644); err != nil {
            t.Errorf("failed to write config file: %s", err)
        }

        os.Setenv("KUBECONFIG", config.Name())

        car := Car{}

        car.Init()

        if car.Display != test.expectedDisplay {
            t.Errorf("Test [%d]: Expected car.Display to be %t, got %t.", i, test.expectedDisplay, car.Display)
        }

        if test.expectedContext != "" && car.Model["Context"].Text != test.expectedContext {
            t.Errorf("Test [%d]: Expected car.Model.Context.Text to be '%s', got '%s'.", i, test.expectedContext, car.Model["Context"].Text)
        }

        if test.expectedCluster != "" && car.Model["Cluster"].Text != test.expectedCluster {
            t.Errorf("Test [%d]: Expected car.Model.Cluster.Text to be '%s', got '%s'.", i, test.expectedCluster, car.Model["Cluster"].Text)
        }

        if test.expectedAuthInfo != "" && car.Model["AuthInfo"].Text != test.expectedAuthInfo {
            t.Errorf("Test [%d]: Expected car.Model.AuthInfo.Text to be '%s', got '%s'.", i, test.expectedAuthInfo, car.Model["AuthInfo"].Text)
        }

        if car.Model["Namespace"].Text != test.expectedNamespace {
            t.Errorf("Test [%d]: Expected car.Model.Namespace.Text to be '%s', got '%s'.", i, test.expectedNamespace, car.Model["Namespace"].Text)
        }
    }
}

repository: jtyr/gbt

repo_name: jtyr/gbt

branch_name: refs/heads/main

gha_language: Go

extension: go


text:
LICENSE = "GPL"
SECTION = "x11/libs"
DESCRIPTION = "HTML rendering/editing library"
DEPENDS = "gtk+ gail libbonoboui libgnomeprintui libgnomeui"

inherit gnome

SRC_URI = "${GNOME_MIRROR}/gtkhtml/3.6/gtkhtml-${PV}.tar.bz2"
FILES_${PN} += "${datadir}/gtkhtml-3.6"
S = "${WORKDIR}/gtkhtml-${PV}"

EXTRA_OECONF = "--disable-gtk-doc"

do_stage() {
	mv src/libgtkhtml.pc src/libgtkhtml-3.6.pc || true
	gnome_stage_includes
	oe_libinstall -C src -so libgtkhtml-3.6 ${STAGING_LIBDIR}
}

extension: bb


text:
package wfregistry

import (
	"fmt"
	"github.com/naveego/bosun/pkg/wf/wfcontracts"
	"github.com/pkg/errors"
)

var DefaultRegistry = New()

type Registry struct {
	workflows map[string]func() wfcontracts.Workflow
}

func New() *Registry  {
	return  &Registry{workflows: map[string]func() wfcontracts.Workflow{}}
}

func (r *Registry) Register(typ string, factory func() wfcontracts.Workflow) {
	if _, ok := r.workflows[typ]; ok{
		panic(fmt.Sprintf("workflow with type %q already registered", typ))
	}
	r.workflows[typ] = factory
}

func (r *Registry) Create(typ string) (wfcontracts.Workflow, error){
	if factory, ok := r.workflows[typ]; !ok{
		return nil, errors.Errorf("workflow with type %q not registered", typ)
	} else {
		return factory(), nil
	}
}

func (r *Registry) GetConfigTemplates() []wfcontracts.Config {
	var configs []wfcontracts.Config
	for _, factory := range r.workflows {
		instance := factory()
		template, _ := instance.Templates()
		configs = append(configs, template)
	}
	return configs
}

repository: naveego/bosun

repo_name: naveego/bosun


text:
// Copyright 2011 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.

using NodaTime.Annotations;
using System.Text;

namespace NodaTime.Text
{
    /// <summary>
    /// Generic interface supporting parsing and formatting. Parsing always results in a
    /// <see cref="ParseResult{T}"/> which can represent success or failure.
    /// </summary>
    /// <remarks>
    /// Idiomatic text handling in Noda Time involves creating a pattern once and reusing it multiple
    /// times, rather than specifying the pattern text repeatedly. All patterns are immutable and thread-safe,
    /// and include the culture used for localization purposes.
    /// </remarks>
    /// <typeparam name="T">Type of value to parse or format.</typeparam>
    public interface IPattern<T>
    {
        /// <summary>
        /// Parses the given text value according to the rules of this pattern.
        /// </summary>
        /// <remarks>
        /// This method never throws an exception (barring a bug in Noda Time itself). Even errors such as
        /// the argument being null are wrapped in a parse result.
        /// </remarks>
        /// <param name="text">The text value to parse.</param>
        /// <returns>The result of parsing, which may be successful or unsuccessful.</returns>
        ParseResult<T> Parse([SpecialNullHandling] string text);

        /// <summary>
        /// Formats the given value as text according to the rules of this pattern.
        /// </summary>
        /// <param name="value">The value to format.</param>
        /// <returns>The value formatted according to this pattern.</returns>
        string Format(T value);

        /// <summary>
        /// Formats the given value as text according to the rules of this pattern,
        /// appending to the given <see cref="StringBuilder"/>.
        /// </summary>
        /// <param name="value">The value to format.</param>
        /// <param name="builder">The <c>StringBuilder</c> to append to.</param>
        /// <returns>The builder passed in as <paramref name="builder"/>.</returns>
        StringBuilder AppendFormat(T value, StringBuilder builder);
    }
}

repository: nodatime/nodatime

repo_name: nodatime/nodatime


text:
package point

import (
    "log"

    "github.com/songgao/water"
)

type TapWroker struct {
    ifce *water.Interface
    writechan chan []byte
    ifmtu int
    verbose int
}

func NewTapWoker(ifce *water.Interface, c *Config) (this *TapWroker) {
    this = &TapWroker {
        ifce: ifce,
        writechan: make(chan []byte, 1024*10),
        ifmtu: c.Ifmtu, //1514
        verbose: c.Verbose,
    }
    return
}

func (this *TapWroker) GoRecv(dorecv func([]byte)(error)) {
    defer this.ifce.Close()
    for {
        data := make([]byte, this.ifmtu)
        n, err := this.ifce.Read(data)
        if err != nil {
            log.Printf("Error| TapWroker.GoRev: %s", err)
            break
        }
        if this.IsVerbose() {
            log.Printf("Debug| TapWroker.GoRev: % x\n", data[:n])
        }

        dorecv(data[:n])
    }
}

func (this *TapWroker) DoSend(data []byte) error {
    if this.IsVerbose() {
        log.Printf("Debug| TapWroker.DoSend: % x\n", data)
    }

    this.writechan <- data
    return nil
}

func (this *TapWroker) GoLoop() error {
    defer this.ifce.Close()
    for {
        select {
        case wdata := <- this.writechan:
            if _, err := this.ifce.Write(wdata); err != nil {
                log.Printf("Error| TapWroker.GoLoop: %s", err)
            }
        }
    }
}

func (this *TapWroker) IsVerbose() bool {
    return this.verbose != 0
}

func (this *TapWroker) Close() {
    this.ifce.Close()
}

repository: buliangjunpp/openlan-go

repo_name: buliangjunpp/openlan-go


text:
package gen

import (
	"fmt"
	"io/ioutil"
	"regexp"
	"strings"
	"unicode"

	"github.com/go-clang/bootstrap/clang"
)

type HeaderFile struct {
	api *API

	name string
	dir  string

	enums     []*Enum
	functions []*Function
	structs   []*Struct

	lookupEnum        map[string]*Enum
	lookupNonTypedefs map[string]string
	lookupStruct      map[string]*Struct
}

func (h *HeaderFile) addMethod(f *Function, fname string, fnamePrefix string, rt Receiver) bool {
	fname = UpperFirstCharacter(fnamePrefix + UpperFirstCharacter(fname))

	if e, ok := h.lookupEnum[rt.Type.GoName]; ok {
		f.Name = fname

		e.Methods = append(e.Methods, f)

		return true
	} else if s, ok := h.lookupStruct[rt.Type.GoName]; ok && s.CName != "CXString" {
		f.Name = fname

		if !rt.Type.IsSlice && rt.Type.PointerLevel > 0 {
			s.IsPointerComposition = true
		}

		s.Methods = append(s.Methods, f)

		return true
	}

	return false
}

func (h *HeaderFile) addBasicMethods(f *Function, fname string, fnamePrefix string, rt Receiver) bool {
	if len(f.Parameters) == 0 && h.IsEnumOrStruct(f.ReturnType.GoName) {
		rtc := rt
		rtc.Type = f.ReturnType

		fname = TrimCommonFunctionNamePrefix(fname)
		if fname == "" {
			fname = f.ReturnType.GoName
		}

		if strings.HasPrefix(f.CName, "clang_create") || strings.HasPrefix(f.CName, "clang_get") || strings.HasSuffix(f.CName, "_create") {
			fname = "New" + fname
		}

		return h.addMethod(f, fname, fnamePrefix, rtc)
	} else if (fname[0] == 'i' && fname[1] == 's' && unicode.IsUpper(rune(fname[2]))) || (fname[0] == 'h' && fname[1] == 'a' && fname[2] == 's' && unicode.IsUpper(rune(fname[3]))) {
		f.ReturnType.GoName = "bool"

		return h.addMethod(f, fname, fnamePrefix, rt)
	} else if len(f.Parameters) == 1 && h.IsEnumOrStruct(f.Parameters[0].Type.GoName) && strings.HasPrefix(fname, "dispose") && f.ReturnType.GoName == "void" {
		fname = "Dispose"

		return h.addMethod(f, fname, fnamePrefix, rt)
	} else if len(f.Parameters) == 2 && strings.HasPrefix(fname, "equal") && h.IsEnumOrStruct(f.Parameters[0].Type.GoName) && f.Parameters[0].Type == f.Parameters[1].Type {
		fname = "Equal"
		f.Parameters[0].Name = commonReceiverName(f.Parameters[0].Type.GoName)
		f.Parameters[1].Name = f.Parameters[0].Name + "2"

		f.ReturnType.GoName = "bool"

		return h.addMethod(f, fname, fnamePrefix, rt)
	}

	return false
}

func (h *HeaderFile) IsEnumOrStruct(name string) bool {
	if _, ok := h.lookupEnum[name]; ok {
		return true
	} else if _, ok := h.lookupStruct[name]; ok {
		return true
	}

	return false
}

func (h *HeaderFile) setIsPointerComposition(typ *Type) {
	if s, ok := h.lookupStruct[typ.GoName]; ok && s.IsPointerComposition {
		typ.IsPointerComposition = true
	}
}

func (h *HeaderFile) prepareFile() error {
	/*
		Hide all "void *" fields of structs by replacing the type with "uintptr_t".

		To paraphrase the original go-clang source code:
			Not hiding these fields confuses the Go GC during garbage collection and
			pointer scanning, making it think the heap/stack has been somehow corrupted.

		I do not know how the original author debugged this, but one thing: Thank you!
	*/
	findStructsRe := regexp.MustCompile(`(?s)struct[\s\w]+{.+?}`)
	f, err := ioutil.ReadFile(h.name)
	if err != nil {
		return fmt.Errorf("Cannot read Index.h: %v", err)
	}
	voidPointerReplacements := map[string]string{}
	findVoidPointerRe := regexp.MustCompile(`(?:const\s+)?void\s*\*\s*(\w+(\[\d+\])?;)`)
	for _, s := range findStructsRe.FindAll(f, -1) {
		s2 := findVoidPointerRe.ReplaceAll(s, []byte("uintptr_t $1"))
		if len(s) != len(s2) {
			voidPointerReplacements[string(s)] = string(s2)
		}
	}
	fs := string(f)
	for s, r := range voidPointerReplacements {
		fs = strings.Replace(fs, s, r, -1)
	}
	if incl := "#include <stdint.h>"; !strings.HasPrefix(fs, incl) { // Include for uintptr_t
		fs = "#include <stdint.h>\n\n" + fs
	}
	err = ioutil.WriteFile(h.name, []byte(fs), 0600)
	if err != nil {
		return fmt.Errorf("Cannot write %s: %v", h.name, err)
	}

	return nil
}

func (h *HeaderFile) handleFile(cursor clang.Cursor) {
	/*
		TODO mark the enum https://github.com/go-clang/gen/issues/40
			typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, CXCursor parent, CXClientData client_data);
		as manually implemented
	*/
	// TODO report other enums like callbacks that they are not implemented https://github.com/go-clang/gen/issues/51

	cursor.Visit(func(cursor, parent clang.Cursor) clang.ChildVisitResult {
		// Only handle code of the current file
		sourceFile, _, _, _ := cursor.Location().FileLocation()
		isCurrentFile := sourceFile.Name() == h.name

		if !strings.HasPrefix(sourceFile.Name(), h.dir) {
			return clang.ChildVisit_Continue
		}

		cname := cursor.Spelling()
		cnameIsTypeDef := false

		if parentCName := parent.Spelling(); parent.Kind() == clang.Cursor_TypedefDecl && parentCName != "" {
			cname = parentCName
			cnameIsTypeDef = true
		}

		switch cursor.Kind() {
		case clang.Cursor_EnumDecl:
			if cname == "" {
				break
			}

			e := handleEnumCursor(cursor, cname, cnameIsTypeDef)
			e.IncludeFiles.addIncludeFile(sourceFile.Name())

			if _, ok := h.lookupEnum[e.Name]; !ok {
				h.lookupEnum[e.Name] = e
				h.lookupNonTypedefs["enum "+e.CName] = e.Name
				h.lookupEnum[e.CName] = e

				h.enums = append(h.enums, e)
			}
		case clang.Cursor_FunctionDecl:
			if !isCurrentFile {
				return clang.ChildVisit_Continue
			}

			f := handleFunctionCursor(cursor)
			if f != nil {
				f.IncludeFiles.addIncludeFile(sourceFile.Name())

				h.functions = append(h.functions, f)
			}
		case clang.Cursor_StructDecl:
			if cname == "" {
				break
			}

			s := handleStructCursor(cursor, cname, cnameIsTypeDef)
			s.api = h.api
			s.IncludeFiles.addIncludeFile(sourceFile.Name())

			if _, ok := h.lookupStruct[s.Name]; !ok {
				h.lookupStruct[s.Name] = s
				h.lookupNonTypedefs["struct "+s.CName] = s.Name
				h.lookupStruct[s.CName] = s

				h.structs = append(h.structs, s)
			}
		case clang.Cursor_TypedefDecl:
			underlyingType := cursor.TypedefDeclUnderlyingType().Spelling()
			underlyingStructType := strings.TrimSuffix(strings.TrimPrefix(underlyingType, "struct "), " *")

			if s, ok := h.lookupStruct[underlyingStructType]; ok && !s.CNameIsTypeDef && strings.HasPrefix(underlyingType, "struct "+s.CName) {
				// Sometimes the typedef is not a parent of the struct but a sibling
				sn := handleStructCursor(cursor, cname, true)
				sn.api = h.api
				sn.IncludeFiles.addIncludeFile(sourceFile.Name())

				if sn.Comment == "" {
					sn.Comment = s.Comment
				}
				sn.Members = s.Members
				sn.Methods = s.Methods

				h.lookupStruct[sn.Name] = sn
				h.lookupNonTypedefs["struct "+sn.CName] = sn.Name
				h.lookupStruct[sn.CName] = sn

				// Update the lookups for the old struct
				h.lookupStruct[s.Name] = sn
				h.lookupStruct[s.CName] = sn

				for i, si := range h.structs {
					if si == s {
						h.structs[i] = sn

						break
					}
				}
			} else if underlyingType == "void *" {
				s := handleStructCursor(cursor, cname, true)
				s.api = h.api
				s.IncludeFiles.addIncludeFile(sourceFile.Name())

				if _, ok := h.lookupStruct[s.Name]; !ok {
					h.lookupStruct[s.Name] = s
					h.lookupNonTypedefs["struct "+s.CName] = s.Name
					h.lookupStruct[s.CName] = s

					h.structs = append(h.structs, s)
				}
			}
		}

		return clang.ChildVisit_Recurse
	})
}

func (h *HeaderFile) parse(clangArguments []string) error {
	if err := h.prepareFile(); err != nil {
		return err
	}

	// Parse the header file to analyse everything we need to know
	idx := clang.NewIndex(0, 1)
	defer idx.Dispose()

	tu := idx.ParseTranslationUnit(h.name, clangArguments, nil, 0)
	defer tu.Dispose()

	if !tu.IsValid() {
		return fmt.Errorf("Cannot parse Index.h")
	}

	for _, diag := range tu.Diagnostics() {
		switch diag.Severity() {
		case clang.Diagnostic_Error:
			return fmt.Errorf("Diagnostic error in Index.h: %s", diag.Spelling())
		case clang.Diagnostic_Fatal:
			return fmt.Errorf("Diagnostic fatal in Index.h: %s", diag.Spelling())
		}
	}

	h.handleFile(tu.TranslationUnitCursor())

	return nil
}

func (h *HeaderFile) handle() error {
	// Prepare all functions
	clangFile := newFile("clang")

	for _, f := range h.functions {
		var fname string
		if h.api.PrepareFunctionName != nil {
			fname = h.api.PrepareFunctionName(h, f)
			f.Name = fname
		} else {
			fname = f.Name
		}

		if h.api.FilterFunction != nil && !h.api.FilterFunction(f) {
			continue
		}

		// Prepare the parameters
		for i := range f.Parameters {
			p := &f.Parameters[i]

			if n, ok := h.lookupNonTypedefs[p.Type.CGoName]; ok {
				p.Type.GoName = n
			}
			if e, ok := h.lookupEnum[p.Type.GoName]; ok {
				p.CName = e.Receiver.CName
				// TODO remove the receiver... and copy only names here to preserve the original pointers and so https://github.com/go-clang/gen/issues/52
				p.Type.GoName = e.Receiver.Type.GoName
				p.Type.CGoName = e.Receiver.Type.CGoName
				p.Type.CGoName = e.Receiver.Type.CGoName
			} else if _, ok := h.lookupStruct[p.Type.GoName]; ok {
			}
		}

		if h.api.PrepareFunction != nil {
			h.api.PrepareFunction(f)
		}

		// Prepare the return argument
		if n, ok := h.lookupNonTypedefs[f.ReturnType.CGoName]; ok {
			f.ReturnType.GoName = n
		}
		if e, ok := h.lookupEnum[f.ReturnType.GoName]; ok {
			f.ReturnType.CGoName = e.Receiver.Type.CGoName
		} else if _, ok := h.lookupStruct[f.ReturnType.GoName]; ok {
		}

		// Prepare the receiver
		var rt Receiver
		if len(f.Parameters) > 0 {
			rt.Name = commonReceiverName(f.Parameters[0].Type.GoName)
			rt.CName = f.Parameters[0].CName
			rt.Type = f.Parameters[0].Type
		} else {
			if e, ok := h.lookupEnum[f.ReturnType.GoName]; ok {
				rt.Type = e.Receiver.Type
			} else if s, ok := h.lookupStruct[f.ReturnType.GoName]; ok {
				rt.Type.GoName = s.Name
			}
		}

		// Check upfront if we can handle a function
		found := false

		for _, p := range f.Parameters {
			if h.api.FilterFunctionParameter != nil && !h.api.FilterFunctionParameter(p) {
				continue
			}

			// Return arguments and slices are always ok since we mark them earlier
			if p.Type.IsReturnArgument || p.Type.IsSlice {
				continue
			}

			if (!h.IsEnumOrStruct(p.Type.GoName) && !p.Type.IsPrimitive) || p.Type.PointerLevel != 0 {
				found = true

				fmt.Printf("Cannot handle parameter %s -> %#v\n", f.CName, p)

				break
			}
		}

		// If we find a heuristic to add the function, add it!
		added := false
		if !found {
			added = h.addBasicMethods(f, fname, "", rt)

			if !added {
				if s := strings.Split(f.Name, "_"); len(s) == 2 {
					if s[0] == rt.Type.GoName {
						rtc := rt
						rtc.Name = s[0]

						added = h.addBasicMethods(f, s[1], "", rtc)
					} else {
						if s[0] != "" {
							s[0] += "_"
						}

						added = h.addBasicMethods(f, strings.Join(s[1:], ""), s[0], rt)
					}
				}
			}

			if !added {
				fname = TrimCommonFunctionName(fname, rt.Type)
				if fn := strings.TrimPrefix(fname, f.ReturnType.GoName+"_"); len(fn) != len(fname) {
					fname = fn
				}

				added = h.addMethod(f, fname, "", rt)

				if !added && h.IsEnumOrStruct(f.ReturnType.GoName) {
					rtc := rt
					rtc.Type = f.ReturnType

					fname = TrimCommonFunctionNamePrefix(fname)
					if fname == "" {
						fname = f.ReturnType.GoName
					}

					if strings.HasPrefix(f.CName, "clang_create") || strings.HasPrefix(f.CName, "clang_get") || strings.HasSuffix(f.CName, "_create") {
						fname = "New" + fname
					}

					added = h.addMethod(f, fname, "", rtc)
				}
				if !added {
					f.Name = UpperFirstCharacter(f.Name)

					clangFile.Functions = append(clangFile.Functions, f)

					added = true
				}
			}
		}

		if !added {
			fmt.Println("Unused function:", f.Name)
		}
	}

	for _, e := range h.enums {
		if err := e.addEnumStringMethods(); err != nil {
			return fmt.Errorf("Cannot generate enum string methods: %v", err)
		}

		for i, m := range e.Methods {
			if r := h.handleMethod(e.Name, m); r != "" {
				e.Methods[i] = r
			}
			switch m := m.(type) {
			case *Function:
				if len(m.Parameters) > 0 && !m.Parameters[0].Type.IsSlice && m.Parameters[0].Type.GoName == e.Name {
					m.Receiver = Receiver{
						Name: commonReceiverName(e.Name),
						Type: m.Parameters[0].Type,
					}

					h.setIsPointerComposition(&m.Receiver.Type)
				}
				for i := range m.Parameters {
					h.setIsPointerComposition(&m.Parameters[i].Type)
				}

				e.IncludeFiles.unifyIncludeFiles(m.IncludeFiles)

				e.Methods[i] = m.generate()
			}
		}

		if err := e.generate(); err != nil {
			return fmt.Errorf("Cannot generate enum: %v", err)
		}
	}

	for _, s := range h.structs {
		if err := s.addMemberGetters(); err != nil {
			return fmt.Errorf("Cannot generate struct member getters: %v", err)
		}

		for i, m := range s.Methods {
			if r := h.handleMethod(s.Name, m); r != "" {
				s.Methods[i] = r
			}
			switch m := m.(type) {
			case *Function:
				s.IncludeFiles.unifyIncludeFiles(m.IncludeFiles)
			}
		}

		if err := s.generate(); err != nil {
			return fmt.Errorf("Cannot generate struct: %v", err)
		}
	}

	if len(clangFile.Functions) > 0 {
		for _, m := range clangFile.Functions {
			switch m := m.(type) {
			case *Function:
				clangFile.IncludeFiles.unifyIncludeFiles(m.IncludeFiles)
			}
		}

		for i, m := range clangFile.Functions {
			if r := h.handleMethod("", m); r != "" {
				clangFile.Functions[i] = r
			}
		}

		if err := clangFile.generate(); err != nil {
			return fmt.Errorf("Cannot generate clang file: %v", err)
		}
	}

	return nil
}

func (h *HeaderFile) handleMethod(receiverName string, m interface{}) string {
	switch m := m.(type) {
	case *Function:
		if h.api.FixedFunctionName != nil {
			if fname := h.api.FixedFunctionName(m); fname != "" {
				m.Name = fname
			}
		}

		if len(m.Parameters) > 0 && !m.Parameters[0].Type.IsSlice && m.Parameters[0].Type.GoName == receiverName {
			m.Receiver = Receiver{
				Name: commonReceiverName(receiverName),
				Type: m.Parameters[0].Type,
			}

			h.setIsPointerComposition(&m.Receiver.Type)
		}
		for i := range m.Parameters {
			h.setIsPointerComposition(&m.Parameters[i].Type)
		}
		h.setIsPointerComposition(&m.ReturnType)

		return m.generate()
	}

	return ""
}

repository: sbinet/go-clang-gen

repo_name: sbinet/go-clang-gen


text:
using System;

namespace _404.ProcessStore
{
    internal class ProcessStopEvent
    {
        public DateTime EndTime;
        public int Pid;
    }
}


text:
import guess from '.';

describe('guess', () => {
  it('should', () => {
    expect.assertions(1);

    const luckyNumber = Math.floor(Math.random() * 100 + 1);

    expect(guess).toBe(luckyNumber);
  });
});

repository: marcobiedermann/codewars

repo_name: marcobiedermann/codewars

gha_language: TypeScript

extension: ts