/*
       -= SEER - C-Scripting engine v 0.94a =-
State      : under implementation
Author     : Przemyslaw Podsiadly
             email: ppodsiad@elka.pw.edu.pl
             WWW:   http://home.elka.pw.edu.pl/~ppodsiad/seer
File:exscript.sc
Desc:example of script type: how to easly communicate between scripts
*/

#title "ExScript"
#author "Przemyslaw Podsiadly 1999"

import int printf(char *,...);

//The SCRIPT stuff:
script CowScript{
 void moo();
 void eat();
 void rush();
};

import bool createCow(CowScript &s,char *name,char *typeOf=typeof(CowScript));
import void killCow(CowScript &s);

script DogScript{
 void bark();
 void guard();
 void sleep();
};

import bool createDog(CowScript &s,char *name,char *typeOf=typeof(DogScript));
import void killDog(CowScript &s);

export main;

int main()
{
 CowScript cow[3];
 DogScript dog;

 //create instances
 if (!createCow(cow[0],"Mucka")) return 1;
 if (!createCow(cow[1],"Ducka")) return 1;
 if (!createCow(cow[2],"Lucka")) return 1;
 if (!createDog(dog,"Willy")) return 1;
 
 //interact with them
 cow[0].moo();
 cow[1].eat();
 cow[2].moo();
 dog.bark();
 dog.guard();
 cow[2].eat();
 cow[0].rush();
 dog.bark();
 cow[0].eat();
 dog.sleep();
 cow[0].rush();
 cow[1].moo();
 cow[2].rush();
 cow[1].rush();
 
 //now free all instances
 killCow(cow[0]);
 killCow(cow[1]);
 killCow(cow[2]);
 killDog(dog);
 
 return 0;
}