Newsgroups: comp.parallel.pvm
From: pxu8785@ucs.usl.edu (Uthayopas Putchong)
Subject: PET V0.1
Organization: Univ. of Southwestern La., Lafayette
Date: 18 Aug 1995 22:54:04 GMT
Message-ID: <4135mc$r4v@rouge.usl.edu>

********** Announcement ***************
---------------------------------------------
PET ( Pvm Encoding Translator) v0.1 alpha
---------------------------------------------

Introduction

This program is a home-made utility that I developed to help me
encode the complex data structure in the form that usable
by PVM program. This will reduce a lot of errors arises from the 
misplace of pvm_pk* and pvm_upk* library call. Hope that this 
utility will be useful for you. 


Features 

- Support most of PVM data types such as: float, double,
  char(byte), int, long , short 
- 2 data structure : structure and sequence ( see examples)
- packing of multi-dimensional array (up to 4 dimensions)
- packing of fix size array (both structure and sequence)
- packing of variable size array ( sequence only)

How it works

Suppose you want to exchange the data structure such as:

struct msg1 {
	int msgtype;
	int x;
	int y;
	};

We start by writing a "Data Definition" file like this: 
#
#	Data Definition  <- Comment begin with # in the first col
#
struct msg1
{			 <- Must be on seperate line
	int msgtype
	int x
	int y
}			 <- This too...

OK. We finish and save this in file name "spec".
The next step is to translate the definition.

% pet spec
PET (Pvm Encoding Translator) 0.1 alpha
By Putchong Uthayopas (Aug 1,1995)
CACS, Univeristy of Southwestern Louisiana
001:  struct msg1
002:  {
003:  	int msgtype
004:  	int x
005:  	int y
006:  }
Total: 6 lines

Generate out put file...code generation completed
done

PET will generate 2 files, pet.h and pet.c which contain
C language declaration and C code to pack and unpack data
structure.

========== spec.h ==========
/*
 * PET (Pvm Encoding Translator) Version 0.1 alpha
 * Fri Aug 18 13:35:18 1995
 */
/*  1 data structures generated. */

struct msg1 {
	int	msgtype;
	int	x;
	int	y;
};
========== spec.c ==========
/*
 * PET (Pvm Encoding Translator) Version 0.1 alpha
 * Fri Aug 18 13:35:18 1995
 */
#include "spec.h"
/*
 * Pack and Unpack msg1
 */
int pk_msg1(p)
struct msg1 *p;
{
	pvm_pkint(&p->msgtype,1,1);
	pvm_pkint(&p->x,1,1);
	pvm_pkint(&p->y,1,1);
}

int upk_msg1(p)
struct msg1 *p;
{
	pvm_upkint(&p->msgtype,1,1);
	pvm_upkint(&p->x,1,1);
	pvm_upkint(&p->y,1,1);
}

When you write your program , just include spec.h and link the
application with spec.c. 

---------------------------------------
For more information see: 
http://www.cacs.usl.edu/~pu
Any commments are very welcome.
Putchong Uthayopas
pu@swamp.cacs.usl.edu
---------------------------------------
-- 
                                       -   -               ___ 
Putchong Uthayopas                    -  ---   (|====   ========= 
EMAIL: pxu8785@usl.edu                 -            \     // 
WWW  : http://www.cacs.usl.edu/~pu    -     -       (|||||)O      

