01: /*=============================================================================
02: * Copyright Texas Instruments 2000. All Rights Reserved.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * $ProjectHeader: OSCRIPT 0.155 Fri, 20 Dec 2002 18:34:22 -0800 rclark $
19: */
20:
21: package oscript;
22:
23: /**
24: * A utility for script writers. This enabled a script program to be
25: * packaged in a jar file without needing a java "Main" class. This
26: * class's <code>main</code> function simply creates a global called
27: * <code>args</code>, which is the array of command line arguments,
28: * and then loades <code>main.os</code> which is provided by the script
29: * program.
30: *
31: * @author Rob Clark (rob@ti.com)
32: * <!--$Format: " * @version $Revision$"$-->
33: * @version 1.2
34: */
35: public class MainRunner {
36: public static void main(String[] args) {
37: try {
38: OscriptInterpreter.getGlobalScope().createMember("args", 0)
39: .opAssign(
40: oscript.data.JavaBridge
41: .convertToScriptObject(args));
42: OscriptInterpreter.eval("import \"main.os\";");
43: } catch (Throwable e) {
44: e.printStackTrace();
45: }
46: }
47: }
48:
49: /*
50: * Local Variables:
51: * tab-width: 2
52: * indent-tabs-mode: nil
53: * mode: java
54: * c-indentation-style: java
55: * c-basic-offset: 2
56: * eval: (c-set-offset 'substatement-open '0)
57: * End:
58: */
|