00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __RIOMMINDEXPARSER_H__
00019 #define __RIOMMINDEXPARSER_H__
00020
00021 #include "RioInterfaceTypes.h"
00022 #include "RioInterface.h"
00023 #include "RioMMIndex.h"
00024
00025 #include "tqueue.h"
00026 #include "tstring.h"
00027
00028 #include <stdio.h>
00029
00030 typedef struct
00031 {
00032 TString name;
00033 unsigned char n_args;
00034 unsigned int arg_types;
00035 void (*callback)( void *, TQueue & );
00036 } RioMMCommand;
00037
00038 class CRioMMIndexParser
00039 {
00040 private:
00041
00042 typedef enum {
00043 TK_INVALID,
00044 TK_EOF,
00045
00046 TK_INTEGER,
00047 TK_STRING,
00048
00049 TK_LCBRAC,
00050 TK_RCBRAC,
00051
00052 TK_LBRAC,
00053 TK_RBRAC,
00054
00055 TK_LPAR,
00056 TK_RPAR,
00057
00058 TK_COMMA,
00059 TK_SEMICOL,
00060
00061 TK_VERSION,
00062 TK_ARCHIVE,
00063 TK_FILE,
00064 TK_SLIDE,
00065 TK_OPENURL,
00066 TK_COMMAND
00067 } TokenType;
00068
00069
00070 static const char * token_name[];
00071
00072
00073 static CRioMMIndex * index;
00074
00075
00076 static FILE * file;
00077 static int line_number;
00078
00079
00080 static TokenType token_type;
00081 static char token_string[ 256 ];
00082 static int token_offset;
00083
00084
00085 static int integer_value;
00086 static RioBlock index_value;
00087
00088
00089 static RioBlock command_index;
00090 static bool quit_on_errors;
00091
00092
00093 static void FilesDeclaration ( void );
00094 static void FileDeclaration ( void );
00095 static void SlidesDeclaration ( void );
00096 static void SlideDeclaration ( void );
00097 static void CommandsDeclaration ( void );
00098 static void CommandDeclaration ( void );
00099 static void ArgumentsDeclaration( void );
00100
00101
00102 static void ReportError( const char * );
00103 static void Match ( TokenType );
00104 static TokenType GetToken ( void );
00105
00106
00107 static void InitVars( void );
00108 public:
00109 static CRioMMIndex * ParseIndex( FILE *, RioBlock );
00110 static bool ParseCommand( FILE *, RioMMCommand *, TQueue &, RioBlock *,
00111 int * );
00112 };
00113
00114 #endif