File: mpe_logf.c

package info (click to toggle)
mpich 1.1.0-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 22,116 kB
  • ctags: 27,349
  • sloc: ansic: 193,435; sh: 11,172; fortran: 6,545; makefile: 5,801; cpp: 5,020; tcl: 3,548; asm: 3,536; csh: 1,079; java: 614; perl: 183; awk: 168; sed: 70; f90: 62
file content (211 lines) | stat: -rw-r--r-- 4,742 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* mpe_log.c */
/* Custom Fortran interface file */
/* These have been edited because they require special string processing */
#ifndef DEBUG_ALL
#define DEBUG_ALL
#endif
#include <stdio.h>
#include "mpe.h"

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#else
extern char *malloc();
extern void free();
#endif

/* This is needed to process Cray - style character data */
#ifdef _CRAY
#include <fortran.h>
#endif

#ifdef POINTER_64_BITS
extern void *MPIR_ToPointer();
extern int MPIR_FromPointer();
extern void MPIR_RmPointer();
#else
#define MPIR_ToPointer(a) (a)
#define MPIR_FromPointer(a) (int)(a)
#define MPIR_RmPointer(a)
#endif

#ifdef FORTRANCAPS
#define mpe_init_log_ MPE_INIT_LOG
#define mpe_start_log_ MPE_START_LOG
#define mpe_stop_log_ MPE_STOP_LOG
#define mpe_describe_state_ MPE_DESCRIBE_STATE
#define mpe_describe_event_ MPE_DESCRIBE_EVENT
#define mpe_log_event_ MPE_LOG_EVENT
#define mpe_finish_log_ MPE_FINISH_LOG
#elif defined(FORTRANDOUBLEUNDERSCORE)
#define mpe_init_log_ mpe_init_log__
#define mpe_start_log_ mpe_start_log__
#define mpe_stop_log_ mpe_stop_log__
#define mpe_describe_state_ mpe_describe_state__
#define mpe_describe_event_ mpe_describe_event__
#define mpe_log_event_ mpe_log_event__
#define mpe_finish_log_ mpe_finish_log__
#elif defined(FORTRANNOUNDERSCORE)
#define mpe_init_log_ mpe_init_log
#define mpe_start_log_ mpe_start_log
#define mpe_stop_log_ mpe_stop_log
#define mpe_describe_state_ mpe_describe_state
#define mpe_describe_event_ mpe_describe_event
#define mpe_log_event_ mpe_log_event
#define mpe_finish_log_ mpe_finish_log
#endif

/* 
 * In order to suppress warnings about missing prototypes, we've added
 * them to this file.
 */

/* 
   This function makes a copy of a Fortran string into a C string.  Some
   Unix Fortran compilers add nulls at the ends of string CONSTANTS, but
   (a) not for substring expressions and (b) not all compilers do so (e.g.,
   RS6000)
 */
static char *mpe_tmp_cpy ANSI_ARGS(( char *, int ));
int mpe_init_log_ ANSI_ARGS(( void ));
int mpe_start_log_ ANSI_ARGS(( void ));
int mpe_stop_log_ ANSI_ARGS(( void ));

static char *mpe_tmp_cpy( s, d )
char *s;
int  d;
{
    char *p;
    p = (char *)malloc( d + 1 );
    if (!p) ;
    strncpy( p, s, d );
    p[d] = 0;
    return p;
}

int  mpe_init_log_()
{
    return MPE_Init_log();
}
int  mpe_start_log_()
{
    return MPE_Start_log();
}
int  mpe_stop_log_()
{
    return MPE_Stop_log();
}

#ifdef _CRAY
int  mpe_describe_state_( start, end, name, color )
int *start, *end;
_fcd name, color;
{
    char *c1, *c2;
    int  err;
    c1 = mpe_tmp_cpy( _fcdtocp( name ), _fcdlen( name ) );
    c2 = mpe_tmp_cpy( _fcdtocp( color ), _fcdlen( color ) );
    err = MPE_Describe_state(*start,*end,c1, c2);
    free( c1 );
    free( c2 );
    return err;
}
#else
int mpe_describe_state_ ANSI_ARGS(( int *, int *, char *, char *, int, int ));
int  mpe_describe_state_( start, end, name, color, d1, d2 )
int *start, *end;
char *name, *color;
int  d1, d2;
{
    char *c1, *c2;
    int  err;
    c1 = mpe_tmp_cpy( name, d1 );
    c2 = mpe_tmp_cpy( color, d2 );
    err = MPE_Describe_state(*start,*end,c1, c2);
    free( c1 );
    free( c2 );
    return err;
}
#endif

#ifdef _CRAY
int mpe_describe_event_( event, name )
int *event;
_fcd name;
{
    char *c1;
    int  err;
    c1 = mpe_tmp_cpy( _fcdtocp( name ), _fcdlen( name ) );
    err = MPE_Describe_event(*event,c1);
    free( c1 );
    return err;
}
#else
int mpe_describe_event_ ANSI_ARGS(( int *, char *, int ));
int  mpe_describe_event_( event, name, d1)
int *event;
char *name;
int  d1;
{
    char *c1;
    int  err;
    c1 = mpe_tmp_cpy( name, d1 );
    err = MPE_Describe_event(*event,c1);
    free( c1 );
    return err;
}
#endif

#ifdef _CRAY
int  mpe_log_event_(event,data,string)
int *event, *data;
_fcd string;
{
    char *c1;
    int  err;
    c1 = mpe_tmp_cpy( _fcdtocp( string ), _fcdtocp( string ) );
    err = MPE_Log_event(*event,*data,c1);
    free( c1 );
    return err;
}
#else
int mpe_log_event_ ANSI_ARGS(( int *, int *, char *, int ));
int  mpe_log_event_(event,data,string, d1)
int *event, *data;
char *string;
int  d1;
{
    char *c1;
    int  err;
    c1 = mpe_tmp_cpy( string, d1 );
    err = MPE_Log_event(*event,*data,c1);
    free( c1 );
    return err;
}
#endif

#ifdef _CRAY
int  mpe_finish_log_( filename)
_fcd filename;
{
    char *c1;
    int  err;
    c1 = mpe_tmp_cpy( _fcdtocp( filename ), _fcdtocp( filename ) );
    err =  MPE_Finish_log(c1);
    free( c1 );
    return err;
}
#else
int mpe_finish_log_ ANSI_ARGS(( char *, int ));
int  mpe_finish_log_( filename, d1)
char *filename;
int  d1;
{
    char *c1;
    int  err;
    c1 = mpe_tmp_cpy( filename, d1 );
    err =  MPE_Finish_log(c1);
    free( c1 );
    return err;
}
#endif