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