ctest wham newcorr
[unres.git] / source / unres / src_MD-M-newcorr / proc_proc.c
1 #include <stdlib.h>
2 #include <math.h>
3 #include <stdio.h>
4
5 #ifdef CRAY
6 void PROC_PROC(long int *f, int *i)
7 #else
8 #ifdef LINUX
9 #ifdef PGI
10 void proc_proc_(long int *f, int *i)
11 #else
12 void proc_proc__(long int *f, int *i)
13 #endif
14 #endif
15 #ifdef SGI
16 void proc_proc_(long int *f, int *i)
17 #endif
18 #if defined(WIN) &&  !defined(WINIFL)
19 void _stdcall PROC_PROC(long int *f, int *i)
20 #endif
21 #ifdef WINIFL
22 void proc_proc(long int *f, int *i)
23 #endif
24 #if defined(AIX) || defined(WINPGI) 
25 void proc_proc(long int *f, int *i)
26 #endif
27 #endif
28
29 {
30 static long int NaNQ;
31 static long int NaNQm;
32
33 if(*i==-1)
34  {
35  NaNQ=*f;
36  NaNQm=0xffffffff;
37  return;
38  }
39 *i=0;
40 if(*f==NaNQ)
41  *i=1;
42 if(*f==NaNQm)
43  *i=1;
44 }
45
46 #ifdef CRAY
47 void PROC_CONV(char *buf, int *i, int n)
48 #endif
49 #ifdef LINUX
50 void proc_conv__(char *buf, int *i, int n)
51 #endif
52 #ifdef SGI
53 void proc_conv_(char *buf, int *i, int n)
54 #endif
55 #if defined(AIX) || defined(WINPGI)
56 void proc_conv(char *buf, int *i, int n)
57 #endif
58 #ifdef WIN
59 void _stdcall PROC_CONV(char *buf, int *i, int n)
60 #endif
61 {
62 int j;
63
64 sscanf(buf,"%d",&j);
65 *i=j;
66 return;
67 }
68
69 #ifdef CRAY
70 void PROC_CONV_R(char *buf, int *i, int n)
71 #endif
72 #ifdef LINUX
73 void proc_conv_r__(char *buf, int *i, int n)
74 #endif
75 #ifdef SGI
76 void proc_conv_r_(char *buf, int *i, int n)
77 #endif
78 #if defined(AIX) || defined(WINPGI)
79 void proc_conv_r(char *buf, int *i, int n)
80 #endif
81 #ifdef WIN
82 void _stdcall PROC_CONV_R(char *buf, int *i, int n)
83 #endif
84
85 {
86
87 /* sprintf(buf,"%d",*i); */
88
89 return;
90 }
91
92
93 #ifndef IMSL
94 #ifdef CRAY
95 void DSVRGP(int *n, double *tab1, double *tab2, int *itab)
96 #endif
97 #ifdef LINUX
98 void dsvrgp__(int *n, double *tab1, double *tab2, int *itab)
99 #endif
100 #ifdef SGI
101 void dsvrgp_(int *n, double *tab1, double *tab2, int *itab)
102 #endif
103 #if defined(AIX) || defined(WINPGI)
104 void dsvrgp(int *n, double *tab1, double *tab2, int *itab)
105 #endif
106 #ifdef WIN
107 void _stdcall DSVRGP(int *n, double *tab1, double *tab2, int *itab)
108 #endif
109 {
110 double t;
111 int i,j,k;
112
113 if(tab1 != tab2)
114  {
115  for(i=0; i<*n; i++)
116   tab2[i]=tab1[i];
117  }
118 k=0;
119 while(k<*n-1)
120  {
121  j=k;
122  t=tab2[k];
123  for(i=k+1; i<*n; i++)
124   if(t>tab2[i])
125    {
126    j=i;
127    t=tab2[i];
128    }
129  if(j!=k)
130   {
131   tab2[j]=tab2[k];
132   tab2[k]=t;
133   i=itab[j];
134   itab[j]=itab[k];
135   itab[k]=i;
136   }
137  k++;
138  }
139 }
140 #endif