1*cdf0e10cSrcweir#************************************************************************* 2*cdf0e10cSrcweir# 3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir# 5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# This file is part of OpenOffice.org. 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir# 15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir# 21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir# 26*cdf0e10cSrcweir#************************************************************************* 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir 29*cdf0e10cSrcweirpackage par2script::exiter; 30*cdf0e10cSrcweir 31*cdf0e10cSrcweiruse par2script::files; 32*cdf0e10cSrcweiruse par2script::globals; 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir############################################ 35*cdf0e10cSrcweir# Exiting the program with an error 36*cdf0e10cSrcweir# This function is used instead of "die" 37*cdf0e10cSrcweir############################################ 38*cdf0e10cSrcweir 39*cdf0e10cSrcweirsub exit_program 40*cdf0e10cSrcweir{ 41*cdf0e10cSrcweir my ($message, $function) = @_; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir my $infoline; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir $infoline = "\n***************************************************************\n"; 46*cdf0e10cSrcweir push(@par2script::globals::logfileinfo, $infoline); 47*cdf0e10cSrcweir print("$infoline"); 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir $infoline = "$message\n"; 50*cdf0e10cSrcweir push(@par2script::globals::logfileinfo, $infoline); 51*cdf0e10cSrcweir print("$infoline"); 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir $infoline = "in function: $function\n"; 54*cdf0e10cSrcweir push(@par2script::globals::logfileinfo, $infoline); 55*cdf0e10cSrcweir print("$infoline"); 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir $infoline = "***************************************************************\n"; 58*cdf0e10cSrcweir push(@par2script::globals::logfileinfo, $infoline); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir if ($par2script::globals::logging) 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir par2script::files::save_file($par2script::globals::logfilename, \@par2script::globals::logfileinfo); 63*cdf0e10cSrcweir print("Saved logfile: $par2script::globals::logfilename\n"); 64*cdf0e10cSrcweir } 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir print("$infoline"); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir exit(-1); 69*cdf0e10cSrcweir} 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir##################################### 72*cdf0e10cSrcweir# Error, because a gid is defined 73*cdf0e10cSrcweir# more than once 74*cdf0e10cSrcweir##################################### 75*cdf0e10cSrcweir 76*cdf0e10cSrcweirsub multidefinitionerror 77*cdf0e10cSrcweir{ 78*cdf0e10cSrcweir my ( $multidefinitiongids ) = @_; 79*cdf0e10cSrcweir print "************************************************\n"; 80*cdf0e10cSrcweir print "ERROR: multiple definition of gids:\n"; 81*cdf0e10cSrcweir print "************************************************\n"; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir my $gid; 84*cdf0e10cSrcweir foreach $gid ( @{$multidefinitiongids} ) { print "\t$gid\n"; } 85*cdf0e10cSrcweir exit(-1); 86*cdf0e10cSrcweir} 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir##################################### 89*cdf0e10cSrcweir# Error, because a gid is assigned 90*cdf0e10cSrcweir# more than once 91*cdf0e10cSrcweir##################################### 92*cdf0e10cSrcweir 93*cdf0e10cSrcweirsub multiassignmenterror 94*cdf0e10cSrcweir{ 95*cdf0e10cSrcweir my ( $multiassignmentgids ) = @_; 96*cdf0e10cSrcweir #print "************************************************\n"; 97*cdf0e10cSrcweir #print "ERROR: multiple assignments of gids:\n"; 98*cdf0e10cSrcweir #print "************************************************\n"; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir my $line; 101*cdf0e10cSrcweir foreach $line ( @{$multiassignmentgids} ) { print "\t$line\n"; } 102*cdf0e10cSrcweir # exit(-1); 103*cdf0e10cSrcweir} 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir##################################### 106*cdf0e10cSrcweir# Error, because a defined gid 107*cdf0e10cSrcweir# is not assigned 108*cdf0e10cSrcweir##################################### 109*cdf0e10cSrcweir 110*cdf0e10cSrcweirsub missingassignmenterror 111*cdf0e10cSrcweir{ 112*cdf0e10cSrcweir my ( $missingassignmentgids ) = @_; 113*cdf0e10cSrcweir print "********************************************************\n"; 114*cdf0e10cSrcweir print "ERROR: Missing assignments for the following GIDs:\n"; 115*cdf0e10cSrcweir print "********************************************************\n"; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir my $gid; 118*cdf0e10cSrcweir foreach $gid ( @{$missingassignmentgids} ) { print "\t$gid\n"; } 119*cdf0e10cSrcweir exit(-1); 120*cdf0e10cSrcweir} 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir1; 123