Main Page | Class List | File List | Class Members | File Members

instructions.cpp File Reference

#include <iostream>
#include "instructions.h"
#include "world.h"

Include dependency graph for instructions.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define process2entity(PROC)   *static_cast<entity*>(&(PROC.getProgram()))
#define vm2world(VM)   *static_cast<world*>(&VM)

Functions

void instr_null (virtualMachine &vm, process &proc, thread &t)
 do nothing

void instr_increment (virtualMachine &vm, process &proc, thread &t)
 increment a value

void instr_and (virtualMachine &vm, process &proc, thread &t)
 logically AND two values and store the result

void instr_or (virtualMachine &vm, process &proc, thread &t)
 logically OR two values and store the result

void instr_copy (virtualMachine &vm, process &proc, thread &t)
 copy data between addresses

void instr_decrement (virtualMachine &vm, process &proc, thread &t)
 decrement a value

void instr_add (virtualMachine &vm, process &proc, thread &t)
 sum two values and store the result

void instr_sub (virtualMachine &vm, process &proc, thread &t)
 subtract two values and store the result

void instr_switch (virtualMachine &vm, process &proc, thread &t)
 test a value to determine the next instruction to execute

void instr_spawnThread (virtualMachine &vm, process &proc, thread &t)
 spawn a new thread

void instr_killThread (virtualMachine &vm, process &proc, thread &t)
 kill a thread

void instr_moveFoward (virtualMachine &vm, process &proc, thread &t)
 move foward

void instr_rotate (virtualMachine &vm, process &proc, thread &t)
 rotate left or right

void instr_transferEnergy (virtualMachine &vm, process &proc, thread &t)
 transfer energy to another entity

void instr_absorbEnergy (virtualMachine &vm, process &proc, thread &t)
 absorb energy from the world

void instr_giveMemory (virtualMachine &vm, process &proc, thread &t)
 transfer memory to the entity/tile infront

void instr_takeMemory (virtualMachine &vm, process &proc, thread &t)
 take memory from the entity infront

void instr_convertEnergyToMemory (virtualMachine &vm, process &proc, thread &t)
 convert energy to memory

void instr_convertMemoryToEnergy (virtualMachine &vm, process &proc, thread &t)
 convert memory to energy


Define Documentation

#define process2entity PROC   )     *static_cast<entity*>(&(PROC.getProgram()))
 

Definition at line 8 of file instructions.cpp.

Referenced by world::canBeExecuted(), instr_absorbEnergy(), instr_add(), instr_and(), instr_convertEnergyToMemory(), instr_convertMemoryToEnergy(), instr_copy(), instr_decrement(), instr_giveMemory(), instr_increment(), instr_killThread(), instr_moveFoward(), instr_null(), instr_or(), instr_rotate(), instr_spawnThread(), instr_sub(), instr_switch(), instr_takeMemory(), instr_transferEnergy(), and world::kill().

#define vm2world VM   )     *static_cast<world*>(&VM)
 

Definition at line 9 of file instructions.cpp.

Referenced by instr_absorbEnergy(), instr_add(), instr_and(), instr_convertEnergyToMemory(), instr_convertMemoryToEnergy(), instr_copy(), instr_decrement(), instr_giveMemory(), instr_increment(), instr_killThread(), instr_moveFoward(), instr_null(), instr_or(), instr_rotate(), instr_spawnThread(), instr_sub(), instr_switch(), instr_takeMemory(), and instr_transferEnergy().


Function Documentation

void instr_absorbEnergy virtualMachine &  vm,
process &  proc,
thread &  t
 

absorb energy from the world

Definition at line 370 of file instructions.cpp.

References world::absorbEnergy(), process2entity, and vm2world.

Referenced by initWorld().

void instr_add virtualMachine &  vm,
process &  proc,
thread &  t
 

sum two values and store the result

Definition at line 155 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_and virtualMachine &  vm,
process &  proc,
thread &  t
 

logically AND two values and store the result

Definition at line 48 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

void instr_convertEnergyToMemory virtualMachine &  vm,
process &  proc,
thread &  t
 

convert energy to memory

Definition at line 423 of file instructions.cpp.

References world::convertEnergyToMemory(), energy, process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_convertMemoryToEnergy virtualMachine &  vm,
process &  proc,
thread &  t
 

convert memory to energy

Definition at line 443 of file instructions.cpp.

References world::convertMemoryToEnergy(), process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_copy virtualMachine &  vm,
process &  proc,
thread &  t
 

copy data between addresses

Definition at line 106 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_decrement virtualMachine &  vm,
process &  proc,
thread &  t
 

decrement a value

Definition at line 131 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_giveMemory virtualMachine &  vm,
process &  proc,
thread &  t
 

transfer memory to the entity/tile infront

Definition at line 383 of file instructions.cpp.

References world::giveMemory(), process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_increment virtualMachine &  vm,
process &  proc,
thread &  t
 

increment a value

Definition at line 25 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_killThread virtualMachine &  vm,
process &  proc,
thread &  t
 

kill a thread

Definition at line 277 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_moveFoward virtualMachine &  vm,
process &  proc,
thread &  t
 

move foward

Definition at line 307 of file instructions.cpp.

References world::moveEntity(), process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_null virtualMachine &  vm,
process &  proc,
thread &  t
 

do nothing

Definition at line 12 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_or virtualMachine &  vm,
process &  proc,
thread &  t
 

logically OR two values and store the result

Definition at line 77 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

void instr_rotate virtualMachine &  vm,
process &  proc,
thread &  t
 

rotate left or right

Definition at line 323 of file instructions.cpp.

References process2entity, world::releaseEnergy(), world::rotateEntityLeft(), world::rotateEntityRight(), and vm2world.

Referenced by initWorld().

void instr_spawnThread virtualMachine &  vm,
process &  proc,
thread &  t
 

spawn a new thread

Definition at line 247 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_sub virtualMachine &  vm,
process &  proc,
thread &  t
 

subtract two values and store the result

Definition at line 184 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_switch virtualMachine &  vm,
process &  proc,
thread &  t
 

test a value to determine the next instruction to execute

Definition at line 217 of file instructions.cpp.

References process2entity, world::releaseEnergy(), and vm2world.

Referenced by initWorld().

void instr_takeMemory virtualMachine &  vm,
process &  proc,
thread &  t
 

take memory from the entity infront

Definition at line 403 of file instructions.cpp.

References process2entity, world::releaseEnergy(), world::takeMemory(), and vm2world.

Referenced by initWorld().

void instr_transferEnergy virtualMachine &  vm,
process &  proc,
thread &  t
 

transfer energy to another entity

Definition at line 350 of file instructions.cpp.

References energy, process2entity, world::releaseEnergy(), world::transferEnergy(), and vm2world.

Referenced by initWorld().


Generated on Sun Mar 6 22:11:25 2005 for experiment03 by doxygen 1.3.7