~ubuntu-branches/ubuntu/precise/torque/precise-updates

« back to all changes in this revision

Viewing changes to src/lib/Libdis/disrl.c

  • Committer: Bazaar Package Importer
  • Author(s): Morten Kjeldgaard
  • Date: 2009-02-16 17:32:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090216173228-repbgujfj52115mg
Tags: 2.3.6+dfsg-0ubuntu1
* New upstream release (LP: #235385).
* Torque-server init script fails during installation and 
  removal (LP: #223649) fixed, "set -e" removed from init script.
* Package torque-scheduler 2.1.8+dfsg-0ubuntu1.1 failed to install
  (LP: #244440 LP: #270574) fixed, "set -e" removed from init script.
* /etc/init.d/torque-mom not idempotent, and stop doesn't work
  (LP: #256998) Fixed, "set -e" removed from init script.
* Torque-scheduler prints errors during package configuration
  (LP: #270653). Reason: missing dir sched_config. Fixed,
  package installs FIFO scheduler config file in
  /var/lib/torque/sched_priv/.
* Package torque-mom 2.1.8+dfsg-0ubuntu1 failed to 
  install/upgrade (LP: #276575 LP: #291674). Reason: missing directories.
  Fixed, /var/lib/torque/server_priv/jobs/, 
  /var/lib/torque/server_priv/queues/, 
  /var/lib/torque/server_priv/accounting/ and
  /var/lib/torque/mom_priv/jobs/ are now installed in their respective
  packages.
* Package torque-gui missing most of the files it needs to run!
  (LP: #281360). Reason: missing *.tk etc. files from src/gui
  Fixed: /usr/lib/xpbs now shipped in package
* changed patch system to quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
*         OpenPBS (Portable Batch System) v2.3 Software License
3
 
 
3
*
4
4
* Copyright (c) 1999-2000 Veridian Information Solutions, Inc.
5
5
* All rights reserved.
6
 
 
6
*
7
7
* ---------------------------------------------------------------------------
8
8
* For a license to use or redistribute the OpenPBS software under conditions
9
9
* other than those described below, or to purchase support for this software,
10
10
* please contact Veridian Systems, PBS Products Department ("Licensor") at:
11
 
 
11
*
12
12
*    www.OpenPBS.org  +1 650 967-4675                  sales@OpenPBS.org
13
13
*                        877 902-4PBS (US toll-free)
14
14
* ---------------------------------------------------------------------------
15
 
 
15
*
16
16
* This license covers use of the OpenPBS v2.3 software (the "Software") at
17
17
* your site or location, and, for certain users, redistribution of the
18
18
* Software to other sites and locations.  Use and redistribution of
19
19
* OpenPBS v2.3 in source and binary forms, with or without modification,
20
20
* are permitted provided that all of the following conditions are met.
21
21
* After December 31, 2001, only conditions 3-6 must be met:
22
 
 
22
*
23
23
* 1. Commercial and/or non-commercial use of the Software is permitted
24
24
*    provided a current software registration is on file at www.OpenPBS.org.
25
25
*    If use of this software contributes to a publication, product, or
26
26
*    service, proper attribution must be given; see www.OpenPBS.org/credit.html
27
 
 
27
*
28
28
* 2. Redistribution in any form is only permitted for non-commercial,
29
29
*    non-profit purposes.  There can be no charge for the Software or any
30
30
*    software incorporating the Software.  Further, there can be no
31
31
*    expectation of revenue generated as a consequence of redistributing
32
32
*    the Software.
33
 
 
33
*
34
34
* 3. Any Redistribution of source code must retain the above copyright notice
35
35
*    and the acknowledgment contained in paragraph 6, this list of conditions
36
36
*    and the disclaimer contained in paragraph 7.
37
 
 
37
*
38
38
* 4. Any Redistribution in binary form must reproduce the above copyright
39
39
*    notice and the acknowledgment contained in paragraph 6, this list of
40
40
*    conditions and the disclaimer contained in paragraph 7 in the
41
41
*    documentation and/or other materials provided with the distribution.
42
 
 
42
*
43
43
* 5. Redistributions in any form must be accompanied by information on how to
44
44
*    obtain complete source code for the OpenPBS software and any
45
45
*    modifications and/or additions to the OpenPBS software.  The source code
47
47
*    than the cost of distribution plus a nominal fee, and all modifications
48
48
*    and additions to the Software must be freely redistributable by any party
49
49
*    (including Licensor) without restriction.
50
 
 
50
*
51
51
* 6. All advertising materials mentioning features or use of the Software must
52
52
*    display the following acknowledgment:
53
 
 
53
*
54
54
*     "This product includes software developed by NASA Ames Research Center,
55
 
*     Lawrence Livermore National Laboratory, and Veridian Information 
 
55
*     Lawrence Livermore National Laboratory, and Veridian Information
56
56
*     Solutions, Inc.
57
57
*     Visit www.OpenPBS.org for OpenPBS software support,
58
58
*     products, and information."
59
 
 
59
*
60
60
* 7. DISCLAIMER OF WARRANTY
61
 
 
61
*
62
62
* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS
63
63
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
64
64
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT
65
65
* ARE EXPRESSLY DISCLAIMED.
66
 
 
66
*
67
67
* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE
68
68
* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT,
69
69
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
72
72
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
73
73
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
74
74
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75
 
 
75
*
76
76
* This license will be governed by the laws of the Commonwealth of Virginia,
77
77
* without reference to its choice of law rules.
78
78
*/
79
79
/*
80
80
 * Synopsis:
81
 
 *      long double disrl(int stream, int *retval)
82
 
 *
83
 
 *      Gets a Data-is-Strings floating point number from <stream> and converts
84
 
 *      it into a long double and returns it.  The number from <stream> consists
85
 
 *      of two consecutive signed integers.  The first is the coefficient, with
86
 
 *      its implied decimal point at the low-order end.  The second is the
87
 
 *      exponent as a power of 10.
88
 
 *
89
 
 *      *<retval> gets DIS_SUCCESS if everything works well.  It gets an error
90
 
 *      code otherwise.  In case of an error, the <stream> character pointer is
91
 
 *      reset, making it possible to retry with some other conversion strategy.
92
 
 *
93
 
 *      By fiat of the author, neither loss of significance nor underflow are
94
 
 *      errors.
 
81
 *  long double disrl(int stream, int *retval)
 
82
 *
 
83
 * Gets a Data-is-Strings floating point number from <stream> and converts
 
84
 * it into a long double and returns it.  The number from <stream> consists
 
85
 * of two consecutive signed integers.  The first is the coefficient, with
 
86
 * its implied decimal point at the low-order end.  The second is the
 
87
 * exponent as a power of 10.
 
88
 *
 
89
 * *<retval> gets DIS_SUCCESS if everything works well.  It gets an error
 
90
 * code otherwise.  In case of an error, the <stream> character pointer is
 
91
 * reset, making it possible to retry with some other conversion strategy.
 
92
 *
 
93
 * By fiat of the author, neither loss of significance nor underflow are
 
94
 * errors.
95
95
 */
96
96
 
97
97
#include <pbs_config.h>   /* the master config generated by configure */
112
112
#endif /* LDBL_MAX */
113
113
 
114
114
#define LDBL_MAX DBL_MAX
 
115
 
115
116
#endif /* SIZEOF_LONG_DOUBLE == SIZEOF_DOUBLE */
116
117
 
 
118
#if defined(__GNUC__) && defined(__DBL_MAX__)
 
119
 
 
120
#ifdef LDBL_MAX
 
121
#undef LDBL_MAX
 
122
#endif /* LDBL_MAX */
 
123
 
 
124
#define LDBL_MAX __DBL_MAX__
 
125
 
 
126
 
 
127
#ifdef HUGE_VAL
 
128
#undef HUGE_VAL
 
129
#endif
 
130
#define HUGE_VAL LDBL_MAX
 
131
 
 
132
#endif
 
133
 
 
134
 
 
135
 
117
136
dis_long_double_t disrl(
118
137
 
119
138
  int  stream,
120
139
  int *retval)
121
140
 
122
141
  {
123
 
  int           expon;
124
 
  unsigned      uexpon;
125
 
  int           locret;
126
 
  int           negate;
127
 
  unsigned      ndigs;
128
 
  unsigned      nskips;
129
 
  dis_long_double_t     ldval;
 
142
  int  expon;
 
143
  unsigned uexpon;
 
144
  int  locret;
 
145
  int  negate;
 
146
  unsigned ndigs;
 
147
  unsigned nskips;
 
148
  dis_long_double_t  ldval;
130
149
 
131
150
  assert(retval != NULL);
132
151
  assert(disr_commit != NULL);
133
152
 
134
 
        ldval = 0.0L;
135
 
        locret = disrl_(stream, &ldval, &ndigs, &nskips, LDBL_DIG, 1);
136
 
        if (locret == DIS_SUCCESS) {
137
 
                locret = disrsi_(stream, &negate, &uexpon, 1);
138
 
                if (locret == DIS_SUCCESS) {
139
 
                        expon = negate ? nskips - uexpon : nskips + uexpon;
140
 
                        if (expon + (int)ndigs > LDBL_MAX_10_EXP) {
141
 
                                if (expon + (int)ndigs > LDBL_MAX_10_EXP + 1) {
142
 
                                        ldval = ldval < 0.0L ?
143
 
                                            -HUGE_VAL : HUGE_VAL;
144
 
                                        locret = DIS_OVERFLOW;
145
 
                                } else {
146
 
                                        ldval *= disp10l_(expon - 1);
147
 
                                        if (ldval > LDBL_MAX / 10.0L) {
148
 
                                                ldval = ldval < 0.0L ?
149
 
                                                    -HUGE_VAL : HUGE_VAL;
150
 
                                                locret = DIS_OVERFLOW;
151
 
                                        } else
152
 
                                                ldval *= 10.0L;
153
 
                                }
154
 
                        } else {
155
 
                                if (expon < LDBL_MIN_10_EXP) {
156
 
                                        ldval *= disp10l_(expon + (int)ndigs);
157
 
                                        ldval /= disp10l_((int)ndigs);
158
 
                                } else
159
 
                                        ldval *= disp10l_(expon);
160
 
                        }
161
 
                }
162
 
        }
 
153
  ldval = 0.0L;
 
154
  locret = disrl_(stream, &ldval, &ndigs, &nskips, LDBL_DIG, 1);
 
155
 
 
156
  if (locret == DIS_SUCCESS)
 
157
    {
 
158
    locret = disrsi_(stream, &negate, &uexpon, 1);
 
159
 
 
160
    if (locret == DIS_SUCCESS)
 
161
      {
 
162
      expon = negate ? nskips - uexpon : nskips + uexpon;
 
163
 
 
164
      if (expon + (int)ndigs > LDBL_MAX_10_EXP)
 
165
        {
 
166
        if (expon + (int)ndigs > LDBL_MAX_10_EXP + 1)
 
167
          {
 
168
          ldval = ldval < 0.0L ?
 
169
                  -HUGE_VAL : HUGE_VAL;
 
170
          locret = DIS_OVERFLOW;
 
171
          }
 
172
        else
 
173
          {
 
174
          ldval *= disp10l_(expon - 1);
 
175
 
 
176
          if (ldval > LDBL_MAX / 10.0L)
 
177
            {
 
178
            ldval = ldval < 0.0L ?
 
179
                    -HUGE_VAL : HUGE_VAL;
 
180
            locret = DIS_OVERFLOW;
 
181
            }
 
182
          else
 
183
            ldval *= 10.0L;
 
184
          }
 
185
        }
 
186
      else
 
187
        {
 
188
        if (expon < LDBL_MIN_10_EXP)
 
189
          {
 
190
          ldval *= disp10l_(expon + (int)ndigs);
 
191
          ldval /= disp10l_((int)ndigs);
 
192
          }
 
193
        else
 
194
          ldval *= disp10l_(expon);
 
195
        }
 
196
      }
 
197
    }
163
198
 
164
199
  if ((*disr_commit)(stream, locret == DIS_SUCCESS) < 0)
165
200
    locret = DIS_NOCOMMIT;