sourceInsight的CodeReview.em的宏

  1 /* version 1.1.1 */
  2
  3 macro Review_Restore_Link()
  4 {
  5     hbuf = GetCurrentBuf()
  6
  7     sProjRoot = GetProjDir(GetCurrentProj())
  8     sProjRoot = Cat(sProjRoot, "\\")
  9
 10     line = 0
 11     while(True)
 12     {
 13         sel = SearchInBuf(hbuf, "FileName : ", line, 0, 1, 0, 0)
 14         if(sel == "") break
 15
 16         line = sel.lnFirst
 17         col = sel.ichLim
 18         str = GetBufLine(hbuf, line)
 19         fileName = strmid(str, col, strlen(str))
 20         fileName = cat(sProjRoot, fileName)
 21
 22         str = GetBufLine(hbuf, line+1)
 23         lnNumber = strmid(str, 11, strlen(str))
 24         SetSourceLink(hbuf, line + 2, fileName, lnNumber - 1)
 25         line = line+2
 26     }
 27
 28     //updateSummary(hbuf)
 29 }
 30
 31 macro Review_Add_Comment()
 32 {
 33     hbuf = GetCurrentBuf()
 34     curFileName = GetBufName(hbuf)
 35     curFunc = GetCurSymbol()
 36     curLineNumber = GetBufLnCur(hbuf)
 37
 38     sProjRoot = GetProjDir(GetCurrentProj())
 39     nPos = strlen(sProjRoot)
 40     sFileName = strmid(curFileName, nPos+1, strlen(curFileName))
 41     sLocation = cat("Location : ",sFileName);
 42     sFileName = cat( "FileName : ", sFileName )
 43     sLineNumber = cat( "Line     : ", curLineNumber + 1 )
 44     sLocation = cat(sLocation,"/L");
 45     sLocation = cat(sLocation,curLineNumber + 1);
 46
 47     promote = "Defect : D,d(Defect); Q,q(Query)"
 48     sTemp = ask(promote);
 49     sTemp = toupper(sTemp[0]);
 50     while( sTemp != "D" && sTemp != "Q")
 51     {
 52         sTemp = ask(cat("Please input again! ", promote));
 53         sTemp = toupper(sTemp[0]);
 54     }
 55
 56     if( sTemp == "D" ) sTemp = "Defect缺陷";
 57     else if ( sTemp == "Q" ) sTemp = "Query疑问";
 58     sClass = cat("Class    : ",sTemp);
 59
 60     /* get the severity of the current comment */
 61     if(sTemp == "Defect缺陷")
 62     {
 63         promote = "Severity : G,g(General); S,s(Suggest); M,m(Major)"
 64         sTemp = ask(promote);
 65         sTemp = toupper(sTemp[0]);
 66         while( sTemp != "G" && sTemp != "S" && sTemp != "M" )
 67         {
 68             sTemp = ask(cat("Please input again! ", promote));
 69             sTemp = toupper(sTemp[0]);
 70         }
 71
 72         if( sTemp == "G" ) sTemp = "General一般";
 73         else if ( sTemp == "S" ) sTemp = "Suggest提示";
 74         else if ( sTemp == "M" ) sTemp = "Major严重";
 75         sSeverity = cat( "Severity : ", sTemp );
 76         // end of get the severity of the current comment
 77
 78         /* get Categories */
 79         promote = "Categories : S,s(SRS); H,h(HLD); L,l(LLD); T,t(TP); C,c(Code); U,u(Um)"
 80         sTemp = ask(promote);
 81         sTemp = toupper(sTemp[0]);
 82         while( sTemp != "S" && sTemp != "H" && sTemp != "L"
 83             && sTemp != "T" && sTemp != "C" && sTemp != "U")
 84         {
 85             sTemp = ask(cat("Please input again! ", promote));
 86             sTemp = toupper(sTemp[0]);
 87         }
 88
 89         if( sTemp == "S" ) sTemp = "SRS软件需求";
 90         else if ( sTemp == "H" ) sTemp = "HLD概要设计";
 91         else if ( sTemp == "L" ) sTemp = "LLD详细设计";
 92         else if ( sTemp == "T" ) sTemp = "TP测试计划";
 93         else if ( sTemp == "C" ) sTemp = "Code代码";
 94         else if ( sTemp == "U" ) sTemp = "UM用户手册";
 95         sCategories = cat( "Categories : ", sTemp );
 96         //end of get categores
 97
 98         /* get defect type */
 99         promote = "Categories : I,i(接口); F,f(功能); B,b(构建/打包); A,a(赋值); D,d(文档); C,c(校验); L,l(算法); T,t(时序/顺序缺陷); O,o(其它)"
100         sTemp = ask(promote);
101         sTemp = toupper(sTemp[0]);
102         while( sTemp != "I" && sTemp != "F" && sTemp != "B"
103             && sTemp != "A" && sTemp != "D" && sTemp != "C"
104             && sTemp != "L" && sTemp != "T" && sTemp != "O")
105         {
106             sTemp = ask(cat("Please input again! ", promote));
107             sTemp = toupper(sTemp[0]);
108         }
109
110         if( sTemp == "I" ) sTemp = "Interface接口";
111         else if ( sTemp == "F" ) sTemp = "Function功能";
112         else if ( sTemp == "B" ) sTemp = "Build/Package构建/打包";
113         else if ( sTemp == "A" ) sTemp = "Assignment赋值";
114         else if ( sTemp == "D" ) sTemp = "Documentation文档";
115         else if ( sTemp == "C" ) sTemp = "Checking校验";
116         else if ( sTemp == "L" ) sTemp = "aLgorithm算法";
117         else if ( sTemp == "T" ) sTemp = "Timing/Serialization时序/顺序缺陷";
118         else if ( sTemp == "O" ) sTemp = "Others其它";
119         sDefectType = cat( "DefectType : ", sTemp );
120         /* end of get defect type */
121     }
122     else
123     {
124         sTemp = " ";
125         sSeverity = cat( "Severity : ", sTemp );
126         sCategories = cat( "Categories : ", sTemp );
127         sDefectType = cat( "DefectType : ", sTemp );
128     }
129
130     /* get the comment */
131     promote = "Input your comment:"
132     sTemp = ask(promote);
133     sComments = cat( "Comments : ", sTemp );
134
135     /* get the licence user name for the reviewer name */
136     progRecord = GetProgramEnvironmentInfo()
137     sMyName = progRecord.UserName
138
139     /* get the ReviewComment buffer handle */
140     bNewCreated = false; // used for the review comment is firstly created
141     hout = GetBufHandle("ReviewComment.txt")
142     if (hout == hNil)
143     {
144         // No existing Review Comment buffer
145         hout= OpenBuf ("ReviewComment.txt")
146         if( hout == hNil )
147         {
148             /* No existing ReviewComment.txt, then create a new review comment buffer */
149             hout = NewBuf("ReviewComment.txt")
150             NewWnd(hout)
151             bNewCreated = true
152
153             /*----------------------------------------------------------------*/
154             /* Get the owner‘s name from the environment variable: MYNAME.    */
155             /* If the variable doesn‘t exist, then the owner field is skipped.*/
156             /*----------------------------------------------------------------*/
157             AppendBufLine(hout, cat("Reviewer Name : ", sMyName))
158
159             AppendBufLine(hout, "-------------------------------------------------------------------------")
160         }
161     } // end of get ReviewComment buffer handle
162
163     delConver123(hout)
164     delSummary(hout)
165     AppendBufLine(hout, "")
166     AppendBufLine(hout, sFileName)
167     AppendBufLine(hout, sLineNumber)
168     AppendBufLine(hout, sLocation)
169     AppendBufLine(hout, cat("Reviewer : ", sMyName))
170     AppendBufLine(hout, cat("Symbol   : ", curFunc) )
171     AppendBufLine(hout, sCategories)
172     AppendBufLine(hout, sClass)
173     AppendBufLine(hout, sSeverity)
174     AppendBufLine(hout, sDefectType)
175     AppendBufLine(hout, "Status   : Open")
176     AppendBufLine(hout, sComments)
177     AppendBufLine(hout, "Resolve : ")
178     AppendBufLine(hout, "Author : ")
179
180     lnSource = GetBufLineCount(hout) - 11
181     SetSourceLink(hout, lnSource, curFileName, curLineNumber)
182     //updateSummary(hout)
183     if( bNewCreated ) SetCurrentBuf(hbuf)
184     jump_to_link;
185 }
186
187 macro Review_Summary()
188 {
189     hbuf = GetCurrentBuf()
190     updateSummary(hbuf)
191 }
192
193 macro Review_Output_123()
194 {
195     sSign123 = "-----------------------Convert to lotus123 format------------------------------------------------"
196     rvTitle = "it1=\"FileName :\";it2=\"评审人员\t\";it3=\"描述\t\";it4=\"位置\t\";it5=\"问题类型\t\";it6=\"严重级别\t\";it7=\"缺陷来源\t\";it8=\"缺陷类型\t\";it9=\"作者修改说明\t\";it10=\"状态\t\""
197     //rvObj = "it1=\"FileName :\";it2=\"Reviewer :\";it3=\"Comments :\";it4=\"Location :\";it5=\"Class    :\";it6=\"Severity :\";it7=\"Categories :\";it8=\"DefectType :\";it9=\"Resolve :\";it10=\"Status   :\""
198
199     hbuf = GetCurrentBuf()
200
201     delConver123(hbuf)
202
203     AppendBufLine(hbuf, "")
204     AppendBufLine(hbuf, "")
205
206     AppendBufLine(hbuf, sSign123)
207     sOutput = cat(rvTitle.it2,rvTitle.it3)
208     sOutput = cat(sOutput,rvTitle.it4)
209     sOutput = cat(sOutput,rvTitle.it5)
210     sOutput = cat(sOutput,rvTitle.it6)
211     sOutput = cat(sOutput,rvTitle.it7)
212     sOutput = cat(sOutput,rvTitle.it8)
213     sOutput = cat(sOutput,rvTitle.it9)
214     sOutput = cat(sOutput,rvTitle.it10)
215     AppendBufLine(hbuf, sOutput)
216     AppendBufLine(hbuf, "-------------------------------------------------------------------------------------------------")
217
218     ln = 0
219     while (True)
220     {
221         sOutput = ""
222         sel = SearchInBuf(hbuf, "^FileName\\s+:\\s+", ln, 0, 1, 1, 0)
223         if (sel == null) break
224
225         ln = sel.lnFirst
226         col = sel.ichLim
227
228         tpsel = SearchInBuf(hbuf, "^Reviewer\\s+:\\s+", ln, 0, 1, 1, 0)
229         if(tpsel)
230         {
231             tpln = tpsel.lnFirst
232             tpcol = tpsel.ichLim
233             sContent = GetBufLine(hbuf, tpln)
234             if(tpcol < strlen(tpsel))
235                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
236             sOutput = cat(sOutput,"\t")
237         }
238
239         tpsel = SearchInBuf(hbuf, "^Comments\\s+:\\s+", ln, 0, 1, 1, 0)
240         if(tpsel)
241         {
242             tpln = tpsel.lnFirst
243             tpcol = tpsel.ichLim
244             sContent = GetBufLine(hbuf, tpln)
245             if(tpcol < strlen(tpsel))
246                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
247             sOutput = cat(sOutput,"\t")
248         }
249
250         tpsel = SearchInBuf(hbuf, "^Location\\s+:\\s+", ln, 0, 1, 1, 0)
251         if(tpsel)
252         {
253             tpln = tpsel.lnFirst
254             tpcol = tpsel.ichLim
255             sContent = GetBufLine(hbuf, tpln)
256             if(tpcol < strlen(tpsel))
257                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
258             sOutput = cat(sOutput,"\t")
259         }
260
261         tpsel = SearchInBuf(hbuf, "^Class\\s+:\\s+", ln, 0, 1, 1, 0)
262         if(tpsel)
263         {
264             tpln = tpsel.lnFirst
265             tpcol = tpsel.ichLim
266             sContent = GetBufLine(hbuf, tpln)
267             if(tpcol < strlen(tpsel))
268                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
269             sOutput = cat(sOutput,"\t")
270         }
271
272         tpsel = SearchInBuf(hbuf, "^Severity\\s+:\\s+", ln, 0, 1, 1, 0)
273         if(tpsel)
274         {
275             tpln = tpsel.lnFirst
276             tpcol = tpsel.ichLim
277             sContent = GetBufLine(hbuf, tpln)
278             if(tpcol < strlen(tpsel))
279                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
280             sOutput = cat(sOutput,"\t")
281         }
282
283         tpsel = SearchInBuf(hbuf, "^Categories\\s+:\\s+", ln, 0, 1, 1, 0)
284         if(tpsel)
285         {
286             tpln = tpsel.lnFirst
287             tpcol = tpsel.ichLim
288             sContent = GetBufLine(hbuf, tpln)
289             if(tpcol < strlen(tpsel))
290                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
291             sOutput = cat(sOutput,"\t")
292         }
293
294         tpsel = SearchInBuf(hbuf, "^DefectType\\s+:\\s+", ln, 0, 1, 1, 0)
295         if(tpsel)
296         {
297             tpln = tpsel.lnFirst
298             tpcol = tpsel.ichLim
299             sContent = GetBufLine(hbuf, tpln)
300             if(tpcol < strlen(tpsel))
301                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
302             sOutput = cat(sOutput,"\t")
303         }
304
305         tpsel = SearchInBuf(hbuf, "^Resolve\\s+:\\s+", ln, 0, 1, 1, 0)
306         if(tpsel)
307         {
308             tpln = tpsel.lnFirst
309             tpcol = tpsel.ichLim
310             sContent = GetBufLine(hbuf, tpln)
311             if(tpcol < strlen(tpsel))
312                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
313             sOutput = cat(sOutput,"\t")
314         }
315
316         tpsel = SearchInBuf(hbuf, "^Status\\s+:\\s+", ln, 0, 1, 1, 0)
317         if(tpsel)
318         {
319             tpln = tpsel.lnFirst
320             tpcol = tpsel.ichLim
321             sContent = GetBufLine(hbuf, tpln)
322             if(tpcol < strlen(tpsel))
323                 sOutput = cat(sOutput,strmid(sContent, tpcol, strlen(sContent)))
324             sOutput = cat(sOutput,"\t")
325         }
326
327         AppendBufLine(hbuf, sOutput)
328
329         tpsel = SearchInBuf(hbuf, "^Author\\s+:\\s+", ln, 0, 1, 1, 0)
330         if(tpsel)
331             tpln = tpsel.lnFirst
332         else
333             tpln = ln + 9
334
335         ln = tpln + 1
336     }
337
338 }
339
340 macro updateSummary(hbuf)
341 {
342     rvSum0 = getReviewSummary(hbuf)
343     rvSum = "general=\"0\";suggest=\"0\";major=\"0\";query=\"0\";open=\"0\";closed=\"0\";rejected=\"0\";SysReq=\"0\";SDes=\"0\";SRS=\"0\";HLD=\"0\";LLD=\"0\";TP=\"0\";Code=\"0\";Docs=\"0\";Others=\"0\""
344
345     /* summary the severity */
346     ln = 0
347     while (True)
348     {
349         sel = SearchInBuf(hbuf, "^Severity\\s+:\\s+", ln, 0, 1, 1, 0)
350         if (sel == null) break
351
352         ln = sel.lnFirst
353         col = sel.ichLim
354         s = GetBufLine(hbuf, ln)
355         if((col + 1) > strlen(s))
356         {
357             rvSum.query = rvSum.query + 1
358             ln = ln + 1;
359             continue;
360         }
361         sTemp = strmid(s, col, col+1)
362         sTemp = toupper(sTEmp);
363
364         if (sTemp == "G" && norejected(hbuf, ln))
365             rvSum.general = rvSum.general + 1
366         else if (sTemp == "S" && norejected(hbuf, ln))
367             rvSum.suggest = rvSum.suggest + 1
368         else if (sTemp == "M" && norejected(hbuf, ln))
369             rvSum.major = rvSum.major + 1
370
371         ln = ln + 1
372     }
373
374     /* summary the satus */
375     ln = 0
376     while (True)
377     {
378         sel = SearchInBuf(hbuf, "^Status\\s+:\\s+", ln, 0, 1, 1, 0)
379         if (sel == null) break
380
381         ln = sel.lnFirst
382         col = sel.ichLim
383         s = GetBufLine(hbuf, ln)
384         sTemp = strmid(s, col, col+1)
385         sTemp = toupper(sTEmp);
386
387         if (sTemp == "O") rvSum.open = rvSum.open + 1
388         else if (sTemp == "C")    rvSum.closed = rvSum.closed + 1
389         else if (sTemp == "R")    rvSum.rejected = rvSum.rejected + 1
390
391         ln = ln + 1
392     }
393
394     /* summary the categories */
395     ln = 0
396     while (True)
397     {
398         norej = norejected(hbuf, ln);
399         sel = SearchInBuf(hbuf, "^Categories\\s+:\\s+", ln, 0, 1, 1, 0)
400         if (sel == null) break
401
402         ln = sel.lnFirst
403         col = sel.ichLim
404         s = GetBufLine(hbuf, ln)
405         if ( (col+2 > strlen(s)) && IsDefect(hbuf, ln))
406         {
407             msg("Please write categories!")
408             return
409         }
410         if((col + 2) > strlen(s))
411             sTemp = "OT"
412         else
413             sTemp = strmid(s, col, col+2)
414         sTemp = toupper(sTEmp);
415
416         if (sTemp == "SY" && norej) rvSum.SysReq = rvSum.SysReq + 1
417         else if (sTemp == "SD" && norej)    rvSum.SDes = rvSum.SDes + 1
418         else if (sTemp == "SR" && norej)    rvSum.SRS = rvSum.SRS + 1
419         else if (sTemp == "HL" && norej)    rvSum.HLD = rvSum.HLD + 1
420         else if (sTemp == "LL" && norej)    rvSum.LLD = rvSum.LLD + 1
421         else if (sTemp == "TP" && norej)    rvSum.TP = rvSum.TP + 1
422         else if (sTemp == "CO" && norej)    rvSum.Code = rvSum.Code + 1
423         else if (sTemp == "UM" && norej)    rvSum.Docs = rvSum.Docs + 1
424         else if (sTemp == "OT" && norej)    rvSum.Others = rvSum.Others + 1
425
426         ln = ln + 1
427     }
428
429     if ( rvSum.general == rvSum0.general && rvSum.suggest == rvSum0.suggest && rvSum.major == rvSum0.major &&
430           rvSum.query == rvSum0.query && rvSum.open == rvSum0.open &&
431           rvSum.closed == rvSum0.closed && rvSum.rejected == rvSum0.rejected  &&
432           rvSum.SysReq == rvSum0.SysReq && rvSum.SDes == rvSum0.SDes &&
433           rvSum.SRS == rvSum0.SRS && rvSum.HLD == rvSum0.HLD &&
434           rvSum.LLD == rvSum0.LLD && rvSum.TP == rvSum0.TP &&
435           rvSum.Code == rvSum0.Code && rvSum.Docs == rvSum0.Docs &&
436           rvSum.Others == rvSum0.Others )
437         return
438     else
439     {
440         delSummary(hbuf)
441         setReviewSummary(hbuf, rvSum)
442     }
443 }
444
445 macro getReviewSummary(hbuf)
446 {
447     sel = SearchInBuf(hbuf, "^Summary$", 0, 0, 1, 1, 0)
448     rvSum = "general=\"0\";suggest=\"0\";major=\"0\";query=\"0\";open=\"0\";closed=\"0\";rejected=\"0\";SysReq=\"0\";SDes=\"0\";SRS=\"0\";HLD=\"0\";LLD=\"0\";TP=\"0\";Code=\"0\";Docs=\"0\";Others=\"0\""
449
450     if (sel == null)
451         return rvSum
452
453     /* get severity summary */
454     ln = sel.lnFirst + 2
455     sel = SearchInBuf(hbuf, "^General\\s+=\\s+", ln, 0, 1, 1, 0)
456     col = sel.ichLim
457     sLine = GetBufLine(hbuf, sel.lnFirst)
458     rvSum.general = strmid(sLine, col, strlen(sLine))
459
460     sel = SearchInBuf(hbuf, "^Suggest\\s+=\\s+", ln, 0, 1, 1, 0)
461     col = sel.ichLim
462     sLine = GetBufLine(hbuf, sel.lnFirst)
463     rvSum.suggest = strmid(sLine, col, strlen(sLine))
464
465     sel = SearchInBuf(hbuf, "^Major\\s+=\\s+", ln, 0, 1, 1, 0)
466     col = sel.ichLim
467     sLine = GetBufLine(hbuf, sel.lnFirst)
468     rvSum.major = strmid(sLine, col, strlen(sLine))
469
470     sel = SearchInBuf(hbuf, "^Query\\s+=\\s+", ln, 0, 1, 1, 0)
471     col = sel.ichLim
472     sLine = GetBufLine(hbuf, sel.lnFirst)
473     rvSum.query = strmid(sLine, col, strlen(sLine))
474
475     /* get status summary */
476     sel = SearchInBuf(hbuf, "^Open\\s+=\\s+", ln, 0, 1, 1, 0)
477     col = sel.ichLim
478     sLine = GetBufLine(hbuf, sel.lnFirst)
479     rvSum.open = strmid(sLine, col, strlen(sLine))
480
481     sel = SearchInBuf(hbuf, "^Closed\\s+=\\s+", ln, 0, 1, 1, 0)
482     col = sel.ichLim
483     sLine = GetBufLine(hbuf, sel.lnFirst)
484     rvSum.closed = strmid(sLine, col, strlen(sLine))
485
486     sel = SearchInBuf(hbuf, "^Rejected\\s+=\\s+", ln, 0, 1, 1, 0)
487     col = sel.ichLim
488     sLine = GetBufLine(hbuf, sel.lnFirst)
489     rvSum.rejected = strmid(sLine, col, strlen(sLine))
490
491     /* get categories summary */
492     sel = SearchInBuf(hbuf, "^SysReq\\s+=\\s+", ln, 0, 1, 1, 0)
493     col = sel.ichLim
494     sLine = GetBufLine(hbuf, sel.lnFirst)
495     rvSum.SysReq = strmid(sLine, col, strlen(sLine))
496
497     sel = SearchInBuf(hbuf, "^SDes\\s+=\\s+", ln, 0, 1, 1, 0)
498     col = sel.ichLim
499     sLine = GetBufLine(hbuf, sel.lnFirst)
500     rvSum.SDes = strmid(sLine, col, strlen(sLine))
501
502     sel = SearchInBuf(hbuf, "^SRS\\s+=\\s+", ln, 0, 1, 1, 0)
503     col = sel.ichLim
504     sLine = GetBufLine(hbuf, sel.lnFirst)
505     rvSum.SRS = strmid(sLine, col, strlen(sLine))
506
507     sel = SearchInBuf(hbuf, "^HLD\\s+=\\s+", ln, 0, 1, 1, 0)
508     col = sel.ichLim
509     sLine = GetBufLine(hbuf, sel.lnFirst)
510     rvSum.HLD = strmid(sLine, col, strlen(sLine))
511
512     sel = SearchInBuf(hbuf, "^LLD\\s+=\\s+", ln, 0, 1, 1, 0)
513     col = sel.ichLim
514     sLine = GetBufLine(hbuf, sel.lnFirst)
515     rvSum.LLD = strmid(sLine, col, strlen(sLine))
516
517     sel = SearchInBuf(hbuf, "^TP\\s+=\\s+", ln, 0, 1, 1, 0)
518     col = sel.ichLim
519     sLine = GetBufLine(hbuf, sel.lnFirst)
520     rvSum.TP = strmid(sLine, col, strlen(sLine))
521
522     sel = SearchInBuf(hbuf, "^Code\\s+=\\s+", ln, 0, 1, 1, 0)
523     col = sel.ichLim
524     sLine = GetBufLine(hbuf, sel.lnFirst)
525     rvSum.Code = strmid(sLine, col, strlen(sLine))
526
527     sel = SearchInBuf(hbuf, "^UM\\s+=\\s+", ln, 0, 1, 1, 0)
528     col = sel.ichLim
529     sLine = GetBufLine(hbuf, sel.lnFirst)
530     rvSum.Docs = strmid(sLine, col, strlen(sLine))
531
532     sel = SearchInBuf(hbuf, "^Others\\s+=\\s+", ln, 0, 1, 1, 0)
533     col = sel.ichLim
534     sLine = GetBufLine(hbuf, sel.lnFirst)
535     rvSum.Others = strmid(sLine, col, strlen(sLine))
536
537     return rvSum
538 }
539
540 macro setReviewSummary(hbuf, rvSum)
541 {
542     AppendBufLine(hbuf, "")
543     AppendBufLine(hbuf, "Summary")
544     AppendBufLine(hbuf, "-------------------------------------------------------------------------")
545
546     /* Defects sumary */
547     AppendBufLine(hbuf, "[Defects sumary]:")
548     s = Cat("Total defects = ", rvSum.general + rvSum.suggest + rvSum.major + rvSum.query)
549     AppendBufLine(hbuf, s)
550     s = Cat("General = ", rvSum.general)
551     AppendBufLine(hbuf, s)
552     s = Cat("Suggest = ", rvSum.suggest)
553     AppendBufLine(hbuf, s)
554     s = Cat("Major = ", rvSum.major)
555     AppendBufLine(hbuf, s)
556     s = Cat("Query = ", rvSum.query)
557     AppendBufLine(hbuf, s)
558
559     /* Status sumary */
560     AppendBufLine(hbuf, "")
561     AppendBufLine(hbuf, "[Status sumary]:")
562     s = Cat("Open = ", rvSum.open)
563     AppendBufLine(hbuf, s)
564     s = Cat("Closed = ", rvSum.closed)
565     AppendBufLine(hbuf, s)
566     s = " ";
567     AppendBufLine(hbuf, s)
568     s = Cat("Rejected = ", rvSum.rejected)
569     AppendBufLine(hbuf, s)
570
571     /* Categories summary */
572     AppendBufLine(hbuf, "")
573     AppendBufLine(hbuf, "[Defects categories]:")
574     s = Cat("Total defects = ", rvSum.SysReq + rvSum.SDes + rvSum.SRS + rvSum.HLD + rvSum.LLD + rvSum.TP + rvSum.Code + rvSum.Docs + rvSum.Others)
575     AppendBufLine(hbuf, s)
576     s = Cat("SysReq = ", rvSum.SysReq)
577     AppendBufLine(hbuf, s)
578     s = Cat("SDes = ", rvSum.SDes)
579     AppendBufLine(hbuf, s)
580     s = Cat("SRS = ", rvSum.SRS)
581     AppendBufLine(hbuf, s)
582     s = Cat("HLD = ", rvSum.HLD)
583     AppendBufLine(hbuf, s)
584     s = Cat("LLD = ", rvSum.LLD)
585     AppendBufLine(hbuf, s)
586     s = Cat("TP = ", rvSum.TP)
587     AppendBufLine(hbuf, s)
588     s = Cat("Code = ", rvSum.Code)
589     AppendBufLine(hbuf, s)
590     s = Cat("UM = ", rvSum.Docs)
591     AppendBufLine(hbuf, s)
592     s = Cat("Others = ", rvSum.Others)
593     AppendBufLine(hbuf, s)
594 }
595
596 macro delSummary(hbuf)
597 {
598     sSign123 = "-----------------------Convert to lotus123 format-----------------------------------"
599
600     sel = SearchInBuf(hbuf, "^Summary$", 0, 0, 1, 1, 0)
601     tpsel = SearchInBuf(hbuf, sSign123, 0, 0, 1, 1, 0)
602     if(tpsel == null)
603         tpln = 0
604     else
605         tpln = tpsel.lnFirst
606
607     if (sel == null)
608         return
609     else
610     {
611         ln = sel.lnFirst
612         LineCount = GetBufLineCount(hbuf) - 1
613
614         if(tpln > ln)
615             LineCount = tpln - 1
616
617         while(LineCount >= ln)
618         {
619             DelBufLine(hbuf, LineCount)
620             LineCount = LineCount -1;
621         }
622     }
623 }
624
625 macro delConver123(hbuf)
626 {
627     sSign123 = "-----------------------Convert to lotus123 format-----------------------------------"
628
629     tpsel = SearchInBuf(hbuf, "^Summary$", 0, 0, 1, 1, 0)
630     sel = SearchInBuf(hbuf, sSign123, 0, 0, 1, 1, 0)
631     if(tpsel == null)
632         tpln = 0
633     else
634         tpln = tpsel.lnFirst
635
636     if (sel == null)
637         return
638     else
639     {
640         ln = sel.lnFirst
641         LineCount = GetBufLineCount(hbuf) - 1
642
643         if(tpln > ln)
644             LineCount = tpln - 1
645
646         while(LineCount >= (ln - 2))
647         {
648             DelBufLine(hbuf, LineCount)
649             LineCount = LineCount -1;
650         }
651     }
652 }
653
654 macro norejected(hbuf, ln)
655 {
656     sel = SearchInBuf(hbuf, "^Status\\s+:\\s+", ln, 0, 1, 1, 0)
657     if (sel == null) return True;
658
659     ln = sel.lnFirst
660     col = sel.ichLim
661     s = GetBufLine(hbuf, ln)
662     sTemp = strmid(s, col, col+1)
663     sTemp = toupper(sTEmp);
664
665     if (sTemp == "R") return  False;
666
667     return True;
668 }
669
670 macro IsDefect(hbuf, ln)
671 {
672     sel = SearchInBuf(hbuf, "^Class\\s+:\\s+", ln, 0, 1, 1, 0)
673     if (sel == null) return True;
674
675     ln = sel.lnFirst
676     col = sel.ichLim
677     s = GetBufLine(hbuf, ln)
678     sTemp = strmid(s, col, col+1)
679     sTemp = toupper(sTEmp);
680
681     if (sTemp == "Q") return  False;
682
683     return True;
684 }
时间: 2024-10-24 03:11:41

sourceInsight的CodeReview.em的宏的相关文章

quicker+.em SourceInsight 宏加强版制作

这两天苦于新建的文件每次都要手动添加文件头,新建的函数每次都要手动添加函数说明,连.h也要手动生成.于是乎,上网搜了搜,发现了lushengwen写的一个神器:quicker.em .好家伙,有了这个东东,再也不用繁琐的手工敲咯~~~ 具体用法,大伙可以参考:http://blog.csdn.net/ghostyu/article/details/7091915 可是问题来了,我发现下面这个东东: /************************************************

SourceInsight宏插件3(非常好用,强力推荐)

openfolder.em源码:(链接:https://pan.baidu.com/s/1draaimWzCHZ3vLxL--lfiQ  提取码:zyq4) //使用资源管理器打开当前文件所在文件夹,并个高亮选中当前文件 推荐快捷键 ctrl+D macro ToExplorerFolder() //Alt+D { buf = GetCurrentBuf(); curFilePath = GetBufName(buf); cmdLine = "explorer.exe /select,@[ema

SourceInsight宏插件2(非常好用,强力推荐)

Quicker宏在SI中的使用方法(下载地址:链接:https://pan.baidu.com/s/1LzTeoSeXGCLlWieuGjeKkQ 提取码:5ewr) Quicker宏的添加到SI中配置方法: 1. 运行SI,打开Base工程,如果没有该工程,则生成它,将Quicker.em加入到工程中 2. 安装触发热键和菜单,打开SI的Options的Key Assignments菜单,在Command窗口中选择Macro: AutoExpand然后对其赋一个热键,例如Ctrl Enter

SourceInsight中 加namespace宏后,无法跳转问题解决

Option->preferences->languages: C++ language->special, checked Ignore namespace declarations. 详见:http://www.sourceinsight.com/docs35/ad919334.htm Special Language Options When you click the Special button in the Preferences: Languages dialog box,

非常适用的Sourceinsight插件,提高效率【强力推荐】

转自:http://www.cnblogs.com/heiyue/p/6225975.html 一直使用sourceinsight编辑C/C++代码,sourceinsight是一个非常好用的编辑工具可以任意定位,跳转,回退,本人一直 使用该工具做C/C++开发,sourceinsight能够满足我的大部分需求,但是有些功能没有总觉得是一个缺憾.本文将补充这些非常好用的功能. <1>.使用快捷键注释,单行注释,多行注释,#if 0注释 <2>.跳转到当前文件所在的文件夹,并高亮选择

搞定SourceInsight的半个汉字的问题

搞定SourceInsight的半个汉字的问题 "SourceInsight是一个面向项目开发的程序编辑器和代码浏览器,它拥有内置的对C/C++, C#和Java等程序的分析.SourceInsight能分析你的源代码并在你工作的同时动态维护它自己的符号数据库,并自动为你显示有用的上下文信息.SourceInsight不仅仅是一个强大的程序编辑器,它还能显示reference trees,class inheritance diagrams和call trees.SourceInsight提供了

source insight自定义宏脚本

1 /* 获取当前的文件名*/ 2 macro wcjFileName() 3 { 4 hbuf = GetCurrentBuf() 5 6 fullname = GetBufName(hbuf) 7 length = strlen(fullname) 8 if (length == 0) 9 return "" 10 11 index = length 12 while ("\\" != fullname[--index]); 13 14 purename = &

sourceinsight安装记录

此文章为本人使用sourceinsight一个星期之后的相关设置步骤记录和经验记录,以备以后查验,网上的相关资料都也较为完善,但是对于新手还是有一定困难的,所以在这里记录下之前遇到的一些问题和困惑的地方,方便大家上手! 2013-09-11  22:21:21 sourceinsight下载网址:http://www.sourceinsight.com/update.html 注:source insight有英文界面,也有中文(新加坡代理)界面,中文界面的软件版本落后于英文界面,建议大家直接g

const常量与宏定义区别

(1) 编译器处理方式不同 define宏是在预处理阶段展开. const常量是编译运行阶段使用. (2) 类型和安全检查不同 define宏没有类型,不做任何类型检查,仅仅是展开. const常量有具体的类型,在编译阶段会执行类型检查. (3) 存储方式不同 define宏仅仅是展开,有多少地方使用,就展开多少次,不会分配内存. const常量会在内存中分配(可以是堆中也可以是栈中). (4)const  可以节省空间,避免不必要的内存分配. 例如: #define PI 3.14159 //