Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__PingPong__HWDef
comparison src/Application/main.c @ 0:8ea476474093
Initial add -- gobbeldegook
| author | Me@portablequad |
|---|---|
| date | Mon, 07 Nov 2011 16:03:01 -0800 |
| parents | |
| children | 7566745e812a |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:b82f273d18a2 |
|---|---|
| 1 /* | |
| 2 | |
| 3 * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org | |
| 4 | |
| 5 * Licensed under GNU General Public License version 2 | |
| 6 | |
| 7 * | |
| 8 | |
| 9 * author seanhalle@yahoo.com | |
| 10 | |
| 11 */ | |
| 12 | |
| 13 | |
| 14 | |
| 15 #include <malloc.h> | |
| 16 | |
| 17 #include <stdlib.h> | |
| 18 | |
| 19 | |
| 20 | |
| 21 #include "SimParams.h" | |
| 22 | |
| 23 #include "HWSim_TeraFlux/HWSim_TeraFlux.h" | |
| 24 | |
| 25 | |
| 26 | |
| 27 /** | |
| 28 | |
| 29 * | |
| 30 | |
| 31 */ | |
| 32 | |
| 33 int main( int argc, char **argv ) | |
| 34 | |
| 35 { SimulationParams *simParams; | |
| 36 | |
| 37 SimulationResults *simResults; | |
| 38 | |
| 39 ParamBag *paramBag; | |
| 40 | |
| 41 | |
| 42 | |
| 43 printf( "arguments: %s | %s\n", argv[0], argv[1] ); | |
| 44 | |
| 45 | |
| 46 | |
| 47 simParams = malloc( sizeof(SimulationParams) ); | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 //VMS has its own separate internal malloc, so to get results out, | |
| 54 | |
| 55 // have to pass in empty array for it to fill up | |
| 56 | |
| 57 //The alternative is internally telling HWSim make external space to use | |
| 58 | |
| 59 simResults = malloc( sizeof(SimulationResults) ); | |
| 60 | |
| 61 simParams->simResults = simResults; | |
| 62 | |
| 63 | |
| 64 | |
| 65 paramBag = makeParamBag(); | |
| 66 | |
| 67 | |
| 68 | |
| 69 readParamFileIntoBag( argv[1], paramBag ); | |
| 70 | |
| 71 fill_sim_params_from_bag( simParams, paramBag ); | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 constructAndSimulateSystem( simParams ); | |
| 78 | |
| 79 | |
| 80 | |
| 81 printSimResults( simResults ); | |
| 82 | |
| 83 | |
| 84 | |
| 85 fflush(stdin); | |
| 86 | |
| 87 | |
| 88 | |
| 89 exit(0); //cleans up | |
| 90 | |
| 91 } | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 |
