Me@11: /* Me@11: Me@11: * Copyright 2009 OpenSourceStewardshipFoundation.org Me@11: Me@11: * Licensed under GNU General Public License version 2 Me@11: Me@11: * Me@11: Me@11: * Author: seanhalle@yahoo.com Me@11: Me@11: * Me@11: Me@11: * Created on November 15, 2009, 2:35 AM Me@11: Me@11: */ Me@11: Me@11: Me@11: Me@11: #include Me@11: Me@11: #include Me@11: Me@11: Me@11: Me@11: #include "SimParams.h" Me@11: Me@11: #include "ParamHelper/Param.h" Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: uint8 * Me@11: Me@11: read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ); Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: void Me@11: Me@11: fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ) Me@11: Me@11: { char *guestAppFileName, *systemCodeFileName; Me@11: Me@11: int numBytesInGuestApp, numBytesInSystemCode; Me@11: Me@11: Me@11: Me@11: ParamStruc *param; Me@11: Me@11: //param = getParamFromBag( "GuestApplicationFileName", paramBag ); Me@11: Me@11: guestAppFileName = param->strValue; Me@11: Me@11: //param = getParamFromBag( "numBytesInGuestApp", paramBag ); Me@11: Me@11: numBytesInGuestApp = param->intValue; Me@11: Me@11: Me@11: Me@11: simParams->guestApp = Me@11: Me@11: read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName ); Me@11: Me@11: Me@11: Me@11: //param = getParamFromBag( "SystemCodeFileName", paramBag ); Me@11: Me@11: systemCodeFileName = param->strValue; Me@11: Me@11: //param = getParamFromBag( "numBytesInSystemCode", paramBag ); Me@11: Me@11: numBytesInSystemCode = param->intValue; Me@11: Me@11: Me@11: Me@11: simParams->systemCode = Me@11: Me@11: read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName ); Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: //param = getParamFromBag( "numNodes", paramBag ); Me@11: Me@11: simParams->numNodes = param->intValue; Me@11: Me@11: Me@11: Me@11: } Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: uint8 * Me@11: Me@11: read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ) Me@11: Me@11: { int byte; Me@11: Me@11: FILE *file; Me@11: Me@11: char *machineCode = malloc( numBytesInFile ); Me@11: Me@11: if( machineCode == NULL ) printf( "\nno mem for machine code\n" ); Me@11: Me@11: Me@11: Me@11: file = fopen( machineCodeFileName, "r" ); Me@11: Me@11: if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} Me@11: Me@11: Me@11: Me@11: fseek( file, 0, SEEK_SET ); Me@11: Me@11: for( byte = 0; byte < numBytesInFile; byte++ ) Me@11: Me@11: { Me@11: Me@11: if( feof( file ) ) printf( "file ran out too soon" ); Me@11: Me@11: // machineCode[byte] = getchar( file ); Me@11: Me@11: Me@11: Me@11: } Me@11: Me@11: return machineCode; Me@11: Me@11: } Me@11: Me@11: Me@11: Me@11: Me@11: Me@11: //========================================================================== Me@11: Me@11: void Me@11: Me@11: printSimResults( SimulationResults simResults ) Me@11: Me@11: { Me@11: Me@11: } Me@11: Me@11: Me@11: Me@11: