#include <cstdio>#include <kglobal.h>#include <klocale.h>#include <limits.h>#include <vector>#include "mealMasterCompiler.hpp"#include "unitMap.hpp"#include "utils.hpp"Go to the source code of this file.
Functions | |
| int | mealMasterlex (void) |
| int | mealMasterrestart (FILE *) |
| static vector< string > | outputBuffer (5) |
| void | writeData (int index, const char *buffer, int size) |
| void | writeUnit (int index, const char *buffer, int size) |
| void | moveData (int index) |
| int | readData (char *buffer, int max_size) |
Variables | |
| long | position |
| int | lineNo |
| int | errorLine |
| int | recipeStartPos |
| int | recipeEndPos |
| int | recipeStartLine |
| int | recipeEndLine |
| const char * | errorMessage |
| static istream * | currentInput |
| int mealMasterlex | ( | void | ) |
| int mealMasterrestart | ( | FILE * | ) |
| void moveData | ( | int | index | ) |
Definition at line 75 of file mealMasterCompiler.cpp.
References outputBuffer().
00076 { 00077 assert( index >= 1 ); 00078 assert( index < (signed)outputBuffer.size() ); 00079 outputBuffer[ 0 ] += outputBuffer[ index ]; 00080 outputBuffer[ index ].clear(); 00081 }
| static vector< string > outputBuffer | ( | 5 | ) | [static] |
Referenced by moveData(), writeData(), and writeUnit().
| int readData | ( | char * | buffer, | |
| int | max_size | |||
| ) |
Definition at line 83 of file mealMasterCompiler.cpp.
References MealMasterCompiler::current, and currentInput.
00084 { 00085 int result; 00086 assert( MealMasterCompiler::current != NULL ); 00087 if ( currentInput == NULL ) { 00088 result = 0; 00089 } else { 00090 currentInput->read( buffer, max_size ); 00091 if ( currentInput->eof() ) { 00092 // Get number of bytes read. 00093 result = currentInput->gcount(); 00094 currentInput = NULL; 00095 } else { 00096 // The buffer was filled. 00097 result = max_size; 00098 }; 00099 }; 00100 // cerr << "Read " << result << '/' << max_size << " characters." << endl; 00101 return result; 00102 }
| void writeData | ( | int | index, | |
| const char * | buffer, | |||
| int | size | |||
| ) |
Definition at line 50 of file mealMasterCompiler.cpp.
References MealMasterCompiler::current, and outputBuffer().
00051 { 00052 assert( MealMasterCompiler::current != NULL ); 00053 assert( index >= 0 ); 00054 assert( index < (signed)outputBuffer.size() ); 00055 outputBuffer[ index ] += string( buffer, size ); 00056 }
| void writeUnit | ( | int | index, | |
| const char * | buffer, | |||
| int | size | |||
| ) |
Definition at line 58 of file mealMasterCompiler.cpp.
References MealMasterCompiler::current, and outputBuffer().
00059 { 00060 string unit( buffer, size ); 00061 assert( MealMasterCompiler::current != NULL ); 00062 string inverseUnit( MealMasterCompiler::current-> 00063 inverseUnitMap[ unit.c_str() ] ); 00064 assert( !inverseUnit.empty() ); 00065 #ifndef NDEBUG 00066 // cerr << "buffer[0] = " << buffer[0] << ' ' << (int)buffer[0] << endl 00067 // << "buffer[1] = " << buffer[1] << ' ' << (int)buffer[1] << endl 00068 // << "size = " << size << endl 00069 // << "string( buffer, size ) = " << unit << endl 00070 // << "inverseUnit = " << inverseUnit << endl; 00071 #endif 00072 outputBuffer[ index ] += (const char *)i18n( inverseUnit.c_str() ); 00073 }
istream* currentInput [static] |
| int errorLine |
Definition at line 33 of file mealMasterCompiler.cpp.
| const char* errorMessage |
Definition at line 38 of file mealMasterCompiler.cpp.
| int lineNo |
Definition at line 32 of file mealMasterCompiler.cpp.
Referenced by MealMasterCompiler::MealMasterCompiler().
| long position |
| int recipeEndLine |
Definition at line 37 of file mealMasterCompiler.cpp.
| int recipeEndPos |
Definition at line 35 of file mealMasterCompiler.cpp.
| int recipeStartLine |
Definition at line 36 of file mealMasterCompiler.cpp.
| int recipeStartPos |
Definition at line 34 of file mealMasterCompiler.cpp.