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 pre2par
::parameter
;
24 use pre2par
::systemactions
;
26 ############################################
27 # Parameter Operations
28 ############################################
33 ---------------------------------------------------------
34 $pre2par::globals::prog
35 The following parameter are needed:
36 -s: path to the pre file
37 -o: path to the par file
38 -l: path to the ulf file (mlf or jlf file)
39 -v: log process (optional)
43 perl pre2par.pl -l test.mlf -s readme.pre -o readme.par -v
45 ---------------------------------------------------------
50 #####################################
52 #####################################
58 my $param = shift(@ARGV);
60 if ($param eq "-s") { $pre2par::globals
::prefilename
= shift(@ARGV); }
61 elsif ($param eq "-o") { $pre2par::globals
::parfilename
= shift(@ARGV); }
62 elsif ($param eq "-l") { $pre2par::globals
::langfilename
= shift(@ARGV); }
63 elsif ($param eq "-v") { $pre2par::globals
::logging
= 1; }
66 print("\n*************************************\n");
67 print("Sorry, unknown parameter: $param");
68 print("\n*************************************\n");
75 ############################################
76 # Controlling the fundamental parameter
77 # (required for every process)
78 ############################################
82 if ($pre2par::globals
::prefilename
eq "")
84 print "\n************************************************\n";
85 print "Error: Name of the input file not set (-s)!";
86 print "\n************************************************\n";
91 if (!(-f
$pre2par::globals
::prefilename
))
93 print "\n************************************************\n";
94 print "Error: Input file does not exist!";
95 print "\n************************************************\n";
100 if ($pre2par::globals
::parfilename
eq "")
102 print "\n************************************************\n";
103 print "Error: Name of the output file not set (-o)!";
104 print "\n************************************************\n";
109 if (!($pre2par::globals
::prefilename
=~ /\.pre\s*$/))
111 print "\n************************************************\n";
112 print "Error: Input file is no .pre file!";
113 print "\n************************************************\n";
118 if (!($pre2par::globals
::parfilename
=~ /\.par\s*$/))
120 print "\n************************************************\n";
121 print "Error: Output file is no .par file!";
122 print "\n************************************************\n";
128 #####################################
129 # Writing parameter to shell
130 #####################################
134 $pre2par::globals
::logging ?
($logoption = " -v") : ($logoption = "");
135 print "\n$pre2par::globals::prog -l $pre2par::globals::langfilename -s $pre2par::globals::prefilename -o $pre2par::globals::parfilename$logoption\n";
137 # print "\n********************************************************\n";
138 # print "This is $pre2par::globals::prog, version 1.0\n";
139 # print "Input file: $pre2par::globals::prefilename\n";
140 # print "Output file: $pre2par::globals::parfilename\n";
141 # print "********************************************************\n";