diff --git a/core/genmsg_cpp/genmsg_lisp.cpp b/core/genmsg_cpp/genmsg_lisp.cpp index 3b41f0d2..7500bf6d 100644 --- a/core/genmsg_cpp/genmsg_lisp.cpp +++ b/core/genmsg_cpp/genmsg_lisp.cpp @@ -267,15 +267,27 @@ public: name.c_str(), name.c_str()); return string(code); */ - string decl = string("(") + name + - string("\n :accessor ") + name + string("-val") + - string("\n :initarg :") + name + - string("\n :initform #())"); + ostringstream code; + code << "(" << name << "\n :accessor " << name << string("-val"); + code << "\n :initarg :" << name; + code << "\n :initform (make-array " << len << " :initial-element "; + if (is_integer(eletype) || eletype=="time" || eletype=="duration") + code << "0"; + else if (is_float(eletype)) + code << "0.0"; + else if (eletype=="string") + code << "\"\""; + else + code << "(make-instance '" << lisp_eletype << ")"; + + code << "))"; + + string export_decl = name + string("-val"); for(unsigned int i=0;i