====== Language plugins : Implementation ====== ===== parse, print command ===== ==== Background ==== A command object executes a command, does not store anything. The reference to "dot" and "dotcard" is historical, because in Spice, commands were prefixed by a dot. This section may change as scripting is enhanced. For reference, here is the class definition from d_dot.h . /*--------------------------------------------------------------------------*/ class DEV_DOT : public CARD { private: std::string _s; explicit DEV_DOT(const DEV_DOT& p) :CARD(p) {set_constant(true);} public: explicit DEV_DOT() :CARD() {set_constant(true);} private: // override virtual std::string value_name()const {return "";} char id_letter()const {untested();return '\0';} std::string dev_type()const {untested();return "dotcard";} CARD* clone()const {return new DEV_DOT(*this);} public: void set(const std::string& S) {_s = S;} const std::string& s()const {return _s;} }; /*--------------------------------------------------------------------------*/ ==== parse_command ==== The parse function reads the string and executes it by calling ''CMD::cmdproc''. Then the new object is deleted, and the function returns a NULL pointer. /*--------------------------------------------------------------------------*/ DEV_DOT* LANG_VERILOG::parse_command(CS& cmd, DEV_DOT* x) { assert(x); x->set(cmd.fullstring()); CARD_LIST* scope = (x->owner()) ? x->owner()->subckt() : &CARD_LIST::card_list; cmd.reset(0); CMD::cmdproc(cmd, scope); delete x; return NULL; } /*--------------------------------------------------------------------------*/ ==== print_command ==== For now, all that is needed is to print it. /*--------------------------------------------------------------------------*/ void LANG_VERILOG::print_command(OMSTREAM& o, const DEV_DOT* x) { assert(x); o << x->s() << '\n'; } /*--------------------------------------------------------------------------*/