Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__PingPong__HWDef
changeset 15:8d9d367e96f9
updated for VMS name chgs from VMS__malloc to VMS_int__malloc
author | Me@portablequad |
---|---|
date | Sun, 12 Feb 2012 01:47:58 -0800 |
parents | ddd87abfeefd |
children | df53f52ef49c 561d3a06ffc5 |
files | HWSim__PingPong__HWDef/FakeSim.c SimParams.c SimParams.h main.c |
diffstat | 4 files changed, 6 insertions(+), 81 deletions(-) [+] |
line diff
1.1 --- a/HWSim__PingPong__HWDef/FakeSim.c Sat Feb 11 16:59:18 2012 -0800 1.2 +++ b/HWSim__PingPong__HWDef/FakeSim.c Sun Feb 12 01:47:58 2012 -0800 1.3 @@ -15,7 +15,7 @@ 1.4 elems= malloc(nrElems*(sizeof(HWSimElem))); 1.5 checkMalloc(elems); 1.6 for (i= 0; i<nrElems; i++) { 1.7 - elems[i].animatingVP= malloc(sizeof(VirtProcr)); 1.8 + elems[i].animatingVP= malloc(sizeof(SlaveVP)); 1.9 checkMalloc(elems[i].animatingVP); 1.10 } 1.11 return elems;
2.1 --- a/SimParams.c Sat Feb 11 16:59:18 2012 -0800 2.2 +++ b/SimParams.c Sun Feb 12 01:47:58 2012 -0800 2.3 @@ -1,155 +1,77 @@ 2.4 /* 2.5 - 2.6 * Copyright 2009 OpenSourceStewardshipFoundation.org 2.7 - 2.8 * Licensed under GNU General Public License version 2 2.9 - 2.10 * 2.11 - 2.12 * Author: seanhalle@yahoo.com 2.13 - 2.14 * 2.15 - 2.16 * Created on November 15, 2009, 2:35 AM 2.17 - 2.18 */ 2.19 2.20 2.21 - 2.22 #include <malloc.h> 2.23 - 2.24 #include <stdlib.h> 2.25 2.26 2.27 - 2.28 #include "SimParams.h" 2.29 2.30 -#include "ParamHelper/Param.h" 2.31 - 2.32 - 2.33 - 2.34 - 2.35 2.36 uint8 * 2.37 - 2.38 read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ); 2.39 2.40 2.41 - 2.42 - 2.43 - 2.44 void 2.45 - 2.46 fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ) 2.47 - 2.48 { char *guestAppFileName, *systemCodeFileName; 2.49 - 2.50 int numBytesInGuestApp, numBytesInSystemCode; 2.51 - 2.52 2.53 - 2.54 ParamStruc *param; 2.55 2.56 //param = getParamFromBag( "GuestApplicationFileName", paramBag ); 2.57 - 2.58 guestAppFileName = param->strValue; 2.59 2.60 //param = getParamFromBag( "numBytesInGuestApp", paramBag ); 2.61 - 2.62 numBytesInGuestApp = param->intValue; 2.63 2.64 - 2.65 - 2.66 simParams->guestApp = 2.67 - 2.68 read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName ); 2.69 2.70 - 2.71 - 2.72 //param = getParamFromBag( "SystemCodeFileName", paramBag ); 2.73 - 2.74 systemCodeFileName = param->strValue; 2.75 2.76 //param = getParamFromBag( "numBytesInSystemCode", paramBag ); 2.77 - 2.78 numBytesInSystemCode = param->intValue; 2.79 2.80 - 2.81 - 2.82 simParams->systemCode = 2.83 - 2.84 read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName ); 2.85 2.86 - 2.87 - 2.88 - 2.89 - 2.90 //param = getParamFromBag( "numNodes", paramBag ); 2.91 - 2.92 simParams->numNodes = param->intValue; 2.93 - 2.94 - 2.95 - 2.96 } 2.97 2.98 2.99 - 2.100 - 2.101 - 2.102 - 2.103 - 2.104 uint8 * 2.105 - 2.106 read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ) 2.107 - 2.108 { int byte; 2.109 - 2.110 FILE *file; 2.111 - 2.112 char *machineCode = malloc( numBytesInFile ); 2.113 - 2.114 if( machineCode == NULL ) printf( "\nno mem for machine code\n" ); 2.115 2.116 - 2.117 - 2.118 file = fopen( machineCodeFileName, "r" ); 2.119 - 2.120 if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} 2.121 2.122 - 2.123 - 2.124 fseek( file, 0, SEEK_SET ); 2.125 - 2.126 for( byte = 0; byte < numBytesInFile; byte++ ) 2.127 - 2.128 { 2.129 - 2.130 if( feof( file ) ) printf( "file ran out too soon" ); 2.131 - 2.132 // machineCode[byte] = getchar( file ); 2.133 - 2.134 - 2.135 - 2.136 } 2.137 - 2.138 return machineCode; 2.139 - 2.140 } 2.141 2.142 2.143 - 2.144 - 2.145 - 2.146 - //========================================================================== 2.147 - 2.148 +//========================================================================== 2.149 void 2.150 - 2.151 printSimResults( SimulationResults simResults ) 2.152 - 2.153 { 2.154 - 2.155 } 2.156 2.157 - 2.158 - 2.159 -
3.1 --- a/SimParams.h Sat Feb 11 16:59:18 2012 -0800 3.2 +++ b/SimParams.h Sun Feb 12 01:47:58 2012 -0800 3.3 @@ -11,7 +11,7 @@ 3.4 #include <malloc.h> 3.5 3.6 #include "../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h" 3.7 -#include "ParamHelper/Param.h" 3.8 +#include "../C_Libraries/ParamHelper/Param.h" 3.9 3.10 3.11 //============================== Structures ==============================
4.1 --- a/main.c Sat Feb 11 16:59:18 2012 -0800 4.2 +++ b/main.c Sun Feb 12 01:47:58 2012 -0800 4.3 @@ -10,6 +10,9 @@ 4.4 4.5 #include "SimParams.h" 4.6 #include "HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h" 4.7 +//Stefan: name conflict here -- MC_shared version of params is in HWSim__PingPong__HWDef.h, but need normal C version here 4.8 +#include "../C_Libraries/ParamHelper/Param.h" 4.9 + 4.10 4.11 char __ProgrammName[] = "HWSim Hello World"; 4.12 char __DataSet[255];