22 %MACRO _scanHeader (MacroName =
25 ,DataOutDoc = _ProgramHeader
27 ,DataOutPgm = _ProgramCode
29 ,DataOutToDo = _ToDoDoc
31 ,DataOutTest = _TestDoc
37 %LOCAL l_sHeaderStartTag l_sHeaderEndTag;
38 %LET l_sHeaderStartTag = %str(/)%str(** );
39 %LET l_sHeaderEndTag = %str(*)%str(/);
41 Data WORK.__programHeader (keep=macroname tag name description);
46 headerStmtOpen tagStmtOpen 8;
47 Retain headerStmtOpen tagStmtOpen 0
50 ***Compile Perl RegEx with PRXPARSE;
51 patternAuthor = PRXPARSE(
"/^\\author/");
52 patternBrief = PRXPARSE(
"/^\\brief/");
53 patternCopyright = PRXPARSE(
"/^\\copyright/");
54 patternDate = PRXPARSE(
"/^\\date/");
55 patternDetails = PRXPARSE(
"/^\\details/");
56 patternFile = PRXPARSE(
"/^\\file/");
57 patternInGroup = PRXPARSE(
"/^\\ingroup/");
58 patternLink = PRXPARSE(
"/^\\link/");
59 patternParam = PRXPARSE(
"/^\\param/");
60 patternReturn = PRXPARSE(
"/^\\return/");
61 patternRet_Val = PRXPARSE(
"/^\\ret_val/");
62 patternSa = PRXPARSE(
"/^\\sa/");
63 patternTodo = PRXPARSE(
"/^\\todo/");
64 patternTest = PRXPARSE(
"/^\\test/");
65 patternBug = PRXPARSE(
"/^\\bug/");
66 patternRemark = PRXPARSE(
"/^\\remark/");
67 patternVersion = PRXPARSE(
"/^\\version/");
69 pattern =
"/^\\author|\\brief|\\copyright|\\date|\\details|\\file|\\ingroup|\\link|\\param|\\return|\\ret_val|\\sa|\\todo|\\test|\\bug|\\version|\\remark/";
70 patternTag = PRXPARSE(pattern);
71 patternComment = PRXPARSE(
"/\*\//");
74 Infile
"&FilePath.\&MacroName.";
77 *** MacroName
for lists (todo, test, bug) ***;
78 macroname =
"&MacroName.";
80 l_zeile = compbl (left (_INFILE_));
83 if (compress(l_zeile) =
"") then
do;
91 ***Stop scanning
if sHeaderStartEnd is found;
92 If (index(_INFILE_,
"&l_sHeaderEndTag")>0) Then DO;
96 ***Check for tag with more than one line;
97 If((tagStmtOpen = 1 AND PRXMATCH(patternTag, l_zeile) = 1) OR PRXMATCH(patternComment, l_zeile) = 1) Then Do;
99 if (PRXMATCH(patternComment, l_zeile) = 1) then do;
107 ***Start Scanning if sHeaderStartTag is found;
108 If (index(l_zeile, "&l_sHeaderStartTag")>0) Then Do;
110 tagPos = Index(l_zeile, "&l_sHeaderStartTag");
111 l_zeile = Strip(substr(l_zeile, tagPos + length("&l_sHeaderStartTag")));
114 If (headerStmtOpen = 1) Then Do;
115 ***Only Tag on single line: \file;
116 If (PRXMATCH(patternFile, l_zeile) = 1) Then Do;
121 blankPos = Index(l_zeile, ' ');
122 tag = Substr(l_zeile, 1, blankPos);
126 ***Complex tags with more than one line, 2 columns;
127 Else If (PRXMATCH(patternBrief, l_zeile) = 1 OR
128 PRXMATCH(patternCopyright, l_zeile) = 1 OR
129 PRXMATCH(patternDetails, l_zeile) = 1 OR
130 PRXMATCH(patternSa, l_zeile) = 1 OR
131 PRXMATCH(patternTodo, l_zeile) = 1 OR
132 PRXMATCH(patternTest, l_zeile) = 1 OR
133 PRXMATCH(patternBug, l_zeile) = 1 OR
134 PRXMATCH(patternReturn, l_zeile) = 1 OR
135 PRXMATCH(patternRemark, l_zeile) = 1 OR
136 PRXMATCH(patternVersion, l_zeile) = 1 OR
137 PRXMATCH(patternInGroup, l_zeile) = 1 OR
138 PRXMATCH(patternAuthor, l_zeile) = 1 OR
139 PRXMATCH(patternDate, l_zeile) = 1) Then Do;
145 blankPos = Index(l_zeile, ' ');
146 tag = Substr(l_zeile, 1, blankPos);
147 l_zeile = Substr(l_zeile, blankPos+1);
148 description = Strip(l_zeile);
150 ***Complex tags with name and more than one line, 3 columns;
151 Else If (PRXMATCH(patternParam, l_zeile) = 1 OR
152 PRXMATCH(patternRet_val, l_zeile) = 1
159 blankPos = Index(l_zeile, ' ');
160 tag = Substr(l_zeile, 1, blankPos);
161 l_zeile = Substr(l_zeile, blankPos+1);
162 blankPos = Index(l_zeile, ' ');
163 name = Substr(l_zeile, 1, blankPos);
164 l_zeile = Substr(l_zeile, blankPos+1);
165 description = Strip(l_zeile);
167 Else If (tagStmtOpen) then do;
168 description = Strip(l_zeile);
173 data WORK.__programHeader;
174 length new_description $3200;
175 set WORK.__programHeader (where=(not missing(tag)));
177 tag_sort = put (tag, $TagSort.);
178 tag_text = put (tag, $HeaderText_&i_language..);
180 new_description = tranwrd (description, "<b>", "^{style [font_weight=bold]
");
181 new_description = tranwrd (new_description, "</b>
", "}
");
182 new_description = tranwrd (new_description, "<em>
", "^{style [font_style=italic]
");
183 new_description = tranwrd (new_description, "</em>
", "}
");
184 new_description = tranwrd (new_description, "\n
", "^n
");
185 new_description = tranwrd (new_description, "~
", "-
");
186 new_description = tranwrd (new_description, "~
", "^_^_^_
");
189 proc sort data=WORK.__programHeader;
190 by tag_sort obs_sort;
193 proc append base=&LibOutTodo..&DataOutTodo. data=WORK.__programHeader (where=(tag="\todo
"));
196 proc append base=&LibOutTest..&DataOutTest. data=WORK.__programHeader (where=(tag="\test
"));
199 proc append base=&LibOutBug..&DataOutBug. data=WORK.__programHeader (where=(tag="\bug
"));
202 data &LibOutDoc..&DataOutDoc.;
203 set WORK.__programHeader;
204 if (tag="\todo
") then do;
205 new_description ="^{style [background=Bisque]
" !! trim (new_description) !! "}
";
207 if (tag="\test
") then do;
208 new_description ="^{style [background=LightBlue]
" !! trim (new_description) !! "}
";
210 if (tag="\bug
") then do;
211 new_description ="^{style [background=LightCoral]
" !! trim (new_description) !! "}
";
213 if (tag="\remark
") then do;
214 new_description ="^{style [background=LightGreen]
" !! trim (new_description) !! "}
";