patch to ASCO 0.4.6 to support multiple analyses with Spectre



Hello,
I've been using the ASCO tool (http://asco.sf.net) for automated
circuit sizing and optimization. Because ASCO 0.4.6, the latest
version, doesn't support optimizing on multiple analyses (AC, TRAN,
DC, etc.) simultaneously with Spectre, I added that functionality.
Here's the patch, for anyone who is interested. I've encoded it in
base64 - to get the text of the patch, using the base64 code in GNU
coreutils, you can run "base64 -d <textfile>" where textfile has the
text block below. Let me know if you need any help with it...

Patrick


LS0tIHRtcC9hc2NvLTAuNC42L2luaXRpYWxpemUuaAkyMDA2LTA1LTE2IDA0OjQ4OjQ0LjAwMDAw
MDAwMCAtMDcwMAorKysgY29kZS9hc2NvL2luaXRpYWxpemUuaAkyMDA4LTExLTE2IDEyOjQ1OjM3
LjAwMDAwMDAwMCAtMDgwMApAQCAtNTAsNiArNTAsNyBAQAogICovCiB0eXBlZGVmIHN0cnVjdCB7
CiAJY2hhciBtZWFzX3N5bWJvbFtMT05HU1RSSU5HU0laRV07IC8qc3ltYm9sIGluIHRoZSBTUElD
RSBvdXRwdXQgZmlsZSB0aGF0IHdpbGwgYmUgbWVhc3VyZWQgKi8KKyAgaW50IGFuYWx5c2lzX3R5
cGU7ICAgICAgICAgICAgICAgICAgICAgIC8qIGZvciBTcGVjdHJlIC0gd2hpY2ggYW5hbHlzaXMg
d2lsbCB0aGUgbWVhc3VyZW1lbnQgYmUgYWRkZWQgdG8/
ICovIAogCWNoYXIgbm9kZVtMT05HU1RS
SU5HU0laRV07ICAgICAgICAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICovCiAJaW50IG9iamVjdGl2ZV9jb25zdHJhaW50OyAgICAgICAgIC8q
TUlOPTEsIE1BWD0yLCBNT049MywgTEU9NCwgR0U9NSwgRVE9NiAgICAgICAgICAgICAgICAgKi8K
IAlkb3VibGUgY29uc3RyYWludF92YWx1ZTsgICAgICAgICAgLypzcGVjaWZpZWQgYnkgdGhlIHVz
ZXIgICAgIC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ICAgICAgICAgICAgICAgICAgICAgICAvKiB0byByZW1vdmUgaW50ZWdlciBhZGRlZCBpbiAoKikg
Ki8KKyAgICAgIGlpPShpbnQpc3RybGVuKGxrazIpOyAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAvKiB0byByZW1vdmUgaW50ZWdlciBhZGRlZCBpbiAoKikgKi8KKyAg
ICAgIHNwcmludGYobGtrMiwgIiVzJXMiLCAiZXh0cmFjdC8iLCBtZWFzdXJlbWVudHNba10ubWVh
c19zeW1ib2wpOyAvKiB0byByZW1vdmUgaW50ZWdlciBhZGRlZCBpbiAoKikgKi8KKyAgICAgIGxr
azJbKGludClzdHJsZW4obGtrMiktaWldPSdcMCc7ICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgLyogdG8gcmVtb3ZlIGludGVnZXIgYWRkZWQgaW4gKCopICovCisgICAgICBpZiAoKGZl
eHRyYWN0ID1mb3Blbihsa2syICwicnQiKSkgPT0gMCkgeworCXByaW50ZigiaW5pdGlhbGl6ZS5j
IC0gU3RlcDQuMiAtLSBDYW5ub3QgZmluZCBtZWFzdXJlbWVudCBmaWxlOiAlc1xuIiwgbGtrKTsK
KwlleGl0KEVYSVRfRkFJTFVSRSk7CisgICAgICB9CisgICAgICBzdHJjcHkobGF1eDIsIGxrazIp
OworCisgICAgICBSZWFkS2V5KGxrazIsICIjIENvbW1hbmRzICMiLCBmZXh0cmFjdCk7CisgICAg
ICBpZiAoc3RyY21wKGxrazIsICIjIENvbW1hbmRzICMiKSkgeyAgICAgICAgICAgIC8qZmluZHMg
IiMgQ29tbWFuZHMgIyIgYW5kIHdyaXRlcyB0byA8aG9zdG5hbWU
+LnRtcCB1bnRpbCB0aGUgZW5k
IG9mIGZpbGUqLworCXByaW50ZigiaW5pdGlhbGl6ZS5jIC0gU3RlcDQuMiAtLSBXcm9uZyBmb3Jt
YXQgaW4gZmlsZTogJXMgLSBzdHJpbmcgcmV0dXJuZWQgaXMgXCIlc1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