xref: /aoo41x/main/xmerge/source/palmtests/bin/spose (revision 5b501c92)
1cdf0e10cSrcweir#!/bin/perl
2*5b501c92SAndrew Rist# *************************************************************
3*5b501c92SAndrew Rist#
4*5b501c92SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
5*5b501c92SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
6*5b501c92SAndrew Rist#  distributed with this work for additional information
7*5b501c92SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
8*5b501c92SAndrew Rist#  to you under the Apache License, Version 2.0 (the
9*5b501c92SAndrew Rist#  "License"); you may not use this file except in compliance
10*5b501c92SAndrew Rist#  with the License.  You may obtain a copy of the License at
11*5b501c92SAndrew Rist#
12*5b501c92SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
13*5b501c92SAndrew Rist#
14*5b501c92SAndrew Rist#  Unless required by applicable law or agreed to in writing,
15*5b501c92SAndrew Rist#  software distributed under the License is distributed on an
16*5b501c92SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*5b501c92SAndrew Rist#  KIND, either express or implied.  See the License for the
18*5b501c92SAndrew Rist#  specific language governing permissions and limitations
19*5b501c92SAndrew Rist#  under the License.
20*5b501c92SAndrew Rist#
21*5b501c92SAndrew Rist# *************************************************************
22cdf0e10cSrcweir#
23cdf0e10cSrcweir# spose - start pose
24cdf0e10cSrcweir#
25cdf0e10cSrcweir
26cdf0e10cSrcweiruse Getopt::Std;
27cdf0e10cSrcweir
28cdf0e10cSrcweir# Location of needed files
29cdf0e10cSrcweir#
30cdf0e10cSrcweir$pose2_exe = $ENV{'POSE2_EXE'};
31cdf0e10cSrcweir$pose3_exe = $ENV{'POSE3_EXE'};
32cdf0e10cSrcweir$pose_prc = $ENV{'POSE_PRC'};
33cdf0e10cSrcweir
34cdf0e10cSrcweir
35cdf0e10cSrcweirif (getopts('23qmwo:r:d:v') != 1)
36cdf0e10cSrcweir{
37cdf0e10cSrcweir   &usage();
38cdf0e10cSrcweir}
39cdf0e10cSrcweir
40cdf0e10cSrcweir$apps_load = "";
41cdf0e10cSrcweir
42cdf0e10cSrcweirif ($opt_q)
43cdf0e10cSrcweir{
44cdf0e10cSrcweir   &add_app("$pose_prc/Quickword.PRC");
45cdf0e10cSrcweir}
46cdf0e10cSrcweirif ($opt_m)
47cdf0e10cSrcweir{
48cdf0e10cSrcweir   &add_app("$pose_prc/MiniCalc.prc");
49cdf0e10cSrcweir}
50cdf0e10cSrcweirif ($opt_w)
51cdf0e10cSrcweir{
52cdf0e10cSrcweir   &add_app("$pose_prc/WordSmith.PRC");
53cdf0e10cSrcweir}
54cdf0e10cSrcweirif ($opt_o)
55cdf0e10cSrcweir{
56cdf0e10cSrcweir   &add_app("$opt_o");
57cdf0e10cSrcweir}
58cdf0e10cSrcweirif ($opt_r)
59cdf0e10cSrcweir{
60cdf0e10cSrcweir   $run_prog .= "-run_app $opt_r";
61cdf0e10cSrcweir}
62cdf0e10cSrcweirif ($opt_d)
63cdf0e10cSrcweir{
64cdf0e10cSrcweir   $directory = $opt_d;
65cdf0e10cSrcweir   @files = `/bin/ls -1 $directory/*.pdb`;
66cdf0e10cSrcweir
67cdf0e10cSrcweir   for ($i=0; $i <= $#files; $i++)
68cdf0e10cSrcweir   {
69cdf0e10cSrcweir      $add_file = "$files[$i]";
70cdf0e10cSrcweir      chomp $add_file;
71cdf0e10cSrcweir      &add_app("$add_file");
72cdf0e10cSrcweir   }
73cdf0e10cSrcweir}
74cdf0e10cSrcweir
75cdf0e10cSrcweirif ($opt_3)
76cdf0e10cSrcweir{
77cdf0e10cSrcweir   $pose_exe = $pose3_exe;
78cdf0e10cSrcweir}
79cdf0e10cSrcweirelse
80cdf0e10cSrcweir{
81cdf0e10cSrcweir   $pose_exe = $pose2_exe;
82cdf0e10cSrcweir}
83cdf0e10cSrcweirif ($pose_exe eq "")
84cdf0e10cSrcweir{
85cdf0e10cSrcweir    print "\nPose not found: Please set \n       POSE2_EXE\n    or POSE3_EXE\n";
86cdf0e10cSrcweir    exit 0;
87cdf0e10cSrcweir}
88cdf0e10cSrcweirif ($opt_v)
89cdf0e10cSrcweir{
90cdf0e10cSrcweir   print ("\n$pose_exe $apps_load $run_prog &\n\n");
91cdf0e10cSrcweir}
92cdf0e10cSrcweirelse
93cdf0e10cSrcweir{
94cdf0e10cSrcweir   system ("$pose_exe $apps_load $run_prog &");
95cdf0e10cSrcweir}
96cdf0e10cSrcweir
97cdf0e10cSrcweirexit 0;
98cdf0e10cSrcweir
99cdf0e10cSrcweirsub usage
100cdf0e10cSrcweir{
101cdf0e10cSrcweir   print "\nUsage: getopt [ -m ] [ -q ] [ -w ] [ -o <PrcFile> ] [ -r <RunProg> ]\n";
102cdf0e10cSrcweir   print " -2            Runs pose version 3.2 [ current default ]\n";
103cdf0e10cSrcweir   print " -3            Runs pose version 3.3\n";
104cdf0e10cSrcweir   print " -d            Load all PDB files in specified directory\n";
105cdf0e10cSrcweir   print " -m            Load MiniCalc PRC file\n";
106cdf0e10cSrcweir   print " -q            Load QuickWord PRC file\n";
107cdf0e10cSrcweir   print " -w            Load WordSmith PRC file\n";
108cdf0e10cSrcweir   print " -o <PrcFile>  Other PRC files to load\n";
109cdf0e10cSrcweir   print " -r <RunProg>  Program to run on startup\n";
110cdf0e10cSrcweir   print " -v            Display the command instead of running\n\n";
111cdf0e10cSrcweir   exit(-1);
112cdf0e10cSrcweir}
113cdf0e10cSrcweir
114cdf0e10cSrcweirsub add_app
115cdf0e10cSrcweir{
116cdf0e10cSrcweir   my $new_app = $_[0];
117cdf0e10cSrcweir
118cdf0e10cSrcweir   if ($apps_load ne "")
119cdf0e10cSrcweir   {
120cdf0e10cSrcweir      $apps_load .= ",";
121cdf0e10cSrcweir   }
122cdf0e10cSrcweir   else
123cdf0e10cSrcweir   {
124cdf0e10cSrcweir      $apps_load = "-load_apps ";
125cdf0e10cSrcweir   }
126cdf0e10cSrcweir
127cdf0e10cSrcweir   $apps_load .= "$new_app";
128cdf0e10cSrcweir}
129