Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / bin / modules / par2script / exiter.pm
blobf2d2ec649b64bcd09e6246ff19c0d426fc79254d
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 package par2script::exiter;
22 use par2script::files;
23 use par2script::globals;
25 ############################################
26 # Exiting the program with an error
27 # This function is used instead of "die"
28 ############################################
30 sub exit_program
32 my ($message, $function) = @_;
34 my $infoline;
36 $infoline = "\n***************************************************************\n";
37 push(@par2script::globals::logfileinfo, $infoline);
38 print("$infoline");
40 $infoline = "$message\n";
41 push(@par2script::globals::logfileinfo, $infoline);
42 print("$infoline");
44 $infoline = "in function: $function\n";
45 push(@par2script::globals::logfileinfo, $infoline);
46 print("$infoline");
48 $infoline = "***************************************************************\n";
49 push(@par2script::globals::logfileinfo, $infoline);
51 if ($par2script::globals::logging)
53 par2script::files::save_file($par2script::globals::logfilename, \@par2script::globals::logfileinfo);
54 print("Saved logfile: $par2script::globals::logfilename\n");
57 print("$infoline");
59 exit(-1);
62 #####################################
63 # Error, because a gid is defined
64 # more than once
65 #####################################
67 sub multidefinitionerror
69 my ( $multidefinitiongids ) = @_;
70 print "************************************************\n";
71 print "ERROR: multiple definition of gids:\n";
72 print "************************************************\n";
74 my $gid;
75 foreach $gid ( @{$multidefinitiongids} ) { print "\t$gid\n"; }
76 exit(-1);
79 #####################################
80 # Error, because a gid is assigned
81 # more than once
82 #####################################
84 sub multiassignmenterror
86 my ( $multiassignmentgids ) = @_;
87 print "************************************************\n";
88 print "WARNING: multiple assignments of gids:\n";
89 print "************************************************\n";
91 my $line;
92 foreach $line ( @{$multiassignmentgids} ) { print "\t$line\n"; }
95 #####################################
96 # Error, because a defined gid
97 # is not assigned
98 #####################################
100 sub missingassignmenterror
102 my ( $missingassignmentgids ) = @_;
103 print "********************************************************\n";
104 print "ERROR: Missing assignments for the following GIDs:\n";
105 print "********************************************************\n";
107 my $gid;
108 foreach $gid ( @{$missingassignmentgids} ) { print "\t$gid\n"; }
109 exit(-1);