Launcher.pm 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. #
  2. # Software Index, Copyright 2010, Software Index Project Team
  3. # Link: http://swi.sourceforge.net
  4. #
  5. # This file is part of Software Index Tool.
  6. #
  7. # Software Index is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Software Index is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Software Index. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. use strict;
  20. use XML::Simple;
  21. use FileHandle;
  22. #
  23. # Export section
  24. #
  25. require Exporter;
  26. use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $PREFERRED_PARSER);
  27. @ISA = qw(Exporter);
  28. @EXPORT = qw(swiLaunch);
  29. @EXPORT_OK = qw();
  30. $VERSION = '1.0';
  31. $PREFERRED_PARSER = undef;
  32. #
  33. # Subroutine for troubleshooting purposes
  34. #
  35. use Internal::Output;
  36. #
  37. # Include SWI libs
  38. #
  39. require SWI::Appraiser;
  40. require SWI::Converter;
  41. require SWI::Merger;
  42. require SWI::Processor;
  43. #
  44. # Global variables
  45. #
  46. my $config = undef;
  47. #
  48. # Enter point
  49. #
  50. sub swiLaunch
  51. {
  52. my $returnCode = 0;
  53. my $rootLocation = shift();
  54. my $swiConfiguration = shift();
  55. # $returnCode == 0 => no critical errors and warnings
  56. # $returnCode > 0 => no critical errors, there are warnings
  57. # $returnCode < 0 => there are critical errors
  58. if ( $returnCode >= 0 )
  59. {
  60. if ( $swiConfiguration eq "" )
  61. {
  62. STATUS("Configuration file should be specified!");
  63. $returnCode = -1;
  64. }
  65. else
  66. {
  67. STATUS("Configuration file: $swiConfiguration.");
  68. }
  69. }
  70. if ( $returnCode >= 0 )
  71. {
  72. if ( swiConfigurationValidate($swiConfiguration) != 0 )
  73. {
  74. STATUS("Wrong configuration file!");
  75. $returnCode = -2;
  76. }
  77. }
  78. if ( $returnCode >= 0 )
  79. {
  80. # Generate report for every module separately
  81. for (
  82. my $i = 0 ;
  83. $i <= $#{ $config->{"swi:modules"}->{"swi:module"} } ;
  84. $i++
  85. )
  86. {
  87. STATUS( "Processing module: '"
  88. . $config->{"swi:modules"}->{"swi:module"}[$i]->{"swi:name"}
  89. . "'." );
  90. my $result = swiProcess( $config, $i, $rootLocation );
  91. if ( $result < 0 )
  92. {
  93. STATUS("The are problems to report the index for the module!");
  94. $returnCode = -5;
  95. }
  96. elsif ( $result > 0 )
  97. {
  98. STATUS("The are scan warnings and/or errors.");
  99. $returnCode = $result;
  100. }
  101. else
  102. {
  103. STATUS("The module has been processed succesfully.");
  104. }
  105. }
  106. }
  107. if ( $returnCode >= 0 )
  108. {
  109. # Merge reports
  110. if ( swiMerge($config) )
  111. {
  112. STATUS("The are problems to merge files to one report!");
  113. $returnCode = -3;
  114. }
  115. else
  116. {
  117. STATUS("Merged report has been created.");
  118. }
  119. }
  120. if ( $returnCode >= 0 )
  121. {
  122. # Add average/min/max/total values and generate final XML report
  123. if ( swiAppraise($config) )
  124. {
  125. STATUS("The are problems to add average/min/max/total values!");
  126. $returnCode = -4;
  127. }
  128. else
  129. {
  130. STATUS("Average/min/max/total values have been added.");
  131. }
  132. }
  133. if ( $returnCode >= 0 )
  134. {
  135. # Convert results
  136. my $result = swiConvert($config);
  137. if ( $result < 0 )
  138. {
  139. STATUS("The are problems to convert the report!");
  140. $returnCode = -5;
  141. }
  142. elsif ( $result > 0 )
  143. {
  144. STATUS(
  145. "Report has been converted. There are exceeded limitations.");
  146. $returnCode = $result;
  147. }
  148. else
  149. {
  150. STATUS("Report has been converted.");
  151. }
  152. }
  153. return $returnCode;
  154. }
  155. sub swiConfigurationValidate
  156. {
  157. my $result = 0;
  158. $config =
  159. XMLin( shift(),
  160. ForceArray => [ "swi:module", "swi:rule", "swi:pattern" ] );
  161. if ( !defined( $config->{'swi:info'} ) )
  162. {
  163. STATUS("Wrong configuration: 'swi:info' section missed.");
  164. $result++;
  165. }
  166. else
  167. {
  168. if ( !defined( $config->{'swi:info'}->{'swi:version'} ) )
  169. {
  170. STATUS(
  171. "Wrong configuration: 'swi:info/swi:version' section missed.");
  172. $result++;
  173. }
  174. elsif ( $config->{'swi:info'}->{'swi:version'} != 1 )
  175. {
  176. STATUS(
  177. "Wrong configuration: Unsupported version of the configuration file. Check 'swi:info/swi:version' section."
  178. );
  179. $result++;
  180. }
  181. if ( !defined( $config->{'swi:info'}->{'swi:project'} ) )
  182. {
  183. STATUS(
  184. "Wrong configuration: 'swi:info/swi:project' section missed.");
  185. $result++;
  186. }
  187. else
  188. {
  189. if (
  190. !defined(
  191. $config->{'swi:info'}->{'swi:project'}->{'swi:name'}
  192. )
  193. )
  194. {
  195. STATUS(
  196. "Wrong configuration: 'swi:info/swi:project/swi:name' section missed."
  197. );
  198. $result++;
  199. }
  200. elsif ( $config->{'swi:info'}->{'swi:project'}->{'swi:name'} eq "" )
  201. {
  202. STATUS(
  203. "Wrong configuration: 'swi:info/swi:project/swi:name' is empty."
  204. );
  205. $result++;
  206. }
  207. }
  208. }
  209. if ( !defined( $config->{'swi:general'} )
  210. || ref( $config->{'swi:general'} ) ne 'HASH' )
  211. {
  212. $config->{'swi:general'} = {};
  213. }
  214. if ( !defined( $config->{'swi:general'}->{'swi:debug'} )
  215. || ref( $config->{'swi:general'}->{'swi:debug'} ) ne 'HASH' )
  216. {
  217. $config->{'swi:general'}->{'swi:debug'} = {};
  218. }
  219. if ( !defined( $config->{'swi:general'}->{'swi:debug'}->{'swi:enabled'} ) )
  220. {
  221. $config->{'swi:general'}->{'swi:debug'}->{'swi:enabled'} = 'off';
  222. }
  223. DEBUG_ENABLED(
  224. ( $config->{'swi:general'}->{'swi:debug'}->{'swi:enabled'} eq 'on' )
  225. ? 1
  226. : 0
  227. );
  228. if ( !defined( $config->{'swi:modules'} )
  229. || ref( $config->{'swi:modules'} ) ne 'HASH' )
  230. {
  231. STATUS("Wrong configuration: 'swi:modules' section missed.");
  232. $result++;
  233. }
  234. else
  235. {
  236. if ( !defined( $config->{'swi:modules'}->{'swi:module'} )
  237. || ref( $config->{'swi:modules'}->{'swi:module'} ) ne 'ARRAY' )
  238. {
  239. STATUS(
  240. "Wrong configuration: 'swi:modules/swi:module' section missed."
  241. );
  242. $result++;
  243. }
  244. else
  245. {
  246. my $moduleId = 0;
  247. foreach my $module ( @{ $config->{'swi:modules'}->{'swi:module'} } )
  248. {
  249. if ( !defined( $module->{'swi:name'} ) )
  250. {
  251. STATUS(
  252. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:name' section missed."
  253. );
  254. $result++;
  255. }
  256. if ( !defined( $module->{'swi:location'} ) )
  257. {
  258. STATUS(
  259. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:location' section missed."
  260. );
  261. $result++;
  262. }
  263. if ( !defined( $module->{'swi:files'} )
  264. || ref( $module->{'swi:files'} ) ne 'HASH' )
  265. {
  266. $module->{'swi:files'} = {};
  267. }
  268. if ( !defined( $module->{'swi:files'}->{'swi:include'} ) )
  269. {
  270. $module->{'swi:files'}->{'swi:include'} = '.*';
  271. }
  272. if ( !defined( $module->{'swi:files'}->{'swi:exclude'} ) )
  273. {
  274. $module->{'swi:files'}->{'swi:exclude'} = '';
  275. }
  276. if ( !defined( $module->{'swi:preprocessor'} )
  277. || ref( $module->{'swi:preprocessor'} ) ne 'HASH' )
  278. {
  279. $module->{'swi:preprocessor'} = {};
  280. }
  281. if ( !defined( $module->{'swi:preprocessor'}->{'swi:rule'} ) )
  282. {
  283. $module->{'swi:preprocessor'}->{'swi:rule'} = [];
  284. }
  285. my $ruleId = 0;
  286. foreach
  287. my $rule ( @{ $module->{'swi:preprocessor'}->{'swi:rule'} } )
  288. {
  289. if ( !defined( $rule->{'swi:filepattern'} )
  290. || $rule->{'swi:filepattern'} eq "" )
  291. {
  292. STATUS(
  293. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:preprocessor/swi:rule[$ruleId]/swi:filepattern' section missed."
  294. );
  295. $result++;
  296. }
  297. if ( !defined( $rule->{'swi:searchpattern'} )
  298. || $rule->{'swi:searchpattern'} eq "" )
  299. {
  300. STATUS(
  301. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:preprocessor/swi:rule[$ruleId]/swi:searchpattern' section missed."
  302. );
  303. $result++;
  304. }
  305. if ( !defined( $rule->{'swi:replacepattern'} )
  306. || $rule->{'swi:replacepattern'} eq "" )
  307. {
  308. STATUS(
  309. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:preprocessor/swi:rule[$ruleId]/swi:replacepattern' section missed."
  310. );
  311. $result++;
  312. }
  313. $ruleId++;
  314. }
  315. if ( !defined( $module->{'swi:scanner'} )
  316. || ref( $module->{'swi:scanner'} ) ne 'HASH' )
  317. {
  318. $module->{'swi:scanner'} = {};
  319. }
  320. if ( !defined( $module->{'swi:scanner'}->{'swi:rule'} ) )
  321. {
  322. $module->{'swi:scanner'}->{'swi:rule'} = [];
  323. }
  324. $ruleId = 0;
  325. foreach my $rule ( @{ $module->{'swi:scanner'}->{'swi:rule'} } )
  326. {
  327. if ( !defined( $rule->{'swi:filepattern'} )
  328. || $rule->{'swi:filepattern'} eq "" )
  329. {
  330. STATUS(
  331. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:scanner/swi:rule[$ruleId]/swi:filepattern' section missed."
  332. );
  333. $result++;
  334. }
  335. if ( !defined( $rule->{'swi:searchpattern'} )
  336. || $rule->{'swi:searchpattern'} eq "" )
  337. {
  338. STATUS(
  339. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:scanner/swi:rule[$ruleId]/swi:searchpattern' section missed."
  340. );
  341. $result++;
  342. }
  343. if ( !defined( $rule->{'swi:messagepattern'} )
  344. || $rule->{'swi:messagepattern'} eq "" )
  345. {
  346. STATUS(
  347. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:scanner/swi:rule[$ruleId]/swi:messagepattern' section missed."
  348. );
  349. $result++;
  350. }
  351. if ( !defined( $rule->{'swi:codecontent'} )
  352. || $rule->{'swi:codecontent'} eq "" )
  353. {
  354. $rule->{'swi:codecontent'} = 'purified';
  355. }
  356. $ruleId++;
  357. }
  358. if ( !defined( $module->{'swi:scanner'}->{'swi:suppress'} ) )
  359. {
  360. $module->{'swi:scanner'}->{'swi:suppress'} = {};
  361. }
  362. if (
  363. !defined(
  364. $module->{'swi:scanner'}->{'swi:suppress'}
  365. ->{'swi:pattern'}
  366. )
  367. )
  368. {
  369. $module->{'swi:scanner'}->{'swi:suppress'}
  370. ->{'swi:pattern'} = [];
  371. }
  372. my $patternId = 0;
  373. foreach my $pattern (
  374. @{
  375. $module->{'swi:scanner'}->{'swi:suppress'}
  376. ->{'swi:pattern'}
  377. }
  378. )
  379. {
  380. if ( ref($pattern) ne 'HASH' )
  381. {
  382. STATUS(
  383. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:scanner/swi:suppress/swi:pattern[$patternId]' section is incorrect."
  384. );
  385. $result++;
  386. }
  387. else
  388. {
  389. if ( !defined( $pattern->{'swi:message'} )
  390. || $pattern->{'swi:message'} eq "" )
  391. {
  392. STATUS(
  393. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:scanner/swi:suppress/swi:pattern[$patternId]/swi:message' field is empty."
  394. );
  395. $result++;
  396. }
  397. if ( !defined( $pattern->{'content'} )
  398. || $pattern->{'content'} eq "" )
  399. {
  400. STATUS(
  401. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:scanner/swi:suppress/swi:pattern[$patternId]' object pattern is empty."
  402. );
  403. $result++;
  404. }
  405. }
  406. $patternId++;
  407. }
  408. if ( !defined( $module->{'swi:indexer:common'} )
  409. || ref( $module->{'swi:indexer:common'} ) ne 'HASH' )
  410. {
  411. $module->{'swi:indexer:common'} = {};
  412. }
  413. if ( !defined( $module->{'swi:indexer:dup'} )
  414. || ref( $module->{'swi:indexer:dup'} ) ne 'HASH' )
  415. {
  416. $module->{'swi:indexer:dup'} = {};
  417. }
  418. if (
  419. !defined(
  420. $module->{'swi:indexer:dup'}->{'swi:codecontent'}
  421. )
  422. )
  423. {
  424. $module->{'swi:indexer:dup'}->{'swi:codecontent'} =
  425. 'purified';
  426. }
  427. if ( !defined( $module->{'swi:indexer:dup'}->{'swi:enabled'} ) )
  428. {
  429. $module->{'swi:indexer:dup'}->{'swi:enabled'} = 'on';
  430. }
  431. if ( !defined( $module->{'swi:indexer:dup'}->{'swi:minlength'} )
  432. )
  433. {
  434. $module->{'swi:indexer:dup'}->{'swi:minlength'} = 100;
  435. }
  436. if ( $module->{'swi:indexer:dup'}->{'swi:minlength'} <= 0 )
  437. {
  438. STATUS(
  439. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:indexer:dup/swi:minlength' can not be less than or equal to zero."
  440. );
  441. $result++;
  442. }
  443. if ( !defined( $module->{'swi:indexer:dup'}->{'swi:proximity'} )
  444. )
  445. {
  446. $module->{'swi:indexer:dup'}->{'swi:proximity'} = 100;
  447. }
  448. if ( $module->{'swi:indexer:dup'}->{'swi:proximity'} <= 0
  449. || $module->{'swi:indexer:dup'}->{'swi:proximity'} > 100 )
  450. {
  451. STATUS(
  452. "Wrong configuration: 'swi:modules/swi:module[$moduleId]/swi:indexer:dup/swi:proximity' should be in the range from 1 till 100."
  453. );
  454. $result++;
  455. }
  456. if (
  457. !defined(
  458. $module->{'swi:indexer:dup'}->{'swi:globalcode'}
  459. )
  460. )
  461. {
  462. $module->{'swi:indexer:dup'}->{'swi:globalcode'} = 'off';
  463. }
  464. if ( !defined( $module->{'swi:indexer:gcov'} )
  465. || ref( $module->{'swi:indexer:gcov'} ) ne 'HASH' )
  466. {
  467. $module->{'swi:indexer:gcov'} = {};
  468. }
  469. if ( !defined( $module->{'swi:indexer:gcov'}->{'swi:enabled'} ) )
  470. {
  471. $module->{'swi:indexer:gcov'}->{'swi:enabled'} = 'off';
  472. }
  473. if ( !defined( $module->{'swi:indexer:gcov'}->{'swi:filepattern'} ) )
  474. {
  475. $module->{'swi:indexer:gcov'}->{'swi:filepattern'} = '.*';
  476. }
  477. if ( !defined( $module->{'swi:indexer:gcov'}->{'swi:sourcefile'} ) )
  478. {
  479. $module->{'swi:indexer:gcov'}->{'swi:sourcefile'} = '(.*)[.][cChH][pP]?[pP]?';
  480. }
  481. if ( !defined( $module->{'swi:indexer:gcov'}->{'swi:gcdafile'} ) )
  482. {
  483. $module->{'swi:indexer:gcov'}->{'swi:gcdafile'} = '${1}.gcda';
  484. }
  485. $moduleId++;
  486. }
  487. }
  488. }
  489. if ( !defined( $config->{'swi:report'} )
  490. || ref( $config->{'swi:report'} ) ne 'HASH' )
  491. {
  492. STATUS("Wrong configuration: 'swi:report' section missed.");
  493. $result++;
  494. }
  495. else
  496. {
  497. if ( !defined( $config->{'swi:report'}->{'swi:destination'} ) )
  498. {
  499. STATUS(
  500. "Wrong configuration: 'swi:report/swi:destination' section missed."
  501. );
  502. $result++;
  503. }
  504. if ( !defined( $config->{'swi:report'}->{'swi:xml'} ) )
  505. {
  506. STATUS("Wrong configuration: 'swi:report/swi:xml' section missed.");
  507. $result++;
  508. }
  509. else
  510. {
  511. if (
  512. !defined( $config->{'swi:report'}->{'swi:xml'}->{'swi:name'} ) )
  513. {
  514. STATUS(
  515. "Wrong configuration: 'swi:report/swi:xml/swi:name' section is empty."
  516. );
  517. $result++;
  518. }
  519. }
  520. if ( !defined( $config->{'swi:report'}->{'swi:notifications'} ) )
  521. {
  522. STATUS(
  523. "Wrong configuration: 'swi:report/swi:notifications' section missed."
  524. );
  525. $result++;
  526. }
  527. else
  528. {
  529. if (
  530. !defined(
  531. $config->{'swi:report'}->{'swi:notifications'}->{'swi:name'}
  532. )
  533. )
  534. {
  535. STATUS(
  536. "Wrong configuration: 'swi:report/swi:notifications/swi:name' section is empty."
  537. );
  538. $result++;
  539. }
  540. if (
  541. !defined(
  542. $config->{'swi:report'}->{'swi:notifications'}
  543. ->{'swi:error'}
  544. )
  545. || ref(
  546. $config->{'swi:report'}->{'swi:notifications'}
  547. ->{'swi:error'}
  548. ) ne 'HASH'
  549. )
  550. {
  551. $config->{'swi:report'}->{'swi:notifications'}->{'swi:error'} =
  552. {};
  553. }
  554. if (
  555. !defined(
  556. $config->{'swi:report'}->{'swi:notifications'}
  557. ->{'swi:error'}->{'swi:added'}
  558. )
  559. )
  560. {
  561. $config->{'swi:report'}->{'swi:notifications'}->{'swi:error'}
  562. ->{'swi:added'} = 'on';
  563. }
  564. if (
  565. !defined(
  566. $config->{'swi:report'}->{'swi:notifications'}
  567. ->{'swi:error'}->{'swi:removed'}
  568. )
  569. )
  570. {
  571. $config->{'swi:report'}->{'swi:notifications'}->{'swi:error'}
  572. ->{'swi:removed'} = 'on';
  573. }
  574. if (
  575. !defined(
  576. $config->{'swi:report'}->{'swi:notifications'}
  577. ->{'swi:error'}->{'swi:modified'}
  578. )
  579. )
  580. {
  581. $config->{'swi:report'}->{'swi:notifications'}->{'swi:error'}
  582. ->{'swi:modified'} = 'on';
  583. }
  584. if (
  585. !defined(
  586. $config->{'swi:report'}->{'swi:notifications'}
  587. ->{'swi:error'}->{'swi:cloned'}
  588. )
  589. )
  590. {
  591. $config->{'swi:report'}->{'swi:notifications'}->{'swi:error'}
  592. ->{'swi:cloned'} = 'on';
  593. }
  594. if (
  595. !defined(
  596. $config->{'swi:report'}->{'swi:notifications'}
  597. ->{'swi:error'}->{'swi:unmodified'}
  598. )
  599. )
  600. {
  601. $config->{'swi:report'}->{'swi:notifications'}->{'swi:error'}
  602. ->{'swi:unmodified'} = 'on';
  603. }
  604. if (
  605. !defined(
  606. $config->{'swi:report'}->{'swi:notifications'}
  607. ->{'swi:print'}
  608. )
  609. || ref(
  610. $config->{'swi:report'}->{'swi:notifications'}
  611. ->{'swi:print'}
  612. ) ne 'HASH'
  613. )
  614. {
  615. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'} =
  616. {};
  617. }
  618. swiUtilConfigFill_PrintSection($config, 'swi:added');
  619. swiUtilConfigFill_PrintSection($config, 'swi:removed');
  620. swiUtilConfigFill_PrintSection($config, 'swi:modified');
  621. swiUtilConfigFill_PrintSection($config, 'swi:cloned');
  622. swiUtilConfigFill_PrintSection($config, 'swi:unmodified');
  623. }
  624. }
  625. # swi:limits section is verified in runtime
  626. # no precheck currently
  627. DEBUG( "Configuration structure is: " . Dumper($config) );
  628. return $result;
  629. }
  630. sub swiUtilConfigFill_PrintSection
  631. {
  632. my $config = shift();
  633. my $modType = shift();
  634. if (
  635. !defined(
  636. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  637. ->{$modType}
  638. )
  639. || ref(
  640. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  641. ->{$modType}
  642. ) ne 'HASH'
  643. )
  644. {
  645. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  646. ->{$modType} = {};
  647. }
  648. if (
  649. !defined(
  650. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  651. ->{$modType}->{'swi:failures'}
  652. )
  653. )
  654. {
  655. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  656. ->{$modType}->{'swi:failures'} = 'on';
  657. }
  658. if (
  659. !defined(
  660. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  661. ->{$modType}->{'swi:modifications'}
  662. )
  663. )
  664. {
  665. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  666. ->{$modType}->{'swi:modifications'} = 'on';
  667. }
  668. if (
  669. !defined(
  670. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  671. ->{$modType}->{'swi:duplications'}
  672. )
  673. )
  674. {
  675. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  676. ->{$modType}->{'swi:duplications'} = 'off';
  677. }
  678. if (
  679. !defined(
  680. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  681. ->{$modType}->{'swi:scanmessages'}
  682. )
  683. )
  684. {
  685. $config->{'swi:report'}->{'swi:notifications'}->{'swi:print'}
  686. ->{$modType}->{'swi:scanmessages'} = 'on';
  687. }
  688. }
  689. return 1;