Back to index

kdeartwork  4.3.2
vm.h
Go to the documentation of this file.
00001 #ifndef __VM_H__
00002 #define __VM_H__
00003 
00004 #include <stdlib.h>
00005 #include <stdio.h> /* !!! */
00006 #include <limits.h>
00007 #include "vm_random.h"
00008 
00009 #define       VM_OP_STOP           1
00010 #define       VM_OP_COPY           2
00011 #define       VM_OP_EXEC           3
00012 #define       VM_OP_WAIT           4
00013 #define       VM_OP_PUSH           (INT_MAX/2)
00014 
00015 struct tvm_process {
00016  int                 position;
00017  int*                stack;
00018  int                 stack_top;
00019  int                 age;
00020  int                 reverse;
00021  struct tvm_process* next;
00022 };
00023 
00024 struct tvm_pool {
00025  int*                area;
00026  int                 area_size;
00027  struct tvm_process* processes;
00028  int                 max_stack_size;
00029  int                 max_threads_num;
00030  int                 reverse_enabled;
00031  struct vm_random_data      vm_random_data;
00032 };
00033 
00034 int vm_init_pool( struct tvm_pool**       pool,
00035                   int                     area_size,
00036                   int                     max_stack_size,
00037                   int                     max_threads_num );
00038 void vm_modify( struct tvm_pool*   pool,
00039                 int                position,
00040                 int                op );
00041 void vm_exec( struct tvm_pool*     pool,
00042               int           position,
00043               int           age,
00044               int           reverse );
00045 void vm_enable_reverse( struct tvm_pool*  pool,
00046                         const int         enabled );
00047 int vm_get_reverse( struct tvm_pool*       pool );
00048 void vm_iterate( struct tvm_pool*  pool,
00049                  char*                    modified );
00050 void vm_done_pool( struct tvm_pool*       pool );
00051 
00052 #endif /* !defined( __VM_H__ ) */