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
;
25 use pre2par
::systemactions
;
27 ############################################
28 # Parameter Operations
29 ############################################
34 ---------------------------------------------------------
35 $pre2par::globals::prog
36 The following parameter are needed:
37 -s: path to the pre file
38 -o: path to the par file
39 -l: path to the ulf file (mlf or jlf file)
40 -v: log process (optional)
44 perl pre2par.pl -l test.mlf -s readme.pre -o readme.par -v
46 ---------------------------------------------------------
51 #####################################
53 #####################################
59 my $param = shift(@ARGV);
61 if ($param eq "-s") { $pre2par::globals
::prefilename
= shift(@ARGV); }
62 elsif ($param eq "-o") { $pre2par::globals
::parfilename
= shift(@ARGV); }
63 elsif ($param eq "-l") { $pre2par::globals
::langfilename
= shift(@ARGV); }
64 elsif ($param eq "-v") { $pre2par::globals
::logging
= 1; }
67 print("\n*************************************\n");
68 print("Sorry, unknown parameter: $param");
69 print("\n*************************************\n");
76 ############################################
77 # Controlling the fundamental parameter
78 # (required for every process)
79 ############################################
83 if ($pre2par::globals
::prefilename
eq "")
85 print "\n************************************************\n";
86 print "Error: Name of the input file not set (-s)!";
87 print "\n************************************************\n";
92 if ($pre2par::globals
::parfilename
eq "")
94 print "\n************************************************\n";
95 print "Error: Name of the output file not set (-o)!";
96 print "\n************************************************\n";
101 if (!($pre2par::globals
::prefilename
=~ /\.pre\s*$/))
103 print "\n************************************************\n";
104 print "Error: Input file is no .pre file!";
105 print "\n************************************************\n";
110 if (!($pre2par::globals
::parfilename
=~ /\.par\s*$/))
112 print "\n************************************************\n";
113 print "Error: Output file is no .par file!";
114 print "\n************************************************\n";
119 # The input file has to exist
121 pre2par
::files
::check_file
($pre2par::globals
::prefilename
);
124 #####################################
125 # Writing parameter to shell
126 #####################################
130 $pre2par::globals
::logging ?
($logoption = " -v") : ($logoption = "");
131 print "\n$pre2par::globals::prog -l $pre2par::globals::langfilename -s $pre2par::globals::prefilename -o $pre2par::globals::parfilename$logoption\n";
133 # print "\n********************************************************\n";
134 # print "This is $pre2par::globals::prog, version 1.0\n";
135 # print "Input file: $pre2par::globals::prefilename\n";
136 # print "Output file: $pre2par::globals::parfilename\n";
137 # print "********************************************************\n";