File: pvmftasks.m4

package info (click to toggle)
pvm 3.4.5-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,480 kB
  • ctags: 6,227
  • sloc: ansic: 71,630; makefile: 1,216; fortran: 631; sh: 511; csh: 73; asm: 37
file content (62 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (14)
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

/* $Id: pvmftasks.m4,v 1.4 1997/05/07 18:07:32 pvmsrc Exp $ */

#include "pvm3.h"
#include "pvm_consts.h"
#include "../src/bfunc.h"

void
FUNCTION(pvmftasks)
	ARGS(`where,
		ntaskp,
		tidp,
		ptidp,
		hostp,
		flagp,
		STRING_ARG(a_out),
		infop')

	int *where, *ntaskp, *tidp, *ptidp, *hostp, *flagp, *infop;
	STRING_ARG_DECL(a_out);
{
	static struct pvmtaskinfo *tip = 0;
	static int ntask = 0;
	static int next = 0;

	int nt;
	int cc;

/* if user sets ntaskp to -1 then pvmftasks() will be reset */

    if ( ntask && ntaskp && (*ntaskp == -1) )
        ntask = 0;

	if ( !ntask ) {
		if ( (cc = pvm_tasks( *where, &nt, &tip )) < 0 ) {
			*infop = cc;
			return;
		}
		ntask = nt;
		next = 0;
	}

	if ( next < ntask ) {
		if ( ntaskp ) *ntaskp = ntask;
		if ( tidp ) *tidp = tip[ next ].ti_tid;
		if ( ptidp ) *ptidp = tip[ next ].ti_ptid;
		if ( hostp ) *hostp = tip[ next ].ti_host;
		if ( flagp ) *flagp = tip[ next ].ti_flag;
		if ( STRING_PTR(a_out) )
			ctofstr( STRING_PTR(a_out), STRING_LEN(a_out),
					tip[ next ].ti_a_out );
		*infop = 1;
		next++;
	}

/* cannot return ti_pid without changing interface */
/* users needing this will have to use C           */

	if ( next == ntask )
		ntask = 0;
}