UCLA Parallel Computing Laboratory

blue beaded border

Code Modifications for Maisie to Parsec

Several changes to Maisie code are necessary before it can be used with the Parsec compiler.

Header Files

The header file, indicated at the begining of the code as "maisie.h", is still necessary. If the header file name is "mayc.h", please change it to "maisie.h".

Example:
#include "maisie.h"

Compilation of the Parsec source file will generate an ".mo" file, containing prototypes for entities and messages. The ".mo" file will then be recompiled.

ANCI C Format

All variable and parameter declarations in entities and friend functions must obey the ANSI C format. For the sake of consistency, it is desirable that all C functions declared in a Parsec program, to also use ANSI C format, although this is not enforced by the Parsec compiler.

Old Format:
entity job{ cpu, disk, dmean }
ename disk, cpu;
int dmean;
{
   message ack { }  ack1;
   message finish { } finish1;
   int i, t, end, start, t_wait, tid; 
   invoke cpu with req {self}; 
   . . . . 
New Format:
entity job{ ename cpu, ename disk, int dmean }
{
   message ack { }  ack1;
   message finish { } finish1;
   int i, t, end, start, t_wait, tid; 
   invoke cpu with req {self}; 
   . . . . 


Friend Functions

Friend functions may be defined inside or outside an entity and the definitions must follow ANSI C syntax rules. A friend function must also have been defined prior to its use within an entity.

If a function, say f has been defined, and is subsequently declared as a friend function within an entity, it is not necessary for the declaration to include the function prototype.

Message Declarations

All message type definitions must include the message type name, followed by the parameters in curly braces. The curly braces are required even in the definition of message types with no parameters (the previous version of the compiler allowed the curly braces to be omitted for parameterless messages).

Legal Syntax:
entity job{ ename cpu, ename disk, 
            int dmean }
{
   message ack { }  ack1;
   message finish{};
   int i, t, end, start, t_wait, tid; 
   invoke cpu with req {self}; 
   . . . . 
Illegal Syntax:
entity job{ ename cpu, ename disk, 
            int dmean }
{
   message ack ack1;
   message finish;
   int i, t, end, start, t_wait, tid; 
   invoke cpu with req {self}; 
   . . . . 

Maisie on the SP2 required every message type definition to also declare a variable of the type, even if such a variable was not required in the program. This is not necessary in Parsec.

The names of message types in a Parsec program are assumed to be global. In other words, a given identifier, say m1 can be used to define only one message type in a program. In the previous version, it was possible for a programmer to use m1 to define multiple message types (in the declaration of different entity types). Message definitions are global and the message variables are local.

Before:
entity job{ ename cpu, ename disk, 
            int dmean }
{
   message ack { }  ack1;
   message m1 { };
   int i, t, end, start, t_wait, tid; 
   invoke cpu with req {self}; 
   . . . . 


Recommended:
message ack { };
message m1 { };

entity job{ ename cpu, ename disk, 
            int dmea