wrf_num_bytes_between.c
References to this file elsewhere.
1 #include <stdio.h>
2
3 #ifndef CRAY
4 # ifdef NOUNDERSCORE
5 # define WRF_NUM_BYTES_BETWEEN wrf_num_bytes_between
6 # define GET_INITIAL_DATA_VALUE get_initial_data_value
7 # define WHAT_IS_A_NAN what_is_a_nan
8 # define WRF_MEM_COPY wrf_mem_copy
9 # else
10 # ifdef F2CSTYLE
11 # define WRF_NUM_BYTES_BETWEEN wrf_num_bytes_between__
12 # define GET_INITIAL_DATA_VALUE get_initial_data_value__
13 # define WHAT_IS_A_NAN what_is_a_nan__
14 # define WRF_MEM_COPY wrf_mem_copy__
15 # else
16 # define WRF_NUM_BYTES_BETWEEN wrf_num_bytes_between_
17 # define GET_INITIAL_DATA_VALUE get_initial_data_value_
18 # define WHAT_IS_A_NAN what_is_a_nan_
19 # define WRF_MEM_COPY wrf_mem_copy_
20 # endif
21 # endif
22 #endif
23
24 WRF_NUM_BYTES_BETWEEN ( a , b , n )
25 char * a ;
26 char * b ;
27 int * n ;
28 {
29 *n = a - b ;
30 if ( *n < 0 ) *n = -(*n) ;
31 }
32
33 /*#define NAN_VALUE */
34 #ifdef NAN_VALUE
35 GET_INITIAL_DATA_VALUE ( n )
36 int * n ;
37 {
38 *n = 0xffc00000 ;
39 }
40 #else
41 GET_INITIAL_DATA_VALUE ( n )
42 float * n ;
43 {
44 *n = 0. ;
45 }
46 #endif
47
48 WHAT_IS_A_NAN ( n )
49 int * n ;
50 {
51 *n = 0xffc00000 ;
52 #if 0
53 *n = 0. ;
54 fprintf(stderr,"WHAT_IS_NAN disabled\n") ;
55 #endif
56 }
57
58 /* SUBROUTINE wrf_mem_copy( a, b, n )
59 INTEGER*1, INTENT (INOUT) :: a(*), b(*)
60 INTEGER, INTENT (IN) :: n
61 INTEGER :: i
62 DO i = 1, n
63 b(i) = a(i)
64 ENDDO
65 RETURN
66 END SUBROUTINE wrf_mem_copy */
67
68 WRF_MEM_COPY ( a , b, n )
69 char * a ;
70 char * b ;
71 int * n ;
72 {
73 int i ;
74 for ( i = 0 ; i < *n ; i++ )
75 {
76 *b++ = *a++ ;
77 }
78 }
79