Category

本文深入探讨了Objective-C中的类别(Category)机制,解释了它如何为现有类添加新方法,以及其在实现类扩展时的局限性,特别是无法添加实例变量和名称冲突的问题。

二、category是什么

类别是一种为现有的类添加新方法的方式。

利用Objective-C的动态运行时分配机制,Category提供了一种比继承(inheritance)更为简洁的方法来对class进行扩展,无需创建对象类的子类就能为现有的类添加新方法


二、类别的局限性

有两方面局限性:

(1)无法向类中添加新的实例变量,类别没有位置容纳实例变量。

(2)名称冲突,即当类别中的方法与原始类方法名称冲突时,类别具有更高的优先级。类别方法将完全取代初始方法从而无法再使用初始方法。


<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <dcspecfile version="1.1"> <categorys> <category>POWER_OSD</category> <category>OS_PS</category> <category>OS_VDD</category> <category>OS_VSS</category> <category>IOZ_VDDH</category> <category>IOZ_VDDL</category> <category>VIHL_VDDH</category> <category>VIHL_VDDL</category> <category>VOHL_VDDL</category> <category>VOH_VDDL</category> <category>VOL_VDDL</category> <category>default</category> </categorys> <dcspectable> <dcspec name="Vcoef" comment=""> <category expression="1" category="POWER_OSD"/> <category expression="1" category="OS_PS"/> <category expression="1" category="OS_VDD"/> <category expression="1" category="OS_VSS"/> <category expression="1" category="IOZ_VDDH"/> <category expression="1" category="IOZ_VDDL"/> <category expression="1" category="VIHL_VDDH"/> <category expression="1" category="VIHL_VDDL"/> <category expression="1" category="VOHL_VDDL"/> <category expression="1" category="VOH_VDDL"/> <category expression="1" category="VOL_VDDL"/> <category expression="1" category="default"/> </dcspec> <dcspec name="Vcoef_IO" comment=""> <category expression="1" category="POWER_OSD"/> <category expression="1" category="OS_PS"/> <category expression="1" category="OS_VDD"/> <category expression="1" category="OS_VSS"/> <category expression="1.1" category="IOZ_VDDH"/> <category expression="0.9" category="IOZ_VDDL"/> <category expression="1.1" category="VIHL_VDDH"/> <category expression="0.9" category="VIHL_VDDL"/> <category expression="0.9" category="VOHL_VDDL"/> <category expression="0.9" category="VOH_VDDL"/> <category expression="0.9" category="VOL_VDDL"/> <category expression="1" category="default"/> </dcspec> <dcspec name="VDD" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.1" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0.75" category="IOZ_VDDH"/> <category expression="0.75" category="IOZ_VDDL"/> <category expression="0.75" category="VIHL_VDDH"/> <category expression="0.75" category="VIHL_VDDL"/> <category expression="0.75" category="VOHL_VDDL"/> <category expression="0.75" category="VOH_VDDL"/> <category expression="0.75" category="VOL_VDDL"/> <category expression="0.75" category="default"/> </dcspec> <dcspec name="VDDC" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.11" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0.75" category="IOZ_VDDH"/> <category expression="0.75" category="IOZ_VDDL"/> <category expression="0.75" category="VIHL_VDDH"/> <category expression="0.75" category="VIHL_VDDL"/> <category expression="0.75" category="VOHL_VDDL"/> <category expression="0.75" category="VOH_VDDL"/> <category expression="0.75" category="VOL_VDDL"/> <category expression="0.75" category="default"/> </dcspec> <dcspec name="DVDD18_IO" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.12" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="1.8" category="IOZ_VDDH"/> <category expression="1.8" category="IOZ_VDDL"/> <category expression="1.8" category="VIHL_VDDH"/> <category expression="1.8" category="VIHL_VDDL"/> <category expression="1.8" category="VOHL_VDDL"/> <category expression="1.8" category="VOH_VDDL"/> <category expression="1.8" category="VOL_VDDL"/> <category expression="1.8" category="default"/> </dcspec> <dcspec name="AVDD075_FNPLL" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.13" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0.75" category="IOZ_VDDH"/> <category expression="0.75" category="IOZ_VDDL"/> <category expression="0.75" category="VIHL_VDDH"/> <category expression="0.75" category="VIHL_VDDL"/> <category expression="0.75" category="VOHL_VDDL"/> <category expression="0.75" category="VOH_VDDL"/> <category expression="0.75" category="VOL_VDDL"/> <category expression="0.75" category="default"/> </dcspec> <dcspec name="AVDD12_FNPLL" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.14" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="1.2" category="IOZ_VDDH"/> <category expression="1.2" category="IOZ_VDDL"/> <category expression="1.2" category="VIHL_VDDH"/> <category expression="1.2" category="VIHL_VDDL"/> <category expression="1.2" category="VOHL_VDDL"/> <category expression="1.2" category="VOH_VDDL"/> <category expression="1.2" category="VOL_VDDL"/> <category expression="1.2" category="default"/> </dcspec> <dcspec name="Vout_VDD" comment=""> <category expression="VDD*Vcoef" category="POWER_OSD"/> <category expression="VDD*Vcoef" category="OS_PS"/> <category expression="VDD*Vcoef" category="OS_VDD"/> <category expression="VDD*Vcoef" category="OS_VSS"/> <category expression="VDD*Vcoef" category="IOZ_VDDH"/> <category expression="VDD*Vcoef" category="IOZ_VDDL"/> <category expression="VDD*Vcoef" category="VIHL_VDDH"/> <category expression="VDD*Vcoef" category="VIHL_VDDL"/> <category expression="VDD*Vcoef" category="VOHL_VDDL"/> <category expression="VDD*Vcoef" category="VOH_VDDL"/> <category expression="VDD*Vcoef" category="VOL_VDDL"/> <category expression="VDD*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_VDDC" comment=""> <category expression="VDDC*Vcoef" category="POWER_OSD"/> <category expression="VDDC*Vcoef" category="OS_PS"/> <category expression="VDDC*Vcoef" category="OS_VDD"/> <category expression="VDDC*Vcoef" category="OS_VSS"/> <category expression="VDDC*Vcoef" category="IOZ_VDDH"/> <category expression="VDDC*Vcoef" category="IOZ_VDDL"/> <category expression="VDDC*Vcoef" category="VIHL_VDDH"/> <category expression="VDDC*Vcoef" category="VIHL_VDDL"/> <category expression="VDDC*Vcoef" category="VOHL_VDDL"/> <category expression="VDDC*Vcoef" category="VOH_VDDL"/> <category expression="VDDC*Vcoef" category="VOL_VDDL"/> <category expression="VDDC*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_DVDD18_IO" comment=""> <category expression="DVDD18_IO*Vcoef" category="POWER_OSD"/> <category expression="DVDD18_IO*Vcoef" category="OS_PS"/> <category expression="DVDD18_IO*Vcoef" category="OS_VDD"/> <category expression="DVDD18_IO*Vcoef" category="OS_VSS"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="DVDD18_IO*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_AVDD075_FNPLL" comment=""> <category expression="AVDD075_FNPLL*Vcoef" category="POWER_OSD"/> <category expression="AVDD075_FNPLL*Vcoef" category="OS_PS"/> <category expression="AVDD075_FNPLL*Vcoef" category="OS_VDD"/> <category expression="AVDD075_FNPLL*Vcoef" category="OS_VSS"/> <category expression="AVDD075_FNPLL*Vcoef" category="IOZ_VDDH"/> <category expression="AVDD075_FNPLL*Vcoef" category="IOZ_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VIHL_VDDH"/> <category expression="AVDD075_FNPLL*Vcoef" category="VIHL_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VOHL_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VOH_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VOL_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_AVDD12_FNPLL" comment=""> <category expression="AVDD12_FNPLL*Vcoef" category="POWER_OSD"/> <category expression="AVDD12_FNPLL*Vcoef" category="OS_PS"/> <category expression="AVDD12_FNPLL*Vcoef" category="OS_VDD"/> <category expression="AVDD12_FNPLL*Vcoef" category="OS_VSS"/> <category expression="AVDD12_FNPLL*Vcoef" category="IOZ_VDDH"/> <category expression="AVDD12_FNPLL*Vcoef" category="IOZ_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VIHL_VDDH"/> <category expression="AVDD12_FNPLL*Vcoef" category="VIHL_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VOHL_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VOH_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VOL_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="default"/> </dcspec> <dcspec name="Iclamp_VDD" comment=""> <category expression="8A" category="POWER_OSD"/> <category expression="0.2" category="OS_PS"/> <category expression="0.2" category="OS_VDD"/> <category expression="0.2" category="OS_VSS"/> <category expression="30A" category="IOZ_VDDH"/> <category expression="30A" category="IOZ_VDDL"/> <category expression="30A" category="VIHL_VDDH"/> <category expression="30A" category="VIHL_VDDL"/> <category expression="30A" category="VOHL_VDDL"/> <category expression="30A" category="VOH_VDDL"/> <category expression="30A" category="VOL_VDDL"/> <category expression="30A" category="default"/> </dcspec> <dcspec name="Iclamp_VDDC" comment=""> <category expression="4A" category="POWER_OSD"/> <category expression="0.2" category="OS_PS"/> <category expression="0.2" category="OS_VDD"/> <category expression="0.2" category="OS_VSS"/> <category expression="15A" category="IOZ_VDDH"/> <category expression="15A" category="IOZ_VDDL"/> <category expression="15A" category="VIHL_VDDH"/> <category expression="15A" category="VIHL_VDDL"/> <category expression="15A" category="VOHL_VDDL"/> <category expression="15A" category="VOH_VDDL"/> <category expression="15A" category="VOL_VDDL"/> <category expression="15A" category="default"/> </dcspec> <dcspec name="Iclamp_DVDD18_IO" comment=""> <category expression="0.4" category="POWER_OSD"/> <category expression="0.4" category="OS_PS"/> <category expression="0.4" category="OS_VDD"/> <category expression="0.4" category="OS_VSS"/> <category expression="1A" category="IOZ_VDDH"/> <category expression="1A" category="IOZ_VDDL"/> <category expression="1A" category="VIHL_VDDH"/> <category expression="1A" category="VIHL_VDDL"/> <category expression="1A" category="VOHL_VDDL"/> <category expression="1A" category="VOH_VDDL"/> <category expression="1A" category="VOL_VDDL"/> <category expression="1A" category="default"/> </dcspec> <dcspec name="Iclamp_AVDD075_FNPLL" comment=""> <category expression="0.2" category="POWER_OSD"/> <category expression="0.2" category="OS_PS"/> <category expression="0.2" category="OS_VDD"/> <category expression="0.2" category="OS_VSS"/> <category expression="0.5A" category="IOZ_VDDH"/> <category expression="0.5A" category="IOZ_VDDL"/> <category expression="0.5A" category="VIHL_VDDH"/> <category expression="0.5A" category="VIHL_VDDL"/> <category expression="0.5A" category="VOHL_VDDL"/> <category expression="0.5A" category="VOH_VDDL"/> <category expression="0.5A" category="VOL_VDDL"/> <category expression="0.5A" category="default"/> </dcspec> <dcspec name="Iclamp_AVDD12_FNPLL" comment=""> <category expression="0.4" category="POWER_OSD"/> <category expression="0.4" category="OS_PS"/> <category expression="0.4" category="OS_VDD"/> <category expression="0.4" category="OS_VSS"/> <category expression="0.5A" category="IOZ_VDDH"/> <category expression="0.5A" category="IOZ_VDDL"/> <category expression="0.5A" category="VIHL_VDDH"/> <category expression="0.5A" category="VIHL_VDDL"/> <category expression="0.5A" category="VOHL_VDDL"/> <category expression="0.5A" category="VOH_VDDL"/> <category expression="0.5A" category="VOL_VDDL"/> <category expression="0.5A" category="default"/> </dcspec> <dcspec name="Setupdelay_VDD" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Setupdelay_VDDC" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Setupdelay_DVDD18_IO" comment=""> <category expression="9ms" category="POWER_OSD"/> <category expression="9ms" category="OS_PS"/> <category expression="9ms" category="OS_VDD"/> <category expression="9ms" category="OS_VSS"/> <category expression="9ms" category="IOZ_VDDH"/> <category expression="9ms" category="IOZ_VDDL"/> <category expression="9ms" category="VIHL_VDDH"/> <category expression="9ms" category="VIHL_VDDL"/> <category expression="9ms" category="VOHL_VDDL"/> <category expression="9ms" category="VOH_VDDL"/> <category expression="9ms" category="VOL_VDDL"/> <category expression="9ms" category="default"/> </dcspec> <dcspec name="Setupdelay_AVDD075_FNPLL" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Setupdelay_AVDD12_FNPLL" comment=""> <category expression="5ms" category="POWER_OSD"/> <category expression="5ms" category="OS_PS"/> <category expression="5ms" category="OS_VDD"/> <category expression="5ms" category="OS_VSS"/> <category expression="5ms" category="IOZ_VDDH"/> <category expression="5ms" category="IOZ_VDDL"/> <category expression="5ms" category="VIHL_VDDH"/> <category expression="5ms" category="VIHL_VDDL"/> <category expression="5ms" category="VOHL_VDDL"/> <category expression="5ms" category="VOH_VDDL"/> <category expression="5ms" category="VOL_VDDL"/> <category expression="5ms" category="default"/> </dcspec> <dcspec name="Trise_VDD" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Trise_VDDC" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Trise_DVDD18_IO" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Trise_AVDD075_FNPLL" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Trise_AVDD12_FNPLL" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Vil_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="0.35*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.35*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Vih_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="0.65*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.65*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Vol_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.05" category="OS_VDD"/> <category expression="-1" category="OS_VSS"/> <category expression="0.45" category="IOZ_VDDH"/> <category expression="0.45" category="IOZ_VDDL"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="0.45" category="VOHL_VDDL"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="0.45" category="VOL_VDDL"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Voh_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.95" category="OS_VDD"/> <category expression="-0.05" category="OS_VSS"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="IOZ_VDDH"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="IOZ_VDDL"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="VOHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="VOH_VDDL"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Vt_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="1" category="OS_VDD"/> <category expression="-1.1" category="OS_VSS"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Iol_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.0008" category="OS_VDD"/> <category expression="0.6mA" category="OS_VSS"/> <category expression="3mA" category="IOZ_VDDH"/> <category expression="2mA" category="IOZ_VDDL"/> <category expression="2mA" category="VIHL_VDDH"/> <category expression="2mA" category="VIHL_VDDL"/> <category expression="2mA" category="VOHL_VDDL"/> <category expression="2mA" category="VOH_VDDL"/> <category expression="2mA" category="VOL_VDDL"/> <category expression="10mA" category="default"/> </dcspec> <dcspec name="Ioh_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.0008" category="OS_VDD"/> <category expression="0.6mA" category="OS_VSS"/> <category expression="3mA" category="IOZ_VDDH"/> <category expression="2mA" category="IOZ_VDDL"/> <category expression="2mA" category="VIHL_VDDH"/> <category expression="2mA" category="VIHL_VDDL"/> <category expression="2mA" category="VOHL_VDDL"/> <category expression="2mA" category="VOH_VDDL"/> <category expression="2mA" category="VOL_VDDL"/> <category expression="10mA" category="default"/> </dcspec> <dcspec name="Vch_gIO_Digital_All" comment=""> <category expression="1.5" category="POWER_OSD"/> <category expression="1.5" category="OS_PS"/> <category expression="1.5" category="OS_VDD"/> <category expression="1.5" category="OS_VSS"/> <category expression="0" category="IOZ_VDDH"/> <category expression="0" category="IOZ_VDDL"/> <category expression="0" category="VIHL_VDDH"/> <category expression="0" category="VIHL_VDDL"/> <category expression="0" category="VOHL_VDDL"/> <category expression="0" category="VOH_VDDL"/> <category expression="0" category="VOL_VDDL"/> <category expression="0" category="default"/> </dcspec> <dcspec name="Vcl_gIO_Digital_All" comment=""> <category expression="-1" category="POWER_OSD"/> <category expression="-1" category="OS_PS"/> <category expression="-1.5" category="OS_VDD"/> <category expression="-1.5" category="OS_VSS"/> <category expression="0" category="IOZ_VDDH"/> <category expression="0" category="IOZ_VDDL"/> <category expression="0" category="VIHL_VDDH"/> <category expression="0" category="VIHL_VDDL"/> <category expression="0" category="VOHL_VDDL"/> <category expression="0" category="VOH_VDDL"/> <category expression="0" category="VOL_VDDL"/> <category expression="0" category="default"/> </dcspec> </dcspectable> </dcspecfile> 使用python 转换上述xml 为excel, 其中categorys为行标题,在第一行,dcspectable中各dcspec 的name 为列标题,其中的category子项中的category值对应上述行标题,expression为值,我需要你转换计算expression的值,其中会有表达式,表达式中的变量对应dcspec name里category 对应的expression值,但是有些有电流或者电压的单位,计算时需要注意,我需要你输出一个计算后的excel
最新发布
08-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值