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