Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields  

ToyMemType.h

00001 /***************************************************************************
00002                           ToyMemType.h  -  Defines the structures and
00003     main union that represent the Toy Memory Manager's main memory.
00004                              -------------------
00005     begin                : Sat Jan 25 2003
00006     copyright            : (C) 2003 by Tyler Montbriand
00007     student #            : 200200370
00008     class                : CS330
00009     email                : monttyle@heavyspace.ca 
00010 ***************************************************************************/
00011 
00012 #ifndef __TOYMEMTYPE_H__
00013 #define __TOYMEMTYPE_H__
00014 
00015 #ifdef __cplusplus
00016   extern "C" {
00017 #endif/*__cplusplus*/
00018 
00020 #define MAX_STRLEN 20
00021 
00022 /*
00023  *  Toy_MemType.h
00024  *  Defines the structures used for the type of memory
00025  *  the Toy Memory Manager handles;  a single slot in memory
00026  *  can be an integer, a string, or an instruction.
00027  *
00028  */
00029 
00031 typedef enum InstructionType_e
00032 {
00034   INSTRUCTION_ERROR = -1,
00036   INSTRUCTION_RUN   = 0,
00038   INSTRUCTION_HALT
00039 } InstructionType_e;
00040 
00042 typedef enum DataType_e
00043 {
00045   DATA_ERROR    =-1,
00047   DATA_MAGIC    = 0,
00049   DATA_INTEGER  = 1,
00051   DATA_STRING,
00053   DATA_INSTRUCTION
00054 } DataType_e;
00055 
00057 typedef struct ToyMem_Integer
00058 {
00060   DataType_e type;
00062   unsigned int value;
00063 } ToyMem_Integer;
00064 
00066 typedef struct ToyMem_String
00067 {
00069   DataType_e type;
00071   char value[MAX_STRLEN+1];
00072 } ToyMem_String;
00073 
00075 typedef struct ToyMem_Instruction
00076 {
00078   DataType_e type;
00080   InstructionType_e value;
00081 } ToyMem_Instruction;
00082 
00097 typedef union ToyMem
00098 {
00100   DataType_e type;
00102   ToyMem_Instruction  instruction;
00104   ToyMem_String       string;
00106   ToyMem_Integer      integer;  
00107 } ToyMem;
00108 
00109 #ifdef __cplusplus
00110   }
00111 #endif/*__cplusplus*/
00112 
00113 #endif/*__TOYMEMTYPE_H__*/

Generated on Fri Apr 4 14:29:07 2003 for ToyMem by doxygen1.3-rc3