I'm writing a script to port a design between processes, and I need some kind of data structure that describes how to make the conversion for every primitive instance of the old process. This would include things like the library and cell name of the equivalent instance in the new process, mapping between symbol terminals, mapping between cdf properties, cdf callbacks to run, and any custom functions that need to be called during the conversion process. (I'd include custom functions as strings and use evalstring(), unless there's a better option). This entire structure would be static and loaded from a file. Since there are so many libraries and cells, I need something that can be searched quickly. I realize that the actual conversion process will probably take significantly more time than finding the instructions, but I think the efficiency still matters since it will add up.
There seem to be some tradeoffs between associative tables, disembodied property lists, and defstructs, depending on the number of elements. My understanding is that associative tables are best for long structures, and the defstructs might be better for shorter structures (or maybe DPL's, but the documentation doesn't suggest they're any good). I'm not sure what the tradeoffs between defstructs and associative lists are, but it seems like associative lists are better for things where the keys are unknown, and defstructs for things where the keys are known.
My first thought was:
- Assoc Table: libraries[]
- Keys: library names of cells to be converted
- Values: Assoc Tables cells[]
- Assoc table: cells[]
- Keys: cell names of cells to be converted
- Values: Defstruct cellmap
- Defstruct: cellmap
- ?libname - String, library name of new cell
- ?cellname - String, cell name of new cell
- ?termmap - Assoc list, keys are old terminal names, values are new terminal names
- ?propmap - Defstruct, An assoc list similar to termmap except for property names, and a string for callbacks to be executed/custom functions to run on the property value
Any thoughts?