Example #1
0
FileServer::FileServer()
{
    setPort(uHTTP::HTTP::DEFAULT_PORT);
    setRootDirectory(".");
    setVerbose(false);
    addRequestListener(this);
}
Example #2
0
bool Assembler::assemble(string path){
	Assembler* ptr = this;
	setRootDirectory(parser.filePathToParentDirectory(path));
	setProgramName(parser.filePathToFileName(path));
	bool invalidateAssembly = false;
	try{
		loadProgramFromFile(programName);
		
		splitLabels();
		replaceEqv();
		extractMacroDefinitions();
		replaceMacros();
		pseudoInstructionPad();
		
		alignRawProgram();
		pseudoInstructionReplace();
		replaceLabels();

		writeAlignedRawProgramToDisk(rootDirectory + programName + alignedProgramNamePostfix);
		mapAlignedProgramToVirtualMemory();

		builtObjectFileName = rootDirectory + programName + objectNamePostfix;
		virtualMemory.serialize(builtObjectFileName);
	}catch(AssemblerException &e){
		string message = e.toString();
		cout << '\n' << message << '\n';
		invalidateAssembly = true;
	}catch(InvalidTokenException &e){
		cout << "ERROR [Assembler::assemble(string fileName)]: HANDLE INVALID TOKEN EXCEPTION IN ASSEMBLER!!!:\t" + e.toString();
		getchar();
	}
	if(recoverableExceptions.size() != 0 || invalidateAssembly){
		for(int i=0; i<recoverableExceptions.size(); i++){
			cout << recoverableExceptions[i].toString() << '\n';
		}
		return false;
	}
	return true;
}