File: Pvmfconfig.c

package info (click to toggle)
pvm 3.4.6-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,284 kB
  • sloc: ansic: 72,074; makefile: 1,198; fortran: 631; sh: 285; csh: 74; asm: 37
file content (88 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (9)
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

/* $Id: Pvmfconfig.c,v 1.4 2002/04/03 16:13:32 pvmsrc Exp $ */

#ifdef WIN32
#include "..\..\include\pvm3.h"
#include "..\..\src\pvmwin.h"
#else
#include "pvm3.h"
#endif

#include "pvm_consts.h"
#include "../../src/bfunc.h"
void
#ifdef IMA_WIN32_WATCOM
pvmfconfig(nhostp,
		narchp,
		tidp,
		name_ptr,name_len,
		arch_ptr,arch_len
		speedp,
		infop)

	int  *nhostp, *narchp, *tidp, *speedp, *infop;
	char * name_ptr; int name_len;
	char * arch_ptr; int arch_len;
#else
__fortran PVMFCONFIG
	(nhostp,
		narchp,
/* rd		narchp,arch_len, */
		tidp,
		name_ptr,name_len,
/* rd		arch_ptr, */
		arch_ptr,arch_len,
		speedp,
		infop)

	int  *nhostp, *narchp, *tidp, *speedp, *infop;
	char * name_ptr; int name_len;
	char * arch_ptr; int arch_len;
#endif
{
	static struct pvmhostinfo *hip = 0;
	static int nhost = 0;
	static int narch = 0;
	static int next = 0;

	int cc;
	struct pvmhostinfo *hip2;

#ifndef WIN32
	char *malloc();
#endif
/* if user sets nhostp to -1 then pvmfconfig() will be reset */

    if (hip && (*nhostp == -1)) {
        free((char*)hip);
        hip = 0;
    }

	if (!hip) {
		if ((cc = pvm_config(&nhost, &narch, &hip2)) < 0) {
			*infop = cc;
			return;
		}
		hip = (struct pvmhostinfo*)malloc(nhost * sizeof(struct pvmhostinfo));
		BCOPY((char*)hip2, (char*)hip, nhost * sizeof(struct pvmhostinfo));
		next = 0;
	}

	if (next < nhost) {
		*nhostp = nhost;
		*narchp = narch;
		*tidp = hip[next].hi_tid;
		ctofstr(name_ptr, name_len, hip[next].hi_name);
		ctofstr(arch_ptr, arch_len, hip[next].hi_arch);
		*speedp = hip[next].hi_speed;
		*infop = 1;
		next++;

	}

	if (next == nhost) {
		free((char*)hip);
		hip = 0;
	}
}