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