Newsgroups: comp.parallel.pvm
From: pxu8785@ucs.usl.edu (Uthayopas Putchong)
Subject: Re: Help: seek tool to convert C struct to pvmpack and unpack code
Organization: Univ. of Southwestern La., Lafayette
Date: 18 Sep 1995 23:23:16 GMT
Message-ID: <43kv14$pvf@rouge.usl.edu>

In article <1995Sep14.120002.45388@yogi.urz.unibas.ch>,
Niandong Fang <fang@violett.ifi.unibas.ch> wrote:
>Dear PVM netter,
>
>I read in this news group that someone implemented a tool to convert C struct to pvmpack and unpack code,
>But unfortunately I did not notice it down. Can someone tell me how can I get the code?
>
>Thanks in advanced.
>
>Regards,
>Niandong
>
>---
>********************************************************************
>Niandong Fang                   *       Tel. + 41 61 321 99 67
>Institut fuer Informatik        *       Fax  + 41 61 321 99 15
>Universitaet Basel              *  
>Mittlere Strasse 142            *       email: fang@ifi.unibas.ch
>CH-4056 Basel                   *            (NeXT mail accepted)
>Switzerland                     *
>********************************************************************
>

Hi, I think that you talk about my home-made utility.
Here's more information. 

Putchong Uthayopas

********** Announcement ***************
---------------------------------------------
PET ( Pvm Encoding Tool) v0.1 
---------------------------------------------

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.<p>

I'm working on a document right now and should finish briefly after this.

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 Tool) 0.1 
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 Tool) 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 Tool) Version 0.1 
 * 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                    -  ---   (|====   ========= 
EMAIL: pxu8785@usl.edu                 -            \     // 
WWW  : http://www.cacs.usl.edu/~pu    -     -       (|||||)O      

