1cdf0e10cSrcweir:
2cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}'
3cdf0e10cSrcweir    if 0;
4cdf0e10cSrcweir
5*7e90fac2SAndrew Rist#**************************************************************
6*7e90fac2SAndrew Rist#
7*7e90fac2SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
8*7e90fac2SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
9*7e90fac2SAndrew Rist#  distributed with this work for additional information
10*7e90fac2SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
11*7e90fac2SAndrew Rist#  to you under the Apache License, Version 2.0 (the
12*7e90fac2SAndrew Rist#  "License"); you may not use this file except in compliance
13*7e90fac2SAndrew Rist#  with the License.  You may obtain a copy of the License at
14*7e90fac2SAndrew Rist#
15*7e90fac2SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
16*7e90fac2SAndrew Rist#
17*7e90fac2SAndrew Rist#  Unless required by applicable law or agreed to in writing,
18*7e90fac2SAndrew Rist#  software distributed under the License is distributed on an
19*7e90fac2SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20*7e90fac2SAndrew Rist#  KIND, either express or implied.  See the License for the
21*7e90fac2SAndrew Rist#  specific language governing permissions and limitations
22*7e90fac2SAndrew Rist#  under the License.
23*7e90fac2SAndrew Rist#
24*7e90fac2SAndrew Rist#**************************************************************
25*7e90fac2SAndrew Rist
26*7e90fac2SAndrew Rist
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir#*****************************************************************************************
30cdf0e10cSrcweir# ASCII parser for the changeover of the current build.lst files to XML files            *
31cdf0e10cSrcweir# programmer: Pascal Junck, Sun Microsystems GmbH                                        *
32cdf0e10cSrcweir#*****************************************************************************************
33cdf0e10cSrcweir
34cdf0e10cSrcweir# this is the first step for the changeover of the current 'build.lst' files to the new
35cdf0e10cSrcweir# 'build.xlist'(XML) files
36cdf0e10cSrcweir# before we create the new ones we have to parse all important informations from the old files
37cdf0e10cSrcweir# important parameters are:
38cdf0e10cSrcweir# 1. 'module name'
39cdf0e10cSrcweir# 2. 'module dependency names'
40cdf0e10cSrcweir# 3. 'dependency type'
41cdf0e10cSrcweir# 4. 'job dir'
42cdf0e10cSrcweir# 5. 'depending directories'
43cdf0e10cSrcweir# 6. 'job platform'(only: 'w', 'u', 'm' and 'all')
44cdf0e10cSrcweir# 7. 'job'(only: 'nmake' means 'make')
45cdf0e10cSrcweir# 8. 'build requirements'(here called: 'restrictions')
46cdf0e10cSrcweir
47cdf0e10cSrcweir
48cdf0e10cSrcweir#################################  begin of main   #######################################
49cdf0e10cSrcweir
50cdf0e10cSrcweiruse strict;
51cdf0e10cSrcweiruse lib ("/home/vg119683/work/modules");
52cdf0e10cSrcweir
53cdf0e10cSrcweiruse XMLBuildListParser;
54cdf0e10cSrcweir
55cdf0e10cSrcweir# get and work with each argument(build.lst files) of the commando line
56cdf0e10cSrcweir# e.g. if the user wants to parse the build.lst file(s):
57cdf0e10cSrcweir#   user input (on unix) for all modules    : 'perl -w ascii_parser.pl /so/ws/SRC680/src.m42/*/prj/build.lst'
58cdf0e10cSrcweir#   user input (on windows) for one module  : 'perl -w ascii_parser.pl O:/SRC680/src.m42/[module]/prj/build.lst'
59cdf0e10cSrcweir# get all arguments (build.lst files) of the commando line in this global variable '@buildlist_files'
60cdf0e10cSrcweirmy @buildlist_files = @ARGV;
61cdf0e10cSrcweir# global variable for each file name that we want to parse in ASCII
62cdf0e10cSrcweirmy $parse_file = "";
63cdf0e10cSrcweir# set the global variable '$debug' (= 1) to see all results on the terminal,
64cdf0e10cSrcweir# else (= 0) it shows nothing of the working output!
65cdf0e10cSrcweirmy $debug = 0;
66cdf0e10cSrcweir
67cdf0e10cSrcweir# open the filehandle 'ERROR_LOG' for all errors
68cdf0e10cSrcweiropen (ERROR_LOG, ">>ascii_parse.log")
69cdf0e10cSrcweir  or die "Error. Open the file <ascii_parse.log> wasn't successful!\n\n";
70cdf0e10cSrcweir
71cdf0e10cSrcweir# reference of the instance of a new object
72cdf0e10cSrcweirmy $XMLTree;
73cdf0e10cSrcweir
74cdf0e10cSrcweirforeach (@buildlist_files)
75cdf0e10cSrcweir{
76cdf0e10cSrcweir   # get each element (= module) in '$parse_file'
77cdf0e10cSrcweir   $parse_file = $_;
78cdf0e10cSrcweir
79cdf0e10cSrcweir   # open the filehandle 'PARSE_ASCII' for each module/file that we want to parse
80cdf0e10cSrcweir   open (PARSE_ASCII, $parse_file)
81cdf0e10cSrcweir     or die "Error. Open the module <$parse_file> wasn't successful!\n\n";
82cdf0e10cSrcweir
83cdf0e10cSrcweir   # create a new object
84cdf0e10cSrcweir   $XMLTree = XMLBuildListParser->new();
85cdf0e10cSrcweir
86cdf0e10cSrcweir   # invoking of the main subroutine
87cdf0e10cSrcweir   reading_file();
88cdf0e10cSrcweir
89cdf0e10cSrcweir   # is the file name 'build.lst' in the path on the command line?
90cdf0e10cSrcweir   # if not, we can not parse and create the new 'build.xlist' file
91cdf0e10cSrcweir   if ($parse_file =~ /build(\w+)?\.lst\S*$/)
92cdf0e10cSrcweir   {
93cdf0e10cSrcweir      my $path = $parse_file;
94cdf0e10cSrcweir
95cdf0e10cSrcweir      $path =~ s/build(\w+)?\.lst\S*$/build\.xlist/;
96cdf0e10cSrcweir
97cdf0e10cSrcweir      $XMLTree->saveXMLFile($path);
98cdf0e10cSrcweir   }
99cdf0e10cSrcweir   else
100cdf0e10cSrcweir   {
101cdf0e10cSrcweir      add_errorlog_no_buildlst_file_found_statement($parse_file);
102cdf0e10cSrcweir   }
103cdf0e10cSrcweir
104cdf0e10cSrcweir   # close the current $parse_file
105cdf0e10cSrcweir   close(PARSE_ASCII);
106cdf0e10cSrcweir
107cdf0e10cSrcweir}
108cdf0e10cSrcweir# after all files were read close the errorlog file
109cdf0e10cSrcweirclose(ERROR_LOG);
110cdf0e10cSrcweir
111cdf0e10cSrcweir
112cdf0e10cSrcweir###########################  begin of subroutines  #####################################
113cdf0e10cSrcweir#
114cdf0e10cSrcweir#                       global used variable: $parse_file
115cdf0e10cSrcweir#
116cdf0e10cSrcweir########################################################################################
117cdf0e10cSrcweir
118cdf0e10cSrcweir
119cdf0e10cSrcweir########################################################################################
120cdf0e10cSrcweir#       sub: reading_file
121cdf0e10cSrcweir#      gets: $_ (current file)
122cdf0e10cSrcweir#   returns: -
123cdf0e10cSrcweir########################################################################################
124cdf0e10cSrcweirsub reading_file
125cdf0e10cSrcweir{
126cdf0e10cSrcweir   # variable for the name of the current module
127cdf0e10cSrcweir   my $module_name = "";
128cdf0e10cSrcweir
129cdf0e10cSrcweir   # hashes for the infos beginning at the second line of the build.lst files
130cdf0e10cSrcweir   my %dir_of_job_platform = ();
131cdf0e10cSrcweir   my %dir_of_alias = ();
132cdf0e10cSrcweir
133cdf0e10cSrcweir   # control variable for the module dependency line of the file
134cdf0e10cSrcweir   #   like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42)
135cdf0e10cSrcweir   #   "sa      sal     :       xml2cmp NULL"
136cdf0e10cSrcweir   my $module_dependency_line_exists = 0;
137cdf0e10cSrcweir   my $module_dependency_line_was_read = 0;
138cdf0e10cSrcweir
139cdf0e10cSrcweir   # this line variables are for checking that all lines will be read
140cdf0e10cSrcweir   # counts each line
141cdf0e10cSrcweir   my $line_number = 0;
142cdf0e10cSrcweir   # for the sum of the informative lines (='module dependency line' and 'nmake' lines of the file)
143cdf0e10cSrcweir   my $info_line_sum = 0;
144cdf0e10cSrcweir   # for the sum of the no-info lines, like:
145cdf0e10cSrcweir   # job lines: 'usr1', 'get', ... and comment lines: '# ...' or empty lines
146cdf0e10cSrcweir   my $no_info_line_sum = 0;
147cdf0e10cSrcweir
148cdf0e10cSrcweir   # read all lines of the file to resolve the first alias
149cdf0e10cSrcweir   # with the matching dir to know all aliases and directories
150cdf0e10cSrcweir   # at the later second file reading
151cdf0e10cSrcweir   while (<PARSE_ASCII>)
152cdf0e10cSrcweir   {
153cdf0e10cSrcweir      # the variable for each line of a file
154cdf0e10cSrcweir      my $line = $_;
155cdf0e10cSrcweir
156cdf0e10cSrcweir      # count each line for more exact error descriptions in the log file
157cdf0e10cSrcweir      $line_number += 1;
158cdf0e10cSrcweir
159cdf0e10cSrcweir      # remember it, if this line exists
160cdf0e10cSrcweir      if ( (is_module_dependency_line($line)) && ($module_dependency_line_exists == 0) )
161cdf0e10cSrcweir      {
162cdf0e10cSrcweir         $module_dependency_line_exists = 1;
163cdf0e10cSrcweir
164cdf0e10cSrcweir         # get the name of the current module
165cdf0e10cSrcweir         $module_name = get_module_name($line);
166cdf0e10cSrcweir      }
167cdf0e10cSrcweir
168cdf0e10cSrcweir      # skip all lines, that hasn't the job 'nmake'
169cdf0e10cSrcweir      next if (!(is_nmake_line($line)));
170cdf0e10cSrcweir
171cdf0e10cSrcweir      # check that the infos (job directory, job platform and alias) exist
172cdf0e10cSrcweir      if (my ($job_dir, $job_platform, $alias) = get_alias_resolving_infos($line))
173cdf0e10cSrcweir      {
174cdf0e10cSrcweir         # prove that it's a valid job_platform
175cdf0e10cSrcweir         # and that each first alias and matching job platform exists only once
176cdf0e10cSrcweir         check_alias_and_job_platform($job_dir, $job_platform, $alias, \%dir_of_job_platform,
177cdf0e10cSrcweir                                      \%dir_of_alias, $module_name, $line_number);
178cdf0e10cSrcweir      }
179cdf0e10cSrcweir      else
180cdf0e10cSrcweir      {
181cdf0e10cSrcweir         chomp;
182cdf0e10cSrcweir         add_errorlog_unknown_format_statement($line, $module_name, $line_number);
183cdf0e10cSrcweir         next;
184cdf0e10cSrcweir      }
185cdf0e10cSrcweir   }
186cdf0e10cSrcweir   # reset the $line_number, because we count it again
187cdf0e10cSrcweir   $line_number = 0;
188cdf0e10cSrcweir
189cdf0e10cSrcweir   # read the same file again
190cdf0e10cSrcweir   seek (PARSE_ASCII,0,0);
191cdf0e10cSrcweir
192cdf0e10cSrcweir   # read each line of the file for all other informations
193cdf0e10cSrcweir   # e.g. line 8 of module 'sal'
194cdf0e10cSrcweir   # "sa  sal\systools\win32\guistdio  nmake  -     n          sa_guistdio     sa_uwinapi.n          NULL"
195cdf0e10cSrcweir   #             $job_dir              $job     $job_platform   1.$alias   2.$alias + alias platform
196cdf0e10cSrcweir   while (<PARSE_ASCII>)
197cdf0e10cSrcweir   {
198cdf0e10cSrcweir      # the variable for each line of a file
199cdf0e10cSrcweir      my $line = $_;
200cdf0e10cSrcweir
201cdf0e10cSrcweir      # count each line to check at the end of the file that all lines were read
202cdf0e10cSrcweir      # and for more exact error descriptions in the log file
203cdf0e10cSrcweir      $line_number += 1;
204cdf0e10cSrcweir
205cdf0e10cSrcweir      # is it a 'nmake' or a 'module dependency' line?
206cdf0e10cSrcweir      # if not: print this line to STDOUT,
207cdf0e10cSrcweir      #         count one to the no-info lines,
208cdf0e10cSrcweir      #         try to get the information about the module name from this line
209cdf0e10cSrcweir      #         and skip the line
210cdf0e10cSrcweir      if ( (!(is_nmake_line($line))) && (!(is_module_dependency_line($line))) )
211cdf0e10cSrcweir      {
212cdf0e10cSrcweir         my $no_info_line = show_no_info_line($line, $line_number);
213cdf0e10cSrcweir
214cdf0e10cSrcweir         $no_info_line_sum += $no_info_line;
215cdf0e10cSrcweir
216cdf0e10cSrcweir         # if no module dependency line exists get the name of the current module from another line
217cdf0e10cSrcweir         $module_name = get_module_name($line) if (!($module_name));
218cdf0e10cSrcweir
219cdf0e10cSrcweir         # skip the no-info line
220cdf0e10cSrcweir         next;
221cdf0e10cSrcweir      }
222cdf0e10cSrcweir
223cdf0e10cSrcweir      # only if the module dependency line exists and it wasn't read get the infos about it
224cdf0e10cSrcweir      if ( ($module_dependency_line_exists) && (!($module_dependency_line_was_read)) )
225cdf0e10cSrcweir      {
226cdf0e10cSrcweir         ($module_dependency_line_was_read, $info_line_sum) = get_module_dependency_line_infos
227cdf0e10cSrcweir                                                              ($line, $module_name, $line_number);
228cdf0e10cSrcweir      }
229cdf0e10cSrcweir
230cdf0e10cSrcweir      # get all 'nmake' line infos
231cdf0e10cSrcweir      my $info_line = get_nmake_line_infos($line, \%dir_of_alias, \%dir_of_job_platform,
232cdf0e10cSrcweir                                           $module_name, $line_number);
233cdf0e10cSrcweir
234cdf0e10cSrcweir      # count the info lines;
235cdf0e10cSrcweir      $info_line_sum += $info_line;
236cdf0e10cSrcweir   }
237cdf0e10cSrcweir
238cdf0e10cSrcweir   if ($debug == 1)
239cdf0e10cSrcweir   {
240cdf0e10cSrcweir      # show the sums of the info and no-info lines
241cdf0e10cSrcweir      lines_sums_output($module_name, $line_number, $info_line_sum, $no_info_line_sum);
242cdf0e10cSrcweir   }
243cdf0e10cSrcweir}
244cdf0e10cSrcweir
245cdf0e10cSrcweir########################################################################################
246cdf0e10cSrcweir#       sub: is_module_dependency_line
247cdf0e10cSrcweir#      gets: $line
248cdf0e10cSrcweir#   returns: 1 (true) or 0 (false)
249cdf0e10cSrcweir########################################################################################
250cdf0e10cSrcweirsub is_module_dependency_line
251cdf0e10cSrcweir{
252cdf0e10cSrcweir   my $line = shift;
253cdf0e10cSrcweir
254cdf0e10cSrcweir   # if the module dpendency line exists return 1, otherwise 0
255cdf0e10cSrcweir   ($line =~ /^\w+\s+\S+\s+:+\s+/)
256cdf0e10cSrcweir   ? return 1
257cdf0e10cSrcweir   : return 0;
258cdf0e10cSrcweir}
259cdf0e10cSrcweir
260cdf0e10cSrcweir########################################################################################
261cdf0e10cSrcweir#       sub: is_nmake_line
262cdf0e10cSrcweir#      gets: $line
263cdf0e10cSrcweir#   returns: '1' (true) or '0' (false)
264cdf0e10cSrcweir########################################################################################
265cdf0e10cSrcweirsub is_nmake_line
266cdf0e10cSrcweir{
267cdf0e10cSrcweir   my $line = shift;
268cdf0e10cSrcweir
269cdf0e10cSrcweir   # these lines are NO nmake lines:
270cdf0e10cSrcweir   # 1. a empty line
271cdf0e10cSrcweir   # 2. a comment line (perhaps with the job 'nmake')
272cdf0e10cSrcweir   #    like line 20 of module 'bridges' (SRC680/src.m42)
273cdf0e10cSrcweir   #    "#br  bridges\source\cli_uno  nmake  -  w,vc7  br_cli_uno br_unotypes NULL========= "
274cdf0e10cSrcweir   # 3. the module dependency line
275cdf0e10cSrcweir   #    like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42)
276cdf0e10cSrcweir   #    "sa      sal     :       xml2cmp N                                    ULL"
277cdf0e10cSrcweir   # 4. a 'p' job platform line (for OS2)
278cdf0e10cSrcweir   # 5. a line with a job, which is not 'nmake'
279cdf0e10cSrcweir   ($line =~ (/^[^\s+\#]/) && (!(/\s+:+\s+/)) && (!(/\s+p\s+/)) && (/\bnmake\b/) )
280cdf0e10cSrcweir   ? return 1
281cdf0e10cSrcweir   : return 0;
282cdf0e10cSrcweir}
283cdf0e10cSrcweir
284cdf0e10cSrcweir########################################################################################
285cdf0e10cSrcweir#       sub: get_alias_resolving_infos
286cdf0e10cSrcweir#      gets: $line
287cdf0e10cSrcweir#   returns: $job_dir, $job_platform, $alias
288cdf0e10cSrcweir########################################################################################
289cdf0e10cSrcweirsub get_alias_resolving_infos
290cdf0e10cSrcweir{
291cdf0e10cSrcweir   my $line = shift;
292cdf0e10cSrcweir
293cdf0e10cSrcweir   if ($line =~ /^\w+\s+(\S+)\s+\w+\s+\-\s+(\w+)\,?(\w+)?\s+(\S+)\s+/)
294cdf0e10cSrcweir   {
295cdf0e10cSrcweir      # get the current work directory
296cdf0e10cSrcweir      my $temp_job_dir = $1;
297cdf0e10cSrcweir
298cdf0e10cSrcweir      my $job_dir = change_job_directory($temp_job_dir);
299cdf0e10cSrcweir
300cdf0e10cSrcweir      # get the job platform of the current job
301cdf0e10cSrcweir      # if it is a 'n' job platform transform it to 'w'
302cdf0e10cSrcweir      # because 'n' can be used now as 'w' (both means windows)
303cdf0e10cSrcweir      my $job_platform = $2;
304cdf0e10cSrcweir      $job_platform = "w" if($job_platform eq "n");
305cdf0e10cSrcweir
306cdf0e10cSrcweir      # get the first alias in each line
307cdf0e10cSrcweir      my $alias = $4;
308cdf0e10cSrcweir
309cdf0e10cSrcweir      return ($job_dir, $job_platform, $alias);
310cdf0e10cSrcweir   }
311cdf0e10cSrcweir   return (undef, undef, undef);
312cdf0e10cSrcweir}
313cdf0e10cSrcweir
314cdf0e10cSrcweir########################################################################################
315cdf0e10cSrcweir#       sub: change_job_directory
316cdf0e10cSrcweir#      gets: $job_dir
317cdf0e10cSrcweir#   returns: $changed_job_dir
318cdf0e10cSrcweir########################################################################################
319cdf0e10cSrcweir# we don't need the module name and the first '\' in the current directory
320cdf0e10cSrcweirsub change_job_directory
321cdf0e10cSrcweir{
322cdf0e10cSrcweir   my $changed_job_dir = shift;
323cdf0e10cSrcweir
324cdf0e10cSrcweir   # ignore the module name
325cdf0e10cSrcweir   $changed_job_dir =~ s/^\w+//;
326cdf0e10cSrcweir   # change all other '\' against the '/' of the current dir
327cdf0e10cSrcweir   $changed_job_dir =~ s/\\/\//g;
328cdf0e10cSrcweir
329cdf0e10cSrcweir   # get only a "/" if we are in the root directory
330cdf0e10cSrcweir   $changed_job_dir = "/" if ($changed_job_dir eq "");
331cdf0e10cSrcweir
332cdf0e10cSrcweir   return $changed_job_dir;
333cdf0e10cSrcweir}
334cdf0e10cSrcweir
335cdf0e10cSrcweir########################################################################################
336cdf0e10cSrcweir#       sub: check_alias_and_job_platform
337cdf0e10cSrcweir#      gets: $job_dir, $job_platform, $alias, $dir_of_job_platform_ref,
338cdf0e10cSrcweir#            $dir_of_alias_ref, $module_name, $line_number
339cdf0e10cSrcweir#   returns: -
340cdf0e10cSrcweir########################################################################################
341cdf0e10cSrcweir# get it in the hash only if it is a valid job platform,
342cdf0e10cSrcweir# like 'w', 'u', 'm' and 'n'
343cdf0e10cSrcweir# 'all' is also valid but it doesn't exist in an alias platform(!)
344cdf0e10cSrcweirsub check_alias_and_job_platform
345cdf0e10cSrcweir{
346cdf0e10cSrcweir   my ($job_dir, $job_platform, $alias, $dir_of_job_platform_ref,
347cdf0e10cSrcweir       $dir_of_alias_ref, $module_name, $line_number) = @_;
348cdf0e10cSrcweir
349cdf0e10cSrcweir   # is it a valid job_platform?
350cdf0e10cSrcweir   if ($job_platform =~ /(w|u|m|n|all)/)
351cdf0e10cSrcweir   {
352cdf0e10cSrcweir      # get only the 'w', 'u', 'm' and 'n' based job platforms
353cdf0e10cSrcweir      if ($job_platform =~ /[wumn]/)
354cdf0e10cSrcweir      {
355cdf0e10cSrcweir         # doesn't the key already exist?
356cdf0e10cSrcweir         (!(exists $$dir_of_job_platform_ref{$job_platform.$alias}))
357cdf0e10cSrcweir           # get the first alias with the matching job platform in the hash
358cdf0e10cSrcweir         ? get_alias_and_job_platform($job_platform, $alias, $dir_of_job_platform_ref)
359cdf0e10cSrcweir           # this is a line with a redundant alias and job platform
360cdf0e10cSrcweir         : add_errorlog_alias_redundancy_statement($module_name, $alias, $job_platform, $line_number);
361cdf0e10cSrcweir      }
362cdf0e10cSrcweir      if (!(exists $$dir_of_alias_ref{$alias}))
363cdf0e10cSrcweir      {
364cdf0e10cSrcweir         # get each first alias with the matching job platform
365cdf0e10cSrcweir         get_alias_and_matching_directory($dir_of_alias_ref, $alias, $job_dir);
366cdf0e10cSrcweir      }
367cdf0e10cSrcweir   }
368cdf0e10cSrcweir   # it's not a valid job platform
369cdf0e10cSrcweir   else
370cdf0e10cSrcweir   {
371cdf0e10cSrcweir      add_errorlog_invalid_platform_statement($module_name, $job_platform, $line_number);
372cdf0e10cSrcweir   }
373cdf0e10cSrcweir}
374cdf0e10cSrcweir
375cdf0e10cSrcweir########################################################################################
376cdf0e10cSrcweir#       sub: get_alias_and_job_platform
377cdf0e10cSrcweir#      gets: $job_platform, $alias, $dir_of_job_platform_ref
378cdf0e10cSrcweir#   returns: -
379cdf0e10cSrcweir########################################################################################
380cdf0e10cSrcweir# get the the job platform and the first alias as a unique key
381cdf0e10cSrcweir# and the job platform as value of the hash
382cdf0e10cSrcweir# it's for checking later that the alias platform is equal to the job platform
383cdf0e10cSrcweir#   e.g.: line 6 + 7 of the module 'gtk' (SRC680/src.m42)
384cdf0e10cSrcweir#   "gt  gtk\pkgconfig  nmake  -  u   gt_pkg   NULL"
385cdf0e10cSrcweir#   "gt  gtk\glib       nmake  -  u   gt_glib gt_pkg.u NULL"
386cdf0e10cSrcweir#   the alias 'gt_pkg' has the directory 'gtk\pkgconfig' (we need only 'pkgconfig')
387cdf0e10cSrcweir#   and it has the job platform 'u' - compare it with the alias platform 'gt_pkg.u'
388cdf0e10cSrcweirsub get_alias_and_job_platform
389cdf0e10cSrcweir{
390cdf0e10cSrcweir   my ($job_platform, $alias, $dir_of_job_platform_ref) = @_;
391cdf0e10cSrcweir
392cdf0e10cSrcweir   # key = 'job platform' and 'first alias'   =>   value = 'job platform'
393cdf0e10cSrcweir   $$dir_of_job_platform_ref{$job_platform.$alias} = $job_platform;
394cdf0e10cSrcweir}
395cdf0e10cSrcweir
396cdf0e10cSrcweir########################################################################################
397cdf0e10cSrcweir#       sub: get_alias_and_matching_directory
398cdf0e10cSrcweir#      gets: $dir_of_alias_ref, $alias, $job_dir
399cdf0e10cSrcweir#   returns: -
400cdf0e10cSrcweir########################################################################################
401cdf0e10cSrcweir# fill the hash with the first alias and the matching directory
402cdf0e10cSrcweir#   e.g. line 14 of module 'setup2' (SRC680/src.m42)
403cdf0e10cSrcweir#   "se  setup2\win\source\unloader   nmake   -   w   se_wulo se_unotypes NULL"
404cdf0e10cSrcweir#   key = 'se_wulo'     =>    value = 'win/source/unloader'
405cdf0e10cSrcweirsub get_alias_and_matching_directory
406cdf0e10cSrcweir{
407cdf0e10cSrcweir   my ($dir_of_alias_ref, $alias, $job_dir) = @_;
408cdf0e10cSrcweir
409cdf0e10cSrcweir   #     key = 'first alias'  => value = 'job directory'
410cdf0e10cSrcweir   $$dir_of_alias_ref{$alias} = $job_dir;
411cdf0e10cSrcweir}
412cdf0e10cSrcweir
413cdf0e10cSrcweir########################################################################################
414cdf0e10cSrcweir#       sub: show_no_info_line
415cdf0e10cSrcweir#      gets: $line, $line_number
416cdf0e10cSrcweir#   returns: $no_info_line
417cdf0e10cSrcweir########################################################################################
418cdf0e10cSrcweirsub show_no_info_line
419cdf0e10cSrcweir{
420cdf0e10cSrcweir   my ($line, $line_number) = @_;
421cdf0e10cSrcweir   my $no_info_line += 1;
422cdf0e10cSrcweir
423cdf0e10cSrcweir   chomp($line);
424cdf0e10cSrcweir
425cdf0e10cSrcweir   print"Ignore line <$line_number>:\n\"$line\"\n\n" if ($debug);
426cdf0e10cSrcweir
427cdf0e10cSrcweir   return $no_info_line;
428cdf0e10cSrcweir}
429cdf0e10cSrcweir
430cdf0e10cSrcweir########################################################################################
431cdf0e10cSrcweir#       sub: get_module_name
432cdf0e10cSrcweir#      gets: $line
433cdf0e10cSrcweir#   returns: $module_name
434cdf0e10cSrcweir########################################################################################
435cdf0e10cSrcweirsub get_module_name
436cdf0e10cSrcweir{
437cdf0e10cSrcweir   my $line = shift;
438cdf0e10cSrcweir   my $module_name = "";
439cdf0e10cSrcweir
440cdf0e10cSrcweir   if ($line =~ /^\w+\s+([\w\.\-]+)\\?/)
441cdf0e10cSrcweir   {
442cdf0e10cSrcweir      $module_name = $1;
443cdf0e10cSrcweir   }
444cdf0e10cSrcweir
445cdf0e10cSrcweir   # set the 'module name' in the data structure tree
446cdf0e10cSrcweir   $XMLTree->setModuleName($module_name);
447cdf0e10cSrcweir
448cdf0e10cSrcweir   return $module_name;
449cdf0e10cSrcweir}
450cdf0e10cSrcweir
451cdf0e10cSrcweir########################################################################################
452cdf0e10cSrcweir#       sub: get_module_dependency_line_infos
453cdf0e10cSrcweir#      gets: $line, $module_name, $line_number
454cdf0e10cSrcweir#   returns: $module_dependency_line_was_read, $info_line_sum
455cdf0e10cSrcweir########################################################################################
456cdf0e10cSrcweir# get the informations about the module dependency line
457cdf0e10cSrcweir# like line 1 of module 'sal' (SRC680/src.m42)
458cdf0e10cSrcweir#    "sa     sal              :                       xml2cmp             NULL"
459cdf0e10cSrcweir#        $module_name   $module_dependency    @module_dependency_names
460cdf0e10cSrcweirsub get_module_dependency_line_infos
461cdf0e10cSrcweir{
462cdf0e10cSrcweir   my ($line, $module_name, $line_number) = @_;
463cdf0e10cSrcweir   my $module_dependency = "";
464cdf0e10cSrcweir   my @module_dependency_names = ();
465cdf0e10cSrcweir   my %dep_modules_and_products = ();
466cdf0e10cSrcweir   my $product = "";
467cdf0e10cSrcweir
468cdf0e10cSrcweir   my $module_dependency_line_was_read = 1;
469cdf0e10cSrcweir   my $info_line_sum = 1;
470cdf0e10cSrcweir
471cdf0e10cSrcweir   if ($debug)
472cdf0e10cSrcweir   {
473cdf0e10cSrcweir      print"\nline number               : <$line_number>\n";
474cdf0e10cSrcweir      print"module-name               : <$module_name>\n";
475cdf0e10cSrcweir   }
476cdf0e10cSrcweir
477cdf0e10cSrcweir   # get the dependencies
478cdf0e10cSrcweir   if ($line =~ /\s+(:+)\s+/)
479cdf0e10cSrcweir   {
480cdf0e10cSrcweir      $module_dependency = $1;
481cdf0e10cSrcweir      print"module-dependency         : <$module_dependency>\n" if ($debug);
482cdf0e10cSrcweir
483cdf0e10cSrcweir      # transform the dependency type to the corresponding tag name
484cdf0e10cSrcweir      if ($module_dependency eq ":")
485cdf0e10cSrcweir      {
486cdf0e10cSrcweir         $module_dependency = "md-simple";
487cdf0e10cSrcweir      }
488cdf0e10cSrcweir      elsif ($module_dependency eq "::")
489cdf0e10cSrcweir      {
490cdf0e10cSrcweir         $module_dependency = "md-always";
491cdf0e10cSrcweir      }
492cdf0e10cSrcweir      elsif ($module_dependency eq ":::")
493cdf0e10cSrcweir      {
494cdf0e10cSrcweir         $module_dependency = "md-force";
495cdf0e10cSrcweir      }
496cdf0e10cSrcweir   }
497cdf0e10cSrcweir
498cdf0e10cSrcweir   # get a list of all depending module names
499cdf0e10cSrcweir   if ($line =~ /:+\s+([\S\s]+)\s+NULL/)
500cdf0e10cSrcweir   {
501cdf0e10cSrcweir      @module_dependency_names = split(/\s+/, $1);
502cdf0e10cSrcweir
503cdf0e10cSrcweir      foreach my $module (@module_dependency_names)
504cdf0e10cSrcweir      {
505cdf0e10cSrcweir         # check whether that there is another product (as "all") of a module
506cdf0e10cSrcweir         if ($module =~ /(\S+):+(\S+)/)
507cdf0e10cSrcweir         {
508cdf0e10cSrcweir            $dep_modules_and_products{$2} = $1;
509cdf0e10cSrcweir         }
510cdf0e10cSrcweir         else
511cdf0e10cSrcweir         {
512cdf0e10cSrcweir            $dep_modules_and_products{$module} = "all";
513cdf0e10cSrcweir         }
514cdf0e10cSrcweir      }
515cdf0e10cSrcweir   }
516cdf0e10cSrcweir
517cdf0e10cSrcweir   # add the dependency module names, the module dependency type and the product to the data structure
518cdf0e10cSrcweir   foreach my $module (sort keys %dep_modules_and_products)
519cdf0e10cSrcweir   {
520cdf0e10cSrcweir      print"module-dependency-name(s) : key <$module>  value <".$dep_modules_and_products{$module}.">\n" if ($debug);
521cdf0e10cSrcweir
522cdf0e10cSrcweir      $XMLTree->addModuleDependencies($module, $module_dependency, $dep_modules_and_products{$module});
523cdf0e10cSrcweir   }
524cdf0e10cSrcweir
525cdf0e10cSrcweir   return ($module_dependency_line_was_read, $info_line_sum);
526cdf0e10cSrcweir}
527cdf0e10cSrcweir
528cdf0e10cSrcweir########################################################################################
529cdf0e10cSrcweir#       sub: get_nmake_line_infos
530cdf0e10cSrcweir#      gets: $line, \%dir_of_alias, \%dir_of_job_platform, $module_name, $line_number
531cdf0e10cSrcweir#   returns: $info_line
532cdf0e10cSrcweir########################################################################################
533cdf0e10cSrcweir# get all infos about the 'nmake' lines
534cdf0e10cSrcweir# e.g. line 8 of module 'sal'
535cdf0e10cSrcweir# "sa  sal\systools\win32\guistdio  nmake  -     n         sa_guistdio     sa_uwinapi.n          NULL"
536cdf0e10cSrcweir#             $job_dir              $job     $job_platform  1.$alias   2.$alias + alias platform
537cdf0e10cSrcweirsub get_nmake_line_infos
538cdf0e10cSrcweir{
539cdf0e10cSrcweir   my ($line, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
540cdf0e10cSrcweir   my $directories_ref = "";
541cdf0e10cSrcweir   my $info_line = 0;
542cdf0e10cSrcweir
543cdf0e10cSrcweir   # get the infos about the 'nmake' lines
544cdf0e10cSrcweir   if ($line =~ /^\w+\s+(\S+)\s+(\w+)\s+\-\s+(\w+)\,?(\S+)?/)
545cdf0e10cSrcweir   {
546cdf0e10cSrcweir      # get the current working directory
547cdf0e10cSrcweir      my $temp_job_dir = $1;
548cdf0e10cSrcweir      my $job_dir = change_job_directory($temp_job_dir);
549cdf0e10cSrcweir
550cdf0e10cSrcweir      # get the job
551cdf0e10cSrcweir      my $job = $2;
552cdf0e10cSrcweir      $job = "make" if ($job eq "nmake");
553cdf0e10cSrcweir
554cdf0e10cSrcweir      # get the job platform of the current job
555cdf0e10cSrcweir      # if it is a 'n' job platform transform it to 'wnt'
556cdf0e10cSrcweir      # available values are: 'wnt', 'unx', 'mac' or 'all'
557cdf0e10cSrcweir      my $job_platform = $3;
558cdf0e10cSrcweir      $job_platform = change_job_platform_name($job_platform);
559cdf0e10cSrcweir
560cdf0e10cSrcweir      # get the first alias in each line
561cdf0e10cSrcweir      my $restriction = $4;
562cdf0e10cSrcweir      my %build_req = ( "$restriction" => "$job_platform") if ($restriction && $job_platform);
563cdf0e10cSrcweir
564cdf0e10cSrcweir
565cdf0e10cSrcweir      # get all aliases (but not the first) in an array
566cdf0e10cSrcweir      my $aliases_ref = get_aliases($line);
567cdf0e10cSrcweir
568cdf0e10cSrcweir      # filter the list of aliases, which has a 'p' job platform
569cdf0e10cSrcweir      # and transform a 'n' ending alias platform to a 'w' ending alias platform
570cdf0e10cSrcweir      filter_aliases($aliases_ref);
571cdf0e10cSrcweir
572cdf0e10cSrcweir      # resolve all aliases (alias[.job platform] => matching directory)
573cdf0e10cSrcweir      $directories_ref = resolve_aliases($aliases_ref, $dir_of_alias_ref,
574cdf0e10cSrcweir                                         $dir_of_job_platform_ref, $module_name, $line_number);
575cdf0e10cSrcweir
576cdf0e10cSrcweir      # count the informative lines
577cdf0e10cSrcweir      $info_line = 1;
578cdf0e10cSrcweir
579cdf0e10cSrcweir      $XMLTree->addJob($job_dir, $job, $job_platform, $directories_ref, \%build_req);
580cdf0e10cSrcweir
581cdf0e10cSrcweir      # show the infos, that we know about each line
582cdf0e10cSrcweir      if ($debug == 1)
583cdf0e10cSrcweir      {
584cdf0e10cSrcweir         show_line_infos($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref);
585cdf0e10cSrcweir      }
586cdf0e10cSrcweir   }
587cdf0e10cSrcweir   return $info_line;
588cdf0e10cSrcweir}
589cdf0e10cSrcweir
590cdf0e10cSrcweir########################################################################################
591cdf0e10cSrcweir#       sub: change_job_platform_name
592cdf0e10cSrcweir#      gets: $job_platform
593cdf0e10cSrcweir#   returns: $job_platform
594cdf0e10cSrcweir########################################################################################
595cdf0e10cSrcweirsub change_job_platform_name
596cdf0e10cSrcweir{
597cdf0e10cSrcweir   my $job_platform = shift;
598cdf0e10cSrcweir
599cdf0e10cSrcweir   $job_platform = "wnt" if($job_platform eq "n" || $job_platform eq "w");
600cdf0e10cSrcweir   $job_platform = "unx" if($job_platform eq "u");
601cdf0e10cSrcweir   $job_platform = "mac" if($job_platform eq "m");
602cdf0e10cSrcweir
603cdf0e10cSrcweir   return $job_platform;
604cdf0e10cSrcweir}
605cdf0e10cSrcweir
606cdf0e10cSrcweir########################################################################################
607cdf0e10cSrcweir#       sub: get_aliases
608cdf0e10cSrcweir#      gets: $_ (current line)
609cdf0e10cSrcweir#   returns: \@aliases
610cdf0e10cSrcweir########################################################################################
611cdf0e10cSrcweir# get all aliases of the line in an array
612cdf0e10cSrcweirsub get_aliases
613cdf0e10cSrcweir{
614cdf0e10cSrcweir   my $line = shift;
615cdf0e10cSrcweir   my @aliases = ();
616cdf0e10cSrcweir
617cdf0e10cSrcweir   # get all aliases in an array (but cut out the first alias)
618cdf0e10cSrcweir   if ($line =~ /\-\s+[\w+\,]+\s+([\S\s]+)\s+NULL$/)
619cdf0e10cSrcweir   {
620cdf0e10cSrcweir      print"\nall job aliases           : <$1>\n" if ($debug);
621cdf0e10cSrcweir
622cdf0e10cSrcweir      @aliases = split /\s+/, $1;
623cdf0e10cSrcweir
624cdf0e10cSrcweir      # we don't need the first alias (it stands for the current job directory)
625cdf0e10cSrcweir      shift @aliases;
626cdf0e10cSrcweir   }
627cdf0e10cSrcweir   return \@aliases;
628cdf0e10cSrcweir}
629cdf0e10cSrcweir
630cdf0e10cSrcweir########################################################################################
631cdf0e10cSrcweir#       sub: filter_aliases
632cdf0e10cSrcweir#      gets: $aliases_ref
633cdf0e10cSrcweir#   returns: -
634cdf0e10cSrcweir########################################################################################
635cdf0e10cSrcweir# filter all aliases, because we only need the 'w', 'u' and 'm' job platform based aliases
636cdf0e10cSrcweirsub filter_aliases
637cdf0e10cSrcweir{
638cdf0e10cSrcweir   my $aliases_ref = shift;
639cdf0e10cSrcweir
640cdf0e10cSrcweir   # get the highest index of the array (number of elements of the array - 1)
641cdf0e10cSrcweir   # also works: my $index = scalar(@$aliases_ref)-1;
642cdf0e10cSrcweir   my $index = $#{@{$aliases_ref}};
643cdf0e10cSrcweir
644cdf0e10cSrcweir   for (; $index >= 0; $index--)
645cdf0e10cSrcweir   {
646cdf0e10cSrcweir      # filter the 'p' job platform based aliases from '@aliases'
647cdf0e10cSrcweir      splice(@$aliases_ref, $index, 1) if ($$aliases_ref[$index] =~ /\.p$/);
648cdf0e10cSrcweir
649cdf0e10cSrcweir      # transform a '.n' ending alias platform to '.w' ending alias platform
650cdf0e10cSrcweir      if ($$aliases_ref[$index] =~ /\.n$/)
651cdf0e10cSrcweir      {
652cdf0e10cSrcweir         $$aliases_ref[$index] =~ s/\.n$/\.w/;
653cdf0e10cSrcweir         splice(@$aliases_ref, $index, 1, $$aliases_ref[$index]);
654cdf0e10cSrcweir      }
655cdf0e10cSrcweir   }
656cdf0e10cSrcweir}
657cdf0e10cSrcweir
658cdf0e10cSrcweir########################################################################################
659cdf0e10cSrcweir#       sub: resolve_aliases
660cdf0e10cSrcweir#      gets: $aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref,
661cdf0e10cSrcweir#            $module_name, $line_number
662cdf0e10cSrcweir#   returns: \@directories
663cdf0e10cSrcweir########################################################################################
664cdf0e10cSrcweir# here we get each alias with the matching job directory
665cdf0e10cSrcweirsub resolve_aliases
666cdf0e10cSrcweir{
667cdf0e10cSrcweir   my ($aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
668cdf0e10cSrcweir
669cdf0e10cSrcweir   my @directories = ();
670cdf0e10cSrcweir   my ($alias_platform, $alias, $temp_alias) = "";
671cdf0e10cSrcweir
672cdf0e10cSrcweir   # resolving all directory aliases
673cdf0e10cSrcweir   foreach $temp_alias (@$aliases_ref)
674cdf0e10cSrcweir   {
675cdf0e10cSrcweir      ($alias, $alias_platform) = compare_job_platform_with_alias_platform
676cdf0e10cSrcweir                                  ($temp_alias, $dir_of_job_platform_ref, $module_name, $line_number);
677cdf0e10cSrcweir
678cdf0e10cSrcweir      # does the alias exist?
679cdf0e10cSrcweir      if (exists $$dir_of_alias_ref{$alias})
680cdf0e10cSrcweir      {
681cdf0e10cSrcweir         # then get the matching directory in the array
682cdf0e10cSrcweir         push (@directories, $$dir_of_alias_ref{$alias});
683cdf0e10cSrcweir      }
684cdf0e10cSrcweir      else
685cdf0e10cSrcweir      {
686cdf0e10cSrcweir         add_errorlog_no_directory_of_alias_statement($module_name, $alias, $line_number);
687cdf0e10cSrcweir      }
688cdf0e10cSrcweir   }
689cdf0e10cSrcweir   return \@directories;
690cdf0e10cSrcweir}
691cdf0e10cSrcweir
692cdf0e10cSrcweir########################################################################################
693cdf0e10cSrcweir#       sub: compare_job_platform_with_alias_platform
694cdf0e10cSrcweir#      gets: $alias, $dir_of_job_platform_ref, $module_name, $line_number
695cdf0e10cSrcweir#   returns: $alias
696cdf0e10cSrcweir########################################################################################
697cdf0e10cSrcweirsub compare_job_platform_with_alias_platform
698cdf0e10cSrcweir{
699cdf0e10cSrcweir   my ($alias, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
700cdf0e10cSrcweir
701cdf0e10cSrcweir   my $alias_platform = "";
702cdf0e10cSrcweir
703cdf0e10cSrcweir   # compare the alias platform (with a dot and an ending letter, like "al_alib.u")
704cdf0e10cSrcweir   # with the job platform of the line in which this alias was resolved
705cdf0e10cSrcweir   if ($alias =~ /\.([wum])$/)
706cdf0e10cSrcweir   {
707cdf0e10cSrcweir      $alias_platform = $1;
708cdf0e10cSrcweir
709cdf0e10cSrcweir      # don't memorize the ending dot and letter
710cdf0e10cSrcweir      $alias =~ s/\.\w$//;
711cdf0e10cSrcweir
712cdf0e10cSrcweir      # if the value(= job platform) of the hash or the alias platform has no value
713cdf0e10cSrcweir      # set it to "no valid value"
714cdf0e10cSrcweir      if (!(exists $$dir_of_job_platform_ref{$alias_platform.$alias}))
715cdf0e10cSrcweir      {
716cdf0e10cSrcweir         $$dir_of_job_platform_ref{$alias_platform.$alias} = "no valid value";
717cdf0e10cSrcweir      }
718cdf0e10cSrcweir      $alias_platform = "no valid value" if (!($alias_platform));
719cdf0e10cSrcweir
720cdf0e10cSrcweir      # are the job platform and the alias platform equal?
721cdf0e10cSrcweir      if ($$dir_of_job_platform_ref{$alias_platform.$alias} ne $alias_platform)
722cdf0e10cSrcweir      {
723cdf0e10cSrcweir         add_errorlog_not_equal_platforms_statement
724cdf0e10cSrcweir         ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number);
725cdf0e10cSrcweir      }
726cdf0e10cSrcweir   }
727cdf0e10cSrcweir   return ($alias, $alias_platform);
728cdf0e10cSrcweir}
729cdf0e10cSrcweir
730cdf0e10cSrcweir########################################################################################
731cdf0e10cSrcweir#       sub: show_line_infos
732cdf0e10cSrcweir#      gets: $line_number, $job_dir, $job, $job_platform, $restriction,
733cdf0e10cSrcweir#            $aliases_ref, $directories_ref
734cdf0e10cSrcweir#   returns: -
735cdf0e10cSrcweir########################################################################################
736cdf0e10cSrcweir# print the infos about each line
737cdf0e10cSrcweirsub show_line_infos
738cdf0e10cSrcweir{
739cdf0e10cSrcweir   my ($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref) = @_;
740cdf0e10cSrcweir
741cdf0e10cSrcweir   print"line number               : <$line_number>\n";
742cdf0e10cSrcweir   print"job directory             : <$job_dir>\n";
743cdf0e10cSrcweir   print"job                       : <$job>\n";
744cdf0e10cSrcweir   print"job platform              : <$job_platform>\n" if ($job_platform =~ /(w|u|m|all)/);
745cdf0e10cSrcweir   print"restriction               : <$restriction>\n" if ($restriction);
746cdf0e10cSrcweir   print"alias dependencies        : <@$aliases_ref>\n";
747cdf0e10cSrcweir   print"directory dependencies    : <@$directories_ref>\n\n";
748cdf0e10cSrcweir}
749cdf0e10cSrcweir
750cdf0e10cSrcweir########################################################################################
751cdf0e10cSrcweir#       sub: lines_sums_output
752cdf0e10cSrcweir#      gets: $module_name, $line_number, $info_line_sum, $no_info_line_sum
753cdf0e10cSrcweir#   returns: -
754cdf0e10cSrcweir########################################################################################
755cdf0e10cSrcweirsub lines_sums_output
756cdf0e10cSrcweir{
757cdf0e10cSrcweir   # this line variables are for checking that all lines will be read:
758cdf0e10cSrcweir   my ($module_name, $line_number, $info_line_sum, $no_info_line_sum) = @_;
759cdf0e10cSrcweir   my $lines_sum = 0;
760cdf0e10cSrcweir
761cdf0e10cSrcweir   add_errorlog_no_module_name_statement() if (!($module_name));
762cdf0e10cSrcweir
763cdf0e10cSrcweir   # were all lines read? and is the checksum okay?
764cdf0e10cSrcweir   $lines_sum = $info_line_sum + $no_info_line_sum;
765cdf0e10cSrcweir   if ($lines_sum == $line_number)
766cdf0e10cSrcweir   {
767cdf0e10cSrcweir      print"All $line_number line(s) of module <$module_name> were read and checked!\n\n";
768cdf0e10cSrcweir   }
769cdf0e10cSrcweir   else
770cdf0e10cSrcweir   {
771cdf0e10cSrcweir      add_errorlog_different_lines_sums_statement($module_name);
772cdf0e10cSrcweir   }
773cdf0e10cSrcweir
774cdf0e10cSrcweir   print"module: <$module_name>\n".
775cdf0e10cSrcweir        "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n".
776cdf0e10cSrcweir        "   info line(s) sum    =  $info_line_sum\n".
777cdf0e10cSrcweir        "no-info line(s) sum    =  $no_info_line_sum\n".
778cdf0e10cSrcweir        "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n".
779cdf0e10cSrcweir        "  total line(s) sum    =  $line_number\n\n\n";
780cdf0e10cSrcweir}
781cdf0e10cSrcweir
782cdf0e10cSrcweir
783cdf0e10cSrcweir############################ ERROR_LOG subroutines #####################################
784cdf0e10cSrcweir
785cdf0e10cSrcweir
786cdf0e10cSrcweir########################################################################################
787cdf0e10cSrcweir#       sub: add_errorlog_invalid_job_platform_statement
788cdf0e10cSrcweir#      gets: $module_name, $platform, $line_number
789cdf0e10cSrcweir#   returns: -
790cdf0e10cSrcweir########################################################################################
791cdf0e10cSrcweirsub add_errorlog_invalid_job_platform_statement
792cdf0e10cSrcweir{
793cdf0e10cSrcweir   my ($module_name, $job_platform, $line_number) = @_;
794cdf0e10cSrcweir
795cdf0e10cSrcweir   print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
796cdf0e10cSrcweir                   "The job platform <$job_platform> is not valid.\n\n";
797cdf0e10cSrcweir}
798cdf0e10cSrcweir
799cdf0e10cSrcweir########################################################################################
800cdf0e10cSrcweir#       sub: add_errorlog_not_equal_platforms_statement
801cdf0e10cSrcweir#      gets: $module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number
802cdf0e10cSrcweir#   returns: -
803cdf0e10cSrcweir########################################################################################
804cdf0e10cSrcweirsub add_errorlog_not_equal_platforms_statement
805cdf0e10cSrcweir{
806cdf0e10cSrcweir   my ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number) = @_;
807cdf0e10cSrcweir
808cdf0e10cSrcweir   print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
809cdf0e10cSrcweir                   "The alias platform <$alias.$alias_platform> is not equal ".
810cdf0e10cSrcweir                   "with the job platform <$$dir_of_job_platform_ref{$alias_platform.$alias}>.\n\n";
811cdf0e10cSrcweir}
812cdf0e10cSrcweir
813cdf0e10cSrcweir########################################################################################
814cdf0e10cSrcweir#       sub: add_errorlog_no_directory_of_alias_statement
815cdf0e10cSrcweir#      gets: $module_name, $alias, $line_number
816cdf0e10cSrcweir#   returns: -
817cdf0e10cSrcweir########################################################################################
818cdf0e10cSrcweirsub add_errorlog_no_directory_of_alias_statement
819cdf0e10cSrcweir{
820cdf0e10cSrcweir   my ($module_name, $alias, $line_number) = @_;
821cdf0e10cSrcweir
822cdf0e10cSrcweir   print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
823cdf0e10cSrcweir                   "The directory of the alias <$alias> doesn't exist!\n\n";
824cdf0e10cSrcweir}
825cdf0e10cSrcweir
826cdf0e10cSrcweir########################################################################################
827cdf0e10cSrcweir#       sub: add_errorlog_no_module_name_statement
828cdf0e10cSrcweir#      gets: -
829cdf0e10cSrcweir#   returns: -
830cdf0e10cSrcweir########################################################################################
831cdf0e10cSrcweirsub add_errorlog_no_module_name_statement
832cdf0e10cSrcweir{
833cdf0e10cSrcweir   print ERROR_LOG "Error. No module name found in dir/file <$parse_file>.\n\n";
834cdf0e10cSrcweir}
835cdf0e10cSrcweir
836cdf0e10cSrcweir########################################################################################
837cdf0e10cSrcweir#       sub: add_errorlog_alias_redundancy_statement
838cdf0e10cSrcweir#      gets: $module_name, $alias, $job_platform, $line_number
839cdf0e10cSrcweir#   returns: -
840cdf0e10cSrcweir########################################################################################
841cdf0e10cSrcweirsub add_errorlog_alias_redundancy_statement
842cdf0e10cSrcweir{
843cdf0e10cSrcweir   my ($module_name, $alias, $job_platform, $line_number)= @_;
844cdf0e10cSrcweir
845cdf0e10cSrcweir   print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
846cdf0e10cSrcweir                   "The alias <$alias> with the job platform <$job_platform> is redundant.\n\n";
847cdf0e10cSrcweir}
848cdf0e10cSrcweir
849cdf0e10cSrcweir########################################################################################
850cdf0e10cSrcweir#       sub: add_errorlog_unknown_format_statement
851cdf0e10cSrcweir#      gets: $module_name, $line_number
852cdf0e10cSrcweir#   returns: -
853cdf0e10cSrcweir########################################################################################
854cdf0e10cSrcweirsub add_errorlog_unknown_format_statement
855cdf0e10cSrcweir{
856cdf0e10cSrcweir   my ($line, $module_name, $line_number) = @_;
857cdf0e10cSrcweir
858cdf0e10cSrcweir   print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.".
859cdf0e10cSrcweir                   "\nUnknown format:\n\"$line\"\n\n";
860cdf0e10cSrcweir}
861cdf0e10cSrcweir
862cdf0e10cSrcweir########################################################################################
863cdf0e10cSrcweir#       sub: add_errorlog_different_lines_sums_statement
864cdf0e10cSrcweir#      gets: $module_name
865cdf0e10cSrcweir#   returns: -
866cdf0e10cSrcweir########################################################################################
867cdf0e10cSrcweirsub add_errorlog_different_lines_sums_statement
868cdf0e10cSrcweir{
869cdf0e10cSrcweir   my $module_name = shift;
870cdf0e10cSrcweir
871cdf0e10cSrcweir   print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file>.\n".
872cdf0e10cSrcweir                   "The sums of all info and no-info lines are not correct!\n\n";
873cdf0e10cSrcweir}
874cdf0e10cSrcweir
875cdf0e10cSrcweir########################################################################################
876cdf0e10cSrcweir#       sub: add_errorlog_no_buildlst_file_found_statement
877cdf0e10cSrcweir#      gets: $parse_file
878cdf0e10cSrcweir#   returns: -
879cdf0e10cSrcweir########################################################################################
880cdf0e10cSrcweirsub add_errorlog_no_buildlst_file_found_statement
881cdf0e10cSrcweir{
882cdf0e10cSrcweir   my $parse_file = shift;
883cdf0e10cSrcweir
884cdf0e10cSrcweir   print ERROR_LOG "Error in command line argument <$parse_file>.\n".
885cdf0e10cSrcweir                   "File 'build.lst' not found!\n";
886cdf0e10cSrcweir}
887cdf0e10cSrcweir
888cdf0e10cSrcweir############################# end of the subroutines ###################################
889