Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields  

ToyMem.h

00001 /***************************************************************************
00002                           ToyMem.h  -  description
00003                              -------------------
00004     begin                : Sat Jan 25 2003
00005     copyright            : (C) 2003 by Tyler Montbriand
00006     student #            : 200200370
00007     class                : CS330
00008     email                : monttyle@heavyspace.ca 
00009 ***************************************************************************/
00010 
00011 #ifndef __TOYMEM_H__
00012 #define __TOYMEM_H__
00013 
00014 #ifdef __cplusplus
00015   extern "C" {
00016 #endif/*__cplusplus*/
00017 
00026 
00028 #define MAX_PROCESSES 10
00029 
00030 #define MIN_MEMSIZE   1000
00031 
00032 #define TMM_CONSOLE_PROMPT "[%03d]$ "
00033 
00035 typedef struct InvPageTable
00036 {
00038   int ID;
00040   int page;
00042   int status;
00043 } InvPageTable;
00044 
00051 typedef struct ToyMM
00052 {
00054   struct Process *processList[MAX_PROCESSES];
00056   union ToyMem   *mem;
00058   int             memSize;
00060   struct SegList *memFree;
00062   int             pageSize;  
00064   InvPageTable   *invPageTable;
00065 /*  int             freePages;*/
00067   int             page;
00069   FILE            *swap;
00070 
00071   int              watchPaging;
00072 } ToyMM;
00073 
00080 typedef enum ErrMessage_t
00081 {
00083   ERR_UNKNOWN=-1,
00085   ERR_INVALIDINPUT=0,
00087   ERR_PROCESSEXISTS=1,
00089   ERR_NOFILE,
00091   ERR_INVALIDFILE,
00093   ERR_DATAOVERFLOW,
00095   ERR_INVALIDINSTRUCTION,
00097   ERR_INVALIDDATA,
00099   ERR_INSUFFICIENTMEM,
00101   ERR_INVALIDADDRESS,
00103   ERR_NOPROCESS,
00105   ERR_NOPRIVILEGE,
00107   ERR_PARSEEND,
00109   ERR_UNIMPLEMENTED,
00111   ERR_HEAPFULL,
00113   ERR_BADFREEHEAPADDRESS,
00115   ERR_BADREALLOCADDRESS,
00117   ERR_INVALIDPAGESIZE,
00119   ERR_NOPAGING,
00121   ERR_NOENABLEPAGEPRIVELEGE,
00123   ERR_NONE
00124 } ErrMessage_t;
00125 
00126 
00128 ToyMM *TMM_Create(int memsize);
00129 
00131 ErrMessage_t TMM_Free(ToyMM *tmm);
00132 
00134 int TMM_ParseFile(const char *fname, ToyMM *tm);
00135 
00141 int TMM_ParseFilePtr(FILE *fp, ToyMM *tm, int prompt);
00142 
00143 
00147 #ifdef __cplusplus
00148   }
00149 #endif/*__cplusplus*/
00150  
00151 #endif/*__TOYMEM_H__*/

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