/*Compare Baseline of System Requirements*/ //Script to compare two SYS.2 Baselines DB exBox = create "System Requirements Baselines comparison" DBE b1 = field(exBox, "SYS.2 older baseline:","0.1 a",20) //put the older baseline number you want to compare DBE b2 = field(exBox, "SYS.2 newer baseline:","0.2 b",20) //put the newer baseline number you want to compare Module m = current void get_numbers(DB exBox) { string s1 = get b1 string s2 = get b2 string sReg = "([0-9]+)\\.([0-9]+) (.*)" print "sReg = [" sReg "]\n" Regexp r = regexp2 sReg int major1, minor1, major2, minor2 string annot1, annot2 if (r(s1)) { major1 = intOf s1[match 1] minor1 = intOf s1[match 2] annot1 = s1[match 3] } if (r(s2)) { major2 = intOf s2[match 1] minor2 = intOf s2[match 2] annot2 = s2[match 3] } print(major1 "." minor1 " " annot1 "\n") print(major2 "." minor2 " " annot2 "\n") string code = "void modifications(bool b1, b2, int major1, minor1, string annot1, int major2, minor2, string annot2)\n" //- "{ display \"in modifications()\\n\"\n" //- "}\n" //- "//#include \n"//- //This part to declare variables with baseline numbers inside the DXL layout //- "int major1 = " major1 "\n" //- "int major2 = " major2 "\n" //- "int minor1 = " minor1 "\n" //- "int minor2 = " minor2 "\n" //- "string annot1 = \"" annot1 "\"\n" //- "string annot2 = \"" annot2 "\"\n" //- "//modifications(true,false,major1,minor1,\"\",major2,minor2,\"\")\n" //- "modifications(true,false,major1,minor1, annot1,major2,minor2,annot2)\n" ErrMess = checkDXL(code) if (!null ErrMess) { errorBox("Error in DXL Code\n" ErrMess code) } else { print code Column c = insert (column 2) title(c, "System requirements baselines " major1 "." minor1 " and " major2 "." minor2 " comparison") width(c, 300) justify(c, full) dxl(c, code) refresh(m) } } apply(exBox, "Get", get_numbers) show exBox //hide exBox