ICEACE Model: Closed Economy  1.0.0
Design Documentation of ICEACE Model
 All Data Structures Files Functions Variables Typedefs Macros Pages
main.c
Go to the documentation of this file.
1 
6 #include "header.h"
7 #define COMPACT_PRINTOUT_P_THRESHOLD 8
8 
14 int main(int argc, char * argv[])
15 {
16  /* Timing variables */
17  double start, stop, interval;
18  FILE *file;
19  char data[100];
20  char logfilepath[1000];
21  char inputpath[1000];
22  char * c;
23  int lastd = 0;
24  int i;
25  int rc;
26  int iteration_number = 0;
27  int iteration_total;
28  int * p_iteration_number = &iteration_number;
29  //xmachine_memory_firm * temp_xmachine_firm;
30  //xmachine_memory_household * temp_xmachine_household;
31  //xmachine_memory_equityfund * temp_xmachine_equityfund;
32  //xmachine_memory_bank * temp_xmachine_bank;
33  //xmachine_memory_government * temp_xmachine_government;
34  //xmachine_memory_centralbank * temp_xmachine_centralbank;
35  //xmachine_memory_jpoffice * temp_xmachine_jpoffice;
36  //xmachine_memory_mall * temp_xmachine_mall;
37  //xmachine_memory_reagency * temp_xmachine_reagency;
38 
39  int FLAME_firm_bank_init_loans_message_board_write;
40  int FLAME_firm_bank_init_loans_message_board_read;
41  int FLAME_firm_bank_init_deposit_message_board_write;
42  int FLAME_firm_bank_init_deposit_message_board_read;
43  int FLAME_firm_bank_update_deposit_message_board_write;
44  int FLAME_firm_bank_update_deposit_message_board_read;
45  int FLAME_household_bank_init_mortgages_message_board_write;
46  int FLAME_household_bank_init_mortgages_message_board_read;
47  int FLAME_household_bank_init_deposit_message_board_write;
48  int FLAME_household_bank_init_deposit_message_board_read;
49  int FLAME_household_bank_update_deposit_message_board_write;
50  int FLAME_household_bank_update_deposit_message_board_read;
51  int FLAME_bank_centralbank_init_debt_message_board_write;
52  int FLAME_bank_centralbank_init_debt_message_board_read;
53  int FLAME_bank_centralbank_init_deposit_message_board_write;
54  int FLAME_bank_centralbank_init_deposit_message_board_read;
55  int FLAME_bank_centralbank_update_deposit_message_board_write;
56  int FLAME_bank_centralbank_update_deposit_message_board_read;
57  int FLAME_fund_centralbank_init_deposit_message_board_write;
58  int FLAME_fund_centralbank_init_deposit_message_board_read;
59  int FLAME_fund_centralbank_update_deposit_message_board_write;
60  int FLAME_fund_centralbank_update_deposit_message_board_read;
61  int FLAME_gov_centralbank_init_deposit_message_board_write;
62  int FLAME_gov_centralbank_init_deposit_message_board_read;
63  int FLAME_gov_centralbank_update_deposit_message_board_write;
64  int FLAME_gov_centralbank_update_deposit_message_board_read;
65  int FLAME_interest_rate_message_board_write;
66  int FLAME_interest_rate_message_board_read;
67  int FLAME_capital_tax_rate_message_board_write;
68  int FLAME_capital_tax_rate_message_board_read;
69  int FLAME_labour_tax_rate_message_board_write;
70  int FLAME_labour_tax_rate_message_board_read;
71  int FLAME_household_jpoffice_id_message_board_write;
72  int FLAME_household_jpoffice_id_message_board_read;
73  int FLAME_jpoffice_household_employer_message_board_write;
74  int FLAME_jpoffice_household_employer_message_board_read;
75  int FLAME_firm_jpoffice_id_message_board_write;
76  int FLAME_firm_jpoffice_id_message_board_read;
77  int FLAME_jpoffice_firm_employee_message_board_write;
78  int FLAME_jpoffice_firm_employee_message_board_read;
79  int FLAME_buy_message_board_write;
80  int FLAME_buy_message_board_read;
81  int FLAME_bought_message_board_write;
82  int FLAME_bought_message_board_read;
83  int FLAME_sell_message_board_write;
84  int FLAME_sell_message_board_read;
85  int FLAME_sold_message_board_write;
86  int FLAME_sold_message_board_read;
87  int FLAME_goods_transactions_summary_message_board_write;
88  int FLAME_goods_transactions_summary_message_board_read;
89  int FLAME_centralbank_households_quarterly_cpi_message_board_write;
90  int FLAME_centralbank_households_quarterly_cpi_message_board_read;
91  int FLAME_fired_message_board_write;
92  int FLAME_fired_message_board_read;
93  int FLAME_vacancy_stage1_message_board_write;
94  int FLAME_vacancy_stage1_message_board_read;
95  int FLAME_job_application_stage2_message_board_write;
96  int FLAME_job_application_stage2_message_board_read;
97  int FLAME_job_application_stage1_message_board_write;
98  int FLAME_job_application_stage1_message_board_read;
99  int FLAME_job_match_stage1_message_board_write;
100  int FLAME_job_match_stage1_message_board_read;
101  int FLAME_job_change_message_board_write;
102  int FLAME_job_change_message_board_read;
103  int FLAME_vacancy_stage2_message_board_write;
104  int FLAME_vacancy_stage2_message_board_read;
105  int FLAME_job_match_stage2_message_board_write;
106  int FLAME_job_match_stage2_message_board_read;
107  int FLAME_employment_status_message_board_write;
108  int FLAME_employment_status_message_board_read;
109  int FLAME_firm_household_wage_payment_message_board_write;
110  int FLAME_firm_household_wage_payment_message_board_read;
111  int FLAME_firm_bank_loan_request_1_message_board_write;
112  int FLAME_firm_bank_loan_request_1_message_board_read;
113  int FLAME_firm_bank_loan_request_2_message_board_write;
114  int FLAME_firm_bank_loan_request_2_message_board_read;
115  int FLAME_bank_firm_loan_acknowledge_1_message_board_write;
116  int FLAME_bank_firm_loan_acknowledge_1_message_board_read;
117  int FLAME_bank_firm_loan_acknowledge_2_message_board_write;
118  int FLAME_bank_firm_loan_acknowledge_2_message_board_read;
119  int FLAME_bank_centralbank_debt_request_message_board_write;
120  int FLAME_bank_centralbank_debt_request_message_board_read;
121  int FLAME_household_share_message_board_write;
122  int FLAME_household_share_message_board_read;
123  int FLAME_capital_tax_message_board_write;
124  int FLAME_capital_tax_message_board_read;
125  int FLAME_labour_tax_message_board_write;
126  int FLAME_labour_tax_message_board_read;
127  int FLAME_unemployment_benefit_message_board_write;
128  int FLAME_unemployment_benefit_message_board_read;
129  int FLAME_general_benefit_message_board_write;
130  int FLAME_general_benefit_message_board_read;
131  int FLAME_fund_request_message_board_write;
132  int FLAME_fund_request_message_board_read;
133  int FLAME_fund_request_ack_message_board_write;
134  int FLAME_fund_request_ack_message_board_read;
135  int FLAME_new_entrant_loan_message_board_write;
136  int FLAME_new_entrant_loan_message_board_read;
137  int FLAME_firm_bank_interest_on_loan_message_board_write;
138  int FLAME_firm_bank_interest_on_loan_message_board_read;
139  int FLAME_loan_writeoff_message_board_write;
140  int FLAME_loan_writeoff_message_board_read;
141  int FLAME_firm_bank_insolvent_account_message_board_write;
142  int FLAME_firm_bank_insolvent_account_message_board_read;
143  int FLAME_firm_net_profit_message_board_write;
144  int FLAME_firm_net_profit_message_board_read;
145  int FLAME_bank_net_profit_message_board_write;
146  int FLAME_bank_net_profit_message_board_read;
147  int FLAME_bank_centralbank_interest_payment_message_board_write;
148  int FLAME_bank_centralbank_interest_payment_message_board_read;
149  int FLAME_bank_centralbank_debt_payment_message_board_write;
150  int FLAME_bank_centralbank_debt_payment_message_board_read;
151  int FLAME_gov_centralbank_debt_request_message_board_write;
152  int FLAME_gov_centralbank_debt_request_message_board_read;
153  int FLAME_gov_centralbank_debt_payment_message_board_write;
154  int FLAME_gov_centralbank_debt_payment_message_board_read;
155  int FLAME_centralbank_government_profit_message_board_write;
156  int FLAME_centralbank_government_profit_message_board_read;
157  int FLAME_housing_price_message_board_write;
158  int FLAME_housing_price_message_board_read;
159  int FLAME_buy_housing_message_board_write;
160  int FLAME_buy_housing_message_board_read;
161  int FLAME_sell_housing_message_board_write;
162  int FLAME_sell_housing_message_board_read;
163  int FLAME_bought_housing_message_board_write;
164  int FLAME_bought_housing_message_board_read;
165  int FLAME_sold_housing_message_board_write;
166  int FLAME_sold_housing_message_board_read;
167  int FLAME_bank_reagency_credibility_message_board_write;
168  int FLAME_bank_reagency_credibility_message_board_read;
169  int FLAME_mortgage_requests_message_board_write;
170  int FLAME_mortgage_requests_message_board_read;
171  int FLAME_mortgage_payment_from_sale_message_board_write;
172  int FLAME_mortgage_payment_from_sale_message_board_read;
173  int FLAME_mortgage_payment_message_board_write;
174  int FLAME_mortgage_payment_message_board_read;
175  int FLAME_mortgage_writeoff_message_board_write;
176  int FLAME_mortgage_writeoff_message_board_read;
177  int FLAME_housing_transactions_summary_message_board_write;
178  int FLAME_housing_transactions_summary_message_board_read;
179 
180  /* Particle cloud data */
181  double cloud_data[6] = {0.0,0.0,0.0,0.0,0.0,0.0};
182  /* Count to debug function branches */
183  int FLAME_debug_count;
184 
185 /* For partition method. Makes geometric (-g flag) the default but may be overridden with -r for round-robin */
186  int partition_method=1;
187 
188 
189 
190  /* Output frequency is 1 as default */
191  output_frequency = 1;
192  /* Set random seed */
193 /* srand(time(NULL)); */
194 
195 
196 
197  rc = MB_Env_Init();
198  #ifdef ERRCHECK
199  if (rc != MB_SUCCESS)
200  {
201  fprintf(stderr, "ERROR: Failed to initialise Message Board environment\n");
202  switch(rc) {
203  case MB_ERR_MPI:
204  fprintf(stderr, "\t reason: MPI library not initialised\n");
205  break;
206  case MB_ERR_MEMALLOC:
207  fprintf(stderr, "\t reason: out of memory\n");
208  break;
209  default:
210  fprintf(stderr, "\t MB_Env_Init returned error code: %d (see libmboard docs for details)\n", rc);
211  break;
212  }
213 
214 
215  exit(rc);
216 
217  }
218  #endif
219 
220  /* For backwards compatabilty allocate current_xmachine */
221  current_xmachine = (xmachine *)malloc(sizeof(xmachine));
222  if(current_xmachine == NULL) {printf("**** ERROR in Memory check current_xmachine\n");exit(EXIT_FAILURE);}
223  /*CHECK_POINTER(current_xmachine);*/
224 
225  /* Initialise pointers */
227 
228 
229  printf("FLAME Application: ICEACE \n");
230 
231 
232  printf("Debug mode enabled \n");
233 FLAME_debug_count = 0;
234 /* Use to stop compiler warnings if not used */
235 if(FLAME_debug_count == 0) {}
236 
237 
238 
239 
240 if(argc < 2)
241  {
242 
243  printf("Usage: %s <number of iterations> [<states_directory>]/<init_state> <partitions> [-f # | -f #+#]\n",argv[0]);
244  printf("\t-f\tOutput frequency, 1st # is frequency, 2nd # is the offset if required\n");
245 
246 
247 
248  exit(0);
249  }
250  iteration_total = atoi(argv[1]);
251 printf("Iterations: %i\n", iteration_total);
252 
253  /* Read initial states of x-machines */
254  if(argc < 3)
255  {
256  printf("Need two parameters\n");
257  exit(0);
258  }
259  strcpy(inputpath, argv[2]);
260 /*printf("Initial states: %s\n", inputpath);*/
261 
262  i = 0;
263  lastd = -1;
264  while(inputpath[i] != '\0')
265  {
266  /* For windows directories */
267  if(inputpath[i] == '\\') lastd=i;
268  /* For unix directories */
269  if(inputpath[i] == '/') lastd=i;
270  i++;
271  }
272  strcpy(outputpath, inputpath);
273  outputpath[lastd+1] = '\0';
274 
275 /*printf("Ouput dir: %s\n", outputpath);*/
276 
277 
278  /* Read number of space partitions (1 by default) */
279  totalnodes = 1;
280  if(argc > 3)
281  {
282  totalnodes = atoi(argv[3]);
283  }
284 
285 
286  i = 3;
287  while(argc > i)
288  {
289  if(strcmp(argv[i],"-f") == 0)
290  {
291  if(argc > (i+1))
292  {
293  output_offset = 0;
294  /* Find offset, separated by the char '+' */
295  c = strchr(argv[(i+1)], '+');
296  if(c == NULL)
297  {
298  output_frequency = atoi(argv[(i+1)]);
299  printf("Using output frequency of: %d\n", output_frequency);
300  }
301  else
302  {
303  output_offset = atoi(argv[(i+1)]+(c-argv[(i+1)])+1);
304  argv[(i+1)][c-argv[(i+1)]] = '\0';
305  output_frequency = atoi(argv[(i+1)]);
306  printf("Using output frequency of: %d with offset %d\n", output_frequency, output_offset);
307  }
308 
309  if(output_frequency == 0)
310  {
311  printf("Output frequency cannot be zero\n");
312  exit(0);
313  }
314 
315  i++;
316  }
317  else
318  {
319  printf("Output frequency number not defined\n");
320  exit(0);
321  }
322  }
323  /* Partitioning method: -g = geometric, -r = round-robin */
324  if(strcmp(argv[i],"-g") == 0) partition_method = 1;
325  if(strcmp(argv[i],"-r") == 0) partition_method = 2;
326  i++;
327  }
328 
329 
330  /* Read initial data into p_xmachine */
331 
332  //agent_list = p_xmachine;
333  readinitialstates(inputpath, outputpath, p_iteration_number, cloud_data, partition_method, 0);
334  /* Generate partitions */
335  generate_partitions(cloud_data,totalnodes,partition_method);
337 
338 
339 
340 
341 
342  /* Partition data */
343  /* stc: no partitions in serial */
344  //partition_data(totalnodes, agent_list, cloud_data, partition_method);
345 
346 
347 
348 /* Use MB_IndexMap routines from libmboard v0.2 */
349 /* For each agent constant (that is used in a filter(?))
350  * declare an index map handle */
351 
352 
353 
354  /*i = 0;
355  current_node = *p_node_info;
356  while(current_node)
357  {
358  printf("No of agents on partition %d: %d\n", current_node->node_id, current_node->agent_total);
359  i += current_node->agent_total;
360  current_node = current_node->next;
361  }
362  printf("Agent total check: %d\n", i);*/
363 
364  /* restore current_node pointer */
365  //current_node = *p_node_info;
366 
367 
368 
369  /* Start log file (now so that xvisualiser can read straight away) */
370 
371  /* Write log file */
372  sprintf(logfilepath, "%slog.xml", outputpath);
373  if((file = fopen(logfilepath, "w"))==NULL)
374  {
375  printf("Error: cannot open file '%s' for writing\n", logfilepath);
376  exit(0);
377  }
378  (void)fputs("<model_run>\n", file);
379  (void)fputs("<codetype>", file);
380  (void)fputs("serial", file);
381 
382  (void)fputs("</codetype>\n", file);
383  (void)fputs("<nodes>", file);
384  sprintf(data, "%i", totalnodes);
385  (void)fputs(data, file);
386  (void)fputs("</nodes>\n", file);
387 
388  /* print timer into */
389  (void)fputs("<!-- <time> unit: milliseconds -->\n", file);
390 
391  sprintf(data, "unspecified");
392 
393  (void)fputs("<!-- <time> timer resolution: ", file);
394  (void)fputs(data, file);
395  (void)fputs(")-->\n", file);
396 
397  start = get_time();
398  stop = get_time();
399  sprintf(data, "%.2e ms", (stop - start) * 1000.0);
400  (void)fputs("<!-- <time> timer overhead: ~", file);
401  (void)fputs(data, file);
402  (void)fputs(")-->\n", file);
403 
404 
405  (void)fclose(file);
406 
407 
408  /* For each message check if their exists agents that input/output the message */
409  FLAME_firm_bank_init_loans_message_board_write = 0;
410  FLAME_firm_bank_init_loans_message_board_read = 0;
411  /* Sending agents */
412  if(firm_start_state->agents != NULL) FLAME_firm_bank_init_loans_message_board_write = 1;
413 
414  /* Reading agents */
415  if(bank_start_state->agents != NULL) FLAME_firm_bank_init_loans_message_board_read = 1;
416 
417  /* Call message board library with details */
418  if(FLAME_firm_bank_init_loans_message_board_write == 0 &&
419  FLAME_firm_bank_init_loans_message_board_read == 0)
420  rc = MB_SetAccessMode(b_firm_bank_init_loans, MB_MODE_IDLE);
421  if(FLAME_firm_bank_init_loans_message_board_write == 1 &&
422  FLAME_firm_bank_init_loans_message_board_read == 0)
423  rc = MB_SetAccessMode(b_firm_bank_init_loans, MB_MODE_WRITEONLY);
424  if(FLAME_firm_bank_init_loans_message_board_write == 0 &&
425  FLAME_firm_bank_init_loans_message_board_read == 1)
426  rc = MB_SetAccessMode(b_firm_bank_init_loans, MB_MODE_READONLY);
427  if(FLAME_firm_bank_init_loans_message_board_write == 1 &&
428  FLAME_firm_bank_init_loans_message_board_read == 1)
429  rc = MB_SetAccessMode(b_firm_bank_init_loans, MB_MODE_READWRITE);
430  #ifdef ERRCHECK
431  if (rc != MB_SUCCESS)
432  {
433  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_init_loans' board\n");
434  switch(rc) {
435  case MB_ERR_INVALID:
436  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
437  break;
438  case MB_ERR_LOCKED:
439  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is locked\n");
440  break;
441  case MB_ERR_MEMALLOC:
442  fprintf(stderr, "\t reason: out of memory\n");
443  break;
444  case MB_ERR_INTERNAL:
445  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
446  break;
447  default:
448  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
449  break;
450  }
451 
452  exit(rc);
453  }
454  #endif
455  FLAME_firm_bank_init_deposit_message_board_write = 0;
456  FLAME_firm_bank_init_deposit_message_board_read = 0;
457  /* Sending agents */
458  if(firm_start_state->agents != NULL) FLAME_firm_bank_init_deposit_message_board_write = 1;
459 
460  /* Reading agents */
461  if(bank_start_state->agents != NULL) FLAME_firm_bank_init_deposit_message_board_read = 1;
462 
463  /* Call message board library with details */
464  if(FLAME_firm_bank_init_deposit_message_board_write == 0 &&
465  FLAME_firm_bank_init_deposit_message_board_read == 0)
466  rc = MB_SetAccessMode(b_firm_bank_init_deposit, MB_MODE_IDLE);
467  if(FLAME_firm_bank_init_deposit_message_board_write == 1 &&
468  FLAME_firm_bank_init_deposit_message_board_read == 0)
469  rc = MB_SetAccessMode(b_firm_bank_init_deposit, MB_MODE_WRITEONLY);
470  if(FLAME_firm_bank_init_deposit_message_board_write == 0 &&
471  FLAME_firm_bank_init_deposit_message_board_read == 1)
472  rc = MB_SetAccessMode(b_firm_bank_init_deposit, MB_MODE_READONLY);
473  if(FLAME_firm_bank_init_deposit_message_board_write == 1 &&
474  FLAME_firm_bank_init_deposit_message_board_read == 1)
475  rc = MB_SetAccessMode(b_firm_bank_init_deposit, MB_MODE_READWRITE);
476  #ifdef ERRCHECK
477  if (rc != MB_SUCCESS)
478  {
479  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_init_deposit' board\n");
480  switch(rc) {
481  case MB_ERR_INVALID:
482  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
483  break;
484  case MB_ERR_LOCKED:
485  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is locked\n");
486  break;
487  case MB_ERR_MEMALLOC:
488  fprintf(stderr, "\t reason: out of memory\n");
489  break;
490  case MB_ERR_INTERNAL:
491  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
492  break;
493  default:
494  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
495  break;
496  }
497 
498  exit(rc);
499  }
500  #endif
501  FLAME_firm_bank_update_deposit_message_board_write = 0;
502  FLAME_firm_bank_update_deposit_message_board_read = 0;
503  /* Sending agents */
504  if(firm_start_state->agents != NULL) FLAME_firm_bank_update_deposit_message_board_write = 1;
505 
506  /* Reading agents */
507  if(bank_start_state->agents != NULL) FLAME_firm_bank_update_deposit_message_board_read = 1;
508 
509  /* Call message board library with details */
510  if(FLAME_firm_bank_update_deposit_message_board_write == 0 &&
511  FLAME_firm_bank_update_deposit_message_board_read == 0)
512  rc = MB_SetAccessMode(b_firm_bank_update_deposit, MB_MODE_IDLE);
513  if(FLAME_firm_bank_update_deposit_message_board_write == 1 &&
514  FLAME_firm_bank_update_deposit_message_board_read == 0)
515  rc = MB_SetAccessMode(b_firm_bank_update_deposit, MB_MODE_WRITEONLY);
516  if(FLAME_firm_bank_update_deposit_message_board_write == 0 &&
517  FLAME_firm_bank_update_deposit_message_board_read == 1)
518  rc = MB_SetAccessMode(b_firm_bank_update_deposit, MB_MODE_READONLY);
519  if(FLAME_firm_bank_update_deposit_message_board_write == 1 &&
520  FLAME_firm_bank_update_deposit_message_board_read == 1)
521  rc = MB_SetAccessMode(b_firm_bank_update_deposit, MB_MODE_READWRITE);
522  #ifdef ERRCHECK
523  if (rc != MB_SUCCESS)
524  {
525  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_update_deposit' board\n");
526  switch(rc) {
527  case MB_ERR_INVALID:
528  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
529  break;
530  case MB_ERR_LOCKED:
531  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is locked\n");
532  break;
533  case MB_ERR_MEMALLOC:
534  fprintf(stderr, "\t reason: out of memory\n");
535  break;
536  case MB_ERR_INTERNAL:
537  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
538  break;
539  default:
540  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
541  break;
542  }
543 
544  exit(rc);
545  }
546  #endif
547  FLAME_household_bank_init_mortgages_message_board_write = 0;
548  FLAME_household_bank_init_mortgages_message_board_read = 0;
549  /* Sending agents */
550  if(household_start_state->agents != NULL) FLAME_household_bank_init_mortgages_message_board_write = 1;
551 
552  /* Reading agents */
553  if(bank_start_state->agents != NULL) FLAME_household_bank_init_mortgages_message_board_read = 1;
554 
555  /* Call message board library with details */
556  if(FLAME_household_bank_init_mortgages_message_board_write == 0 &&
557  FLAME_household_bank_init_mortgages_message_board_read == 0)
558  rc = MB_SetAccessMode(b_household_bank_init_mortgages, MB_MODE_IDLE);
559  if(FLAME_household_bank_init_mortgages_message_board_write == 1 &&
560  FLAME_household_bank_init_mortgages_message_board_read == 0)
561  rc = MB_SetAccessMode(b_household_bank_init_mortgages, MB_MODE_WRITEONLY);
562  if(FLAME_household_bank_init_mortgages_message_board_write == 0 &&
563  FLAME_household_bank_init_mortgages_message_board_read == 1)
564  rc = MB_SetAccessMode(b_household_bank_init_mortgages, MB_MODE_READONLY);
565  if(FLAME_household_bank_init_mortgages_message_board_write == 1 &&
566  FLAME_household_bank_init_mortgages_message_board_read == 1)
567  rc = MB_SetAccessMode(b_household_bank_init_mortgages, MB_MODE_READWRITE);
568  #ifdef ERRCHECK
569  if (rc != MB_SUCCESS)
570  {
571  fprintf(stderr, "ERROR: Could not set access mode of 'household_bank_init_mortgages' board\n");
572  switch(rc) {
573  case MB_ERR_INVALID:
574  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
575  break;
576  case MB_ERR_LOCKED:
577  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is locked\n");
578  break;
579  case MB_ERR_MEMALLOC:
580  fprintf(stderr, "\t reason: out of memory\n");
581  break;
582  case MB_ERR_INTERNAL:
583  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
584  break;
585  default:
586  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
587  break;
588  }
589 
590  exit(rc);
591  }
592  #endif
593  FLAME_household_bank_init_deposit_message_board_write = 0;
594  FLAME_household_bank_init_deposit_message_board_read = 0;
595  /* Sending agents */
596  if(household_start_state->agents != NULL) FLAME_household_bank_init_deposit_message_board_write = 1;
597 
598  /* Reading agents */
599  if(bank_start_state->agents != NULL) FLAME_household_bank_init_deposit_message_board_read = 1;
600 
601  /* Call message board library with details */
602  if(FLAME_household_bank_init_deposit_message_board_write == 0 &&
603  FLAME_household_bank_init_deposit_message_board_read == 0)
604  rc = MB_SetAccessMode(b_household_bank_init_deposit, MB_MODE_IDLE);
605  if(FLAME_household_bank_init_deposit_message_board_write == 1 &&
606  FLAME_household_bank_init_deposit_message_board_read == 0)
607  rc = MB_SetAccessMode(b_household_bank_init_deposit, MB_MODE_WRITEONLY);
608  if(FLAME_household_bank_init_deposit_message_board_write == 0 &&
609  FLAME_household_bank_init_deposit_message_board_read == 1)
610  rc = MB_SetAccessMode(b_household_bank_init_deposit, MB_MODE_READONLY);
611  if(FLAME_household_bank_init_deposit_message_board_write == 1 &&
612  FLAME_household_bank_init_deposit_message_board_read == 1)
613  rc = MB_SetAccessMode(b_household_bank_init_deposit, MB_MODE_READWRITE);
614  #ifdef ERRCHECK
615  if (rc != MB_SUCCESS)
616  {
617  fprintf(stderr, "ERROR: Could not set access mode of 'household_bank_init_deposit' board\n");
618  switch(rc) {
619  case MB_ERR_INVALID:
620  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
621  break;
622  case MB_ERR_LOCKED:
623  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is locked\n");
624  break;
625  case MB_ERR_MEMALLOC:
626  fprintf(stderr, "\t reason: out of memory\n");
627  break;
628  case MB_ERR_INTERNAL:
629  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
630  break;
631  default:
632  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
633  break;
634  }
635 
636  exit(rc);
637  }
638  #endif
639  FLAME_household_bank_update_deposit_message_board_write = 0;
640  FLAME_household_bank_update_deposit_message_board_read = 0;
641  /* Sending agents */
642  if(household_start_state->agents != NULL) FLAME_household_bank_update_deposit_message_board_write = 1;
643 
644  /* Reading agents */
645  if(bank_start_state->agents != NULL) FLAME_household_bank_update_deposit_message_board_read = 1;
646 
647  /* Call message board library with details */
648  if(FLAME_household_bank_update_deposit_message_board_write == 0 &&
649  FLAME_household_bank_update_deposit_message_board_read == 0)
650  rc = MB_SetAccessMode(b_household_bank_update_deposit, MB_MODE_IDLE);
651  if(FLAME_household_bank_update_deposit_message_board_write == 1 &&
652  FLAME_household_bank_update_deposit_message_board_read == 0)
653  rc = MB_SetAccessMode(b_household_bank_update_deposit, MB_MODE_WRITEONLY);
654  if(FLAME_household_bank_update_deposit_message_board_write == 0 &&
655  FLAME_household_bank_update_deposit_message_board_read == 1)
656  rc = MB_SetAccessMode(b_household_bank_update_deposit, MB_MODE_READONLY);
657  if(FLAME_household_bank_update_deposit_message_board_write == 1 &&
658  FLAME_household_bank_update_deposit_message_board_read == 1)
659  rc = MB_SetAccessMode(b_household_bank_update_deposit, MB_MODE_READWRITE);
660  #ifdef ERRCHECK
661  if (rc != MB_SUCCESS)
662  {
663  fprintf(stderr, "ERROR: Could not set access mode of 'household_bank_update_deposit' board\n");
664  switch(rc) {
665  case MB_ERR_INVALID:
666  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
667  break;
668  case MB_ERR_LOCKED:
669  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is locked\n");
670  break;
671  case MB_ERR_MEMALLOC:
672  fprintf(stderr, "\t reason: out of memory\n");
673  break;
674  case MB_ERR_INTERNAL:
675  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
676  break;
677  default:
678  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
679  break;
680  }
681 
682  exit(rc);
683  }
684  #endif
685  FLAME_bank_centralbank_init_debt_message_board_write = 0;
686  FLAME_bank_centralbank_init_debt_message_board_read = 0;
687  /* Sending agents */
688  if(bank_start_state->agents != NULL) FLAME_bank_centralbank_init_debt_message_board_write = 1;
689 
690  /* Reading agents */
691  if(centralbank_start_state->agents != NULL) FLAME_bank_centralbank_init_debt_message_board_read = 1;
692 
693  /* Call message board library with details */
694  if(FLAME_bank_centralbank_init_debt_message_board_write == 0 &&
695  FLAME_bank_centralbank_init_debt_message_board_read == 0)
696  rc = MB_SetAccessMode(b_bank_centralbank_init_debt, MB_MODE_IDLE);
697  if(FLAME_bank_centralbank_init_debt_message_board_write == 1 &&
698  FLAME_bank_centralbank_init_debt_message_board_read == 0)
699  rc = MB_SetAccessMode(b_bank_centralbank_init_debt, MB_MODE_WRITEONLY);
700  if(FLAME_bank_centralbank_init_debt_message_board_write == 0 &&
701  FLAME_bank_centralbank_init_debt_message_board_read == 1)
702  rc = MB_SetAccessMode(b_bank_centralbank_init_debt, MB_MODE_READONLY);
703  if(FLAME_bank_centralbank_init_debt_message_board_write == 1 &&
704  FLAME_bank_centralbank_init_debt_message_board_read == 1)
705  rc = MB_SetAccessMode(b_bank_centralbank_init_debt, MB_MODE_READWRITE);
706  #ifdef ERRCHECK
707  if (rc != MB_SUCCESS)
708  {
709  fprintf(stderr, "ERROR: Could not set access mode of 'bank_centralbank_init_debt' board\n");
710  switch(rc) {
711  case MB_ERR_INVALID:
712  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
713  break;
714  case MB_ERR_LOCKED:
715  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is locked\n");
716  break;
717  case MB_ERR_MEMALLOC:
718  fprintf(stderr, "\t reason: out of memory\n");
719  break;
720  case MB_ERR_INTERNAL:
721  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
722  break;
723  default:
724  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
725  break;
726  }
727 
728  exit(rc);
729  }
730  #endif
731  FLAME_bank_centralbank_init_deposit_message_board_write = 0;
732  FLAME_bank_centralbank_init_deposit_message_board_read = 0;
733  /* Sending agents */
734  if(bank_start_state->agents != NULL) FLAME_bank_centralbank_init_deposit_message_board_write = 1;
735 
736  /* Reading agents */
737  if(centralbank_start_state->agents != NULL) FLAME_bank_centralbank_init_deposit_message_board_read = 1;
738 
739  /* Call message board library with details */
740  if(FLAME_bank_centralbank_init_deposit_message_board_write == 0 &&
741  FLAME_bank_centralbank_init_deposit_message_board_read == 0)
742  rc = MB_SetAccessMode(b_bank_centralbank_init_deposit, MB_MODE_IDLE);
743  if(FLAME_bank_centralbank_init_deposit_message_board_write == 1 &&
744  FLAME_bank_centralbank_init_deposit_message_board_read == 0)
745  rc = MB_SetAccessMode(b_bank_centralbank_init_deposit, MB_MODE_WRITEONLY);
746  if(FLAME_bank_centralbank_init_deposit_message_board_write == 0 &&
747  FLAME_bank_centralbank_init_deposit_message_board_read == 1)
748  rc = MB_SetAccessMode(b_bank_centralbank_init_deposit, MB_MODE_READONLY);
749  if(FLAME_bank_centralbank_init_deposit_message_board_write == 1 &&
750  FLAME_bank_centralbank_init_deposit_message_board_read == 1)
751  rc = MB_SetAccessMode(b_bank_centralbank_init_deposit, MB_MODE_READWRITE);
752  #ifdef ERRCHECK
753  if (rc != MB_SUCCESS)
754  {
755  fprintf(stderr, "ERROR: Could not set access mode of 'bank_centralbank_init_deposit' board\n");
756  switch(rc) {
757  case MB_ERR_INVALID:
758  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
759  break;
760  case MB_ERR_LOCKED:
761  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is locked\n");
762  break;
763  case MB_ERR_MEMALLOC:
764  fprintf(stderr, "\t reason: out of memory\n");
765  break;
766  case MB_ERR_INTERNAL:
767  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
768  break;
769  default:
770  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
771  break;
772  }
773 
774  exit(rc);
775  }
776  #endif
777  FLAME_bank_centralbank_update_deposit_message_board_write = 0;
778  FLAME_bank_centralbank_update_deposit_message_board_read = 0;
779  /* Sending agents */
780  if(bank_start_state->agents != NULL) FLAME_bank_centralbank_update_deposit_message_board_write = 1;
781 
782  /* Reading agents */
783  if(centralbank_start_state->agents != NULL) FLAME_bank_centralbank_update_deposit_message_board_read = 1;
784 
785  /* Call message board library with details */
786  if(FLAME_bank_centralbank_update_deposit_message_board_write == 0 &&
787  FLAME_bank_centralbank_update_deposit_message_board_read == 0)
788  rc = MB_SetAccessMode(b_bank_centralbank_update_deposit, MB_MODE_IDLE);
789  if(FLAME_bank_centralbank_update_deposit_message_board_write == 1 &&
790  FLAME_bank_centralbank_update_deposit_message_board_read == 0)
791  rc = MB_SetAccessMode(b_bank_centralbank_update_deposit, MB_MODE_WRITEONLY);
792  if(FLAME_bank_centralbank_update_deposit_message_board_write == 0 &&
793  FLAME_bank_centralbank_update_deposit_message_board_read == 1)
794  rc = MB_SetAccessMode(b_bank_centralbank_update_deposit, MB_MODE_READONLY);
795  if(FLAME_bank_centralbank_update_deposit_message_board_write == 1 &&
796  FLAME_bank_centralbank_update_deposit_message_board_read == 1)
797  rc = MB_SetAccessMode(b_bank_centralbank_update_deposit, MB_MODE_READWRITE);
798  #ifdef ERRCHECK
799  if (rc != MB_SUCCESS)
800  {
801  fprintf(stderr, "ERROR: Could not set access mode of 'bank_centralbank_update_deposit' board\n");
802  switch(rc) {
803  case MB_ERR_INVALID:
804  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
805  break;
806  case MB_ERR_LOCKED:
807  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is locked\n");
808  break;
809  case MB_ERR_MEMALLOC:
810  fprintf(stderr, "\t reason: out of memory\n");
811  break;
812  case MB_ERR_INTERNAL:
813  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
814  break;
815  default:
816  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
817  break;
818  }
819 
820  exit(rc);
821  }
822  #endif
823  FLAME_fund_centralbank_init_deposit_message_board_write = 0;
824  FLAME_fund_centralbank_init_deposit_message_board_read = 0;
825  /* Sending agents */
826  if(equityfund_start_state->agents != NULL) FLAME_fund_centralbank_init_deposit_message_board_write = 1;
827 
828  /* Reading agents */
829  if(centralbank_start_state->agents != NULL) FLAME_fund_centralbank_init_deposit_message_board_read = 1;
830 
831  /* Call message board library with details */
832  if(FLAME_fund_centralbank_init_deposit_message_board_write == 0 &&
833  FLAME_fund_centralbank_init_deposit_message_board_read == 0)
834  rc = MB_SetAccessMode(b_fund_centralbank_init_deposit, MB_MODE_IDLE);
835  if(FLAME_fund_centralbank_init_deposit_message_board_write == 1 &&
836  FLAME_fund_centralbank_init_deposit_message_board_read == 0)
837  rc = MB_SetAccessMode(b_fund_centralbank_init_deposit, MB_MODE_WRITEONLY);
838  if(FLAME_fund_centralbank_init_deposit_message_board_write == 0 &&
839  FLAME_fund_centralbank_init_deposit_message_board_read == 1)
840  rc = MB_SetAccessMode(b_fund_centralbank_init_deposit, MB_MODE_READONLY);
841  if(FLAME_fund_centralbank_init_deposit_message_board_write == 1 &&
842  FLAME_fund_centralbank_init_deposit_message_board_read == 1)
843  rc = MB_SetAccessMode(b_fund_centralbank_init_deposit, MB_MODE_READWRITE);
844  #ifdef ERRCHECK
845  if (rc != MB_SUCCESS)
846  {
847  fprintf(stderr, "ERROR: Could not set access mode of 'fund_centralbank_init_deposit' board\n");
848  switch(rc) {
849  case MB_ERR_INVALID:
850  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
851  break;
852  case MB_ERR_LOCKED:
853  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is locked\n");
854  break;
855  case MB_ERR_MEMALLOC:
856  fprintf(stderr, "\t reason: out of memory\n");
857  break;
858  case MB_ERR_INTERNAL:
859  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
860  break;
861  default:
862  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
863  break;
864  }
865 
866  exit(rc);
867  }
868  #endif
869  FLAME_fund_centralbank_update_deposit_message_board_write = 0;
870  FLAME_fund_centralbank_update_deposit_message_board_read = 0;
871  /* Sending agents */
872  if(equityfund_start_state->agents != NULL) FLAME_fund_centralbank_update_deposit_message_board_write = 1;
873 
874  /* Reading agents */
875  if(centralbank_start_state->agents != NULL) FLAME_fund_centralbank_update_deposit_message_board_read = 1;
876 
877  /* Call message board library with details */
878  if(FLAME_fund_centralbank_update_deposit_message_board_write == 0 &&
879  FLAME_fund_centralbank_update_deposit_message_board_read == 0)
880  rc = MB_SetAccessMode(b_fund_centralbank_update_deposit, MB_MODE_IDLE);
881  if(FLAME_fund_centralbank_update_deposit_message_board_write == 1 &&
882  FLAME_fund_centralbank_update_deposit_message_board_read == 0)
883  rc = MB_SetAccessMode(b_fund_centralbank_update_deposit, MB_MODE_WRITEONLY);
884  if(FLAME_fund_centralbank_update_deposit_message_board_write == 0 &&
885  FLAME_fund_centralbank_update_deposit_message_board_read == 1)
886  rc = MB_SetAccessMode(b_fund_centralbank_update_deposit, MB_MODE_READONLY);
887  if(FLAME_fund_centralbank_update_deposit_message_board_write == 1 &&
888  FLAME_fund_centralbank_update_deposit_message_board_read == 1)
889  rc = MB_SetAccessMode(b_fund_centralbank_update_deposit, MB_MODE_READWRITE);
890  #ifdef ERRCHECK
891  if (rc != MB_SUCCESS)
892  {
893  fprintf(stderr, "ERROR: Could not set access mode of 'fund_centralbank_update_deposit' board\n");
894  switch(rc) {
895  case MB_ERR_INVALID:
896  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
897  break;
898  case MB_ERR_LOCKED:
899  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is locked\n");
900  break;
901  case MB_ERR_MEMALLOC:
902  fprintf(stderr, "\t reason: out of memory\n");
903  break;
904  case MB_ERR_INTERNAL:
905  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
906  break;
907  default:
908  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
909  break;
910  }
911 
912  exit(rc);
913  }
914  #endif
915  FLAME_gov_centralbank_init_deposit_message_board_write = 0;
916  FLAME_gov_centralbank_init_deposit_message_board_read = 0;
917  /* Sending agents */
918  if(government_start_state->agents != NULL) FLAME_gov_centralbank_init_deposit_message_board_write = 1;
919 
920  /* Reading agents */
921  if(centralbank_start_state->agents != NULL) FLAME_gov_centralbank_init_deposit_message_board_read = 1;
922 
923  /* Call message board library with details */
924  if(FLAME_gov_centralbank_init_deposit_message_board_write == 0 &&
925  FLAME_gov_centralbank_init_deposit_message_board_read == 0)
926  rc = MB_SetAccessMode(b_gov_centralbank_init_deposit, MB_MODE_IDLE);
927  if(FLAME_gov_centralbank_init_deposit_message_board_write == 1 &&
928  FLAME_gov_centralbank_init_deposit_message_board_read == 0)
929  rc = MB_SetAccessMode(b_gov_centralbank_init_deposit, MB_MODE_WRITEONLY);
930  if(FLAME_gov_centralbank_init_deposit_message_board_write == 0 &&
931  FLAME_gov_centralbank_init_deposit_message_board_read == 1)
932  rc = MB_SetAccessMode(b_gov_centralbank_init_deposit, MB_MODE_READONLY);
933  if(FLAME_gov_centralbank_init_deposit_message_board_write == 1 &&
934  FLAME_gov_centralbank_init_deposit_message_board_read == 1)
935  rc = MB_SetAccessMode(b_gov_centralbank_init_deposit, MB_MODE_READWRITE);
936  #ifdef ERRCHECK
937  if (rc != MB_SUCCESS)
938  {
939  fprintf(stderr, "ERROR: Could not set access mode of 'gov_centralbank_init_deposit' board\n");
940  switch(rc) {
941  case MB_ERR_INVALID:
942  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
943  break;
944  case MB_ERR_LOCKED:
945  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is locked\n");
946  break;
947  case MB_ERR_MEMALLOC:
948  fprintf(stderr, "\t reason: out of memory\n");
949  break;
950  case MB_ERR_INTERNAL:
951  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
952  break;
953  default:
954  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
955  break;
956  }
957 
958  exit(rc);
959  }
960  #endif
961  FLAME_gov_centralbank_update_deposit_message_board_write = 0;
962  FLAME_gov_centralbank_update_deposit_message_board_read = 0;
963  /* Sending agents */
964  if(government_start_state->agents != NULL) FLAME_gov_centralbank_update_deposit_message_board_write = 1;
965 
966  /* Reading agents */
967  if(centralbank_start_state->agents != NULL) FLAME_gov_centralbank_update_deposit_message_board_read = 1;
968 
969  /* Call message board library with details */
970  if(FLAME_gov_centralbank_update_deposit_message_board_write == 0 &&
971  FLAME_gov_centralbank_update_deposit_message_board_read == 0)
972  rc = MB_SetAccessMode(b_gov_centralbank_update_deposit, MB_MODE_IDLE);
973  if(FLAME_gov_centralbank_update_deposit_message_board_write == 1 &&
974  FLAME_gov_centralbank_update_deposit_message_board_read == 0)
975  rc = MB_SetAccessMode(b_gov_centralbank_update_deposit, MB_MODE_WRITEONLY);
976  if(FLAME_gov_centralbank_update_deposit_message_board_write == 0 &&
977  FLAME_gov_centralbank_update_deposit_message_board_read == 1)
978  rc = MB_SetAccessMode(b_gov_centralbank_update_deposit, MB_MODE_READONLY);
979  if(FLAME_gov_centralbank_update_deposit_message_board_write == 1 &&
980  FLAME_gov_centralbank_update_deposit_message_board_read == 1)
981  rc = MB_SetAccessMode(b_gov_centralbank_update_deposit, MB_MODE_READWRITE);
982  #ifdef ERRCHECK
983  if (rc != MB_SUCCESS)
984  {
985  fprintf(stderr, "ERROR: Could not set access mode of 'gov_centralbank_update_deposit' board\n");
986  switch(rc) {
987  case MB_ERR_INVALID:
988  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
989  break;
990  case MB_ERR_LOCKED:
991  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is locked\n");
992  break;
993  case MB_ERR_MEMALLOC:
994  fprintf(stderr, "\t reason: out of memory\n");
995  break;
996  case MB_ERR_INTERNAL:
997  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
998  break;
999  default:
1000  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1001  break;
1002  }
1003 
1004  exit(rc);
1005  }
1006  #endif
1007  FLAME_interest_rate_message_board_write = 0;
1008  FLAME_interest_rate_message_board_read = 0;
1009  /* Sending agents */
1010  if(centralbank_start_state->agents != NULL) FLAME_interest_rate_message_board_write = 1;
1011 
1012  /* Reading agents */
1013  if(firm_start_state->agents != NULL) FLAME_interest_rate_message_board_read = 1;
1014  if(household_start_state->agents != NULL) FLAME_interest_rate_message_board_read = 1;
1015  if(bank_start_state->agents != NULL) FLAME_interest_rate_message_board_read = 1;
1016  if(reagency_start_state->agents != NULL) FLAME_interest_rate_message_board_read = 1;
1017 
1018  /* Call message board library with details */
1019  if(FLAME_interest_rate_message_board_write == 0 &&
1020  FLAME_interest_rate_message_board_read == 0)
1021  rc = MB_SetAccessMode(b_interest_rate, MB_MODE_IDLE);
1022  if(FLAME_interest_rate_message_board_write == 1 &&
1023  FLAME_interest_rate_message_board_read == 0)
1024  rc = MB_SetAccessMode(b_interest_rate, MB_MODE_WRITEONLY);
1025  if(FLAME_interest_rate_message_board_write == 0 &&
1026  FLAME_interest_rate_message_board_read == 1)
1027  rc = MB_SetAccessMode(b_interest_rate, MB_MODE_READONLY);
1028  if(FLAME_interest_rate_message_board_write == 1 &&
1029  FLAME_interest_rate_message_board_read == 1)
1030  rc = MB_SetAccessMode(b_interest_rate, MB_MODE_READWRITE);
1031  #ifdef ERRCHECK
1032  if (rc != MB_SUCCESS)
1033  {
1034  fprintf(stderr, "ERROR: Could not set access mode of 'interest_rate' board\n");
1035  switch(rc) {
1036  case MB_ERR_INVALID:
1037  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
1038  break;
1039  case MB_ERR_LOCKED:
1040  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
1041  break;
1042  case MB_ERR_MEMALLOC:
1043  fprintf(stderr, "\t reason: out of memory\n");
1044  break;
1045  case MB_ERR_INTERNAL:
1046  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1047  break;
1048  default:
1049  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1050  break;
1051  }
1052 
1053  exit(rc);
1054  }
1055  #endif
1056  FLAME_capital_tax_rate_message_board_write = 0;
1057  FLAME_capital_tax_rate_message_board_read = 0;
1058  /* Sending agents */
1059  if(government_start_state->agents != NULL) FLAME_capital_tax_rate_message_board_write = 1;
1060 
1061  /* Reading agents */
1062  if(equityfund_start_state->agents != NULL) FLAME_capital_tax_rate_message_board_read = 1;
1063 
1064  /* Call message board library with details */
1065  if(FLAME_capital_tax_rate_message_board_write == 0 &&
1066  FLAME_capital_tax_rate_message_board_read == 0)
1067  rc = MB_SetAccessMode(b_capital_tax_rate, MB_MODE_IDLE);
1068  if(FLAME_capital_tax_rate_message_board_write == 1 &&
1069  FLAME_capital_tax_rate_message_board_read == 0)
1070  rc = MB_SetAccessMode(b_capital_tax_rate, MB_MODE_WRITEONLY);
1071  if(FLAME_capital_tax_rate_message_board_write == 0 &&
1072  FLAME_capital_tax_rate_message_board_read == 1)
1073  rc = MB_SetAccessMode(b_capital_tax_rate, MB_MODE_READONLY);
1074  if(FLAME_capital_tax_rate_message_board_write == 1 &&
1075  FLAME_capital_tax_rate_message_board_read == 1)
1076  rc = MB_SetAccessMode(b_capital_tax_rate, MB_MODE_READWRITE);
1077  #ifdef ERRCHECK
1078  if (rc != MB_SUCCESS)
1079  {
1080  fprintf(stderr, "ERROR: Could not set access mode of 'capital_tax_rate' board\n");
1081  switch(rc) {
1082  case MB_ERR_INVALID:
1083  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
1084  break;
1085  case MB_ERR_LOCKED:
1086  fprintf(stderr, "\t reason: 'capital_tax_rate' board is locked\n");
1087  break;
1088  case MB_ERR_MEMALLOC:
1089  fprintf(stderr, "\t reason: out of memory\n");
1090  break;
1091  case MB_ERR_INTERNAL:
1092  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1093  break;
1094  default:
1095  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1096  break;
1097  }
1098 
1099  exit(rc);
1100  }
1101  #endif
1102  FLAME_labour_tax_rate_message_board_write = 0;
1103  FLAME_labour_tax_rate_message_board_read = 0;
1104  /* Sending agents */
1105  if(government_start_state->agents != NULL) FLAME_labour_tax_rate_message_board_write = 1;
1106 
1107  /* Reading agents */
1108  if(firm_start_state->agents != NULL) FLAME_labour_tax_rate_message_board_read = 1;
1109  if(household_start_state->agents != NULL) FLAME_labour_tax_rate_message_board_read = 1;
1110 
1111  /* Call message board library with details */
1112  if(FLAME_labour_tax_rate_message_board_write == 0 &&
1113  FLAME_labour_tax_rate_message_board_read == 0)
1114  rc = MB_SetAccessMode(b_labour_tax_rate, MB_MODE_IDLE);
1115  if(FLAME_labour_tax_rate_message_board_write == 1 &&
1116  FLAME_labour_tax_rate_message_board_read == 0)
1117  rc = MB_SetAccessMode(b_labour_tax_rate, MB_MODE_WRITEONLY);
1118  if(FLAME_labour_tax_rate_message_board_write == 0 &&
1119  FLAME_labour_tax_rate_message_board_read == 1)
1120  rc = MB_SetAccessMode(b_labour_tax_rate, MB_MODE_READONLY);
1121  if(FLAME_labour_tax_rate_message_board_write == 1 &&
1122  FLAME_labour_tax_rate_message_board_read == 1)
1123  rc = MB_SetAccessMode(b_labour_tax_rate, MB_MODE_READWRITE);
1124  #ifdef ERRCHECK
1125  if (rc != MB_SUCCESS)
1126  {
1127  fprintf(stderr, "ERROR: Could not set access mode of 'labour_tax_rate' board\n");
1128  switch(rc) {
1129  case MB_ERR_INVALID:
1130  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
1131  break;
1132  case MB_ERR_LOCKED:
1133  fprintf(stderr, "\t reason: 'labour_tax_rate' board is locked\n");
1134  break;
1135  case MB_ERR_MEMALLOC:
1136  fprintf(stderr, "\t reason: out of memory\n");
1137  break;
1138  case MB_ERR_INTERNAL:
1139  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1140  break;
1141  default:
1142  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1143  break;
1144  }
1145 
1146  exit(rc);
1147  }
1148  #endif
1149  FLAME_household_jpoffice_id_message_board_write = 0;
1150  FLAME_household_jpoffice_id_message_board_read = 0;
1151  /* Sending agents */
1152  if(household_start_state->agents != NULL) FLAME_household_jpoffice_id_message_board_write = 1;
1153 
1154  /* Reading agents */
1155  if(jpoffice_start_state->agents != NULL) FLAME_household_jpoffice_id_message_board_read = 1;
1156 
1157  /* Call message board library with details */
1158  if(FLAME_household_jpoffice_id_message_board_write == 0 &&
1159  FLAME_household_jpoffice_id_message_board_read == 0)
1160  rc = MB_SetAccessMode(b_household_jpoffice_id, MB_MODE_IDLE);
1161  if(FLAME_household_jpoffice_id_message_board_write == 1 &&
1162  FLAME_household_jpoffice_id_message_board_read == 0)
1163  rc = MB_SetAccessMode(b_household_jpoffice_id, MB_MODE_WRITEONLY);
1164  if(FLAME_household_jpoffice_id_message_board_write == 0 &&
1165  FLAME_household_jpoffice_id_message_board_read == 1)
1166  rc = MB_SetAccessMode(b_household_jpoffice_id, MB_MODE_READONLY);
1167  if(FLAME_household_jpoffice_id_message_board_write == 1 &&
1168  FLAME_household_jpoffice_id_message_board_read == 1)
1169  rc = MB_SetAccessMode(b_household_jpoffice_id, MB_MODE_READWRITE);
1170  #ifdef ERRCHECK
1171  if (rc != MB_SUCCESS)
1172  {
1173  fprintf(stderr, "ERROR: Could not set access mode of 'household_jpoffice_id' board\n");
1174  switch(rc) {
1175  case MB_ERR_INVALID:
1176  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
1177  break;
1178  case MB_ERR_LOCKED:
1179  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is locked\n");
1180  break;
1181  case MB_ERR_MEMALLOC:
1182  fprintf(stderr, "\t reason: out of memory\n");
1183  break;
1184  case MB_ERR_INTERNAL:
1185  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1186  break;
1187  default:
1188  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1189  break;
1190  }
1191 
1192  exit(rc);
1193  }
1194  #endif
1195  FLAME_jpoffice_household_employer_message_board_write = 0;
1196  FLAME_jpoffice_household_employer_message_board_read = 0;
1197  /* Sending agents */
1198  if(jpoffice_start_state->agents != NULL) FLAME_jpoffice_household_employer_message_board_write = 1;
1199 
1200  /* Reading agents */
1201  if(household_start_state->agents != NULL) FLAME_jpoffice_household_employer_message_board_read = 1;
1202 
1203  /* Call message board library with details */
1204  if(FLAME_jpoffice_household_employer_message_board_write == 0 &&
1205  FLAME_jpoffice_household_employer_message_board_read == 0)
1206  rc = MB_SetAccessMode(b_jpoffice_household_employer, MB_MODE_IDLE);
1207  if(FLAME_jpoffice_household_employer_message_board_write == 1 &&
1208  FLAME_jpoffice_household_employer_message_board_read == 0)
1209  rc = MB_SetAccessMode(b_jpoffice_household_employer, MB_MODE_WRITEONLY);
1210  if(FLAME_jpoffice_household_employer_message_board_write == 0 &&
1211  FLAME_jpoffice_household_employer_message_board_read == 1)
1212  rc = MB_SetAccessMode(b_jpoffice_household_employer, MB_MODE_READONLY);
1213  if(FLAME_jpoffice_household_employer_message_board_write == 1 &&
1214  FLAME_jpoffice_household_employer_message_board_read == 1)
1215  rc = MB_SetAccessMode(b_jpoffice_household_employer, MB_MODE_READWRITE);
1216  #ifdef ERRCHECK
1217  if (rc != MB_SUCCESS)
1218  {
1219  fprintf(stderr, "ERROR: Could not set access mode of 'jpoffice_household_employer' board\n");
1220  switch(rc) {
1221  case MB_ERR_INVALID:
1222  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
1223  break;
1224  case MB_ERR_LOCKED:
1225  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is locked\n");
1226  break;
1227  case MB_ERR_MEMALLOC:
1228  fprintf(stderr, "\t reason: out of memory\n");
1229  break;
1230  case MB_ERR_INTERNAL:
1231  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1232  break;
1233  default:
1234  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1235  break;
1236  }
1237 
1238  exit(rc);
1239  }
1240  #endif
1241  FLAME_firm_jpoffice_id_message_board_write = 0;
1242  FLAME_firm_jpoffice_id_message_board_read = 0;
1243  /* Sending agents */
1244  if(firm_start_state->agents != NULL) FLAME_firm_jpoffice_id_message_board_write = 1;
1245 
1246  /* Reading agents */
1247  if(jpoffice_start_state->agents != NULL) FLAME_firm_jpoffice_id_message_board_read = 1;
1248 
1249  /* Call message board library with details */
1250  if(FLAME_firm_jpoffice_id_message_board_write == 0 &&
1251  FLAME_firm_jpoffice_id_message_board_read == 0)
1252  rc = MB_SetAccessMode(b_firm_jpoffice_id, MB_MODE_IDLE);
1253  if(FLAME_firm_jpoffice_id_message_board_write == 1 &&
1254  FLAME_firm_jpoffice_id_message_board_read == 0)
1255  rc = MB_SetAccessMode(b_firm_jpoffice_id, MB_MODE_WRITEONLY);
1256  if(FLAME_firm_jpoffice_id_message_board_write == 0 &&
1257  FLAME_firm_jpoffice_id_message_board_read == 1)
1258  rc = MB_SetAccessMode(b_firm_jpoffice_id, MB_MODE_READONLY);
1259  if(FLAME_firm_jpoffice_id_message_board_write == 1 &&
1260  FLAME_firm_jpoffice_id_message_board_read == 1)
1261  rc = MB_SetAccessMode(b_firm_jpoffice_id, MB_MODE_READWRITE);
1262  #ifdef ERRCHECK
1263  if (rc != MB_SUCCESS)
1264  {
1265  fprintf(stderr, "ERROR: Could not set access mode of 'firm_jpoffice_id' board\n");
1266  switch(rc) {
1267  case MB_ERR_INVALID:
1268  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
1269  break;
1270  case MB_ERR_LOCKED:
1271  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is locked\n");
1272  break;
1273  case MB_ERR_MEMALLOC:
1274  fprintf(stderr, "\t reason: out of memory\n");
1275  break;
1276  case MB_ERR_INTERNAL:
1277  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1278  break;
1279  default:
1280  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1281  break;
1282  }
1283 
1284  exit(rc);
1285  }
1286  #endif
1287  FLAME_jpoffice_firm_employee_message_board_write = 0;
1288  FLAME_jpoffice_firm_employee_message_board_read = 0;
1289  /* Sending agents */
1290  if(jpoffice_start_state->agents != NULL) FLAME_jpoffice_firm_employee_message_board_write = 1;
1291 
1292  /* Reading agents */
1293  if(firm_start_state->agents != NULL) FLAME_jpoffice_firm_employee_message_board_read = 1;
1294 
1295  /* Call message board library with details */
1296  if(FLAME_jpoffice_firm_employee_message_board_write == 0 &&
1297  FLAME_jpoffice_firm_employee_message_board_read == 0)
1298  rc = MB_SetAccessMode(b_jpoffice_firm_employee, MB_MODE_IDLE);
1299  if(FLAME_jpoffice_firm_employee_message_board_write == 1 &&
1300  FLAME_jpoffice_firm_employee_message_board_read == 0)
1301  rc = MB_SetAccessMode(b_jpoffice_firm_employee, MB_MODE_WRITEONLY);
1302  if(FLAME_jpoffice_firm_employee_message_board_write == 0 &&
1303  FLAME_jpoffice_firm_employee_message_board_read == 1)
1304  rc = MB_SetAccessMode(b_jpoffice_firm_employee, MB_MODE_READONLY);
1305  if(FLAME_jpoffice_firm_employee_message_board_write == 1 &&
1306  FLAME_jpoffice_firm_employee_message_board_read == 1)
1307  rc = MB_SetAccessMode(b_jpoffice_firm_employee, MB_MODE_READWRITE);
1308  #ifdef ERRCHECK
1309  if (rc != MB_SUCCESS)
1310  {
1311  fprintf(stderr, "ERROR: Could not set access mode of 'jpoffice_firm_employee' board\n");
1312  switch(rc) {
1313  case MB_ERR_INVALID:
1314  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
1315  break;
1316  case MB_ERR_LOCKED:
1317  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is locked\n");
1318  break;
1319  case MB_ERR_MEMALLOC:
1320  fprintf(stderr, "\t reason: out of memory\n");
1321  break;
1322  case MB_ERR_INTERNAL:
1323  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1324  break;
1325  default:
1326  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1327  break;
1328  }
1329 
1330  exit(rc);
1331  }
1332  #endif
1333  FLAME_buy_message_board_write = 0;
1334  FLAME_buy_message_board_read = 0;
1335  /* Sending agents */
1336  if(household_start_state->agents != NULL) FLAME_buy_message_board_write = 1;
1337 
1338  /* Reading agents */
1339  if(mall_start_state->agents != NULL) FLAME_buy_message_board_read = 1;
1340 
1341  /* Call message board library with details */
1342  if(FLAME_buy_message_board_write == 0 &&
1343  FLAME_buy_message_board_read == 0)
1344  rc = MB_SetAccessMode(b_buy, MB_MODE_IDLE);
1345  if(FLAME_buy_message_board_write == 1 &&
1346  FLAME_buy_message_board_read == 0)
1347  rc = MB_SetAccessMode(b_buy, MB_MODE_WRITEONLY);
1348  if(FLAME_buy_message_board_write == 0 &&
1349  FLAME_buy_message_board_read == 1)
1350  rc = MB_SetAccessMode(b_buy, MB_MODE_READONLY);
1351  if(FLAME_buy_message_board_write == 1 &&
1352  FLAME_buy_message_board_read == 1)
1353  rc = MB_SetAccessMode(b_buy, MB_MODE_READWRITE);
1354  #ifdef ERRCHECK
1355  if (rc != MB_SUCCESS)
1356  {
1357  fprintf(stderr, "ERROR: Could not set access mode of 'buy' board\n");
1358  switch(rc) {
1359  case MB_ERR_INVALID:
1360  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
1361  break;
1362  case MB_ERR_LOCKED:
1363  fprintf(stderr, "\t reason: 'buy' board is locked\n");
1364  break;
1365  case MB_ERR_MEMALLOC:
1366  fprintf(stderr, "\t reason: out of memory\n");
1367  break;
1368  case MB_ERR_INTERNAL:
1369  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1370  break;
1371  default:
1372  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1373  break;
1374  }
1375 
1376  exit(rc);
1377  }
1378  #endif
1379  FLAME_bought_message_board_write = 0;
1380  FLAME_bought_message_board_read = 0;
1381  /* Sending agents */
1382  if(mall_start_state->agents != NULL) FLAME_bought_message_board_write = 1;
1383 
1384  /* Reading agents */
1385  if(household_start_state->agents != NULL) FLAME_bought_message_board_read = 1;
1386 
1387  /* Call message board library with details */
1388  if(FLAME_bought_message_board_write == 0 &&
1389  FLAME_bought_message_board_read == 0)
1390  rc = MB_SetAccessMode(b_bought, MB_MODE_IDLE);
1391  if(FLAME_bought_message_board_write == 1 &&
1392  FLAME_bought_message_board_read == 0)
1393  rc = MB_SetAccessMode(b_bought, MB_MODE_WRITEONLY);
1394  if(FLAME_bought_message_board_write == 0 &&
1395  FLAME_bought_message_board_read == 1)
1396  rc = MB_SetAccessMode(b_bought, MB_MODE_READONLY);
1397  if(FLAME_bought_message_board_write == 1 &&
1398  FLAME_bought_message_board_read == 1)
1399  rc = MB_SetAccessMode(b_bought, MB_MODE_READWRITE);
1400  #ifdef ERRCHECK
1401  if (rc != MB_SUCCESS)
1402  {
1403  fprintf(stderr, "ERROR: Could not set access mode of 'bought' board\n");
1404  switch(rc) {
1405  case MB_ERR_INVALID:
1406  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
1407  break;
1408  case MB_ERR_LOCKED:
1409  fprintf(stderr, "\t reason: 'bought' board is locked\n");
1410  break;
1411  case MB_ERR_MEMALLOC:
1412  fprintf(stderr, "\t reason: out of memory\n");
1413  break;
1414  case MB_ERR_INTERNAL:
1415  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1416  break;
1417  default:
1418  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1419  break;
1420  }
1421 
1422  exit(rc);
1423  }
1424  #endif
1425  FLAME_sell_message_board_write = 0;
1426  FLAME_sell_message_board_read = 0;
1427  /* Sending agents */
1428  if(firm_start_state->agents != NULL) FLAME_sell_message_board_write = 1;
1429 
1430  /* Reading agents */
1431  if(mall_start_state->agents != NULL) FLAME_sell_message_board_read = 1;
1432 
1433  /* Call message board library with details */
1434  if(FLAME_sell_message_board_write == 0 &&
1435  FLAME_sell_message_board_read == 0)
1436  rc = MB_SetAccessMode(b_sell, MB_MODE_IDLE);
1437  if(FLAME_sell_message_board_write == 1 &&
1438  FLAME_sell_message_board_read == 0)
1439  rc = MB_SetAccessMode(b_sell, MB_MODE_WRITEONLY);
1440  if(FLAME_sell_message_board_write == 0 &&
1441  FLAME_sell_message_board_read == 1)
1442  rc = MB_SetAccessMode(b_sell, MB_MODE_READONLY);
1443  if(FLAME_sell_message_board_write == 1 &&
1444  FLAME_sell_message_board_read == 1)
1445  rc = MB_SetAccessMode(b_sell, MB_MODE_READWRITE);
1446  #ifdef ERRCHECK
1447  if (rc != MB_SUCCESS)
1448  {
1449  fprintf(stderr, "ERROR: Could not set access mode of 'sell' board\n");
1450  switch(rc) {
1451  case MB_ERR_INVALID:
1452  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
1453  break;
1454  case MB_ERR_LOCKED:
1455  fprintf(stderr, "\t reason: 'sell' board is locked\n");
1456  break;
1457  case MB_ERR_MEMALLOC:
1458  fprintf(stderr, "\t reason: out of memory\n");
1459  break;
1460  case MB_ERR_INTERNAL:
1461  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1462  break;
1463  default:
1464  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1465  break;
1466  }
1467 
1468  exit(rc);
1469  }
1470  #endif
1471  FLAME_sold_message_board_write = 0;
1472  FLAME_sold_message_board_read = 0;
1473  /* Sending agents */
1474  if(mall_start_state->agents != NULL) FLAME_sold_message_board_write = 1;
1475 
1476  /* Reading agents */
1477  if(firm_start_state->agents != NULL) FLAME_sold_message_board_read = 1;
1478 
1479  /* Call message board library with details */
1480  if(FLAME_sold_message_board_write == 0 &&
1481  FLAME_sold_message_board_read == 0)
1482  rc = MB_SetAccessMode(b_sold, MB_MODE_IDLE);
1483  if(FLAME_sold_message_board_write == 1 &&
1484  FLAME_sold_message_board_read == 0)
1485  rc = MB_SetAccessMode(b_sold, MB_MODE_WRITEONLY);
1486  if(FLAME_sold_message_board_write == 0 &&
1487  FLAME_sold_message_board_read == 1)
1488  rc = MB_SetAccessMode(b_sold, MB_MODE_READONLY);
1489  if(FLAME_sold_message_board_write == 1 &&
1490  FLAME_sold_message_board_read == 1)
1491  rc = MB_SetAccessMode(b_sold, MB_MODE_READWRITE);
1492  #ifdef ERRCHECK
1493  if (rc != MB_SUCCESS)
1494  {
1495  fprintf(stderr, "ERROR: Could not set access mode of 'sold' board\n");
1496  switch(rc) {
1497  case MB_ERR_INVALID:
1498  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
1499  break;
1500  case MB_ERR_LOCKED:
1501  fprintf(stderr, "\t reason: 'sold' board is locked\n");
1502  break;
1503  case MB_ERR_MEMALLOC:
1504  fprintf(stderr, "\t reason: out of memory\n");
1505  break;
1506  case MB_ERR_INTERNAL:
1507  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1508  break;
1509  default:
1510  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1511  break;
1512  }
1513 
1514  exit(rc);
1515  }
1516  #endif
1517  FLAME_goods_transactions_summary_message_board_write = 0;
1518  FLAME_goods_transactions_summary_message_board_read = 0;
1519  /* Sending agents */
1520  if(mall_start_state->agents != NULL) FLAME_goods_transactions_summary_message_board_write = 1;
1521 
1522  /* Reading agents */
1523  if(firm_start_state->agents != NULL) FLAME_goods_transactions_summary_message_board_read = 1;
1524  if(centralbank_start_state->agents != NULL) FLAME_goods_transactions_summary_message_board_read = 1;
1525 
1526  /* Call message board library with details */
1527  if(FLAME_goods_transactions_summary_message_board_write == 0 &&
1528  FLAME_goods_transactions_summary_message_board_read == 0)
1529  rc = MB_SetAccessMode(b_goods_transactions_summary, MB_MODE_IDLE);
1530  if(FLAME_goods_transactions_summary_message_board_write == 1 &&
1531  FLAME_goods_transactions_summary_message_board_read == 0)
1532  rc = MB_SetAccessMode(b_goods_transactions_summary, MB_MODE_WRITEONLY);
1533  if(FLAME_goods_transactions_summary_message_board_write == 0 &&
1534  FLAME_goods_transactions_summary_message_board_read == 1)
1535  rc = MB_SetAccessMode(b_goods_transactions_summary, MB_MODE_READONLY);
1536  if(FLAME_goods_transactions_summary_message_board_write == 1 &&
1537  FLAME_goods_transactions_summary_message_board_read == 1)
1538  rc = MB_SetAccessMode(b_goods_transactions_summary, MB_MODE_READWRITE);
1539  #ifdef ERRCHECK
1540  if (rc != MB_SUCCESS)
1541  {
1542  fprintf(stderr, "ERROR: Could not set access mode of 'goods_transactions_summary' board\n");
1543  switch(rc) {
1544  case MB_ERR_INVALID:
1545  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
1546  break;
1547  case MB_ERR_LOCKED:
1548  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is locked\n");
1549  break;
1550  case MB_ERR_MEMALLOC:
1551  fprintf(stderr, "\t reason: out of memory\n");
1552  break;
1553  case MB_ERR_INTERNAL:
1554  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1555  break;
1556  default:
1557  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1558  break;
1559  }
1560 
1561  exit(rc);
1562  }
1563  #endif
1564  FLAME_centralbank_households_quarterly_cpi_message_board_write = 0;
1565  FLAME_centralbank_households_quarterly_cpi_message_board_read = 0;
1566  /* Sending agents */
1567  if(centralbank_start_state->agents != NULL) FLAME_centralbank_households_quarterly_cpi_message_board_write = 1;
1568 
1569  /* Reading agents */
1570  if(household_start_state->agents != NULL) FLAME_centralbank_households_quarterly_cpi_message_board_read = 1;
1571 
1572  /* Call message board library with details */
1573  if(FLAME_centralbank_households_quarterly_cpi_message_board_write == 0 &&
1574  FLAME_centralbank_households_quarterly_cpi_message_board_read == 0)
1575  rc = MB_SetAccessMode(b_centralbank_households_quarterly_cpi, MB_MODE_IDLE);
1576  if(FLAME_centralbank_households_quarterly_cpi_message_board_write == 1 &&
1577  FLAME_centralbank_households_quarterly_cpi_message_board_read == 0)
1578  rc = MB_SetAccessMode(b_centralbank_households_quarterly_cpi, MB_MODE_WRITEONLY);
1579  if(FLAME_centralbank_households_quarterly_cpi_message_board_write == 0 &&
1580  FLAME_centralbank_households_quarterly_cpi_message_board_read == 1)
1581  rc = MB_SetAccessMode(b_centralbank_households_quarterly_cpi, MB_MODE_READONLY);
1582  if(FLAME_centralbank_households_quarterly_cpi_message_board_write == 1 &&
1583  FLAME_centralbank_households_quarterly_cpi_message_board_read == 1)
1584  rc = MB_SetAccessMode(b_centralbank_households_quarterly_cpi, MB_MODE_READWRITE);
1585  #ifdef ERRCHECK
1586  if (rc != MB_SUCCESS)
1587  {
1588  fprintf(stderr, "ERROR: Could not set access mode of 'centralbank_households_quarterly_cpi' board\n");
1589  switch(rc) {
1590  case MB_ERR_INVALID:
1591  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
1592  break;
1593  case MB_ERR_LOCKED:
1594  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is locked\n");
1595  break;
1596  case MB_ERR_MEMALLOC:
1597  fprintf(stderr, "\t reason: out of memory\n");
1598  break;
1599  case MB_ERR_INTERNAL:
1600  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1601  break;
1602  default:
1603  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1604  break;
1605  }
1606 
1607  exit(rc);
1608  }
1609  #endif
1610  FLAME_fired_message_board_write = 0;
1611  FLAME_fired_message_board_read = 0;
1612  /* Sending agents */
1613  if(firm_start_state->agents != NULL) FLAME_fired_message_board_write = 1;
1614 
1615  /* Reading agents */
1616  if(household_start_state->agents != NULL) FLAME_fired_message_board_read = 1;
1617 
1618  /* Call message board library with details */
1619  if(FLAME_fired_message_board_write == 0 &&
1620  FLAME_fired_message_board_read == 0)
1621  rc = MB_SetAccessMode(b_fired, MB_MODE_IDLE);
1622  if(FLAME_fired_message_board_write == 1 &&
1623  FLAME_fired_message_board_read == 0)
1624  rc = MB_SetAccessMode(b_fired, MB_MODE_WRITEONLY);
1625  if(FLAME_fired_message_board_write == 0 &&
1626  FLAME_fired_message_board_read == 1)
1627  rc = MB_SetAccessMode(b_fired, MB_MODE_READONLY);
1628  if(FLAME_fired_message_board_write == 1 &&
1629  FLAME_fired_message_board_read == 1)
1630  rc = MB_SetAccessMode(b_fired, MB_MODE_READWRITE);
1631  #ifdef ERRCHECK
1632  if (rc != MB_SUCCESS)
1633  {
1634  fprintf(stderr, "ERROR: Could not set access mode of 'fired' board\n");
1635  switch(rc) {
1636  case MB_ERR_INVALID:
1637  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
1638  break;
1639  case MB_ERR_LOCKED:
1640  fprintf(stderr, "\t reason: 'fired' board is locked\n");
1641  break;
1642  case MB_ERR_MEMALLOC:
1643  fprintf(stderr, "\t reason: out of memory\n");
1644  break;
1645  case MB_ERR_INTERNAL:
1646  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1647  break;
1648  default:
1649  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1650  break;
1651  }
1652 
1653  exit(rc);
1654  }
1655  #endif
1656  FLAME_vacancy_stage1_message_board_write = 0;
1657  FLAME_vacancy_stage1_message_board_read = 0;
1658  /* Sending agents */
1659  if(firm_start_state->agents != NULL) FLAME_vacancy_stage1_message_board_write = 1;
1660 
1661  /* Reading agents */
1662  if(jpoffice_start_state->agents != NULL) FLAME_vacancy_stage1_message_board_read = 1;
1663 
1664  /* Call message board library with details */
1665  if(FLAME_vacancy_stage1_message_board_write == 0 &&
1666  FLAME_vacancy_stage1_message_board_read == 0)
1667  rc = MB_SetAccessMode(b_vacancy_stage1, MB_MODE_IDLE);
1668  if(FLAME_vacancy_stage1_message_board_write == 1 &&
1669  FLAME_vacancy_stage1_message_board_read == 0)
1670  rc = MB_SetAccessMode(b_vacancy_stage1, MB_MODE_WRITEONLY);
1671  if(FLAME_vacancy_stage1_message_board_write == 0 &&
1672  FLAME_vacancy_stage1_message_board_read == 1)
1673  rc = MB_SetAccessMode(b_vacancy_stage1, MB_MODE_READONLY);
1674  if(FLAME_vacancy_stage1_message_board_write == 1 &&
1675  FLAME_vacancy_stage1_message_board_read == 1)
1676  rc = MB_SetAccessMode(b_vacancy_stage1, MB_MODE_READWRITE);
1677  #ifdef ERRCHECK
1678  if (rc != MB_SUCCESS)
1679  {
1680  fprintf(stderr, "ERROR: Could not set access mode of 'vacancy_stage1' board\n");
1681  switch(rc) {
1682  case MB_ERR_INVALID:
1683  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
1684  break;
1685  case MB_ERR_LOCKED:
1686  fprintf(stderr, "\t reason: 'vacancy_stage1' board is locked\n");
1687  break;
1688  case MB_ERR_MEMALLOC:
1689  fprintf(stderr, "\t reason: out of memory\n");
1690  break;
1691  case MB_ERR_INTERNAL:
1692  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1693  break;
1694  default:
1695  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1696  break;
1697  }
1698 
1699  exit(rc);
1700  }
1701  #endif
1702  FLAME_job_application_stage2_message_board_write = 0;
1703  FLAME_job_application_stage2_message_board_read = 0;
1704  /* Sending agents */
1705  if(household_start_state->agents != NULL) FLAME_job_application_stage2_message_board_write = 1;
1706 
1707  /* Reading agents */
1708  if(jpoffice_start_state->agents != NULL) FLAME_job_application_stage2_message_board_read = 1;
1709 
1710  /* Call message board library with details */
1711  if(FLAME_job_application_stage2_message_board_write == 0 &&
1712  FLAME_job_application_stage2_message_board_read == 0)
1713  rc = MB_SetAccessMode(b_job_application_stage2, MB_MODE_IDLE);
1714  if(FLAME_job_application_stage2_message_board_write == 1 &&
1715  FLAME_job_application_stage2_message_board_read == 0)
1716  rc = MB_SetAccessMode(b_job_application_stage2, MB_MODE_WRITEONLY);
1717  if(FLAME_job_application_stage2_message_board_write == 0 &&
1718  FLAME_job_application_stage2_message_board_read == 1)
1719  rc = MB_SetAccessMode(b_job_application_stage2, MB_MODE_READONLY);
1720  if(FLAME_job_application_stage2_message_board_write == 1 &&
1721  FLAME_job_application_stage2_message_board_read == 1)
1722  rc = MB_SetAccessMode(b_job_application_stage2, MB_MODE_READWRITE);
1723  #ifdef ERRCHECK
1724  if (rc != MB_SUCCESS)
1725  {
1726  fprintf(stderr, "ERROR: Could not set access mode of 'job_application_stage2' board\n");
1727  switch(rc) {
1728  case MB_ERR_INVALID:
1729  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
1730  break;
1731  case MB_ERR_LOCKED:
1732  fprintf(stderr, "\t reason: 'job_application_stage2' board is locked\n");
1733  break;
1734  case MB_ERR_MEMALLOC:
1735  fprintf(stderr, "\t reason: out of memory\n");
1736  break;
1737  case MB_ERR_INTERNAL:
1738  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1739  break;
1740  default:
1741  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1742  break;
1743  }
1744 
1745  exit(rc);
1746  }
1747  #endif
1748  FLAME_job_application_stage1_message_board_write = 0;
1749  FLAME_job_application_stage1_message_board_read = 0;
1750  /* Sending agents */
1751  if(household_start_state->agents != NULL) FLAME_job_application_stage1_message_board_write = 1;
1752 
1753  /* Reading agents */
1754  if(jpoffice_start_state->agents != NULL) FLAME_job_application_stage1_message_board_read = 1;
1755 
1756  /* Call message board library with details */
1757  if(FLAME_job_application_stage1_message_board_write == 0 &&
1758  FLAME_job_application_stage1_message_board_read == 0)
1759  rc = MB_SetAccessMode(b_job_application_stage1, MB_MODE_IDLE);
1760  if(FLAME_job_application_stage1_message_board_write == 1 &&
1761  FLAME_job_application_stage1_message_board_read == 0)
1762  rc = MB_SetAccessMode(b_job_application_stage1, MB_MODE_WRITEONLY);
1763  if(FLAME_job_application_stage1_message_board_write == 0 &&
1764  FLAME_job_application_stage1_message_board_read == 1)
1765  rc = MB_SetAccessMode(b_job_application_stage1, MB_MODE_READONLY);
1766  if(FLAME_job_application_stage1_message_board_write == 1 &&
1767  FLAME_job_application_stage1_message_board_read == 1)
1768  rc = MB_SetAccessMode(b_job_application_stage1, MB_MODE_READWRITE);
1769  #ifdef ERRCHECK
1770  if (rc != MB_SUCCESS)
1771  {
1772  fprintf(stderr, "ERROR: Could not set access mode of 'job_application_stage1' board\n");
1773  switch(rc) {
1774  case MB_ERR_INVALID:
1775  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
1776  break;
1777  case MB_ERR_LOCKED:
1778  fprintf(stderr, "\t reason: 'job_application_stage1' board is locked\n");
1779  break;
1780  case MB_ERR_MEMALLOC:
1781  fprintf(stderr, "\t reason: out of memory\n");
1782  break;
1783  case MB_ERR_INTERNAL:
1784  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1785  break;
1786  default:
1787  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1788  break;
1789  }
1790 
1791  exit(rc);
1792  }
1793  #endif
1794  FLAME_job_match_stage1_message_board_write = 0;
1795  FLAME_job_match_stage1_message_board_read = 0;
1796  /* Sending agents */
1797  if(jpoffice_start_state->agents != NULL) FLAME_job_match_stage1_message_board_write = 1;
1798 
1799  /* Reading agents */
1800  if(firm_start_state->agents != NULL) FLAME_job_match_stage1_message_board_read = 1;
1801  if(household_start_state->agents != NULL) FLAME_job_match_stage1_message_board_read = 1;
1802 
1803  /* Call message board library with details */
1804  if(FLAME_job_match_stage1_message_board_write == 0 &&
1805  FLAME_job_match_stage1_message_board_read == 0)
1806  rc = MB_SetAccessMode(b_job_match_stage1, MB_MODE_IDLE);
1807  if(FLAME_job_match_stage1_message_board_write == 1 &&
1808  FLAME_job_match_stage1_message_board_read == 0)
1809  rc = MB_SetAccessMode(b_job_match_stage1, MB_MODE_WRITEONLY);
1810  if(FLAME_job_match_stage1_message_board_write == 0 &&
1811  FLAME_job_match_stage1_message_board_read == 1)
1812  rc = MB_SetAccessMode(b_job_match_stage1, MB_MODE_READONLY);
1813  if(FLAME_job_match_stage1_message_board_write == 1 &&
1814  FLAME_job_match_stage1_message_board_read == 1)
1815  rc = MB_SetAccessMode(b_job_match_stage1, MB_MODE_READWRITE);
1816  #ifdef ERRCHECK
1817  if (rc != MB_SUCCESS)
1818  {
1819  fprintf(stderr, "ERROR: Could not set access mode of 'job_match_stage1' board\n");
1820  switch(rc) {
1821  case MB_ERR_INVALID:
1822  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
1823  break;
1824  case MB_ERR_LOCKED:
1825  fprintf(stderr, "\t reason: 'job_match_stage1' board is locked\n");
1826  break;
1827  case MB_ERR_MEMALLOC:
1828  fprintf(stderr, "\t reason: out of memory\n");
1829  break;
1830  case MB_ERR_INTERNAL:
1831  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1832  break;
1833  default:
1834  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1835  break;
1836  }
1837 
1838  exit(rc);
1839  }
1840  #endif
1841  FLAME_job_change_message_board_write = 0;
1842  FLAME_job_change_message_board_read = 0;
1843  /* Sending agents */
1844  if(household_start_state->agents != NULL) FLAME_job_change_message_board_write = 1;
1845 
1846  /* Reading agents */
1847  if(firm_start_state->agents != NULL) FLAME_job_change_message_board_read = 1;
1848 
1849  /* Call message board library with details */
1850  if(FLAME_job_change_message_board_write == 0 &&
1851  FLAME_job_change_message_board_read == 0)
1852  rc = MB_SetAccessMode(b_job_change, MB_MODE_IDLE);
1853  if(FLAME_job_change_message_board_write == 1 &&
1854  FLAME_job_change_message_board_read == 0)
1855  rc = MB_SetAccessMode(b_job_change, MB_MODE_WRITEONLY);
1856  if(FLAME_job_change_message_board_write == 0 &&
1857  FLAME_job_change_message_board_read == 1)
1858  rc = MB_SetAccessMode(b_job_change, MB_MODE_READONLY);
1859  if(FLAME_job_change_message_board_write == 1 &&
1860  FLAME_job_change_message_board_read == 1)
1861  rc = MB_SetAccessMode(b_job_change, MB_MODE_READWRITE);
1862  #ifdef ERRCHECK
1863  if (rc != MB_SUCCESS)
1864  {
1865  fprintf(stderr, "ERROR: Could not set access mode of 'job_change' board\n");
1866  switch(rc) {
1867  case MB_ERR_INVALID:
1868  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
1869  break;
1870  case MB_ERR_LOCKED:
1871  fprintf(stderr, "\t reason: 'job_change' board is locked\n");
1872  break;
1873  case MB_ERR_MEMALLOC:
1874  fprintf(stderr, "\t reason: out of memory\n");
1875  break;
1876  case MB_ERR_INTERNAL:
1877  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1878  break;
1879  default:
1880  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1881  break;
1882  }
1883 
1884  exit(rc);
1885  }
1886  #endif
1887  FLAME_vacancy_stage2_message_board_write = 0;
1888  FLAME_vacancy_stage2_message_board_read = 0;
1889  /* Sending agents */
1890  if(firm_start_state->agents != NULL) FLAME_vacancy_stage2_message_board_write = 1;
1891 
1892  /* Reading agents */
1893  if(jpoffice_start_state->agents != NULL) FLAME_vacancy_stage2_message_board_read = 1;
1894 
1895  /* Call message board library with details */
1896  if(FLAME_vacancy_stage2_message_board_write == 0 &&
1897  FLAME_vacancy_stage2_message_board_read == 0)
1898  rc = MB_SetAccessMode(b_vacancy_stage2, MB_MODE_IDLE);
1899  if(FLAME_vacancy_stage2_message_board_write == 1 &&
1900  FLAME_vacancy_stage2_message_board_read == 0)
1901  rc = MB_SetAccessMode(b_vacancy_stage2, MB_MODE_WRITEONLY);
1902  if(FLAME_vacancy_stage2_message_board_write == 0 &&
1903  FLAME_vacancy_stage2_message_board_read == 1)
1904  rc = MB_SetAccessMode(b_vacancy_stage2, MB_MODE_READONLY);
1905  if(FLAME_vacancy_stage2_message_board_write == 1 &&
1906  FLAME_vacancy_stage2_message_board_read == 1)
1907  rc = MB_SetAccessMode(b_vacancy_stage2, MB_MODE_READWRITE);
1908  #ifdef ERRCHECK
1909  if (rc != MB_SUCCESS)
1910  {
1911  fprintf(stderr, "ERROR: Could not set access mode of 'vacancy_stage2' board\n");
1912  switch(rc) {
1913  case MB_ERR_INVALID:
1914  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
1915  break;
1916  case MB_ERR_LOCKED:
1917  fprintf(stderr, "\t reason: 'vacancy_stage2' board is locked\n");
1918  break;
1919  case MB_ERR_MEMALLOC:
1920  fprintf(stderr, "\t reason: out of memory\n");
1921  break;
1922  case MB_ERR_INTERNAL:
1923  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1924  break;
1925  default:
1926  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1927  break;
1928  }
1929 
1930  exit(rc);
1931  }
1932  #endif
1933  FLAME_job_match_stage2_message_board_write = 0;
1934  FLAME_job_match_stage2_message_board_read = 0;
1935  /* Sending agents */
1936  if(jpoffice_start_state->agents != NULL) FLAME_job_match_stage2_message_board_write = 1;
1937 
1938  /* Reading agents */
1939  if(firm_start_state->agents != NULL) FLAME_job_match_stage2_message_board_read = 1;
1940  if(household_start_state->agents != NULL) FLAME_job_match_stage2_message_board_read = 1;
1941 
1942  /* Call message board library with details */
1943  if(FLAME_job_match_stage2_message_board_write == 0 &&
1944  FLAME_job_match_stage2_message_board_read == 0)
1945  rc = MB_SetAccessMode(b_job_match_stage2, MB_MODE_IDLE);
1946  if(FLAME_job_match_stage2_message_board_write == 1 &&
1947  FLAME_job_match_stage2_message_board_read == 0)
1948  rc = MB_SetAccessMode(b_job_match_stage2, MB_MODE_WRITEONLY);
1949  if(FLAME_job_match_stage2_message_board_write == 0 &&
1950  FLAME_job_match_stage2_message_board_read == 1)
1951  rc = MB_SetAccessMode(b_job_match_stage2, MB_MODE_READONLY);
1952  if(FLAME_job_match_stage2_message_board_write == 1 &&
1953  FLAME_job_match_stage2_message_board_read == 1)
1954  rc = MB_SetAccessMode(b_job_match_stage2, MB_MODE_READWRITE);
1955  #ifdef ERRCHECK
1956  if (rc != MB_SUCCESS)
1957  {
1958  fprintf(stderr, "ERROR: Could not set access mode of 'job_match_stage2' board\n");
1959  switch(rc) {
1960  case MB_ERR_INVALID:
1961  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
1962  break;
1963  case MB_ERR_LOCKED:
1964  fprintf(stderr, "\t reason: 'job_match_stage2' board is locked\n");
1965  break;
1966  case MB_ERR_MEMALLOC:
1967  fprintf(stderr, "\t reason: out of memory\n");
1968  break;
1969  case MB_ERR_INTERNAL:
1970  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
1971  break;
1972  default:
1973  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
1974  break;
1975  }
1976 
1977  exit(rc);
1978  }
1979  #endif
1980  FLAME_employment_status_message_board_write = 0;
1981  FLAME_employment_status_message_board_read = 0;
1982  /* Sending agents */
1983  if(household_start_state->agents != NULL) FLAME_employment_status_message_board_write = 1;
1984 
1985  /* Reading agents */
1986  if(firm_start_state->agents != NULL) FLAME_employment_status_message_board_read = 1;
1987  if(equityfund_start_state->agents != NULL) FLAME_employment_status_message_board_read = 1;
1988  if(government_start_state->agents != NULL) FLAME_employment_status_message_board_read = 1;
1989  if(centralbank_start_state->agents != NULL) FLAME_employment_status_message_board_read = 1;
1990 
1991  /* Call message board library with details */
1992  if(FLAME_employment_status_message_board_write == 0 &&
1993  FLAME_employment_status_message_board_read == 0)
1994  rc = MB_SetAccessMode(b_employment_status, MB_MODE_IDLE);
1995  if(FLAME_employment_status_message_board_write == 1 &&
1996  FLAME_employment_status_message_board_read == 0)
1997  rc = MB_SetAccessMode(b_employment_status, MB_MODE_WRITEONLY);
1998  if(FLAME_employment_status_message_board_write == 0 &&
1999  FLAME_employment_status_message_board_read == 1)
2000  rc = MB_SetAccessMode(b_employment_status, MB_MODE_READONLY);
2001  if(FLAME_employment_status_message_board_write == 1 &&
2002  FLAME_employment_status_message_board_read == 1)
2003  rc = MB_SetAccessMode(b_employment_status, MB_MODE_READWRITE);
2004  #ifdef ERRCHECK
2005  if (rc != MB_SUCCESS)
2006  {
2007  fprintf(stderr, "ERROR: Could not set access mode of 'employment_status' board\n");
2008  switch(rc) {
2009  case MB_ERR_INVALID:
2010  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
2011  break;
2012  case MB_ERR_LOCKED:
2013  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
2014  break;
2015  case MB_ERR_MEMALLOC:
2016  fprintf(stderr, "\t reason: out of memory\n");
2017  break;
2018  case MB_ERR_INTERNAL:
2019  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2020  break;
2021  default:
2022  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2023  break;
2024  }
2025 
2026  exit(rc);
2027  }
2028  #endif
2029  FLAME_firm_household_wage_payment_message_board_write = 0;
2030  FLAME_firm_household_wage_payment_message_board_read = 0;
2031  /* Sending agents */
2032  if(firm_start_state->agents != NULL) FLAME_firm_household_wage_payment_message_board_write = 1;
2033 
2034  /* Reading agents */
2035  if(household_start_state->agents != NULL) FLAME_firm_household_wage_payment_message_board_read = 1;
2036 
2037  /* Call message board library with details */
2038  if(FLAME_firm_household_wage_payment_message_board_write == 0 &&
2039  FLAME_firm_household_wage_payment_message_board_read == 0)
2040  rc = MB_SetAccessMode(b_firm_household_wage_payment, MB_MODE_IDLE);
2041  if(FLAME_firm_household_wage_payment_message_board_write == 1 &&
2042  FLAME_firm_household_wage_payment_message_board_read == 0)
2043  rc = MB_SetAccessMode(b_firm_household_wage_payment, MB_MODE_WRITEONLY);
2044  if(FLAME_firm_household_wage_payment_message_board_write == 0 &&
2045  FLAME_firm_household_wage_payment_message_board_read == 1)
2046  rc = MB_SetAccessMode(b_firm_household_wage_payment, MB_MODE_READONLY);
2047  if(FLAME_firm_household_wage_payment_message_board_write == 1 &&
2048  FLAME_firm_household_wage_payment_message_board_read == 1)
2049  rc = MB_SetAccessMode(b_firm_household_wage_payment, MB_MODE_READWRITE);
2050  #ifdef ERRCHECK
2051  if (rc != MB_SUCCESS)
2052  {
2053  fprintf(stderr, "ERROR: Could not set access mode of 'firm_household_wage_payment' board\n");
2054  switch(rc) {
2055  case MB_ERR_INVALID:
2056  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
2057  break;
2058  case MB_ERR_LOCKED:
2059  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is locked\n");
2060  break;
2061  case MB_ERR_MEMALLOC:
2062  fprintf(stderr, "\t reason: out of memory\n");
2063  break;
2064  case MB_ERR_INTERNAL:
2065  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2066  break;
2067  default:
2068  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2069  break;
2070  }
2071 
2072  exit(rc);
2073  }
2074  #endif
2075  FLAME_firm_bank_loan_request_1_message_board_write = 0;
2076  FLAME_firm_bank_loan_request_1_message_board_read = 0;
2077  /* Sending agents */
2078  if(firm_start_state->agents != NULL) FLAME_firm_bank_loan_request_1_message_board_write = 1;
2079 
2080  /* Reading agents */
2081  if(bank_start_state->agents != NULL) FLAME_firm_bank_loan_request_1_message_board_read = 1;
2082 
2083  /* Call message board library with details */
2084  if(FLAME_firm_bank_loan_request_1_message_board_write == 0 &&
2085  FLAME_firm_bank_loan_request_1_message_board_read == 0)
2086  rc = MB_SetAccessMode(b_firm_bank_loan_request_1, MB_MODE_IDLE);
2087  if(FLAME_firm_bank_loan_request_1_message_board_write == 1 &&
2088  FLAME_firm_bank_loan_request_1_message_board_read == 0)
2089  rc = MB_SetAccessMode(b_firm_bank_loan_request_1, MB_MODE_WRITEONLY);
2090  if(FLAME_firm_bank_loan_request_1_message_board_write == 0 &&
2091  FLAME_firm_bank_loan_request_1_message_board_read == 1)
2092  rc = MB_SetAccessMode(b_firm_bank_loan_request_1, MB_MODE_READONLY);
2093  if(FLAME_firm_bank_loan_request_1_message_board_write == 1 &&
2094  FLAME_firm_bank_loan_request_1_message_board_read == 1)
2095  rc = MB_SetAccessMode(b_firm_bank_loan_request_1, MB_MODE_READWRITE);
2096  #ifdef ERRCHECK
2097  if (rc != MB_SUCCESS)
2098  {
2099  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_loan_request_1' board\n");
2100  switch(rc) {
2101  case MB_ERR_INVALID:
2102  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
2103  break;
2104  case MB_ERR_LOCKED:
2105  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is locked\n");
2106  break;
2107  case MB_ERR_MEMALLOC:
2108  fprintf(stderr, "\t reason: out of memory\n");
2109  break;
2110  case MB_ERR_INTERNAL:
2111  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2112  break;
2113  default:
2114  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2115  break;
2116  }
2117 
2118  exit(rc);
2119  }
2120  #endif
2121  FLAME_firm_bank_loan_request_2_message_board_write = 0;
2122  FLAME_firm_bank_loan_request_2_message_board_read = 0;
2123  /* Sending agents */
2124  if(firm_start_state->agents != NULL) FLAME_firm_bank_loan_request_2_message_board_write = 1;
2125 
2126  /* Reading agents */
2127  if(bank_start_state->agents != NULL) FLAME_firm_bank_loan_request_2_message_board_read = 1;
2128 
2129  /* Call message board library with details */
2130  if(FLAME_firm_bank_loan_request_2_message_board_write == 0 &&
2131  FLAME_firm_bank_loan_request_2_message_board_read == 0)
2132  rc = MB_SetAccessMode(b_firm_bank_loan_request_2, MB_MODE_IDLE);
2133  if(FLAME_firm_bank_loan_request_2_message_board_write == 1 &&
2134  FLAME_firm_bank_loan_request_2_message_board_read == 0)
2135  rc = MB_SetAccessMode(b_firm_bank_loan_request_2, MB_MODE_WRITEONLY);
2136  if(FLAME_firm_bank_loan_request_2_message_board_write == 0 &&
2137  FLAME_firm_bank_loan_request_2_message_board_read == 1)
2138  rc = MB_SetAccessMode(b_firm_bank_loan_request_2, MB_MODE_READONLY);
2139  if(FLAME_firm_bank_loan_request_2_message_board_write == 1 &&
2140  FLAME_firm_bank_loan_request_2_message_board_read == 1)
2141  rc = MB_SetAccessMode(b_firm_bank_loan_request_2, MB_MODE_READWRITE);
2142  #ifdef ERRCHECK
2143  if (rc != MB_SUCCESS)
2144  {
2145  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_loan_request_2' board\n");
2146  switch(rc) {
2147  case MB_ERR_INVALID:
2148  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
2149  break;
2150  case MB_ERR_LOCKED:
2151  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is locked\n");
2152  break;
2153  case MB_ERR_MEMALLOC:
2154  fprintf(stderr, "\t reason: out of memory\n");
2155  break;
2156  case MB_ERR_INTERNAL:
2157  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2158  break;
2159  default:
2160  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2161  break;
2162  }
2163 
2164  exit(rc);
2165  }
2166  #endif
2167  FLAME_bank_firm_loan_acknowledge_1_message_board_write = 0;
2168  FLAME_bank_firm_loan_acknowledge_1_message_board_read = 0;
2169  /* Sending agents */
2170  if(bank_start_state->agents != NULL) FLAME_bank_firm_loan_acknowledge_1_message_board_write = 1;
2171 
2172  /* Reading agents */
2173  if(firm_start_state->agents != NULL) FLAME_bank_firm_loan_acknowledge_1_message_board_read = 1;
2174 
2175  /* Call message board library with details */
2176  if(FLAME_bank_firm_loan_acknowledge_1_message_board_write == 0 &&
2177  FLAME_bank_firm_loan_acknowledge_1_message_board_read == 0)
2178  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_1, MB_MODE_IDLE);
2179  if(FLAME_bank_firm_loan_acknowledge_1_message_board_write == 1 &&
2180  FLAME_bank_firm_loan_acknowledge_1_message_board_read == 0)
2181  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_1, MB_MODE_WRITEONLY);
2182  if(FLAME_bank_firm_loan_acknowledge_1_message_board_write == 0 &&
2183  FLAME_bank_firm_loan_acknowledge_1_message_board_read == 1)
2184  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_1, MB_MODE_READONLY);
2185  if(FLAME_bank_firm_loan_acknowledge_1_message_board_write == 1 &&
2186  FLAME_bank_firm_loan_acknowledge_1_message_board_read == 1)
2187  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_1, MB_MODE_READWRITE);
2188  #ifdef ERRCHECK
2189  if (rc != MB_SUCCESS)
2190  {
2191  fprintf(stderr, "ERROR: Could not set access mode of 'bank_firm_loan_acknowledge_1' board\n");
2192  switch(rc) {
2193  case MB_ERR_INVALID:
2194  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
2195  break;
2196  case MB_ERR_LOCKED:
2197  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is locked\n");
2198  break;
2199  case MB_ERR_MEMALLOC:
2200  fprintf(stderr, "\t reason: out of memory\n");
2201  break;
2202  case MB_ERR_INTERNAL:
2203  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2204  break;
2205  default:
2206  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2207  break;
2208  }
2209 
2210  exit(rc);
2211  }
2212  #endif
2213  FLAME_bank_firm_loan_acknowledge_2_message_board_write = 0;
2214  FLAME_bank_firm_loan_acknowledge_2_message_board_read = 0;
2215  /* Sending agents */
2216  if(bank_start_state->agents != NULL) FLAME_bank_firm_loan_acknowledge_2_message_board_write = 1;
2217 
2218  /* Reading agents */
2219  if(firm_start_state->agents != NULL) FLAME_bank_firm_loan_acknowledge_2_message_board_read = 1;
2220 
2221  /* Call message board library with details */
2222  if(FLAME_bank_firm_loan_acknowledge_2_message_board_write == 0 &&
2223  FLAME_bank_firm_loan_acknowledge_2_message_board_read == 0)
2224  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_2, MB_MODE_IDLE);
2225  if(FLAME_bank_firm_loan_acknowledge_2_message_board_write == 1 &&
2226  FLAME_bank_firm_loan_acknowledge_2_message_board_read == 0)
2227  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_2, MB_MODE_WRITEONLY);
2228  if(FLAME_bank_firm_loan_acknowledge_2_message_board_write == 0 &&
2229  FLAME_bank_firm_loan_acknowledge_2_message_board_read == 1)
2230  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_2, MB_MODE_READONLY);
2231  if(FLAME_bank_firm_loan_acknowledge_2_message_board_write == 1 &&
2232  FLAME_bank_firm_loan_acknowledge_2_message_board_read == 1)
2233  rc = MB_SetAccessMode(b_bank_firm_loan_acknowledge_2, MB_MODE_READWRITE);
2234  #ifdef ERRCHECK
2235  if (rc != MB_SUCCESS)
2236  {
2237  fprintf(stderr, "ERROR: Could not set access mode of 'bank_firm_loan_acknowledge_2' board\n");
2238  switch(rc) {
2239  case MB_ERR_INVALID:
2240  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
2241  break;
2242  case MB_ERR_LOCKED:
2243  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is locked\n");
2244  break;
2245  case MB_ERR_MEMALLOC:
2246  fprintf(stderr, "\t reason: out of memory\n");
2247  break;
2248  case MB_ERR_INTERNAL:
2249  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2250  break;
2251  default:
2252  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2253  break;
2254  }
2255 
2256  exit(rc);
2257  }
2258  #endif
2259  FLAME_bank_centralbank_debt_request_message_board_write = 0;
2260  FLAME_bank_centralbank_debt_request_message_board_read = 0;
2261  /* Sending agents */
2262  if(bank_start_state->agents != NULL) FLAME_bank_centralbank_debt_request_message_board_write = 1;
2263 
2264  /* Reading agents */
2265  if(centralbank_start_state->agents != NULL) FLAME_bank_centralbank_debt_request_message_board_read = 1;
2266 
2267  /* Call message board library with details */
2268  if(FLAME_bank_centralbank_debt_request_message_board_write == 0 &&
2269  FLAME_bank_centralbank_debt_request_message_board_read == 0)
2270  rc = MB_SetAccessMode(b_bank_centralbank_debt_request, MB_MODE_IDLE);
2271  if(FLAME_bank_centralbank_debt_request_message_board_write == 1 &&
2272  FLAME_bank_centralbank_debt_request_message_board_read == 0)
2273  rc = MB_SetAccessMode(b_bank_centralbank_debt_request, MB_MODE_WRITEONLY);
2274  if(FLAME_bank_centralbank_debt_request_message_board_write == 0 &&
2275  FLAME_bank_centralbank_debt_request_message_board_read == 1)
2276  rc = MB_SetAccessMode(b_bank_centralbank_debt_request, MB_MODE_READONLY);
2277  if(FLAME_bank_centralbank_debt_request_message_board_write == 1 &&
2278  FLAME_bank_centralbank_debt_request_message_board_read == 1)
2279  rc = MB_SetAccessMode(b_bank_centralbank_debt_request, MB_MODE_READWRITE);
2280  #ifdef ERRCHECK
2281  if (rc != MB_SUCCESS)
2282  {
2283  fprintf(stderr, "ERROR: Could not set access mode of 'bank_centralbank_debt_request' board\n");
2284  switch(rc) {
2285  case MB_ERR_INVALID:
2286  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
2287  break;
2288  case MB_ERR_LOCKED:
2289  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is locked\n");
2290  break;
2291  case MB_ERR_MEMALLOC:
2292  fprintf(stderr, "\t reason: out of memory\n");
2293  break;
2294  case MB_ERR_INTERNAL:
2295  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2296  break;
2297  default:
2298  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2299  break;
2300  }
2301 
2302  exit(rc);
2303  }
2304  #endif
2305  FLAME_household_share_message_board_write = 0;
2306  FLAME_household_share_message_board_read = 0;
2307  /* Sending agents */
2308  if(equityfund_start_state->agents != NULL) FLAME_household_share_message_board_write = 1;
2309 
2310  /* Reading agents */
2311  if(household_start_state->agents != NULL) FLAME_household_share_message_board_read = 1;
2312 
2313  /* Call message board library with details */
2314  if(FLAME_household_share_message_board_write == 0 &&
2315  FLAME_household_share_message_board_read == 0)
2316  rc = MB_SetAccessMode(b_household_share, MB_MODE_IDLE);
2317  if(FLAME_household_share_message_board_write == 1 &&
2318  FLAME_household_share_message_board_read == 0)
2319  rc = MB_SetAccessMode(b_household_share, MB_MODE_WRITEONLY);
2320  if(FLAME_household_share_message_board_write == 0 &&
2321  FLAME_household_share_message_board_read == 1)
2322  rc = MB_SetAccessMode(b_household_share, MB_MODE_READONLY);
2323  if(FLAME_household_share_message_board_write == 1 &&
2324  FLAME_household_share_message_board_read == 1)
2325  rc = MB_SetAccessMode(b_household_share, MB_MODE_READWRITE);
2326  #ifdef ERRCHECK
2327  if (rc != MB_SUCCESS)
2328  {
2329  fprintf(stderr, "ERROR: Could not set access mode of 'household_share' board\n");
2330  switch(rc) {
2331  case MB_ERR_INVALID:
2332  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
2333  break;
2334  case MB_ERR_LOCKED:
2335  fprintf(stderr, "\t reason: 'household_share' board is locked\n");
2336  break;
2337  case MB_ERR_MEMALLOC:
2338  fprintf(stderr, "\t reason: out of memory\n");
2339  break;
2340  case MB_ERR_INTERNAL:
2341  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2342  break;
2343  default:
2344  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2345  break;
2346  }
2347 
2348  exit(rc);
2349  }
2350  #endif
2351  FLAME_capital_tax_message_board_write = 0;
2352  FLAME_capital_tax_message_board_read = 0;
2353  /* Sending agents */
2354  if(equityfund_start_state->agents != NULL) FLAME_capital_tax_message_board_write = 1;
2355 
2356  /* Reading agents */
2357  if(government_start_state->agents != NULL) FLAME_capital_tax_message_board_read = 1;
2358 
2359  /* Call message board library with details */
2360  if(FLAME_capital_tax_message_board_write == 0 &&
2361  FLAME_capital_tax_message_board_read == 0)
2362  rc = MB_SetAccessMode(b_capital_tax, MB_MODE_IDLE);
2363  if(FLAME_capital_tax_message_board_write == 1 &&
2364  FLAME_capital_tax_message_board_read == 0)
2365  rc = MB_SetAccessMode(b_capital_tax, MB_MODE_WRITEONLY);
2366  if(FLAME_capital_tax_message_board_write == 0 &&
2367  FLAME_capital_tax_message_board_read == 1)
2368  rc = MB_SetAccessMode(b_capital_tax, MB_MODE_READONLY);
2369  if(FLAME_capital_tax_message_board_write == 1 &&
2370  FLAME_capital_tax_message_board_read == 1)
2371  rc = MB_SetAccessMode(b_capital_tax, MB_MODE_READWRITE);
2372  #ifdef ERRCHECK
2373  if (rc != MB_SUCCESS)
2374  {
2375  fprintf(stderr, "ERROR: Could not set access mode of 'capital_tax' board\n");
2376  switch(rc) {
2377  case MB_ERR_INVALID:
2378  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
2379  break;
2380  case MB_ERR_LOCKED:
2381  fprintf(stderr, "\t reason: 'capital_tax' board is locked\n");
2382  break;
2383  case MB_ERR_MEMALLOC:
2384  fprintf(stderr, "\t reason: out of memory\n");
2385  break;
2386  case MB_ERR_INTERNAL:
2387  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2388  break;
2389  default:
2390  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2391  break;
2392  }
2393 
2394  exit(rc);
2395  }
2396  #endif
2397  FLAME_labour_tax_message_board_write = 0;
2398  FLAME_labour_tax_message_board_read = 0;
2399  /* Sending agents */
2400  if(firm_start_state->agents != NULL) FLAME_labour_tax_message_board_write = 1;
2401 
2402  /* Reading agents */
2403  if(government_start_state->agents != NULL) FLAME_labour_tax_message_board_read = 1;
2404 
2405  /* Call message board library with details */
2406  if(FLAME_labour_tax_message_board_write == 0 &&
2407  FLAME_labour_tax_message_board_read == 0)
2408  rc = MB_SetAccessMode(b_labour_tax, MB_MODE_IDLE);
2409  if(FLAME_labour_tax_message_board_write == 1 &&
2410  FLAME_labour_tax_message_board_read == 0)
2411  rc = MB_SetAccessMode(b_labour_tax, MB_MODE_WRITEONLY);
2412  if(FLAME_labour_tax_message_board_write == 0 &&
2413  FLAME_labour_tax_message_board_read == 1)
2414  rc = MB_SetAccessMode(b_labour_tax, MB_MODE_READONLY);
2415  if(FLAME_labour_tax_message_board_write == 1 &&
2416  FLAME_labour_tax_message_board_read == 1)
2417  rc = MB_SetAccessMode(b_labour_tax, MB_MODE_READWRITE);
2418  #ifdef ERRCHECK
2419  if (rc != MB_SUCCESS)
2420  {
2421  fprintf(stderr, "ERROR: Could not set access mode of 'labour_tax' board\n");
2422  switch(rc) {
2423  case MB_ERR_INVALID:
2424  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
2425  break;
2426  case MB_ERR_LOCKED:
2427  fprintf(stderr, "\t reason: 'labour_tax' board is locked\n");
2428  break;
2429  case MB_ERR_MEMALLOC:
2430  fprintf(stderr, "\t reason: out of memory\n");
2431  break;
2432  case MB_ERR_INTERNAL:
2433  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2434  break;
2435  default:
2436  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2437  break;
2438  }
2439 
2440  exit(rc);
2441  }
2442  #endif
2443  FLAME_unemployment_benefit_message_board_write = 0;
2444  FLAME_unemployment_benefit_message_board_read = 0;
2445  /* Sending agents */
2446  if(government_start_state->agents != NULL) FLAME_unemployment_benefit_message_board_write = 1;
2447 
2448  /* Reading agents */
2449  if(household_start_state->agents != NULL) FLAME_unemployment_benefit_message_board_read = 1;
2450 
2451  /* Call message board library with details */
2452  if(FLAME_unemployment_benefit_message_board_write == 0 &&
2453  FLAME_unemployment_benefit_message_board_read == 0)
2454  rc = MB_SetAccessMode(b_unemployment_benefit, MB_MODE_IDLE);
2455  if(FLAME_unemployment_benefit_message_board_write == 1 &&
2456  FLAME_unemployment_benefit_message_board_read == 0)
2457  rc = MB_SetAccessMode(b_unemployment_benefit, MB_MODE_WRITEONLY);
2458  if(FLAME_unemployment_benefit_message_board_write == 0 &&
2459  FLAME_unemployment_benefit_message_board_read == 1)
2460  rc = MB_SetAccessMode(b_unemployment_benefit, MB_MODE_READONLY);
2461  if(FLAME_unemployment_benefit_message_board_write == 1 &&
2462  FLAME_unemployment_benefit_message_board_read == 1)
2463  rc = MB_SetAccessMode(b_unemployment_benefit, MB_MODE_READWRITE);
2464  #ifdef ERRCHECK
2465  if (rc != MB_SUCCESS)
2466  {
2467  fprintf(stderr, "ERROR: Could not set access mode of 'unemployment_benefit' board\n");
2468  switch(rc) {
2469  case MB_ERR_INVALID:
2470  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
2471  break;
2472  case MB_ERR_LOCKED:
2473  fprintf(stderr, "\t reason: 'unemployment_benefit' board is locked\n");
2474  break;
2475  case MB_ERR_MEMALLOC:
2476  fprintf(stderr, "\t reason: out of memory\n");
2477  break;
2478  case MB_ERR_INTERNAL:
2479  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2480  break;
2481  default:
2482  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2483  break;
2484  }
2485 
2486  exit(rc);
2487  }
2488  #endif
2489  FLAME_general_benefit_message_board_write = 0;
2490  FLAME_general_benefit_message_board_read = 0;
2491  /* Sending agents */
2492  if(government_start_state->agents != NULL) FLAME_general_benefit_message_board_write = 1;
2493 
2494  /* Reading agents */
2495  if(household_start_state->agents != NULL) FLAME_general_benefit_message_board_read = 1;
2496 
2497  /* Call message board library with details */
2498  if(FLAME_general_benefit_message_board_write == 0 &&
2499  FLAME_general_benefit_message_board_read == 0)
2500  rc = MB_SetAccessMode(b_general_benefit, MB_MODE_IDLE);
2501  if(FLAME_general_benefit_message_board_write == 1 &&
2502  FLAME_general_benefit_message_board_read == 0)
2503  rc = MB_SetAccessMode(b_general_benefit, MB_MODE_WRITEONLY);
2504  if(FLAME_general_benefit_message_board_write == 0 &&
2505  FLAME_general_benefit_message_board_read == 1)
2506  rc = MB_SetAccessMode(b_general_benefit, MB_MODE_READONLY);
2507  if(FLAME_general_benefit_message_board_write == 1 &&
2508  FLAME_general_benefit_message_board_read == 1)
2509  rc = MB_SetAccessMode(b_general_benefit, MB_MODE_READWRITE);
2510  #ifdef ERRCHECK
2511  if (rc != MB_SUCCESS)
2512  {
2513  fprintf(stderr, "ERROR: Could not set access mode of 'general_benefit' board\n");
2514  switch(rc) {
2515  case MB_ERR_INVALID:
2516  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
2517  break;
2518  case MB_ERR_LOCKED:
2519  fprintf(stderr, "\t reason: 'general_benefit' board is locked\n");
2520  break;
2521  case MB_ERR_MEMALLOC:
2522  fprintf(stderr, "\t reason: out of memory\n");
2523  break;
2524  case MB_ERR_INTERNAL:
2525  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2526  break;
2527  default:
2528  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2529  break;
2530  }
2531 
2532  exit(rc);
2533  }
2534  #endif
2535  FLAME_fund_request_message_board_write = 0;
2536  FLAME_fund_request_message_board_read = 0;
2537  /* Sending agents */
2538  if(firm_start_state->agents != NULL) FLAME_fund_request_message_board_write = 1;
2539 
2540  /* Reading agents */
2541  if(equityfund_start_state->agents != NULL) FLAME_fund_request_message_board_read = 1;
2542 
2543  /* Call message board library with details */
2544  if(FLAME_fund_request_message_board_write == 0 &&
2545  FLAME_fund_request_message_board_read == 0)
2546  rc = MB_SetAccessMode(b_fund_request, MB_MODE_IDLE);
2547  if(FLAME_fund_request_message_board_write == 1 &&
2548  FLAME_fund_request_message_board_read == 0)
2549  rc = MB_SetAccessMode(b_fund_request, MB_MODE_WRITEONLY);
2550  if(FLAME_fund_request_message_board_write == 0 &&
2551  FLAME_fund_request_message_board_read == 1)
2552  rc = MB_SetAccessMode(b_fund_request, MB_MODE_READONLY);
2553  if(FLAME_fund_request_message_board_write == 1 &&
2554  FLAME_fund_request_message_board_read == 1)
2555  rc = MB_SetAccessMode(b_fund_request, MB_MODE_READWRITE);
2556  #ifdef ERRCHECK
2557  if (rc != MB_SUCCESS)
2558  {
2559  fprintf(stderr, "ERROR: Could not set access mode of 'fund_request' board\n");
2560  switch(rc) {
2561  case MB_ERR_INVALID:
2562  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
2563  break;
2564  case MB_ERR_LOCKED:
2565  fprintf(stderr, "\t reason: 'fund_request' board is locked\n");
2566  break;
2567  case MB_ERR_MEMALLOC:
2568  fprintf(stderr, "\t reason: out of memory\n");
2569  break;
2570  case MB_ERR_INTERNAL:
2571  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2572  break;
2573  default:
2574  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2575  break;
2576  }
2577 
2578  exit(rc);
2579  }
2580  #endif
2581  FLAME_fund_request_ack_message_board_write = 0;
2582  FLAME_fund_request_ack_message_board_read = 0;
2583  /* Sending agents */
2584  if(equityfund_start_state->agents != NULL) FLAME_fund_request_ack_message_board_write = 1;
2585 
2586  /* Reading agents */
2587  if(firm_start_state->agents != NULL) FLAME_fund_request_ack_message_board_read = 1;
2588 
2589  /* Call message board library with details */
2590  if(FLAME_fund_request_ack_message_board_write == 0 &&
2591  FLAME_fund_request_ack_message_board_read == 0)
2592  rc = MB_SetAccessMode(b_fund_request_ack, MB_MODE_IDLE);
2593  if(FLAME_fund_request_ack_message_board_write == 1 &&
2594  FLAME_fund_request_ack_message_board_read == 0)
2595  rc = MB_SetAccessMode(b_fund_request_ack, MB_MODE_WRITEONLY);
2596  if(FLAME_fund_request_ack_message_board_write == 0 &&
2597  FLAME_fund_request_ack_message_board_read == 1)
2598  rc = MB_SetAccessMode(b_fund_request_ack, MB_MODE_READONLY);
2599  if(FLAME_fund_request_ack_message_board_write == 1 &&
2600  FLAME_fund_request_ack_message_board_read == 1)
2601  rc = MB_SetAccessMode(b_fund_request_ack, MB_MODE_READWRITE);
2602  #ifdef ERRCHECK
2603  if (rc != MB_SUCCESS)
2604  {
2605  fprintf(stderr, "ERROR: Could not set access mode of 'fund_request_ack' board\n");
2606  switch(rc) {
2607  case MB_ERR_INVALID:
2608  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
2609  break;
2610  case MB_ERR_LOCKED:
2611  fprintf(stderr, "\t reason: 'fund_request_ack' board is locked\n");
2612  break;
2613  case MB_ERR_MEMALLOC:
2614  fprintf(stderr, "\t reason: out of memory\n");
2615  break;
2616  case MB_ERR_INTERNAL:
2617  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2618  break;
2619  default:
2620  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2621  break;
2622  }
2623 
2624  exit(rc);
2625  }
2626  #endif
2627  FLAME_new_entrant_loan_message_board_write = 0;
2628  FLAME_new_entrant_loan_message_board_read = 0;
2629  /* Sending agents */
2630  if(firm_start_state->agents != NULL) FLAME_new_entrant_loan_message_board_write = 1;
2631 
2632  /* Reading agents */
2633  if(bank_start_state->agents != NULL) FLAME_new_entrant_loan_message_board_read = 1;
2634 
2635  /* Call message board library with details */
2636  if(FLAME_new_entrant_loan_message_board_write == 0 &&
2637  FLAME_new_entrant_loan_message_board_read == 0)
2638  rc = MB_SetAccessMode(b_new_entrant_loan, MB_MODE_IDLE);
2639  if(FLAME_new_entrant_loan_message_board_write == 1 &&
2640  FLAME_new_entrant_loan_message_board_read == 0)
2641  rc = MB_SetAccessMode(b_new_entrant_loan, MB_MODE_WRITEONLY);
2642  if(FLAME_new_entrant_loan_message_board_write == 0 &&
2643  FLAME_new_entrant_loan_message_board_read == 1)
2644  rc = MB_SetAccessMode(b_new_entrant_loan, MB_MODE_READONLY);
2645  if(FLAME_new_entrant_loan_message_board_write == 1 &&
2646  FLAME_new_entrant_loan_message_board_read == 1)
2647  rc = MB_SetAccessMode(b_new_entrant_loan, MB_MODE_READWRITE);
2648  #ifdef ERRCHECK
2649  if (rc != MB_SUCCESS)
2650  {
2651  fprintf(stderr, "ERROR: Could not set access mode of 'new_entrant_loan' board\n");
2652  switch(rc) {
2653  case MB_ERR_INVALID:
2654  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
2655  break;
2656  case MB_ERR_LOCKED:
2657  fprintf(stderr, "\t reason: 'new_entrant_loan' board is locked\n");
2658  break;
2659  case MB_ERR_MEMALLOC:
2660  fprintf(stderr, "\t reason: out of memory\n");
2661  break;
2662  case MB_ERR_INTERNAL:
2663  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2664  break;
2665  default:
2666  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2667  break;
2668  }
2669 
2670  exit(rc);
2671  }
2672  #endif
2673  FLAME_firm_bank_interest_on_loan_message_board_write = 0;
2674  FLAME_firm_bank_interest_on_loan_message_board_read = 0;
2675  /* Sending agents */
2676  if(firm_start_state->agents != NULL) FLAME_firm_bank_interest_on_loan_message_board_write = 1;
2677 
2678  /* Reading agents */
2679  if(bank_start_state->agents != NULL) FLAME_firm_bank_interest_on_loan_message_board_read = 1;
2680 
2681  /* Call message board library with details */
2682  if(FLAME_firm_bank_interest_on_loan_message_board_write == 0 &&
2683  FLAME_firm_bank_interest_on_loan_message_board_read == 0)
2684  rc = MB_SetAccessMode(b_firm_bank_interest_on_loan, MB_MODE_IDLE);
2685  if(FLAME_firm_bank_interest_on_loan_message_board_write == 1 &&
2686  FLAME_firm_bank_interest_on_loan_message_board_read == 0)
2687  rc = MB_SetAccessMode(b_firm_bank_interest_on_loan, MB_MODE_WRITEONLY);
2688  if(FLAME_firm_bank_interest_on_loan_message_board_write == 0 &&
2689  FLAME_firm_bank_interest_on_loan_message_board_read == 1)
2690  rc = MB_SetAccessMode(b_firm_bank_interest_on_loan, MB_MODE_READONLY);
2691  if(FLAME_firm_bank_interest_on_loan_message_board_write == 1 &&
2692  FLAME_firm_bank_interest_on_loan_message_board_read == 1)
2693  rc = MB_SetAccessMode(b_firm_bank_interest_on_loan, MB_MODE_READWRITE);
2694  #ifdef ERRCHECK
2695  if (rc != MB_SUCCESS)
2696  {
2697  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_interest_on_loan' board\n");
2698  switch(rc) {
2699  case MB_ERR_INVALID:
2700  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
2701  break;
2702  case MB_ERR_LOCKED:
2703  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is locked\n");
2704  break;
2705  case MB_ERR_MEMALLOC:
2706  fprintf(stderr, "\t reason: out of memory\n");
2707  break;
2708  case MB_ERR_INTERNAL:
2709  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2710  break;
2711  default:
2712  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2713  break;
2714  }
2715 
2716  exit(rc);
2717  }
2718  #endif
2719  FLAME_loan_writeoff_message_board_write = 0;
2720  FLAME_loan_writeoff_message_board_read = 0;
2721  /* Sending agents */
2722  if(firm_start_state->agents != NULL) FLAME_loan_writeoff_message_board_write = 1;
2723 
2724  /* Reading agents */
2725  if(bank_start_state->agents != NULL) FLAME_loan_writeoff_message_board_read = 1;
2726 
2727  /* Call message board library with details */
2728  if(FLAME_loan_writeoff_message_board_write == 0 &&
2729  FLAME_loan_writeoff_message_board_read == 0)
2730  rc = MB_SetAccessMode(b_loan_writeoff, MB_MODE_IDLE);
2731  if(FLAME_loan_writeoff_message_board_write == 1 &&
2732  FLAME_loan_writeoff_message_board_read == 0)
2733  rc = MB_SetAccessMode(b_loan_writeoff, MB_MODE_WRITEONLY);
2734  if(FLAME_loan_writeoff_message_board_write == 0 &&
2735  FLAME_loan_writeoff_message_board_read == 1)
2736  rc = MB_SetAccessMode(b_loan_writeoff, MB_MODE_READONLY);
2737  if(FLAME_loan_writeoff_message_board_write == 1 &&
2738  FLAME_loan_writeoff_message_board_read == 1)
2739  rc = MB_SetAccessMode(b_loan_writeoff, MB_MODE_READWRITE);
2740  #ifdef ERRCHECK
2741  if (rc != MB_SUCCESS)
2742  {
2743  fprintf(stderr, "ERROR: Could not set access mode of 'loan_writeoff' board\n");
2744  switch(rc) {
2745  case MB_ERR_INVALID:
2746  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
2747  break;
2748  case MB_ERR_LOCKED:
2749  fprintf(stderr, "\t reason: 'loan_writeoff' board is locked\n");
2750  break;
2751  case MB_ERR_MEMALLOC:
2752  fprintf(stderr, "\t reason: out of memory\n");
2753  break;
2754  case MB_ERR_INTERNAL:
2755  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2756  break;
2757  default:
2758  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2759  break;
2760  }
2761 
2762  exit(rc);
2763  }
2764  #endif
2765  FLAME_firm_bank_insolvent_account_message_board_write = 0;
2766  FLAME_firm_bank_insolvent_account_message_board_read = 0;
2767  /* Sending agents */
2768  if(firm_start_state->agents != NULL) FLAME_firm_bank_insolvent_account_message_board_write = 1;
2769 
2770  /* Reading agents */
2771  if(bank_start_state->agents != NULL) FLAME_firm_bank_insolvent_account_message_board_read = 1;
2772 
2773  /* Call message board library with details */
2774  if(FLAME_firm_bank_insolvent_account_message_board_write == 0 &&
2775  FLAME_firm_bank_insolvent_account_message_board_read == 0)
2776  rc = MB_SetAccessMode(b_firm_bank_insolvent_account, MB_MODE_IDLE);
2777  if(FLAME_firm_bank_insolvent_account_message_board_write == 1 &&
2778  FLAME_firm_bank_insolvent_account_message_board_read == 0)
2779  rc = MB_SetAccessMode(b_firm_bank_insolvent_account, MB_MODE_WRITEONLY);
2780  if(FLAME_firm_bank_insolvent_account_message_board_write == 0 &&
2781  FLAME_firm_bank_insolvent_account_message_board_read == 1)
2782  rc = MB_SetAccessMode(b_firm_bank_insolvent_account, MB_MODE_READONLY);
2783  if(FLAME_firm_bank_insolvent_account_message_board_write == 1 &&
2784  FLAME_firm_bank_insolvent_account_message_board_read == 1)
2785  rc = MB_SetAccessMode(b_firm_bank_insolvent_account, MB_MODE_READWRITE);
2786  #ifdef ERRCHECK
2787  if (rc != MB_SUCCESS)
2788  {
2789  fprintf(stderr, "ERROR: Could not set access mode of 'firm_bank_insolvent_account' board\n");
2790  switch(rc) {
2791  case MB_ERR_INVALID:
2792  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
2793  break;
2794  case MB_ERR_LOCKED:
2795  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is locked\n");
2796  break;
2797  case MB_ERR_MEMALLOC:
2798  fprintf(stderr, "\t reason: out of memory\n");
2799  break;
2800  case MB_ERR_INTERNAL:
2801  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2802  break;
2803  default:
2804  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2805  break;
2806  }
2807 
2808  exit(rc);
2809  }
2810  #endif
2811  FLAME_firm_net_profit_message_board_write = 0;
2812  FLAME_firm_net_profit_message_board_read = 0;
2813  /* Sending agents */
2814  if(firm_start_state->agents != NULL) FLAME_firm_net_profit_message_board_write = 1;
2815 
2816  /* Reading agents */
2817  if(equityfund_start_state->agents != NULL) FLAME_firm_net_profit_message_board_read = 1;
2818 
2819  /* Call message board library with details */
2820  if(FLAME_firm_net_profit_message_board_write == 0 &&
2821  FLAME_firm_net_profit_message_board_read == 0)
2822  rc = MB_SetAccessMode(b_firm_net_profit, MB_MODE_IDLE);
2823  if(FLAME_firm_net_profit_message_board_write == 1 &&
2824  FLAME_firm_net_profit_message_board_read == 0)
2825  rc = MB_SetAccessMode(b_firm_net_profit, MB_MODE_WRITEONLY);
2826  if(FLAME_firm_net_profit_message_board_write == 0 &&
2827  FLAME_firm_net_profit_message_board_read == 1)
2828  rc = MB_SetAccessMode(b_firm_net_profit, MB_MODE_READONLY);
2829  if(FLAME_firm_net_profit_message_board_write == 1 &&
2830  FLAME_firm_net_profit_message_board_read == 1)
2831  rc = MB_SetAccessMode(b_firm_net_profit, MB_MODE_READWRITE);
2832  #ifdef ERRCHECK
2833  if (rc != MB_SUCCESS)
2834  {
2835  fprintf(stderr, "ERROR: Could not set access mode of 'firm_net_profit' board\n");
2836  switch(rc) {
2837  case MB_ERR_INVALID:
2838  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
2839  break;
2840  case MB_ERR_LOCKED:
2841  fprintf(stderr, "\t reason: 'firm_net_profit' board is locked\n");
2842  break;
2843  case MB_ERR_MEMALLOC:
2844  fprintf(stderr, "\t reason: out of memory\n");
2845  break;
2846  case MB_ERR_INTERNAL:
2847  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2848  break;
2849  default:
2850  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2851  break;
2852  }
2853 
2854  exit(rc);
2855  }
2856  #endif
2857  FLAME_bank_net_profit_message_board_write = 0;
2858  FLAME_bank_net_profit_message_board_read = 0;
2859  /* Sending agents */
2860  if(bank_start_state->agents != NULL) FLAME_bank_net_profit_message_board_write = 1;
2861 
2862  /* Reading agents */
2863  if(equityfund_start_state->agents != NULL) FLAME_bank_net_profit_message_board_read = 1;
2864 
2865  /* Call message board library with details */
2866  if(FLAME_bank_net_profit_message_board_write == 0 &&
2867  FLAME_bank_net_profit_message_board_read == 0)
2868  rc = MB_SetAccessMode(b_bank_net_profit, MB_MODE_IDLE);
2869  if(FLAME_bank_net_profit_message_board_write == 1 &&
2870  FLAME_bank_net_profit_message_board_read == 0)
2871  rc = MB_SetAccessMode(b_bank_net_profit, MB_MODE_WRITEONLY);
2872  if(FLAME_bank_net_profit_message_board_write == 0 &&
2873  FLAME_bank_net_profit_message_board_read == 1)
2874  rc = MB_SetAccessMode(b_bank_net_profit, MB_MODE_READONLY);
2875  if(FLAME_bank_net_profit_message_board_write == 1 &&
2876  FLAME_bank_net_profit_message_board_read == 1)
2877  rc = MB_SetAccessMode(b_bank_net_profit, MB_MODE_READWRITE);
2878  #ifdef ERRCHECK
2879  if (rc != MB_SUCCESS)
2880  {
2881  fprintf(stderr, "ERROR: Could not set access mode of 'bank_net_profit' board\n");
2882  switch(rc) {
2883  case MB_ERR_INVALID:
2884  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
2885  break;
2886  case MB_ERR_LOCKED:
2887  fprintf(stderr, "\t reason: 'bank_net_profit' board is locked\n");
2888  break;
2889  case MB_ERR_MEMALLOC:
2890  fprintf(stderr, "\t reason: out of memory\n");
2891  break;
2892  case MB_ERR_INTERNAL:
2893  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2894  break;
2895  default:
2896  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2897  break;
2898  }
2899 
2900  exit(rc);
2901  }
2902  #endif
2903  FLAME_bank_centralbank_interest_payment_message_board_write = 0;
2904  FLAME_bank_centralbank_interest_payment_message_board_read = 0;
2905  /* Sending agents */
2906  if(bank_start_state->agents != NULL) FLAME_bank_centralbank_interest_payment_message_board_write = 1;
2907 
2908  /* Reading agents */
2909  if(centralbank_start_state->agents != NULL) FLAME_bank_centralbank_interest_payment_message_board_read = 1;
2910 
2911  /* Call message board library with details */
2912  if(FLAME_bank_centralbank_interest_payment_message_board_write == 0 &&
2913  FLAME_bank_centralbank_interest_payment_message_board_read == 0)
2914  rc = MB_SetAccessMode(b_bank_centralbank_interest_payment, MB_MODE_IDLE);
2915  if(FLAME_bank_centralbank_interest_payment_message_board_write == 1 &&
2916  FLAME_bank_centralbank_interest_payment_message_board_read == 0)
2917  rc = MB_SetAccessMode(b_bank_centralbank_interest_payment, MB_MODE_WRITEONLY);
2918  if(FLAME_bank_centralbank_interest_payment_message_board_write == 0 &&
2919  FLAME_bank_centralbank_interest_payment_message_board_read == 1)
2920  rc = MB_SetAccessMode(b_bank_centralbank_interest_payment, MB_MODE_READONLY);
2921  if(FLAME_bank_centralbank_interest_payment_message_board_write == 1 &&
2922  FLAME_bank_centralbank_interest_payment_message_board_read == 1)
2923  rc = MB_SetAccessMode(b_bank_centralbank_interest_payment, MB_MODE_READWRITE);
2924  #ifdef ERRCHECK
2925  if (rc != MB_SUCCESS)
2926  {
2927  fprintf(stderr, "ERROR: Could not set access mode of 'bank_centralbank_interest_payment' board\n");
2928  switch(rc) {
2929  case MB_ERR_INVALID:
2930  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
2931  break;
2932  case MB_ERR_LOCKED:
2933  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is locked\n");
2934  break;
2935  case MB_ERR_MEMALLOC:
2936  fprintf(stderr, "\t reason: out of memory\n");
2937  break;
2938  case MB_ERR_INTERNAL:
2939  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2940  break;
2941  default:
2942  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2943  break;
2944  }
2945 
2946  exit(rc);
2947  }
2948  #endif
2949  FLAME_bank_centralbank_debt_payment_message_board_write = 0;
2950  FLAME_bank_centralbank_debt_payment_message_board_read = 0;
2951  /* Sending agents */
2952  if(bank_start_state->agents != NULL) FLAME_bank_centralbank_debt_payment_message_board_write = 1;
2953 
2954  /* Reading agents */
2955  if(centralbank_start_state->agents != NULL) FLAME_bank_centralbank_debt_payment_message_board_read = 1;
2956 
2957  /* Call message board library with details */
2958  if(FLAME_bank_centralbank_debt_payment_message_board_write == 0 &&
2959  FLAME_bank_centralbank_debt_payment_message_board_read == 0)
2960  rc = MB_SetAccessMode(b_bank_centralbank_debt_payment, MB_MODE_IDLE);
2961  if(FLAME_bank_centralbank_debt_payment_message_board_write == 1 &&
2962  FLAME_bank_centralbank_debt_payment_message_board_read == 0)
2963  rc = MB_SetAccessMode(b_bank_centralbank_debt_payment, MB_MODE_WRITEONLY);
2964  if(FLAME_bank_centralbank_debt_payment_message_board_write == 0 &&
2965  FLAME_bank_centralbank_debt_payment_message_board_read == 1)
2966  rc = MB_SetAccessMode(b_bank_centralbank_debt_payment, MB_MODE_READONLY);
2967  if(FLAME_bank_centralbank_debt_payment_message_board_write == 1 &&
2968  FLAME_bank_centralbank_debt_payment_message_board_read == 1)
2969  rc = MB_SetAccessMode(b_bank_centralbank_debt_payment, MB_MODE_READWRITE);
2970  #ifdef ERRCHECK
2971  if (rc != MB_SUCCESS)
2972  {
2973  fprintf(stderr, "ERROR: Could not set access mode of 'bank_centralbank_debt_payment' board\n");
2974  switch(rc) {
2975  case MB_ERR_INVALID:
2976  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
2977  break;
2978  case MB_ERR_LOCKED:
2979  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is locked\n");
2980  break;
2981  case MB_ERR_MEMALLOC:
2982  fprintf(stderr, "\t reason: out of memory\n");
2983  break;
2984  case MB_ERR_INTERNAL:
2985  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
2986  break;
2987  default:
2988  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
2989  break;
2990  }
2991 
2992  exit(rc);
2993  }
2994  #endif
2995  FLAME_gov_centralbank_debt_request_message_board_write = 0;
2996  FLAME_gov_centralbank_debt_request_message_board_read = 0;
2997  /* Sending agents */
2998  if(government_start_state->agents != NULL) FLAME_gov_centralbank_debt_request_message_board_write = 1;
2999 
3000  /* Reading agents */
3001  if(centralbank_start_state->agents != NULL) FLAME_gov_centralbank_debt_request_message_board_read = 1;
3002 
3003  /* Call message board library with details */
3004  if(FLAME_gov_centralbank_debt_request_message_board_write == 0 &&
3005  FLAME_gov_centralbank_debt_request_message_board_read == 0)
3006  rc = MB_SetAccessMode(b_gov_centralbank_debt_request, MB_MODE_IDLE);
3007  if(FLAME_gov_centralbank_debt_request_message_board_write == 1 &&
3008  FLAME_gov_centralbank_debt_request_message_board_read == 0)
3009  rc = MB_SetAccessMode(b_gov_centralbank_debt_request, MB_MODE_WRITEONLY);
3010  if(FLAME_gov_centralbank_debt_request_message_board_write == 0 &&
3011  FLAME_gov_centralbank_debt_request_message_board_read == 1)
3012  rc = MB_SetAccessMode(b_gov_centralbank_debt_request, MB_MODE_READONLY);
3013  if(FLAME_gov_centralbank_debt_request_message_board_write == 1 &&
3014  FLAME_gov_centralbank_debt_request_message_board_read == 1)
3015  rc = MB_SetAccessMode(b_gov_centralbank_debt_request, MB_MODE_READWRITE);
3016  #ifdef ERRCHECK
3017  if (rc != MB_SUCCESS)
3018  {
3019  fprintf(stderr, "ERROR: Could not set access mode of 'gov_centralbank_debt_request' board\n");
3020  switch(rc) {
3021  case MB_ERR_INVALID:
3022  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
3023  break;
3024  case MB_ERR_LOCKED:
3025  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is locked\n");
3026  break;
3027  case MB_ERR_MEMALLOC:
3028  fprintf(stderr, "\t reason: out of memory\n");
3029  break;
3030  case MB_ERR_INTERNAL:
3031  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3032  break;
3033  default:
3034  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3035  break;
3036  }
3037 
3038  exit(rc);
3039  }
3040  #endif
3041  FLAME_gov_centralbank_debt_payment_message_board_write = 0;
3042  FLAME_gov_centralbank_debt_payment_message_board_read = 0;
3043  /* Sending agents */
3044  if(government_start_state->agents != NULL) FLAME_gov_centralbank_debt_payment_message_board_write = 1;
3045 
3046  /* Reading agents */
3047  if(centralbank_start_state->agents != NULL) FLAME_gov_centralbank_debt_payment_message_board_read = 1;
3048 
3049  /* Call message board library with details */
3050  if(FLAME_gov_centralbank_debt_payment_message_board_write == 0 &&
3051  FLAME_gov_centralbank_debt_payment_message_board_read == 0)
3052  rc = MB_SetAccessMode(b_gov_centralbank_debt_payment, MB_MODE_IDLE);
3053  if(FLAME_gov_centralbank_debt_payment_message_board_write == 1 &&
3054  FLAME_gov_centralbank_debt_payment_message_board_read == 0)
3055  rc = MB_SetAccessMode(b_gov_centralbank_debt_payment, MB_MODE_WRITEONLY);
3056  if(FLAME_gov_centralbank_debt_payment_message_board_write == 0 &&
3057  FLAME_gov_centralbank_debt_payment_message_board_read == 1)
3058  rc = MB_SetAccessMode(b_gov_centralbank_debt_payment, MB_MODE_READONLY);
3059  if(FLAME_gov_centralbank_debt_payment_message_board_write == 1 &&
3060  FLAME_gov_centralbank_debt_payment_message_board_read == 1)
3061  rc = MB_SetAccessMode(b_gov_centralbank_debt_payment, MB_MODE_READWRITE);
3062  #ifdef ERRCHECK
3063  if (rc != MB_SUCCESS)
3064  {
3065  fprintf(stderr, "ERROR: Could not set access mode of 'gov_centralbank_debt_payment' board\n");
3066  switch(rc) {
3067  case MB_ERR_INVALID:
3068  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
3069  break;
3070  case MB_ERR_LOCKED:
3071  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is locked\n");
3072  break;
3073  case MB_ERR_MEMALLOC:
3074  fprintf(stderr, "\t reason: out of memory\n");
3075  break;
3076  case MB_ERR_INTERNAL:
3077  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3078  break;
3079  default:
3080  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3081  break;
3082  }
3083 
3084  exit(rc);
3085  }
3086  #endif
3087  FLAME_centralbank_government_profit_message_board_write = 0;
3088  FLAME_centralbank_government_profit_message_board_read = 0;
3089  /* Sending agents */
3090  if(centralbank_start_state->agents != NULL) FLAME_centralbank_government_profit_message_board_write = 1;
3091 
3092  /* Reading agents */
3093  if(government_start_state->agents != NULL) FLAME_centralbank_government_profit_message_board_read = 1;
3094 
3095  /* Call message board library with details */
3096  if(FLAME_centralbank_government_profit_message_board_write == 0 &&
3097  FLAME_centralbank_government_profit_message_board_read == 0)
3098  rc = MB_SetAccessMode(b_centralbank_government_profit, MB_MODE_IDLE);
3099  if(FLAME_centralbank_government_profit_message_board_write == 1 &&
3100  FLAME_centralbank_government_profit_message_board_read == 0)
3101  rc = MB_SetAccessMode(b_centralbank_government_profit, MB_MODE_WRITEONLY);
3102  if(FLAME_centralbank_government_profit_message_board_write == 0 &&
3103  FLAME_centralbank_government_profit_message_board_read == 1)
3104  rc = MB_SetAccessMode(b_centralbank_government_profit, MB_MODE_READONLY);
3105  if(FLAME_centralbank_government_profit_message_board_write == 1 &&
3106  FLAME_centralbank_government_profit_message_board_read == 1)
3107  rc = MB_SetAccessMode(b_centralbank_government_profit, MB_MODE_READWRITE);
3108  #ifdef ERRCHECK
3109  if (rc != MB_SUCCESS)
3110  {
3111  fprintf(stderr, "ERROR: Could not set access mode of 'centralbank_government_profit' board\n");
3112  switch(rc) {
3113  case MB_ERR_INVALID:
3114  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
3115  break;
3116  case MB_ERR_LOCKED:
3117  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is locked\n");
3118  break;
3119  case MB_ERR_MEMALLOC:
3120  fprintf(stderr, "\t reason: out of memory\n");
3121  break;
3122  case MB_ERR_INTERNAL:
3123  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3124  break;
3125  default:
3126  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3127  break;
3128  }
3129 
3130  exit(rc);
3131  }
3132  #endif
3133  FLAME_housing_price_message_board_write = 0;
3134  FLAME_housing_price_message_board_read = 0;
3135  /* Sending agents */
3136  if(reagency_start_state->agents != NULL) FLAME_housing_price_message_board_write = 1;
3137 
3138  /* Reading agents */
3139  if(firm_start_state->agents != NULL) FLAME_housing_price_message_board_read = 1;
3140  if(household_start_state->agents != NULL) FLAME_housing_price_message_board_read = 1;
3141 
3142  /* Call message board library with details */
3143  if(FLAME_housing_price_message_board_write == 0 &&
3144  FLAME_housing_price_message_board_read == 0)
3145  rc = MB_SetAccessMode(b_housing_price, MB_MODE_IDLE);
3146  if(FLAME_housing_price_message_board_write == 1 &&
3147  FLAME_housing_price_message_board_read == 0)
3148  rc = MB_SetAccessMode(b_housing_price, MB_MODE_WRITEONLY);
3149  if(FLAME_housing_price_message_board_write == 0 &&
3150  FLAME_housing_price_message_board_read == 1)
3151  rc = MB_SetAccessMode(b_housing_price, MB_MODE_READONLY);
3152  if(FLAME_housing_price_message_board_write == 1 &&
3153  FLAME_housing_price_message_board_read == 1)
3154  rc = MB_SetAccessMode(b_housing_price, MB_MODE_READWRITE);
3155  #ifdef ERRCHECK
3156  if (rc != MB_SUCCESS)
3157  {
3158  fprintf(stderr, "ERROR: Could not set access mode of 'housing_price' board\n");
3159  switch(rc) {
3160  case MB_ERR_INVALID:
3161  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
3162  break;
3163  case MB_ERR_LOCKED:
3164  fprintf(stderr, "\t reason: 'housing_price' board is locked\n");
3165  break;
3166  case MB_ERR_MEMALLOC:
3167  fprintf(stderr, "\t reason: out of memory\n");
3168  break;
3169  case MB_ERR_INTERNAL:
3170  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3171  break;
3172  default:
3173  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3174  break;
3175  }
3176 
3177  exit(rc);
3178  }
3179  #endif
3180  FLAME_buy_housing_message_board_write = 0;
3181  FLAME_buy_housing_message_board_read = 0;
3182  /* Sending agents */
3183  if(household_start_state->agents != NULL) FLAME_buy_housing_message_board_write = 1;
3184 
3185  /* Reading agents */
3186  if(reagency_start_state->agents != NULL) FLAME_buy_housing_message_board_read = 1;
3187 
3188  /* Call message board library with details */
3189  if(FLAME_buy_housing_message_board_write == 0 &&
3190  FLAME_buy_housing_message_board_read == 0)
3191  rc = MB_SetAccessMode(b_buy_housing, MB_MODE_IDLE);
3192  if(FLAME_buy_housing_message_board_write == 1 &&
3193  FLAME_buy_housing_message_board_read == 0)
3194  rc = MB_SetAccessMode(b_buy_housing, MB_MODE_WRITEONLY);
3195  if(FLAME_buy_housing_message_board_write == 0 &&
3196  FLAME_buy_housing_message_board_read == 1)
3197  rc = MB_SetAccessMode(b_buy_housing, MB_MODE_READONLY);
3198  if(FLAME_buy_housing_message_board_write == 1 &&
3199  FLAME_buy_housing_message_board_read == 1)
3200  rc = MB_SetAccessMode(b_buy_housing, MB_MODE_READWRITE);
3201  #ifdef ERRCHECK
3202  if (rc != MB_SUCCESS)
3203  {
3204  fprintf(stderr, "ERROR: Could not set access mode of 'buy_housing' board\n");
3205  switch(rc) {
3206  case MB_ERR_INVALID:
3207  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
3208  break;
3209  case MB_ERR_LOCKED:
3210  fprintf(stderr, "\t reason: 'buy_housing' board is locked\n");
3211  break;
3212  case MB_ERR_MEMALLOC:
3213  fprintf(stderr, "\t reason: out of memory\n");
3214  break;
3215  case MB_ERR_INTERNAL:
3216  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3217  break;
3218  default:
3219  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3220  break;
3221  }
3222 
3223  exit(rc);
3224  }
3225  #endif
3226  FLAME_sell_housing_message_board_write = 0;
3227  FLAME_sell_housing_message_board_read = 0;
3228  /* Sending agents */
3229  if(firm_start_state->agents != NULL) FLAME_sell_housing_message_board_write = 1;
3230  if(household_start_state->agents != NULL) FLAME_sell_housing_message_board_write = 1;
3231 
3232  /* Reading agents */
3233  if(reagency_start_state->agents != NULL) FLAME_sell_housing_message_board_read = 1;
3234 
3235  /* Call message board library with details */
3236  if(FLAME_sell_housing_message_board_write == 0 &&
3237  FLAME_sell_housing_message_board_read == 0)
3238  rc = MB_SetAccessMode(b_sell_housing, MB_MODE_IDLE);
3239  if(FLAME_sell_housing_message_board_write == 1 &&
3240  FLAME_sell_housing_message_board_read == 0)
3241  rc = MB_SetAccessMode(b_sell_housing, MB_MODE_WRITEONLY);
3242  if(FLAME_sell_housing_message_board_write == 0 &&
3243  FLAME_sell_housing_message_board_read == 1)
3244  rc = MB_SetAccessMode(b_sell_housing, MB_MODE_READONLY);
3245  if(FLAME_sell_housing_message_board_write == 1 &&
3246  FLAME_sell_housing_message_board_read == 1)
3247  rc = MB_SetAccessMode(b_sell_housing, MB_MODE_READWRITE);
3248  #ifdef ERRCHECK
3249  if (rc != MB_SUCCESS)
3250  {
3251  fprintf(stderr, "ERROR: Could not set access mode of 'sell_housing' board\n");
3252  switch(rc) {
3253  case MB_ERR_INVALID:
3254  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
3255  break;
3256  case MB_ERR_LOCKED:
3257  fprintf(stderr, "\t reason: 'sell_housing' board is locked\n");
3258  break;
3259  case MB_ERR_MEMALLOC:
3260  fprintf(stderr, "\t reason: out of memory\n");
3261  break;
3262  case MB_ERR_INTERNAL:
3263  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3264  break;
3265  default:
3266  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3267  break;
3268  }
3269 
3270  exit(rc);
3271  }
3272  #endif
3273  FLAME_bought_housing_message_board_write = 0;
3274  FLAME_bought_housing_message_board_read = 0;
3275  /* Sending agents */
3276  if(reagency_start_state->agents != NULL) FLAME_bought_housing_message_board_write = 1;
3277 
3278  /* Reading agents */
3279  if(household_start_state->agents != NULL) FLAME_bought_housing_message_board_read = 1;
3280 
3281  /* Call message board library with details */
3282  if(FLAME_bought_housing_message_board_write == 0 &&
3283  FLAME_bought_housing_message_board_read == 0)
3284  rc = MB_SetAccessMode(b_bought_housing, MB_MODE_IDLE);
3285  if(FLAME_bought_housing_message_board_write == 1 &&
3286  FLAME_bought_housing_message_board_read == 0)
3287  rc = MB_SetAccessMode(b_bought_housing, MB_MODE_WRITEONLY);
3288  if(FLAME_bought_housing_message_board_write == 0 &&
3289  FLAME_bought_housing_message_board_read == 1)
3290  rc = MB_SetAccessMode(b_bought_housing, MB_MODE_READONLY);
3291  if(FLAME_bought_housing_message_board_write == 1 &&
3292  FLAME_bought_housing_message_board_read == 1)
3293  rc = MB_SetAccessMode(b_bought_housing, MB_MODE_READWRITE);
3294  #ifdef ERRCHECK
3295  if (rc != MB_SUCCESS)
3296  {
3297  fprintf(stderr, "ERROR: Could not set access mode of 'bought_housing' board\n");
3298  switch(rc) {
3299  case MB_ERR_INVALID:
3300  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
3301  break;
3302  case MB_ERR_LOCKED:
3303  fprintf(stderr, "\t reason: 'bought_housing' board is locked\n");
3304  break;
3305  case MB_ERR_MEMALLOC:
3306  fprintf(stderr, "\t reason: out of memory\n");
3307  break;
3308  case MB_ERR_INTERNAL:
3309  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3310  break;
3311  default:
3312  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3313  break;
3314  }
3315 
3316  exit(rc);
3317  }
3318  #endif
3319  FLAME_sold_housing_message_board_write = 0;
3320  FLAME_sold_housing_message_board_read = 0;
3321  /* Sending agents */
3322  if(reagency_start_state->agents != NULL) FLAME_sold_housing_message_board_write = 1;
3323 
3324  /* Reading agents */
3325  if(firm_start_state->agents != NULL) FLAME_sold_housing_message_board_read = 1;
3326  if(household_start_state->agents != NULL) FLAME_sold_housing_message_board_read = 1;
3327 
3328  /* Call message board library with details */
3329  if(FLAME_sold_housing_message_board_write == 0 &&
3330  FLAME_sold_housing_message_board_read == 0)
3331  rc = MB_SetAccessMode(b_sold_housing, MB_MODE_IDLE);
3332  if(FLAME_sold_housing_message_board_write == 1 &&
3333  FLAME_sold_housing_message_board_read == 0)
3334  rc = MB_SetAccessMode(b_sold_housing, MB_MODE_WRITEONLY);
3335  if(FLAME_sold_housing_message_board_write == 0 &&
3336  FLAME_sold_housing_message_board_read == 1)
3337  rc = MB_SetAccessMode(b_sold_housing, MB_MODE_READONLY);
3338  if(FLAME_sold_housing_message_board_write == 1 &&
3339  FLAME_sold_housing_message_board_read == 1)
3340  rc = MB_SetAccessMode(b_sold_housing, MB_MODE_READWRITE);
3341  #ifdef ERRCHECK
3342  if (rc != MB_SUCCESS)
3343  {
3344  fprintf(stderr, "ERROR: Could not set access mode of 'sold_housing' board\n");
3345  switch(rc) {
3346  case MB_ERR_INVALID:
3347  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
3348  break;
3349  case MB_ERR_LOCKED:
3350  fprintf(stderr, "\t reason: 'sold_housing' board is locked\n");
3351  break;
3352  case MB_ERR_MEMALLOC:
3353  fprintf(stderr, "\t reason: out of memory\n");
3354  break;
3355  case MB_ERR_INTERNAL:
3356  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3357  break;
3358  default:
3359  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3360  break;
3361  }
3362 
3363  exit(rc);
3364  }
3365  #endif
3366  FLAME_bank_reagency_credibility_message_board_write = 0;
3367  FLAME_bank_reagency_credibility_message_board_read = 0;
3368  /* Sending agents */
3369  if(bank_start_state->agents != NULL) FLAME_bank_reagency_credibility_message_board_write = 1;
3370 
3371  /* Reading agents */
3372  if(reagency_start_state->agents != NULL) FLAME_bank_reagency_credibility_message_board_read = 1;
3373 
3374  /* Call message board library with details */
3375  if(FLAME_bank_reagency_credibility_message_board_write == 0 &&
3376  FLAME_bank_reagency_credibility_message_board_read == 0)
3377  rc = MB_SetAccessMode(b_bank_reagency_credibility, MB_MODE_IDLE);
3378  if(FLAME_bank_reagency_credibility_message_board_write == 1 &&
3379  FLAME_bank_reagency_credibility_message_board_read == 0)
3380  rc = MB_SetAccessMode(b_bank_reagency_credibility, MB_MODE_WRITEONLY);
3381  if(FLAME_bank_reagency_credibility_message_board_write == 0 &&
3382  FLAME_bank_reagency_credibility_message_board_read == 1)
3383  rc = MB_SetAccessMode(b_bank_reagency_credibility, MB_MODE_READONLY);
3384  if(FLAME_bank_reagency_credibility_message_board_write == 1 &&
3385  FLAME_bank_reagency_credibility_message_board_read == 1)
3386  rc = MB_SetAccessMode(b_bank_reagency_credibility, MB_MODE_READWRITE);
3387  #ifdef ERRCHECK
3388  if (rc != MB_SUCCESS)
3389  {
3390  fprintf(stderr, "ERROR: Could not set access mode of 'bank_reagency_credibility' board\n");
3391  switch(rc) {
3392  case MB_ERR_INVALID:
3393  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
3394  break;
3395  case MB_ERR_LOCKED:
3396  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is locked\n");
3397  break;
3398  case MB_ERR_MEMALLOC:
3399  fprintf(stderr, "\t reason: out of memory\n");
3400  break;
3401  case MB_ERR_INTERNAL:
3402  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3403  break;
3404  default:
3405  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3406  break;
3407  }
3408 
3409  exit(rc);
3410  }
3411  #endif
3412  FLAME_mortgage_requests_message_board_write = 0;
3413  FLAME_mortgage_requests_message_board_read = 0;
3414  /* Sending agents */
3415  if(reagency_start_state->agents != NULL) FLAME_mortgage_requests_message_board_write = 1;
3416 
3417  /* Reading agents */
3418  if(bank_start_state->agents != NULL) FLAME_mortgage_requests_message_board_read = 1;
3419 
3420  /* Call message board library with details */
3421  if(FLAME_mortgage_requests_message_board_write == 0 &&
3422  FLAME_mortgage_requests_message_board_read == 0)
3423  rc = MB_SetAccessMode(b_mortgage_requests, MB_MODE_IDLE);
3424  if(FLAME_mortgage_requests_message_board_write == 1 &&
3425  FLAME_mortgage_requests_message_board_read == 0)
3426  rc = MB_SetAccessMode(b_mortgage_requests, MB_MODE_WRITEONLY);
3427  if(FLAME_mortgage_requests_message_board_write == 0 &&
3428  FLAME_mortgage_requests_message_board_read == 1)
3429  rc = MB_SetAccessMode(b_mortgage_requests, MB_MODE_READONLY);
3430  if(FLAME_mortgage_requests_message_board_write == 1 &&
3431  FLAME_mortgage_requests_message_board_read == 1)
3432  rc = MB_SetAccessMode(b_mortgage_requests, MB_MODE_READWRITE);
3433  #ifdef ERRCHECK
3434  if (rc != MB_SUCCESS)
3435  {
3436  fprintf(stderr, "ERROR: Could not set access mode of 'mortgage_requests' board\n");
3437  switch(rc) {
3438  case MB_ERR_INVALID:
3439  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
3440  break;
3441  case MB_ERR_LOCKED:
3442  fprintf(stderr, "\t reason: 'mortgage_requests' board is locked\n");
3443  break;
3444  case MB_ERR_MEMALLOC:
3445  fprintf(stderr, "\t reason: out of memory\n");
3446  break;
3447  case MB_ERR_INTERNAL:
3448  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3449  break;
3450  default:
3451  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3452  break;
3453  }
3454 
3455  exit(rc);
3456  }
3457  #endif
3458  FLAME_mortgage_payment_from_sale_message_board_write = 0;
3459  FLAME_mortgage_payment_from_sale_message_board_read = 0;
3460  /* Sending agents */
3461  if(household_start_state->agents != NULL) FLAME_mortgage_payment_from_sale_message_board_write = 1;
3462 
3463  /* Reading agents */
3464  if(bank_start_state->agents != NULL) FLAME_mortgage_payment_from_sale_message_board_read = 1;
3465 
3466  /* Call message board library with details */
3467  if(FLAME_mortgage_payment_from_sale_message_board_write == 0 &&
3468  FLAME_mortgage_payment_from_sale_message_board_read == 0)
3469  rc = MB_SetAccessMode(b_mortgage_payment_from_sale, MB_MODE_IDLE);
3470  if(FLAME_mortgage_payment_from_sale_message_board_write == 1 &&
3471  FLAME_mortgage_payment_from_sale_message_board_read == 0)
3472  rc = MB_SetAccessMode(b_mortgage_payment_from_sale, MB_MODE_WRITEONLY);
3473  if(FLAME_mortgage_payment_from_sale_message_board_write == 0 &&
3474  FLAME_mortgage_payment_from_sale_message_board_read == 1)
3475  rc = MB_SetAccessMode(b_mortgage_payment_from_sale, MB_MODE_READONLY);
3476  if(FLAME_mortgage_payment_from_sale_message_board_write == 1 &&
3477  FLAME_mortgage_payment_from_sale_message_board_read == 1)
3478  rc = MB_SetAccessMode(b_mortgage_payment_from_sale, MB_MODE_READWRITE);
3479  #ifdef ERRCHECK
3480  if (rc != MB_SUCCESS)
3481  {
3482  fprintf(stderr, "ERROR: Could not set access mode of 'mortgage_payment_from_sale' board\n");
3483  switch(rc) {
3484  case MB_ERR_INVALID:
3485  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
3486  break;
3487  case MB_ERR_LOCKED:
3488  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is locked\n");
3489  break;
3490  case MB_ERR_MEMALLOC:
3491  fprintf(stderr, "\t reason: out of memory\n");
3492  break;
3493  case MB_ERR_INTERNAL:
3494  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3495  break;
3496  default:
3497  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3498  break;
3499  }
3500 
3501  exit(rc);
3502  }
3503  #endif
3504  FLAME_mortgage_payment_message_board_write = 0;
3505  FLAME_mortgage_payment_message_board_read = 0;
3506  /* Sending agents */
3507  if(household_start_state->agents != NULL) FLAME_mortgage_payment_message_board_write = 1;
3508 
3509  /* Reading agents */
3510  if(bank_start_state->agents != NULL) FLAME_mortgage_payment_message_board_read = 1;
3511 
3512  /* Call message board library with details */
3513  if(FLAME_mortgage_payment_message_board_write == 0 &&
3514  FLAME_mortgage_payment_message_board_read == 0)
3515  rc = MB_SetAccessMode(b_mortgage_payment, MB_MODE_IDLE);
3516  if(FLAME_mortgage_payment_message_board_write == 1 &&
3517  FLAME_mortgage_payment_message_board_read == 0)
3518  rc = MB_SetAccessMode(b_mortgage_payment, MB_MODE_WRITEONLY);
3519  if(FLAME_mortgage_payment_message_board_write == 0 &&
3520  FLAME_mortgage_payment_message_board_read == 1)
3521  rc = MB_SetAccessMode(b_mortgage_payment, MB_MODE_READONLY);
3522  if(FLAME_mortgage_payment_message_board_write == 1 &&
3523  FLAME_mortgage_payment_message_board_read == 1)
3524  rc = MB_SetAccessMode(b_mortgage_payment, MB_MODE_READWRITE);
3525  #ifdef ERRCHECK
3526  if (rc != MB_SUCCESS)
3527  {
3528  fprintf(stderr, "ERROR: Could not set access mode of 'mortgage_payment' board\n");
3529  switch(rc) {
3530  case MB_ERR_INVALID:
3531  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
3532  break;
3533  case MB_ERR_LOCKED:
3534  fprintf(stderr, "\t reason: 'mortgage_payment' board is locked\n");
3535  break;
3536  case MB_ERR_MEMALLOC:
3537  fprintf(stderr, "\t reason: out of memory\n");
3538  break;
3539  case MB_ERR_INTERNAL:
3540  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3541  break;
3542  default:
3543  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3544  break;
3545  }
3546 
3547  exit(rc);
3548  }
3549  #endif
3550  FLAME_mortgage_writeoff_message_board_write = 0;
3551  FLAME_mortgage_writeoff_message_board_read = 0;
3552  /* Sending agents */
3553  if(household_start_state->agents != NULL) FLAME_mortgage_writeoff_message_board_write = 1;
3554 
3555  /* Reading agents */
3556  if(bank_start_state->agents != NULL) FLAME_mortgage_writeoff_message_board_read = 1;
3557 
3558  /* Call message board library with details */
3559  if(FLAME_mortgage_writeoff_message_board_write == 0 &&
3560  FLAME_mortgage_writeoff_message_board_read == 0)
3561  rc = MB_SetAccessMode(b_mortgage_writeoff, MB_MODE_IDLE);
3562  if(FLAME_mortgage_writeoff_message_board_write == 1 &&
3563  FLAME_mortgage_writeoff_message_board_read == 0)
3564  rc = MB_SetAccessMode(b_mortgage_writeoff, MB_MODE_WRITEONLY);
3565  if(FLAME_mortgage_writeoff_message_board_write == 0 &&
3566  FLAME_mortgage_writeoff_message_board_read == 1)
3567  rc = MB_SetAccessMode(b_mortgage_writeoff, MB_MODE_READONLY);
3568  if(FLAME_mortgage_writeoff_message_board_write == 1 &&
3569  FLAME_mortgage_writeoff_message_board_read == 1)
3570  rc = MB_SetAccessMode(b_mortgage_writeoff, MB_MODE_READWRITE);
3571  #ifdef ERRCHECK
3572  if (rc != MB_SUCCESS)
3573  {
3574  fprintf(stderr, "ERROR: Could not set access mode of 'mortgage_writeoff' board\n");
3575  switch(rc) {
3576  case MB_ERR_INVALID:
3577  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
3578  break;
3579  case MB_ERR_LOCKED:
3580  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is locked\n");
3581  break;
3582  case MB_ERR_MEMALLOC:
3583  fprintf(stderr, "\t reason: out of memory\n");
3584  break;
3585  case MB_ERR_INTERNAL:
3586  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3587  break;
3588  default:
3589  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3590  break;
3591  }
3592 
3593  exit(rc);
3594  }
3595  #endif
3596  FLAME_housing_transactions_summary_message_board_write = 0;
3597  FLAME_housing_transactions_summary_message_board_read = 0;
3598  /* Sending agents */
3599  if(reagency_start_state->agents != NULL) FLAME_housing_transactions_summary_message_board_write = 1;
3600 
3601  /* Reading agents */
3602  if(centralbank_start_state->agents != NULL) FLAME_housing_transactions_summary_message_board_read = 1;
3603 
3604  /* Call message board library with details */
3605  if(FLAME_housing_transactions_summary_message_board_write == 0 &&
3606  FLAME_housing_transactions_summary_message_board_read == 0)
3607  rc = MB_SetAccessMode(b_housing_transactions_summary, MB_MODE_IDLE);
3608  if(FLAME_housing_transactions_summary_message_board_write == 1 &&
3609  FLAME_housing_transactions_summary_message_board_read == 0)
3610  rc = MB_SetAccessMode(b_housing_transactions_summary, MB_MODE_WRITEONLY);
3611  if(FLAME_housing_transactions_summary_message_board_write == 0 &&
3612  FLAME_housing_transactions_summary_message_board_read == 1)
3613  rc = MB_SetAccessMode(b_housing_transactions_summary, MB_MODE_READONLY);
3614  if(FLAME_housing_transactions_summary_message_board_write == 1 &&
3615  FLAME_housing_transactions_summary_message_board_read == 1)
3616  rc = MB_SetAccessMode(b_housing_transactions_summary, MB_MODE_READWRITE);
3617  #ifdef ERRCHECK
3618  if (rc != MB_SUCCESS)
3619  {
3620  fprintf(stderr, "ERROR: Could not set access mode of 'housing_transactions_summary' board\n");
3621  switch(rc) {
3622  case MB_ERR_INVALID:
3623  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
3624  break;
3625  case MB_ERR_LOCKED:
3626  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is locked\n");
3627  break;
3628  case MB_ERR_MEMALLOC:
3629  fprintf(stderr, "\t reason: out of memory\n");
3630  break;
3631  case MB_ERR_INTERNAL:
3632  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3633  break;
3634  default:
3635  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3636  break;
3637  }
3638 
3639  exit(rc);
3640  }
3641  #endif
3642 
3643 
3644  /* Start timing */
3645  start = get_time();
3646 
3647  for(iteration_loop=iteration_number+1; iteration_loop < iteration_number+iteration_total+1; iteration_loop++)
3648  {
3649  interval = get_time();
3650 
3651  /* Print out iteration number */
3652 
3653  fprintf(stdout, "Iteration - %d\n", iteration_loop);
3654  (void)fflush(stdout);
3655 
3656  /* START OF ITERATION */
3657 
3658  /* Start sync message boards that don't write */
3659  if(FLAME_firm_bank_init_loans_message_board_write == 0)
3660  {
3661  /*printf("%d> firm_bank_init_loans message board sync start early as no agents sending any messages of this type\n", node_number);*/
3662 
3663  /* ********** sync message board here ********** */
3664  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_init_loans)\n");
3665  rc = MB_SyncStart(b_firm_bank_init_loans);
3666  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_init_loans)\n");
3667  #ifdef ERRCHECK
3668  if (rc != MB_SUCCESS)
3669  {
3670  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_init_loans' board\n");
3671  switch(rc) {
3672  case MB_ERR_INVALID:
3673  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
3674  break;
3675  case MB_ERR_LOCKED:
3676  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is locked\n");
3677  break;
3678  case MB_ERR_MEMALLOC:
3679  fprintf(stderr, "\t reason: out of memory\n");
3680  break;
3681  case MB_ERR_INTERNAL:
3682  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3683  break;
3684  default:
3685  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3686  break;
3687  }
3688 
3689 
3690  exit(rc);
3691  }
3692  #endif
3693  }
3694 
3695  /* Start sync message boards that don't write */
3696  if(FLAME_firm_bank_init_deposit_message_board_write == 0)
3697  {
3698  /*printf("%d> firm_bank_init_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3699 
3700  /* ********** sync message board here ********** */
3701  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_init_deposit)\n");
3702  rc = MB_SyncStart(b_firm_bank_init_deposit);
3703  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_init_deposit)\n");
3704  #ifdef ERRCHECK
3705  if (rc != MB_SUCCESS)
3706  {
3707  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_init_deposit' board\n");
3708  switch(rc) {
3709  case MB_ERR_INVALID:
3710  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
3711  break;
3712  case MB_ERR_LOCKED:
3713  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is locked\n");
3714  break;
3715  case MB_ERR_MEMALLOC:
3716  fprintf(stderr, "\t reason: out of memory\n");
3717  break;
3718  case MB_ERR_INTERNAL:
3719  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3720  break;
3721  default:
3722  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3723  break;
3724  }
3725 
3726 
3727  exit(rc);
3728  }
3729  #endif
3730  }
3731 
3732  /* Start sync message boards that don't write */
3733  if(FLAME_firm_bank_update_deposit_message_board_write == 0)
3734  {
3735  /*printf("%d> firm_bank_update_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3736 
3737  /* ********** sync message board here ********** */
3738  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_update_deposit)\n");
3739  rc = MB_SyncStart(b_firm_bank_update_deposit);
3740  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_update_deposit)\n");
3741  #ifdef ERRCHECK
3742  if (rc != MB_SUCCESS)
3743  {
3744  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_update_deposit' board\n");
3745  switch(rc) {
3746  case MB_ERR_INVALID:
3747  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
3748  break;
3749  case MB_ERR_LOCKED:
3750  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is locked\n");
3751  break;
3752  case MB_ERR_MEMALLOC:
3753  fprintf(stderr, "\t reason: out of memory\n");
3754  break;
3755  case MB_ERR_INTERNAL:
3756  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3757  break;
3758  default:
3759  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3760  break;
3761  }
3762 
3763 
3764  exit(rc);
3765  }
3766  #endif
3767  }
3768 
3769  /* Start sync message boards that don't write */
3770  if(FLAME_household_bank_init_mortgages_message_board_write == 0)
3771  {
3772  /*printf("%d> household_bank_init_mortgages message board sync start early as no agents sending any messages of this type\n", node_number);*/
3773 
3774  /* ********** sync message board here ********** */
3775  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_bank_init_mortgages)\n");
3776  rc = MB_SyncStart(b_household_bank_init_mortgages);
3777  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_bank_init_mortgages)\n");
3778  #ifdef ERRCHECK
3779  if (rc != MB_SUCCESS)
3780  {
3781  fprintf(stderr, "ERROR: Could not start sync of 'household_bank_init_mortgages' board\n");
3782  switch(rc) {
3783  case MB_ERR_INVALID:
3784  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
3785  break;
3786  case MB_ERR_LOCKED:
3787  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is locked\n");
3788  break;
3789  case MB_ERR_MEMALLOC:
3790  fprintf(stderr, "\t reason: out of memory\n");
3791  break;
3792  case MB_ERR_INTERNAL:
3793  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3794  break;
3795  default:
3796  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3797  break;
3798  }
3799 
3800 
3801  exit(rc);
3802  }
3803  #endif
3804  }
3805 
3806  /* Start sync message boards that don't write */
3807  if(FLAME_household_bank_init_deposit_message_board_write == 0)
3808  {
3809  /*printf("%d> household_bank_init_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3810 
3811  /* ********** sync message board here ********** */
3812  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_bank_init_deposit)\n");
3813  rc = MB_SyncStart(b_household_bank_init_deposit);
3814  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_bank_init_deposit)\n");
3815  #ifdef ERRCHECK
3816  if (rc != MB_SUCCESS)
3817  {
3818  fprintf(stderr, "ERROR: Could not start sync of 'household_bank_init_deposit' board\n");
3819  switch(rc) {
3820  case MB_ERR_INVALID:
3821  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
3822  break;
3823  case MB_ERR_LOCKED:
3824  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is locked\n");
3825  break;
3826  case MB_ERR_MEMALLOC:
3827  fprintf(stderr, "\t reason: out of memory\n");
3828  break;
3829  case MB_ERR_INTERNAL:
3830  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3831  break;
3832  default:
3833  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3834  break;
3835  }
3836 
3837 
3838  exit(rc);
3839  }
3840  #endif
3841  }
3842 
3843  /* Start sync message boards that don't write */
3844  if(FLAME_household_bank_update_deposit_message_board_write == 0)
3845  {
3846  /*printf("%d> household_bank_update_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3847 
3848  /* ********** sync message board here ********** */
3849  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_bank_update_deposit)\n");
3850  rc = MB_SyncStart(b_household_bank_update_deposit);
3851  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_bank_update_deposit)\n");
3852  #ifdef ERRCHECK
3853  if (rc != MB_SUCCESS)
3854  {
3855  fprintf(stderr, "ERROR: Could not start sync of 'household_bank_update_deposit' board\n");
3856  switch(rc) {
3857  case MB_ERR_INVALID:
3858  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
3859  break;
3860  case MB_ERR_LOCKED:
3861  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is locked\n");
3862  break;
3863  case MB_ERR_MEMALLOC:
3864  fprintf(stderr, "\t reason: out of memory\n");
3865  break;
3866  case MB_ERR_INTERNAL:
3867  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3868  break;
3869  default:
3870  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3871  break;
3872  }
3873 
3874 
3875  exit(rc);
3876  }
3877  #endif
3878  }
3879 
3880  /* Start sync message boards that don't write */
3881  if(FLAME_bank_centralbank_init_debt_message_board_write == 0)
3882  {
3883  /*printf("%d> bank_centralbank_init_debt message board sync start early as no agents sending any messages of this type\n", node_number);*/
3884 
3885  /* ********** sync message board here ********** */
3886  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_init_debt)\n");
3887  rc = MB_SyncStart(b_bank_centralbank_init_debt);
3888  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_init_debt)\n");
3889  #ifdef ERRCHECK
3890  if (rc != MB_SUCCESS)
3891  {
3892  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_init_debt' board\n");
3893  switch(rc) {
3894  case MB_ERR_INVALID:
3895  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
3896  break;
3897  case MB_ERR_LOCKED:
3898  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is locked\n");
3899  break;
3900  case MB_ERR_MEMALLOC:
3901  fprintf(stderr, "\t reason: out of memory\n");
3902  break;
3903  case MB_ERR_INTERNAL:
3904  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3905  break;
3906  default:
3907  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3908  break;
3909  }
3910 
3911 
3912  exit(rc);
3913  }
3914  #endif
3915  }
3916 
3917  /* Start sync message boards that don't write */
3918  if(FLAME_bank_centralbank_init_deposit_message_board_write == 0)
3919  {
3920  /*printf("%d> bank_centralbank_init_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3921 
3922  /* ********** sync message board here ********** */
3923  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_init_deposit)\n");
3924  rc = MB_SyncStart(b_bank_centralbank_init_deposit);
3925  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_init_deposit)\n");
3926  #ifdef ERRCHECK
3927  if (rc != MB_SUCCESS)
3928  {
3929  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_init_deposit' board\n");
3930  switch(rc) {
3931  case MB_ERR_INVALID:
3932  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
3933  break;
3934  case MB_ERR_LOCKED:
3935  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is locked\n");
3936  break;
3937  case MB_ERR_MEMALLOC:
3938  fprintf(stderr, "\t reason: out of memory\n");
3939  break;
3940  case MB_ERR_INTERNAL:
3941  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3942  break;
3943  default:
3944  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3945  break;
3946  }
3947 
3948 
3949  exit(rc);
3950  }
3951  #endif
3952  }
3953 
3954  /* Start sync message boards that don't write */
3955  if(FLAME_bank_centralbank_update_deposit_message_board_write == 0)
3956  {
3957  /*printf("%d> bank_centralbank_update_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3958 
3959  /* ********** sync message board here ********** */
3960  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_update_deposit)\n");
3961  rc = MB_SyncStart(b_bank_centralbank_update_deposit);
3962  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_update_deposit)\n");
3963  #ifdef ERRCHECK
3964  if (rc != MB_SUCCESS)
3965  {
3966  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_update_deposit' board\n");
3967  switch(rc) {
3968  case MB_ERR_INVALID:
3969  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
3970  break;
3971  case MB_ERR_LOCKED:
3972  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is locked\n");
3973  break;
3974  case MB_ERR_MEMALLOC:
3975  fprintf(stderr, "\t reason: out of memory\n");
3976  break;
3977  case MB_ERR_INTERNAL:
3978  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
3979  break;
3980  default:
3981  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
3982  break;
3983  }
3984 
3985 
3986  exit(rc);
3987  }
3988  #endif
3989  }
3990 
3991  /* Start sync message boards that don't write */
3992  if(FLAME_fund_centralbank_init_deposit_message_board_write == 0)
3993  {
3994  /*printf("%d> fund_centralbank_init_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
3995 
3996  /* ********** sync message board here ********** */
3997  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_centralbank_init_deposit)\n");
3998  rc = MB_SyncStart(b_fund_centralbank_init_deposit);
3999  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_centralbank_init_deposit)\n");
4000  #ifdef ERRCHECK
4001  if (rc != MB_SUCCESS)
4002  {
4003  fprintf(stderr, "ERROR: Could not start sync of 'fund_centralbank_init_deposit' board\n");
4004  switch(rc) {
4005  case MB_ERR_INVALID:
4006  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
4007  break;
4008  case MB_ERR_LOCKED:
4009  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is locked\n");
4010  break;
4011  case MB_ERR_MEMALLOC:
4012  fprintf(stderr, "\t reason: out of memory\n");
4013  break;
4014  case MB_ERR_INTERNAL:
4015  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4016  break;
4017  default:
4018  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4019  break;
4020  }
4021 
4022 
4023  exit(rc);
4024  }
4025  #endif
4026  }
4027 
4028  /* Start sync message boards that don't write */
4029  if(FLAME_fund_centralbank_update_deposit_message_board_write == 0)
4030  {
4031  /*printf("%d> fund_centralbank_update_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
4032 
4033  /* ********** sync message board here ********** */
4034  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_centralbank_update_deposit)\n");
4035  rc = MB_SyncStart(b_fund_centralbank_update_deposit);
4036  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_centralbank_update_deposit)\n");
4037  #ifdef ERRCHECK
4038  if (rc != MB_SUCCESS)
4039  {
4040  fprintf(stderr, "ERROR: Could not start sync of 'fund_centralbank_update_deposit' board\n");
4041  switch(rc) {
4042  case MB_ERR_INVALID:
4043  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
4044  break;
4045  case MB_ERR_LOCKED:
4046  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is locked\n");
4047  break;
4048  case MB_ERR_MEMALLOC:
4049  fprintf(stderr, "\t reason: out of memory\n");
4050  break;
4051  case MB_ERR_INTERNAL:
4052  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4053  break;
4054  default:
4055  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4056  break;
4057  }
4058 
4059 
4060  exit(rc);
4061  }
4062  #endif
4063  }
4064 
4065  /* Start sync message boards that don't write */
4066  if(FLAME_gov_centralbank_init_deposit_message_board_write == 0)
4067  {
4068  /*printf("%d> gov_centralbank_init_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
4069 
4070  /* ********** sync message board here ********** */
4071  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_init_deposit)\n");
4072  rc = MB_SyncStart(b_gov_centralbank_init_deposit);
4073  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_init_deposit)\n");
4074  #ifdef ERRCHECK
4075  if (rc != MB_SUCCESS)
4076  {
4077  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_init_deposit' board\n");
4078  switch(rc) {
4079  case MB_ERR_INVALID:
4080  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
4081  break;
4082  case MB_ERR_LOCKED:
4083  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is locked\n");
4084  break;
4085  case MB_ERR_MEMALLOC:
4086  fprintf(stderr, "\t reason: out of memory\n");
4087  break;
4088  case MB_ERR_INTERNAL:
4089  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4090  break;
4091  default:
4092  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4093  break;
4094  }
4095 
4096 
4097  exit(rc);
4098  }
4099  #endif
4100  }
4101 
4102  /* Start sync message boards that don't write */
4103  if(FLAME_gov_centralbank_update_deposit_message_board_write == 0)
4104  {
4105  /*printf("%d> gov_centralbank_update_deposit message board sync start early as no agents sending any messages of this type\n", node_number);*/
4106 
4107  /* ********** sync message board here ********** */
4108  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_update_deposit)\n");
4109  rc = MB_SyncStart(b_gov_centralbank_update_deposit);
4110  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_update_deposit)\n");
4111  #ifdef ERRCHECK
4112  if (rc != MB_SUCCESS)
4113  {
4114  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_update_deposit' board\n");
4115  switch(rc) {
4116  case MB_ERR_INVALID:
4117  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
4118  break;
4119  case MB_ERR_LOCKED:
4120  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is locked\n");
4121  break;
4122  case MB_ERR_MEMALLOC:
4123  fprintf(stderr, "\t reason: out of memory\n");
4124  break;
4125  case MB_ERR_INTERNAL:
4126  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4127  break;
4128  default:
4129  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4130  break;
4131  }
4132 
4133 
4134  exit(rc);
4135  }
4136  #endif
4137  }
4138 
4139  /* Start sync message boards that don't write */
4140  if(FLAME_interest_rate_message_board_write == 0)
4141  {
4142  /*printf("%d> interest_rate message board sync start early as no agents sending any messages of this type\n", node_number);*/
4143 
4144  /* ********** sync message board here ********** */
4145  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_interest_rate)\n");
4146  rc = MB_SyncStart(b_interest_rate);
4147  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_interest_rate)\n");
4148  #ifdef ERRCHECK
4149  if (rc != MB_SUCCESS)
4150  {
4151  fprintf(stderr, "ERROR: Could not start sync of 'interest_rate' board\n");
4152  switch(rc) {
4153  case MB_ERR_INVALID:
4154  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
4155  break;
4156  case MB_ERR_LOCKED:
4157  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
4158  break;
4159  case MB_ERR_MEMALLOC:
4160  fprintf(stderr, "\t reason: out of memory\n");
4161  break;
4162  case MB_ERR_INTERNAL:
4163  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4164  break;
4165  default:
4166  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4167  break;
4168  }
4169 
4170 
4171  exit(rc);
4172  }
4173  #endif
4174  }
4175 
4176  /* Start sync message boards that don't write */
4177  if(FLAME_capital_tax_rate_message_board_write == 0)
4178  {
4179  /*printf("%d> capital_tax_rate message board sync start early as no agents sending any messages of this type\n", node_number);*/
4180 
4181  /* ********** sync message board here ********** */
4182  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_capital_tax_rate)\n");
4183  rc = MB_SyncStart(b_capital_tax_rate);
4184  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_capital_tax_rate)\n");
4185  #ifdef ERRCHECK
4186  if (rc != MB_SUCCESS)
4187  {
4188  fprintf(stderr, "ERROR: Could not start sync of 'capital_tax_rate' board\n");
4189  switch(rc) {
4190  case MB_ERR_INVALID:
4191  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
4192  break;
4193  case MB_ERR_LOCKED:
4194  fprintf(stderr, "\t reason: 'capital_tax_rate' board is locked\n");
4195  break;
4196  case MB_ERR_MEMALLOC:
4197  fprintf(stderr, "\t reason: out of memory\n");
4198  break;
4199  case MB_ERR_INTERNAL:
4200  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4201  break;
4202  default:
4203  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4204  break;
4205  }
4206 
4207 
4208  exit(rc);
4209  }
4210  #endif
4211  }
4212 
4213  /* Start sync message boards that don't write */
4214  if(FLAME_labour_tax_rate_message_board_write == 0)
4215  {
4216  /*printf("%d> labour_tax_rate message board sync start early as no agents sending any messages of this type\n", node_number);*/
4217 
4218  /* ********** sync message board here ********** */
4219  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_labour_tax_rate)\n");
4220  rc = MB_SyncStart(b_labour_tax_rate);
4221  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_labour_tax_rate)\n");
4222  #ifdef ERRCHECK
4223  if (rc != MB_SUCCESS)
4224  {
4225  fprintf(stderr, "ERROR: Could not start sync of 'labour_tax_rate' board\n");
4226  switch(rc) {
4227  case MB_ERR_INVALID:
4228  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
4229  break;
4230  case MB_ERR_LOCKED:
4231  fprintf(stderr, "\t reason: 'labour_tax_rate' board is locked\n");
4232  break;
4233  case MB_ERR_MEMALLOC:
4234  fprintf(stderr, "\t reason: out of memory\n");
4235  break;
4236  case MB_ERR_INTERNAL:
4237  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4238  break;
4239  default:
4240  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4241  break;
4242  }
4243 
4244 
4245  exit(rc);
4246  }
4247  #endif
4248  }
4249 
4250  /* Start sync message boards that don't write */
4251  if(FLAME_household_jpoffice_id_message_board_write == 0)
4252  {
4253  /*printf("%d> household_jpoffice_id message board sync start early as no agents sending any messages of this type\n", node_number);*/
4254 
4255  /* ********** sync message board here ********** */
4256  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_jpoffice_id)\n");
4257  rc = MB_SyncStart(b_household_jpoffice_id);
4258  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_jpoffice_id)\n");
4259  #ifdef ERRCHECK
4260  if (rc != MB_SUCCESS)
4261  {
4262  fprintf(stderr, "ERROR: Could not start sync of 'household_jpoffice_id' board\n");
4263  switch(rc) {
4264  case MB_ERR_INVALID:
4265  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
4266  break;
4267  case MB_ERR_LOCKED:
4268  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is locked\n");
4269  break;
4270  case MB_ERR_MEMALLOC:
4271  fprintf(stderr, "\t reason: out of memory\n");
4272  break;
4273  case MB_ERR_INTERNAL:
4274  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4275  break;
4276  default:
4277  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4278  break;
4279  }
4280 
4281 
4282  exit(rc);
4283  }
4284  #endif
4285  }
4286 
4287  /* Start sync message boards that don't write */
4288  if(FLAME_jpoffice_household_employer_message_board_write == 0)
4289  {
4290  /*printf("%d> jpoffice_household_employer message board sync start early as no agents sending any messages of this type\n", node_number);*/
4291 
4292  /* ********** sync message board here ********** */
4293  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_jpoffice_household_employer)\n");
4294  rc = MB_SyncStart(b_jpoffice_household_employer);
4295  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_jpoffice_household_employer)\n");
4296  #ifdef ERRCHECK
4297  if (rc != MB_SUCCESS)
4298  {
4299  fprintf(stderr, "ERROR: Could not start sync of 'jpoffice_household_employer' board\n");
4300  switch(rc) {
4301  case MB_ERR_INVALID:
4302  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
4303  break;
4304  case MB_ERR_LOCKED:
4305  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is locked\n");
4306  break;
4307  case MB_ERR_MEMALLOC:
4308  fprintf(stderr, "\t reason: out of memory\n");
4309  break;
4310  case MB_ERR_INTERNAL:
4311  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4312  break;
4313  default:
4314  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4315  break;
4316  }
4317 
4318 
4319  exit(rc);
4320  }
4321  #endif
4322  }
4323 
4324  /* Start sync message boards that don't write */
4325  if(FLAME_firm_jpoffice_id_message_board_write == 0)
4326  {
4327  /*printf("%d> firm_jpoffice_id message board sync start early as no agents sending any messages of this type\n", node_number);*/
4328 
4329  /* ********** sync message board here ********** */
4330  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_jpoffice_id)\n");
4331  rc = MB_SyncStart(b_firm_jpoffice_id);
4332  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_jpoffice_id)\n");
4333  #ifdef ERRCHECK
4334  if (rc != MB_SUCCESS)
4335  {
4336  fprintf(stderr, "ERROR: Could not start sync of 'firm_jpoffice_id' board\n");
4337  switch(rc) {
4338  case MB_ERR_INVALID:
4339  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
4340  break;
4341  case MB_ERR_LOCKED:
4342  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is locked\n");
4343  break;
4344  case MB_ERR_MEMALLOC:
4345  fprintf(stderr, "\t reason: out of memory\n");
4346  break;
4347  case MB_ERR_INTERNAL:
4348  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4349  break;
4350  default:
4351  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4352  break;
4353  }
4354 
4355 
4356  exit(rc);
4357  }
4358  #endif
4359  }
4360 
4361  /* Start sync message boards that don't write */
4362  if(FLAME_jpoffice_firm_employee_message_board_write == 0)
4363  {
4364  /*printf("%d> jpoffice_firm_employee message board sync start early as no agents sending any messages of this type\n", node_number);*/
4365 
4366  /* ********** sync message board here ********** */
4367  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_jpoffice_firm_employee)\n");
4368  rc = MB_SyncStart(b_jpoffice_firm_employee);
4369  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_jpoffice_firm_employee)\n");
4370  #ifdef ERRCHECK
4371  if (rc != MB_SUCCESS)
4372  {
4373  fprintf(stderr, "ERROR: Could not start sync of 'jpoffice_firm_employee' board\n");
4374  switch(rc) {
4375  case MB_ERR_INVALID:
4376  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
4377  break;
4378  case MB_ERR_LOCKED:
4379  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is locked\n");
4380  break;
4381  case MB_ERR_MEMALLOC:
4382  fprintf(stderr, "\t reason: out of memory\n");
4383  break;
4384  case MB_ERR_INTERNAL:
4385  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4386  break;
4387  default:
4388  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4389  break;
4390  }
4391 
4392 
4393  exit(rc);
4394  }
4395  #endif
4396  }
4397 
4398  /* Start sync message boards that don't write */
4399  if(FLAME_buy_message_board_write == 0)
4400  {
4401  /*printf("%d> buy message board sync start early as no agents sending any messages of this type\n", node_number);*/
4402 
4403  /* ********** sync message board here ********** */
4404  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_buy)\n");
4405  rc = MB_SyncStart(b_buy);
4406  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_buy)\n");
4407  #ifdef ERRCHECK
4408  if (rc != MB_SUCCESS)
4409  {
4410  fprintf(stderr, "ERROR: Could not start sync of 'buy' board\n");
4411  switch(rc) {
4412  case MB_ERR_INVALID:
4413  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
4414  break;
4415  case MB_ERR_LOCKED:
4416  fprintf(stderr, "\t reason: 'buy' board is locked\n");
4417  break;
4418  case MB_ERR_MEMALLOC:
4419  fprintf(stderr, "\t reason: out of memory\n");
4420  break;
4421  case MB_ERR_INTERNAL:
4422  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4423  break;
4424  default:
4425  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4426  break;
4427  }
4428 
4429 
4430  exit(rc);
4431  }
4432  #endif
4433  }
4434 
4435  /* Start sync message boards that don't write */
4436  if(FLAME_bought_message_board_write == 0)
4437  {
4438  /*printf("%d> bought message board sync start early as no agents sending any messages of this type\n", node_number);*/
4439 
4440  /* ********** sync message board here ********** */
4441  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bought)\n");
4442  rc = MB_SyncStart(b_bought);
4443  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bought)\n");
4444  #ifdef ERRCHECK
4445  if (rc != MB_SUCCESS)
4446  {
4447  fprintf(stderr, "ERROR: Could not start sync of 'bought' board\n");
4448  switch(rc) {
4449  case MB_ERR_INVALID:
4450  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
4451  break;
4452  case MB_ERR_LOCKED:
4453  fprintf(stderr, "\t reason: 'bought' board is locked\n");
4454  break;
4455  case MB_ERR_MEMALLOC:
4456  fprintf(stderr, "\t reason: out of memory\n");
4457  break;
4458  case MB_ERR_INTERNAL:
4459  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4460  break;
4461  default:
4462  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4463  break;
4464  }
4465 
4466 
4467  exit(rc);
4468  }
4469  #endif
4470  }
4471 
4472  /* Start sync message boards that don't write */
4473  if(FLAME_sell_message_board_write == 0)
4474  {
4475  /*printf("%d> sell message board sync start early as no agents sending any messages of this type\n", node_number);*/
4476 
4477  /* ********** sync message board here ********** */
4478  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sell)\n");
4479  rc = MB_SyncStart(b_sell);
4480  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sell)\n");
4481  #ifdef ERRCHECK
4482  if (rc != MB_SUCCESS)
4483  {
4484  fprintf(stderr, "ERROR: Could not start sync of 'sell' board\n");
4485  switch(rc) {
4486  case MB_ERR_INVALID:
4487  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
4488  break;
4489  case MB_ERR_LOCKED:
4490  fprintf(stderr, "\t reason: 'sell' board is locked\n");
4491  break;
4492  case MB_ERR_MEMALLOC:
4493  fprintf(stderr, "\t reason: out of memory\n");
4494  break;
4495  case MB_ERR_INTERNAL:
4496  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4497  break;
4498  default:
4499  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4500  break;
4501  }
4502 
4503 
4504  exit(rc);
4505  }
4506  #endif
4507  }
4508 
4509  /* Start sync message boards that don't write */
4510  if(FLAME_sold_message_board_write == 0)
4511  {
4512  /*printf("%d> sold message board sync start early as no agents sending any messages of this type\n", node_number);*/
4513 
4514  /* ********** sync message board here ********** */
4515  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sold)\n");
4516  rc = MB_SyncStart(b_sold);
4517  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sold)\n");
4518  #ifdef ERRCHECK
4519  if (rc != MB_SUCCESS)
4520  {
4521  fprintf(stderr, "ERROR: Could not start sync of 'sold' board\n");
4522  switch(rc) {
4523  case MB_ERR_INVALID:
4524  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
4525  break;
4526  case MB_ERR_LOCKED:
4527  fprintf(stderr, "\t reason: 'sold' board is locked\n");
4528  break;
4529  case MB_ERR_MEMALLOC:
4530  fprintf(stderr, "\t reason: out of memory\n");
4531  break;
4532  case MB_ERR_INTERNAL:
4533  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4534  break;
4535  default:
4536  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4537  break;
4538  }
4539 
4540 
4541  exit(rc);
4542  }
4543  #endif
4544  }
4545 
4546  /* Start sync message boards that don't write */
4547  if(FLAME_goods_transactions_summary_message_board_write == 0)
4548  {
4549  /*printf("%d> goods_transactions_summary message board sync start early as no agents sending any messages of this type\n", node_number);*/
4550 
4551  /* ********** sync message board here ********** */
4552  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_goods_transactions_summary)\n");
4553  rc = MB_SyncStart(b_goods_transactions_summary);
4554  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_goods_transactions_summary)\n");
4555  #ifdef ERRCHECK
4556  if (rc != MB_SUCCESS)
4557  {
4558  fprintf(stderr, "ERROR: Could not start sync of 'goods_transactions_summary' board\n");
4559  switch(rc) {
4560  case MB_ERR_INVALID:
4561  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
4562  break;
4563  case MB_ERR_LOCKED:
4564  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is locked\n");
4565  break;
4566  case MB_ERR_MEMALLOC:
4567  fprintf(stderr, "\t reason: out of memory\n");
4568  break;
4569  case MB_ERR_INTERNAL:
4570  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4571  break;
4572  default:
4573  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4574  break;
4575  }
4576 
4577 
4578  exit(rc);
4579  }
4580  #endif
4581  }
4582 
4583  /* Start sync message boards that don't write */
4584  if(FLAME_centralbank_households_quarterly_cpi_message_board_write == 0)
4585  {
4586  /*printf("%d> centralbank_households_quarterly_cpi message board sync start early as no agents sending any messages of this type\n", node_number);*/
4587 
4588  /* ********** sync message board here ********** */
4589  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_centralbank_households_quarterly_cpi)\n");
4590  rc = MB_SyncStart(b_centralbank_households_quarterly_cpi);
4591  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_centralbank_households_quarterly_cpi)\n");
4592  #ifdef ERRCHECK
4593  if (rc != MB_SUCCESS)
4594  {
4595  fprintf(stderr, "ERROR: Could not start sync of 'centralbank_households_quarterly_cpi' board\n");
4596  switch(rc) {
4597  case MB_ERR_INVALID:
4598  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
4599  break;
4600  case MB_ERR_LOCKED:
4601  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is locked\n");
4602  break;
4603  case MB_ERR_MEMALLOC:
4604  fprintf(stderr, "\t reason: out of memory\n");
4605  break;
4606  case MB_ERR_INTERNAL:
4607  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4608  break;
4609  default:
4610  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4611  break;
4612  }
4613 
4614 
4615  exit(rc);
4616  }
4617  #endif
4618  }
4619 
4620  /* Start sync message boards that don't write */
4621  if(FLAME_fired_message_board_write == 0)
4622  {
4623  /*printf("%d> fired message board sync start early as no agents sending any messages of this type\n", node_number);*/
4624 
4625  /* ********** sync message board here ********** */
4626  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fired)\n");
4627  rc = MB_SyncStart(b_fired);
4628  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fired)\n");
4629  #ifdef ERRCHECK
4630  if (rc != MB_SUCCESS)
4631  {
4632  fprintf(stderr, "ERROR: Could not start sync of 'fired' board\n");
4633  switch(rc) {
4634  case MB_ERR_INVALID:
4635  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
4636  break;
4637  case MB_ERR_LOCKED:
4638  fprintf(stderr, "\t reason: 'fired' board is locked\n");
4639  break;
4640  case MB_ERR_MEMALLOC:
4641  fprintf(stderr, "\t reason: out of memory\n");
4642  break;
4643  case MB_ERR_INTERNAL:
4644  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4645  break;
4646  default:
4647  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4648  break;
4649  }
4650 
4651 
4652  exit(rc);
4653  }
4654  #endif
4655  }
4656 
4657  /* Start sync message boards that don't write */
4658  if(FLAME_vacancy_stage1_message_board_write == 0)
4659  {
4660  /*printf("%d> vacancy_stage1 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4661 
4662  /* ********** sync message board here ********** */
4663  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_vacancy_stage1)\n");
4664  rc = MB_SyncStart(b_vacancy_stage1);
4665  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_vacancy_stage1)\n");
4666  #ifdef ERRCHECK
4667  if (rc != MB_SUCCESS)
4668  {
4669  fprintf(stderr, "ERROR: Could not start sync of 'vacancy_stage1' board\n");
4670  switch(rc) {
4671  case MB_ERR_INVALID:
4672  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
4673  break;
4674  case MB_ERR_LOCKED:
4675  fprintf(stderr, "\t reason: 'vacancy_stage1' board is locked\n");
4676  break;
4677  case MB_ERR_MEMALLOC:
4678  fprintf(stderr, "\t reason: out of memory\n");
4679  break;
4680  case MB_ERR_INTERNAL:
4681  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4682  break;
4683  default:
4684  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4685  break;
4686  }
4687 
4688 
4689  exit(rc);
4690  }
4691  #endif
4692  }
4693 
4694  /* Start sync message boards that don't write */
4695  if(FLAME_job_application_stage2_message_board_write == 0)
4696  {
4697  /*printf("%d> job_application_stage2 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4698 
4699  /* ********** sync message board here ********** */
4700  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_application_stage2)\n");
4701  rc = MB_SyncStart(b_job_application_stage2);
4702  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_application_stage2)\n");
4703  #ifdef ERRCHECK
4704  if (rc != MB_SUCCESS)
4705  {
4706  fprintf(stderr, "ERROR: Could not start sync of 'job_application_stage2' board\n");
4707  switch(rc) {
4708  case MB_ERR_INVALID:
4709  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
4710  break;
4711  case MB_ERR_LOCKED:
4712  fprintf(stderr, "\t reason: 'job_application_stage2' board is locked\n");
4713  break;
4714  case MB_ERR_MEMALLOC:
4715  fprintf(stderr, "\t reason: out of memory\n");
4716  break;
4717  case MB_ERR_INTERNAL:
4718  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4719  break;
4720  default:
4721  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4722  break;
4723  }
4724 
4725 
4726  exit(rc);
4727  }
4728  #endif
4729  }
4730 
4731  /* Start sync message boards that don't write */
4732  if(FLAME_job_application_stage1_message_board_write == 0)
4733  {
4734  /*printf("%d> job_application_stage1 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4735 
4736  /* ********** sync message board here ********** */
4737  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_application_stage1)\n");
4738  rc = MB_SyncStart(b_job_application_stage1);
4739  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_application_stage1)\n");
4740  #ifdef ERRCHECK
4741  if (rc != MB_SUCCESS)
4742  {
4743  fprintf(stderr, "ERROR: Could not start sync of 'job_application_stage1' board\n");
4744  switch(rc) {
4745  case MB_ERR_INVALID:
4746  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
4747  break;
4748  case MB_ERR_LOCKED:
4749  fprintf(stderr, "\t reason: 'job_application_stage1' board is locked\n");
4750  break;
4751  case MB_ERR_MEMALLOC:
4752  fprintf(stderr, "\t reason: out of memory\n");
4753  break;
4754  case MB_ERR_INTERNAL:
4755  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4756  break;
4757  default:
4758  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4759  break;
4760  }
4761 
4762 
4763  exit(rc);
4764  }
4765  #endif
4766  }
4767 
4768  /* Start sync message boards that don't write */
4769  if(FLAME_job_match_stage1_message_board_write == 0)
4770  {
4771  /*printf("%d> job_match_stage1 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4772 
4773  /* ********** sync message board here ********** */
4774  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_match_stage1)\n");
4775  rc = MB_SyncStart(b_job_match_stage1);
4776  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_match_stage1)\n");
4777  #ifdef ERRCHECK
4778  if (rc != MB_SUCCESS)
4779  {
4780  fprintf(stderr, "ERROR: Could not start sync of 'job_match_stage1' board\n");
4781  switch(rc) {
4782  case MB_ERR_INVALID:
4783  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
4784  break;
4785  case MB_ERR_LOCKED:
4786  fprintf(stderr, "\t reason: 'job_match_stage1' board is locked\n");
4787  break;
4788  case MB_ERR_MEMALLOC:
4789  fprintf(stderr, "\t reason: out of memory\n");
4790  break;
4791  case MB_ERR_INTERNAL:
4792  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4793  break;
4794  default:
4795  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4796  break;
4797  }
4798 
4799 
4800  exit(rc);
4801  }
4802  #endif
4803  }
4804 
4805  /* Start sync message boards that don't write */
4806  if(FLAME_job_change_message_board_write == 0)
4807  {
4808  /*printf("%d> job_change message board sync start early as no agents sending any messages of this type\n", node_number);*/
4809 
4810  /* ********** sync message board here ********** */
4811  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_change)\n");
4812  rc = MB_SyncStart(b_job_change);
4813  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_change)\n");
4814  #ifdef ERRCHECK
4815  if (rc != MB_SUCCESS)
4816  {
4817  fprintf(stderr, "ERROR: Could not start sync of 'job_change' board\n");
4818  switch(rc) {
4819  case MB_ERR_INVALID:
4820  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
4821  break;
4822  case MB_ERR_LOCKED:
4823  fprintf(stderr, "\t reason: 'job_change' board is locked\n");
4824  break;
4825  case MB_ERR_MEMALLOC:
4826  fprintf(stderr, "\t reason: out of memory\n");
4827  break;
4828  case MB_ERR_INTERNAL:
4829  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4830  break;
4831  default:
4832  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4833  break;
4834  }
4835 
4836 
4837  exit(rc);
4838  }
4839  #endif
4840  }
4841 
4842  /* Start sync message boards that don't write */
4843  if(FLAME_vacancy_stage2_message_board_write == 0)
4844  {
4845  /*printf("%d> vacancy_stage2 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4846 
4847  /* ********** sync message board here ********** */
4848  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_vacancy_stage2)\n");
4849  rc = MB_SyncStart(b_vacancy_stage2);
4850  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_vacancy_stage2)\n");
4851  #ifdef ERRCHECK
4852  if (rc != MB_SUCCESS)
4853  {
4854  fprintf(stderr, "ERROR: Could not start sync of 'vacancy_stage2' board\n");
4855  switch(rc) {
4856  case MB_ERR_INVALID:
4857  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
4858  break;
4859  case MB_ERR_LOCKED:
4860  fprintf(stderr, "\t reason: 'vacancy_stage2' board is locked\n");
4861  break;
4862  case MB_ERR_MEMALLOC:
4863  fprintf(stderr, "\t reason: out of memory\n");
4864  break;
4865  case MB_ERR_INTERNAL:
4866  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4867  break;
4868  default:
4869  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4870  break;
4871  }
4872 
4873 
4874  exit(rc);
4875  }
4876  #endif
4877  }
4878 
4879  /* Start sync message boards that don't write */
4880  if(FLAME_job_match_stage2_message_board_write == 0)
4881  {
4882  /*printf("%d> job_match_stage2 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4883 
4884  /* ********** sync message board here ********** */
4885  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_match_stage2)\n");
4886  rc = MB_SyncStart(b_job_match_stage2);
4887  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_match_stage2)\n");
4888  #ifdef ERRCHECK
4889  if (rc != MB_SUCCESS)
4890  {
4891  fprintf(stderr, "ERROR: Could not start sync of 'job_match_stage2' board\n");
4892  switch(rc) {
4893  case MB_ERR_INVALID:
4894  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
4895  break;
4896  case MB_ERR_LOCKED:
4897  fprintf(stderr, "\t reason: 'job_match_stage2' board is locked\n");
4898  break;
4899  case MB_ERR_MEMALLOC:
4900  fprintf(stderr, "\t reason: out of memory\n");
4901  break;
4902  case MB_ERR_INTERNAL:
4903  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4904  break;
4905  default:
4906  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4907  break;
4908  }
4909 
4910 
4911  exit(rc);
4912  }
4913  #endif
4914  }
4915 
4916  /* Start sync message boards that don't write */
4917  if(FLAME_employment_status_message_board_write == 0)
4918  {
4919  /*printf("%d> employment_status message board sync start early as no agents sending any messages of this type\n", node_number);*/
4920 
4921  /* ********** sync message board here ********** */
4922  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_employment_status)\n");
4923  rc = MB_SyncStart(b_employment_status);
4924  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_employment_status)\n");
4925  #ifdef ERRCHECK
4926  if (rc != MB_SUCCESS)
4927  {
4928  fprintf(stderr, "ERROR: Could not start sync of 'employment_status' board\n");
4929  switch(rc) {
4930  case MB_ERR_INVALID:
4931  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
4932  break;
4933  case MB_ERR_LOCKED:
4934  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
4935  break;
4936  case MB_ERR_MEMALLOC:
4937  fprintf(stderr, "\t reason: out of memory\n");
4938  break;
4939  case MB_ERR_INTERNAL:
4940  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4941  break;
4942  default:
4943  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4944  break;
4945  }
4946 
4947 
4948  exit(rc);
4949  }
4950  #endif
4951  }
4952 
4953  /* Start sync message boards that don't write */
4954  if(FLAME_firm_household_wage_payment_message_board_write == 0)
4955  {
4956  /*printf("%d> firm_household_wage_payment message board sync start early as no agents sending any messages of this type\n", node_number);*/
4957 
4958  /* ********** sync message board here ********** */
4959  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_household_wage_payment)\n");
4960  rc = MB_SyncStart(b_firm_household_wage_payment);
4961  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_household_wage_payment)\n");
4962  #ifdef ERRCHECK
4963  if (rc != MB_SUCCESS)
4964  {
4965  fprintf(stderr, "ERROR: Could not start sync of 'firm_household_wage_payment' board\n");
4966  switch(rc) {
4967  case MB_ERR_INVALID:
4968  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
4969  break;
4970  case MB_ERR_LOCKED:
4971  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is locked\n");
4972  break;
4973  case MB_ERR_MEMALLOC:
4974  fprintf(stderr, "\t reason: out of memory\n");
4975  break;
4976  case MB_ERR_INTERNAL:
4977  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
4978  break;
4979  default:
4980  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
4981  break;
4982  }
4983 
4984 
4985  exit(rc);
4986  }
4987  #endif
4988  }
4989 
4990  /* Start sync message boards that don't write */
4991  if(FLAME_firm_bank_loan_request_1_message_board_write == 0)
4992  {
4993  /*printf("%d> firm_bank_loan_request_1 message board sync start early as no agents sending any messages of this type\n", node_number);*/
4994 
4995  /* ********** sync message board here ********** */
4996  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_loan_request_1)\n");
4997  rc = MB_SyncStart(b_firm_bank_loan_request_1);
4998  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_loan_request_1)\n");
4999  #ifdef ERRCHECK
5000  if (rc != MB_SUCCESS)
5001  {
5002  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_loan_request_1' board\n");
5003  switch(rc) {
5004  case MB_ERR_INVALID:
5005  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
5006  break;
5007  case MB_ERR_LOCKED:
5008  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is locked\n");
5009  break;
5010  case MB_ERR_MEMALLOC:
5011  fprintf(stderr, "\t reason: out of memory\n");
5012  break;
5013  case MB_ERR_INTERNAL:
5014  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5015  break;
5016  default:
5017  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5018  break;
5019  }
5020 
5021 
5022  exit(rc);
5023  }
5024  #endif
5025  }
5026 
5027  /* Start sync message boards that don't write */
5028  if(FLAME_firm_bank_loan_request_2_message_board_write == 0)
5029  {
5030  /*printf("%d> firm_bank_loan_request_2 message board sync start early as no agents sending any messages of this type\n", node_number);*/
5031 
5032  /* ********** sync message board here ********** */
5033  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_loan_request_2)\n");
5034  rc = MB_SyncStart(b_firm_bank_loan_request_2);
5035  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_loan_request_2)\n");
5036  #ifdef ERRCHECK
5037  if (rc != MB_SUCCESS)
5038  {
5039  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_loan_request_2' board\n");
5040  switch(rc) {
5041  case MB_ERR_INVALID:
5042  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
5043  break;
5044  case MB_ERR_LOCKED:
5045  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is locked\n");
5046  break;
5047  case MB_ERR_MEMALLOC:
5048  fprintf(stderr, "\t reason: out of memory\n");
5049  break;
5050  case MB_ERR_INTERNAL:
5051  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5052  break;
5053  default:
5054  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5055  break;
5056  }
5057 
5058 
5059  exit(rc);
5060  }
5061  #endif
5062  }
5063 
5064  /* Start sync message boards that don't write */
5065  if(FLAME_bank_firm_loan_acknowledge_1_message_board_write == 0)
5066  {
5067  /*printf("%d> bank_firm_loan_acknowledge_1 message board sync start early as no agents sending any messages of this type\n", node_number);*/
5068 
5069  /* ********** sync message board here ********** */
5070  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_firm_loan_acknowledge_1)\n");
5071  rc = MB_SyncStart(b_bank_firm_loan_acknowledge_1);
5072  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_firm_loan_acknowledge_1)\n");
5073  #ifdef ERRCHECK
5074  if (rc != MB_SUCCESS)
5075  {
5076  fprintf(stderr, "ERROR: Could not start sync of 'bank_firm_loan_acknowledge_1' board\n");
5077  switch(rc) {
5078  case MB_ERR_INVALID:
5079  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
5080  break;
5081  case MB_ERR_LOCKED:
5082  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is locked\n");
5083  break;
5084  case MB_ERR_MEMALLOC:
5085  fprintf(stderr, "\t reason: out of memory\n");
5086  break;
5087  case MB_ERR_INTERNAL:
5088  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5089  break;
5090  default:
5091  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5092  break;
5093  }
5094 
5095 
5096  exit(rc);
5097  }
5098  #endif
5099  }
5100 
5101  /* Start sync message boards that don't write */
5102  if(FLAME_bank_firm_loan_acknowledge_2_message_board_write == 0)
5103  {
5104  /*printf("%d> bank_firm_loan_acknowledge_2 message board sync start early as no agents sending any messages of this type\n", node_number);*/
5105 
5106  /* ********** sync message board here ********** */
5107  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_firm_loan_acknowledge_2)\n");
5108  rc = MB_SyncStart(b_bank_firm_loan_acknowledge_2);
5109  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_firm_loan_acknowledge_2)\n");
5110  #ifdef ERRCHECK
5111  if (rc != MB_SUCCESS)
5112  {
5113  fprintf(stderr, "ERROR: Could not start sync of 'bank_firm_loan_acknowledge_2' board\n");
5114  switch(rc) {
5115  case MB_ERR_INVALID:
5116  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
5117  break;
5118  case MB_ERR_LOCKED:
5119  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is locked\n");
5120  break;
5121  case MB_ERR_MEMALLOC:
5122  fprintf(stderr, "\t reason: out of memory\n");
5123  break;
5124  case MB_ERR_INTERNAL:
5125  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5126  break;
5127  default:
5128  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5129  break;
5130  }
5131 
5132 
5133  exit(rc);
5134  }
5135  #endif
5136  }
5137 
5138  /* Start sync message boards that don't write */
5139  if(FLAME_bank_centralbank_debt_request_message_board_write == 0)
5140  {
5141  /*printf("%d> bank_centralbank_debt_request message board sync start early as no agents sending any messages of this type\n", node_number);*/
5142 
5143  /* ********** sync message board here ********** */
5144  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_debt_request)\n");
5145  rc = MB_SyncStart(b_bank_centralbank_debt_request);
5146  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_debt_request)\n");
5147  #ifdef ERRCHECK
5148  if (rc != MB_SUCCESS)
5149  {
5150  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_debt_request' board\n");
5151  switch(rc) {
5152  case MB_ERR_INVALID:
5153  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
5154  break;
5155  case MB_ERR_LOCKED:
5156  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is locked\n");
5157  break;
5158  case MB_ERR_MEMALLOC:
5159  fprintf(stderr, "\t reason: out of memory\n");
5160  break;
5161  case MB_ERR_INTERNAL:
5162  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5163  break;
5164  default:
5165  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5166  break;
5167  }
5168 
5169 
5170  exit(rc);
5171  }
5172  #endif
5173  }
5174 
5175  /* Start sync message boards that don't write */
5176  if(FLAME_household_share_message_board_write == 0)
5177  {
5178  /*printf("%d> household_share message board sync start early as no agents sending any messages of this type\n", node_number);*/
5179 
5180  /* ********** sync message board here ********** */
5181  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_share)\n");
5182  rc = MB_SyncStart(b_household_share);
5183  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_share)\n");
5184  #ifdef ERRCHECK
5185  if (rc != MB_SUCCESS)
5186  {
5187  fprintf(stderr, "ERROR: Could not start sync of 'household_share' board\n");
5188  switch(rc) {
5189  case MB_ERR_INVALID:
5190  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
5191  break;
5192  case MB_ERR_LOCKED:
5193  fprintf(stderr, "\t reason: 'household_share' board is locked\n");
5194  break;
5195  case MB_ERR_MEMALLOC:
5196  fprintf(stderr, "\t reason: out of memory\n");
5197  break;
5198  case MB_ERR_INTERNAL:
5199  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5200  break;
5201  default:
5202  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5203  break;
5204  }
5205 
5206 
5207  exit(rc);
5208  }
5209  #endif
5210  }
5211 
5212  /* Start sync message boards that don't write */
5213  if(FLAME_capital_tax_message_board_write == 0)
5214  {
5215  /*printf("%d> capital_tax message board sync start early as no agents sending any messages of this type\n", node_number);*/
5216 
5217  /* ********** sync message board here ********** */
5218  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_capital_tax)\n");
5219  rc = MB_SyncStart(b_capital_tax);
5220  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_capital_tax)\n");
5221  #ifdef ERRCHECK
5222  if (rc != MB_SUCCESS)
5223  {
5224  fprintf(stderr, "ERROR: Could not start sync of 'capital_tax' board\n");
5225  switch(rc) {
5226  case MB_ERR_INVALID:
5227  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
5228  break;
5229  case MB_ERR_LOCKED:
5230  fprintf(stderr, "\t reason: 'capital_tax' board is locked\n");
5231  break;
5232  case MB_ERR_MEMALLOC:
5233  fprintf(stderr, "\t reason: out of memory\n");
5234  break;
5235  case MB_ERR_INTERNAL:
5236  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5237  break;
5238  default:
5239  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5240  break;
5241  }
5242 
5243 
5244  exit(rc);
5245  }
5246  #endif
5247  }
5248 
5249  /* Start sync message boards that don't write */
5250  if(FLAME_labour_tax_message_board_write == 0)
5251  {
5252  /*printf("%d> labour_tax message board sync start early as no agents sending any messages of this type\n", node_number);*/
5253 
5254  /* ********** sync message board here ********** */
5255  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_labour_tax)\n");
5256  rc = MB_SyncStart(b_labour_tax);
5257  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_labour_tax)\n");
5258  #ifdef ERRCHECK
5259  if (rc != MB_SUCCESS)
5260  {
5261  fprintf(stderr, "ERROR: Could not start sync of 'labour_tax' board\n");
5262  switch(rc) {
5263  case MB_ERR_INVALID:
5264  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
5265  break;
5266  case MB_ERR_LOCKED:
5267  fprintf(stderr, "\t reason: 'labour_tax' board is locked\n");
5268  break;
5269  case MB_ERR_MEMALLOC:
5270  fprintf(stderr, "\t reason: out of memory\n");
5271  break;
5272  case MB_ERR_INTERNAL:
5273  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5274  break;
5275  default:
5276  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5277  break;
5278  }
5279 
5280 
5281  exit(rc);
5282  }
5283  #endif
5284  }
5285 
5286  /* Start sync message boards that don't write */
5287  if(FLAME_unemployment_benefit_message_board_write == 0)
5288  {
5289  /*printf("%d> unemployment_benefit message board sync start early as no agents sending any messages of this type\n", node_number);*/
5290 
5291  /* ********** sync message board here ********** */
5292  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_unemployment_benefit)\n");
5293  rc = MB_SyncStart(b_unemployment_benefit);
5294  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_unemployment_benefit)\n");
5295  #ifdef ERRCHECK
5296  if (rc != MB_SUCCESS)
5297  {
5298  fprintf(stderr, "ERROR: Could not start sync of 'unemployment_benefit' board\n");
5299  switch(rc) {
5300  case MB_ERR_INVALID:
5301  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
5302  break;
5303  case MB_ERR_LOCKED:
5304  fprintf(stderr, "\t reason: 'unemployment_benefit' board is locked\n");
5305  break;
5306  case MB_ERR_MEMALLOC:
5307  fprintf(stderr, "\t reason: out of memory\n");
5308  break;
5309  case MB_ERR_INTERNAL:
5310  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5311  break;
5312  default:
5313  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5314  break;
5315  }
5316 
5317 
5318  exit(rc);
5319  }
5320  #endif
5321  }
5322 
5323  /* Start sync message boards that don't write */
5324  if(FLAME_general_benefit_message_board_write == 0)
5325  {
5326  /*printf("%d> general_benefit message board sync start early as no agents sending any messages of this type\n", node_number);*/
5327 
5328  /* ********** sync message board here ********** */
5329  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_general_benefit)\n");
5330  rc = MB_SyncStart(b_general_benefit);
5331  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_general_benefit)\n");
5332  #ifdef ERRCHECK
5333  if (rc != MB_SUCCESS)
5334  {
5335  fprintf(stderr, "ERROR: Could not start sync of 'general_benefit' board\n");
5336  switch(rc) {
5337  case MB_ERR_INVALID:
5338  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
5339  break;
5340  case MB_ERR_LOCKED:
5341  fprintf(stderr, "\t reason: 'general_benefit' board is locked\n");
5342  break;
5343  case MB_ERR_MEMALLOC:
5344  fprintf(stderr, "\t reason: out of memory\n");
5345  break;
5346  case MB_ERR_INTERNAL:
5347  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5348  break;
5349  default:
5350  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5351  break;
5352  }
5353 
5354 
5355  exit(rc);
5356  }
5357  #endif
5358  }
5359 
5360  /* Start sync message boards that don't write */
5361  if(FLAME_fund_request_message_board_write == 0)
5362  {
5363  /*printf("%d> fund_request message board sync start early as no agents sending any messages of this type\n", node_number);*/
5364 
5365  /* ********** sync message board here ********** */
5366  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_request)\n");
5367  rc = MB_SyncStart(b_fund_request);
5368  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_request)\n");
5369  #ifdef ERRCHECK
5370  if (rc != MB_SUCCESS)
5371  {
5372  fprintf(stderr, "ERROR: Could not start sync of 'fund_request' board\n");
5373  switch(rc) {
5374  case MB_ERR_INVALID:
5375  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
5376  break;
5377  case MB_ERR_LOCKED:
5378  fprintf(stderr, "\t reason: 'fund_request' board is locked\n");
5379  break;
5380  case MB_ERR_MEMALLOC:
5381  fprintf(stderr, "\t reason: out of memory\n");
5382  break;
5383  case MB_ERR_INTERNAL:
5384  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5385  break;
5386  default:
5387  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5388  break;
5389  }
5390 
5391 
5392  exit(rc);
5393  }
5394  #endif
5395  }
5396 
5397  /* Start sync message boards that don't write */
5398  if(FLAME_fund_request_ack_message_board_write == 0)
5399  {
5400  /*printf("%d> fund_request_ack message board sync start early as no agents sending any messages of this type\n", node_number);*/
5401 
5402  /* ********** sync message board here ********** */
5403  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_request_ack)\n");
5404  rc = MB_SyncStart(b_fund_request_ack);
5405  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_request_ack)\n");
5406  #ifdef ERRCHECK
5407  if (rc != MB_SUCCESS)
5408  {
5409  fprintf(stderr, "ERROR: Could not start sync of 'fund_request_ack' board\n");
5410  switch(rc) {
5411  case MB_ERR_INVALID:
5412  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
5413  break;
5414  case MB_ERR_LOCKED:
5415  fprintf(stderr, "\t reason: 'fund_request_ack' board is locked\n");
5416  break;
5417  case MB_ERR_MEMALLOC:
5418  fprintf(stderr, "\t reason: out of memory\n");
5419  break;
5420  case MB_ERR_INTERNAL:
5421  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5422  break;
5423  default:
5424  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5425  break;
5426  }
5427 
5428 
5429  exit(rc);
5430  }
5431  #endif
5432  }
5433 
5434  /* Start sync message boards that don't write */
5435  if(FLAME_new_entrant_loan_message_board_write == 0)
5436  {
5437  /*printf("%d> new_entrant_loan message board sync start early as no agents sending any messages of this type\n", node_number);*/
5438 
5439  /* ********** sync message board here ********** */
5440  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_new_entrant_loan)\n");
5441  rc = MB_SyncStart(b_new_entrant_loan);
5442  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_new_entrant_loan)\n");
5443  #ifdef ERRCHECK
5444  if (rc != MB_SUCCESS)
5445  {
5446  fprintf(stderr, "ERROR: Could not start sync of 'new_entrant_loan' board\n");
5447  switch(rc) {
5448  case MB_ERR_INVALID:
5449  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
5450  break;
5451  case MB_ERR_LOCKED:
5452  fprintf(stderr, "\t reason: 'new_entrant_loan' board is locked\n");
5453  break;
5454  case MB_ERR_MEMALLOC:
5455  fprintf(stderr, "\t reason: out of memory\n");
5456  break;
5457  case MB_ERR_INTERNAL:
5458  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5459  break;
5460  default:
5461  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5462  break;
5463  }
5464 
5465 
5466  exit(rc);
5467  }
5468  #endif
5469  }
5470 
5471  /* Start sync message boards that don't write */
5472  if(FLAME_firm_bank_interest_on_loan_message_board_write == 0)
5473  {
5474  /*printf("%d> firm_bank_interest_on_loan message board sync start early as no agents sending any messages of this type\n", node_number);*/
5475 
5476  /* ********** sync message board here ********** */
5477  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_interest_on_loan)\n");
5478  rc = MB_SyncStart(b_firm_bank_interest_on_loan);
5479  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_interest_on_loan)\n");
5480  #ifdef ERRCHECK
5481  if (rc != MB_SUCCESS)
5482  {
5483  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_interest_on_loan' board\n");
5484  switch(rc) {
5485  case MB_ERR_INVALID:
5486  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
5487  break;
5488  case MB_ERR_LOCKED:
5489  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is locked\n");
5490  break;
5491  case MB_ERR_MEMALLOC:
5492  fprintf(stderr, "\t reason: out of memory\n");
5493  break;
5494  case MB_ERR_INTERNAL:
5495  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5496  break;
5497  default:
5498  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5499  break;
5500  }
5501 
5502 
5503  exit(rc);
5504  }
5505  #endif
5506  }
5507 
5508  /* Start sync message boards that don't write */
5509  if(FLAME_loan_writeoff_message_board_write == 0)
5510  {
5511  /*printf("%d> loan_writeoff message board sync start early as no agents sending any messages of this type\n", node_number);*/
5512 
5513  /* ********** sync message board here ********** */
5514  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_loan_writeoff)\n");
5515  rc = MB_SyncStart(b_loan_writeoff);
5516  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_loan_writeoff)\n");
5517  #ifdef ERRCHECK
5518  if (rc != MB_SUCCESS)
5519  {
5520  fprintf(stderr, "ERROR: Could not start sync of 'loan_writeoff' board\n");
5521  switch(rc) {
5522  case MB_ERR_INVALID:
5523  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
5524  break;
5525  case MB_ERR_LOCKED:
5526  fprintf(stderr, "\t reason: 'loan_writeoff' board is locked\n");
5527  break;
5528  case MB_ERR_MEMALLOC:
5529  fprintf(stderr, "\t reason: out of memory\n");
5530  break;
5531  case MB_ERR_INTERNAL:
5532  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5533  break;
5534  default:
5535  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5536  break;
5537  }
5538 
5539 
5540  exit(rc);
5541  }
5542  #endif
5543  }
5544 
5545  /* Start sync message boards that don't write */
5546  if(FLAME_firm_bank_insolvent_account_message_board_write == 0)
5547  {
5548  /*printf("%d> firm_bank_insolvent_account message board sync start early as no agents sending any messages of this type\n", node_number);*/
5549 
5550  /* ********** sync message board here ********** */
5551  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_insolvent_account)\n");
5552  rc = MB_SyncStart(b_firm_bank_insolvent_account);
5553  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_insolvent_account)\n");
5554  #ifdef ERRCHECK
5555  if (rc != MB_SUCCESS)
5556  {
5557  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_insolvent_account' board\n");
5558  switch(rc) {
5559  case MB_ERR_INVALID:
5560  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
5561  break;
5562  case MB_ERR_LOCKED:
5563  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is locked\n");
5564  break;
5565  case MB_ERR_MEMALLOC:
5566  fprintf(stderr, "\t reason: out of memory\n");
5567  break;
5568  case MB_ERR_INTERNAL:
5569  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5570  break;
5571  default:
5572  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5573  break;
5574  }
5575 
5576 
5577  exit(rc);
5578  }
5579  #endif
5580  }
5581 
5582  /* Start sync message boards that don't write */
5583  if(FLAME_firm_net_profit_message_board_write == 0)
5584  {
5585  /*printf("%d> firm_net_profit message board sync start early as no agents sending any messages of this type\n", node_number);*/
5586 
5587  /* ********** sync message board here ********** */
5588  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_net_profit)\n");
5589  rc = MB_SyncStart(b_firm_net_profit);
5590  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_net_profit)\n");
5591  #ifdef ERRCHECK
5592  if (rc != MB_SUCCESS)
5593  {
5594  fprintf(stderr, "ERROR: Could not start sync of 'firm_net_profit' board\n");
5595  switch(rc) {
5596  case MB_ERR_INVALID:
5597  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
5598  break;
5599  case MB_ERR_LOCKED:
5600  fprintf(stderr, "\t reason: 'firm_net_profit' board is locked\n");
5601  break;
5602  case MB_ERR_MEMALLOC:
5603  fprintf(stderr, "\t reason: out of memory\n");
5604  break;
5605  case MB_ERR_INTERNAL:
5606  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5607  break;
5608  default:
5609  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5610  break;
5611  }
5612 
5613 
5614  exit(rc);
5615  }
5616  #endif
5617  }
5618 
5619  /* Start sync message boards that don't write */
5620  if(FLAME_bank_net_profit_message_board_write == 0)
5621  {
5622  /*printf("%d> bank_net_profit message board sync start early as no agents sending any messages of this type\n", node_number);*/
5623 
5624  /* ********** sync message board here ********** */
5625  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_net_profit)\n");
5626  rc = MB_SyncStart(b_bank_net_profit);
5627  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_net_profit)\n");
5628  #ifdef ERRCHECK
5629  if (rc != MB_SUCCESS)
5630  {
5631  fprintf(stderr, "ERROR: Could not start sync of 'bank_net_profit' board\n");
5632  switch(rc) {
5633  case MB_ERR_INVALID:
5634  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
5635  break;
5636  case MB_ERR_LOCKED:
5637  fprintf(stderr, "\t reason: 'bank_net_profit' board is locked\n");
5638  break;
5639  case MB_ERR_MEMALLOC:
5640  fprintf(stderr, "\t reason: out of memory\n");
5641  break;
5642  case MB_ERR_INTERNAL:
5643  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5644  break;
5645  default:
5646  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5647  break;
5648  }
5649 
5650 
5651  exit(rc);
5652  }
5653  #endif
5654  }
5655 
5656  /* Start sync message boards that don't write */
5657  if(FLAME_bank_centralbank_interest_payment_message_board_write == 0)
5658  {
5659  /*printf("%d> bank_centralbank_interest_payment message board sync start early as no agents sending any messages of this type\n", node_number);*/
5660 
5661  /* ********** sync message board here ********** */
5662  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_interest_payment)\n");
5663  rc = MB_SyncStart(b_bank_centralbank_interest_payment);
5664  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_interest_payment)\n");
5665  #ifdef ERRCHECK
5666  if (rc != MB_SUCCESS)
5667  {
5668  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_interest_payment' board\n");
5669  switch(rc) {
5670  case MB_ERR_INVALID:
5671  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
5672  break;
5673  case MB_ERR_LOCKED:
5674  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is locked\n");
5675  break;
5676  case MB_ERR_MEMALLOC:
5677  fprintf(stderr, "\t reason: out of memory\n");
5678  break;
5679  case MB_ERR_INTERNAL:
5680  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5681  break;
5682  default:
5683  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5684  break;
5685  }
5686 
5687 
5688  exit(rc);
5689  }
5690  #endif
5691  }
5692 
5693  /* Start sync message boards that don't write */
5694  if(FLAME_bank_centralbank_debt_payment_message_board_write == 0)
5695  {
5696  /*printf("%d> bank_centralbank_debt_payment message board sync start early as no agents sending any messages of this type\n", node_number);*/
5697 
5698  /* ********** sync message board here ********** */
5699  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_debt_payment)\n");
5700  rc = MB_SyncStart(b_bank_centralbank_debt_payment);
5701  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_debt_payment)\n");
5702  #ifdef ERRCHECK
5703  if (rc != MB_SUCCESS)
5704  {
5705  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_debt_payment' board\n");
5706  switch(rc) {
5707  case MB_ERR_INVALID:
5708  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
5709  break;
5710  case MB_ERR_LOCKED:
5711  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is locked\n");
5712  break;
5713  case MB_ERR_MEMALLOC:
5714  fprintf(stderr, "\t reason: out of memory\n");
5715  break;
5716  case MB_ERR_INTERNAL:
5717  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5718  break;
5719  default:
5720  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5721  break;
5722  }
5723 
5724 
5725  exit(rc);
5726  }
5727  #endif
5728  }
5729 
5730  /* Start sync message boards that don't write */
5731  if(FLAME_gov_centralbank_debt_request_message_board_write == 0)
5732  {
5733  /*printf("%d> gov_centralbank_debt_request message board sync start early as no agents sending any messages of this type\n", node_number);*/
5734 
5735  /* ********** sync message board here ********** */
5736  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_debt_request)\n");
5737  rc = MB_SyncStart(b_gov_centralbank_debt_request);
5738  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_debt_request)\n");
5739  #ifdef ERRCHECK
5740  if (rc != MB_SUCCESS)
5741  {
5742  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_debt_request' board\n");
5743  switch(rc) {
5744  case MB_ERR_INVALID:
5745  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
5746  break;
5747  case MB_ERR_LOCKED:
5748  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is locked\n");
5749  break;
5750  case MB_ERR_MEMALLOC:
5751  fprintf(stderr, "\t reason: out of memory\n");
5752  break;
5753  case MB_ERR_INTERNAL:
5754  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5755  break;
5756  default:
5757  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5758  break;
5759  }
5760 
5761 
5762  exit(rc);
5763  }
5764  #endif
5765  }
5766 
5767  /* Start sync message boards that don't write */
5768  if(FLAME_gov_centralbank_debt_payment_message_board_write == 0)
5769  {
5770  /*printf("%d> gov_centralbank_debt_payment message board sync start early as no agents sending any messages of this type\n", node_number);*/
5771 
5772  /* ********** sync message board here ********** */
5773  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_debt_payment)\n");
5774  rc = MB_SyncStart(b_gov_centralbank_debt_payment);
5775  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_debt_payment)\n");
5776  #ifdef ERRCHECK
5777  if (rc != MB_SUCCESS)
5778  {
5779  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_debt_payment' board\n");
5780  switch(rc) {
5781  case MB_ERR_INVALID:
5782  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
5783  break;
5784  case MB_ERR_LOCKED:
5785  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is locked\n");
5786  break;
5787  case MB_ERR_MEMALLOC:
5788  fprintf(stderr, "\t reason: out of memory\n");
5789  break;
5790  case MB_ERR_INTERNAL:
5791  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5792  break;
5793  default:
5794  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5795  break;
5796  }
5797 
5798 
5799  exit(rc);
5800  }
5801  #endif
5802  }
5803 
5804  /* Start sync message boards that don't write */
5805  if(FLAME_centralbank_government_profit_message_board_write == 0)
5806  {
5807  /*printf("%d> centralbank_government_profit message board sync start early as no agents sending any messages of this type\n", node_number);*/
5808 
5809  /* ********** sync message board here ********** */
5810  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_centralbank_government_profit)\n");
5811  rc = MB_SyncStart(b_centralbank_government_profit);
5812  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_centralbank_government_profit)\n");
5813  #ifdef ERRCHECK
5814  if (rc != MB_SUCCESS)
5815  {
5816  fprintf(stderr, "ERROR: Could not start sync of 'centralbank_government_profit' board\n");
5817  switch(rc) {
5818  case MB_ERR_INVALID:
5819  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
5820  break;
5821  case MB_ERR_LOCKED:
5822  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is locked\n");
5823  break;
5824  case MB_ERR_MEMALLOC:
5825  fprintf(stderr, "\t reason: out of memory\n");
5826  break;
5827  case MB_ERR_INTERNAL:
5828  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5829  break;
5830  default:
5831  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5832  break;
5833  }
5834 
5835 
5836  exit(rc);
5837  }
5838  #endif
5839  }
5840 
5841  /* Start sync message boards that don't write */
5842  if(FLAME_housing_price_message_board_write == 0)
5843  {
5844  /*printf("%d> housing_price message board sync start early as no agents sending any messages of this type\n", node_number);*/
5845 
5846  /* ********** sync message board here ********** */
5847  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_housing_price)\n");
5848  rc = MB_SyncStart(b_housing_price);
5849  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_housing_price)\n");
5850  #ifdef ERRCHECK
5851  if (rc != MB_SUCCESS)
5852  {
5853  fprintf(stderr, "ERROR: Could not start sync of 'housing_price' board\n");
5854  switch(rc) {
5855  case MB_ERR_INVALID:
5856  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
5857  break;
5858  case MB_ERR_LOCKED:
5859  fprintf(stderr, "\t reason: 'housing_price' board is locked\n");
5860  break;
5861  case MB_ERR_MEMALLOC:
5862  fprintf(stderr, "\t reason: out of memory\n");
5863  break;
5864  case MB_ERR_INTERNAL:
5865  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5866  break;
5867  default:
5868  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5869  break;
5870  }
5871 
5872 
5873  exit(rc);
5874  }
5875  #endif
5876  }
5877 
5878  /* Start sync message boards that don't write */
5879  if(FLAME_buy_housing_message_board_write == 0)
5880  {
5881  /*printf("%d> buy_housing message board sync start early as no agents sending any messages of this type\n", node_number);*/
5882 
5883  /* ********** sync message board here ********** */
5884  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_buy_housing)\n");
5885  rc = MB_SyncStart(b_buy_housing);
5886  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_buy_housing)\n");
5887  #ifdef ERRCHECK
5888  if (rc != MB_SUCCESS)
5889  {
5890  fprintf(stderr, "ERROR: Could not start sync of 'buy_housing' board\n");
5891  switch(rc) {
5892  case MB_ERR_INVALID:
5893  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
5894  break;
5895  case MB_ERR_LOCKED:
5896  fprintf(stderr, "\t reason: 'buy_housing' board is locked\n");
5897  break;
5898  case MB_ERR_MEMALLOC:
5899  fprintf(stderr, "\t reason: out of memory\n");
5900  break;
5901  case MB_ERR_INTERNAL:
5902  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5903  break;
5904  default:
5905  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5906  break;
5907  }
5908 
5909 
5910  exit(rc);
5911  }
5912  #endif
5913  }
5914 
5915  /* Start sync message boards that don't write */
5916  if(FLAME_sell_housing_message_board_write == 0)
5917  {
5918  /*printf("%d> sell_housing message board sync start early as no agents sending any messages of this type\n", node_number);*/
5919 
5920  /* ********** sync message board here ********** */
5921  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sell_housing)\n");
5922  rc = MB_SyncStart(b_sell_housing);
5923  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sell_housing)\n");
5924  #ifdef ERRCHECK
5925  if (rc != MB_SUCCESS)
5926  {
5927  fprintf(stderr, "ERROR: Could not start sync of 'sell_housing' board\n");
5928  switch(rc) {
5929  case MB_ERR_INVALID:
5930  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
5931  break;
5932  case MB_ERR_LOCKED:
5933  fprintf(stderr, "\t reason: 'sell_housing' board is locked\n");
5934  break;
5935  case MB_ERR_MEMALLOC:
5936  fprintf(stderr, "\t reason: out of memory\n");
5937  break;
5938  case MB_ERR_INTERNAL:
5939  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5940  break;
5941  default:
5942  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5943  break;
5944  }
5945 
5946 
5947  exit(rc);
5948  }
5949  #endif
5950  }
5951 
5952  /* Start sync message boards that don't write */
5953  if(FLAME_bought_housing_message_board_write == 0)
5954  {
5955  /*printf("%d> bought_housing message board sync start early as no agents sending any messages of this type\n", node_number);*/
5956 
5957  /* ********** sync message board here ********** */
5958  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bought_housing)\n");
5959  rc = MB_SyncStart(b_bought_housing);
5960  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bought_housing)\n");
5961  #ifdef ERRCHECK
5962  if (rc != MB_SUCCESS)
5963  {
5964  fprintf(stderr, "ERROR: Could not start sync of 'bought_housing' board\n");
5965  switch(rc) {
5966  case MB_ERR_INVALID:
5967  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
5968  break;
5969  case MB_ERR_LOCKED:
5970  fprintf(stderr, "\t reason: 'bought_housing' board is locked\n");
5971  break;
5972  case MB_ERR_MEMALLOC:
5973  fprintf(stderr, "\t reason: out of memory\n");
5974  break;
5975  case MB_ERR_INTERNAL:
5976  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
5977  break;
5978  default:
5979  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
5980  break;
5981  }
5982 
5983 
5984  exit(rc);
5985  }
5986  #endif
5987  }
5988 
5989  /* Start sync message boards that don't write */
5990  if(FLAME_sold_housing_message_board_write == 0)
5991  {
5992  /*printf("%d> sold_housing message board sync start early as no agents sending any messages of this type\n", node_number);*/
5993 
5994  /* ********** sync message board here ********** */
5995  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sold_housing)\n");
5996  rc = MB_SyncStart(b_sold_housing);
5997  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sold_housing)\n");
5998  #ifdef ERRCHECK
5999  if (rc != MB_SUCCESS)
6000  {
6001  fprintf(stderr, "ERROR: Could not start sync of 'sold_housing' board\n");
6002  switch(rc) {
6003  case MB_ERR_INVALID:
6004  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
6005  break;
6006  case MB_ERR_LOCKED:
6007  fprintf(stderr, "\t reason: 'sold_housing' board is locked\n");
6008  break;
6009  case MB_ERR_MEMALLOC:
6010  fprintf(stderr, "\t reason: out of memory\n");
6011  break;
6012  case MB_ERR_INTERNAL:
6013  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6014  break;
6015  default:
6016  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6017  break;
6018  }
6019 
6020 
6021  exit(rc);
6022  }
6023  #endif
6024  }
6025 
6026  /* Start sync message boards that don't write */
6027  if(FLAME_bank_reagency_credibility_message_board_write == 0)
6028  {
6029  /*printf("%d> bank_reagency_credibility message board sync start early as no agents sending any messages of this type\n", node_number);*/
6030 
6031  /* ********** sync message board here ********** */
6032  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_reagency_credibility)\n");
6033  rc = MB_SyncStart(b_bank_reagency_credibility);
6034  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_reagency_credibility)\n");
6035  #ifdef ERRCHECK
6036  if (rc != MB_SUCCESS)
6037  {
6038  fprintf(stderr, "ERROR: Could not start sync of 'bank_reagency_credibility' board\n");
6039  switch(rc) {
6040  case MB_ERR_INVALID:
6041  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
6042  break;
6043  case MB_ERR_LOCKED:
6044  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is locked\n");
6045  break;
6046  case MB_ERR_MEMALLOC:
6047  fprintf(stderr, "\t reason: out of memory\n");
6048  break;
6049  case MB_ERR_INTERNAL:
6050  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6051  break;
6052  default:
6053  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6054  break;
6055  }
6056 
6057 
6058  exit(rc);
6059  }
6060  #endif
6061  }
6062 
6063  /* Start sync message boards that don't write */
6064  if(FLAME_mortgage_requests_message_board_write == 0)
6065  {
6066  /*printf("%d> mortgage_requests message board sync start early as no agents sending any messages of this type\n", node_number);*/
6067 
6068  /* ********** sync message board here ********** */
6069  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_requests)\n");
6070  rc = MB_SyncStart(b_mortgage_requests);
6071  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_requests)\n");
6072  #ifdef ERRCHECK
6073  if (rc != MB_SUCCESS)
6074  {
6075  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_requests' board\n");
6076  switch(rc) {
6077  case MB_ERR_INVALID:
6078  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
6079  break;
6080  case MB_ERR_LOCKED:
6081  fprintf(stderr, "\t reason: 'mortgage_requests' board is locked\n");
6082  break;
6083  case MB_ERR_MEMALLOC:
6084  fprintf(stderr, "\t reason: out of memory\n");
6085  break;
6086  case MB_ERR_INTERNAL:
6087  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6088  break;
6089  default:
6090  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6091  break;
6092  }
6093 
6094 
6095  exit(rc);
6096  }
6097  #endif
6098  }
6099 
6100  /* Start sync message boards that don't write */
6101  if(FLAME_mortgage_payment_from_sale_message_board_write == 0)
6102  {
6103  /*printf("%d> mortgage_payment_from_sale message board sync start early as no agents sending any messages of this type\n", node_number);*/
6104 
6105  /* ********** sync message board here ********** */
6106  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_payment_from_sale)\n");
6107  rc = MB_SyncStart(b_mortgage_payment_from_sale);
6108  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_payment_from_sale)\n");
6109  #ifdef ERRCHECK
6110  if (rc != MB_SUCCESS)
6111  {
6112  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_payment_from_sale' board\n");
6113  switch(rc) {
6114  case MB_ERR_INVALID:
6115  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
6116  break;
6117  case MB_ERR_LOCKED:
6118  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is locked\n");
6119  break;
6120  case MB_ERR_MEMALLOC:
6121  fprintf(stderr, "\t reason: out of memory\n");
6122  break;
6123  case MB_ERR_INTERNAL:
6124  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6125  break;
6126  default:
6127  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6128  break;
6129  }
6130 
6131 
6132  exit(rc);
6133  }
6134  #endif
6135  }
6136 
6137  /* Start sync message boards that don't write */
6138  if(FLAME_mortgage_payment_message_board_write == 0)
6139  {
6140  /*printf("%d> mortgage_payment message board sync start early as no agents sending any messages of this type\n", node_number);*/
6141 
6142  /* ********** sync message board here ********** */
6143  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_payment)\n");
6144  rc = MB_SyncStart(b_mortgage_payment);
6145  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_payment)\n");
6146  #ifdef ERRCHECK
6147  if (rc != MB_SUCCESS)
6148  {
6149  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_payment' board\n");
6150  switch(rc) {
6151  case MB_ERR_INVALID:
6152  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
6153  break;
6154  case MB_ERR_LOCKED:
6155  fprintf(stderr, "\t reason: 'mortgage_payment' board is locked\n");
6156  break;
6157  case MB_ERR_MEMALLOC:
6158  fprintf(stderr, "\t reason: out of memory\n");
6159  break;
6160  case MB_ERR_INTERNAL:
6161  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6162  break;
6163  default:
6164  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6165  break;
6166  }
6167 
6168 
6169  exit(rc);
6170  }
6171  #endif
6172  }
6173 
6174  /* Start sync message boards that don't write */
6175  if(FLAME_mortgage_writeoff_message_board_write == 0)
6176  {
6177  /*printf("%d> mortgage_writeoff message board sync start early as no agents sending any messages of this type\n", node_number);*/
6178 
6179  /* ********** sync message board here ********** */
6180  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_writeoff)\n");
6181  rc = MB_SyncStart(b_mortgage_writeoff);
6182  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_writeoff)\n");
6183  #ifdef ERRCHECK
6184  if (rc != MB_SUCCESS)
6185  {
6186  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_writeoff' board\n");
6187  switch(rc) {
6188  case MB_ERR_INVALID:
6189  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
6190  break;
6191  case MB_ERR_LOCKED:
6192  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is locked\n");
6193  break;
6194  case MB_ERR_MEMALLOC:
6195  fprintf(stderr, "\t reason: out of memory\n");
6196  break;
6197  case MB_ERR_INTERNAL:
6198  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6199  break;
6200  default:
6201  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6202  break;
6203  }
6204 
6205 
6206  exit(rc);
6207  }
6208  #endif
6209  }
6210 
6211  /* Start sync message boards that don't write */
6212  if(FLAME_housing_transactions_summary_message_board_write == 0)
6213  {
6214  /*printf("%d> housing_transactions_summary message board sync start early as no agents sending any messages of this type\n", node_number);*/
6215 
6216  /* ********** sync message board here ********** */
6217  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_housing_transactions_summary)\n");
6218  rc = MB_SyncStart(b_housing_transactions_summary);
6219  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_housing_transactions_summary)\n");
6220  #ifdef ERRCHECK
6221  if (rc != MB_SUCCESS)
6222  {
6223  fprintf(stderr, "ERROR: Could not start sync of 'housing_transactions_summary' board\n");
6224  switch(rc) {
6225  case MB_ERR_INVALID:
6226  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
6227  break;
6228  case MB_ERR_LOCKED:
6229  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is locked\n");
6230  break;
6231  case MB_ERR_MEMALLOC:
6232  fprintf(stderr, "\t reason: out of memory\n");
6233  break;
6234  case MB_ERR_INTERNAL:
6235  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6236  break;
6237  default:
6238  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6239  break;
6240  }
6241 
6242 
6243  exit(rc);
6244  }
6245  #endif
6246  }
6247 
6248 
6249  /* DEBUG: States with branching functions */
6252  {
6253  FLAME_debug_count = 0;
6254  /* Function: idle */
6256  { FLAME_debug_count++; }
6257  /* Function: equityfund_init */
6259  { FLAME_debug_count++; }
6260  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
6261  if(FLAME_debug_count != 1)
6262  {
6263  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'equityfund' leaving state 'start'\n");
6264  if(FLAME_debug_count > 1)
6265  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
6266  if(FLAME_debug_count == 0)
6267  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
6268  }
6269 
6271  }
6272  /* DEBUG: States with branching functions */
6275  {
6276  FLAME_debug_count = 0;
6277  /* Function: idle */
6279  { FLAME_debug_count++; }
6280  /* Function: government_init */
6282  { FLAME_debug_count++; }
6283  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
6284  if(FLAME_debug_count != 1)
6285  {
6286  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'government' leaving state 'start'\n");
6287  if(FLAME_debug_count > 1)
6288  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
6289  if(FLAME_debug_count == 0)
6290  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
6291  }
6292 
6294  }
6295 
6296  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_init\n");
6299  {
6303  /* For backwards compatibility set current_xmachine */
6314 
6316  {
6317 
6318 
6319 
6320  i = equityfund_init();
6321 
6322 
6323 
6324  if(i == 1)
6325  {
6327  }
6328  else
6329  {
6331  }
6332  }
6333 
6335 
6337  }
6338  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_init\n");
6339 
6340  if(FLAME_fund_centralbank_init_deposit_message_board_write == 1)
6341  {
6342 
6343  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_centralbank_init_deposit)\n");
6344  rc = MB_SyncStart(b_fund_centralbank_init_deposit);
6345  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_centralbank_init_deposit)\n");
6346  #ifdef ERRCHECK
6347  if (rc != MB_SUCCESS)
6348  {
6349  fprintf(stderr, "ERROR: Could not start sync of 'fund_centralbank_init_deposit' board\n");
6350  switch(rc) {
6351  case MB_ERR_INVALID:
6352  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
6353  break;
6354  case MB_ERR_LOCKED:
6355  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is locked\n");
6356  break;
6357  case MB_ERR_MEMALLOC:
6358  fprintf(stderr, "\t reason: out of memory\n");
6359  break;
6360  case MB_ERR_INTERNAL:
6361  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6362  break;
6363  default:
6364  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6365  break;
6366  }
6367 
6368 
6369  exit(rc);
6370  }
6371  #endif
6372  }
6373 
6374 
6375 
6376  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_init\n");
6379  {
6383  /* For backwards compatibility set current_xmachine */
6394 
6396  {
6397 
6398 
6399 
6400  i = government_init();
6401 
6402 
6403 
6404  if(i == 1)
6405  {
6407  }
6408  else
6409  {
6411  }
6412  }
6413 
6415 
6417  }
6418  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_init\n");
6419 
6420  if(FLAME_gov_centralbank_init_deposit_message_board_write == 1)
6421  {
6422 
6423  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_init_deposit)\n");
6424  rc = MB_SyncStart(b_gov_centralbank_init_deposit);
6425  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_init_deposit)\n");
6426  #ifdef ERRCHECK
6427  if (rc != MB_SUCCESS)
6428  {
6429  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_init_deposit' board\n");
6430  switch(rc) {
6431  case MB_ERR_INVALID:
6432  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
6433  break;
6434  case MB_ERR_LOCKED:
6435  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is locked\n");
6436  break;
6437  case MB_ERR_MEMALLOC:
6438  fprintf(stderr, "\t reason: out of memory\n");
6439  break;
6440  case MB_ERR_INTERNAL:
6441  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
6442  break;
6443  default:
6444  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
6445  break;
6446  }
6447 
6448 
6449  exit(rc);
6450  }
6451  #endif
6452  }
6453 
6454 
6455 
6456  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start reagency_init\n");
6459  {
6463  /* For backwards compatibility set current_xmachine */
6474 
6475 
6476 
6477 
6478 
6479  i = reagency_init();
6480 
6481 
6482 
6483  if(i == 1)
6484  {
6486  }
6487  else
6488  {
6490  }
6491 
6492 
6494 
6496  }
6497  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish reagency_init\n");
6498 
6499 
6500  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start mall_init\n");
6503  {
6507  /* For backwards compatibility set current_xmachine */
6518 
6519 
6520 
6521 
6522 
6523  i = mall_init();
6524 
6525 
6526 
6527  if(i == 1)
6528  {
6530  }
6531  else
6532  {
6534  }
6535 
6536 
6537  current_xmachine_mall = NULL;
6538 
6540  }
6541  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish mall_init\n");
6542 
6543 
6544  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6547  {
6551  /* For backwards compatibility set current_xmachine */
6562 
6564  {
6565 
6566 
6567 
6568  i = idle();
6569 
6570 
6571 
6572  if(i == 1)
6573  {
6575  }
6576  else
6577  {
6579  }
6580  }
6581 
6583 
6585  }
6586  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6587 
6588 
6589  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6592  {
6596  /* For backwards compatibility set current_xmachine */
6607 
6609  {
6610 
6611 
6612 
6613  i = idle();
6614 
6615 
6616 
6617  if(i == 1)
6618  {
6620  }
6621  else
6622  {
6624  }
6625  }
6626 
6628 
6630  }
6631  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6632 
6633 
6634  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6637  {
6641  /* For backwards compatibility set current_xmachine */
6652 
6654  {
6655 
6656 
6657 
6658  i = idle();
6659 
6660 
6661 
6662  if(i == 1)
6663  {
6665  }
6666  else
6667  {
6669  }
6670  }
6671 
6673 
6675  }
6676  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6677 
6678 
6679  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6682  {
6686  /* For backwards compatibility set current_xmachine */
6697 
6699  {
6700 
6701 
6702 
6703  i = idle();
6704 
6705 
6706 
6707  if(i == 1)
6708  {
6710  }
6711  else
6712  {
6714  }
6715  }
6716 
6718 
6720  }
6721  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6722 
6723 
6724  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6727  {
6731  /* For backwards compatibility set current_xmachine */
6742 
6744  {
6745 
6746 
6747 
6748  i = idle();
6749 
6750 
6751 
6752  if(i == 1)
6753  {
6755  }
6756  else
6757  {
6759  }
6760  }
6761 
6763 
6765  }
6766  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6767 
6768 
6769  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6772  {
6776  /* For backwards compatibility set current_xmachine */
6787 
6789  {
6790 
6791 
6792 
6793  i = idle();
6794 
6795 
6796 
6797  if(i == 1)
6798  {
6800  }
6801  else
6802  {
6804  }
6805  }
6806 
6807  current_xmachine_bank = NULL;
6808 
6810  }
6811  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6812 
6813 
6814  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6817  {
6821  /* For backwards compatibility set current_xmachine */
6832 
6834  {
6835 
6836 
6837 
6838  i = idle();
6839 
6840 
6841 
6842  if(i == 1)
6843  {
6845  }
6846  else
6847  {
6849  }
6850  }
6851 
6852  current_xmachine_bank = NULL;
6853 
6855  }
6856  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6857 
6858 
6859  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6862  {
6866  /* For backwards compatibility set current_xmachine */
6877 
6879  {
6880 
6881 
6882 
6883  i = idle();
6884 
6885 
6886 
6887  if(i == 1)
6888  {
6890  }
6891  else
6892  {
6894  }
6895  }
6896 
6898 
6900  }
6901  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6902 
6903 
6904  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6907  {
6911  /* For backwards compatibility set current_xmachine */
6922 
6924  {
6925 
6926 
6927 
6928  i = idle();
6929 
6930 
6931 
6932  if(i == 1)
6933  {
6935  }
6936  else
6937  {
6939  }
6940  }
6941 
6943 
6945  }
6946  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6947 
6948 
6949  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6952  {
6956  /* For backwards compatibility set current_xmachine */
6967 
6969  {
6970 
6971 
6972 
6973  i = idle();
6974 
6975 
6976 
6977  if(i == 1)
6978  {
6980  }
6981  else
6982  {
6984  }
6985  }
6986 
6988 
6990  }
6991  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
6992 
6993 
6994  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
6997  {
7001  /* For backwards compatibility set current_xmachine */
7012 
7014  {
7015 
7016 
7017 
7018  i = idle();
7019 
7020 
7021 
7022  if(i == 1)
7023  {
7025  }
7026  else
7027  {
7029  }
7030  }
7031 
7032  current_xmachine_firm = NULL;
7033 
7035  }
7036  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
7037 
7038 
7039  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
7042  {
7046  /* For backwards compatibility set current_xmachine */
7057 
7059  {
7060 
7061 
7062 
7063  i = idle();
7064 
7065 
7066 
7067  if(i == 1)
7068  {
7070  }
7071  else
7072  {
7074  }
7075  }
7076 
7077  current_xmachine_firm = NULL;
7078 
7080  }
7081  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
7082 
7083 
7084 /* End of layer number 0 */
7085 
7086 /* Clear message boards that have finished being used
7087  * and sync complete if doing late sync complete */
7088 
7089  /* DEBUG: States with branching functions */
7092  {
7093  FLAME_debug_count = 0;
7094  /* Function: mall_consumption_shopping */
7096  { FLAME_debug_count++; }
7097  /* Function: idle */
7099  { FLAME_debug_count++; }
7100  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
7101  if(FLAME_debug_count != 1)
7102  {
7103  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'mall' leaving state 'MallConsumptionMarket'\n");
7104  if(FLAME_debug_count > 1)
7105  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
7106  if(FLAME_debug_count == 0)
7107  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
7108  }
7109 
7111  }
7112  /* DEBUG: States with branching functions */
7115  {
7116  FLAME_debug_count = 0;
7117  /* Function: reagency_housing_process */
7119  { FLAME_debug_count++; }
7120  /* Function: idle */
7122  { FLAME_debug_count++; }
7123  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
7124  if(FLAME_debug_count != 1)
7125  {
7126  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'reagency' leaving state 'REAgencyHousingMarket'\n");
7127  if(FLAME_debug_count > 1)
7128  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
7129  if(FLAME_debug_count == 0)
7130  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
7131  }
7132 
7134  }
7135 
7136  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_init_post_id\n");
7139  {
7143  /* For backwards compatibility set current_xmachine */
7154 
7155 
7156 
7157 
7158 
7159  i = firm_init_post_id();
7160 
7161 
7162 
7163  if(i == 1)
7164  {
7166  }
7167  else
7168  {
7170  }
7171 
7172 
7173  current_xmachine_firm = NULL;
7174 
7176  }
7177  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_init_post_id\n");
7178 
7179  if(FLAME_firm_jpoffice_id_message_board_write == 1)
7180  {
7181 
7182  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_jpoffice_id)\n");
7183  rc = MB_SyncStart(b_firm_jpoffice_id);
7184  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_jpoffice_id)\n");
7185  #ifdef ERRCHECK
7186  if (rc != MB_SUCCESS)
7187  {
7188  fprintf(stderr, "ERROR: Could not start sync of 'firm_jpoffice_id' board\n");
7189  switch(rc) {
7190  case MB_ERR_INVALID:
7191  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
7192  break;
7193  case MB_ERR_LOCKED:
7194  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is locked\n");
7195  break;
7196  case MB_ERR_MEMALLOC:
7197  fprintf(stderr, "\t reason: out of memory\n");
7198  break;
7199  case MB_ERR_INTERNAL:
7200  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7201  break;
7202  default:
7203  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
7204  break;
7205  }
7206 
7207 
7208  exit(rc);
7209  }
7210  #endif
7211  }
7212 
7213 
7214 
7215  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_init_post_id\n");
7218  {
7222  /* For backwards compatibility set current_xmachine */
7233 
7234 
7235 
7236 
7237 
7238  i = household_init_post_id();
7239 
7240 
7241 
7242  if(i == 1)
7243  {
7245  }
7246  else
7247  {
7249  }
7250 
7251 
7253 
7255  }
7256  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_init_post_id\n");
7257 
7258  if(FLAME_household_jpoffice_id_message_board_write == 1)
7259  {
7260 
7261  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_jpoffice_id)\n");
7262  rc = MB_SyncStart(b_household_jpoffice_id);
7263  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_jpoffice_id)\n");
7264  #ifdef ERRCHECK
7265  if (rc != MB_SUCCESS)
7266  {
7267  fprintf(stderr, "ERROR: Could not start sync of 'household_jpoffice_id' board\n");
7268  switch(rc) {
7269  case MB_ERR_INVALID:
7270  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
7271  break;
7272  case MB_ERR_LOCKED:
7273  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is locked\n");
7274  break;
7275  case MB_ERR_MEMALLOC:
7276  fprintf(stderr, "\t reason: out of memory\n");
7277  break;
7278  case MB_ERR_INTERNAL:
7279  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7280  break;
7281  default:
7282  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
7283  break;
7284  }
7285 
7286 
7287  exit(rc);
7288  }
7289  #endif
7290  }
7291 
7292 
7293 
7294  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
7297  {
7301  /* For backwards compatibility set current_xmachine */
7312 
7314  {
7315 
7316 
7317 
7318  i = idle();
7319 
7320 
7321 
7322  if(i == 1)
7323  {
7325  }
7326  else
7327  {
7329  }
7330  }
7331 
7333 
7335  }
7336  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
7337 
7338 
7339  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
7342  {
7346  /* For backwards compatibility set current_xmachine */
7357 
7359  {
7360 
7361 
7362 
7363  i = idle();
7364 
7365 
7366 
7367  if(i == 1)
7368  {
7370  }
7371  else
7372  {
7374  }
7375  }
7376 
7377  current_xmachine_mall = NULL;
7378 
7380  }
7381  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
7382 
7383 
7384  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_iterate\n");
7387  {
7391  /* For backwards compatibility set current_xmachine */
7402 
7403 
7404 
7405 
7406 
7407  i = government_iterate();
7408 
7409 
7410 
7411  if(i == 1)
7412  {
7414  }
7415  else
7416  {
7418  }
7419 
7420 
7422 
7424  }
7425  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_iterate\n");
7426 
7427 
7428  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_iterate\n");
7431  {
7435  /* For backwards compatibility set current_xmachine */
7446 
7447 
7448 
7449 
7450 
7451  i = equityfund_iterate();
7452 
7453 
7454 
7455  if(i == 1)
7456  {
7458  }
7459  else
7460  {
7462  }
7463 
7464 
7466 
7468  }
7469  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_iterate\n");
7470 
7471 
7472 /* End of layer number 1 */
7473 
7474 /* Clear message boards that have finished being used
7475  * and sync complete if doing late sync complete */
7476 
7477  /* DEBUG: States with branching functions */
7480  {
7481  FLAME_debug_count = 0;
7482  /* Function: equityfund_credit_invest_illiquids */
7484  { FLAME_debug_count++; }
7485  /* Function: idle */
7487  { FLAME_debug_count++; }
7488  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
7489  if(FLAME_debug_count != 1)
7490  {
7491  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'equityfund' leaving state 'EquityFundCredit'\n");
7492  if(FLAME_debug_count > 1)
7493  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
7494  if(FLAME_debug_count == 0)
7495  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
7496  }
7497 
7499  }
7500  /* DEBUG: States with branching functions */
7503  {
7504  FLAME_debug_count = 0;
7505  /* Function: government_collect_capital_tax */
7507  { FLAME_debug_count++; }
7508  /* Function: idle */
7510  { FLAME_debug_count++; }
7511  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
7512  if(FLAME_debug_count != 1)
7513  {
7514  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'government' leaving state 'GovernmentCredit'\n");
7515  if(FLAME_debug_count > 1)
7516  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
7517  if(FLAME_debug_count == 0)
7518  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
7519  }
7520 
7522  }
7523 
7524  /* If mb is not read then leave sync complete until last possible moment */
7525  if(FLAME_firm_jpoffice_id_message_board_read == 1)
7526  {
7527  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_jpoffice_id)\n");
7528  rc = MB_SyncComplete(b_firm_jpoffice_id);
7529  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_jpoffice_id)\n");
7530  #ifdef ERRCHECK
7531  if (rc != MB_SUCCESS)
7532  {
7533  fprintf(stderr, "ERROR: Could not complete sync of 'firm_jpoffice_id' board\n");
7534  switch(rc) {
7535  case MB_ERR_INVALID:
7536  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
7537  break;
7538  case MB_ERR_MEMALLOC:
7539  fprintf(stderr, "\t reason: out of memory\n");
7540  break;
7541  case MB_ERR_INTERNAL:
7542  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7543  break;
7544  default:
7545  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
7546  break;
7547  }
7548 
7549 
7550  exit(rc);
7551  }
7552  #endif
7553 
7554 
7555 
7556  }
7557 
7558  /* If mb is not read then leave sync complete until last possible moment */
7559  if(FLAME_household_jpoffice_id_message_board_read == 1)
7560  {
7561  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_jpoffice_id)\n");
7562  rc = MB_SyncComplete(b_household_jpoffice_id);
7563  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_jpoffice_id)\n");
7564  #ifdef ERRCHECK
7565  if (rc != MB_SUCCESS)
7566  {
7567  fprintf(stderr, "ERROR: Could not complete sync of 'household_jpoffice_id' board\n");
7568  switch(rc) {
7569  case MB_ERR_INVALID:
7570  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
7571  break;
7572  case MB_ERR_MEMALLOC:
7573  fprintf(stderr, "\t reason: out of memory\n");
7574  break;
7575  case MB_ERR_INTERNAL:
7576  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7577  break;
7578  default:
7579  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
7580  break;
7581  }
7582 
7583 
7584  exit(rc);
7585  }
7586  #endif
7587 
7588 
7589 
7590  }
7591 
7592  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start jpoffice_init_employment\n");
7595  {
7599  /* For backwards compatibility set current_xmachine */
7610 
7611 
7612 
7613 
7614 
7615 
7616 
7618 
7619  #ifdef ERRCHECK
7620  if (rc != MB_SUCCESS)
7621  {
7622  fprintf(stderr, "ERROR: Could not create Iterator for 'household_jpoffice_id'\n");
7623  switch(rc) {
7624  case MB_ERR_INVALID:
7625  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
7626  break;
7627  case MB_ERR_LOCKED:
7628  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is locked\n");
7629  break;
7630  case MB_ERR_MEMALLOC:
7631  fprintf(stderr, "\t reason: out of memory\n");
7632  break;
7633  case MB_ERR_INTERNAL:
7634  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7635  break;
7636  default:
7637 
7638 
7639  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
7640 
7641  break;
7642  }
7643 
7644 
7645  exit(rc);
7646  }
7647  #endif
7648 
7649 
7650 
7651 
7652 
7654 
7655  #ifdef ERRCHECK
7656  if (rc != MB_SUCCESS)
7657  {
7658  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_jpoffice_id'\n");
7659  switch(rc) {
7660  case MB_ERR_INVALID:
7661  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
7662  break;
7663  case MB_ERR_LOCKED:
7664  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is locked\n");
7665  break;
7666  case MB_ERR_MEMALLOC:
7667  fprintf(stderr, "\t reason: out of memory\n");
7668  break;
7669  case MB_ERR_INTERNAL:
7670  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7671  break;
7672  default:
7673 
7674 
7675  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
7676 
7677  break;
7678  }
7679 
7680 
7681  exit(rc);
7682  }
7683  #endif
7684 
7685 
7686 
7688 
7689 
7690  rc = MB_Iterator_Delete(&i_household_jpoffice_id);
7691  #ifdef ERRCHECK
7692  if (rc != MB_SUCCESS)
7693  {
7694  fprintf(stderr, "ERROR: Could not delete 'household_jpoffice_id' iterator\n");
7695  switch(rc) {
7696  case MB_ERR_INVALID:
7697  fprintf(stderr, "\t reason: 'household_jpoffice_id' iterator is invalid\n");
7698  break;
7699  case MB_ERR_INTERNAL:
7700  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7701  break;
7702  default:
7703  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
7704  break;
7705  }
7706 
7707 
7708  exit(rc);
7709  }
7710  #endif
7711 
7712  rc = MB_Iterator_Delete(&i_firm_jpoffice_id);
7713  #ifdef ERRCHECK
7714  if (rc != MB_SUCCESS)
7715  {
7716  fprintf(stderr, "ERROR: Could not delete 'firm_jpoffice_id' iterator\n");
7717  switch(rc) {
7718  case MB_ERR_INVALID:
7719  fprintf(stderr, "\t reason: 'firm_jpoffice_id' iterator is invalid\n");
7720  break;
7721  case MB_ERR_INTERNAL:
7722  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7723  break;
7724  default:
7725  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
7726  break;
7727  }
7728 
7729 
7730  exit(rc);
7731  }
7732  #endif
7733 
7734 
7735  if(i == 1)
7736  {
7738  }
7739  else
7740  {
7742  }
7743 
7744 
7746 
7748  }
7749  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish jpoffice_init_employment\n");
7750 
7751  if(FLAME_jpoffice_firm_employee_message_board_write == 1)
7752  {
7753 
7754  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_jpoffice_firm_employee)\n");
7755  rc = MB_SyncStart(b_jpoffice_firm_employee);
7756  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_jpoffice_firm_employee)\n");
7757  #ifdef ERRCHECK
7758  if (rc != MB_SUCCESS)
7759  {
7760  fprintf(stderr, "ERROR: Could not start sync of 'jpoffice_firm_employee' board\n");
7761  switch(rc) {
7762  case MB_ERR_INVALID:
7763  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
7764  break;
7765  case MB_ERR_LOCKED:
7766  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is locked\n");
7767  break;
7768  case MB_ERR_MEMALLOC:
7769  fprintf(stderr, "\t reason: out of memory\n");
7770  break;
7771  case MB_ERR_INTERNAL:
7772  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7773  break;
7774  default:
7775  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
7776  break;
7777  }
7778 
7779 
7780  exit(rc);
7781  }
7782  #endif
7783  }
7784 
7785 
7786  if(FLAME_jpoffice_household_employer_message_board_write == 1)
7787  {
7788 
7789  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_jpoffice_household_employer)\n");
7790  rc = MB_SyncStart(b_jpoffice_household_employer);
7791  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_jpoffice_household_employer)\n");
7792  #ifdef ERRCHECK
7793  if (rc != MB_SUCCESS)
7794  {
7795  fprintf(stderr, "ERROR: Could not start sync of 'jpoffice_household_employer' board\n");
7796  switch(rc) {
7797  case MB_ERR_INVALID:
7798  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
7799  break;
7800  case MB_ERR_LOCKED:
7801  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is locked\n");
7802  break;
7803  case MB_ERR_MEMALLOC:
7804  fprintf(stderr, "\t reason: out of memory\n");
7805  break;
7806  case MB_ERR_INTERNAL:
7807  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7808  break;
7809  default:
7810  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
7811  break;
7812  }
7813 
7814 
7815  exit(rc);
7816  }
7817  #endif
7818  }
7819 
7820 
7821 
7822  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
7825  {
7829  /* For backwards compatibility set current_xmachine */
7840 
7842  {
7843 
7844 
7845 
7846  i = idle();
7847 
7848 
7849 
7850  if(i == 1)
7851  {
7853  }
7854  else
7855  {
7857  }
7858  }
7859 
7861 
7863  }
7864  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
7865 
7866 
7867  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
7870  {
7874  /* For backwards compatibility set current_xmachine */
7885 
7887  {
7888 
7889 
7890 
7891  i = idle();
7892 
7893 
7894 
7895  if(i == 1)
7896  {
7898  }
7899  else
7900  {
7902  }
7903  }
7904 
7906 
7908  }
7909  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
7910 
7911 
7912 /* End of layer number 2 */
7913 
7914 /* Clear message boards that have finished being used
7915  * and sync complete if doing late sync complete */
7916 
7917 if(FLAME_household_jpoffice_id_message_board_read == 0)
7918 {
7919  /*printf("%d> household_jpoffice_id message board sync complete late as no agents reading any messages of this type\n", node_number);*/
7920 
7921  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_jpoffice_id)\n");
7922  rc = MB_SyncComplete(b_household_jpoffice_id);
7923  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_jpoffice_id)\n");
7924  #ifdef ERRCHECK
7925  if (rc != MB_SUCCESS)
7926  {
7927  fprintf(stderr, "ERROR: Could not complete sync of 'household_jpoffice_id' board\n");
7928  switch(rc) {
7929  case MB_ERR_INVALID:
7930  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
7931  break;
7932  case MB_ERR_MEMALLOC:
7933  fprintf(stderr, "\t reason: out of memory\n");
7934  break;
7935  case MB_ERR_INTERNAL:
7936  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7937  break;
7938  default:
7939  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
7940  break;
7941  }
7942 
7943 
7944  exit(rc);
7945  }
7946  #endif
7947 }
7948 
7949  /* Delete any search trees */
7950 
7951  rc = MB_Clear(b_household_jpoffice_id);
7952  #ifdef ERRCHECK
7953  if (rc != MB_SUCCESS)
7954  {
7955  fprintf(stderr, "ERROR: Could not clear 'household_jpoffice_id' board\n");
7956  switch(rc) {
7957  case MB_ERR_INVALID:
7958  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is invalid\n");
7959  break;
7960  case MB_ERR_LOCKED:
7961  fprintf(stderr, "\t reason: 'household_jpoffice_id' board is locked\n");
7962  break;
7963  case MB_ERR_INTERNAL:
7964  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7965  break;
7966  default:
7967  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
7968  break;
7969 
7970  }
7971 
7972 
7973  exit(rc);
7974  }
7975  #endif
7976 
7977 if(FLAME_firm_jpoffice_id_message_board_read == 0)
7978 {
7979  /*printf("%d> firm_jpoffice_id message board sync complete late as no agents reading any messages of this type\n", node_number);*/
7980 
7981  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_jpoffice_id)\n");
7982  rc = MB_SyncComplete(b_firm_jpoffice_id);
7983  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_jpoffice_id)\n");
7984  #ifdef ERRCHECK
7985  if (rc != MB_SUCCESS)
7986  {
7987  fprintf(stderr, "ERROR: Could not complete sync of 'firm_jpoffice_id' board\n");
7988  switch(rc) {
7989  case MB_ERR_INVALID:
7990  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
7991  break;
7992  case MB_ERR_MEMALLOC:
7993  fprintf(stderr, "\t reason: out of memory\n");
7994  break;
7995  case MB_ERR_INTERNAL:
7996  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
7997  break;
7998  default:
7999  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
8000  break;
8001  }
8002 
8003 
8004  exit(rc);
8005  }
8006  #endif
8007 }
8008 
8009  /* Delete any search trees */
8010 
8011  rc = MB_Clear(b_firm_jpoffice_id);
8012  #ifdef ERRCHECK
8013  if (rc != MB_SUCCESS)
8014  {
8015  fprintf(stderr, "ERROR: Could not clear 'firm_jpoffice_id' board\n");
8016  switch(rc) {
8017  case MB_ERR_INVALID:
8018  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is invalid\n");
8019  break;
8020  case MB_ERR_LOCKED:
8021  fprintf(stderr, "\t reason: 'firm_jpoffice_id' board is locked\n");
8022  break;
8023  case MB_ERR_INTERNAL:
8024  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8025  break;
8026  default:
8027  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
8028  break;
8029 
8030  }
8031 
8032 
8033  exit(rc);
8034  }
8035  #endif
8036 
8037 
8038  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start jpoffice_iterate\n");
8041  {
8045  /* For backwards compatibility set current_xmachine */
8056 
8057 
8058 
8059 
8060 
8061  i = jpoffice_iterate();
8062 
8063 
8064 
8065  if(i == 1)
8066  {
8068  }
8069  else
8070  {
8072  }
8073 
8074 
8076 
8078  }
8079  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish jpoffice_iterate\n");
8080 
8081 
8082  /* If mb is not read then leave sync complete until last possible moment */
8083  if(FLAME_jpoffice_firm_employee_message_board_read == 1)
8084  {
8085  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_jpoffice_firm_employee)\n");
8086  rc = MB_SyncComplete(b_jpoffice_firm_employee);
8087  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_jpoffice_firm_employee)\n");
8088  #ifdef ERRCHECK
8089  if (rc != MB_SUCCESS)
8090  {
8091  fprintf(stderr, "ERROR: Could not complete sync of 'jpoffice_firm_employee' board\n");
8092  switch(rc) {
8093  case MB_ERR_INVALID:
8094  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
8095  break;
8096  case MB_ERR_MEMALLOC:
8097  fprintf(stderr, "\t reason: out of memory\n");
8098  break;
8099  case MB_ERR_INTERNAL:
8100  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8101  break;
8102  default:
8103  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
8104  break;
8105  }
8106 
8107 
8108  exit(rc);
8109  }
8110  #endif
8111 
8112 
8113 
8114  }
8115 
8116  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_init_employment\n");
8119  {
8123  /* For backwards compatibility set current_xmachine */
8134 
8135 
8136 
8137 
8138 
8139 
8140 
8141 
8143 
8144 
8145 
8146  #ifdef ERRCHECK
8147  if (rc != MB_SUCCESS)
8148  {
8149  fprintf(stderr, "ERROR: Could not create Iterator for 'jpoffice_firm_employee'\n");
8150  switch(rc) {
8151  case MB_ERR_INVALID:
8152  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
8153  break;
8154  case MB_ERR_LOCKED:
8155  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is locked\n");
8156  break;
8157  case MB_ERR_MEMALLOC:
8158  fprintf(stderr, "\t reason: out of memory\n");
8159  break;
8160  case MB_ERR_INTERNAL:
8161  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8162  break;
8163  default:
8164 
8165  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
8166 
8167 
8168  break;
8169  }
8170 
8171 
8172  exit(rc);
8173  }
8174  #endif
8175 
8176 
8177 
8178  i = firm_init_employment();
8179 
8180 
8181  rc = MB_Iterator_Delete(&i_jpoffice_firm_employee);
8182  #ifdef ERRCHECK
8183  if (rc != MB_SUCCESS)
8184  {
8185  fprintf(stderr, "ERROR: Could not delete 'jpoffice_firm_employee' iterator\n");
8186  switch(rc) {
8187  case MB_ERR_INVALID:
8188  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' iterator is invalid\n");
8189  break;
8190  case MB_ERR_INTERNAL:
8191  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8192  break;
8193  default:
8194  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
8195  break;
8196  }
8197 
8198 
8199  exit(rc);
8200  }
8201  #endif
8202 
8203 
8204  if(i == 1)
8205  {
8207  }
8208  else
8209  {
8211  }
8212 
8213 
8214  current_xmachine_firm = NULL;
8215 
8217  }
8218  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_init_employment\n");
8219 
8220 
8221  /* If mb is not read then leave sync complete until last possible moment */
8222  if(FLAME_jpoffice_household_employer_message_board_read == 1)
8223  {
8224  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_jpoffice_household_employer)\n");
8225  rc = MB_SyncComplete(b_jpoffice_household_employer);
8226  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_jpoffice_household_employer)\n");
8227  #ifdef ERRCHECK
8228  if (rc != MB_SUCCESS)
8229  {
8230  fprintf(stderr, "ERROR: Could not complete sync of 'jpoffice_household_employer' board\n");
8231  switch(rc) {
8232  case MB_ERR_INVALID:
8233  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
8234  break;
8235  case MB_ERR_MEMALLOC:
8236  fprintf(stderr, "\t reason: out of memory\n");
8237  break;
8238  case MB_ERR_INTERNAL:
8239  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8240  break;
8241  default:
8242  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
8243  break;
8244  }
8245 
8246 
8247  exit(rc);
8248  }
8249  #endif
8250 
8251 
8252 
8253  }
8254 
8255  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_init_employment\n");
8258  {
8262  /* For backwards compatibility set current_xmachine */
8273 
8274 
8275 
8276 
8277 
8278 
8279 
8280 
8282 
8283 
8284 
8285  #ifdef ERRCHECK
8286  if (rc != MB_SUCCESS)
8287  {
8288  fprintf(stderr, "ERROR: Could not create Iterator for 'jpoffice_household_employer'\n");
8289  switch(rc) {
8290  case MB_ERR_INVALID:
8291  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
8292  break;
8293  case MB_ERR_LOCKED:
8294  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is locked\n");
8295  break;
8296  case MB_ERR_MEMALLOC:
8297  fprintf(stderr, "\t reason: out of memory\n");
8298  break;
8299  case MB_ERR_INTERNAL:
8300  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8301  break;
8302  default:
8303 
8304  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
8305 
8306 
8307  break;
8308  }
8309 
8310 
8311  exit(rc);
8312  }
8313  #endif
8314 
8315 
8316 
8318 
8319 
8320  rc = MB_Iterator_Delete(&i_jpoffice_household_employer);
8321  #ifdef ERRCHECK
8322  if (rc != MB_SUCCESS)
8323  {
8324  fprintf(stderr, "ERROR: Could not delete 'jpoffice_household_employer' iterator\n");
8325  switch(rc) {
8326  case MB_ERR_INVALID:
8327  fprintf(stderr, "\t reason: 'jpoffice_household_employer' iterator is invalid\n");
8328  break;
8329  case MB_ERR_INTERNAL:
8330  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8331  break;
8332  default:
8333  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
8334  break;
8335  }
8336 
8337 
8338  exit(rc);
8339  }
8340  #endif
8341 
8342 
8343  if(i == 1)
8344  {
8346  }
8347  else
8348  {
8350  }
8351 
8352 
8354 
8356  }
8357  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_init_employment\n");
8358 
8359 
8360 /* End of layer number 3 */
8361 
8362 /* Clear message boards that have finished being used
8363  * and sync complete if doing late sync complete */
8364 
8365 if(FLAME_jpoffice_household_employer_message_board_read == 0)
8366 {
8367  /*printf("%d> jpoffice_household_employer message board sync complete late as no agents reading any messages of this type\n", node_number);*/
8368 
8369  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_jpoffice_household_employer)\n");
8370  rc = MB_SyncComplete(b_jpoffice_household_employer);
8371  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_jpoffice_household_employer)\n");
8372  #ifdef ERRCHECK
8373  if (rc != MB_SUCCESS)
8374  {
8375  fprintf(stderr, "ERROR: Could not complete sync of 'jpoffice_household_employer' board\n");
8376  switch(rc) {
8377  case MB_ERR_INVALID:
8378  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
8379  break;
8380  case MB_ERR_MEMALLOC:
8381  fprintf(stderr, "\t reason: out of memory\n");
8382  break;
8383  case MB_ERR_INTERNAL:
8384  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8385  break;
8386  default:
8387  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
8388  break;
8389  }
8390 
8391 
8392  exit(rc);
8393  }
8394  #endif
8395 }
8396 
8397  /* Delete any search trees */
8398 
8399  rc = MB_Clear(b_jpoffice_household_employer);
8400  #ifdef ERRCHECK
8401  if (rc != MB_SUCCESS)
8402  {
8403  fprintf(stderr, "ERROR: Could not clear 'jpoffice_household_employer' board\n");
8404  switch(rc) {
8405  case MB_ERR_INVALID:
8406  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is invalid\n");
8407  break;
8408  case MB_ERR_LOCKED:
8409  fprintf(stderr, "\t reason: 'jpoffice_household_employer' board is locked\n");
8410  break;
8411  case MB_ERR_INTERNAL:
8412  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8413  break;
8414  default:
8415  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
8416  break;
8417 
8418  }
8419 
8420 
8421  exit(rc);
8422  }
8423  #endif
8424 
8425 if(FLAME_jpoffice_firm_employee_message_board_read == 0)
8426 {
8427  /*printf("%d> jpoffice_firm_employee message board sync complete late as no agents reading any messages of this type\n", node_number);*/
8428 
8429  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_jpoffice_firm_employee)\n");
8430  rc = MB_SyncComplete(b_jpoffice_firm_employee);
8431  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_jpoffice_firm_employee)\n");
8432  #ifdef ERRCHECK
8433  if (rc != MB_SUCCESS)
8434  {
8435  fprintf(stderr, "ERROR: Could not complete sync of 'jpoffice_firm_employee' board\n");
8436  switch(rc) {
8437  case MB_ERR_INVALID:
8438  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
8439  break;
8440  case MB_ERR_MEMALLOC:
8441  fprintf(stderr, "\t reason: out of memory\n");
8442  break;
8443  case MB_ERR_INTERNAL:
8444  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8445  break;
8446  default:
8447  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
8448  break;
8449  }
8450 
8451 
8452  exit(rc);
8453  }
8454  #endif
8455 }
8456 
8457  /* Delete any search trees */
8458 
8459  rc = MB_Clear(b_jpoffice_firm_employee);
8460  #ifdef ERRCHECK
8461  if (rc != MB_SUCCESS)
8462  {
8463  fprintf(stderr, "ERROR: Could not clear 'jpoffice_firm_employee' board\n");
8464  switch(rc) {
8465  case MB_ERR_INVALID:
8466  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is invalid\n");
8467  break;
8468  case MB_ERR_LOCKED:
8469  fprintf(stderr, "\t reason: 'jpoffice_firm_employee' board is locked\n");
8470  break;
8471  case MB_ERR_INTERNAL:
8472  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8473  break;
8474  default:
8475  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
8476  break;
8477 
8478  }
8479 
8480 
8481  exit(rc);
8482  }
8483  #endif
8484 
8485  /* DEBUG: States with branching functions */
8488  {
8489  FLAME_debug_count = 0;
8490  /* Function: jpoffice_labour_stage1 */
8492  { FLAME_debug_count++; }
8493  /* Function: idle */
8495  { FLAME_debug_count++; }
8496  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
8497  if(FLAME_debug_count != 1)
8498  {
8499  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'jpoffice' leaving state 'JPOLabourMarket'\n");
8500  if(FLAME_debug_count > 1)
8501  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
8502  if(FLAME_debug_count == 0)
8503  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
8504  }
8505 
8507  }
8508 
8509  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_init_balancesheet\n");
8512  {
8516  /* For backwards compatibility set current_xmachine */
8527 
8528 
8529 
8530 
8531 
8532  i = firm_init_balancesheet();
8533 
8534 
8535 
8536  if(i == 1)
8537  {
8539  }
8540  else
8541  {
8543  }
8544 
8545 
8546  current_xmachine_firm = NULL;
8547 
8549  }
8550  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_init_balancesheet\n");
8551 
8552  if(FLAME_firm_bank_init_deposit_message_board_write == 1)
8553  {
8554 
8555  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_init_deposit)\n");
8556  rc = MB_SyncStart(b_firm_bank_init_deposit);
8557  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_init_deposit)\n");
8558  #ifdef ERRCHECK
8559  if (rc != MB_SUCCESS)
8560  {
8561  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_init_deposit' board\n");
8562  switch(rc) {
8563  case MB_ERR_INVALID:
8564  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
8565  break;
8566  case MB_ERR_LOCKED:
8567  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is locked\n");
8568  break;
8569  case MB_ERR_MEMALLOC:
8570  fprintf(stderr, "\t reason: out of memory\n");
8571  break;
8572  case MB_ERR_INTERNAL:
8573  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8574  break;
8575  default:
8576  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
8577  break;
8578  }
8579 
8580 
8581  exit(rc);
8582  }
8583  #endif
8584  }
8585 
8586 
8587  if(FLAME_firm_bank_init_loans_message_board_write == 1)
8588  {
8589 
8590  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_init_loans)\n");
8591  rc = MB_SyncStart(b_firm_bank_init_loans);
8592  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_init_loans)\n");
8593  #ifdef ERRCHECK
8594  if (rc != MB_SUCCESS)
8595  {
8596  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_init_loans' board\n");
8597  switch(rc) {
8598  case MB_ERR_INVALID:
8599  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
8600  break;
8601  case MB_ERR_LOCKED:
8602  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is locked\n");
8603  break;
8604  case MB_ERR_MEMALLOC:
8605  fprintf(stderr, "\t reason: out of memory\n");
8606  break;
8607  case MB_ERR_INTERNAL:
8608  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8609  break;
8610  default:
8611  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
8612  break;
8613  }
8614 
8615 
8616  exit(rc);
8617  }
8618  #endif
8619  }
8620 
8621 
8622 
8623  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_init_balancesheet\n");
8626  {
8630  /* For backwards compatibility set current_xmachine */
8641 
8642 
8643 
8644 
8645 
8647 
8648 
8649 
8650  if(i == 1)
8651  {
8653  }
8654  else
8655  {
8657  }
8658 
8659 
8661 
8663  }
8664  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_init_balancesheet\n");
8665 
8666  if(FLAME_household_bank_init_deposit_message_board_write == 1)
8667  {
8668 
8669  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_bank_init_deposit)\n");
8670  rc = MB_SyncStart(b_household_bank_init_deposit);
8671  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_bank_init_deposit)\n");
8672  #ifdef ERRCHECK
8673  if (rc != MB_SUCCESS)
8674  {
8675  fprintf(stderr, "ERROR: Could not start sync of 'household_bank_init_deposit' board\n");
8676  switch(rc) {
8677  case MB_ERR_INVALID:
8678  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
8679  break;
8680  case MB_ERR_LOCKED:
8681  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is locked\n");
8682  break;
8683  case MB_ERR_MEMALLOC:
8684  fprintf(stderr, "\t reason: out of memory\n");
8685  break;
8686  case MB_ERR_INTERNAL:
8687  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8688  break;
8689  default:
8690  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
8691  break;
8692  }
8693 
8694 
8695  exit(rc);
8696  }
8697  #endif
8698  }
8699 
8700 
8701  if(FLAME_household_bank_init_mortgages_message_board_write == 1)
8702  {
8703 
8704  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_bank_init_mortgages)\n");
8705  rc = MB_SyncStart(b_household_bank_init_mortgages);
8706  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_bank_init_mortgages)\n");
8707  #ifdef ERRCHECK
8708  if (rc != MB_SUCCESS)
8709  {
8710  fprintf(stderr, "ERROR: Could not start sync of 'household_bank_init_mortgages' board\n");
8711  switch(rc) {
8712  case MB_ERR_INVALID:
8713  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
8714  break;
8715  case MB_ERR_LOCKED:
8716  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is locked\n");
8717  break;
8718  case MB_ERR_MEMALLOC:
8719  fprintf(stderr, "\t reason: out of memory\n");
8720  break;
8721  case MB_ERR_INTERNAL:
8722  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8723  break;
8724  default:
8725  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
8726  break;
8727  }
8728 
8729 
8730  exit(rc);
8731  }
8732  #endif
8733  }
8734 
8735 
8736 
8737  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
8740  {
8744  /* For backwards compatibility set current_xmachine */
8755 
8757  {
8758 
8759 
8760 
8761  i = idle();
8762 
8763 
8764 
8765  if(i == 1)
8766  {
8768  }
8769  else
8770  {
8772  }
8773  }
8774 
8776 
8778  }
8779  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
8780 
8781 
8782 /* End of layer number 4 */
8783 
8784 /* Clear message boards that have finished being used
8785  * and sync complete if doing late sync complete */
8786 
8787 
8788  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_iterate\n");
8791  {
8795  /* For backwards compatibility set current_xmachine */
8806 
8807 
8808 
8809 
8810 
8811  i = household_iterate();
8812 
8813 
8814 
8815  if(i == 1)
8816  {
8818  }
8819  else
8820  {
8822  }
8823 
8824 
8826 
8828  }
8829  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_iterate\n");
8830 
8831 
8832  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_iterate\n");
8835  {
8839  /* For backwards compatibility set current_xmachine */
8850 
8851 
8852 
8853 
8854 
8855  i = firm_iterate();
8856 
8857 
8858 
8859  if(i == 1)
8860  {
8862  }
8863  else
8864  {
8866  }
8867 
8868 
8869  current_xmachine_firm = NULL;
8870 
8872  }
8873  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_iterate\n");
8874 
8875 
8876  /* If mb is not read then leave sync complete until last possible moment */
8877  if(FLAME_firm_bank_init_loans_message_board_read == 1)
8878  {
8879  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_init_loans)\n");
8880  rc = MB_SyncComplete(b_firm_bank_init_loans);
8881  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_init_loans)\n");
8882  #ifdef ERRCHECK
8883  if (rc != MB_SUCCESS)
8884  {
8885  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_init_loans' board\n");
8886  switch(rc) {
8887  case MB_ERR_INVALID:
8888  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
8889  break;
8890  case MB_ERR_MEMALLOC:
8891  fprintf(stderr, "\t reason: out of memory\n");
8892  break;
8893  case MB_ERR_INTERNAL:
8894  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8895  break;
8896  default:
8897  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
8898  break;
8899  }
8900 
8901 
8902  exit(rc);
8903  }
8904  #endif
8905 
8906 
8907 
8908  }
8909 
8910  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_init_loans\n");
8913  {
8917  /* For backwards compatibility set current_xmachine */
8928 
8929 
8930 
8931 
8932 
8933 
8934 
8935 
8937 
8938 
8939 
8940  #ifdef ERRCHECK
8941  if (rc != MB_SUCCESS)
8942  {
8943  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_init_loans'\n");
8944  switch(rc) {
8945  case MB_ERR_INVALID:
8946  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
8947  break;
8948  case MB_ERR_LOCKED:
8949  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is locked\n");
8950  break;
8951  case MB_ERR_MEMALLOC:
8952  fprintf(stderr, "\t reason: out of memory\n");
8953  break;
8954  case MB_ERR_INTERNAL:
8955  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8956  break;
8957  default:
8958 
8959  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
8960 
8961 
8962  break;
8963  }
8964 
8965 
8966  exit(rc);
8967  }
8968  #endif
8969 
8970 
8971 
8972  i = bank_init_loans();
8973 
8974 
8975  rc = MB_Iterator_Delete(&i_firm_bank_init_loans);
8976  #ifdef ERRCHECK
8977  if (rc != MB_SUCCESS)
8978  {
8979  fprintf(stderr, "ERROR: Could not delete 'firm_bank_init_loans' iterator\n");
8980  switch(rc) {
8981  case MB_ERR_INVALID:
8982  fprintf(stderr, "\t reason: 'firm_bank_init_loans' iterator is invalid\n");
8983  break;
8984  case MB_ERR_INTERNAL:
8985  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
8986  break;
8987  default:
8988  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
8989  break;
8990  }
8991 
8992 
8993  exit(rc);
8994  }
8995  #endif
8996 
8997 
8998  if(i == 1)
8999  {
9001  }
9002  else
9003  {
9005  }
9006 
9007 
9008  current_xmachine_bank = NULL;
9009 
9011  }
9012  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_init_loans\n");
9013 
9014 
9015 /* End of layer number 5 */
9016 
9017 /* Clear message boards that have finished being used
9018  * and sync complete if doing late sync complete */
9019 
9020 if(FLAME_firm_bank_init_loans_message_board_read == 0)
9021 {
9022  /*printf("%d> firm_bank_init_loans message board sync complete late as no agents reading any messages of this type\n", node_number);*/
9023 
9024  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_init_loans)\n");
9025  rc = MB_SyncComplete(b_firm_bank_init_loans);
9026  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_init_loans)\n");
9027  #ifdef ERRCHECK
9028  if (rc != MB_SUCCESS)
9029  {
9030  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_init_loans' board\n");
9031  switch(rc) {
9032  case MB_ERR_INVALID:
9033  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
9034  break;
9035  case MB_ERR_MEMALLOC:
9036  fprintf(stderr, "\t reason: out of memory\n");
9037  break;
9038  case MB_ERR_INTERNAL:
9039  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9040  break;
9041  default:
9042  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9043  break;
9044  }
9045 
9046 
9047  exit(rc);
9048  }
9049  #endif
9050 }
9051 
9052  /* Delete any search trees */
9053 
9054  rc = MB_Clear(b_firm_bank_init_loans);
9055  #ifdef ERRCHECK
9056  if (rc != MB_SUCCESS)
9057  {
9058  fprintf(stderr, "ERROR: Could not clear 'firm_bank_init_loans' board\n");
9059  switch(rc) {
9060  case MB_ERR_INVALID:
9061  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is invalid\n");
9062  break;
9063  case MB_ERR_LOCKED:
9064  fprintf(stderr, "\t reason: 'firm_bank_init_loans' board is locked\n");
9065  break;
9066  case MB_ERR_INTERNAL:
9067  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9068  break;
9069  default:
9070  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
9071  break;
9072 
9073  }
9074 
9075 
9076  exit(rc);
9077  }
9078  #endif
9079 
9080  /* DEBUG: States with branching functions */
9083  {
9084  FLAME_debug_count = 0;
9085  /* Function: firm_credit_compute_income_statement */
9087  { FLAME_debug_count++; }
9088  /* Function: idle */
9090  { FLAME_debug_count++; }
9091  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
9092  if(FLAME_debug_count != 1)
9093  {
9094  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditStart'\n");
9095  if(FLAME_debug_count > 1)
9096  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
9097  if(FLAME_debug_count == 0)
9098  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
9099  }
9100 
9102  }
9103 
9104  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
9107  {
9111  /* For backwards compatibility set current_xmachine */
9122 
9124  {
9125 
9126 
9127 
9128  i = idle();
9129 
9130 
9131 
9132  if(i == 1)
9133  {
9135  }
9136  else
9137  {
9139  }
9140  }
9141 
9143 
9145  }
9146  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
9147 
9148 
9149  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
9152  {
9156  /* For backwards compatibility set current_xmachine */
9167 
9169  {
9170 
9171 
9172 
9173  i = idle();
9174 
9175 
9176 
9177  if(i == 1)
9178  {
9180  }
9181  else
9182  {
9184  }
9185  }
9186 
9188 
9190  }
9191  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
9192 
9193 
9194  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_compute_income_statement\n");
9197  {
9201  /* For backwards compatibility set current_xmachine */
9212 
9214  {
9215 
9216 
9217 
9219 
9220 
9221 
9222  if(i == 1)
9223  {
9225  }
9226  else
9227  {
9229  }
9230  }
9231 
9232  current_xmachine_firm = NULL;
9233 
9235  }
9236  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_compute_income_statement\n");
9237 
9238 
9239  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
9242  {
9246  /* For backwards compatibility set current_xmachine */
9257 
9259  {
9260 
9261 
9262 
9263  i = idle();
9264 
9265 
9266 
9267  if(i == 1)
9268  {
9270  }
9271  else
9272  {
9274  }
9275  }
9276 
9277  current_xmachine_firm = NULL;
9278 
9280  }
9281  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
9282 
9283 
9284  /* If mb is not read then leave sync complete until last possible moment */
9285  if(FLAME_household_bank_init_mortgages_message_board_read == 1)
9286  {
9287  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_bank_init_mortgages)\n");
9288  rc = MB_SyncComplete(b_household_bank_init_mortgages);
9289  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_bank_init_mortgages)\n");
9290  #ifdef ERRCHECK
9291  if (rc != MB_SUCCESS)
9292  {
9293  fprintf(stderr, "ERROR: Could not complete sync of 'household_bank_init_mortgages' board\n");
9294  switch(rc) {
9295  case MB_ERR_INVALID:
9296  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
9297  break;
9298  case MB_ERR_MEMALLOC:
9299  fprintf(stderr, "\t reason: out of memory\n");
9300  break;
9301  case MB_ERR_INTERNAL:
9302  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9303  break;
9304  default:
9305  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9306  break;
9307  }
9308 
9309 
9310  exit(rc);
9311  }
9312  #endif
9313 
9314 
9315 
9316  }
9317 
9318  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_init_mortgages\n");
9321  {
9325  /* For backwards compatibility set current_xmachine */
9336 
9337 
9338 
9339 
9340 
9341 
9342 
9343 
9345 
9346 
9347 
9348  #ifdef ERRCHECK
9349  if (rc != MB_SUCCESS)
9350  {
9351  fprintf(stderr, "ERROR: Could not create Iterator for 'household_bank_init_mortgages'\n");
9352  switch(rc) {
9353  case MB_ERR_INVALID:
9354  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
9355  break;
9356  case MB_ERR_LOCKED:
9357  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is locked\n");
9358  break;
9359  case MB_ERR_MEMALLOC:
9360  fprintf(stderr, "\t reason: out of memory\n");
9361  break;
9362  case MB_ERR_INTERNAL:
9363  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9364  break;
9365  default:
9366 
9367  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
9368 
9369 
9370  break;
9371  }
9372 
9373 
9374  exit(rc);
9375  }
9376  #endif
9377 
9378 
9379 
9380  i = bank_init_mortgages();
9381 
9382 
9383  rc = MB_Iterator_Delete(&i_household_bank_init_mortgages);
9384  #ifdef ERRCHECK
9385  if (rc != MB_SUCCESS)
9386  {
9387  fprintf(stderr, "ERROR: Could not delete 'household_bank_init_mortgages' iterator\n");
9388  switch(rc) {
9389  case MB_ERR_INVALID:
9390  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' iterator is invalid\n");
9391  break;
9392  case MB_ERR_INTERNAL:
9393  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9394  break;
9395  default:
9396  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
9397  break;
9398  }
9399 
9400 
9401  exit(rc);
9402  }
9403  #endif
9404 
9405 
9406  if(i == 1)
9407  {
9409  }
9410  else
9411  {
9413  }
9414 
9415 
9416  current_xmachine_bank = NULL;
9417 
9419  }
9420  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_init_mortgages\n");
9421 
9422 
9423 /* End of layer number 6 */
9424 
9425 /* Clear message boards that have finished being used
9426  * and sync complete if doing late sync complete */
9427 
9428 if(FLAME_household_bank_init_mortgages_message_board_read == 0)
9429 {
9430  /*printf("%d> household_bank_init_mortgages message board sync complete late as no agents reading any messages of this type\n", node_number);*/
9431 
9432  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_bank_init_mortgages)\n");
9433  rc = MB_SyncComplete(b_household_bank_init_mortgages);
9434  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_bank_init_mortgages)\n");
9435  #ifdef ERRCHECK
9436  if (rc != MB_SUCCESS)
9437  {
9438  fprintf(stderr, "ERROR: Could not complete sync of 'household_bank_init_mortgages' board\n");
9439  switch(rc) {
9440  case MB_ERR_INVALID:
9441  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
9442  break;
9443  case MB_ERR_MEMALLOC:
9444  fprintf(stderr, "\t reason: out of memory\n");
9445  break;
9446  case MB_ERR_INTERNAL:
9447  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9448  break;
9449  default:
9450  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9451  break;
9452  }
9453 
9454 
9455  exit(rc);
9456  }
9457  #endif
9458 }
9459 
9460  /* Delete any search trees */
9461 
9462  rc = MB_Clear(b_household_bank_init_mortgages);
9463  #ifdef ERRCHECK
9464  if (rc != MB_SUCCESS)
9465  {
9466  fprintf(stderr, "ERROR: Could not clear 'household_bank_init_mortgages' board\n");
9467  switch(rc) {
9468  case MB_ERR_INVALID:
9469  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is invalid\n");
9470  break;
9471  case MB_ERR_LOCKED:
9472  fprintf(stderr, "\t reason: 'household_bank_init_mortgages' board is locked\n");
9473  break;
9474  case MB_ERR_INTERNAL:
9475  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9476  break;
9477  default:
9478  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
9479  break;
9480 
9481  }
9482 
9483 
9484  exit(rc);
9485  }
9486  #endif
9487 
9488  /* DEBUG: States with branching functions */
9491  {
9492  FLAME_debug_count = 0;
9493  /* Function: household_credit_collect_shares */
9495  { FLAME_debug_count++; }
9496  /* Function: idle */
9498  { FLAME_debug_count++; }
9499  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
9500  if(FLAME_debug_count != 1)
9501  {
9502  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHCreditIsCapitalist'\n");
9503  if(FLAME_debug_count > 1)
9504  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
9505  if(FLAME_debug_count == 0)
9506  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
9507  }
9508 
9510  }
9511 
9512  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
9515  {
9519  /* For backwards compatibility set current_xmachine */
9530 
9532  {
9533 
9534 
9535 
9536  i = idle();
9537 
9538 
9539 
9540  if(i == 1)
9541  {
9543  }
9544  else
9545  {
9547  }
9548  }
9549 
9551 
9553  }
9554  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
9555 
9556 
9557  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_investment_decisions\n");
9560  {
9564  /* For backwards compatibility set current_xmachine */
9575 
9576 
9577 
9578 
9579 
9581 
9582 
9583 
9584  if(i == 1)
9585  {
9587  }
9588  else
9589  {
9591  }
9592 
9593 
9594  current_xmachine_firm = NULL;
9595 
9597  }
9598  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_investment_decisions\n");
9599 
9600 
9601  /* If mb is not read then leave sync complete until last possible moment */
9602  if(FLAME_household_bank_init_deposit_message_board_read == 1)
9603  {
9604  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_bank_init_deposit)\n");
9605  rc = MB_SyncComplete(b_household_bank_init_deposit);
9606  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_bank_init_deposit)\n");
9607  #ifdef ERRCHECK
9608  if (rc != MB_SUCCESS)
9609  {
9610  fprintf(stderr, "ERROR: Could not complete sync of 'household_bank_init_deposit' board\n");
9611  switch(rc) {
9612  case MB_ERR_INVALID:
9613  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
9614  break;
9615  case MB_ERR_MEMALLOC:
9616  fprintf(stderr, "\t reason: out of memory\n");
9617  break;
9618  case MB_ERR_INTERNAL:
9619  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9620  break;
9621  default:
9622  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9623  break;
9624  }
9625 
9626 
9627  exit(rc);
9628  }
9629  #endif
9630 
9631 
9632 
9633  }
9634 
9635  /* If mb is not read then leave sync complete until last possible moment */
9636  if(FLAME_firm_bank_init_deposit_message_board_read == 1)
9637  {
9638  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_init_deposit)\n");
9639  rc = MB_SyncComplete(b_firm_bank_init_deposit);
9640  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_init_deposit)\n");
9641  #ifdef ERRCHECK
9642  if (rc != MB_SUCCESS)
9643  {
9644  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_init_deposit' board\n");
9645  switch(rc) {
9646  case MB_ERR_INVALID:
9647  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
9648  break;
9649  case MB_ERR_MEMALLOC:
9650  fprintf(stderr, "\t reason: out of memory\n");
9651  break;
9652  case MB_ERR_INTERNAL:
9653  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9654  break;
9655  default:
9656  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9657  break;
9658  }
9659 
9660 
9661  exit(rc);
9662  }
9663  #endif
9664 
9665 
9666 
9667  }
9668 
9669  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_init_deposits\n");
9672  {
9676  /* For backwards compatibility set current_xmachine */
9687 
9688 
9689 
9690 
9691 
9692 
9693 
9694 
9696 
9697 
9698 
9699  #ifdef ERRCHECK
9700  if (rc != MB_SUCCESS)
9701  {
9702  fprintf(stderr, "ERROR: Could not create Iterator for 'household_bank_init_deposit'\n");
9703  switch(rc) {
9704  case MB_ERR_INVALID:
9705  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
9706  break;
9707  case MB_ERR_LOCKED:
9708  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is locked\n");
9709  break;
9710  case MB_ERR_MEMALLOC:
9711  fprintf(stderr, "\t reason: out of memory\n");
9712  break;
9713  case MB_ERR_INTERNAL:
9714  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9715  break;
9716  default:
9717 
9718  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
9719 
9720 
9721  break;
9722  }
9723 
9724 
9725  exit(rc);
9726  }
9727  #endif
9728 
9729 
9730 
9731 
9732 
9733 
9735 
9736 
9737 
9738  #ifdef ERRCHECK
9739  if (rc != MB_SUCCESS)
9740  {
9741  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_init_deposit'\n");
9742  switch(rc) {
9743  case MB_ERR_INVALID:
9744  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
9745  break;
9746  case MB_ERR_LOCKED:
9747  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is locked\n");
9748  break;
9749  case MB_ERR_MEMALLOC:
9750  fprintf(stderr, "\t reason: out of memory\n");
9751  break;
9752  case MB_ERR_INTERNAL:
9753  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9754  break;
9755  default:
9756 
9757  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
9758 
9759 
9760  break;
9761  }
9762 
9763 
9764  exit(rc);
9765  }
9766  #endif
9767 
9768 
9769 
9770  i = bank_init_deposits();
9771 
9772 
9773  rc = MB_Iterator_Delete(&i_household_bank_init_deposit);
9774  #ifdef ERRCHECK
9775  if (rc != MB_SUCCESS)
9776  {
9777  fprintf(stderr, "ERROR: Could not delete 'household_bank_init_deposit' iterator\n");
9778  switch(rc) {
9779  case MB_ERR_INVALID:
9780  fprintf(stderr, "\t reason: 'household_bank_init_deposit' iterator is invalid\n");
9781  break;
9782  case MB_ERR_INTERNAL:
9783  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9784  break;
9785  default:
9786  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
9787  break;
9788  }
9789 
9790 
9791  exit(rc);
9792  }
9793  #endif
9794 
9795  rc = MB_Iterator_Delete(&i_firm_bank_init_deposit);
9796  #ifdef ERRCHECK
9797  if (rc != MB_SUCCESS)
9798  {
9799  fprintf(stderr, "ERROR: Could not delete 'firm_bank_init_deposit' iterator\n");
9800  switch(rc) {
9801  case MB_ERR_INVALID:
9802  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' iterator is invalid\n");
9803  break;
9804  case MB_ERR_INTERNAL:
9805  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9806  break;
9807  default:
9808  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
9809  break;
9810  }
9811 
9812 
9813  exit(rc);
9814  }
9815  #endif
9816 
9817 
9818  if(i == 1)
9819  {
9821  }
9822  else
9823  {
9825  }
9826 
9827 
9828  current_xmachine_bank = NULL;
9829 
9831  }
9832  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_init_deposits\n");
9833 
9834 
9835 /* End of layer number 7 */
9836 
9837 /* Clear message boards that have finished being used
9838  * and sync complete if doing late sync complete */
9839 
9840 if(FLAME_firm_bank_init_deposit_message_board_read == 0)
9841 {
9842  /*printf("%d> firm_bank_init_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
9843 
9844  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_init_deposit)\n");
9845  rc = MB_SyncComplete(b_firm_bank_init_deposit);
9846  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_init_deposit)\n");
9847  #ifdef ERRCHECK
9848  if (rc != MB_SUCCESS)
9849  {
9850  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_init_deposit' board\n");
9851  switch(rc) {
9852  case MB_ERR_INVALID:
9853  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
9854  break;
9855  case MB_ERR_MEMALLOC:
9856  fprintf(stderr, "\t reason: out of memory\n");
9857  break;
9858  case MB_ERR_INTERNAL:
9859  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9860  break;
9861  default:
9862  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9863  break;
9864  }
9865 
9866 
9867  exit(rc);
9868  }
9869  #endif
9870 }
9871 
9872  /* Delete any search trees */
9873 
9874  rc = MB_Clear(b_firm_bank_init_deposit);
9875  #ifdef ERRCHECK
9876  if (rc != MB_SUCCESS)
9877  {
9878  fprintf(stderr, "ERROR: Could not clear 'firm_bank_init_deposit' board\n");
9879  switch(rc) {
9880  case MB_ERR_INVALID:
9881  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is invalid\n");
9882  break;
9883  case MB_ERR_LOCKED:
9884  fprintf(stderr, "\t reason: 'firm_bank_init_deposit' board is locked\n");
9885  break;
9886  case MB_ERR_INTERNAL:
9887  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9888  break;
9889  default:
9890  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
9891  break;
9892 
9893  }
9894 
9895 
9896  exit(rc);
9897  }
9898  #endif
9899 
9900 if(FLAME_household_bank_init_deposit_message_board_read == 0)
9901 {
9902  /*printf("%d> household_bank_init_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
9903 
9904  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_bank_init_deposit)\n");
9905  rc = MB_SyncComplete(b_household_bank_init_deposit);
9906  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_bank_init_deposit)\n");
9907  #ifdef ERRCHECK
9908  if (rc != MB_SUCCESS)
9909  {
9910  fprintf(stderr, "ERROR: Could not complete sync of 'household_bank_init_deposit' board\n");
9911  switch(rc) {
9912  case MB_ERR_INVALID:
9913  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
9914  break;
9915  case MB_ERR_MEMALLOC:
9916  fprintf(stderr, "\t reason: out of memory\n");
9917  break;
9918  case MB_ERR_INTERNAL:
9919  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9920  break;
9921  default:
9922  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
9923  break;
9924  }
9925 
9926 
9927  exit(rc);
9928  }
9929  #endif
9930 }
9931 
9932  /* Delete any search trees */
9933 
9934  rc = MB_Clear(b_household_bank_init_deposit);
9935  #ifdef ERRCHECK
9936  if (rc != MB_SUCCESS)
9937  {
9938  fprintf(stderr, "ERROR: Could not clear 'household_bank_init_deposit' board\n");
9939  switch(rc) {
9940  case MB_ERR_INVALID:
9941  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is invalid\n");
9942  break;
9943  case MB_ERR_LOCKED:
9944  fprintf(stderr, "\t reason: 'household_bank_init_deposit' board is locked\n");
9945  break;
9946  case MB_ERR_INTERNAL:
9947  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
9948  break;
9949  default:
9950  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
9951  break;
9952 
9953  }
9954 
9955 
9956  exit(rc);
9957  }
9958  #endif
9959 
9960 
9961  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_init_balancesheet\n");
9964  {
9968  /* For backwards compatibility set current_xmachine */
9979 
9980 
9981 
9982 
9983 
9984  i = bank_init_balancesheet();
9985 
9986 
9987 
9988  if(i == 1)
9989  {
9991  }
9992  else
9993  {
9995  }
9996 
9997 
9998  current_xmachine_bank = NULL;
9999 
10001  }
10002  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_init_balancesheet\n");
10003 
10004  if(FLAME_bank_centralbank_init_deposit_message_board_write == 1)
10005  {
10006 
10007  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_init_deposit)\n");
10008  rc = MB_SyncStart(b_bank_centralbank_init_deposit);
10009  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_init_deposit)\n");
10010  #ifdef ERRCHECK
10011  if (rc != MB_SUCCESS)
10012  {
10013  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_init_deposit' board\n");
10014  switch(rc) {
10015  case MB_ERR_INVALID:
10016  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
10017  break;
10018  case MB_ERR_LOCKED:
10019  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is locked\n");
10020  break;
10021  case MB_ERR_MEMALLOC:
10022  fprintf(stderr, "\t reason: out of memory\n");
10023  break;
10024  case MB_ERR_INTERNAL:
10025  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10026  break;
10027  default:
10028  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
10029  break;
10030  }
10031 
10032 
10033  exit(rc);
10034  }
10035  #endif
10036  }
10037 
10038 
10039  if(FLAME_bank_centralbank_init_debt_message_board_write == 1)
10040  {
10041 
10042  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_init_debt)\n");
10043  rc = MB_SyncStart(b_bank_centralbank_init_debt);
10044  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_init_debt)\n");
10045  #ifdef ERRCHECK
10046  if (rc != MB_SUCCESS)
10047  {
10048  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_init_debt' board\n");
10049  switch(rc) {
10050  case MB_ERR_INVALID:
10051  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
10052  break;
10053  case MB_ERR_LOCKED:
10054  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is locked\n");
10055  break;
10056  case MB_ERR_MEMALLOC:
10057  fprintf(stderr, "\t reason: out of memory\n");
10058  break;
10059  case MB_ERR_INTERNAL:
10060  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10061  break;
10062  default:
10063  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
10064  break;
10065  }
10066 
10067 
10068  exit(rc);
10069  }
10070  #endif
10071  }
10072 
10073 
10074 
10075  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_compute_dividends\n");
10078  {
10082  /* For backwards compatibility set current_xmachine */
10093 
10094 
10095 
10096 
10097 
10099 
10100 
10101 
10102  if(i == 1)
10103  {
10105  }
10106  else
10107  {
10109  }
10110 
10111 
10112  current_xmachine_firm = NULL;
10113 
10115  }
10116  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_compute_dividends\n");
10117 
10118 
10119 /* End of layer number 8 */
10120 
10121 /* Clear message boards that have finished being used
10122  * and sync complete if doing late sync complete */
10123 
10124 
10125  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_iterate\n");
10128  {
10132  /* For backwards compatibility set current_xmachine */
10143 
10144 
10145 
10146 
10147 
10148  i = bank_iterate();
10149 
10150 
10151 
10152  if(i == 1)
10153  {
10155  }
10156  else
10157  {
10159  }
10160 
10161 
10162  current_xmachine_bank = NULL;
10163 
10165  }
10166  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_iterate\n");
10167 
10168 
10169  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_check_liquidity_need\n");
10172  {
10176  /* For backwards compatibility set current_xmachine */
10187 
10188 
10189 
10190 
10191 
10193 
10194 
10195 
10196  if(i == 1)
10197  {
10199  }
10200  else
10201  {
10203  }
10204 
10205 
10206  current_xmachine_firm = NULL;
10207 
10209  }
10210  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_check_liquidity_need\n");
10211 
10212 
10213  /* If mb is not read then leave sync complete until last possible moment */
10214  if(FLAME_gov_centralbank_init_deposit_message_board_read == 1)
10215  {
10216  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_init_deposit)\n");
10217  rc = MB_SyncComplete(b_gov_centralbank_init_deposit);
10218  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_init_deposit)\n");
10219  #ifdef ERRCHECK
10220  if (rc != MB_SUCCESS)
10221  {
10222  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_init_deposit' board\n");
10223  switch(rc) {
10224  case MB_ERR_INVALID:
10225  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
10226  break;
10227  case MB_ERR_MEMALLOC:
10228  fprintf(stderr, "\t reason: out of memory\n");
10229  break;
10230  case MB_ERR_INTERNAL:
10231  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10232  break;
10233  default:
10234  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10235  break;
10236  }
10237 
10238 
10239  exit(rc);
10240  }
10241  #endif
10242 
10243 
10244 
10245  }
10246 
10247  /* If mb is not read then leave sync complete until last possible moment */
10248  if(FLAME_fund_centralbank_init_deposit_message_board_read == 1)
10249  {
10250  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_centralbank_init_deposit)\n");
10251  rc = MB_SyncComplete(b_fund_centralbank_init_deposit);
10252  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_centralbank_init_deposit)\n");
10253  #ifdef ERRCHECK
10254  if (rc != MB_SUCCESS)
10255  {
10256  fprintf(stderr, "ERROR: Could not complete sync of 'fund_centralbank_init_deposit' board\n");
10257  switch(rc) {
10258  case MB_ERR_INVALID:
10259  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
10260  break;
10261  case MB_ERR_MEMALLOC:
10262  fprintf(stderr, "\t reason: out of memory\n");
10263  break;
10264  case MB_ERR_INTERNAL:
10265  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10266  break;
10267  default:
10268  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10269  break;
10270  }
10271 
10272 
10273  exit(rc);
10274  }
10275  #endif
10276 
10277 
10278 
10279  }
10280 
10281  /* If mb is not read then leave sync complete until last possible moment */
10282  if(FLAME_bank_centralbank_init_deposit_message_board_read == 1)
10283  {
10284  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_init_deposit)\n");
10285  rc = MB_SyncComplete(b_bank_centralbank_init_deposit);
10286  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_init_deposit)\n");
10287  #ifdef ERRCHECK
10288  if (rc != MB_SUCCESS)
10289  {
10290  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_init_deposit' board\n");
10291  switch(rc) {
10292  case MB_ERR_INVALID:
10293  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
10294  break;
10295  case MB_ERR_MEMALLOC:
10296  fprintf(stderr, "\t reason: out of memory\n");
10297  break;
10298  case MB_ERR_INTERNAL:
10299  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10300  break;
10301  default:
10302  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10303  break;
10304  }
10305 
10306 
10307  exit(rc);
10308  }
10309  #endif
10310 
10311 
10312 
10313  }
10314 
10315  /* If mb is not read then leave sync complete until last possible moment */
10316  if(FLAME_bank_centralbank_init_debt_message_board_read == 1)
10317  {
10318  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_init_debt)\n");
10319  rc = MB_SyncComplete(b_bank_centralbank_init_debt);
10320  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_init_debt)\n");
10321  #ifdef ERRCHECK
10322  if (rc != MB_SUCCESS)
10323  {
10324  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_init_debt' board\n");
10325  switch(rc) {
10326  case MB_ERR_INVALID:
10327  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
10328  break;
10329  case MB_ERR_MEMALLOC:
10330  fprintf(stderr, "\t reason: out of memory\n");
10331  break;
10332  case MB_ERR_INTERNAL:
10333  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10334  break;
10335  default:
10336  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10337  break;
10338  }
10339 
10340 
10341  exit(rc);
10342  }
10343  #endif
10344 
10345 
10346 
10347  }
10348 
10349  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_init_balancesheet\n");
10352  {
10356  /* For backwards compatibility set current_xmachine */
10367 
10368 
10369 
10370 
10371 
10372 
10374 
10375 
10376  #ifdef ERRCHECK
10377  if (rc != MB_SUCCESS)
10378  {
10379  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_centralbank_init_debt'\n");
10380  switch(rc) {
10381  case MB_ERR_INVALID:
10382  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
10383  break;
10384  case MB_ERR_LOCKED:
10385  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is locked\n");
10386  break;
10387  case MB_ERR_MEMALLOC:
10388  fprintf(stderr, "\t reason: out of memory\n");
10389  break;
10390  case MB_ERR_INTERNAL:
10391  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10392  break;
10393  default:
10394 
10395 
10396  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
10397 
10398  break;
10399  }
10400 
10401 
10402  exit(rc);
10403  }
10404  #endif
10405 
10406 
10407 
10408 
10410 
10411 
10412  #ifdef ERRCHECK
10413  if (rc != MB_SUCCESS)
10414  {
10415  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_centralbank_init_deposit'\n");
10416  switch(rc) {
10417  case MB_ERR_INVALID:
10418  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
10419  break;
10420  case MB_ERR_LOCKED:
10421  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is locked\n");
10422  break;
10423  case MB_ERR_MEMALLOC:
10424  fprintf(stderr, "\t reason: out of memory\n");
10425  break;
10426  case MB_ERR_INTERNAL:
10427  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10428  break;
10429  default:
10430 
10431 
10432  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
10433 
10434  break;
10435  }
10436 
10437 
10438  exit(rc);
10439  }
10440  #endif
10441 
10442 
10443 
10444 
10446 
10447 
10448  #ifdef ERRCHECK
10449  if (rc != MB_SUCCESS)
10450  {
10451  fprintf(stderr, "ERROR: Could not create Iterator for 'fund_centralbank_init_deposit'\n");
10452  switch(rc) {
10453  case MB_ERR_INVALID:
10454  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
10455  break;
10456  case MB_ERR_LOCKED:
10457  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is locked\n");
10458  break;
10459  case MB_ERR_MEMALLOC:
10460  fprintf(stderr, "\t reason: out of memory\n");
10461  break;
10462  case MB_ERR_INTERNAL:
10463  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10464  break;
10465  default:
10466 
10467 
10468  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
10469 
10470  break;
10471  }
10472 
10473 
10474  exit(rc);
10475  }
10476  #endif
10477 
10478 
10479 
10480 
10482 
10483 
10484  #ifdef ERRCHECK
10485  if (rc != MB_SUCCESS)
10486  {
10487  fprintf(stderr, "ERROR: Could not create Iterator for 'gov_centralbank_init_deposit'\n");
10488  switch(rc) {
10489  case MB_ERR_INVALID:
10490  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
10491  break;
10492  case MB_ERR_LOCKED:
10493  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is locked\n");
10494  break;
10495  case MB_ERR_MEMALLOC:
10496  fprintf(stderr, "\t reason: out of memory\n");
10497  break;
10498  case MB_ERR_INTERNAL:
10499  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10500  break;
10501  default:
10502 
10503 
10504  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
10505 
10506  break;
10507  }
10508 
10509 
10510  exit(rc);
10511  }
10512  #endif
10513 
10514 
10515 
10517 
10518 
10519  rc = MB_Iterator_Delete(&i_bank_centralbank_init_debt);
10520  #ifdef ERRCHECK
10521  if (rc != MB_SUCCESS)
10522  {
10523  fprintf(stderr, "ERROR: Could not delete 'bank_centralbank_init_debt' iterator\n");
10524  switch(rc) {
10525  case MB_ERR_INVALID:
10526  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' iterator is invalid\n");
10527  break;
10528  case MB_ERR_INTERNAL:
10529  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10530  break;
10531  default:
10532  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
10533  break;
10534  }
10535 
10536 
10537  exit(rc);
10538  }
10539  #endif
10540 
10541  rc = MB_Iterator_Delete(&i_bank_centralbank_init_deposit);
10542  #ifdef ERRCHECK
10543  if (rc != MB_SUCCESS)
10544  {
10545  fprintf(stderr, "ERROR: Could not delete 'bank_centralbank_init_deposit' iterator\n");
10546  switch(rc) {
10547  case MB_ERR_INVALID:
10548  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' iterator is invalid\n");
10549  break;
10550  case MB_ERR_INTERNAL:
10551  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10552  break;
10553  default:
10554  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
10555  break;
10556  }
10557 
10558 
10559  exit(rc);
10560  }
10561  #endif
10562 
10563  rc = MB_Iterator_Delete(&i_fund_centralbank_init_deposit);
10564  #ifdef ERRCHECK
10565  if (rc != MB_SUCCESS)
10566  {
10567  fprintf(stderr, "ERROR: Could not delete 'fund_centralbank_init_deposit' iterator\n");
10568  switch(rc) {
10569  case MB_ERR_INVALID:
10570  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' iterator is invalid\n");
10571  break;
10572  case MB_ERR_INTERNAL:
10573  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10574  break;
10575  default:
10576  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
10577  break;
10578  }
10579 
10580 
10581  exit(rc);
10582  }
10583  #endif
10584 
10585  rc = MB_Iterator_Delete(&i_gov_centralbank_init_deposit);
10586  #ifdef ERRCHECK
10587  if (rc != MB_SUCCESS)
10588  {
10589  fprintf(stderr, "ERROR: Could not delete 'gov_centralbank_init_deposit' iterator\n");
10590  switch(rc) {
10591  case MB_ERR_INVALID:
10592  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' iterator is invalid\n");
10593  break;
10594  case MB_ERR_INTERNAL:
10595  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10596  break;
10597  default:
10598  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
10599  break;
10600  }
10601 
10602 
10603  exit(rc);
10604  }
10605  #endif
10606 
10607 
10608  if(i == 1)
10609  {
10611  }
10612  else
10613  {
10615  }
10616 
10617 
10619 
10621  }
10622  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_init_balancesheet\n");
10623 
10624 
10625 /* End of layer number 9 */
10626 
10627 /* Clear message boards that have finished being used
10628  * and sync complete if doing late sync complete */
10629 
10630 if(FLAME_bank_centralbank_init_debt_message_board_read == 0)
10631 {
10632  /*printf("%d> bank_centralbank_init_debt message board sync complete late as no agents reading any messages of this type\n", node_number);*/
10633 
10634  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_init_debt)\n");
10635  rc = MB_SyncComplete(b_bank_centralbank_init_debt);
10636  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_init_debt)\n");
10637  #ifdef ERRCHECK
10638  if (rc != MB_SUCCESS)
10639  {
10640  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_init_debt' board\n");
10641  switch(rc) {
10642  case MB_ERR_INVALID:
10643  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
10644  break;
10645  case MB_ERR_MEMALLOC:
10646  fprintf(stderr, "\t reason: out of memory\n");
10647  break;
10648  case MB_ERR_INTERNAL:
10649  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10650  break;
10651  default:
10652  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10653  break;
10654  }
10655 
10656 
10657  exit(rc);
10658  }
10659  #endif
10660 }
10661 
10662  /* Delete any search trees */
10663 
10664  rc = MB_Clear(b_bank_centralbank_init_debt);
10665  #ifdef ERRCHECK
10666  if (rc != MB_SUCCESS)
10667  {
10668  fprintf(stderr, "ERROR: Could not clear 'bank_centralbank_init_debt' board\n");
10669  switch(rc) {
10670  case MB_ERR_INVALID:
10671  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is invalid\n");
10672  break;
10673  case MB_ERR_LOCKED:
10674  fprintf(stderr, "\t reason: 'bank_centralbank_init_debt' board is locked\n");
10675  break;
10676  case MB_ERR_INTERNAL:
10677  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10678  break;
10679  default:
10680  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
10681  break;
10682 
10683  }
10684 
10685 
10686  exit(rc);
10687  }
10688  #endif
10689 
10690 if(FLAME_bank_centralbank_init_deposit_message_board_read == 0)
10691 {
10692  /*printf("%d> bank_centralbank_init_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
10693 
10694  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_init_deposit)\n");
10695  rc = MB_SyncComplete(b_bank_centralbank_init_deposit);
10696  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_init_deposit)\n");
10697  #ifdef ERRCHECK
10698  if (rc != MB_SUCCESS)
10699  {
10700  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_init_deposit' board\n");
10701  switch(rc) {
10702  case MB_ERR_INVALID:
10703  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
10704  break;
10705  case MB_ERR_MEMALLOC:
10706  fprintf(stderr, "\t reason: out of memory\n");
10707  break;
10708  case MB_ERR_INTERNAL:
10709  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10710  break;
10711  default:
10712  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10713  break;
10714  }
10715 
10716 
10717  exit(rc);
10718  }
10719  #endif
10720 }
10721 
10722  /* Delete any search trees */
10723 
10724  rc = MB_Clear(b_bank_centralbank_init_deposit);
10725  #ifdef ERRCHECK
10726  if (rc != MB_SUCCESS)
10727  {
10728  fprintf(stderr, "ERROR: Could not clear 'bank_centralbank_init_deposit' board\n");
10729  switch(rc) {
10730  case MB_ERR_INVALID:
10731  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is invalid\n");
10732  break;
10733  case MB_ERR_LOCKED:
10734  fprintf(stderr, "\t reason: 'bank_centralbank_init_deposit' board is locked\n");
10735  break;
10736  case MB_ERR_INTERNAL:
10737  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10738  break;
10739  default:
10740  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
10741  break;
10742 
10743  }
10744 
10745 
10746  exit(rc);
10747  }
10748  #endif
10749 
10750 if(FLAME_fund_centralbank_init_deposit_message_board_read == 0)
10751 {
10752  /*printf("%d> fund_centralbank_init_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
10753 
10754  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_centralbank_init_deposit)\n");
10755  rc = MB_SyncComplete(b_fund_centralbank_init_deposit);
10756  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_centralbank_init_deposit)\n");
10757  #ifdef ERRCHECK
10758  if (rc != MB_SUCCESS)
10759  {
10760  fprintf(stderr, "ERROR: Could not complete sync of 'fund_centralbank_init_deposit' board\n");
10761  switch(rc) {
10762  case MB_ERR_INVALID:
10763  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
10764  break;
10765  case MB_ERR_MEMALLOC:
10766  fprintf(stderr, "\t reason: out of memory\n");
10767  break;
10768  case MB_ERR_INTERNAL:
10769  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10770  break;
10771  default:
10772  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10773  break;
10774  }
10775 
10776 
10777  exit(rc);
10778  }
10779  #endif
10780 }
10781 
10782  /* Delete any search trees */
10783 
10784  rc = MB_Clear(b_fund_centralbank_init_deposit);
10785  #ifdef ERRCHECK
10786  if (rc != MB_SUCCESS)
10787  {
10788  fprintf(stderr, "ERROR: Could not clear 'fund_centralbank_init_deposit' board\n");
10789  switch(rc) {
10790  case MB_ERR_INVALID:
10791  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is invalid\n");
10792  break;
10793  case MB_ERR_LOCKED:
10794  fprintf(stderr, "\t reason: 'fund_centralbank_init_deposit' board is locked\n");
10795  break;
10796  case MB_ERR_INTERNAL:
10797  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10798  break;
10799  default:
10800  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
10801  break;
10802 
10803  }
10804 
10805 
10806  exit(rc);
10807  }
10808  #endif
10809 
10810 if(FLAME_gov_centralbank_init_deposit_message_board_read == 0)
10811 {
10812  /*printf("%d> gov_centralbank_init_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
10813 
10814  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_init_deposit)\n");
10815  rc = MB_SyncComplete(b_gov_centralbank_init_deposit);
10816  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_init_deposit)\n");
10817  #ifdef ERRCHECK
10818  if (rc != MB_SUCCESS)
10819  {
10820  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_init_deposit' board\n");
10821  switch(rc) {
10822  case MB_ERR_INVALID:
10823  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
10824  break;
10825  case MB_ERR_MEMALLOC:
10826  fprintf(stderr, "\t reason: out of memory\n");
10827  break;
10828  case MB_ERR_INTERNAL:
10829  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10830  break;
10831  default:
10832  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
10833  break;
10834  }
10835 
10836 
10837  exit(rc);
10838  }
10839  #endif
10840 }
10841 
10842  /* Delete any search trees */
10843 
10844  rc = MB_Clear(b_gov_centralbank_init_deposit);
10845  #ifdef ERRCHECK
10846  if (rc != MB_SUCCESS)
10847  {
10848  fprintf(stderr, "ERROR: Could not clear 'gov_centralbank_init_deposit' board\n");
10849  switch(rc) {
10850  case MB_ERR_INVALID:
10851  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is invalid\n");
10852  break;
10853  case MB_ERR_LOCKED:
10854  fprintf(stderr, "\t reason: 'gov_centralbank_init_deposit' board is locked\n");
10855  break;
10856  case MB_ERR_INTERNAL:
10857  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10858  break;
10859  default:
10860  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
10861  break;
10862 
10863  }
10864 
10865 
10866  exit(rc);
10867  }
10868  #endif
10869 
10870  /* DEBUG: States with branching functions */
10873  {
10874  FLAME_debug_count = 0;
10875  /* Function: firm_credit_demand_loans_1 */
10877  { FLAME_debug_count++; }
10878  /* Function: idle */
10880  { FLAME_debug_count++; }
10881  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
10882  if(FLAME_debug_count != 1)
10883  {
10884  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditStatus'\n");
10885  if(FLAME_debug_count > 1)
10886  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
10887  if(FLAME_debug_count == 0)
10888  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
10889  }
10890 
10892  }
10893  /* DEBUG: States with branching functions */
10896  {
10897  FLAME_debug_count = 0;
10898  /* Function: bank_credit_compute_income_statement */
10900  { FLAME_debug_count++; }
10901  /* Function: idle */
10903  { FLAME_debug_count++; }
10904  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
10905  if(FLAME_debug_count != 1)
10906  {
10907  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'bank' leaving state 'BankCreditStart'\n");
10908  if(FLAME_debug_count > 1)
10909  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
10910  if(FLAME_debug_count == 0)
10911  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
10912  }
10913 
10915  }
10916 
10917  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_compute_income_statement\n");
10920  {
10924  /* For backwards compatibility set current_xmachine */
10935 
10937  {
10938 
10939 
10940 
10942 
10943 
10944 
10945  if(i == 1)
10946  {
10948  }
10949  else
10950  {
10952  }
10953  }
10954 
10955  current_xmachine_bank = NULL;
10956 
10958  }
10959  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_compute_income_statement\n");
10960 
10961  if(FLAME_bank_centralbank_interest_payment_message_board_write == 1)
10962  {
10963 
10964  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_interest_payment)\n");
10965  rc = MB_SyncStart(b_bank_centralbank_interest_payment);
10966  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_interest_payment)\n");
10967  #ifdef ERRCHECK
10968  if (rc != MB_SUCCESS)
10969  {
10970  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_interest_payment' board\n");
10971  switch(rc) {
10972  case MB_ERR_INVALID:
10973  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
10974  break;
10975  case MB_ERR_LOCKED:
10976  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is locked\n");
10977  break;
10978  case MB_ERR_MEMALLOC:
10979  fprintf(stderr, "\t reason: out of memory\n");
10980  break;
10981  case MB_ERR_INTERNAL:
10982  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
10983  break;
10984  default:
10985  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
10986  break;
10987  }
10988 
10989 
10990  exit(rc);
10991  }
10992  #endif
10993  }
10994 
10995 
10996 
10997  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_demand_loans_1\n");
11000  {
11004  /* For backwards compatibility set current_xmachine */
11015 
11017  {
11018 
11019 
11020 
11022 
11023 
11024 
11025  if(i == 1)
11026  {
11028  }
11029  else
11030  {
11032  }
11033  }
11034 
11035  current_xmachine_firm = NULL;
11036 
11038  }
11039  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_demand_loans_1\n");
11040 
11041  if(FLAME_firm_bank_loan_request_1_message_board_write == 1)
11042  {
11043 
11044  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_loan_request_1)\n");
11045  rc = MB_SyncStart(b_firm_bank_loan_request_1);
11046  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_loan_request_1)\n");
11047  #ifdef ERRCHECK
11048  if (rc != MB_SUCCESS)
11049  {
11050  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_loan_request_1' board\n");
11051  switch(rc) {
11052  case MB_ERR_INVALID:
11053  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
11054  break;
11055  case MB_ERR_LOCKED:
11056  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is locked\n");
11057  break;
11058  case MB_ERR_MEMALLOC:
11059  fprintf(stderr, "\t reason: out of memory\n");
11060  break;
11061  case MB_ERR_INTERNAL:
11062  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11063  break;
11064  default:
11065  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
11066  break;
11067  }
11068 
11069 
11070  exit(rc);
11071  }
11072  #endif
11073  }
11074 
11075 
11076 
11077  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_iterate\n");
11080  {
11084  /* For backwards compatibility set current_xmachine */
11095 
11096 
11097 
11098 
11099 
11100  i = centralbank_iterate();
11101 
11102 
11103 
11104  if(i == 1)
11105  {
11107  }
11108  else
11109  {
11111  }
11112 
11113 
11115 
11117  }
11118  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_iterate\n");
11119 
11120 
11121  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
11124  {
11128  /* For backwards compatibility set current_xmachine */
11139 
11141  {
11142 
11143 
11144 
11145  i = idle();
11146 
11147 
11148 
11149  if(i == 1)
11150  {
11152  }
11153  else
11154  {
11156  }
11157  }
11158 
11159  current_xmachine_bank = NULL;
11160 
11162  }
11163  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
11164 
11165 
11166  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
11169  {
11173  /* For backwards compatibility set current_xmachine */
11184 
11186  {
11187 
11188 
11189 
11190  i = idle();
11191 
11192 
11193 
11194  if(i == 1)
11195  {
11197  }
11198  else
11199  {
11201  }
11202  }
11203 
11204  current_xmachine_firm = NULL;
11205 
11207  }
11208  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
11209 
11210 
11211 /* End of layer number 10 */
11212 
11213 /* Clear message boards that have finished being used
11214  * and sync complete if doing late sync complete */
11215 
11216  /* DEBUG: States with branching functions */
11219  {
11220  FLAME_debug_count = 0;
11221  /* Function: centralbank_collect_interest_payments */
11223  { FLAME_debug_count++; }
11224  /* Function: idle */
11226  { FLAME_debug_count++; }
11227  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
11228  if(FLAME_debug_count != 1)
11229  {
11230  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'centralbank' leaving state 'CentralBankCredit'\n");
11231  if(FLAME_debug_count > 1)
11232  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
11233  if(FLAME_debug_count == 0)
11234  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
11235  }
11236 
11238  }
11239 
11240  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_compute_dividends\n");
11243  {
11247  /* For backwards compatibility set current_xmachine */
11258 
11259 
11260 
11261 
11262 
11264 
11265 
11266 
11267  if(i == 1)
11268  {
11270  }
11271  else
11272  {
11274  }
11275 
11276 
11277  current_xmachine_bank = NULL;
11278 
11280  }
11281  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_compute_dividends\n");
11282 
11283  if(FLAME_bank_net_profit_message_board_write == 1)
11284  {
11285 
11286  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_net_profit)\n");
11287  rc = MB_SyncStart(b_bank_net_profit);
11288  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_net_profit)\n");
11289  #ifdef ERRCHECK
11290  if (rc != MB_SUCCESS)
11291  {
11292  fprintf(stderr, "ERROR: Could not start sync of 'bank_net_profit' board\n");
11293  switch(rc) {
11294  case MB_ERR_INVALID:
11295  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
11296  break;
11297  case MB_ERR_LOCKED:
11298  fprintf(stderr, "\t reason: 'bank_net_profit' board is locked\n");
11299  break;
11300  case MB_ERR_MEMALLOC:
11301  fprintf(stderr, "\t reason: out of memory\n");
11302  break;
11303  case MB_ERR_INTERNAL:
11304  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11305  break;
11306  default:
11307  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
11308  break;
11309  }
11310 
11311 
11312  exit(rc);
11313  }
11314  #endif
11315  }
11316 
11317 
11318 
11319  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
11322  {
11326  /* For backwards compatibility set current_xmachine */
11337 
11339  {
11340 
11341 
11342 
11343  i = idle();
11344 
11345 
11346 
11347  if(i == 1)
11348  {
11350  }
11351  else
11352  {
11354  }
11355  }
11356 
11358 
11360  }
11361  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
11362 
11363 
11364  /* If mb is not read then leave sync complete until last possible moment */
11365  if(FLAME_bank_centralbank_interest_payment_message_board_read == 1)
11366  {
11367  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_interest_payment)\n");
11368  rc = MB_SyncComplete(b_bank_centralbank_interest_payment);
11369  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_interest_payment)\n");
11370  #ifdef ERRCHECK
11371  if (rc != MB_SUCCESS)
11372  {
11373  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_interest_payment' board\n");
11374  switch(rc) {
11375  case MB_ERR_INVALID:
11376  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
11377  break;
11378  case MB_ERR_MEMALLOC:
11379  fprintf(stderr, "\t reason: out of memory\n");
11380  break;
11381  case MB_ERR_INTERNAL:
11382  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11383  break;
11384  default:
11385  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
11386  break;
11387  }
11388 
11389 
11390  exit(rc);
11391  }
11392  #endif
11393 
11394 
11395 
11396  }
11397 
11398  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_collect_interest_payments\n");
11401  {
11405  /* For backwards compatibility set current_xmachine */
11416 
11418  {
11419 
11420 
11421 
11422 
11424 
11425 
11426  #ifdef ERRCHECK
11427  if (rc != MB_SUCCESS)
11428  {
11429  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_centralbank_interest_payment'\n");
11430  switch(rc) {
11431  case MB_ERR_INVALID:
11432  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
11433  break;
11434  case MB_ERR_LOCKED:
11435  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is locked\n");
11436  break;
11437  case MB_ERR_MEMALLOC:
11438  fprintf(stderr, "\t reason: out of memory\n");
11439  break;
11440  case MB_ERR_INTERNAL:
11441  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11442  break;
11443  default:
11444 
11445 
11446  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
11447 
11448  break;
11449  }
11450 
11451 
11452  exit(rc);
11453  }
11454  #endif
11455 
11456 
11457 
11459 
11460 
11461  rc = MB_Iterator_Delete(&i_bank_centralbank_interest_payment);
11462  #ifdef ERRCHECK
11463  if (rc != MB_SUCCESS)
11464  {
11465  fprintf(stderr, "ERROR: Could not delete 'bank_centralbank_interest_payment' iterator\n");
11466  switch(rc) {
11467  case MB_ERR_INVALID:
11468  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' iterator is invalid\n");
11469  break;
11470  case MB_ERR_INTERNAL:
11471  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11472  break;
11473  default:
11474  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
11475  break;
11476  }
11477 
11478 
11479  exit(rc);
11480  }
11481  #endif
11482 
11483 
11484  if(i == 1)
11485  {
11487  }
11488  else
11489  {
11491  }
11492  }
11493 
11495 
11497  }
11498  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_collect_interest_payments\n");
11499 
11500 
11501 /* End of layer number 11 */
11502 
11503 /* Clear message boards that have finished being used
11504  * and sync complete if doing late sync complete */
11505 
11506 if(FLAME_bank_centralbank_interest_payment_message_board_read == 0)
11507 {
11508  /*printf("%d> bank_centralbank_interest_payment message board sync complete late as no agents reading any messages of this type\n", node_number);*/
11509 
11510  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_interest_payment)\n");
11511  rc = MB_SyncComplete(b_bank_centralbank_interest_payment);
11512  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_interest_payment)\n");
11513  #ifdef ERRCHECK
11514  if (rc != MB_SUCCESS)
11515  {
11516  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_interest_payment' board\n");
11517  switch(rc) {
11518  case MB_ERR_INVALID:
11519  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
11520  break;
11521  case MB_ERR_MEMALLOC:
11522  fprintf(stderr, "\t reason: out of memory\n");
11523  break;
11524  case MB_ERR_INTERNAL:
11525  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11526  break;
11527  default:
11528  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
11529  break;
11530  }
11531 
11532 
11533  exit(rc);
11534  }
11535  #endif
11536 }
11537 
11538  /* Delete any search trees */
11539 
11540  rc = MB_Clear(b_bank_centralbank_interest_payment);
11541  #ifdef ERRCHECK
11542  if (rc != MB_SUCCESS)
11543  {
11544  fprintf(stderr, "ERROR: Could not clear 'bank_centralbank_interest_payment' board\n");
11545  switch(rc) {
11546  case MB_ERR_INVALID:
11547  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is invalid\n");
11548  break;
11549  case MB_ERR_LOCKED:
11550  fprintf(stderr, "\t reason: 'bank_centralbank_interest_payment' board is locked\n");
11551  break;
11552  case MB_ERR_INTERNAL:
11553  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11554  break;
11555  default:
11556  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
11557  break;
11558 
11559  }
11560 
11561 
11562  exit(rc);
11563  }
11564  #endif
11565 
11566 
11567  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_do_balance_sheet\n");
11570  {
11574  /* For backwards compatibility set current_xmachine */
11585 
11586 
11587 
11588 
11589 
11591 
11592 
11593 
11594  if(i == 1)
11595  {
11597  }
11598  else
11599  {
11601  }
11602 
11603 
11604  current_xmachine_bank = NULL;
11605 
11607  }
11608  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_do_balance_sheet\n");
11609 
11610  if(FLAME_bank_centralbank_debt_payment_message_board_write == 1)
11611  {
11612 
11613  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_debt_payment)\n");
11614  rc = MB_SyncStart(b_bank_centralbank_debt_payment);
11615  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_debt_payment)\n");
11616  #ifdef ERRCHECK
11617  if (rc != MB_SUCCESS)
11618  {
11619  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_debt_payment' board\n");
11620  switch(rc) {
11621  case MB_ERR_INVALID:
11622  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
11623  break;
11624  case MB_ERR_LOCKED:
11625  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is locked\n");
11626  break;
11627  case MB_ERR_MEMALLOC:
11628  fprintf(stderr, "\t reason: out of memory\n");
11629  break;
11630  case MB_ERR_INTERNAL:
11631  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11632  break;
11633  default:
11634  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
11635  break;
11636  }
11637 
11638 
11639  exit(rc);
11640  }
11641  #endif
11642  }
11643 
11644 
11645  if(FLAME_bank_centralbank_debt_request_message_board_write == 1)
11646  {
11647 
11648  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_debt_request)\n");
11649  rc = MB_SyncStart(b_bank_centralbank_debt_request);
11650  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_debt_request)\n");
11651  #ifdef ERRCHECK
11652  if (rc != MB_SUCCESS)
11653  {
11654  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_debt_request' board\n");
11655  switch(rc) {
11656  case MB_ERR_INVALID:
11657  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
11658  break;
11659  case MB_ERR_LOCKED:
11660  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is locked\n");
11661  break;
11662  case MB_ERR_MEMALLOC:
11663  fprintf(stderr, "\t reason: out of memory\n");
11664  break;
11665  case MB_ERR_INTERNAL:
11666  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11667  break;
11668  default:
11669  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
11670  break;
11671  }
11672 
11673 
11674  exit(rc);
11675  }
11676  #endif
11677  }
11678 
11679 
11680  if(FLAME_bank_centralbank_update_deposit_message_board_write == 1)
11681  {
11682 
11683  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_centralbank_update_deposit)\n");
11684  rc = MB_SyncStart(b_bank_centralbank_update_deposit);
11685  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_centralbank_update_deposit)\n");
11686  #ifdef ERRCHECK
11687  if (rc != MB_SUCCESS)
11688  {
11689  fprintf(stderr, "ERROR: Could not start sync of 'bank_centralbank_update_deposit' board\n");
11690  switch(rc) {
11691  case MB_ERR_INVALID:
11692  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
11693  break;
11694  case MB_ERR_LOCKED:
11695  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is locked\n");
11696  break;
11697  case MB_ERR_MEMALLOC:
11698  fprintf(stderr, "\t reason: out of memory\n");
11699  break;
11700  case MB_ERR_INTERNAL:
11701  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11702  break;
11703  default:
11704  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
11705  break;
11706  }
11707 
11708 
11709  exit(rc);
11710  }
11711  #endif
11712  }
11713 
11714 
11715 
11716 /* End of layer number 12 */
11717 
11718 /* Clear message boards that have finished being used
11719  * and sync complete if doing late sync complete */
11720 
11721 
11722  /* If mb is not read then leave sync complete until last possible moment */
11723  if(FLAME_firm_bank_loan_request_1_message_board_read == 1)
11724  {
11725  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_loan_request_1)\n");
11726  rc = MB_SyncComplete(b_firm_bank_loan_request_1);
11727  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_loan_request_1)\n");
11728  #ifdef ERRCHECK
11729  if (rc != MB_SUCCESS)
11730  {
11731  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_loan_request_1' board\n");
11732  switch(rc) {
11733  case MB_ERR_INVALID:
11734  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
11735  break;
11736  case MB_ERR_MEMALLOC:
11737  fprintf(stderr, "\t reason: out of memory\n");
11738  break;
11739  case MB_ERR_INTERNAL:
11740  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11741  break;
11742  default:
11743  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
11744  break;
11745  }
11746 
11747 
11748  exit(rc);
11749  }
11750  #endif
11751 
11752 
11753 
11754  }
11755 
11756  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_process_loan_requests_1\n");
11759  {
11763  /* For backwards compatibility set current_xmachine */
11774 
11775 
11776 
11777 
11778 
11779 
11780 
11781 
11783 
11784 
11785 
11786  #ifdef ERRCHECK
11787  if (rc != MB_SUCCESS)
11788  {
11789  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_loan_request_1'\n");
11790  switch(rc) {
11791  case MB_ERR_INVALID:
11792  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
11793  break;
11794  case MB_ERR_LOCKED:
11795  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is locked\n");
11796  break;
11797  case MB_ERR_MEMALLOC:
11798  fprintf(stderr, "\t reason: out of memory\n");
11799  break;
11800  case MB_ERR_INTERNAL:
11801  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11802  break;
11803  default:
11804 
11805  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
11806 
11807 
11808  break;
11809  }
11810 
11811 
11812  exit(rc);
11813  }
11814  #endif
11815 
11816 
11817 
11819 
11820 
11821  rc = MB_Iterator_Delete(&i_firm_bank_loan_request_1);
11822  #ifdef ERRCHECK
11823  if (rc != MB_SUCCESS)
11824  {
11825  fprintf(stderr, "ERROR: Could not delete 'firm_bank_loan_request_1' iterator\n");
11826  switch(rc) {
11827  case MB_ERR_INVALID:
11828  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' iterator is invalid\n");
11829  break;
11830  case MB_ERR_INTERNAL:
11831  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11832  break;
11833  default:
11834  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
11835  break;
11836  }
11837 
11838 
11839  exit(rc);
11840  }
11841  #endif
11842 
11843 
11844  if(i == 1)
11845  {
11847  }
11848  else
11849  {
11851  }
11852 
11853 
11854  current_xmachine_bank = NULL;
11855 
11857  }
11858  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_process_loan_requests_1\n");
11859 
11860  if(FLAME_bank_firm_loan_acknowledge_1_message_board_write == 1)
11861  {
11862 
11863  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_firm_loan_acknowledge_1)\n");
11864  rc = MB_SyncStart(b_bank_firm_loan_acknowledge_1);
11865  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_firm_loan_acknowledge_1)\n");
11866  #ifdef ERRCHECK
11867  if (rc != MB_SUCCESS)
11868  {
11869  fprintf(stderr, "ERROR: Could not start sync of 'bank_firm_loan_acknowledge_1' board\n");
11870  switch(rc) {
11871  case MB_ERR_INVALID:
11872  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
11873  break;
11874  case MB_ERR_LOCKED:
11875  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is locked\n");
11876  break;
11877  case MB_ERR_MEMALLOC:
11878  fprintf(stderr, "\t reason: out of memory\n");
11879  break;
11880  case MB_ERR_INTERNAL:
11881  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11882  break;
11883  default:
11884  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
11885  break;
11886  }
11887 
11888 
11889  exit(rc);
11890  }
11891  #endif
11892  }
11893 
11894 
11895 
11896  /* If mb is not read then leave sync complete until last possible moment */
11897  if(FLAME_bank_centralbank_debt_payment_message_board_read == 1)
11898  {
11899  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_debt_payment)\n");
11900  rc = MB_SyncComplete(b_bank_centralbank_debt_payment);
11901  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_debt_payment)\n");
11902  #ifdef ERRCHECK
11903  if (rc != MB_SUCCESS)
11904  {
11905  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_debt_payment' board\n");
11906  switch(rc) {
11907  case MB_ERR_INVALID:
11908  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
11909  break;
11910  case MB_ERR_MEMALLOC:
11911  fprintf(stderr, "\t reason: out of memory\n");
11912  break;
11913  case MB_ERR_INTERNAL:
11914  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11915  break;
11916  default:
11917  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
11918  break;
11919  }
11920 
11921 
11922  exit(rc);
11923  }
11924  #endif
11925 
11926 
11927 
11928  }
11929 
11930  /* If mb is not read then leave sync complete until last possible moment */
11931  if(FLAME_bank_centralbank_debt_request_message_board_read == 1)
11932  {
11933  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_debt_request)\n");
11934  rc = MB_SyncComplete(b_bank_centralbank_debt_request);
11935  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_debt_request)\n");
11936  #ifdef ERRCHECK
11937  if (rc != MB_SUCCESS)
11938  {
11939  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_debt_request' board\n");
11940  switch(rc) {
11941  case MB_ERR_INVALID:
11942  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
11943  break;
11944  case MB_ERR_MEMALLOC:
11945  fprintf(stderr, "\t reason: out of memory\n");
11946  break;
11947  case MB_ERR_INTERNAL:
11948  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11949  break;
11950  default:
11951  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
11952  break;
11953  }
11954 
11955 
11956  exit(rc);
11957  }
11958  #endif
11959 
11960 
11961 
11962  }
11963 
11964  /* If mb is not read then leave sync complete until last possible moment */
11965  if(FLAME_bank_centralbank_update_deposit_message_board_read == 1)
11966  {
11967  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_update_deposit)\n");
11968  rc = MB_SyncComplete(b_bank_centralbank_update_deposit);
11969  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_update_deposit)\n");
11970  #ifdef ERRCHECK
11971  if (rc != MB_SUCCESS)
11972  {
11973  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_update_deposit' board\n");
11974  switch(rc) {
11975  case MB_ERR_INVALID:
11976  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
11977  break;
11978  case MB_ERR_MEMALLOC:
11979  fprintf(stderr, "\t reason: out of memory\n");
11980  break;
11981  case MB_ERR_INTERNAL:
11982  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
11983  break;
11984  default:
11985  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
11986  break;
11987  }
11988 
11989 
11990  exit(rc);
11991  }
11992  #endif
11993 
11994 
11995 
11996  }
11997 
11998  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_process_debt_requests\n");
12001  {
12005  /* For backwards compatibility set current_xmachine */
12016 
12017 
12018 
12019 
12020 
12021 
12023 
12024 
12025  #ifdef ERRCHECK
12026  if (rc != MB_SUCCESS)
12027  {
12028  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_centralbank_debt_request'\n");
12029  switch(rc) {
12030  case MB_ERR_INVALID:
12031  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
12032  break;
12033  case MB_ERR_LOCKED:
12034  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is locked\n");
12035  break;
12036  case MB_ERR_MEMALLOC:
12037  fprintf(stderr, "\t reason: out of memory\n");
12038  break;
12039  case MB_ERR_INTERNAL:
12040  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12041  break;
12042  default:
12043 
12044 
12045  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
12046 
12047  break;
12048  }
12049 
12050 
12051  exit(rc);
12052  }
12053  #endif
12054 
12055 
12056 
12057 
12059 
12060 
12061  #ifdef ERRCHECK
12062  if (rc != MB_SUCCESS)
12063  {
12064  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_centralbank_debt_payment'\n");
12065  switch(rc) {
12066  case MB_ERR_INVALID:
12067  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
12068  break;
12069  case MB_ERR_LOCKED:
12070  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is locked\n");
12071  break;
12072  case MB_ERR_MEMALLOC:
12073  fprintf(stderr, "\t reason: out of memory\n");
12074  break;
12075  case MB_ERR_INTERNAL:
12076  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12077  break;
12078  default:
12079 
12080 
12081  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
12082 
12083  break;
12084  }
12085 
12086 
12087  exit(rc);
12088  }
12089  #endif
12090 
12091 
12092 
12093 
12095 
12096 
12097  #ifdef ERRCHECK
12098  if (rc != MB_SUCCESS)
12099  {
12100  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_centralbank_update_deposit'\n");
12101  switch(rc) {
12102  case MB_ERR_INVALID:
12103  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
12104  break;
12105  case MB_ERR_LOCKED:
12106  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is locked\n");
12107  break;
12108  case MB_ERR_MEMALLOC:
12109  fprintf(stderr, "\t reason: out of memory\n");
12110  break;
12111  case MB_ERR_INTERNAL:
12112  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12113  break;
12114  default:
12115 
12116 
12117  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
12118 
12119  break;
12120  }
12121 
12122 
12123  exit(rc);
12124  }
12125  #endif
12126 
12127 
12128 
12130 
12131 
12132  rc = MB_Iterator_Delete(&i_bank_centralbank_debt_request);
12133  #ifdef ERRCHECK
12134  if (rc != MB_SUCCESS)
12135  {
12136  fprintf(stderr, "ERROR: Could not delete 'bank_centralbank_debt_request' iterator\n");
12137  switch(rc) {
12138  case MB_ERR_INVALID:
12139  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' iterator is invalid\n");
12140  break;
12141  case MB_ERR_INTERNAL:
12142  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12143  break;
12144  default:
12145  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
12146  break;
12147  }
12148 
12149 
12150  exit(rc);
12151  }
12152  #endif
12153 
12154  rc = MB_Iterator_Delete(&i_bank_centralbank_debt_payment);
12155  #ifdef ERRCHECK
12156  if (rc != MB_SUCCESS)
12157  {
12158  fprintf(stderr, "ERROR: Could not delete 'bank_centralbank_debt_payment' iterator\n");
12159  switch(rc) {
12160  case MB_ERR_INVALID:
12161  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' iterator is invalid\n");
12162  break;
12163  case MB_ERR_INTERNAL:
12164  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12165  break;
12166  default:
12167  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
12168  break;
12169  }
12170 
12171 
12172  exit(rc);
12173  }
12174  #endif
12175 
12176  rc = MB_Iterator_Delete(&i_bank_centralbank_update_deposit);
12177  #ifdef ERRCHECK
12178  if (rc != MB_SUCCESS)
12179  {
12180  fprintf(stderr, "ERROR: Could not delete 'bank_centralbank_update_deposit' iterator\n");
12181  switch(rc) {
12182  case MB_ERR_INVALID:
12183  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' iterator is invalid\n");
12184  break;
12185  case MB_ERR_INTERNAL:
12186  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12187  break;
12188  default:
12189  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
12190  break;
12191  }
12192 
12193 
12194  exit(rc);
12195  }
12196  #endif
12197 
12198 
12199  if(i == 1)
12200  {
12202  }
12203  else
12204  {
12206  }
12207 
12208 
12210 
12212  }
12213  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_process_debt_requests\n");
12214 
12215 
12216 /* End of layer number 13 */
12217 
12218 /* Clear message boards that have finished being used
12219  * and sync complete if doing late sync complete */
12220 
12221 if(FLAME_bank_centralbank_update_deposit_message_board_read == 0)
12222 {
12223  /*printf("%d> bank_centralbank_update_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
12224 
12225  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_update_deposit)\n");
12226  rc = MB_SyncComplete(b_bank_centralbank_update_deposit);
12227  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_update_deposit)\n");
12228  #ifdef ERRCHECK
12229  if (rc != MB_SUCCESS)
12230  {
12231  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_update_deposit' board\n");
12232  switch(rc) {
12233  case MB_ERR_INVALID:
12234  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
12235  break;
12236  case MB_ERR_MEMALLOC:
12237  fprintf(stderr, "\t reason: out of memory\n");
12238  break;
12239  case MB_ERR_INTERNAL:
12240  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12241  break;
12242  default:
12243  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12244  break;
12245  }
12246 
12247 
12248  exit(rc);
12249  }
12250  #endif
12251 }
12252 
12253  /* Delete any search trees */
12254 
12255  rc = MB_Clear(b_bank_centralbank_update_deposit);
12256  #ifdef ERRCHECK
12257  if (rc != MB_SUCCESS)
12258  {
12259  fprintf(stderr, "ERROR: Could not clear 'bank_centralbank_update_deposit' board\n");
12260  switch(rc) {
12261  case MB_ERR_INVALID:
12262  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is invalid\n");
12263  break;
12264  case MB_ERR_LOCKED:
12265  fprintf(stderr, "\t reason: 'bank_centralbank_update_deposit' board is locked\n");
12266  break;
12267  case MB_ERR_INTERNAL:
12268  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12269  break;
12270  default:
12271  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
12272  break;
12273 
12274  }
12275 
12276 
12277  exit(rc);
12278  }
12279  #endif
12280 
12281 if(FLAME_firm_bank_loan_request_1_message_board_read == 0)
12282 {
12283  /*printf("%d> firm_bank_loan_request_1 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
12284 
12285  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_loan_request_1)\n");
12286  rc = MB_SyncComplete(b_firm_bank_loan_request_1);
12287  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_loan_request_1)\n");
12288  #ifdef ERRCHECK
12289  if (rc != MB_SUCCESS)
12290  {
12291  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_loan_request_1' board\n");
12292  switch(rc) {
12293  case MB_ERR_INVALID:
12294  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
12295  break;
12296  case MB_ERR_MEMALLOC:
12297  fprintf(stderr, "\t reason: out of memory\n");
12298  break;
12299  case MB_ERR_INTERNAL:
12300  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12301  break;
12302  default:
12303  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12304  break;
12305  }
12306 
12307 
12308  exit(rc);
12309  }
12310  #endif
12311 }
12312 
12313  /* Delete any search trees */
12314 
12315  rc = MB_Clear(b_firm_bank_loan_request_1);
12316  #ifdef ERRCHECK
12317  if (rc != MB_SUCCESS)
12318  {
12319  fprintf(stderr, "ERROR: Could not clear 'firm_bank_loan_request_1' board\n");
12320  switch(rc) {
12321  case MB_ERR_INVALID:
12322  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is invalid\n");
12323  break;
12324  case MB_ERR_LOCKED:
12325  fprintf(stderr, "\t reason: 'firm_bank_loan_request_1' board is locked\n");
12326  break;
12327  case MB_ERR_INTERNAL:
12328  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12329  break;
12330  default:
12331  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
12332  break;
12333 
12334  }
12335 
12336 
12337  exit(rc);
12338  }
12339  #endif
12340 
12341 if(FLAME_bank_centralbank_debt_request_message_board_read == 0)
12342 {
12343  /*printf("%d> bank_centralbank_debt_request message board sync complete late as no agents reading any messages of this type\n", node_number);*/
12344 
12345  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_debt_request)\n");
12346  rc = MB_SyncComplete(b_bank_centralbank_debt_request);
12347  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_debt_request)\n");
12348  #ifdef ERRCHECK
12349  if (rc != MB_SUCCESS)
12350  {
12351  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_debt_request' board\n");
12352  switch(rc) {
12353  case MB_ERR_INVALID:
12354  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
12355  break;
12356  case MB_ERR_MEMALLOC:
12357  fprintf(stderr, "\t reason: out of memory\n");
12358  break;
12359  case MB_ERR_INTERNAL:
12360  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12361  break;
12362  default:
12363  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12364  break;
12365  }
12366 
12367 
12368  exit(rc);
12369  }
12370  #endif
12371 }
12372 
12373  /* Delete any search trees */
12374 
12375  rc = MB_Clear(b_bank_centralbank_debt_request);
12376  #ifdef ERRCHECK
12377  if (rc != MB_SUCCESS)
12378  {
12379  fprintf(stderr, "ERROR: Could not clear 'bank_centralbank_debt_request' board\n");
12380  switch(rc) {
12381  case MB_ERR_INVALID:
12382  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is invalid\n");
12383  break;
12384  case MB_ERR_LOCKED:
12385  fprintf(stderr, "\t reason: 'bank_centralbank_debt_request' board is locked\n");
12386  break;
12387  case MB_ERR_INTERNAL:
12388  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12389  break;
12390  default:
12391  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
12392  break;
12393 
12394  }
12395 
12396 
12397  exit(rc);
12398  }
12399  #endif
12400 
12401 if(FLAME_bank_centralbank_debt_payment_message_board_read == 0)
12402 {
12403  /*printf("%d> bank_centralbank_debt_payment message board sync complete late as no agents reading any messages of this type\n", node_number);*/
12404 
12405  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_centralbank_debt_payment)\n");
12406  rc = MB_SyncComplete(b_bank_centralbank_debt_payment);
12407  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_centralbank_debt_payment)\n");
12408  #ifdef ERRCHECK
12409  if (rc != MB_SUCCESS)
12410  {
12411  fprintf(stderr, "ERROR: Could not complete sync of 'bank_centralbank_debt_payment' board\n");
12412  switch(rc) {
12413  case MB_ERR_INVALID:
12414  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
12415  break;
12416  case MB_ERR_MEMALLOC:
12417  fprintf(stderr, "\t reason: out of memory\n");
12418  break;
12419  case MB_ERR_INTERNAL:
12420  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12421  break;
12422  default:
12423  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12424  break;
12425  }
12426 
12427 
12428  exit(rc);
12429  }
12430  #endif
12431 }
12432 
12433  /* Delete any search trees */
12434 
12435  rc = MB_Clear(b_bank_centralbank_debt_payment);
12436  #ifdef ERRCHECK
12437  if (rc != MB_SUCCESS)
12438  {
12439  fprintf(stderr, "ERROR: Could not clear 'bank_centralbank_debt_payment' board\n");
12440  switch(rc) {
12441  case MB_ERR_INVALID:
12442  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is invalid\n");
12443  break;
12444  case MB_ERR_LOCKED:
12445  fprintf(stderr, "\t reason: 'bank_centralbank_debt_payment' board is locked\n");
12446  break;
12447  case MB_ERR_INTERNAL:
12448  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12449  break;
12450  default:
12451  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
12452  break;
12453 
12454  }
12455 
12456 
12457  exit(rc);
12458  }
12459  #endif
12460 
12461  /* DEBUG: States with branching functions */
12464  {
12465  FLAME_debug_count = 0;
12466  /* Function: centralbank_trace_goods_prices */
12468  { FLAME_debug_count++; }
12469  /* Function: idle */
12471  { FLAME_debug_count++; }
12472  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
12473  if(FLAME_debug_count != 1)
12474  {
12475  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'centralbank' leaving state 'CentralBankConsumption'\n");
12476  if(FLAME_debug_count > 1)
12477  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
12478  if(FLAME_debug_count == 0)
12479  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
12480  }
12481 
12483  }
12484 
12485  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
12488  {
12492  /* For backwards compatibility set current_xmachine */
12503 
12505  {
12506 
12507 
12508 
12509  i = idle();
12510 
12511 
12512 
12513  if(i == 1)
12514  {
12516  }
12517  else
12518  {
12520  }
12521  }
12522 
12524 
12526  }
12527  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
12528 
12529 
12530  /* If mb is not read then leave sync complete until last possible moment */
12531  if(FLAME_bank_firm_loan_acknowledge_1_message_board_read == 1)
12532  {
12533  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_firm_loan_acknowledge_1)\n");
12534  rc = MB_SyncComplete(b_bank_firm_loan_acknowledge_1);
12535  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_firm_loan_acknowledge_1)\n");
12536  #ifdef ERRCHECK
12537  if (rc != MB_SUCCESS)
12538  {
12539  fprintf(stderr, "ERROR: Could not complete sync of 'bank_firm_loan_acknowledge_1' board\n");
12540  switch(rc) {
12541  case MB_ERR_INVALID:
12542  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
12543  break;
12544  case MB_ERR_MEMALLOC:
12545  fprintf(stderr, "\t reason: out of memory\n");
12546  break;
12547  case MB_ERR_INTERNAL:
12548  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12549  break;
12550  default:
12551  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12552  break;
12553  }
12554 
12555 
12556  exit(rc);
12557  }
12558  #endif
12559 
12560 
12561 
12562  }
12563 
12564  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_borrow_loans_1\n");
12567  {
12571  /* For backwards compatibility set current_xmachine */
12582 
12583 
12584 
12585 
12586 
12587 
12588 
12589 
12591 
12592 
12593 
12594  #ifdef ERRCHECK
12595  if (rc != MB_SUCCESS)
12596  {
12597  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_firm_loan_acknowledge_1'\n");
12598  switch(rc) {
12599  case MB_ERR_INVALID:
12600  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
12601  break;
12602  case MB_ERR_LOCKED:
12603  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is locked\n");
12604  break;
12605  case MB_ERR_MEMALLOC:
12606  fprintf(stderr, "\t reason: out of memory\n");
12607  break;
12608  case MB_ERR_INTERNAL:
12609  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12610  break;
12611  default:
12612 
12613  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
12614 
12615 
12616  break;
12617  }
12618 
12619 
12620  exit(rc);
12621  }
12622  #endif
12623 
12624 
12625 
12627 
12628 
12629  rc = MB_Iterator_Delete(&i_bank_firm_loan_acknowledge_1);
12630  #ifdef ERRCHECK
12631  if (rc != MB_SUCCESS)
12632  {
12633  fprintf(stderr, "ERROR: Could not delete 'bank_firm_loan_acknowledge_1' iterator\n");
12634  switch(rc) {
12635  case MB_ERR_INVALID:
12636  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' iterator is invalid\n");
12637  break;
12638  case MB_ERR_INTERNAL:
12639  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12640  break;
12641  default:
12642  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
12643  break;
12644  }
12645 
12646 
12647  exit(rc);
12648  }
12649  #endif
12650 
12651 
12652  if(i == 1)
12653  {
12655  }
12656  else
12657  {
12659  }
12660 
12661 
12662  current_xmachine_firm = NULL;
12663 
12665  }
12666  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_borrow_loans_1\n");
12667 
12668  if(FLAME_firm_bank_loan_request_2_message_board_write == 1)
12669  {
12670 
12671  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_loan_request_2)\n");
12672  rc = MB_SyncStart(b_firm_bank_loan_request_2);
12673  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_loan_request_2)\n");
12674  #ifdef ERRCHECK
12675  if (rc != MB_SUCCESS)
12676  {
12677  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_loan_request_2' board\n");
12678  switch(rc) {
12679  case MB_ERR_INVALID:
12680  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
12681  break;
12682  case MB_ERR_LOCKED:
12683  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is locked\n");
12684  break;
12685  case MB_ERR_MEMALLOC:
12686  fprintf(stderr, "\t reason: out of memory\n");
12687  break;
12688  case MB_ERR_INTERNAL:
12689  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12690  break;
12691  default:
12692  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
12693  break;
12694  }
12695 
12696 
12697  exit(rc);
12698  }
12699  #endif
12700  }
12701 
12702 
12703 
12704 /* End of layer number 14 */
12705 
12706 /* Clear message boards that have finished being used
12707  * and sync complete if doing late sync complete */
12708 
12709 if(FLAME_bank_firm_loan_acknowledge_1_message_board_read == 0)
12710 {
12711  /*printf("%d> bank_firm_loan_acknowledge_1 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
12712 
12713  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_firm_loan_acknowledge_1)\n");
12714  rc = MB_SyncComplete(b_bank_firm_loan_acknowledge_1);
12715  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_firm_loan_acknowledge_1)\n");
12716  #ifdef ERRCHECK
12717  if (rc != MB_SUCCESS)
12718  {
12719  fprintf(stderr, "ERROR: Could not complete sync of 'bank_firm_loan_acknowledge_1' board\n");
12720  switch(rc) {
12721  case MB_ERR_INVALID:
12722  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
12723  break;
12724  case MB_ERR_MEMALLOC:
12725  fprintf(stderr, "\t reason: out of memory\n");
12726  break;
12727  case MB_ERR_INTERNAL:
12728  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12729  break;
12730  default:
12731  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12732  break;
12733  }
12734 
12735 
12736  exit(rc);
12737  }
12738  #endif
12739 }
12740 
12741  /* Delete any search trees */
12742 
12743  rc = MB_Clear(b_bank_firm_loan_acknowledge_1);
12744  #ifdef ERRCHECK
12745  if (rc != MB_SUCCESS)
12746  {
12747  fprintf(stderr, "ERROR: Could not clear 'bank_firm_loan_acknowledge_1' board\n");
12748  switch(rc) {
12749  case MB_ERR_INVALID:
12750  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is invalid\n");
12751  break;
12752  case MB_ERR_LOCKED:
12753  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_1' board is locked\n");
12754  break;
12755  case MB_ERR_INTERNAL:
12756  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12757  break;
12758  default:
12759  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
12760  break;
12761 
12762  }
12763 
12764 
12765  exit(rc);
12766  }
12767  #endif
12768 
12769  /* DEBUG: States with branching functions */
12772  {
12773  FLAME_debug_count = 0;
12774  /* Function: firm_credit_borrow_loans_2 */
12776  { FLAME_debug_count++; }
12777  /* Function: idle */
12779  { FLAME_debug_count++; }
12780  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
12781  if(FLAME_debug_count != 1)
12782  {
12783  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditLoanBorrow2'\n");
12784  if(FLAME_debug_count > 1)
12785  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
12786  if(FLAME_debug_count == 0)
12787  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
12788  }
12789 
12791  }
12792 
12793  /* If mb is not read then leave sync complete until last possible moment */
12794  if(FLAME_firm_bank_loan_request_2_message_board_read == 1)
12795  {
12796  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_loan_request_2)\n");
12797  rc = MB_SyncComplete(b_firm_bank_loan_request_2);
12798  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_loan_request_2)\n");
12799  #ifdef ERRCHECK
12800  if (rc != MB_SUCCESS)
12801  {
12802  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_loan_request_2' board\n");
12803  switch(rc) {
12804  case MB_ERR_INVALID:
12805  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
12806  break;
12807  case MB_ERR_MEMALLOC:
12808  fprintf(stderr, "\t reason: out of memory\n");
12809  break;
12810  case MB_ERR_INTERNAL:
12811  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12812  break;
12813  default:
12814  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
12815  break;
12816  }
12817 
12818 
12819  exit(rc);
12820  }
12821  #endif
12822 
12823 
12824 
12825  }
12826 
12827  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_process_loan_requests_2\n");
12830  {
12834  /* For backwards compatibility set current_xmachine */
12845 
12846 
12847 
12848 
12849 
12850 
12851 
12852 
12854 
12855 
12856 
12857  #ifdef ERRCHECK
12858  if (rc != MB_SUCCESS)
12859  {
12860  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_loan_request_2'\n");
12861  switch(rc) {
12862  case MB_ERR_INVALID:
12863  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
12864  break;
12865  case MB_ERR_LOCKED:
12866  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is locked\n");
12867  break;
12868  case MB_ERR_MEMALLOC:
12869  fprintf(stderr, "\t reason: out of memory\n");
12870  break;
12871  case MB_ERR_INTERNAL:
12872  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12873  break;
12874  default:
12875 
12876  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
12877 
12878 
12879  break;
12880  }
12881 
12882 
12883  exit(rc);
12884  }
12885  #endif
12886 
12887 
12888 
12890 
12891 
12892  rc = MB_Iterator_Delete(&i_firm_bank_loan_request_2);
12893  #ifdef ERRCHECK
12894  if (rc != MB_SUCCESS)
12895  {
12896  fprintf(stderr, "ERROR: Could not delete 'firm_bank_loan_request_2' iterator\n");
12897  switch(rc) {
12898  case MB_ERR_INVALID:
12899  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' iterator is invalid\n");
12900  break;
12901  case MB_ERR_INTERNAL:
12902  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12903  break;
12904  default:
12905  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
12906  break;
12907  }
12908 
12909 
12910  exit(rc);
12911  }
12912  #endif
12913 
12914 
12915  if(i == 1)
12916  {
12918  }
12919  else
12920  {
12922  }
12923 
12924 
12925  current_xmachine_bank = NULL;
12926 
12928  }
12929  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_process_loan_requests_2\n");
12930 
12931  if(FLAME_bank_firm_loan_acknowledge_2_message_board_write == 1)
12932  {
12933 
12934  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_firm_loan_acknowledge_2)\n");
12935  rc = MB_SyncStart(b_bank_firm_loan_acknowledge_2);
12936  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_firm_loan_acknowledge_2)\n");
12937  #ifdef ERRCHECK
12938  if (rc != MB_SUCCESS)
12939  {
12940  fprintf(stderr, "ERROR: Could not start sync of 'bank_firm_loan_acknowledge_2' board\n");
12941  switch(rc) {
12942  case MB_ERR_INVALID:
12943  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
12944  break;
12945  case MB_ERR_LOCKED:
12946  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is locked\n");
12947  break;
12948  case MB_ERR_MEMALLOC:
12949  fprintf(stderr, "\t reason: out of memory\n");
12950  break;
12951  case MB_ERR_INTERNAL:
12952  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
12953  break;
12954  default:
12955  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
12956  break;
12957  }
12958 
12959 
12960  exit(rc);
12961  }
12962  #endif
12963  }
12964 
12965 
12966 
12967  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
12970  {
12974  /* For backwards compatibility set current_xmachine */
12985 
12987  {
12988 
12989 
12990 
12991  i = idle();
12992 
12993 
12994 
12995  if(i == 1)
12996  {
12998  }
12999  else
13000  {
13002  }
13003  }
13004 
13005  current_xmachine_firm = NULL;
13006 
13008  }
13009  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
13010 
13011 
13012 /* End of layer number 15 */
13013 
13014 /* Clear message boards that have finished being used
13015  * and sync complete if doing late sync complete */
13016 
13017 if(FLAME_firm_bank_loan_request_2_message_board_read == 0)
13018 {
13019  /*printf("%d> firm_bank_loan_request_2 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
13020 
13021  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_loan_request_2)\n");
13022  rc = MB_SyncComplete(b_firm_bank_loan_request_2);
13023  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_loan_request_2)\n");
13024  #ifdef ERRCHECK
13025  if (rc != MB_SUCCESS)
13026  {
13027  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_loan_request_2' board\n");
13028  switch(rc) {
13029  case MB_ERR_INVALID:
13030  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
13031  break;
13032  case MB_ERR_MEMALLOC:
13033  fprintf(stderr, "\t reason: out of memory\n");
13034  break;
13035  case MB_ERR_INTERNAL:
13036  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13037  break;
13038  default:
13039  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13040  break;
13041  }
13042 
13043 
13044  exit(rc);
13045  }
13046  #endif
13047 }
13048 
13049  /* Delete any search trees */
13050 
13051  rc = MB_Clear(b_firm_bank_loan_request_2);
13052  #ifdef ERRCHECK
13053  if (rc != MB_SUCCESS)
13054  {
13055  fprintf(stderr, "ERROR: Could not clear 'firm_bank_loan_request_2' board\n");
13056  switch(rc) {
13057  case MB_ERR_INVALID:
13058  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is invalid\n");
13059  break;
13060  case MB_ERR_LOCKED:
13061  fprintf(stderr, "\t reason: 'firm_bank_loan_request_2' board is locked\n");
13062  break;
13063  case MB_ERR_INTERNAL:
13064  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13065  break;
13066  default:
13067  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
13068  break;
13069 
13070  }
13071 
13072 
13073  exit(rc);
13074  }
13075  #endif
13076 
13077 
13078  /* If mb is not read then leave sync complete until last possible moment */
13079  if(FLAME_bank_firm_loan_acknowledge_2_message_board_read == 1)
13080  {
13081  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_firm_loan_acknowledge_2)\n");
13082  rc = MB_SyncComplete(b_bank_firm_loan_acknowledge_2);
13083  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_firm_loan_acknowledge_2)\n");
13084  #ifdef ERRCHECK
13085  if (rc != MB_SUCCESS)
13086  {
13087  fprintf(stderr, "ERROR: Could not complete sync of 'bank_firm_loan_acknowledge_2' board\n");
13088  switch(rc) {
13089  case MB_ERR_INVALID:
13090  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
13091  break;
13092  case MB_ERR_MEMALLOC:
13093  fprintf(stderr, "\t reason: out of memory\n");
13094  break;
13095  case MB_ERR_INTERNAL:
13096  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13097  break;
13098  default:
13099  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13100  break;
13101  }
13102 
13103 
13104  exit(rc);
13105  }
13106  #endif
13107 
13108 
13109 
13110  }
13111 
13112  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_borrow_loans_2\n");
13115  {
13119  /* For backwards compatibility set current_xmachine */
13130 
13132  {
13133 
13134 
13135 
13136 
13137 
13138 
13140 
13141 
13142 
13143  #ifdef ERRCHECK
13144  if (rc != MB_SUCCESS)
13145  {
13146  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_firm_loan_acknowledge_2'\n");
13147  switch(rc) {
13148  case MB_ERR_INVALID:
13149  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
13150  break;
13151  case MB_ERR_LOCKED:
13152  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is locked\n");
13153  break;
13154  case MB_ERR_MEMALLOC:
13155  fprintf(stderr, "\t reason: out of memory\n");
13156  break;
13157  case MB_ERR_INTERNAL:
13158  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13159  break;
13160  default:
13161 
13162  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
13163 
13164 
13165  break;
13166  }
13167 
13168 
13169  exit(rc);
13170  }
13171  #endif
13172 
13173 
13174 
13176 
13177 
13178  rc = MB_Iterator_Delete(&i_bank_firm_loan_acknowledge_2);
13179  #ifdef ERRCHECK
13180  if (rc != MB_SUCCESS)
13181  {
13182  fprintf(stderr, "ERROR: Could not delete 'bank_firm_loan_acknowledge_2' iterator\n");
13183  switch(rc) {
13184  case MB_ERR_INVALID:
13185  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' iterator is invalid\n");
13186  break;
13187  case MB_ERR_INTERNAL:
13188  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13189  break;
13190  default:
13191  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
13192  break;
13193  }
13194 
13195 
13196  exit(rc);
13197  }
13198  #endif
13199 
13200 
13201  if(i == 1)
13202  {
13204  }
13205  else
13206  {
13208  }
13209  }
13210 
13211  current_xmachine_firm = NULL;
13212 
13214  }
13215  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_borrow_loans_2\n");
13216 
13217 
13218 /* End of layer number 16 */
13219 
13220 /* Clear message boards that have finished being used
13221  * and sync complete if doing late sync complete */
13222 
13223 if(FLAME_bank_firm_loan_acknowledge_2_message_board_read == 0)
13224 {
13225  /*printf("%d> bank_firm_loan_acknowledge_2 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
13226 
13227  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_firm_loan_acknowledge_2)\n");
13228  rc = MB_SyncComplete(b_bank_firm_loan_acknowledge_2);
13229  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_firm_loan_acknowledge_2)\n");
13230  #ifdef ERRCHECK
13231  if (rc != MB_SUCCESS)
13232  {
13233  fprintf(stderr, "ERROR: Could not complete sync of 'bank_firm_loan_acknowledge_2' board\n");
13234  switch(rc) {
13235  case MB_ERR_INVALID:
13236  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
13237  break;
13238  case MB_ERR_MEMALLOC:
13239  fprintf(stderr, "\t reason: out of memory\n");
13240  break;
13241  case MB_ERR_INTERNAL:
13242  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13243  break;
13244  default:
13245  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13246  break;
13247  }
13248 
13249 
13250  exit(rc);
13251  }
13252  #endif
13253 }
13254 
13255  /* Delete any search trees */
13256 
13257  rc = MB_Clear(b_bank_firm_loan_acknowledge_2);
13258  #ifdef ERRCHECK
13259  if (rc != MB_SUCCESS)
13260  {
13261  fprintf(stderr, "ERROR: Could not clear 'bank_firm_loan_acknowledge_2' board\n");
13262  switch(rc) {
13263  case MB_ERR_INVALID:
13264  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is invalid\n");
13265  break;
13266  case MB_ERR_LOCKED:
13267  fprintf(stderr, "\t reason: 'bank_firm_loan_acknowledge_2' board is locked\n");
13268  break;
13269  case MB_ERR_INTERNAL:
13270  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13271  break;
13272  default:
13273  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
13274  break;
13275 
13276  }
13277 
13278 
13279  exit(rc);
13280  }
13281  #endif
13282 
13283  /* DEBUG: States with branching functions */
13286  {
13287  FLAME_debug_count = 0;
13288  /* Function: firm_credit_request_equityfund_investment */
13290  { FLAME_debug_count++; }
13291  /* Function: idle */
13293  { FLAME_debug_count++; }
13294  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
13295  if(FLAME_debug_count != 1)
13296  {
13297  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditIlliquidityStatus'\n");
13298  if(FLAME_debug_count > 1)
13299  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
13300  if(FLAME_debug_count == 0)
13301  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
13302  }
13303 
13305  }
13306 
13307  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_request_equityfund_investment\n");
13310  {
13314  /* For backwards compatibility set current_xmachine */
13325 
13327  {
13328 
13329 
13330 
13332 
13333 
13334 
13335  if(i == 1)
13336  {
13338  }
13339  else
13340  {
13342  }
13343  }
13344 
13345  current_xmachine_firm = NULL;
13346 
13348  }
13349  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_request_equityfund_investment\n");
13350 
13351  if(FLAME_fund_request_message_board_write == 1)
13352  {
13353 
13354  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_request)\n");
13355  rc = MB_SyncStart(b_fund_request);
13356  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_request)\n");
13357  #ifdef ERRCHECK
13358  if (rc != MB_SUCCESS)
13359  {
13360  fprintf(stderr, "ERROR: Could not start sync of 'fund_request' board\n");
13361  switch(rc) {
13362  case MB_ERR_INVALID:
13363  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
13364  break;
13365  case MB_ERR_LOCKED:
13366  fprintf(stderr, "\t reason: 'fund_request' board is locked\n");
13367  break;
13368  case MB_ERR_MEMALLOC:
13369  fprintf(stderr, "\t reason: out of memory\n");
13370  break;
13371  case MB_ERR_INTERNAL:
13372  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13373  break;
13374  default:
13375  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
13376  break;
13377  }
13378 
13379 
13380  exit(rc);
13381  }
13382  #endif
13383  }
13384 
13385 
13386 
13387  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
13390  {
13394  /* For backwards compatibility set current_xmachine */
13405 
13407  {
13408 
13409 
13410 
13411  i = idle();
13412 
13413 
13414 
13415  if(i == 1)
13416  {
13418  }
13419  else
13420  {
13422  }
13423  }
13424 
13425  current_xmachine_firm = NULL;
13426 
13428  }
13429  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
13430 
13431 
13432 /* End of layer number 17 */
13433 
13434 /* Clear message boards that have finished being used
13435  * and sync complete if doing late sync complete */
13436 
13437  /* DEBUG: States with branching functions */
13440  {
13441  FLAME_debug_count = 0;
13442  /* Function: firm_credit_check_equityfund_investment */
13444  { FLAME_debug_count++; }
13445  /* Function: idle */
13447  { FLAME_debug_count++; }
13448  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
13449  if(FLAME_debug_count != 1)
13450  {
13451  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditLiquidityRecheck'\n");
13452  if(FLAME_debug_count > 1)
13453  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
13454  if(FLAME_debug_count == 0)
13455  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
13456  }
13457 
13459  }
13460 
13461  /* If mb is not read then leave sync complete until last possible moment */
13462  if(FLAME_fund_request_message_board_read == 1)
13463  {
13464  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_request)\n");
13465  rc = MB_SyncComplete(b_fund_request);
13466  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_request)\n");
13467  #ifdef ERRCHECK
13468  if (rc != MB_SUCCESS)
13469  {
13470  fprintf(stderr, "ERROR: Could not complete sync of 'fund_request' board\n");
13471  switch(rc) {
13472  case MB_ERR_INVALID:
13473  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
13474  break;
13475  case MB_ERR_MEMALLOC:
13476  fprintf(stderr, "\t reason: out of memory\n");
13477  break;
13478  case MB_ERR_INTERNAL:
13479  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13480  break;
13481  default:
13482  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13483  break;
13484  }
13485 
13486 
13487  exit(rc);
13488  }
13489  #endif
13490 
13491 
13492 
13493  }
13494 
13495  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_invest_illiquids\n");
13498  {
13502  /* For backwards compatibility set current_xmachine */
13513 
13515  {
13516 
13517 
13518 
13519 
13520  rc = MB_Iterator_Create(b_fund_request, &i_fund_request);
13521 
13522 
13523  #ifdef ERRCHECK
13524  if (rc != MB_SUCCESS)
13525  {
13526  fprintf(stderr, "ERROR: Could not create Iterator for 'fund_request'\n");
13527  switch(rc) {
13528  case MB_ERR_INVALID:
13529  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
13530  break;
13531  case MB_ERR_LOCKED:
13532  fprintf(stderr, "\t reason: 'fund_request' board is locked\n");
13533  break;
13534  case MB_ERR_MEMALLOC:
13535  fprintf(stderr, "\t reason: out of memory\n");
13536  break;
13537  case MB_ERR_INTERNAL:
13538  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13539  break;
13540  default:
13541 
13542 
13543  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
13544 
13545  break;
13546  }
13547 
13548 
13549  exit(rc);
13550  }
13551  #endif
13552  MB_Iterator_Randomise(i_fund_request);
13553 
13554 
13556 
13557 
13558  rc = MB_Iterator_Delete(&i_fund_request);
13559  #ifdef ERRCHECK
13560  if (rc != MB_SUCCESS)
13561  {
13562  fprintf(stderr, "ERROR: Could not delete 'fund_request' iterator\n");
13563  switch(rc) {
13564  case MB_ERR_INVALID:
13565  fprintf(stderr, "\t reason: 'fund_request' iterator is invalid\n");
13566  break;
13567  case MB_ERR_INTERNAL:
13568  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13569  break;
13570  default:
13571  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
13572  break;
13573  }
13574 
13575 
13576  exit(rc);
13577  }
13578  #endif
13579 
13580 
13581  if(i == 1)
13582  {
13584  }
13585  else
13586  {
13588  }
13589  }
13590 
13592 
13594  }
13595  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_invest_illiquids\n");
13596 
13597  if(FLAME_fund_request_ack_message_board_write == 1)
13598  {
13599 
13600  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_request_ack)\n");
13601  rc = MB_SyncStart(b_fund_request_ack);
13602  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_request_ack)\n");
13603  #ifdef ERRCHECK
13604  if (rc != MB_SUCCESS)
13605  {
13606  fprintf(stderr, "ERROR: Could not start sync of 'fund_request_ack' board\n");
13607  switch(rc) {
13608  case MB_ERR_INVALID:
13609  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
13610  break;
13611  case MB_ERR_LOCKED:
13612  fprintf(stderr, "\t reason: 'fund_request_ack' board is locked\n");
13613  break;
13614  case MB_ERR_MEMALLOC:
13615  fprintf(stderr, "\t reason: out of memory\n");
13616  break;
13617  case MB_ERR_INTERNAL:
13618  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13619  break;
13620  default:
13621  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
13622  break;
13623  }
13624 
13625 
13626  exit(rc);
13627  }
13628  #endif
13629  }
13630 
13631 
13632 
13633  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
13636  {
13640  /* For backwards compatibility set current_xmachine */
13651 
13653  {
13654 
13655 
13656 
13657  i = idle();
13658 
13659 
13660 
13661  if(i == 1)
13662  {
13664  }
13665  else
13666  {
13668  }
13669  }
13670 
13671  current_xmachine_firm = NULL;
13672 
13674  }
13675  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
13676 
13677 
13678 /* End of layer number 18 */
13679 
13680 /* Clear message boards that have finished being used
13681  * and sync complete if doing late sync complete */
13682 
13683 if(FLAME_fund_request_message_board_read == 0)
13684 {
13685  /*printf("%d> fund_request message board sync complete late as no agents reading any messages of this type\n", node_number);*/
13686 
13687  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_request)\n");
13688  rc = MB_SyncComplete(b_fund_request);
13689  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_request)\n");
13690  #ifdef ERRCHECK
13691  if (rc != MB_SUCCESS)
13692  {
13693  fprintf(stderr, "ERROR: Could not complete sync of 'fund_request' board\n");
13694  switch(rc) {
13695  case MB_ERR_INVALID:
13696  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
13697  break;
13698  case MB_ERR_MEMALLOC:
13699  fprintf(stderr, "\t reason: out of memory\n");
13700  break;
13701  case MB_ERR_INTERNAL:
13702  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13703  break;
13704  default:
13705  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13706  break;
13707  }
13708 
13709 
13710  exit(rc);
13711  }
13712  #endif
13713 }
13714 
13715  /* Delete any search trees */
13716 
13717  rc = MB_Clear(b_fund_request);
13718  #ifdef ERRCHECK
13719  if (rc != MB_SUCCESS)
13720  {
13721  fprintf(stderr, "ERROR: Could not clear 'fund_request' board\n");
13722  switch(rc) {
13723  case MB_ERR_INVALID:
13724  fprintf(stderr, "\t reason: 'fund_request' board is invalid\n");
13725  break;
13726  case MB_ERR_LOCKED:
13727  fprintf(stderr, "\t reason: 'fund_request' board is locked\n");
13728  break;
13729  case MB_ERR_INTERNAL:
13730  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13731  break;
13732  default:
13733  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
13734  break;
13735 
13736  }
13737 
13738 
13739  exit(rc);
13740  }
13741  #endif
13742 
13743 
13744  /* If mb is not read then leave sync complete until last possible moment */
13745  if(FLAME_bank_net_profit_message_board_read == 1)
13746  {
13747  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_net_profit)\n");
13748  rc = MB_SyncComplete(b_bank_net_profit);
13749  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_net_profit)\n");
13750  #ifdef ERRCHECK
13751  if (rc != MB_SUCCESS)
13752  {
13753  fprintf(stderr, "ERROR: Could not complete sync of 'bank_net_profit' board\n");
13754  switch(rc) {
13755  case MB_ERR_INVALID:
13756  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
13757  break;
13758  case MB_ERR_MEMALLOC:
13759  fprintf(stderr, "\t reason: out of memory\n");
13760  break;
13761  case MB_ERR_INTERNAL:
13762  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13763  break;
13764  default:
13765  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13766  break;
13767  }
13768 
13769 
13770  exit(rc);
13771  }
13772  #endif
13773 
13774 
13775 
13776  }
13777 
13778  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_collect_bank_shares\n");
13781  {
13785  /* For backwards compatibility set current_xmachine */
13796 
13797 
13798 
13799 
13800 
13801 
13802  rc = MB_Iterator_Create(b_bank_net_profit, &i_bank_net_profit);
13803 
13804 
13805  #ifdef ERRCHECK
13806  if (rc != MB_SUCCESS)
13807  {
13808  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_net_profit'\n");
13809  switch(rc) {
13810  case MB_ERR_INVALID:
13811  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
13812  break;
13813  case MB_ERR_LOCKED:
13814  fprintf(stderr, "\t reason: 'bank_net_profit' board is locked\n");
13815  break;
13816  case MB_ERR_MEMALLOC:
13817  fprintf(stderr, "\t reason: out of memory\n");
13818  break;
13819  case MB_ERR_INTERNAL:
13820  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13821  break;
13822  default:
13823 
13824 
13825  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
13826 
13827  break;
13828  }
13829 
13830 
13831  exit(rc);
13832  }
13833  #endif
13834 
13835 
13836 
13838 
13839 
13840  rc = MB_Iterator_Delete(&i_bank_net_profit);
13841  #ifdef ERRCHECK
13842  if (rc != MB_SUCCESS)
13843  {
13844  fprintf(stderr, "ERROR: Could not delete 'bank_net_profit' iterator\n");
13845  switch(rc) {
13846  case MB_ERR_INVALID:
13847  fprintf(stderr, "\t reason: 'bank_net_profit' iterator is invalid\n");
13848  break;
13849  case MB_ERR_INTERNAL:
13850  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13851  break;
13852  default:
13853  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
13854  break;
13855  }
13856 
13857 
13858  exit(rc);
13859  }
13860  #endif
13861 
13862 
13863  if(i == 1)
13864  {
13866  }
13867  else
13868  {
13870  }
13871 
13872 
13874 
13876  }
13877  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_collect_bank_shares\n");
13878 
13879 
13880  /* If mb is not read then leave sync complete until last possible moment */
13881  if(FLAME_fund_request_ack_message_board_read == 1)
13882  {
13883  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_request_ack)\n");
13884  rc = MB_SyncComplete(b_fund_request_ack);
13885  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_request_ack)\n");
13886  #ifdef ERRCHECK
13887  if (rc != MB_SUCCESS)
13888  {
13889  fprintf(stderr, "ERROR: Could not complete sync of 'fund_request_ack' board\n");
13890  switch(rc) {
13891  case MB_ERR_INVALID:
13892  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
13893  break;
13894  case MB_ERR_MEMALLOC:
13895  fprintf(stderr, "\t reason: out of memory\n");
13896  break;
13897  case MB_ERR_INTERNAL:
13898  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13899  break;
13900  default:
13901  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
13902  break;
13903  }
13904 
13905 
13906  exit(rc);
13907  }
13908  #endif
13909 
13910 
13911 
13912  }
13913 
13914  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_check_equityfund_investment\n");
13917  {
13921  /* For backwards compatibility set current_xmachine */
13932 
13934  {
13935 
13936 
13937 
13938 
13939 
13940 
13942 
13943 
13944 
13945  #ifdef ERRCHECK
13946  if (rc != MB_SUCCESS)
13947  {
13948  fprintf(stderr, "ERROR: Could not create Iterator for 'fund_request_ack'\n");
13949  switch(rc) {
13950  case MB_ERR_INVALID:
13951  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
13952  break;
13953  case MB_ERR_LOCKED:
13954  fprintf(stderr, "\t reason: 'fund_request_ack' board is locked\n");
13955  break;
13956  case MB_ERR_MEMALLOC:
13957  fprintf(stderr, "\t reason: out of memory\n");
13958  break;
13959  case MB_ERR_INTERNAL:
13960  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13961  break;
13962  default:
13963 
13964  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
13965 
13966 
13967  break;
13968  }
13969 
13970 
13971  exit(rc);
13972  }
13973  #endif
13974 
13975 
13976 
13978 
13979 
13980  rc = MB_Iterator_Delete(&i_fund_request_ack);
13981  #ifdef ERRCHECK
13982  if (rc != MB_SUCCESS)
13983  {
13984  fprintf(stderr, "ERROR: Could not delete 'fund_request_ack' iterator\n");
13985  switch(rc) {
13986  case MB_ERR_INVALID:
13987  fprintf(stderr, "\t reason: 'fund_request_ack' iterator is invalid\n");
13988  break;
13989  case MB_ERR_INTERNAL:
13990  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
13991  break;
13992  default:
13993  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
13994  break;
13995  }
13996 
13997 
13998  exit(rc);
13999  }
14000  #endif
14001 
14002 
14003  if(i == 1)
14004  {
14006  }
14007  else
14008  {
14010  }
14011  }
14012 
14013  current_xmachine_firm = NULL;
14014 
14016  }
14017  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_check_equityfund_investment\n");
14018 
14019 
14020 /* End of layer number 19 */
14021 
14022 /* Clear message boards that have finished being used
14023  * and sync complete if doing late sync complete */
14024 
14025 if(FLAME_fund_request_ack_message_board_read == 0)
14026 {
14027  /*printf("%d> fund_request_ack message board sync complete late as no agents reading any messages of this type\n", node_number);*/
14028 
14029  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_request_ack)\n");
14030  rc = MB_SyncComplete(b_fund_request_ack);
14031  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_request_ack)\n");
14032  #ifdef ERRCHECK
14033  if (rc != MB_SUCCESS)
14034  {
14035  fprintf(stderr, "ERROR: Could not complete sync of 'fund_request_ack' board\n");
14036  switch(rc) {
14037  case MB_ERR_INVALID:
14038  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
14039  break;
14040  case MB_ERR_MEMALLOC:
14041  fprintf(stderr, "\t reason: out of memory\n");
14042  break;
14043  case MB_ERR_INTERNAL:
14044  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14045  break;
14046  default:
14047  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
14048  break;
14049  }
14050 
14051 
14052  exit(rc);
14053  }
14054  #endif
14055 }
14056 
14057  /* Delete any search trees */
14058 
14059  rc = MB_Clear(b_fund_request_ack);
14060  #ifdef ERRCHECK
14061  if (rc != MB_SUCCESS)
14062  {
14063  fprintf(stderr, "ERROR: Could not clear 'fund_request_ack' board\n");
14064  switch(rc) {
14065  case MB_ERR_INVALID:
14066  fprintf(stderr, "\t reason: 'fund_request_ack' board is invalid\n");
14067  break;
14068  case MB_ERR_LOCKED:
14069  fprintf(stderr, "\t reason: 'fund_request_ack' board is locked\n");
14070  break;
14071  case MB_ERR_INTERNAL:
14072  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14073  break;
14074  default:
14075  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
14076  break;
14077 
14078  }
14079 
14080 
14081  exit(rc);
14082  }
14083  #endif
14084 
14085 if(FLAME_bank_net_profit_message_board_read == 0)
14086 {
14087  /*printf("%d> bank_net_profit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
14088 
14089  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_net_profit)\n");
14090  rc = MB_SyncComplete(b_bank_net_profit);
14091  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_net_profit)\n");
14092  #ifdef ERRCHECK
14093  if (rc != MB_SUCCESS)
14094  {
14095  fprintf(stderr, "ERROR: Could not complete sync of 'bank_net_profit' board\n");
14096  switch(rc) {
14097  case MB_ERR_INVALID:
14098  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
14099  break;
14100  case MB_ERR_MEMALLOC:
14101  fprintf(stderr, "\t reason: out of memory\n");
14102  break;
14103  case MB_ERR_INTERNAL:
14104  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14105  break;
14106  default:
14107  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
14108  break;
14109  }
14110 
14111 
14112  exit(rc);
14113  }
14114  #endif
14115 }
14116 
14117  /* Delete any search trees */
14118 
14119  rc = MB_Clear(b_bank_net_profit);
14120  #ifdef ERRCHECK
14121  if (rc != MB_SUCCESS)
14122  {
14123  fprintf(stderr, "ERROR: Could not clear 'bank_net_profit' board\n");
14124  switch(rc) {
14125  case MB_ERR_INVALID:
14126  fprintf(stderr, "\t reason: 'bank_net_profit' board is invalid\n");
14127  break;
14128  case MB_ERR_LOCKED:
14129  fprintf(stderr, "\t reason: 'bank_net_profit' board is locked\n");
14130  break;
14131  case MB_ERR_INTERNAL:
14132  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14133  break;
14134  default:
14135  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
14136  break;
14137 
14138  }
14139 
14140 
14141  exit(rc);
14142  }
14143  #endif
14144 
14145  /* DEBUG: States with branching functions */
14148  {
14149  FLAME_debug_count = 0;
14150  /* Function: firm_credit_illiquidity_bankrupt */
14152  { FLAME_debug_count++; }
14153  /* Function: idle */
14155  { FLAME_debug_count++; }
14156  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
14157  if(FLAME_debug_count != 1)
14158  {
14159  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditBankruptcy'\n");
14160  if(FLAME_debug_count > 1)
14161  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
14162  if(FLAME_debug_count == 0)
14163  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
14164  }
14165 
14167  }
14168 
14169  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_illiquidity_bankrupt\n");
14172  {
14176  /* For backwards compatibility set current_xmachine */
14187 
14189  {
14190 
14191 
14192 
14194 
14195 
14196 
14197  if(i == 1)
14198  {
14200  }
14201  else
14202  {
14204  }
14205  }
14206 
14207  current_xmachine_firm = NULL;
14208 
14210  }
14211  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_illiquidity_bankrupt\n");
14212 
14213 
14214  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
14217  {
14221  /* For backwards compatibility set current_xmachine */
14232 
14234  {
14235 
14236 
14237 
14238  i = idle();
14239 
14240 
14241 
14242  if(i == 1)
14243  {
14245  }
14246  else
14247  {
14249  }
14250  }
14251 
14252  current_xmachine_firm = NULL;
14253 
14255  }
14256  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
14257 
14258 
14259 /* End of layer number 20 */
14260 
14261 /* Clear message boards that have finished being used
14262  * and sync complete if doing late sync complete */
14263 
14264 
14265  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_pay_interest_on_loans\n");
14268  {
14272  /* For backwards compatibility set current_xmachine */
14283 
14284 
14285 
14286 
14287 
14289 
14290 
14291 
14292  if(i == 1)
14293  {
14295  }
14296  else
14297  {
14299  }
14300 
14301 
14302  current_xmachine_firm = NULL;
14303 
14305  }
14306  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_pay_interest_on_loans\n");
14307 
14308  if(FLAME_firm_bank_interest_on_loan_message_board_write == 1)
14309  {
14310 
14311  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_interest_on_loan)\n");
14312  rc = MB_SyncStart(b_firm_bank_interest_on_loan);
14313  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_interest_on_loan)\n");
14314  #ifdef ERRCHECK
14315  if (rc != MB_SUCCESS)
14316  {
14317  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_interest_on_loan' board\n");
14318  switch(rc) {
14319  case MB_ERR_INVALID:
14320  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
14321  break;
14322  case MB_ERR_LOCKED:
14323  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is locked\n");
14324  break;
14325  case MB_ERR_MEMALLOC:
14326  fprintf(stderr, "\t reason: out of memory\n");
14327  break;
14328  case MB_ERR_INTERNAL:
14329  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14330  break;
14331  default:
14332  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14333  break;
14334  }
14335 
14336 
14337  exit(rc);
14338  }
14339  #endif
14340  }
14341 
14342 
14343 
14344 /* End of layer number 21 */
14345 
14346 /* Clear message boards that have finished being used
14347  * and sync complete if doing late sync complete */
14348 
14349 
14350  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_pay_dividends\n");
14353  {
14357  /* For backwards compatibility set current_xmachine */
14368 
14369 
14370 
14371 
14372 
14374 
14375 
14376 
14377  if(i == 1)
14378  {
14380  }
14381  else
14382  {
14384  }
14385 
14386 
14387  current_xmachine_firm = NULL;
14388 
14390  }
14391  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_pay_dividends\n");
14392 
14393  if(FLAME_firm_net_profit_message_board_write == 1)
14394  {
14395 
14396  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_net_profit)\n");
14397  rc = MB_SyncStart(b_firm_net_profit);
14398  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_net_profit)\n");
14399  #ifdef ERRCHECK
14400  if (rc != MB_SUCCESS)
14401  {
14402  fprintf(stderr, "ERROR: Could not start sync of 'firm_net_profit' board\n");
14403  switch(rc) {
14404  case MB_ERR_INVALID:
14405  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
14406  break;
14407  case MB_ERR_LOCKED:
14408  fprintf(stderr, "\t reason: 'firm_net_profit' board is locked\n");
14409  break;
14410  case MB_ERR_MEMALLOC:
14411  fprintf(stderr, "\t reason: out of memory\n");
14412  break;
14413  case MB_ERR_INTERNAL:
14414  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14415  break;
14416  default:
14417  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14418  break;
14419  }
14420 
14421 
14422  exit(rc);
14423  }
14424  #endif
14425  }
14426 
14427 
14428 
14429 /* End of layer number 22 */
14430 
14431 /* Clear message boards that have finished being used
14432  * and sync complete if doing late sync complete */
14433 
14434 
14435  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_do_balance_sheet\n");
14438  {
14442  /* For backwards compatibility set current_xmachine */
14453 
14454 
14455 
14456 
14457 
14459 
14460 
14461 
14462  if(i == 1)
14463  {
14465  }
14466  else
14467  {
14469  }
14470 
14471 
14472  current_xmachine_firm = NULL;
14473 
14475  }
14476  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_do_balance_sheet\n");
14477 
14478 
14479  /* If mb is not read then leave sync complete until last possible moment */
14480  if(FLAME_firm_net_profit_message_board_read == 1)
14481  {
14482  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_net_profit)\n");
14483  rc = MB_SyncComplete(b_firm_net_profit);
14484  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_net_profit)\n");
14485  #ifdef ERRCHECK
14486  if (rc != MB_SUCCESS)
14487  {
14488  fprintf(stderr, "ERROR: Could not complete sync of 'firm_net_profit' board\n");
14489  switch(rc) {
14490  case MB_ERR_INVALID:
14491  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
14492  break;
14493  case MB_ERR_MEMALLOC:
14494  fprintf(stderr, "\t reason: out of memory\n");
14495  break;
14496  case MB_ERR_INTERNAL:
14497  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14498  break;
14499  default:
14500  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
14501  break;
14502  }
14503 
14504 
14505  exit(rc);
14506  }
14507  #endif
14508 
14509 
14510 
14511  }
14512 
14513  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_collect_firm_shares\n");
14516  {
14520  /* For backwards compatibility set current_xmachine */
14531 
14532 
14533 
14534 
14535 
14536 
14537  rc = MB_Iterator_Create(b_firm_net_profit, &i_firm_net_profit);
14538 
14539 
14540  #ifdef ERRCHECK
14541  if (rc != MB_SUCCESS)
14542  {
14543  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_net_profit'\n");
14544  switch(rc) {
14545  case MB_ERR_INVALID:
14546  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
14547  break;
14548  case MB_ERR_LOCKED:
14549  fprintf(stderr, "\t reason: 'firm_net_profit' board is locked\n");
14550  break;
14551  case MB_ERR_MEMALLOC:
14552  fprintf(stderr, "\t reason: out of memory\n");
14553  break;
14554  case MB_ERR_INTERNAL:
14555  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14556  break;
14557  default:
14558 
14559 
14560  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
14561 
14562  break;
14563  }
14564 
14565 
14566  exit(rc);
14567  }
14568  #endif
14569 
14570 
14571 
14573 
14574 
14575  rc = MB_Iterator_Delete(&i_firm_net_profit);
14576  #ifdef ERRCHECK
14577  if (rc != MB_SUCCESS)
14578  {
14579  fprintf(stderr, "ERROR: Could not delete 'firm_net_profit' iterator\n");
14580  switch(rc) {
14581  case MB_ERR_INVALID:
14582  fprintf(stderr, "\t reason: 'firm_net_profit' iterator is invalid\n");
14583  break;
14584  case MB_ERR_INTERNAL:
14585  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14586  break;
14587  default:
14588  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
14589  break;
14590  }
14591 
14592 
14593  exit(rc);
14594  }
14595  #endif
14596 
14597 
14598  if(i == 1)
14599  {
14601  }
14602  else
14603  {
14605  }
14606 
14607 
14609 
14611  }
14612  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_collect_firm_shares\n");
14613 
14614 
14615 /* End of layer number 23 */
14616 
14617 /* Clear message boards that have finished being used
14618  * and sync complete if doing late sync complete */
14619 
14620 if(FLAME_firm_net_profit_message_board_read == 0)
14621 {
14622  /*printf("%d> firm_net_profit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
14623 
14624  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_net_profit)\n");
14625  rc = MB_SyncComplete(b_firm_net_profit);
14626  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_net_profit)\n");
14627  #ifdef ERRCHECK
14628  if (rc != MB_SUCCESS)
14629  {
14630  fprintf(stderr, "ERROR: Could not complete sync of 'firm_net_profit' board\n");
14631  switch(rc) {
14632  case MB_ERR_INVALID:
14633  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
14634  break;
14635  case MB_ERR_MEMALLOC:
14636  fprintf(stderr, "\t reason: out of memory\n");
14637  break;
14638  case MB_ERR_INTERNAL:
14639  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14640  break;
14641  default:
14642  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
14643  break;
14644  }
14645 
14646 
14647  exit(rc);
14648  }
14649  #endif
14650 }
14651 
14652  /* Delete any search trees */
14653 
14654  rc = MB_Clear(b_firm_net_profit);
14655  #ifdef ERRCHECK
14656  if (rc != MB_SUCCESS)
14657  {
14658  fprintf(stderr, "ERROR: Could not clear 'firm_net_profit' board\n");
14659  switch(rc) {
14660  case MB_ERR_INVALID:
14661  fprintf(stderr, "\t reason: 'firm_net_profit' board is invalid\n");
14662  break;
14663  case MB_ERR_LOCKED:
14664  fprintf(stderr, "\t reason: 'firm_net_profit' board is locked\n");
14665  break;
14666  case MB_ERR_INTERNAL:
14667  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14668  break;
14669  default:
14670  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
14671  break;
14672 
14673  }
14674 
14675 
14676  exit(rc);
14677  }
14678  #endif
14679 
14680  /* DEBUG: States with branching functions */
14683  {
14684  FLAME_debug_count = 0;
14685  /* Function: firm_credit_insolvency_bankruptcy */
14687  { FLAME_debug_count++; }
14688  /* Function: idle */
14690  { FLAME_debug_count++; }
14691  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
14692  if(FLAME_debug_count != 1)
14693  {
14694  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditInsolvencyCheck'\n");
14695  if(FLAME_debug_count > 1)
14696  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
14697  if(FLAME_debug_count == 0)
14698  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
14699  }
14700 
14702  }
14703 
14704  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_distribute_shares\n");
14707  {
14711  /* For backwards compatibility set current_xmachine */
14722 
14723 
14724 
14725 
14726 
14728 
14729 
14730 
14731  if(i == 1)
14732  {
14734  }
14735  else
14736  {
14738  }
14739 
14740 
14742 
14744  }
14745  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_distribute_shares\n");
14746 
14747  if(FLAME_capital_tax_message_board_write == 1)
14748  {
14749 
14750  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_capital_tax)\n");
14751  rc = MB_SyncStart(b_capital_tax);
14752  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_capital_tax)\n");
14753  #ifdef ERRCHECK
14754  if (rc != MB_SUCCESS)
14755  {
14756  fprintf(stderr, "ERROR: Could not start sync of 'capital_tax' board\n");
14757  switch(rc) {
14758  case MB_ERR_INVALID:
14759  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
14760  break;
14761  case MB_ERR_LOCKED:
14762  fprintf(stderr, "\t reason: 'capital_tax' board is locked\n");
14763  break;
14764  case MB_ERR_MEMALLOC:
14765  fprintf(stderr, "\t reason: out of memory\n");
14766  break;
14767  case MB_ERR_INTERNAL:
14768  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14769  break;
14770  default:
14771  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14772  break;
14773  }
14774 
14775 
14776  exit(rc);
14777  }
14778  #endif
14779  }
14780 
14781 
14782  if(FLAME_household_share_message_board_write == 1)
14783  {
14784 
14785  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_share)\n");
14786  rc = MB_SyncStart(b_household_share);
14787  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_share)\n");
14788  #ifdef ERRCHECK
14789  if (rc != MB_SUCCESS)
14790  {
14791  fprintf(stderr, "ERROR: Could not start sync of 'household_share' board\n");
14792  switch(rc) {
14793  case MB_ERR_INVALID:
14794  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
14795  break;
14796  case MB_ERR_LOCKED:
14797  fprintf(stderr, "\t reason: 'household_share' board is locked\n");
14798  break;
14799  case MB_ERR_MEMALLOC:
14800  fprintf(stderr, "\t reason: out of memory\n");
14801  break;
14802  case MB_ERR_INTERNAL:
14803  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14804  break;
14805  default:
14806  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14807  break;
14808  }
14809 
14810 
14811  exit(rc);
14812  }
14813  #endif
14814  }
14815 
14816 
14817 
14818  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_insolvency_bankruptcy\n");
14821  {
14825  /* For backwards compatibility set current_xmachine */
14836 
14838  {
14839 
14840 
14841 
14843 
14844 
14845 
14846  if(i == 1)
14847  {
14849  }
14850  else
14851  {
14853  }
14854  }
14855 
14856  current_xmachine_firm = NULL;
14857 
14859  }
14860  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_insolvency_bankruptcy\n");
14861 
14862  if(FLAME_firm_bank_insolvent_account_message_board_write == 1)
14863  {
14864 
14865  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_insolvent_account)\n");
14866  rc = MB_SyncStart(b_firm_bank_insolvent_account);
14867  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_insolvent_account)\n");
14868  #ifdef ERRCHECK
14869  if (rc != MB_SUCCESS)
14870  {
14871  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_insolvent_account' board\n");
14872  switch(rc) {
14873  case MB_ERR_INVALID:
14874  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
14875  break;
14876  case MB_ERR_LOCKED:
14877  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is locked\n");
14878  break;
14879  case MB_ERR_MEMALLOC:
14880  fprintf(stderr, "\t reason: out of memory\n");
14881  break;
14882  case MB_ERR_INTERNAL:
14883  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14884  break;
14885  default:
14886  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14887  break;
14888  }
14889 
14890 
14891  exit(rc);
14892  }
14893  #endif
14894  }
14895 
14896 
14897  if(FLAME_loan_writeoff_message_board_write == 1)
14898  {
14899 
14900  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_loan_writeoff)\n");
14901  rc = MB_SyncStart(b_loan_writeoff);
14902  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_loan_writeoff)\n");
14903  #ifdef ERRCHECK
14904  if (rc != MB_SUCCESS)
14905  {
14906  fprintf(stderr, "ERROR: Could not start sync of 'loan_writeoff' board\n");
14907  switch(rc) {
14908  case MB_ERR_INVALID:
14909  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
14910  break;
14911  case MB_ERR_LOCKED:
14912  fprintf(stderr, "\t reason: 'loan_writeoff' board is locked\n");
14913  break;
14914  case MB_ERR_MEMALLOC:
14915  fprintf(stderr, "\t reason: out of memory\n");
14916  break;
14917  case MB_ERR_INTERNAL:
14918  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14919  break;
14920  default:
14921  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14922  break;
14923  }
14924 
14925 
14926  exit(rc);
14927  }
14928  #endif
14929  }
14930 
14931 
14932  if(FLAME_new_entrant_loan_message_board_write == 1)
14933  {
14934 
14935  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_new_entrant_loan)\n");
14936  rc = MB_SyncStart(b_new_entrant_loan);
14937  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_new_entrant_loan)\n");
14938  #ifdef ERRCHECK
14939  if (rc != MB_SUCCESS)
14940  {
14941  fprintf(stderr, "ERROR: Could not start sync of 'new_entrant_loan' board\n");
14942  switch(rc) {
14943  case MB_ERR_INVALID:
14944  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
14945  break;
14946  case MB_ERR_LOCKED:
14947  fprintf(stderr, "\t reason: 'new_entrant_loan' board is locked\n");
14948  break;
14949  case MB_ERR_MEMALLOC:
14950  fprintf(stderr, "\t reason: out of memory\n");
14951  break;
14952  case MB_ERR_INTERNAL:
14953  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
14954  break;
14955  default:
14956  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
14957  break;
14958  }
14959 
14960 
14961  exit(rc);
14962  }
14963  #endif
14964  }
14965 
14966 
14967 
14968  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
14971  {
14975  /* For backwards compatibility set current_xmachine */
14986 
14988  {
14989 
14990 
14991 
14992  i = idle();
14993 
14994 
14995 
14996  if(i == 1)
14997  {
14999  }
15000  else
15001  {
15003  }
15004  }
15005 
15006  current_xmachine_firm = NULL;
15007 
15009  }
15010  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
15011 
15012 
15013 /* End of layer number 24 */
15014 
15015 /* Clear message boards that have finished being used
15016  * and sync complete if doing late sync complete */
15017 
15018  /* DEBUG: States with branching functions */
15021  {
15022  FLAME_debug_count = 0;
15023  /* Function: equityfund_audit_dividends */
15025  { FLAME_debug_count++; }
15026  /* Function: idle */
15028  { FLAME_debug_count++; }
15029  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
15030  if(FLAME_debug_count != 1)
15031  {
15032  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'equityfund' leaving state 'EFLabourMarket'\n");
15033  if(FLAME_debug_count > 1)
15034  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
15035  if(FLAME_debug_count == 0)
15036  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
15037  }
15038 
15040  }
15041 
15042  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
15045  {
15049  /* For backwards compatibility set current_xmachine */
15060 
15062  {
15063 
15064 
15065 
15066  i = idle();
15067 
15068 
15069 
15070  if(i == 1)
15071  {
15073  }
15074  else
15075  {
15077  }
15078  }
15079 
15081 
15083  }
15084  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
15085 
15086 
15087  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
15090  {
15094  /* For backwards compatibility set current_xmachine */
15105 
15107  {
15108 
15109 
15110 
15111  i = idle();
15112 
15113 
15114 
15115  if(i == 1)
15116  {
15118  }
15119  else
15120  {
15122  }
15123  }
15124 
15125  current_xmachine_firm = NULL;
15126 
15128  }
15129  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
15130 
15131 
15132  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
15135  {
15139  /* For backwards compatibility set current_xmachine */
15150 
15152  {
15153 
15154 
15155 
15156  i = idle();
15157 
15158 
15159 
15160  if(i == 1)
15161  {
15163  }
15164  else
15165  {
15167  }
15168  }
15169 
15170  current_xmachine_firm = NULL;
15171 
15173  }
15174  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
15175 
15176 
15177  /* If mb is not read then leave sync complete until last possible moment */
15178  if(FLAME_firm_bank_insolvent_account_message_board_read == 1)
15179  {
15180  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_insolvent_account)\n");
15181  rc = MB_SyncComplete(b_firm_bank_insolvent_account);
15182  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_insolvent_account)\n");
15183  #ifdef ERRCHECK
15184  if (rc != MB_SUCCESS)
15185  {
15186  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_insolvent_account' board\n");
15187  switch(rc) {
15188  case MB_ERR_INVALID:
15189  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
15190  break;
15191  case MB_ERR_MEMALLOC:
15192  fprintf(stderr, "\t reason: out of memory\n");
15193  break;
15194  case MB_ERR_INTERNAL:
15195  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15196  break;
15197  default:
15198  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15199  break;
15200  }
15201 
15202 
15203  exit(rc);
15204  }
15205  #endif
15206 
15207 
15208 
15209  }
15210 
15211  /* If mb is not read then leave sync complete until last possible moment */
15212  if(FLAME_loan_writeoff_message_board_read == 1)
15213  {
15214  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_loan_writeoff)\n");
15215  rc = MB_SyncComplete(b_loan_writeoff);
15216  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_loan_writeoff)\n");
15217  #ifdef ERRCHECK
15218  if (rc != MB_SUCCESS)
15219  {
15220  fprintf(stderr, "ERROR: Could not complete sync of 'loan_writeoff' board\n");
15221  switch(rc) {
15222  case MB_ERR_INVALID:
15223  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
15224  break;
15225  case MB_ERR_MEMALLOC:
15226  fprintf(stderr, "\t reason: out of memory\n");
15227  break;
15228  case MB_ERR_INTERNAL:
15229  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15230  break;
15231  default:
15232  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15233  break;
15234  }
15235 
15236 
15237  exit(rc);
15238  }
15239  #endif
15240 
15241 
15242 
15243  }
15244 
15245  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_recieve_loan_writeoffs\n");
15248  {
15252  /* For backwards compatibility set current_xmachine */
15263 
15264 
15265 
15266 
15267 
15268 
15269 
15270 
15272 
15273 
15274 
15275  #ifdef ERRCHECK
15276  if (rc != MB_SUCCESS)
15277  {
15278  fprintf(stderr, "ERROR: Could not create Iterator for 'loan_writeoff'\n");
15279  switch(rc) {
15280  case MB_ERR_INVALID:
15281  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
15282  break;
15283  case MB_ERR_LOCKED:
15284  fprintf(stderr, "\t reason: 'loan_writeoff' board is locked\n");
15285  break;
15286  case MB_ERR_MEMALLOC:
15287  fprintf(stderr, "\t reason: out of memory\n");
15288  break;
15289  case MB_ERR_INTERNAL:
15290  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15291  break;
15292  default:
15293 
15294  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
15295 
15296 
15297  break;
15298  }
15299 
15300 
15301  exit(rc);
15302  }
15303  #endif
15304 
15305 
15306 
15307 
15308 
15309 
15311 
15312 
15313 
15314  #ifdef ERRCHECK
15315  if (rc != MB_SUCCESS)
15316  {
15317  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_insolvent_account'\n");
15318  switch(rc) {
15319  case MB_ERR_INVALID:
15320  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
15321  break;
15322  case MB_ERR_LOCKED:
15323  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is locked\n");
15324  break;
15325  case MB_ERR_MEMALLOC:
15326  fprintf(stderr, "\t reason: out of memory\n");
15327  break;
15328  case MB_ERR_INTERNAL:
15329  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15330  break;
15331  default:
15332 
15333  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
15334 
15335 
15336  break;
15337  }
15338 
15339 
15340  exit(rc);
15341  }
15342  #endif
15343 
15344 
15345 
15347 
15348 
15349  rc = MB_Iterator_Delete(&i_loan_writeoff);
15350  #ifdef ERRCHECK
15351  if (rc != MB_SUCCESS)
15352  {
15353  fprintf(stderr, "ERROR: Could not delete 'loan_writeoff' iterator\n");
15354  switch(rc) {
15355  case MB_ERR_INVALID:
15356  fprintf(stderr, "\t reason: 'loan_writeoff' iterator is invalid\n");
15357  break;
15358  case MB_ERR_INTERNAL:
15359  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15360  break;
15361  default:
15362  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
15363  break;
15364  }
15365 
15366 
15367  exit(rc);
15368  }
15369  #endif
15370 
15371  rc = MB_Iterator_Delete(&i_firm_bank_insolvent_account);
15372  #ifdef ERRCHECK
15373  if (rc != MB_SUCCESS)
15374  {
15375  fprintf(stderr, "ERROR: Could not delete 'firm_bank_insolvent_account' iterator\n");
15376  switch(rc) {
15377  case MB_ERR_INVALID:
15378  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' iterator is invalid\n");
15379  break;
15380  case MB_ERR_INTERNAL:
15381  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15382  break;
15383  default:
15384  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
15385  break;
15386  }
15387 
15388 
15389  exit(rc);
15390  }
15391  #endif
15392 
15393 
15394  if(i == 1)
15395  {
15397  }
15398  else
15399  {
15401  }
15402 
15403 
15404  current_xmachine_bank = NULL;
15405 
15407  }
15408  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_recieve_loan_writeoffs\n");
15409 
15410 
15411  /* If mb is not read then leave sync complete until last possible moment */
15412  if(FLAME_household_share_message_board_read == 1)
15413  {
15414  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_share)\n");
15415  rc = MB_SyncComplete(b_household_share);
15416  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_share)\n");
15417  #ifdef ERRCHECK
15418  if (rc != MB_SUCCESS)
15419  {
15420  fprintf(stderr, "ERROR: Could not complete sync of 'household_share' board\n");
15421  switch(rc) {
15422  case MB_ERR_INVALID:
15423  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
15424  break;
15425  case MB_ERR_MEMALLOC:
15426  fprintf(stderr, "\t reason: out of memory\n");
15427  break;
15428  case MB_ERR_INTERNAL:
15429  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15430  break;
15431  default:
15432  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15433  break;
15434  }
15435 
15436 
15437  exit(rc);
15438  }
15439  #endif
15440 
15441 
15442 
15443  }
15444 
15445  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_credit_collect_shares\n");
15448  {
15452  /* For backwards compatibility set current_xmachine */
15463 
15465  {
15466 
15467 
15468 
15469 
15470  rc = MB_Iterator_Create(b_household_share, &i_household_share);
15471 
15472 
15473  #ifdef ERRCHECK
15474  if (rc != MB_SUCCESS)
15475  {
15476  fprintf(stderr, "ERROR: Could not create Iterator for 'household_share'\n");
15477  switch(rc) {
15478  case MB_ERR_INVALID:
15479  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
15480  break;
15481  case MB_ERR_LOCKED:
15482  fprintf(stderr, "\t reason: 'household_share' board is locked\n");
15483  break;
15484  case MB_ERR_MEMALLOC:
15485  fprintf(stderr, "\t reason: out of memory\n");
15486  break;
15487  case MB_ERR_INTERNAL:
15488  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15489  break;
15490  default:
15491 
15492 
15493  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
15494 
15495  break;
15496  }
15497 
15498 
15499  exit(rc);
15500  }
15501  #endif
15502 
15503 
15504 
15506 
15507 
15508  rc = MB_Iterator_Delete(&i_household_share);
15509  #ifdef ERRCHECK
15510  if (rc != MB_SUCCESS)
15511  {
15512  fprintf(stderr, "ERROR: Could not delete 'household_share' iterator\n");
15513  switch(rc) {
15514  case MB_ERR_INVALID:
15515  fprintf(stderr, "\t reason: 'household_share' iterator is invalid\n");
15516  break;
15517  case MB_ERR_INTERNAL:
15518  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15519  break;
15520  default:
15521  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
15522  break;
15523  }
15524 
15525 
15526  exit(rc);
15527  }
15528  #endif
15529 
15530 
15531  if(i == 1)
15532  {
15534  }
15535  else
15536  {
15538  }
15539  }
15540 
15542 
15544  }
15545  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_credit_collect_shares\n");
15546 
15547 
15548  /* If mb is not read then leave sync complete until last possible moment */
15549  if(FLAME_capital_tax_message_board_read == 1)
15550  {
15551  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_capital_tax)\n");
15552  rc = MB_SyncComplete(b_capital_tax);
15553  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_capital_tax)\n");
15554  #ifdef ERRCHECK
15555  if (rc != MB_SUCCESS)
15556  {
15557  fprintf(stderr, "ERROR: Could not complete sync of 'capital_tax' board\n");
15558  switch(rc) {
15559  case MB_ERR_INVALID:
15560  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
15561  break;
15562  case MB_ERR_MEMALLOC:
15563  fprintf(stderr, "\t reason: out of memory\n");
15564  break;
15565  case MB_ERR_INTERNAL:
15566  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15567  break;
15568  default:
15569  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15570  break;
15571  }
15572 
15573 
15574  exit(rc);
15575  }
15576  #endif
15577 
15578 
15579 
15580  }
15581 
15582  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_collect_capital_tax\n");
15585  {
15589  /* For backwards compatibility set current_xmachine */
15600 
15602  {
15603 
15604 
15605 
15606 
15607  rc = MB_Iterator_Create(b_capital_tax, &i_capital_tax);
15608 
15609 
15610  #ifdef ERRCHECK
15611  if (rc != MB_SUCCESS)
15612  {
15613  fprintf(stderr, "ERROR: Could not create Iterator for 'capital_tax'\n");
15614  switch(rc) {
15615  case MB_ERR_INVALID:
15616  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
15617  break;
15618  case MB_ERR_LOCKED:
15619  fprintf(stderr, "\t reason: 'capital_tax' board is locked\n");
15620  break;
15621  case MB_ERR_MEMALLOC:
15622  fprintf(stderr, "\t reason: out of memory\n");
15623  break;
15624  case MB_ERR_INTERNAL:
15625  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15626  break;
15627  default:
15628 
15629 
15630  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
15631 
15632  break;
15633  }
15634 
15635 
15636  exit(rc);
15637  }
15638  #endif
15639 
15640 
15641 
15643 
15644 
15645  rc = MB_Iterator_Delete(&i_capital_tax);
15646  #ifdef ERRCHECK
15647  if (rc != MB_SUCCESS)
15648  {
15649  fprintf(stderr, "ERROR: Could not delete 'capital_tax' iterator\n");
15650  switch(rc) {
15651  case MB_ERR_INVALID:
15652  fprintf(stderr, "\t reason: 'capital_tax' iterator is invalid\n");
15653  break;
15654  case MB_ERR_INTERNAL:
15655  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15656  break;
15657  default:
15658  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
15659  break;
15660  }
15661 
15662 
15663  exit(rc);
15664  }
15665  #endif
15666 
15667 
15668  if(i == 1)
15669  {
15671  }
15672  else
15673  {
15675  }
15676  }
15677 
15679 
15681  }
15682  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_collect_capital_tax\n");
15683 
15684 
15685 /* End of layer number 25 */
15686 
15687 /* Clear message boards that have finished being used
15688  * and sync complete if doing late sync complete */
15689 
15690 if(FLAME_household_share_message_board_read == 0)
15691 {
15692  /*printf("%d> household_share message board sync complete late as no agents reading any messages of this type\n", node_number);*/
15693 
15694  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_share)\n");
15695  rc = MB_SyncComplete(b_household_share);
15696  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_share)\n");
15697  #ifdef ERRCHECK
15698  if (rc != MB_SUCCESS)
15699  {
15700  fprintf(stderr, "ERROR: Could not complete sync of 'household_share' board\n");
15701  switch(rc) {
15702  case MB_ERR_INVALID:
15703  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
15704  break;
15705  case MB_ERR_MEMALLOC:
15706  fprintf(stderr, "\t reason: out of memory\n");
15707  break;
15708  case MB_ERR_INTERNAL:
15709  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15710  break;
15711  default:
15712  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15713  break;
15714  }
15715 
15716 
15717  exit(rc);
15718  }
15719  #endif
15720 }
15721 
15722  /* Delete any search trees */
15723 
15724  rc = MB_Clear(b_household_share);
15725  #ifdef ERRCHECK
15726  if (rc != MB_SUCCESS)
15727  {
15728  fprintf(stderr, "ERROR: Could not clear 'household_share' board\n");
15729  switch(rc) {
15730  case MB_ERR_INVALID:
15731  fprintf(stderr, "\t reason: 'household_share' board is invalid\n");
15732  break;
15733  case MB_ERR_LOCKED:
15734  fprintf(stderr, "\t reason: 'household_share' board is locked\n");
15735  break;
15736  case MB_ERR_INTERNAL:
15737  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15738  break;
15739  default:
15740  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
15741  break;
15742 
15743  }
15744 
15745 
15746  exit(rc);
15747  }
15748  #endif
15749 
15750 if(FLAME_capital_tax_message_board_read == 0)
15751 {
15752  /*printf("%d> capital_tax message board sync complete late as no agents reading any messages of this type\n", node_number);*/
15753 
15754  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_capital_tax)\n");
15755  rc = MB_SyncComplete(b_capital_tax);
15756  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_capital_tax)\n");
15757  #ifdef ERRCHECK
15758  if (rc != MB_SUCCESS)
15759  {
15760  fprintf(stderr, "ERROR: Could not complete sync of 'capital_tax' board\n");
15761  switch(rc) {
15762  case MB_ERR_INVALID:
15763  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
15764  break;
15765  case MB_ERR_MEMALLOC:
15766  fprintf(stderr, "\t reason: out of memory\n");
15767  break;
15768  case MB_ERR_INTERNAL:
15769  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15770  break;
15771  default:
15772  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15773  break;
15774  }
15775 
15776 
15777  exit(rc);
15778  }
15779  #endif
15780 }
15781 
15782  /* Delete any search trees */
15783 
15784  rc = MB_Clear(b_capital_tax);
15785  #ifdef ERRCHECK
15786  if (rc != MB_SUCCESS)
15787  {
15788  fprintf(stderr, "ERROR: Could not clear 'capital_tax' board\n");
15789  switch(rc) {
15790  case MB_ERR_INVALID:
15791  fprintf(stderr, "\t reason: 'capital_tax' board is invalid\n");
15792  break;
15793  case MB_ERR_LOCKED:
15794  fprintf(stderr, "\t reason: 'capital_tax' board is locked\n");
15795  break;
15796  case MB_ERR_INTERNAL:
15797  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15798  break;
15799  default:
15800  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
15801  break;
15802 
15803  }
15804 
15805 
15806  exit(rc);
15807  }
15808  #endif
15809 
15810 if(FLAME_loan_writeoff_message_board_read == 0)
15811 {
15812  /*printf("%d> loan_writeoff message board sync complete late as no agents reading any messages of this type\n", node_number);*/
15813 
15814  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_loan_writeoff)\n");
15815  rc = MB_SyncComplete(b_loan_writeoff);
15816  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_loan_writeoff)\n");
15817  #ifdef ERRCHECK
15818  if (rc != MB_SUCCESS)
15819  {
15820  fprintf(stderr, "ERROR: Could not complete sync of 'loan_writeoff' board\n");
15821  switch(rc) {
15822  case MB_ERR_INVALID:
15823  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
15824  break;
15825  case MB_ERR_MEMALLOC:
15826  fprintf(stderr, "\t reason: out of memory\n");
15827  break;
15828  case MB_ERR_INTERNAL:
15829  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15830  break;
15831  default:
15832  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15833  break;
15834  }
15835 
15836 
15837  exit(rc);
15838  }
15839  #endif
15840 }
15841 
15842  /* Delete any search trees */
15843 
15844  rc = MB_Clear(b_loan_writeoff);
15845  #ifdef ERRCHECK
15846  if (rc != MB_SUCCESS)
15847  {
15848  fprintf(stderr, "ERROR: Could not clear 'loan_writeoff' board\n");
15849  switch(rc) {
15850  case MB_ERR_INVALID:
15851  fprintf(stderr, "\t reason: 'loan_writeoff' board is invalid\n");
15852  break;
15853  case MB_ERR_LOCKED:
15854  fprintf(stderr, "\t reason: 'loan_writeoff' board is locked\n");
15855  break;
15856  case MB_ERR_INTERNAL:
15857  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15858  break;
15859  default:
15860  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
15861  break;
15862 
15863  }
15864 
15865 
15866  exit(rc);
15867  }
15868  #endif
15869 
15870 if(FLAME_firm_bank_insolvent_account_message_board_read == 0)
15871 {
15872  /*printf("%d> firm_bank_insolvent_account message board sync complete late as no agents reading any messages of this type\n", node_number);*/
15873 
15874  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_insolvent_account)\n");
15875  rc = MB_SyncComplete(b_firm_bank_insolvent_account);
15876  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_insolvent_account)\n");
15877  #ifdef ERRCHECK
15878  if (rc != MB_SUCCESS)
15879  {
15880  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_insolvent_account' board\n");
15881  switch(rc) {
15882  case MB_ERR_INVALID:
15883  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
15884  break;
15885  case MB_ERR_MEMALLOC:
15886  fprintf(stderr, "\t reason: out of memory\n");
15887  break;
15888  case MB_ERR_INTERNAL:
15889  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15890  break;
15891  default:
15892  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
15893  break;
15894  }
15895 
15896 
15897  exit(rc);
15898  }
15899  #endif
15900 }
15901 
15902  /* Delete any search trees */
15903 
15904  rc = MB_Clear(b_firm_bank_insolvent_account);
15905  #ifdef ERRCHECK
15906  if (rc != MB_SUCCESS)
15907  {
15908  fprintf(stderr, "ERROR: Could not clear 'firm_bank_insolvent_account' board\n");
15909  switch(rc) {
15910  case MB_ERR_INVALID:
15911  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is invalid\n");
15912  break;
15913  case MB_ERR_LOCKED:
15914  fprintf(stderr, "\t reason: 'firm_bank_insolvent_account' board is locked\n");
15915  break;
15916  case MB_ERR_INTERNAL:
15917  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
15918  break;
15919  default:
15920  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
15921  break;
15922 
15923  }
15924 
15925 
15926  exit(rc);
15927  }
15928  #endif
15929 
15930  /* DEBUG: States with branching functions */
15933  {
15934  FLAME_debug_count = 0;
15935  /* Function: idle */
15937  { FLAME_debug_count++; }
15938  /* Function: firm_production_skip */
15940  { FLAME_debug_count++; }
15941  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
15942  if(FLAME_debug_count != 1)
15943  {
15944  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmProductionSkip'\n");
15945  if(FLAME_debug_count > 1)
15946  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
15947  if(FLAME_debug_count == 0)
15948  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
15949  }
15950 
15952  }
15953  /* DEBUG: States with branching functions */
15956  {
15957  FLAME_debug_count = 0;
15958  /* Function: government_distribute_general_benefits */
15960  { FLAME_debug_count++; }
15961  /* Function: idle */
15963  { FLAME_debug_count++; }
15964  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
15965  if(FLAME_debug_count != 1)
15966  {
15967  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'government' leaving state 'GovernmentMonthly'\n");
15968  if(FLAME_debug_count > 1)
15969  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
15970  if(FLAME_debug_count == 0)
15971  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
15972  }
15973 
15975  }
15976 
15977  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_distribute_general_benefits\n");
15980  {
15984  /* For backwards compatibility set current_xmachine */
15995 
15997  {
15998 
15999 
16000 
16002 
16003 
16004 
16005  if(i == 1)
16006  {
16008  }
16009  else
16010  {
16012  }
16013  }
16014 
16016 
16018  }
16019  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_distribute_general_benefits\n");
16020 
16021  if(FLAME_general_benefit_message_board_write == 1)
16022  {
16023 
16024  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_general_benefit)\n");
16025  rc = MB_SyncStart(b_general_benefit);
16026  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_general_benefit)\n");
16027  #ifdef ERRCHECK
16028  if (rc != MB_SUCCESS)
16029  {
16030  fprintf(stderr, "ERROR: Could not start sync of 'general_benefit' board\n");
16031  switch(rc) {
16032  case MB_ERR_INVALID:
16033  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
16034  break;
16035  case MB_ERR_LOCKED:
16036  fprintf(stderr, "\t reason: 'general_benefit' board is locked\n");
16037  break;
16038  case MB_ERR_MEMALLOC:
16039  fprintf(stderr, "\t reason: out of memory\n");
16040  break;
16041  case MB_ERR_INTERNAL:
16042  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16043  break;
16044  default:
16045  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
16046  break;
16047  }
16048 
16049 
16050  exit(rc);
16051  }
16052  #endif
16053  }
16054 
16055 
16056 
16057  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
16060  {
16064  /* For backwards compatibility set current_xmachine */
16075 
16077  {
16078 
16079 
16080 
16081  i = idle();
16082 
16083 
16084 
16085  if(i == 1)
16086  {
16088  }
16089  else
16090  {
16092  }
16093  }
16094 
16096 
16098  }
16099  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
16100 
16101 
16102  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_credit_do_balance_sheet\n");
16105  {
16109  /* For backwards compatibility set current_xmachine */
16120 
16121 
16122 
16123 
16124 
16126 
16127 
16128 
16129  if(i == 1)
16130  {
16132  }
16133  else
16134  {
16136  }
16137 
16138 
16140 
16142  }
16143  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_credit_do_balance_sheet\n");
16144 
16145 
16146  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
16149  {
16153  /* For backwards compatibility set current_xmachine */
16164 
16166  {
16167 
16168 
16169 
16170  i = idle();
16171 
16172 
16173 
16174  if(i == 1)
16175  {
16177  }
16178  else
16179  {
16181  }
16182  }
16183 
16184  current_xmachine_firm = NULL;
16185 
16187  }
16188  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
16189 
16190 
16191  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_skip\n");
16194  {
16198  /* For backwards compatibility set current_xmachine */
16209 
16211  {
16212 
16213 
16214 
16215  i = firm_production_skip();
16216 
16217 
16218 
16219  if(i == 1)
16220  {
16222  }
16223  else
16224  {
16226  }
16227  }
16228 
16229  current_xmachine_firm = NULL;
16230 
16232  }
16233  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_skip\n");
16234 
16235 
16236  /* If mb is not read then leave sync complete until last possible moment */
16237  if(FLAME_new_entrant_loan_message_board_read == 1)
16238  {
16239  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_new_entrant_loan)\n");
16240  rc = MB_SyncComplete(b_new_entrant_loan);
16241  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_new_entrant_loan)\n");
16242  #ifdef ERRCHECK
16243  if (rc != MB_SUCCESS)
16244  {
16245  fprintf(stderr, "ERROR: Could not complete sync of 'new_entrant_loan' board\n");
16246  switch(rc) {
16247  case MB_ERR_INVALID:
16248  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
16249  break;
16250  case MB_ERR_MEMALLOC:
16251  fprintf(stderr, "\t reason: out of memory\n");
16252  break;
16253  case MB_ERR_INTERNAL:
16254  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16255  break;
16256  default:
16257  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
16258  break;
16259  }
16260 
16261 
16262  exit(rc);
16263  }
16264  #endif
16265 
16266 
16267 
16268  }
16269 
16270  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_recieve_new_entrant_loan_requests\n");
16273  {
16277  /* For backwards compatibility set current_xmachine */
16288 
16289 
16290 
16291 
16292 
16293 
16294 
16295 
16297 
16298 
16299 
16300  #ifdef ERRCHECK
16301  if (rc != MB_SUCCESS)
16302  {
16303  fprintf(stderr, "ERROR: Could not create Iterator for 'new_entrant_loan'\n");
16304  switch(rc) {
16305  case MB_ERR_INVALID:
16306  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
16307  break;
16308  case MB_ERR_LOCKED:
16309  fprintf(stderr, "\t reason: 'new_entrant_loan' board is locked\n");
16310  break;
16311  case MB_ERR_MEMALLOC:
16312  fprintf(stderr, "\t reason: out of memory\n");
16313  break;
16314  case MB_ERR_INTERNAL:
16315  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16316  break;
16317  default:
16318 
16319  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
16320 
16321 
16322  break;
16323  }
16324 
16325 
16326  exit(rc);
16327  }
16328  #endif
16329 
16330 
16331 
16333 
16334 
16335  rc = MB_Iterator_Delete(&i_new_entrant_loan);
16336  #ifdef ERRCHECK
16337  if (rc != MB_SUCCESS)
16338  {
16339  fprintf(stderr, "ERROR: Could not delete 'new_entrant_loan' iterator\n");
16340  switch(rc) {
16341  case MB_ERR_INVALID:
16342  fprintf(stderr, "\t reason: 'new_entrant_loan' iterator is invalid\n");
16343  break;
16344  case MB_ERR_INTERNAL:
16345  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16346  break;
16347  default:
16348  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
16349  break;
16350  }
16351 
16352 
16353  exit(rc);
16354  }
16355  #endif
16356 
16357 
16358  if(i == 1)
16359  {
16361  }
16362  else
16363  {
16365  }
16366 
16367 
16368  current_xmachine_bank = NULL;
16369 
16371  }
16372  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_recieve_new_entrant_loan_requests\n");
16373 
16374 
16375 /* End of layer number 26 */
16376 
16377 /* Clear message boards that have finished being used
16378  * and sync complete if doing late sync complete */
16379 
16380 if(FLAME_new_entrant_loan_message_board_read == 0)
16381 {
16382  /*printf("%d> new_entrant_loan message board sync complete late as no agents reading any messages of this type\n", node_number);*/
16383 
16384  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_new_entrant_loan)\n");
16385  rc = MB_SyncComplete(b_new_entrant_loan);
16386  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_new_entrant_loan)\n");
16387  #ifdef ERRCHECK
16388  if (rc != MB_SUCCESS)
16389  {
16390  fprintf(stderr, "ERROR: Could not complete sync of 'new_entrant_loan' board\n");
16391  switch(rc) {
16392  case MB_ERR_INVALID:
16393  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
16394  break;
16395  case MB_ERR_MEMALLOC:
16396  fprintf(stderr, "\t reason: out of memory\n");
16397  break;
16398  case MB_ERR_INTERNAL:
16399  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16400  break;
16401  default:
16402  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
16403  break;
16404  }
16405 
16406 
16407  exit(rc);
16408  }
16409  #endif
16410 }
16411 
16412  /* Delete any search trees */
16413 
16414  rc = MB_Clear(b_new_entrant_loan);
16415  #ifdef ERRCHECK
16416  if (rc != MB_SUCCESS)
16417  {
16418  fprintf(stderr, "ERROR: Could not clear 'new_entrant_loan' board\n");
16419  switch(rc) {
16420  case MB_ERR_INVALID:
16421  fprintf(stderr, "\t reason: 'new_entrant_loan' board is invalid\n");
16422  break;
16423  case MB_ERR_LOCKED:
16424  fprintf(stderr, "\t reason: 'new_entrant_loan' board is locked\n");
16425  break;
16426  case MB_ERR_INTERNAL:
16427  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16428  break;
16429  default:
16430  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
16431  break;
16432 
16433  }
16434 
16435 
16436  exit(rc);
16437  }
16438  #endif
16439 
16440  /* DEBUG: States with branching functions */
16443  {
16444  FLAME_debug_count = 0;
16445  /* Function: household_credit_collect_benefits */
16447  { FLAME_debug_count++; }
16448  /* Function: idle */
16450  { FLAME_debug_count++; }
16451  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
16452  if(FLAME_debug_count != 1)
16453  {
16454  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHCreditMonthly'\n");
16455  if(FLAME_debug_count > 1)
16456  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
16457  if(FLAME_debug_count == 0)
16458  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
16459  }
16460 
16462  }
16463 
16464  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_distribute_unemployment_benefits\n");
16467  {
16471  /* For backwards compatibility set current_xmachine */
16482 
16483 
16484 
16485 
16486 
16488 
16489 
16490 
16491  if(i == 1)
16492  {
16494  }
16495  else
16496  {
16498  }
16499 
16500 
16502 
16504  }
16505  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_distribute_unemployment_benefits\n");
16506 
16507  if(FLAME_unemployment_benefit_message_board_write == 1)
16508  {
16509 
16510  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_unemployment_benefit)\n");
16511  rc = MB_SyncStart(b_unemployment_benefit);
16512  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_unemployment_benefit)\n");
16513  #ifdef ERRCHECK
16514  if (rc != MB_SUCCESS)
16515  {
16516  fprintf(stderr, "ERROR: Could not start sync of 'unemployment_benefit' board\n");
16517  switch(rc) {
16518  case MB_ERR_INVALID:
16519  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
16520  break;
16521  case MB_ERR_LOCKED:
16522  fprintf(stderr, "\t reason: 'unemployment_benefit' board is locked\n");
16523  break;
16524  case MB_ERR_MEMALLOC:
16525  fprintf(stderr, "\t reason: out of memory\n");
16526  break;
16527  case MB_ERR_INTERNAL:
16528  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16529  break;
16530  default:
16531  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
16532  break;
16533  }
16534 
16535 
16536  exit(rc);
16537  }
16538  #endif
16539  }
16540 
16541 
16542 
16543  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
16546  {
16550  /* For backwards compatibility set current_xmachine */
16561 
16563  {
16564 
16565 
16566 
16567  i = idle();
16568 
16569 
16570 
16571  if(i == 1)
16572  {
16574  }
16575  else
16576  {
16578  }
16579  }
16580 
16582 
16584  }
16585  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
16586 
16587 
16588  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
16591  {
16595  /* For backwards compatibility set current_xmachine */
16606 
16608  {
16609 
16610 
16611 
16612  i = idle();
16613 
16614 
16615 
16616  if(i == 1)
16617  {
16619  }
16620  else
16621  {
16623  }
16624  }
16625 
16626  current_xmachine_firm = NULL;
16627 
16629  }
16630  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
16631 
16632 
16633  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
16636  {
16640  /* For backwards compatibility set current_xmachine */
16651 
16653  {
16654 
16655 
16656 
16657  i = idle();
16658 
16659 
16660 
16661  if(i == 1)
16662  {
16664  }
16665  else
16666  {
16668  }
16669  }
16670 
16671  current_xmachine_firm = NULL;
16672 
16674  }
16675  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
16676 
16677 
16678  /* If mb is not read then leave sync complete until last possible moment */
16679  if(FLAME_firm_bank_interest_on_loan_message_board_read == 1)
16680  {
16681  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_interest_on_loan)\n");
16682  rc = MB_SyncComplete(b_firm_bank_interest_on_loan);
16683  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_interest_on_loan)\n");
16684  #ifdef ERRCHECK
16685  if (rc != MB_SUCCESS)
16686  {
16687  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_interest_on_loan' board\n");
16688  switch(rc) {
16689  case MB_ERR_INVALID:
16690  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
16691  break;
16692  case MB_ERR_MEMALLOC:
16693  fprintf(stderr, "\t reason: out of memory\n");
16694  break;
16695  case MB_ERR_INTERNAL:
16696  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16697  break;
16698  default:
16699  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
16700  break;
16701  }
16702 
16703 
16704  exit(rc);
16705  }
16706  #endif
16707 
16708 
16709 
16710  }
16711 
16712  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_collect_loan_interests\n");
16715  {
16719  /* For backwards compatibility set current_xmachine */
16730 
16731 
16732 
16733 
16734 
16735 
16736 
16737 
16739 
16740 
16741 
16742  #ifdef ERRCHECK
16743  if (rc != MB_SUCCESS)
16744  {
16745  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_interest_on_loan'\n");
16746  switch(rc) {
16747  case MB_ERR_INVALID:
16748  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
16749  break;
16750  case MB_ERR_LOCKED:
16751  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is locked\n");
16752  break;
16753  case MB_ERR_MEMALLOC:
16754  fprintf(stderr, "\t reason: out of memory\n");
16755  break;
16756  case MB_ERR_INTERNAL:
16757  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16758  break;
16759  default:
16760 
16761  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
16762 
16763 
16764  break;
16765  }
16766 
16767 
16768  exit(rc);
16769  }
16770  #endif
16771 
16772 
16773 
16775 
16776 
16777  rc = MB_Iterator_Delete(&i_firm_bank_interest_on_loan);
16778  #ifdef ERRCHECK
16779  if (rc != MB_SUCCESS)
16780  {
16781  fprintf(stderr, "ERROR: Could not delete 'firm_bank_interest_on_loan' iterator\n");
16782  switch(rc) {
16783  case MB_ERR_INVALID:
16784  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' iterator is invalid\n");
16785  break;
16786  case MB_ERR_INTERNAL:
16787  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16788  break;
16789  default:
16790  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
16791  break;
16792  }
16793 
16794 
16795  exit(rc);
16796  }
16797  #endif
16798 
16799 
16800  if(i == 1)
16801  {
16803  }
16804  else
16805  {
16807  }
16808 
16809 
16810  current_xmachine_bank = NULL;
16811 
16813  }
16814  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_collect_loan_interests\n");
16815 
16816 
16817 /* End of layer number 27 */
16818 
16819 /* Clear message boards that have finished being used
16820  * and sync complete if doing late sync complete */
16821 
16822 if(FLAME_firm_bank_interest_on_loan_message_board_read == 0)
16823 {
16824  /*printf("%d> firm_bank_interest_on_loan message board sync complete late as no agents reading any messages of this type\n", node_number);*/
16825 
16826  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_interest_on_loan)\n");
16827  rc = MB_SyncComplete(b_firm_bank_interest_on_loan);
16828  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_interest_on_loan)\n");
16829  #ifdef ERRCHECK
16830  if (rc != MB_SUCCESS)
16831  {
16832  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_interest_on_loan' board\n");
16833  switch(rc) {
16834  case MB_ERR_INVALID:
16835  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
16836  break;
16837  case MB_ERR_MEMALLOC:
16838  fprintf(stderr, "\t reason: out of memory\n");
16839  break;
16840  case MB_ERR_INTERNAL:
16841  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16842  break;
16843  default:
16844  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
16845  break;
16846  }
16847 
16848 
16849  exit(rc);
16850  }
16851  #endif
16852 }
16853 
16854  /* Delete any search trees */
16855 
16856  rc = MB_Clear(b_firm_bank_interest_on_loan);
16857  #ifdef ERRCHECK
16858  if (rc != MB_SUCCESS)
16859  {
16860  fprintf(stderr, "ERROR: Could not clear 'firm_bank_interest_on_loan' board\n");
16861  switch(rc) {
16862  case MB_ERR_INVALID:
16863  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is invalid\n");
16864  break;
16865  case MB_ERR_LOCKED:
16866  fprintf(stderr, "\t reason: 'firm_bank_interest_on_loan' board is locked\n");
16867  break;
16868  case MB_ERR_INTERNAL:
16869  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
16870  break;
16871  default:
16872  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
16873  break;
16874 
16875  }
16876 
16877 
16878  exit(rc);
16879  }
16880  #endif
16881 
16882  /* DEBUG: States with branching functions */
16885  {
16886  FLAME_debug_count = 0;
16887  /* Function: firm_production_set_price */
16889  { FLAME_debug_count++; }
16890  /* Function: firm_production_produce_goods */
16892  { FLAME_debug_count++; }
16893  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
16894  if(FLAME_debug_count != 1)
16895  {
16896  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmProductionRegular'\n");
16897  if(FLAME_debug_count > 1)
16898  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
16899  if(FLAME_debug_count == 0)
16900  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
16901  }
16902 
16904  }
16905  /* DEBUG: States with branching functions */
16908  {
16909  FLAME_debug_count = 0;
16910  /* Function: firm_production_construction_plan */
16912  { FLAME_debug_count++; }
16913  /* Function: firm_production_construct_houses */
16915  { FLAME_debug_count++; }
16916  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
16917  if(FLAME_debug_count != 1)
16918  {
16919  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmProductionConstructor'\n");
16920  if(FLAME_debug_count > 1)
16921  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
16922  if(FLAME_debug_count == 0)
16923  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
16924  }
16925 
16927  }
16928  /* DEBUG: States with branching functions */
16931  {
16932  FLAME_debug_count = 0;
16933  /* Function: bank_housing_compute_capital_status */
16935  { FLAME_debug_count++; }
16936  /* Function: idle */
16938  { FLAME_debug_count++; }
16939  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
16940  if(FLAME_debug_count != 1)
16941  {
16942  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'bank' leaving state 'BankHousingMarket'\n");
16943  if(FLAME_debug_count > 1)
16944  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
16945  if(FLAME_debug_count == 0)
16946  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
16947  }
16948 
16950  }
16951 
16952  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_housing_compute_capital_status\n");
16955  {
16959  /* For backwards compatibility set current_xmachine */
16970 
16972  {
16973 
16974 
16975 
16977 
16978 
16979 
16980  if(i == 1)
16981  {
16983  }
16984  else
16985  {
16987  }
16988  }
16989 
16990  current_xmachine_bank = NULL;
16991 
16993  }
16994  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_housing_compute_capital_status\n");
16995 
16996  if(FLAME_bank_reagency_credibility_message_board_write == 1)
16997  {
16998 
16999  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bank_reagency_credibility)\n");
17000  rc = MB_SyncStart(b_bank_reagency_credibility);
17001  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bank_reagency_credibility)\n");
17002  #ifdef ERRCHECK
17003  if (rc != MB_SUCCESS)
17004  {
17005  fprintf(stderr, "ERROR: Could not start sync of 'bank_reagency_credibility' board\n");
17006  switch(rc) {
17007  case MB_ERR_INVALID:
17008  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
17009  break;
17010  case MB_ERR_LOCKED:
17011  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is locked\n");
17012  break;
17013  case MB_ERR_MEMALLOC:
17014  fprintf(stderr, "\t reason: out of memory\n");
17015  break;
17016  case MB_ERR_INTERNAL:
17017  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17018  break;
17019  default:
17020  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
17021  break;
17022  }
17023 
17024 
17025  exit(rc);
17026  }
17027  #endif
17028  }
17029 
17030 
17031 
17032  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
17035  {
17039  /* For backwards compatibility set current_xmachine */
17050 
17052  {
17053 
17054 
17055 
17056  i = idle();
17057 
17058 
17059 
17060  if(i == 1)
17061  {
17063  }
17064  else
17065  {
17067  }
17068  }
17069 
17070  current_xmachine_bank = NULL;
17071 
17073  }
17074  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
17075 
17076 
17077  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_construction_plan\n");
17080  {
17084  /* For backwards compatibility set current_xmachine */
17095 
17097  {
17098 
17099 
17100 
17102 
17103 
17104 
17105  if(i == 1)
17106  {
17108  }
17109  else
17110  {
17112  }
17113  }
17114 
17115  current_xmachine_firm = NULL;
17116 
17118  }
17119  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_construction_plan\n");
17120 
17121 
17122  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_construct_houses\n");
17125  {
17129  /* For backwards compatibility set current_xmachine */
17140 
17142  {
17143 
17144 
17145 
17147 
17148 
17149 
17150  if(i == 1)
17151  {
17153  }
17154  else
17155  {
17157  }
17158  }
17159 
17160  current_xmachine_firm = NULL;
17161 
17163  }
17164  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_construct_houses\n");
17165 
17166 
17167  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_set_price\n");
17170  {
17174  /* For backwards compatibility set current_xmachine */
17185 
17187  {
17188 
17189 
17190 
17192 
17193 
17194 
17195  if(i == 1)
17196  {
17198  }
17199  else
17200  {
17202  }
17203  }
17204 
17205  current_xmachine_firm = NULL;
17206 
17208  }
17209  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_set_price\n");
17210 
17211 
17212  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_produce_goods\n");
17215  {
17219  /* For backwards compatibility set current_xmachine */
17230 
17232  {
17233 
17234 
17235 
17237 
17238 
17239 
17240  if(i == 1)
17241  {
17243  }
17244  else
17245  {
17247  }
17248  }
17249 
17250  current_xmachine_firm = NULL;
17251 
17253  }
17254  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_produce_goods\n");
17255 
17256 
17257  /* If mb is not read then leave sync complete until last possible moment */
17258  if(FLAME_general_benefit_message_board_read == 1)
17259  {
17260  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_general_benefit)\n");
17261  rc = MB_SyncComplete(b_general_benefit);
17262  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_general_benefit)\n");
17263  #ifdef ERRCHECK
17264  if (rc != MB_SUCCESS)
17265  {
17266  fprintf(stderr, "ERROR: Could not complete sync of 'general_benefit' board\n");
17267  switch(rc) {
17268  case MB_ERR_INVALID:
17269  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
17270  break;
17271  case MB_ERR_MEMALLOC:
17272  fprintf(stderr, "\t reason: out of memory\n");
17273  break;
17274  case MB_ERR_INTERNAL:
17275  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17276  break;
17277  default:
17278  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
17279  break;
17280  }
17281 
17282 
17283  exit(rc);
17284  }
17285  #endif
17286 
17287 
17288 
17289  }
17290 
17291  /* If mb is not read then leave sync complete until last possible moment */
17292  if(FLAME_unemployment_benefit_message_board_read == 1)
17293  {
17294  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_unemployment_benefit)\n");
17295  rc = MB_SyncComplete(b_unemployment_benefit);
17296  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_unemployment_benefit)\n");
17297  #ifdef ERRCHECK
17298  if (rc != MB_SUCCESS)
17299  {
17300  fprintf(stderr, "ERROR: Could not complete sync of 'unemployment_benefit' board\n");
17301  switch(rc) {
17302  case MB_ERR_INVALID:
17303  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
17304  break;
17305  case MB_ERR_MEMALLOC:
17306  fprintf(stderr, "\t reason: out of memory\n");
17307  break;
17308  case MB_ERR_INTERNAL:
17309  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17310  break;
17311  default:
17312  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
17313  break;
17314  }
17315 
17316 
17317  exit(rc);
17318  }
17319  #endif
17320 
17321 
17322 
17323  }
17324 
17325  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_credit_collect_benefits\n");
17328  {
17332  /* For backwards compatibility set current_xmachine */
17343 
17345  {
17346 
17347 
17348 
17349 
17350  rc = MB_Iterator_Create(b_general_benefit, &i_general_benefit);
17351 
17352 
17353  #ifdef ERRCHECK
17354  if (rc != MB_SUCCESS)
17355  {
17356  fprintf(stderr, "ERROR: Could not create Iterator for 'general_benefit'\n");
17357  switch(rc) {
17358  case MB_ERR_INVALID:
17359  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
17360  break;
17361  case MB_ERR_LOCKED:
17362  fprintf(stderr, "\t reason: 'general_benefit' board is locked\n");
17363  break;
17364  case MB_ERR_MEMALLOC:
17365  fprintf(stderr, "\t reason: out of memory\n");
17366  break;
17367  case MB_ERR_INTERNAL:
17368  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17369  break;
17370  default:
17371 
17372 
17373  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
17374 
17375  break;
17376  }
17377 
17378 
17379  exit(rc);
17380  }
17381  #endif
17382 
17383 
17384 
17385 
17386  rc = MB_Iterator_Create(b_unemployment_benefit, &i_unemployment_benefit);
17387 
17388 
17389  #ifdef ERRCHECK
17390  if (rc != MB_SUCCESS)
17391  {
17392  fprintf(stderr, "ERROR: Could not create Iterator for 'unemployment_benefit'\n");
17393  switch(rc) {
17394  case MB_ERR_INVALID:
17395  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
17396  break;
17397  case MB_ERR_LOCKED:
17398  fprintf(stderr, "\t reason: 'unemployment_benefit' board is locked\n");
17399  break;
17400  case MB_ERR_MEMALLOC:
17401  fprintf(stderr, "\t reason: out of memory\n");
17402  break;
17403  case MB_ERR_INTERNAL:
17404  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17405  break;
17406  default:
17407 
17408 
17409  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
17410 
17411  break;
17412  }
17413 
17414 
17415  exit(rc);
17416  }
17417  #endif
17418 
17419 
17420 
17422 
17423 
17424  rc = MB_Iterator_Delete(&i_general_benefit);
17425  #ifdef ERRCHECK
17426  if (rc != MB_SUCCESS)
17427  {
17428  fprintf(stderr, "ERROR: Could not delete 'general_benefit' iterator\n");
17429  switch(rc) {
17430  case MB_ERR_INVALID:
17431  fprintf(stderr, "\t reason: 'general_benefit' iterator is invalid\n");
17432  break;
17433  case MB_ERR_INTERNAL:
17434  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17435  break;
17436  default:
17437  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
17438  break;
17439  }
17440 
17441 
17442  exit(rc);
17443  }
17444  #endif
17445 
17446  rc = MB_Iterator_Delete(&i_unemployment_benefit);
17447  #ifdef ERRCHECK
17448  if (rc != MB_SUCCESS)
17449  {
17450  fprintf(stderr, "ERROR: Could not delete 'unemployment_benefit' iterator\n");
17451  switch(rc) {
17452  case MB_ERR_INVALID:
17453  fprintf(stderr, "\t reason: 'unemployment_benefit' iterator is invalid\n");
17454  break;
17455  case MB_ERR_INTERNAL:
17456  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17457  break;
17458  default:
17459  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
17460  break;
17461  }
17462 
17463 
17464  exit(rc);
17465  }
17466  #endif
17467 
17468 
17469  if(i == 1)
17470  {
17472  }
17473  else
17474  {
17476  }
17477  }
17478 
17480 
17482  }
17483  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_credit_collect_benefits\n");
17484 
17485 
17486 /* End of layer number 28 */
17487 
17488 /* Clear message boards that have finished being used
17489  * and sync complete if doing late sync complete */
17490 
17491 if(FLAME_unemployment_benefit_message_board_read == 0)
17492 {
17493  /*printf("%d> unemployment_benefit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
17494 
17495  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_unemployment_benefit)\n");
17496  rc = MB_SyncComplete(b_unemployment_benefit);
17497  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_unemployment_benefit)\n");
17498  #ifdef ERRCHECK
17499  if (rc != MB_SUCCESS)
17500  {
17501  fprintf(stderr, "ERROR: Could not complete sync of 'unemployment_benefit' board\n");
17502  switch(rc) {
17503  case MB_ERR_INVALID:
17504  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
17505  break;
17506  case MB_ERR_MEMALLOC:
17507  fprintf(stderr, "\t reason: out of memory\n");
17508  break;
17509  case MB_ERR_INTERNAL:
17510  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17511  break;
17512  default:
17513  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
17514  break;
17515  }
17516 
17517 
17518  exit(rc);
17519  }
17520  #endif
17521 }
17522 
17523  /* Delete any search trees */
17524 
17525  rc = MB_Clear(b_unemployment_benefit);
17526  #ifdef ERRCHECK
17527  if (rc != MB_SUCCESS)
17528  {
17529  fprintf(stderr, "ERROR: Could not clear 'unemployment_benefit' board\n");
17530  switch(rc) {
17531  case MB_ERR_INVALID:
17532  fprintf(stderr, "\t reason: 'unemployment_benefit' board is invalid\n");
17533  break;
17534  case MB_ERR_LOCKED:
17535  fprintf(stderr, "\t reason: 'unemployment_benefit' board is locked\n");
17536  break;
17537  case MB_ERR_INTERNAL:
17538  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17539  break;
17540  default:
17541  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
17542  break;
17543 
17544  }
17545 
17546 
17547  exit(rc);
17548  }
17549  #endif
17550 
17551 if(FLAME_general_benefit_message_board_read == 0)
17552 {
17553  /*printf("%d> general_benefit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
17554 
17555  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_general_benefit)\n");
17556  rc = MB_SyncComplete(b_general_benefit);
17557  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_general_benefit)\n");
17558  #ifdef ERRCHECK
17559  if (rc != MB_SUCCESS)
17560  {
17561  fprintf(stderr, "ERROR: Could not complete sync of 'general_benefit' board\n");
17562  switch(rc) {
17563  case MB_ERR_INVALID:
17564  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
17565  break;
17566  case MB_ERR_MEMALLOC:
17567  fprintf(stderr, "\t reason: out of memory\n");
17568  break;
17569  case MB_ERR_INTERNAL:
17570  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17571  break;
17572  default:
17573  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
17574  break;
17575  }
17576 
17577 
17578  exit(rc);
17579  }
17580  #endif
17581 }
17582 
17583  /* Delete any search trees */
17584 
17585  rc = MB_Clear(b_general_benefit);
17586  #ifdef ERRCHECK
17587  if (rc != MB_SUCCESS)
17588  {
17589  fprintf(stderr, "ERROR: Could not clear 'general_benefit' board\n");
17590  switch(rc) {
17591  case MB_ERR_INVALID:
17592  fprintf(stderr, "\t reason: 'general_benefit' board is invalid\n");
17593  break;
17594  case MB_ERR_LOCKED:
17595  fprintf(stderr, "\t reason: 'general_benefit' board is locked\n");
17596  break;
17597  case MB_ERR_INTERNAL:
17598  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
17599  break;
17600  default:
17601  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
17602  break;
17603 
17604  }
17605 
17606 
17607  exit(rc);
17608  }
17609  #endif
17610 
17611  /* DEBUG: States with branching functions */
17614  {
17615  FLAME_debug_count = 0;
17616  /* Function: household_labour_check_fired */
17618  { FLAME_debug_count++; }
17619  /* Function: idle */
17621  { FLAME_debug_count++; }
17622  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
17623  if(FLAME_debug_count != 1)
17624  {
17625  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHLabourStart'\n");
17626  if(FLAME_debug_count > 1)
17627  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
17628  if(FLAME_debug_count == 0)
17629  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
17630  }
17631 
17633  }
17634 
17635  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
17638  {
17642  /* For backwards compatibility set current_xmachine */
17653 
17655  {
17656 
17657 
17658 
17659  i = idle();
17660 
17661 
17662 
17663  if(i == 1)
17664  {
17666  }
17667  else
17668  {
17670  }
17671  }
17672 
17674 
17676  }
17677  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
17678 
17679 
17680  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_construction_labour_demand\n");
17683  {
17687  /* For backwards compatibility set current_xmachine */
17698 
17699 
17700 
17701 
17702 
17704 
17705 
17706 
17707  if(i == 1)
17708  {
17710  }
17711  else
17712  {
17714  }
17715 
17716 
17717  current_xmachine_firm = NULL;
17718 
17720  }
17721  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_construction_labour_demand\n");
17722 
17723 
17724  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_plan\n");
17727  {
17731  /* For backwards compatibility set current_xmachine */
17742 
17743 
17744 
17745 
17746 
17747  i = firm_production_plan();
17748 
17749 
17750 
17751  if(i == 1)
17752  {
17754  }
17755  else
17756  {
17758  }
17759 
17760 
17761  current_xmachine_firm = NULL;
17762 
17764  }
17765  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_plan\n");
17766 
17767 
17768 /* End of layer number 29 */
17769 
17770 /* Clear message boards that have finished being used
17771  * and sync complete if doing late sync complete */
17772 
17773 
17774  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_production_compute_labour_demand\n");
17777  {
17781  /* For backwards compatibility set current_xmachine */
17792 
17793 
17794 
17795 
17796 
17798 
17799 
17800 
17801  if(i == 1)
17802  {
17804  }
17805  else
17806  {
17808  }
17809 
17810 
17811  current_xmachine_firm = NULL;
17812 
17814  }
17815  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_production_compute_labour_demand\n");
17816 
17817 
17818 /* End of layer number 30 */
17819 
17820 /* Clear message boards that have finished being used
17821  * and sync complete if doing late sync complete */
17822 
17823  /* DEBUG: States with branching functions */
17826  {
17827  FLAME_debug_count = 0;
17828  /* Function: firm_labour_workforce_needed */
17830  { FLAME_debug_count++; }
17831  /* Function: idle */
17833  { FLAME_debug_count++; }
17834  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
17835  if(FLAME_debug_count != 1)
17836  {
17837  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmLabourStart'\n");
17838  if(FLAME_debug_count > 1)
17839  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
17840  if(FLAME_debug_count == 0)
17841  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
17842  }
17843 
17845  }
17846 
17847  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_workforce_needed\n");
17850  {
17854  /* For backwards compatibility set current_xmachine */
17865 
17867  {
17868 
17869 
17870 
17872 
17873 
17874 
17875  if(i == 1)
17876  {
17878  }
17879  else
17880  {
17882  }
17883  }
17884 
17885  current_xmachine_firm = NULL;
17886 
17888  }
17889  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_workforce_needed\n");
17890 
17891 
17892  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
17895  {
17899  /* For backwards compatibility set current_xmachine */
17910 
17912  {
17913 
17914 
17915 
17916  i = idle();
17917 
17918 
17919 
17920  if(i == 1)
17921  {
17923  }
17924  else
17925  {
17927  }
17928  }
17929 
17930  current_xmachine_firm = NULL;
17931 
17933  }
17934  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
17935 
17936 
17937 /* End of layer number 31 */
17938 
17939 /* Clear message boards that have finished being used
17940  * and sync complete if doing late sync complete */
17941 
17942  /* DEBUG: States with branching functions */
17945  {
17946  FLAME_debug_count = 0;
17947  /* Function: firm_labour_job_announcement_stage1 */
17949  { FLAME_debug_count++; }
17950  /* Function: firm_labour_fire */
17952  { FLAME_debug_count++; }
17953  /* Function: idle */
17955  { FLAME_debug_count++; }
17956  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
17957  if(FLAME_debug_count != 1)
17958  {
17959  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmLabourStage1'\n");
17960  if(FLAME_debug_count > 1)
17961  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
17962  if(FLAME_debug_count == 0)
17963  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
17964  }
17965 
17967  }
17968 
17969  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_fire\n");
17972  {
17976  /* For backwards compatibility set current_xmachine */
17987 
17989  {
17990 
17991 
17992 
17993  i = firm_labour_fire();
17994 
17995 
17996 
17997  if(i == 1)
17998  {
18000  }
18001  else
18002  {
18004  }
18005  }
18006 
18007  current_xmachine_firm = NULL;
18008 
18010  }
18011  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_fire\n");
18012 
18013  if(FLAME_fired_message_board_write == 1)
18014  {
18015 
18016  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fired)\n");
18017  rc = MB_SyncStart(b_fired);
18018  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fired)\n");
18019  #ifdef ERRCHECK
18020  if (rc != MB_SUCCESS)
18021  {
18022  fprintf(stderr, "ERROR: Could not start sync of 'fired' board\n");
18023  switch(rc) {
18024  case MB_ERR_INVALID:
18025  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
18026  break;
18027  case MB_ERR_LOCKED:
18028  fprintf(stderr, "\t reason: 'fired' board is locked\n");
18029  break;
18030  case MB_ERR_MEMALLOC:
18031  fprintf(stderr, "\t reason: out of memory\n");
18032  break;
18033  case MB_ERR_INTERNAL:
18034  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18035  break;
18036  default:
18037  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
18038  break;
18039  }
18040 
18041 
18042  exit(rc);
18043  }
18044  #endif
18045  }
18046 
18047 
18048 
18049  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_job_announcement_stage1\n");
18052  {
18056  /* For backwards compatibility set current_xmachine */
18067 
18069  {
18070 
18071 
18072 
18074 
18075 
18076 
18077  if(i == 1)
18078  {
18080  }
18081  else
18082  {
18084  }
18085  }
18086 
18087  current_xmachine_firm = NULL;
18088 
18090  }
18091  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_job_announcement_stage1\n");
18092 
18093  if(FLAME_vacancy_stage1_message_board_write == 1)
18094  {
18095 
18096  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_vacancy_stage1)\n");
18097  rc = MB_SyncStart(b_vacancy_stage1);
18098  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_vacancy_stage1)\n");
18099  #ifdef ERRCHECK
18100  if (rc != MB_SUCCESS)
18101  {
18102  fprintf(stderr, "ERROR: Could not start sync of 'vacancy_stage1' board\n");
18103  switch(rc) {
18104  case MB_ERR_INVALID:
18105  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
18106  break;
18107  case MB_ERR_LOCKED:
18108  fprintf(stderr, "\t reason: 'vacancy_stage1' board is locked\n");
18109  break;
18110  case MB_ERR_MEMALLOC:
18111  fprintf(stderr, "\t reason: out of memory\n");
18112  break;
18113  case MB_ERR_INTERNAL:
18114  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18115  break;
18116  default:
18117  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
18118  break;
18119  }
18120 
18121 
18122  exit(rc);
18123  }
18124  #endif
18125  }
18126 
18127 
18128 
18129  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
18132  {
18136  /* For backwards compatibility set current_xmachine */
18147 
18149  {
18150 
18151 
18152 
18153  i = idle();
18154 
18155 
18156 
18157  if(i == 1)
18158  {
18160  }
18161  else
18162  {
18164  }
18165  }
18166 
18167  current_xmachine_firm = NULL;
18168 
18170  }
18171  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
18172 
18173 
18174 /* End of layer number 32 */
18175 
18176 /* Clear message boards that have finished being used
18177  * and sync complete if doing late sync complete */
18178 
18179 
18180  /* If mb is not read then leave sync complete until last possible moment */
18181  if(FLAME_fired_message_board_read == 1)
18182  {
18183  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fired)\n");
18184  rc = MB_SyncComplete(b_fired);
18185  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fired)\n");
18186  #ifdef ERRCHECK
18187  if (rc != MB_SUCCESS)
18188  {
18189  fprintf(stderr, "ERROR: Could not complete sync of 'fired' board\n");
18190  switch(rc) {
18191  case MB_ERR_INVALID:
18192  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
18193  break;
18194  case MB_ERR_MEMALLOC:
18195  fprintf(stderr, "\t reason: out of memory\n");
18196  break;
18197  case MB_ERR_INTERNAL:
18198  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18199  break;
18200  default:
18201  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
18202  break;
18203  }
18204 
18205 
18206  exit(rc);
18207  }
18208  #endif
18209 
18210 
18211 
18212  }
18213 
18214  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_check_fired\n");
18217  {
18221  /* For backwards compatibility set current_xmachine */
18232 
18234  {
18235 
18236 
18237 
18238 
18239 
18240 
18242 
18243 
18244 
18245  #ifdef ERRCHECK
18246  if (rc != MB_SUCCESS)
18247  {
18248  fprintf(stderr, "ERROR: Could not create Iterator for 'fired'\n");
18249  switch(rc) {
18250  case MB_ERR_INVALID:
18251  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
18252  break;
18253  case MB_ERR_LOCKED:
18254  fprintf(stderr, "\t reason: 'fired' board is locked\n");
18255  break;
18256  case MB_ERR_MEMALLOC:
18257  fprintf(stderr, "\t reason: out of memory\n");
18258  break;
18259  case MB_ERR_INTERNAL:
18260  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18261  break;
18262  default:
18263 
18264  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
18265 
18266 
18267  break;
18268  }
18269 
18270 
18271  exit(rc);
18272  }
18273  #endif
18274 
18275 
18276 
18278 
18279 
18280  rc = MB_Iterator_Delete(&i_fired);
18281  #ifdef ERRCHECK
18282  if (rc != MB_SUCCESS)
18283  {
18284  fprintf(stderr, "ERROR: Could not delete 'fired' iterator\n");
18285  switch(rc) {
18286  case MB_ERR_INVALID:
18287  fprintf(stderr, "\t reason: 'fired' iterator is invalid\n");
18288  break;
18289  case MB_ERR_INTERNAL:
18290  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18291  break;
18292  default:
18293  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
18294  break;
18295  }
18296 
18297 
18298  exit(rc);
18299  }
18300  #endif
18301 
18302 
18303  if(i == 1)
18304  {
18306  }
18307  else
18308  {
18310  }
18311  }
18312 
18314 
18316  }
18317  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_check_fired\n");
18318 
18319 
18320 /* End of layer number 33 */
18321 
18322 /* Clear message boards that have finished being used
18323  * and sync complete if doing late sync complete */
18324 
18325 if(FLAME_fired_message_board_read == 0)
18326 {
18327  /*printf("%d> fired message board sync complete late as no agents reading any messages of this type\n", node_number);*/
18328 
18329  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fired)\n");
18330  rc = MB_SyncComplete(b_fired);
18331  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fired)\n");
18332  #ifdef ERRCHECK
18333  if (rc != MB_SUCCESS)
18334  {
18335  fprintf(stderr, "ERROR: Could not complete sync of 'fired' board\n");
18336  switch(rc) {
18337  case MB_ERR_INVALID:
18338  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
18339  break;
18340  case MB_ERR_MEMALLOC:
18341  fprintf(stderr, "\t reason: out of memory\n");
18342  break;
18343  case MB_ERR_INTERNAL:
18344  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18345  break;
18346  default:
18347  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
18348  break;
18349  }
18350 
18351 
18352  exit(rc);
18353  }
18354  #endif
18355 }
18356 
18357  /* Delete any search trees */
18358 
18359  rc = MB_Clear(b_fired);
18360  #ifdef ERRCHECK
18361  if (rc != MB_SUCCESS)
18362  {
18363  fprintf(stderr, "ERROR: Could not clear 'fired' board\n");
18364  switch(rc) {
18365  case MB_ERR_INVALID:
18366  fprintf(stderr, "\t reason: 'fired' board is invalid\n");
18367  break;
18368  case MB_ERR_LOCKED:
18369  fprintf(stderr, "\t reason: 'fired' board is locked\n");
18370  break;
18371  case MB_ERR_INTERNAL:
18372  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18373  break;
18374  default:
18375  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
18376  break;
18377 
18378  }
18379 
18380 
18381  exit(rc);
18382  }
18383  #endif
18384 
18385  /* DEBUG: States with branching functions */
18388  {
18389  FLAME_debug_count = 0;
18390  /* Function: idle */
18392  { FLAME_debug_count++; }
18393  /* Function: household_labour_reemployment_application */
18395  { FLAME_debug_count++; }
18396  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
18397  if(FLAME_debug_count != 1)
18398  {
18399  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHLabourStage1'\n");
18400  if(FLAME_debug_count > 1)
18401  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
18402  if(FLAME_debug_count == 0)
18403  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
18404  }
18405 
18407  }
18408 
18409  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_reemployment_application\n");
18412  {
18416  /* For backwards compatibility set current_xmachine */
18427 
18429  {
18430 
18431 
18432 
18434 
18435 
18436 
18437  if(i == 1)
18438  {
18440  }
18441  else
18442  {
18444  }
18445  }
18446 
18448 
18450  }
18451  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_reemployment_application\n");
18452 
18453  if(FLAME_job_application_stage1_message_board_write == 1)
18454  {
18455 
18456  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_application_stage1)\n");
18457  rc = MB_SyncStart(b_job_application_stage1);
18458  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_application_stage1)\n");
18459  #ifdef ERRCHECK
18460  if (rc != MB_SUCCESS)
18461  {
18462  fprintf(stderr, "ERROR: Could not start sync of 'job_application_stage1' board\n");
18463  switch(rc) {
18464  case MB_ERR_INVALID:
18465  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
18466  break;
18467  case MB_ERR_LOCKED:
18468  fprintf(stderr, "\t reason: 'job_application_stage1' board is locked\n");
18469  break;
18470  case MB_ERR_MEMALLOC:
18471  fprintf(stderr, "\t reason: out of memory\n");
18472  break;
18473  case MB_ERR_INTERNAL:
18474  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18475  break;
18476  default:
18477  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
18478  break;
18479  }
18480 
18481 
18482  exit(rc);
18483  }
18484  #endif
18485  }
18486 
18487 
18488 
18489  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
18492  {
18496  /* For backwards compatibility set current_xmachine */
18507 
18509  {
18510 
18511 
18512 
18513  i = idle();
18514 
18515 
18516 
18517  if(i == 1)
18518  {
18520  }
18521  else
18522  {
18524  }
18525  }
18526 
18528 
18530  }
18531  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
18532 
18533 
18534 /* End of layer number 34 */
18535 
18536 /* Clear message boards that have finished being used
18537  * and sync complete if doing late sync complete */
18538 
18539 
18540  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_employment_application\n");
18543  {
18547  /* For backwards compatibility set current_xmachine */
18558 
18559 
18560 
18561 
18562 
18564 
18565 
18566 
18567  if(i == 1)
18568  {
18570  }
18571  else
18572  {
18574  }
18575 
18576 
18578 
18580  }
18581  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_employment_application\n");
18582 
18583  if(FLAME_job_application_stage2_message_board_write == 1)
18584  {
18585 
18586  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_application_stage2)\n");
18587  rc = MB_SyncStart(b_job_application_stage2);
18588  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_application_stage2)\n");
18589  #ifdef ERRCHECK
18590  if (rc != MB_SUCCESS)
18591  {
18592  fprintf(stderr, "ERROR: Could not start sync of 'job_application_stage2' board\n");
18593  switch(rc) {
18594  case MB_ERR_INVALID:
18595  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
18596  break;
18597  case MB_ERR_LOCKED:
18598  fprintf(stderr, "\t reason: 'job_application_stage2' board is locked\n");
18599  break;
18600  case MB_ERR_MEMALLOC:
18601  fprintf(stderr, "\t reason: out of memory\n");
18602  break;
18603  case MB_ERR_INTERNAL:
18604  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18605  break;
18606  default:
18607  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
18608  break;
18609  }
18610 
18611 
18612  exit(rc);
18613  }
18614  #endif
18615  }
18616 
18617 
18618 
18619  /* If mb is not read then leave sync complete until last possible moment */
18620  if(FLAME_job_application_stage1_message_board_read == 1)
18621  {
18622  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_application_stage1)\n");
18623  rc = MB_SyncComplete(b_job_application_stage1);
18624  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_application_stage1)\n");
18625  #ifdef ERRCHECK
18626  if (rc != MB_SUCCESS)
18627  {
18628  fprintf(stderr, "ERROR: Could not complete sync of 'job_application_stage1' board\n");
18629  switch(rc) {
18630  case MB_ERR_INVALID:
18631  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
18632  break;
18633  case MB_ERR_MEMALLOC:
18634  fprintf(stderr, "\t reason: out of memory\n");
18635  break;
18636  case MB_ERR_INTERNAL:
18637  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18638  break;
18639  default:
18640  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
18641  break;
18642  }
18643 
18644 
18645  exit(rc);
18646  }
18647  #endif
18648 
18649 
18650 
18651  }
18652 
18653  /* If mb is not read then leave sync complete until last possible moment */
18654  if(FLAME_vacancy_stage1_message_board_read == 1)
18655  {
18656  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_vacancy_stage1)\n");
18657  rc = MB_SyncComplete(b_vacancy_stage1);
18658  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_vacancy_stage1)\n");
18659  #ifdef ERRCHECK
18660  if (rc != MB_SUCCESS)
18661  {
18662  fprintf(stderr, "ERROR: Could not complete sync of 'vacancy_stage1' board\n");
18663  switch(rc) {
18664  case MB_ERR_INVALID:
18665  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
18666  break;
18667  case MB_ERR_MEMALLOC:
18668  fprintf(stderr, "\t reason: out of memory\n");
18669  break;
18670  case MB_ERR_INTERNAL:
18671  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18672  break;
18673  default:
18674  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
18675  break;
18676  }
18677 
18678 
18679  exit(rc);
18680  }
18681  #endif
18682 
18683 
18684 
18685  }
18686 
18687  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start jpoffice_labour_stage1\n");
18690  {
18694  /* For backwards compatibility set current_xmachine */
18705 
18707  {
18708 
18709 
18710 
18711 
18712 
18714 
18715  #ifdef ERRCHECK
18716  if (rc != MB_SUCCESS)
18717  {
18718  fprintf(stderr, "ERROR: Could not create Iterator for 'vacancy_stage1'\n");
18719  switch(rc) {
18720  case MB_ERR_INVALID:
18721  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
18722  break;
18723  case MB_ERR_LOCKED:
18724  fprintf(stderr, "\t reason: 'vacancy_stage1' board is locked\n");
18725  break;
18726  case MB_ERR_MEMALLOC:
18727  fprintf(stderr, "\t reason: out of memory\n");
18728  break;
18729  case MB_ERR_INTERNAL:
18730  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18731  break;
18732  default:
18733 
18734 
18735  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
18736 
18737  break;
18738  }
18739 
18740 
18741  exit(rc);
18742  }
18743  #endif
18744 
18745 
18746 
18747 
18748 
18750 
18751  #ifdef ERRCHECK
18752  if (rc != MB_SUCCESS)
18753  {
18754  fprintf(stderr, "ERROR: Could not create Iterator for 'job_application_stage1'\n");
18755  switch(rc) {
18756  case MB_ERR_INVALID:
18757  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
18758  break;
18759  case MB_ERR_LOCKED:
18760  fprintf(stderr, "\t reason: 'job_application_stage1' board is locked\n");
18761  break;
18762  case MB_ERR_MEMALLOC:
18763  fprintf(stderr, "\t reason: out of memory\n");
18764  break;
18765  case MB_ERR_INTERNAL:
18766  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18767  break;
18768  default:
18769 
18770 
18771  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
18772 
18773  break;
18774  }
18775 
18776 
18777  exit(rc);
18778  }
18779  #endif
18780 
18781 
18782 
18783  i = jpoffice_labour_stage1();
18784 
18785 
18786  rc = MB_Iterator_Delete(&i_vacancy_stage1);
18787  #ifdef ERRCHECK
18788  if (rc != MB_SUCCESS)
18789  {
18790  fprintf(stderr, "ERROR: Could not delete 'vacancy_stage1' iterator\n");
18791  switch(rc) {
18792  case MB_ERR_INVALID:
18793  fprintf(stderr, "\t reason: 'vacancy_stage1' iterator is invalid\n");
18794  break;
18795  case MB_ERR_INTERNAL:
18796  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18797  break;
18798  default:
18799  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
18800  break;
18801  }
18802 
18803 
18804  exit(rc);
18805  }
18806  #endif
18807 
18808  rc = MB_Iterator_Delete(&i_job_application_stage1);
18809  #ifdef ERRCHECK
18810  if (rc != MB_SUCCESS)
18811  {
18812  fprintf(stderr, "ERROR: Could not delete 'job_application_stage1' iterator\n");
18813  switch(rc) {
18814  case MB_ERR_INVALID:
18815  fprintf(stderr, "\t reason: 'job_application_stage1' iterator is invalid\n");
18816  break;
18817  case MB_ERR_INTERNAL:
18818  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18819  break;
18820  default:
18821  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
18822  break;
18823  }
18824 
18825 
18826  exit(rc);
18827  }
18828  #endif
18829 
18830 
18831  if(i == 1)
18832  {
18834  }
18835  else
18836  {
18838  }
18839  }
18840 
18842 
18844  }
18845  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish jpoffice_labour_stage1\n");
18846 
18847  if(FLAME_job_match_stage1_message_board_write == 1)
18848  {
18849 
18850  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_match_stage1)\n");
18851  rc = MB_SyncStart(b_job_match_stage1);
18852  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_match_stage1)\n");
18853  #ifdef ERRCHECK
18854  if (rc != MB_SUCCESS)
18855  {
18856  fprintf(stderr, "ERROR: Could not start sync of 'job_match_stage1' board\n");
18857  switch(rc) {
18858  case MB_ERR_INVALID:
18859  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
18860  break;
18861  case MB_ERR_LOCKED:
18862  fprintf(stderr, "\t reason: 'job_match_stage1' board is locked\n");
18863  break;
18864  case MB_ERR_MEMALLOC:
18865  fprintf(stderr, "\t reason: out of memory\n");
18866  break;
18867  case MB_ERR_INTERNAL:
18868  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18869  break;
18870  default:
18871  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
18872  break;
18873  }
18874 
18875 
18876  exit(rc);
18877  }
18878  #endif
18879  }
18880 
18881 
18882 
18883 /* End of layer number 35 */
18884 
18885 /* Clear message boards that have finished being used
18886  * and sync complete if doing late sync complete */
18887 
18888 if(FLAME_vacancy_stage1_message_board_read == 0)
18889 {
18890  /*printf("%d> vacancy_stage1 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
18891 
18892  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_vacancy_stage1)\n");
18893  rc = MB_SyncComplete(b_vacancy_stage1);
18894  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_vacancy_stage1)\n");
18895  #ifdef ERRCHECK
18896  if (rc != MB_SUCCESS)
18897  {
18898  fprintf(stderr, "ERROR: Could not complete sync of 'vacancy_stage1' board\n");
18899  switch(rc) {
18900  case MB_ERR_INVALID:
18901  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
18902  break;
18903  case MB_ERR_MEMALLOC:
18904  fprintf(stderr, "\t reason: out of memory\n");
18905  break;
18906  case MB_ERR_INTERNAL:
18907  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18908  break;
18909  default:
18910  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
18911  break;
18912  }
18913 
18914 
18915  exit(rc);
18916  }
18917  #endif
18918 }
18919 
18920  /* Delete any search trees */
18921 
18922  rc = MB_Clear(b_vacancy_stage1);
18923  #ifdef ERRCHECK
18924  if (rc != MB_SUCCESS)
18925  {
18926  fprintf(stderr, "ERROR: Could not clear 'vacancy_stage1' board\n");
18927  switch(rc) {
18928  case MB_ERR_INVALID:
18929  fprintf(stderr, "\t reason: 'vacancy_stage1' board is invalid\n");
18930  break;
18931  case MB_ERR_LOCKED:
18932  fprintf(stderr, "\t reason: 'vacancy_stage1' board is locked\n");
18933  break;
18934  case MB_ERR_INTERNAL:
18935  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18936  break;
18937  default:
18938  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
18939  break;
18940 
18941  }
18942 
18943 
18944  exit(rc);
18945  }
18946  #endif
18947 
18948 if(FLAME_job_application_stage1_message_board_read == 0)
18949 {
18950  /*printf("%d> job_application_stage1 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
18951 
18952  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_application_stage1)\n");
18953  rc = MB_SyncComplete(b_job_application_stage1);
18954  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_application_stage1)\n");
18955  #ifdef ERRCHECK
18956  if (rc != MB_SUCCESS)
18957  {
18958  fprintf(stderr, "ERROR: Could not complete sync of 'job_application_stage1' board\n");
18959  switch(rc) {
18960  case MB_ERR_INVALID:
18961  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
18962  break;
18963  case MB_ERR_MEMALLOC:
18964  fprintf(stderr, "\t reason: out of memory\n");
18965  break;
18966  case MB_ERR_INTERNAL:
18967  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18968  break;
18969  default:
18970  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
18971  break;
18972  }
18973 
18974 
18975  exit(rc);
18976  }
18977  #endif
18978 }
18979 
18980  /* Delete any search trees */
18981 
18982  rc = MB_Clear(b_job_application_stage1);
18983  #ifdef ERRCHECK
18984  if (rc != MB_SUCCESS)
18985  {
18986  fprintf(stderr, "ERROR: Could not clear 'job_application_stage1' board\n");
18987  switch(rc) {
18988  case MB_ERR_INVALID:
18989  fprintf(stderr, "\t reason: 'job_application_stage1' board is invalid\n");
18990  break;
18991  case MB_ERR_LOCKED:
18992  fprintf(stderr, "\t reason: 'job_application_stage1' board is locked\n");
18993  break;
18994  case MB_ERR_INTERNAL:
18995  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
18996  break;
18997  default:
18998  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
18999  break;
19000 
19001  }
19002 
19003 
19004  exit(rc);
19005  }
19006  #endif
19007 
19008 
19009  /* If mb is not read then leave sync complete until last possible moment */
19010  if(FLAME_job_match_stage1_message_board_read == 1)
19011  {
19012  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_match_stage1)\n");
19013  rc = MB_SyncComplete(b_job_match_stage1);
19014  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_match_stage1)\n");
19015  #ifdef ERRCHECK
19016  if (rc != MB_SUCCESS)
19017  {
19018  fprintf(stderr, "ERROR: Could not complete sync of 'job_match_stage1' board\n");
19019  switch(rc) {
19020  case MB_ERR_INVALID:
19021  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
19022  break;
19023  case MB_ERR_MEMALLOC:
19024  fprintf(stderr, "\t reason: out of memory\n");
19025  break;
19026  case MB_ERR_INTERNAL:
19027  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19028  break;
19029  default:
19030  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
19031  break;
19032  }
19033 
19034 
19035  exit(rc);
19036  }
19037  #endif
19038 
19039 
19040 
19041  }
19042 
19043  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_turnover\n");
19046  {
19050  /* For backwards compatibility set current_xmachine */
19061 
19062 
19063 
19064 
19065 
19066 
19067 
19068 
19070 
19071 
19072 
19073  #ifdef ERRCHECK
19074  if (rc != MB_SUCCESS)
19075  {
19076  fprintf(stderr, "ERROR: Could not create Iterator for 'job_match_stage1'\n");
19077  switch(rc) {
19078  case MB_ERR_INVALID:
19079  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
19080  break;
19081  case MB_ERR_LOCKED:
19082  fprintf(stderr, "\t reason: 'job_match_stage1' board is locked\n");
19083  break;
19084  case MB_ERR_MEMALLOC:
19085  fprintf(stderr, "\t reason: out of memory\n");
19086  break;
19087  case MB_ERR_INTERNAL:
19088  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19089  break;
19090  default:
19091 
19092  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
19093 
19094 
19095  break;
19096  }
19097 
19098 
19099  exit(rc);
19100  }
19101  #endif
19102 
19103 
19104 
19106 
19107 
19108  rc = MB_Iterator_Delete(&i_job_match_stage1);
19109  #ifdef ERRCHECK
19110  if (rc != MB_SUCCESS)
19111  {
19112  fprintf(stderr, "ERROR: Could not delete 'job_match_stage1' iterator\n");
19113  switch(rc) {
19114  case MB_ERR_INVALID:
19115  fprintf(stderr, "\t reason: 'job_match_stage1' iterator is invalid\n");
19116  break;
19117  case MB_ERR_INTERNAL:
19118  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19119  break;
19120  default:
19121  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
19122  break;
19123  }
19124 
19125 
19126  exit(rc);
19127  }
19128  #endif
19129 
19130 
19131  if(i == 1)
19132  {
19134  }
19135  else
19136  {
19138  }
19139 
19140 
19142 
19144  }
19145  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_turnover\n");
19146 
19147  if(FLAME_job_change_message_board_write == 1)
19148  {
19149 
19150  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_change)\n");
19151  rc = MB_SyncStart(b_job_change);
19152  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_change)\n");
19153  #ifdef ERRCHECK
19154  if (rc != MB_SUCCESS)
19155  {
19156  fprintf(stderr, "ERROR: Could not start sync of 'job_change' board\n");
19157  switch(rc) {
19158  case MB_ERR_INVALID:
19159  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
19160  break;
19161  case MB_ERR_LOCKED:
19162  fprintf(stderr, "\t reason: 'job_change' board is locked\n");
19163  break;
19164  case MB_ERR_MEMALLOC:
19165  fprintf(stderr, "\t reason: out of memory\n");
19166  break;
19167  case MB_ERR_INTERNAL:
19168  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19169  break;
19170  default:
19171  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
19172  break;
19173  }
19174 
19175 
19176  exit(rc);
19177  }
19178  #endif
19179  }
19180 
19181 
19182 
19183  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_job_offer_stage1\n");
19186  {
19190  /* For backwards compatibility set current_xmachine */
19201 
19202 
19203 
19204 
19205 
19206 
19207 
19208 
19210 
19211 
19212 
19213  #ifdef ERRCHECK
19214  if (rc != MB_SUCCESS)
19215  {
19216  fprintf(stderr, "ERROR: Could not create Iterator for 'job_match_stage1'\n");
19217  switch(rc) {
19218  case MB_ERR_INVALID:
19219  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
19220  break;
19221  case MB_ERR_LOCKED:
19222  fprintf(stderr, "\t reason: 'job_match_stage1' board is locked\n");
19223  break;
19224  case MB_ERR_MEMALLOC:
19225  fprintf(stderr, "\t reason: out of memory\n");
19226  break;
19227  case MB_ERR_INTERNAL:
19228  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19229  break;
19230  default:
19231 
19232  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
19233 
19234 
19235  break;
19236  }
19237 
19238 
19239  exit(rc);
19240  }
19241  #endif
19242 
19243 
19244 
19246 
19247 
19248  rc = MB_Iterator_Delete(&i_job_match_stage1);
19249  #ifdef ERRCHECK
19250  if (rc != MB_SUCCESS)
19251  {
19252  fprintf(stderr, "ERROR: Could not delete 'job_match_stage1' iterator\n");
19253  switch(rc) {
19254  case MB_ERR_INVALID:
19255  fprintf(stderr, "\t reason: 'job_match_stage1' iterator is invalid\n");
19256  break;
19257  case MB_ERR_INTERNAL:
19258  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19259  break;
19260  default:
19261  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
19262  break;
19263  }
19264 
19265 
19266  exit(rc);
19267  }
19268  #endif
19269 
19270 
19271  if(i == 1)
19272  {
19274  }
19275  else
19276  {
19278  }
19279 
19280 
19281  current_xmachine_firm = NULL;
19282 
19284  }
19285  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_job_offer_stage1\n");
19286 
19287 
19288 /* End of layer number 36 */
19289 
19290 /* Clear message boards that have finished being used
19291  * and sync complete if doing late sync complete */
19292 
19293 if(FLAME_job_match_stage1_message_board_read == 0)
19294 {
19295  /*printf("%d> job_match_stage1 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
19296 
19297  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_match_stage1)\n");
19298  rc = MB_SyncComplete(b_job_match_stage1);
19299  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_match_stage1)\n");
19300  #ifdef ERRCHECK
19301  if (rc != MB_SUCCESS)
19302  {
19303  fprintf(stderr, "ERROR: Could not complete sync of 'job_match_stage1' board\n");
19304  switch(rc) {
19305  case MB_ERR_INVALID:
19306  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
19307  break;
19308  case MB_ERR_MEMALLOC:
19309  fprintf(stderr, "\t reason: out of memory\n");
19310  break;
19311  case MB_ERR_INTERNAL:
19312  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19313  break;
19314  default:
19315  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
19316  break;
19317  }
19318 
19319 
19320  exit(rc);
19321  }
19322  #endif
19323 }
19324 
19325  /* Delete any search trees */
19326 
19327  rc = MB_Clear(b_job_match_stage1);
19328  #ifdef ERRCHECK
19329  if (rc != MB_SUCCESS)
19330  {
19331  fprintf(stderr, "ERROR: Could not clear 'job_match_stage1' board\n");
19332  switch(rc) {
19333  case MB_ERR_INVALID:
19334  fprintf(stderr, "\t reason: 'job_match_stage1' board is invalid\n");
19335  break;
19336  case MB_ERR_LOCKED:
19337  fprintf(stderr, "\t reason: 'job_match_stage1' board is locked\n");
19338  break;
19339  case MB_ERR_INTERNAL:
19340  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19341  break;
19342  default:
19343  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
19344  break;
19345 
19346  }
19347 
19348 
19349  exit(rc);
19350  }
19351  #endif
19352 
19353 
19354  /* If mb is not read then leave sync complete until last possible moment */
19355  if(FLAME_job_change_message_board_read == 1)
19356  {
19357  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_change)\n");
19358  rc = MB_SyncComplete(b_job_change);
19359  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_change)\n");
19360  #ifdef ERRCHECK
19361  if (rc != MB_SUCCESS)
19362  {
19363  fprintf(stderr, "ERROR: Could not complete sync of 'job_change' board\n");
19364  switch(rc) {
19365  case MB_ERR_INVALID:
19366  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
19367  break;
19368  case MB_ERR_MEMALLOC:
19369  fprintf(stderr, "\t reason: out of memory\n");
19370  break;
19371  case MB_ERR_INTERNAL:
19372  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19373  break;
19374  default:
19375  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
19376  break;
19377  }
19378 
19379 
19380  exit(rc);
19381  }
19382  #endif
19383 
19384 
19385 
19386  }
19387 
19388  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_update\n");
19391  {
19395  /* For backwards compatibility set current_xmachine */
19406 
19407 
19408 
19409 
19410 
19411 
19412 
19413 
19415 
19416 
19417 
19418  #ifdef ERRCHECK
19419  if (rc != MB_SUCCESS)
19420  {
19421  fprintf(stderr, "ERROR: Could not create Iterator for 'job_change'\n");
19422  switch(rc) {
19423  case MB_ERR_INVALID:
19424  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
19425  break;
19426  case MB_ERR_LOCKED:
19427  fprintf(stderr, "\t reason: 'job_change' board is locked\n");
19428  break;
19429  case MB_ERR_MEMALLOC:
19430  fprintf(stderr, "\t reason: out of memory\n");
19431  break;
19432  case MB_ERR_INTERNAL:
19433  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19434  break;
19435  default:
19436 
19437  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
19438 
19439 
19440  break;
19441  }
19442 
19443 
19444  exit(rc);
19445  }
19446  #endif
19447 
19448 
19449 
19450  i = firm_labour_update();
19451 
19452 
19453  rc = MB_Iterator_Delete(&i_job_change);
19454  #ifdef ERRCHECK
19455  if (rc != MB_SUCCESS)
19456  {
19457  fprintf(stderr, "ERROR: Could not delete 'job_change' iterator\n");
19458  switch(rc) {
19459  case MB_ERR_INVALID:
19460  fprintf(stderr, "\t reason: 'job_change' iterator is invalid\n");
19461  break;
19462  case MB_ERR_INTERNAL:
19463  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19464  break;
19465  default:
19466  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
19467  break;
19468  }
19469 
19470 
19471  exit(rc);
19472  }
19473  #endif
19474 
19475 
19476  if(i == 1)
19477  {
19479  }
19480  else
19481  {
19483  }
19484 
19485 
19486  current_xmachine_firm = NULL;
19487 
19489  }
19490  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_update\n");
19491 
19492 
19493 /* End of layer number 37 */
19494 
19495 /* Clear message boards that have finished being used
19496  * and sync complete if doing late sync complete */
19497 
19498 if(FLAME_job_change_message_board_read == 0)
19499 {
19500  /*printf("%d> job_change message board sync complete late as no agents reading any messages of this type\n", node_number);*/
19501 
19502  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_change)\n");
19503  rc = MB_SyncComplete(b_job_change);
19504  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_change)\n");
19505  #ifdef ERRCHECK
19506  if (rc != MB_SUCCESS)
19507  {
19508  fprintf(stderr, "ERROR: Could not complete sync of 'job_change' board\n");
19509  switch(rc) {
19510  case MB_ERR_INVALID:
19511  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
19512  break;
19513  case MB_ERR_MEMALLOC:
19514  fprintf(stderr, "\t reason: out of memory\n");
19515  break;
19516  case MB_ERR_INTERNAL:
19517  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19518  break;
19519  default:
19520  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
19521  break;
19522  }
19523 
19524 
19525  exit(rc);
19526  }
19527  #endif
19528 }
19529 
19530  /* Delete any search trees */
19531 
19532  rc = MB_Clear(b_job_change);
19533  #ifdef ERRCHECK
19534  if (rc != MB_SUCCESS)
19535  {
19536  fprintf(stderr, "ERROR: Could not clear 'job_change' board\n");
19537  switch(rc) {
19538  case MB_ERR_INVALID:
19539  fprintf(stderr, "\t reason: 'job_change' board is invalid\n");
19540  break;
19541  case MB_ERR_LOCKED:
19542  fprintf(stderr, "\t reason: 'job_change' board is locked\n");
19543  break;
19544  case MB_ERR_INTERNAL:
19545  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19546  break;
19547  default:
19548  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
19549  break;
19550 
19551  }
19552 
19553 
19554  exit(rc);
19555  }
19556  #endif
19557 
19558  /* DEBUG: States with branching functions */
19561  {
19562  FLAME_debug_count = 0;
19563  /* Function: idle */
19565  { FLAME_debug_count++; }
19566  /* Function: firm_labour_job_announcement_stage2 */
19568  { FLAME_debug_count++; }
19569  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
19570  if(FLAME_debug_count != 1)
19571  {
19572  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmLabourStage2'\n");
19573  if(FLAME_debug_count > 1)
19574  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
19575  if(FLAME_debug_count == 0)
19576  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
19577  }
19578 
19580  }
19581 
19582  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_job_announcement_stage2\n");
19585  {
19589  /* For backwards compatibility set current_xmachine */
19600 
19602  {
19603 
19604 
19605 
19607 
19608 
19609 
19610  if(i == 1)
19611  {
19613  }
19614  else
19615  {
19617  }
19618  }
19619 
19620  current_xmachine_firm = NULL;
19621 
19623  }
19624  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_job_announcement_stage2\n");
19625 
19626  if(FLAME_vacancy_stage2_message_board_write == 1)
19627  {
19628 
19629  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_vacancy_stage2)\n");
19630  rc = MB_SyncStart(b_vacancy_stage2);
19631  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_vacancy_stage2)\n");
19632  #ifdef ERRCHECK
19633  if (rc != MB_SUCCESS)
19634  {
19635  fprintf(stderr, "ERROR: Could not start sync of 'vacancy_stage2' board\n");
19636  switch(rc) {
19637  case MB_ERR_INVALID:
19638  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
19639  break;
19640  case MB_ERR_LOCKED:
19641  fprintf(stderr, "\t reason: 'vacancy_stage2' board is locked\n");
19642  break;
19643  case MB_ERR_MEMALLOC:
19644  fprintf(stderr, "\t reason: out of memory\n");
19645  break;
19646  case MB_ERR_INTERNAL:
19647  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19648  break;
19649  default:
19650  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
19651  break;
19652  }
19653 
19654 
19655  exit(rc);
19656  }
19657  #endif
19658  }
19659 
19660 
19661 
19662  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
19665  {
19669  /* For backwards compatibility set current_xmachine */
19680 
19682  {
19683 
19684 
19685 
19686  i = idle();
19687 
19688 
19689 
19690  if(i == 1)
19691  {
19693  }
19694  else
19695  {
19697  }
19698  }
19699 
19700  current_xmachine_firm = NULL;
19701 
19703  }
19704  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
19705 
19706 
19707 /* End of layer number 38 */
19708 
19709 /* Clear message boards that have finished being used
19710  * and sync complete if doing late sync complete */
19711 
19712 
19713  /* If mb is not read then leave sync complete until last possible moment */
19714  if(FLAME_vacancy_stage2_message_board_read == 1)
19715  {
19716  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_vacancy_stage2)\n");
19717  rc = MB_SyncComplete(b_vacancy_stage2);
19718  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_vacancy_stage2)\n");
19719  #ifdef ERRCHECK
19720  if (rc != MB_SUCCESS)
19721  {
19722  fprintf(stderr, "ERROR: Could not complete sync of 'vacancy_stage2' board\n");
19723  switch(rc) {
19724  case MB_ERR_INVALID:
19725  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
19726  break;
19727  case MB_ERR_MEMALLOC:
19728  fprintf(stderr, "\t reason: out of memory\n");
19729  break;
19730  case MB_ERR_INTERNAL:
19731  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19732  break;
19733  default:
19734  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
19735  break;
19736  }
19737 
19738 
19739  exit(rc);
19740  }
19741  #endif
19742 
19743 
19744 
19745  }
19746 
19747  /* If mb is not read then leave sync complete until last possible moment */
19748  if(FLAME_job_application_stage2_message_board_read == 1)
19749  {
19750  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_application_stage2)\n");
19751  rc = MB_SyncComplete(b_job_application_stage2);
19752  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_application_stage2)\n");
19753  #ifdef ERRCHECK
19754  if (rc != MB_SUCCESS)
19755  {
19756  fprintf(stderr, "ERROR: Could not complete sync of 'job_application_stage2' board\n");
19757  switch(rc) {
19758  case MB_ERR_INVALID:
19759  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
19760  break;
19761  case MB_ERR_MEMALLOC:
19762  fprintf(stderr, "\t reason: out of memory\n");
19763  break;
19764  case MB_ERR_INTERNAL:
19765  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19766  break;
19767  default:
19768  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
19769  break;
19770  }
19771 
19772 
19773  exit(rc);
19774  }
19775  #endif
19776 
19777 
19778 
19779  }
19780 
19781  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start jpoffice_labour_stage2\n");
19784  {
19788  /* For backwards compatibility set current_xmachine */
19799 
19800 
19801 
19802 
19803 
19804 
19805 
19807 
19808  #ifdef ERRCHECK
19809  if (rc != MB_SUCCESS)
19810  {
19811  fprintf(stderr, "ERROR: Could not create Iterator for 'vacancy_stage2'\n");
19812  switch(rc) {
19813  case MB_ERR_INVALID:
19814  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
19815  break;
19816  case MB_ERR_LOCKED:
19817  fprintf(stderr, "\t reason: 'vacancy_stage2' board is locked\n");
19818  break;
19819  case MB_ERR_MEMALLOC:
19820  fprintf(stderr, "\t reason: out of memory\n");
19821  break;
19822  case MB_ERR_INTERNAL:
19823  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19824  break;
19825  default:
19826 
19827 
19828  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
19829 
19830  break;
19831  }
19832 
19833 
19834  exit(rc);
19835  }
19836  #endif
19837 
19838 
19839 
19840 
19841 
19843 
19844  #ifdef ERRCHECK
19845  if (rc != MB_SUCCESS)
19846  {
19847  fprintf(stderr, "ERROR: Could not create Iterator for 'job_application_stage2'\n");
19848  switch(rc) {
19849  case MB_ERR_INVALID:
19850  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
19851  break;
19852  case MB_ERR_LOCKED:
19853  fprintf(stderr, "\t reason: 'job_application_stage2' board is locked\n");
19854  break;
19855  case MB_ERR_MEMALLOC:
19856  fprintf(stderr, "\t reason: out of memory\n");
19857  break;
19858  case MB_ERR_INTERNAL:
19859  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19860  break;
19861  default:
19862 
19863 
19864  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
19865 
19866  break;
19867  }
19868 
19869 
19870  exit(rc);
19871  }
19872  #endif
19873 
19874 
19875 
19876  i = jpoffice_labour_stage2();
19877 
19878 
19879  rc = MB_Iterator_Delete(&i_vacancy_stage2);
19880  #ifdef ERRCHECK
19881  if (rc != MB_SUCCESS)
19882  {
19883  fprintf(stderr, "ERROR: Could not delete 'vacancy_stage2' iterator\n");
19884  switch(rc) {
19885  case MB_ERR_INVALID:
19886  fprintf(stderr, "\t reason: 'vacancy_stage2' iterator is invalid\n");
19887  break;
19888  case MB_ERR_INTERNAL:
19889  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19890  break;
19891  default:
19892  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
19893  break;
19894  }
19895 
19896 
19897  exit(rc);
19898  }
19899  #endif
19900 
19901  rc = MB_Iterator_Delete(&i_job_application_stage2);
19902  #ifdef ERRCHECK
19903  if (rc != MB_SUCCESS)
19904  {
19905  fprintf(stderr, "ERROR: Could not delete 'job_application_stage2' iterator\n");
19906  switch(rc) {
19907  case MB_ERR_INVALID:
19908  fprintf(stderr, "\t reason: 'job_application_stage2' iterator is invalid\n");
19909  break;
19910  case MB_ERR_INTERNAL:
19911  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19912  break;
19913  default:
19914  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
19915  break;
19916  }
19917 
19918 
19919  exit(rc);
19920  }
19921  #endif
19922 
19923 
19924  if(i == 1)
19925  {
19927  }
19928  else
19929  {
19931  }
19932 
19933 
19935 
19937  }
19938  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish jpoffice_labour_stage2\n");
19939 
19940  if(FLAME_job_match_stage2_message_board_write == 1)
19941  {
19942 
19943  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_job_match_stage2)\n");
19944  rc = MB_SyncStart(b_job_match_stage2);
19945  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_job_match_stage2)\n");
19946  #ifdef ERRCHECK
19947  if (rc != MB_SUCCESS)
19948  {
19949  fprintf(stderr, "ERROR: Could not start sync of 'job_match_stage2' board\n");
19950  switch(rc) {
19951  case MB_ERR_INVALID:
19952  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
19953  break;
19954  case MB_ERR_LOCKED:
19955  fprintf(stderr, "\t reason: 'job_match_stage2' board is locked\n");
19956  break;
19957  case MB_ERR_MEMALLOC:
19958  fprintf(stderr, "\t reason: out of memory\n");
19959  break;
19960  case MB_ERR_INTERNAL:
19961  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
19962  break;
19963  default:
19964  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
19965  break;
19966  }
19967 
19968 
19969  exit(rc);
19970  }
19971  #endif
19972  }
19973 
19974 
19975 
19976 /* End of layer number 39 */
19977 
19978 /* Clear message boards that have finished being used
19979  * and sync complete if doing late sync complete */
19980 
19981 if(FLAME_job_application_stage2_message_board_read == 0)
19982 {
19983  /*printf("%d> job_application_stage2 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
19984 
19985  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_application_stage2)\n");
19986  rc = MB_SyncComplete(b_job_application_stage2);
19987  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_application_stage2)\n");
19988  #ifdef ERRCHECK
19989  if (rc != MB_SUCCESS)
19990  {
19991  fprintf(stderr, "ERROR: Could not complete sync of 'job_application_stage2' board\n");
19992  switch(rc) {
19993  case MB_ERR_INVALID:
19994  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
19995  break;
19996  case MB_ERR_MEMALLOC:
19997  fprintf(stderr, "\t reason: out of memory\n");
19998  break;
19999  case MB_ERR_INTERNAL:
20000  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20001  break;
20002  default:
20003  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
20004  break;
20005  }
20006 
20007 
20008  exit(rc);
20009  }
20010  #endif
20011 }
20012 
20013  /* Delete any search trees */
20014 
20015  rc = MB_Clear(b_job_application_stage2);
20016  #ifdef ERRCHECK
20017  if (rc != MB_SUCCESS)
20018  {
20019  fprintf(stderr, "ERROR: Could not clear 'job_application_stage2' board\n");
20020  switch(rc) {
20021  case MB_ERR_INVALID:
20022  fprintf(stderr, "\t reason: 'job_application_stage2' board is invalid\n");
20023  break;
20024  case MB_ERR_LOCKED:
20025  fprintf(stderr, "\t reason: 'job_application_stage2' board is locked\n");
20026  break;
20027  case MB_ERR_INTERNAL:
20028  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20029  break;
20030  default:
20031  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
20032  break;
20033 
20034  }
20035 
20036 
20037  exit(rc);
20038  }
20039  #endif
20040 
20041 if(FLAME_vacancy_stage2_message_board_read == 0)
20042 {
20043  /*printf("%d> vacancy_stage2 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
20044 
20045  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_vacancy_stage2)\n");
20046  rc = MB_SyncComplete(b_vacancy_stage2);
20047  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_vacancy_stage2)\n");
20048  #ifdef ERRCHECK
20049  if (rc != MB_SUCCESS)
20050  {
20051  fprintf(stderr, "ERROR: Could not complete sync of 'vacancy_stage2' board\n");
20052  switch(rc) {
20053  case MB_ERR_INVALID:
20054  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
20055  break;
20056  case MB_ERR_MEMALLOC:
20057  fprintf(stderr, "\t reason: out of memory\n");
20058  break;
20059  case MB_ERR_INTERNAL:
20060  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20061  break;
20062  default:
20063  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
20064  break;
20065  }
20066 
20067 
20068  exit(rc);
20069  }
20070  #endif
20071 }
20072 
20073  /* Delete any search trees */
20074 
20075  rc = MB_Clear(b_vacancy_stage2);
20076  #ifdef ERRCHECK
20077  if (rc != MB_SUCCESS)
20078  {
20079  fprintf(stderr, "ERROR: Could not clear 'vacancy_stage2' board\n");
20080  switch(rc) {
20081  case MB_ERR_INVALID:
20082  fprintf(stderr, "\t reason: 'vacancy_stage2' board is invalid\n");
20083  break;
20084  case MB_ERR_LOCKED:
20085  fprintf(stderr, "\t reason: 'vacancy_stage2' board is locked\n");
20086  break;
20087  case MB_ERR_INTERNAL:
20088  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20089  break;
20090  default:
20091  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
20092  break;
20093 
20094  }
20095 
20096 
20097  exit(rc);
20098  }
20099  #endif
20100 
20101 
20102  /* If mb is not read then leave sync complete until last possible moment */
20103  if(FLAME_job_match_stage2_message_board_read == 1)
20104  {
20105  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_match_stage2)\n");
20106  rc = MB_SyncComplete(b_job_match_stage2);
20107  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_match_stage2)\n");
20108  #ifdef ERRCHECK
20109  if (rc != MB_SUCCESS)
20110  {
20111  fprintf(stderr, "ERROR: Could not complete sync of 'job_match_stage2' board\n");
20112  switch(rc) {
20113  case MB_ERR_INVALID:
20114  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
20115  break;
20116  case MB_ERR_MEMALLOC:
20117  fprintf(stderr, "\t reason: out of memory\n");
20118  break;
20119  case MB_ERR_INTERNAL:
20120  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20121  break;
20122  default:
20123  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
20124  break;
20125  }
20126 
20127 
20128  exit(rc);
20129  }
20130  #endif
20131 
20132 
20133 
20134  }
20135 
20136  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_job_offer_stage2\n");
20139  {
20143  /* For backwards compatibility set current_xmachine */
20154 
20155 
20156 
20157 
20158 
20159 
20160 
20161 
20163 
20164 
20165 
20166  #ifdef ERRCHECK
20167  if (rc != MB_SUCCESS)
20168  {
20169  fprintf(stderr, "ERROR: Could not create Iterator for 'job_match_stage2'\n");
20170  switch(rc) {
20171  case MB_ERR_INVALID:
20172  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
20173  break;
20174  case MB_ERR_LOCKED:
20175  fprintf(stderr, "\t reason: 'job_match_stage2' board is locked\n");
20176  break;
20177  case MB_ERR_MEMALLOC:
20178  fprintf(stderr, "\t reason: out of memory\n");
20179  break;
20180  case MB_ERR_INTERNAL:
20181  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20182  break;
20183  default:
20184 
20185  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
20186 
20187 
20188  break;
20189  }
20190 
20191 
20192  exit(rc);
20193  }
20194  #endif
20195 
20196 
20197 
20199 
20200 
20201  rc = MB_Iterator_Delete(&i_job_match_stage2);
20202  #ifdef ERRCHECK
20203  if (rc != MB_SUCCESS)
20204  {
20205  fprintf(stderr, "ERROR: Could not delete 'job_match_stage2' iterator\n");
20206  switch(rc) {
20207  case MB_ERR_INVALID:
20208  fprintf(stderr, "\t reason: 'job_match_stage2' iterator is invalid\n");
20209  break;
20210  case MB_ERR_INTERNAL:
20211  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20212  break;
20213  default:
20214  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
20215  break;
20216  }
20217 
20218 
20219  exit(rc);
20220  }
20221  #endif
20222 
20223 
20224  if(i == 1)
20225  {
20227  }
20228  else
20229  {
20231  }
20232 
20233 
20234  current_xmachine_firm = NULL;
20235 
20237  }
20238  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_job_offer_stage2\n");
20239 
20240 
20241  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_employment\n");
20244  {
20248  /* For backwards compatibility set current_xmachine */
20259 
20260 
20261 
20262 
20263 
20264 
20265 
20266 
20268 
20269 
20270 
20271  #ifdef ERRCHECK
20272  if (rc != MB_SUCCESS)
20273  {
20274  fprintf(stderr, "ERROR: Could not create Iterator for 'job_match_stage2'\n");
20275  switch(rc) {
20276  case MB_ERR_INVALID:
20277  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
20278  break;
20279  case MB_ERR_LOCKED:
20280  fprintf(stderr, "\t reason: 'job_match_stage2' board is locked\n");
20281  break;
20282  case MB_ERR_MEMALLOC:
20283  fprintf(stderr, "\t reason: out of memory\n");
20284  break;
20285  case MB_ERR_INTERNAL:
20286  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20287  break;
20288  default:
20289 
20290  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
20291 
20292 
20293  break;
20294  }
20295 
20296 
20297  exit(rc);
20298  }
20299  #endif
20300 
20301 
20302 
20304 
20305 
20306  rc = MB_Iterator_Delete(&i_job_match_stage2);
20307  #ifdef ERRCHECK
20308  if (rc != MB_SUCCESS)
20309  {
20310  fprintf(stderr, "ERROR: Could not delete 'job_match_stage2' iterator\n");
20311  switch(rc) {
20312  case MB_ERR_INVALID:
20313  fprintf(stderr, "\t reason: 'job_match_stage2' iterator is invalid\n");
20314  break;
20315  case MB_ERR_INTERNAL:
20316  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20317  break;
20318  default:
20319  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
20320  break;
20321  }
20322 
20323 
20324  exit(rc);
20325  }
20326  #endif
20327 
20328 
20329  if(i == 1)
20330  {
20332  }
20333  else
20334  {
20336  }
20337 
20338 
20340 
20342  }
20343  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_employment\n");
20344 
20345 
20346 /* End of layer number 40 */
20347 
20348 /* Clear message boards that have finished being used
20349  * and sync complete if doing late sync complete */
20350 
20351 if(FLAME_job_match_stage2_message_board_read == 0)
20352 {
20353  /*printf("%d> job_match_stage2 message board sync complete late as no agents reading any messages of this type\n", node_number);*/
20354 
20355  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_job_match_stage2)\n");
20356  rc = MB_SyncComplete(b_job_match_stage2);
20357  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_job_match_stage2)\n");
20358  #ifdef ERRCHECK
20359  if (rc != MB_SUCCESS)
20360  {
20361  fprintf(stderr, "ERROR: Could not complete sync of 'job_match_stage2' board\n");
20362  switch(rc) {
20363  case MB_ERR_INVALID:
20364  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
20365  break;
20366  case MB_ERR_MEMALLOC:
20367  fprintf(stderr, "\t reason: out of memory\n");
20368  break;
20369  case MB_ERR_INTERNAL:
20370  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20371  break;
20372  default:
20373  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
20374  break;
20375  }
20376 
20377 
20378  exit(rc);
20379  }
20380  #endif
20381 }
20382 
20383  /* Delete any search trees */
20384 
20385  rc = MB_Clear(b_job_match_stage2);
20386  #ifdef ERRCHECK
20387  if (rc != MB_SUCCESS)
20388  {
20389  fprintf(stderr, "ERROR: Could not clear 'job_match_stage2' board\n");
20390  switch(rc) {
20391  case MB_ERR_INVALID:
20392  fprintf(stderr, "\t reason: 'job_match_stage2' board is invalid\n");
20393  break;
20394  case MB_ERR_LOCKED:
20395  fprintf(stderr, "\t reason: 'job_match_stage2' board is locked\n");
20396  break;
20397  case MB_ERR_INTERNAL:
20398  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20399  break;
20400  default:
20401  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
20402  break;
20403 
20404  }
20405 
20406 
20407  exit(rc);
20408  }
20409  #endif
20410 
20411  /* DEBUG: States with branching functions */
20414  {
20415  FLAME_debug_count = 0;
20416  /* Function: household_consumption_compute_budget */
20418  { FLAME_debug_count++; }
20419  /* Function: idle */
20421  { FLAME_debug_count++; }
20422  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
20423  if(FLAME_debug_count != 1)
20424  {
20425  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHConsumptionStart'\n");
20426  if(FLAME_debug_count > 1)
20427  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
20428  if(FLAME_debug_count == 0)
20429  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
20430  }
20431 
20433  }
20434 
20435  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_consumption_compute_budget\n");
20438  {
20442  /* For backwards compatibility set current_xmachine */
20453 
20455  {
20456 
20457 
20458 
20460 
20461 
20462 
20463  if(i == 1)
20464  {
20466  }
20467  else
20468  {
20470  }
20471  }
20472 
20474 
20476  }
20477  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_consumption_compute_budget\n");
20478 
20479 
20480  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
20483  {
20487  /* For backwards compatibility set current_xmachine */
20498 
20500  {
20501 
20502 
20503 
20504  i = idle();
20505 
20506 
20507 
20508  if(i == 1)
20509  {
20511  }
20512  else
20513  {
20515  }
20516  }
20517 
20519 
20521  }
20522  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
20523 
20524 
20525  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
20528  {
20532  /* For backwards compatibility set current_xmachine */
20543 
20545  {
20546 
20547 
20548 
20549  i = idle();
20550 
20551 
20552 
20553  if(i == 1)
20554  {
20556  }
20557  else
20558  {
20560  }
20561  }
20562 
20563  current_xmachine_firm = NULL;
20564 
20566  }
20567  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
20568 
20569 
20570  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
20573  {
20577  /* For backwards compatibility set current_xmachine */
20588 
20590  {
20591 
20592 
20593 
20594  i = idle();
20595 
20596 
20597 
20598  if(i == 1)
20599  {
20601  }
20602  else
20603  {
20605  }
20606  }
20607 
20608  current_xmachine_firm = NULL;
20609 
20611  }
20612  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
20613 
20614 
20615 /* End of layer number 41 */
20616 
20617 /* Clear message boards that have finished being used
20618  * and sync complete if doing late sync complete */
20619 
20620  /* DEBUG: States with branching functions */
20623  {
20624  FLAME_debug_count = 0;
20625  /* Function: firm_consumption_supply */
20627  { FLAME_debug_count++; }
20628  /* Function: idle */
20630  { FLAME_debug_count++; }
20631  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
20632  if(FLAME_debug_count != 1)
20633  {
20634  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmConsumptionMarket'\n");
20635  if(FLAME_debug_count > 1)
20636  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
20637  if(FLAME_debug_count == 0)
20638  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
20639  }
20640 
20642  }
20643  /* DEBUG: States with branching functions */
20646  {
20647  FLAME_debug_count = 0;
20648  /* Function: household_consumption_demand */
20650  { FLAME_debug_count++; }
20651  /* Function: idle */
20653  { FLAME_debug_count++; }
20654  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
20655  if(FLAME_debug_count != 1)
20656  {
20657  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHConsumptionWeekly'\n");
20658  if(FLAME_debug_count > 1)
20659  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
20660  if(FLAME_debug_count == 0)
20661  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
20662  }
20663 
20665  }
20666 
20667  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_consumption_supply\n");
20670  {
20674  /* For backwards compatibility set current_xmachine */
20685 
20687  {
20688 
20689 
20690 
20692 
20693 
20694 
20695  if(i == 1)
20696  {
20698  }
20699  else
20700  {
20702  }
20703  }
20704 
20705  current_xmachine_firm = NULL;
20706 
20708  }
20709  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_consumption_supply\n");
20710 
20711  if(FLAME_sell_message_board_write == 1)
20712  {
20713 
20714  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sell)\n");
20715  rc = MB_SyncStart(b_sell);
20716  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sell)\n");
20717  #ifdef ERRCHECK
20718  if (rc != MB_SUCCESS)
20719  {
20720  fprintf(stderr, "ERROR: Could not start sync of 'sell' board\n");
20721  switch(rc) {
20722  case MB_ERR_INVALID:
20723  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
20724  break;
20725  case MB_ERR_LOCKED:
20726  fprintf(stderr, "\t reason: 'sell' board is locked\n");
20727  break;
20728  case MB_ERR_MEMALLOC:
20729  fprintf(stderr, "\t reason: out of memory\n");
20730  break;
20731  case MB_ERR_INTERNAL:
20732  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20733  break;
20734  default:
20735  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
20736  break;
20737  }
20738 
20739 
20740  exit(rc);
20741  }
20742  #endif
20743  }
20744 
20745 
20746 
20747  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_consumption_demand\n");
20750  {
20754  /* For backwards compatibility set current_xmachine */
20765 
20767  {
20768 
20769 
20770 
20772 
20773 
20774 
20775  if(i == 1)
20776  {
20778  }
20779  else
20780  {
20782  }
20783  }
20784 
20786 
20788  }
20789  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_consumption_demand\n");
20790 
20791  if(FLAME_buy_message_board_write == 1)
20792  {
20793 
20794  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_buy)\n");
20795  rc = MB_SyncStart(b_buy);
20796  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_buy)\n");
20797  #ifdef ERRCHECK
20798  if (rc != MB_SUCCESS)
20799  {
20800  fprintf(stderr, "ERROR: Could not start sync of 'buy' board\n");
20801  switch(rc) {
20802  case MB_ERR_INVALID:
20803  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
20804  break;
20805  case MB_ERR_LOCKED:
20806  fprintf(stderr, "\t reason: 'buy' board is locked\n");
20807  break;
20808  case MB_ERR_MEMALLOC:
20809  fprintf(stderr, "\t reason: out of memory\n");
20810  break;
20811  case MB_ERR_INTERNAL:
20812  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20813  break;
20814  default:
20815  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
20816  break;
20817  }
20818 
20819 
20820  exit(rc);
20821  }
20822  #endif
20823  }
20824 
20825 
20826 
20827  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
20830  {
20834  /* For backwards compatibility set current_xmachine */
20845 
20847  {
20848 
20849 
20850 
20851  i = idle();
20852 
20853 
20854 
20855  if(i == 1)
20856  {
20858  }
20859  else
20860  {
20862  }
20863  }
20864 
20866 
20868  }
20869  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
20870 
20871 
20872  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
20875  {
20879  /* For backwards compatibility set current_xmachine */
20890 
20892  {
20893 
20894 
20895 
20896  i = idle();
20897 
20898 
20899 
20900  if(i == 1)
20901  {
20903  }
20904  else
20905  {
20907  }
20908  }
20909 
20910  current_xmachine_firm = NULL;
20911 
20913  }
20914  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
20915 
20916 
20917 /* End of layer number 42 */
20918 
20919 /* Clear message boards that have finished being used
20920  * and sync complete if doing late sync complete */
20921 
20922 
20923  /* If mb is not read then leave sync complete until last possible moment */
20924  if(FLAME_sell_message_board_read == 1)
20925  {
20926  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sell)\n");
20927  rc = MB_SyncComplete(b_sell);
20928  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sell)\n");
20929  #ifdef ERRCHECK
20930  if (rc != MB_SUCCESS)
20931  {
20932  fprintf(stderr, "ERROR: Could not complete sync of 'sell' board\n");
20933  switch(rc) {
20934  case MB_ERR_INVALID:
20935  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
20936  break;
20937  case MB_ERR_MEMALLOC:
20938  fprintf(stderr, "\t reason: out of memory\n");
20939  break;
20940  case MB_ERR_INTERNAL:
20941  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20942  break;
20943  default:
20944  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
20945  break;
20946  }
20947 
20948 
20949  exit(rc);
20950  }
20951  #endif
20952 
20953 
20954 
20955  }
20956 
20957  /* If mb is not read then leave sync complete until last possible moment */
20958  if(FLAME_buy_message_board_read == 1)
20959  {
20960  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_buy)\n");
20961  rc = MB_SyncComplete(b_buy);
20962  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_buy)\n");
20963  #ifdef ERRCHECK
20964  if (rc != MB_SUCCESS)
20965  {
20966  fprintf(stderr, "ERROR: Could not complete sync of 'buy' board\n");
20967  switch(rc) {
20968  case MB_ERR_INVALID:
20969  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
20970  break;
20971  case MB_ERR_MEMALLOC:
20972  fprintf(stderr, "\t reason: out of memory\n");
20973  break;
20974  case MB_ERR_INTERNAL:
20975  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
20976  break;
20977  default:
20978  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
20979  break;
20980  }
20981 
20982 
20983  exit(rc);
20984  }
20985  #endif
20986 
20987 
20988 
20989  }
20990 
20991  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start mall_consumption_shopping\n");
20994  {
20998  /* For backwards compatibility set current_xmachine */
21009 
21011  {
21012 
21013 
21014 
21015 
21016 
21018 
21019  #ifdef ERRCHECK
21020  if (rc != MB_SUCCESS)
21021  {
21022  fprintf(stderr, "ERROR: Could not create Iterator for 'sell'\n");
21023  switch(rc) {
21024  case MB_ERR_INVALID:
21025  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
21026  break;
21027  case MB_ERR_LOCKED:
21028  fprintf(stderr, "\t reason: 'sell' board is locked\n");
21029  break;
21030  case MB_ERR_MEMALLOC:
21031  fprintf(stderr, "\t reason: out of memory\n");
21032  break;
21033  case MB_ERR_INTERNAL:
21034  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21035  break;
21036  default:
21037 
21038 
21039  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
21040 
21041  break;
21042  }
21043 
21044 
21045  exit(rc);
21046  }
21047  #endif
21048 
21049 
21050 
21051 
21052  rc = MB_Iterator_Create(b_buy, &i_buy);
21053 
21054 
21055  #ifdef ERRCHECK
21056  if (rc != MB_SUCCESS)
21057  {
21058  fprintf(stderr, "ERROR: Could not create Iterator for 'buy'\n");
21059  switch(rc) {
21060  case MB_ERR_INVALID:
21061  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
21062  break;
21063  case MB_ERR_LOCKED:
21064  fprintf(stderr, "\t reason: 'buy' board is locked\n");
21065  break;
21066  case MB_ERR_MEMALLOC:
21067  fprintf(stderr, "\t reason: out of memory\n");
21068  break;
21069  case MB_ERR_INTERNAL:
21070  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21071  break;
21072  default:
21073 
21074 
21075  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
21076 
21077  break;
21078  }
21079 
21080 
21081  exit(rc);
21082  }
21083  #endif
21084  MB_Iterator_Randomise(i_buy);
21085 
21086 
21088 
21089 
21090  rc = MB_Iterator_Delete(&i_sell);
21091  #ifdef ERRCHECK
21092  if (rc != MB_SUCCESS)
21093  {
21094  fprintf(stderr, "ERROR: Could not delete 'sell' iterator\n");
21095  switch(rc) {
21096  case MB_ERR_INVALID:
21097  fprintf(stderr, "\t reason: 'sell' iterator is invalid\n");
21098  break;
21099  case MB_ERR_INTERNAL:
21100  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21101  break;
21102  default:
21103  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
21104  break;
21105  }
21106 
21107 
21108  exit(rc);
21109  }
21110  #endif
21111 
21112  rc = MB_Iterator_Delete(&i_buy);
21113  #ifdef ERRCHECK
21114  if (rc != MB_SUCCESS)
21115  {
21116  fprintf(stderr, "ERROR: Could not delete 'buy' iterator\n");
21117  switch(rc) {
21118  case MB_ERR_INVALID:
21119  fprintf(stderr, "\t reason: 'buy' iterator is invalid\n");
21120  break;
21121  case MB_ERR_INTERNAL:
21122  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21123  break;
21124  default:
21125  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
21126  break;
21127  }
21128 
21129 
21130  exit(rc);
21131  }
21132  #endif
21133 
21134 
21135  if(i == 1)
21136  {
21138  }
21139  else
21140  {
21142  }
21143  }
21144 
21145  current_xmachine_mall = NULL;
21146 
21148  }
21149  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish mall_consumption_shopping\n");
21150 
21151  if(FLAME_sold_message_board_write == 1)
21152  {
21153 
21154  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sold)\n");
21155  rc = MB_SyncStart(b_sold);
21156  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sold)\n");
21157  #ifdef ERRCHECK
21158  if (rc != MB_SUCCESS)
21159  {
21160  fprintf(stderr, "ERROR: Could not start sync of 'sold' board\n");
21161  switch(rc) {
21162  case MB_ERR_INVALID:
21163  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
21164  break;
21165  case MB_ERR_LOCKED:
21166  fprintf(stderr, "\t reason: 'sold' board is locked\n");
21167  break;
21168  case MB_ERR_MEMALLOC:
21169  fprintf(stderr, "\t reason: out of memory\n");
21170  break;
21171  case MB_ERR_INTERNAL:
21172  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21173  break;
21174  default:
21175  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
21176  break;
21177  }
21178 
21179 
21180  exit(rc);
21181  }
21182  #endif
21183  }
21184 
21185 
21186  if(FLAME_bought_message_board_write == 1)
21187  {
21188 
21189  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bought)\n");
21190  rc = MB_SyncStart(b_bought);
21191  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bought)\n");
21192  #ifdef ERRCHECK
21193  if (rc != MB_SUCCESS)
21194  {
21195  fprintf(stderr, "ERROR: Could not start sync of 'bought' board\n");
21196  switch(rc) {
21197  case MB_ERR_INVALID:
21198  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
21199  break;
21200  case MB_ERR_LOCKED:
21201  fprintf(stderr, "\t reason: 'bought' board is locked\n");
21202  break;
21203  case MB_ERR_MEMALLOC:
21204  fprintf(stderr, "\t reason: out of memory\n");
21205  break;
21206  case MB_ERR_INTERNAL:
21207  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21208  break;
21209  default:
21210  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
21211  break;
21212  }
21213 
21214 
21215  exit(rc);
21216  }
21217  #endif
21218  }
21219 
21220 
21221 
21222 /* End of layer number 43 */
21223 
21224 /* Clear message boards that have finished being used
21225  * and sync complete if doing late sync complete */
21226 
21227 if(FLAME_buy_message_board_read == 0)
21228 {
21229  /*printf("%d> buy message board sync complete late as no agents reading any messages of this type\n", node_number);*/
21230 
21231  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_buy)\n");
21232  rc = MB_SyncComplete(b_buy);
21233  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_buy)\n");
21234  #ifdef ERRCHECK
21235  if (rc != MB_SUCCESS)
21236  {
21237  fprintf(stderr, "ERROR: Could not complete sync of 'buy' board\n");
21238  switch(rc) {
21239  case MB_ERR_INVALID:
21240  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
21241  break;
21242  case MB_ERR_MEMALLOC:
21243  fprintf(stderr, "\t reason: out of memory\n");
21244  break;
21245  case MB_ERR_INTERNAL:
21246  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21247  break;
21248  default:
21249  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21250  break;
21251  }
21252 
21253 
21254  exit(rc);
21255  }
21256  #endif
21257 }
21258 
21259  /* Delete any search trees */
21260 
21261  rc = MB_Clear(b_buy);
21262  #ifdef ERRCHECK
21263  if (rc != MB_SUCCESS)
21264  {
21265  fprintf(stderr, "ERROR: Could not clear 'buy' board\n");
21266  switch(rc) {
21267  case MB_ERR_INVALID:
21268  fprintf(stderr, "\t reason: 'buy' board is invalid\n");
21269  break;
21270  case MB_ERR_LOCKED:
21271  fprintf(stderr, "\t reason: 'buy' board is locked\n");
21272  break;
21273  case MB_ERR_INTERNAL:
21274  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21275  break;
21276  default:
21277  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
21278  break;
21279 
21280  }
21281 
21282 
21283  exit(rc);
21284  }
21285  #endif
21286 
21287 if(FLAME_sell_message_board_read == 0)
21288 {
21289  /*printf("%d> sell message board sync complete late as no agents reading any messages of this type\n", node_number);*/
21290 
21291  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sell)\n");
21292  rc = MB_SyncComplete(b_sell);
21293  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sell)\n");
21294  #ifdef ERRCHECK
21295  if (rc != MB_SUCCESS)
21296  {
21297  fprintf(stderr, "ERROR: Could not complete sync of 'sell' board\n");
21298  switch(rc) {
21299  case MB_ERR_INVALID:
21300  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
21301  break;
21302  case MB_ERR_MEMALLOC:
21303  fprintf(stderr, "\t reason: out of memory\n");
21304  break;
21305  case MB_ERR_INTERNAL:
21306  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21307  break;
21308  default:
21309  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21310  break;
21311  }
21312 
21313 
21314  exit(rc);
21315  }
21316  #endif
21317 }
21318 
21319  /* Delete any search trees */
21320 
21321  rc = MB_Clear(b_sell);
21322  #ifdef ERRCHECK
21323  if (rc != MB_SUCCESS)
21324  {
21325  fprintf(stderr, "ERROR: Could not clear 'sell' board\n");
21326  switch(rc) {
21327  case MB_ERR_INVALID:
21328  fprintf(stderr, "\t reason: 'sell' board is invalid\n");
21329  break;
21330  case MB_ERR_LOCKED:
21331  fprintf(stderr, "\t reason: 'sell' board is locked\n");
21332  break;
21333  case MB_ERR_INTERNAL:
21334  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21335  break;
21336  default:
21337  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
21338  break;
21339 
21340  }
21341 
21342 
21343  exit(rc);
21344  }
21345  #endif
21346 
21347 
21348  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start mall_consumption_summary\n");
21351  {
21355  /* For backwards compatibility set current_xmachine */
21366 
21367 
21368 
21369 
21370 
21372 
21373 
21374 
21375  if(i == 1)
21376  {
21378  }
21379  else
21380  {
21382  }
21383 
21384 
21385  current_xmachine_mall = NULL;
21386 
21388  }
21389  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish mall_consumption_summary\n");
21390 
21391  if(FLAME_goods_transactions_summary_message_board_write == 1)
21392  {
21393 
21394  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_goods_transactions_summary)\n");
21395  rc = MB_SyncStart(b_goods_transactions_summary);
21396  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_goods_transactions_summary)\n");
21397  #ifdef ERRCHECK
21398  if (rc != MB_SUCCESS)
21399  {
21400  fprintf(stderr, "ERROR: Could not start sync of 'goods_transactions_summary' board\n");
21401  switch(rc) {
21402  case MB_ERR_INVALID:
21403  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
21404  break;
21405  case MB_ERR_LOCKED:
21406  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is locked\n");
21407  break;
21408  case MB_ERR_MEMALLOC:
21409  fprintf(stderr, "\t reason: out of memory\n");
21410  break;
21411  case MB_ERR_INTERNAL:
21412  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21413  break;
21414  default:
21415  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
21416  break;
21417  }
21418 
21419 
21420  exit(rc);
21421  }
21422  #endif
21423  }
21424 
21425 
21426 
21427  /* If mb is not read then leave sync complete until last possible moment */
21428  if(FLAME_sold_message_board_read == 1)
21429  {
21430  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sold)\n");
21431  rc = MB_SyncComplete(b_sold);
21432  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sold)\n");
21433  #ifdef ERRCHECK
21434  if (rc != MB_SUCCESS)
21435  {
21436  fprintf(stderr, "ERROR: Could not complete sync of 'sold' board\n");
21437  switch(rc) {
21438  case MB_ERR_INVALID:
21439  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
21440  break;
21441  case MB_ERR_MEMALLOC:
21442  fprintf(stderr, "\t reason: out of memory\n");
21443  break;
21444  case MB_ERR_INTERNAL:
21445  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21446  break;
21447  default:
21448  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21449  break;
21450  }
21451 
21452 
21453  exit(rc);
21454  }
21455  #endif
21456 
21457 
21458 
21459  }
21460 
21461  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_consumption_receive_sales\n");
21464  {
21468  /* For backwards compatibility set current_xmachine */
21479 
21480 
21481 
21482 
21483 
21484 
21485 
21486 
21488 
21489 
21490 
21491  #ifdef ERRCHECK
21492  if (rc != MB_SUCCESS)
21493  {
21494  fprintf(stderr, "ERROR: Could not create Iterator for 'sold'\n");
21495  switch(rc) {
21496  case MB_ERR_INVALID:
21497  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
21498  break;
21499  case MB_ERR_LOCKED:
21500  fprintf(stderr, "\t reason: 'sold' board is locked\n");
21501  break;
21502  case MB_ERR_MEMALLOC:
21503  fprintf(stderr, "\t reason: out of memory\n");
21504  break;
21505  case MB_ERR_INTERNAL:
21506  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21507  break;
21508  default:
21509 
21510  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
21511 
21512 
21513  break;
21514  }
21515 
21516 
21517  exit(rc);
21518  }
21519  #endif
21520 
21521 
21522 
21524 
21525 
21526  rc = MB_Iterator_Delete(&i_sold);
21527  #ifdef ERRCHECK
21528  if (rc != MB_SUCCESS)
21529  {
21530  fprintf(stderr, "ERROR: Could not delete 'sold' iterator\n");
21531  switch(rc) {
21532  case MB_ERR_INVALID:
21533  fprintf(stderr, "\t reason: 'sold' iterator is invalid\n");
21534  break;
21535  case MB_ERR_INTERNAL:
21536  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21537  break;
21538  default:
21539  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
21540  break;
21541  }
21542 
21543 
21544  exit(rc);
21545  }
21546  #endif
21547 
21548 
21549  if(i == 1)
21550  {
21552  }
21553  else
21554  {
21556  }
21557 
21558 
21559  current_xmachine_firm = NULL;
21560 
21562  }
21563  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_consumption_receive_sales\n");
21564 
21565 
21566  /* If mb is not read then leave sync complete until last possible moment */
21567  if(FLAME_bought_message_board_read == 1)
21568  {
21569  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bought)\n");
21570  rc = MB_SyncComplete(b_bought);
21571  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bought)\n");
21572  #ifdef ERRCHECK
21573  if (rc != MB_SUCCESS)
21574  {
21575  fprintf(stderr, "ERROR: Could not complete sync of 'bought' board\n");
21576  switch(rc) {
21577  case MB_ERR_INVALID:
21578  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
21579  break;
21580  case MB_ERR_MEMALLOC:
21581  fprintf(stderr, "\t reason: out of memory\n");
21582  break;
21583  case MB_ERR_INTERNAL:
21584  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21585  break;
21586  default:
21587  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21588  break;
21589  }
21590 
21591 
21592  exit(rc);
21593  }
21594  #endif
21595 
21596 
21597 
21598  }
21599 
21600  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_consumption_recieve_goods\n");
21603  {
21607  /* For backwards compatibility set current_xmachine */
21618 
21619 
21620 
21621 
21622 
21623 
21624 
21625 
21627 
21628 
21629 
21630  #ifdef ERRCHECK
21631  if (rc != MB_SUCCESS)
21632  {
21633  fprintf(stderr, "ERROR: Could not create Iterator for 'bought'\n");
21634  switch(rc) {
21635  case MB_ERR_INVALID:
21636  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
21637  break;
21638  case MB_ERR_LOCKED:
21639  fprintf(stderr, "\t reason: 'bought' board is locked\n");
21640  break;
21641  case MB_ERR_MEMALLOC:
21642  fprintf(stderr, "\t reason: out of memory\n");
21643  break;
21644  case MB_ERR_INTERNAL:
21645  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21646  break;
21647  default:
21648 
21649  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
21650 
21651 
21652  break;
21653  }
21654 
21655 
21656  exit(rc);
21657  }
21658  #endif
21659 
21660 
21661 
21663 
21664 
21665  rc = MB_Iterator_Delete(&i_bought);
21666  #ifdef ERRCHECK
21667  if (rc != MB_SUCCESS)
21668  {
21669  fprintf(stderr, "ERROR: Could not delete 'bought' iterator\n");
21670  switch(rc) {
21671  case MB_ERR_INVALID:
21672  fprintf(stderr, "\t reason: 'bought' iterator is invalid\n");
21673  break;
21674  case MB_ERR_INTERNAL:
21675  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21676  break;
21677  default:
21678  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
21679  break;
21680  }
21681 
21682 
21683  exit(rc);
21684  }
21685  #endif
21686 
21687 
21688  if(i == 1)
21689  {
21691  }
21692  else
21693  {
21695  }
21696 
21697 
21699 
21701  }
21702  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_consumption_recieve_goods\n");
21703 
21704 
21705 /* End of layer number 44 */
21706 
21707 /* Clear message boards that have finished being used
21708  * and sync complete if doing late sync complete */
21709 
21710 if(FLAME_bought_message_board_read == 0)
21711 {
21712  /*printf("%d> bought message board sync complete late as no agents reading any messages of this type\n", node_number);*/
21713 
21714  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bought)\n");
21715  rc = MB_SyncComplete(b_bought);
21716  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bought)\n");
21717  #ifdef ERRCHECK
21718  if (rc != MB_SUCCESS)
21719  {
21720  fprintf(stderr, "ERROR: Could not complete sync of 'bought' board\n");
21721  switch(rc) {
21722  case MB_ERR_INVALID:
21723  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
21724  break;
21725  case MB_ERR_MEMALLOC:
21726  fprintf(stderr, "\t reason: out of memory\n");
21727  break;
21728  case MB_ERR_INTERNAL:
21729  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21730  break;
21731  default:
21732  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21733  break;
21734  }
21735 
21736 
21737  exit(rc);
21738  }
21739  #endif
21740 }
21741 
21742  /* Delete any search trees */
21743 
21744  rc = MB_Clear(b_bought);
21745  #ifdef ERRCHECK
21746  if (rc != MB_SUCCESS)
21747  {
21748  fprintf(stderr, "ERROR: Could not clear 'bought' board\n");
21749  switch(rc) {
21750  case MB_ERR_INVALID:
21751  fprintf(stderr, "\t reason: 'bought' board is invalid\n");
21752  break;
21753  case MB_ERR_LOCKED:
21754  fprintf(stderr, "\t reason: 'bought' board is locked\n");
21755  break;
21756  case MB_ERR_INTERNAL:
21757  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21758  break;
21759  default:
21760  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
21761  break;
21762 
21763  }
21764 
21765 
21766  exit(rc);
21767  }
21768  #endif
21769 
21770 if(FLAME_sold_message_board_read == 0)
21771 {
21772  /*printf("%d> sold message board sync complete late as no agents reading any messages of this type\n", node_number);*/
21773 
21774  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sold)\n");
21775  rc = MB_SyncComplete(b_sold);
21776  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sold)\n");
21777  #ifdef ERRCHECK
21778  if (rc != MB_SUCCESS)
21779  {
21780  fprintf(stderr, "ERROR: Could not complete sync of 'sold' board\n");
21781  switch(rc) {
21782  case MB_ERR_INVALID:
21783  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
21784  break;
21785  case MB_ERR_MEMALLOC:
21786  fprintf(stderr, "\t reason: out of memory\n");
21787  break;
21788  case MB_ERR_INTERNAL:
21789  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21790  break;
21791  default:
21792  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21793  break;
21794  }
21795 
21796 
21797  exit(rc);
21798  }
21799  #endif
21800 }
21801 
21802  /* Delete any search trees */
21803 
21804  rc = MB_Clear(b_sold);
21805  #ifdef ERRCHECK
21806  if (rc != MB_SUCCESS)
21807  {
21808  fprintf(stderr, "ERROR: Could not clear 'sold' board\n");
21809  switch(rc) {
21810  case MB_ERR_INVALID:
21811  fprintf(stderr, "\t reason: 'sold' board is invalid\n");
21812  break;
21813  case MB_ERR_LOCKED:
21814  fprintf(stderr, "\t reason: 'sold' board is locked\n");
21815  break;
21816  case MB_ERR_INTERNAL:
21817  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21818  break;
21819  default:
21820  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
21821  break;
21822 
21823  }
21824 
21825 
21826  exit(rc);
21827  }
21828  #endif
21829 
21830  /* DEBUG: States with branching functions */
21833  {
21834  FLAME_debug_count = 0;
21835  /* Function: household_consumption_trace_cpi */
21837  { FLAME_debug_count++; }
21838  /* Function: idle */
21840  { FLAME_debug_count++; }
21841  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
21842  if(FLAME_debug_count != 1)
21843  {
21844  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHConsumptionMonthly'\n");
21845  if(FLAME_debug_count > 1)
21846  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
21847  if(FLAME_debug_count == 0)
21848  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
21849  }
21850 
21852  }
21853 
21854  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
21857  {
21861  /* For backwards compatibility set current_xmachine */
21872 
21874  {
21875 
21876 
21877 
21878  i = idle();
21879 
21880 
21881 
21882  if(i == 1)
21883  {
21885  }
21886  else
21887  {
21889  }
21890  }
21891 
21893 
21895  }
21896  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
21897 
21898 
21899  /* If mb is not read then leave sync complete until last possible moment */
21900  if(FLAME_goods_transactions_summary_message_board_read == 1)
21901  {
21902  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_goods_transactions_summary)\n");
21903  rc = MB_SyncComplete(b_goods_transactions_summary);
21904  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_goods_transactions_summary)\n");
21905  #ifdef ERRCHECK
21906  if (rc != MB_SUCCESS)
21907  {
21908  fprintf(stderr, "ERROR: Could not complete sync of 'goods_transactions_summary' board\n");
21909  switch(rc) {
21910  case MB_ERR_INVALID:
21911  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
21912  break;
21913  case MB_ERR_MEMALLOC:
21914  fprintf(stderr, "\t reason: out of memory\n");
21915  break;
21916  case MB_ERR_INTERNAL:
21917  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21918  break;
21919  default:
21920  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
21921  break;
21922  }
21923 
21924 
21925  exit(rc);
21926  }
21927  #endif
21928 
21929 
21930 
21931  }
21932 
21933  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_consumption_update_market_price\n");
21936  {
21940  /* For backwards compatibility set current_xmachine */
21951 
21952 
21953 
21954 
21955 
21956 
21958 
21959 
21960  #ifdef ERRCHECK
21961  if (rc != MB_SUCCESS)
21962  {
21963  fprintf(stderr, "ERROR: Could not create Iterator for 'goods_transactions_summary'\n");
21964  switch(rc) {
21965  case MB_ERR_INVALID:
21966  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
21967  break;
21968  case MB_ERR_LOCKED:
21969  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is locked\n");
21970  break;
21971  case MB_ERR_MEMALLOC:
21972  fprintf(stderr, "\t reason: out of memory\n");
21973  break;
21974  case MB_ERR_INTERNAL:
21975  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
21976  break;
21977  default:
21978 
21979 
21980  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
21981 
21982  break;
21983  }
21984 
21985 
21986  exit(rc);
21987  }
21988  #endif
21989 
21990 
21991 
21993 
21994 
21995  rc = MB_Iterator_Delete(&i_goods_transactions_summary);
21996  #ifdef ERRCHECK
21997  if (rc != MB_SUCCESS)
21998  {
21999  fprintf(stderr, "ERROR: Could not delete 'goods_transactions_summary' iterator\n");
22000  switch(rc) {
22001  case MB_ERR_INVALID:
22002  fprintf(stderr, "\t reason: 'goods_transactions_summary' iterator is invalid\n");
22003  break;
22004  case MB_ERR_INTERNAL:
22005  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22006  break;
22007  default:
22008  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
22009  break;
22010  }
22011 
22012 
22013  exit(rc);
22014  }
22015  #endif
22016 
22017 
22018  if(i == 1)
22019  {
22021  }
22022  else
22023  {
22025  }
22026 
22027 
22028  current_xmachine_firm = NULL;
22029 
22031  }
22032  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_consumption_update_market_price\n");
22033 
22034 
22035  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_trace_goods_prices\n");
22038  {
22042  /* For backwards compatibility set current_xmachine */
22053 
22055  {
22056 
22057 
22058 
22059 
22061 
22062 
22063  #ifdef ERRCHECK
22064  if (rc != MB_SUCCESS)
22065  {
22066  fprintf(stderr, "ERROR: Could not create Iterator for 'goods_transactions_summary'\n");
22067  switch(rc) {
22068  case MB_ERR_INVALID:
22069  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
22070  break;
22071  case MB_ERR_LOCKED:
22072  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is locked\n");
22073  break;
22074  case MB_ERR_MEMALLOC:
22075  fprintf(stderr, "\t reason: out of memory\n");
22076  break;
22077  case MB_ERR_INTERNAL:
22078  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22079  break;
22080  default:
22081 
22082 
22083  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
22084 
22085  break;
22086  }
22087 
22088 
22089  exit(rc);
22090  }
22091  #endif
22092 
22093 
22094 
22096 
22097 
22098  rc = MB_Iterator_Delete(&i_goods_transactions_summary);
22099  #ifdef ERRCHECK
22100  if (rc != MB_SUCCESS)
22101  {
22102  fprintf(stderr, "ERROR: Could not delete 'goods_transactions_summary' iterator\n");
22103  switch(rc) {
22104  case MB_ERR_INVALID:
22105  fprintf(stderr, "\t reason: 'goods_transactions_summary' iterator is invalid\n");
22106  break;
22107  case MB_ERR_INTERNAL:
22108  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22109  break;
22110  default:
22111  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
22112  break;
22113  }
22114 
22115 
22116  exit(rc);
22117  }
22118  #endif
22119 
22120 
22121  if(i == 1)
22122  {
22124  }
22125  else
22126  {
22128  }
22129  }
22130 
22132 
22134  }
22135  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_trace_goods_prices\n");
22136 
22137 
22138 /* End of layer number 45 */
22139 
22140 /* Clear message boards that have finished being used
22141  * and sync complete if doing late sync complete */
22142 
22143 if(FLAME_goods_transactions_summary_message_board_read == 0)
22144 {
22145  /*printf("%d> goods_transactions_summary message board sync complete late as no agents reading any messages of this type\n", node_number);*/
22146 
22147  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_goods_transactions_summary)\n");
22148  rc = MB_SyncComplete(b_goods_transactions_summary);
22149  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_goods_transactions_summary)\n");
22150  #ifdef ERRCHECK
22151  if (rc != MB_SUCCESS)
22152  {
22153  fprintf(stderr, "ERROR: Could not complete sync of 'goods_transactions_summary' board\n");
22154  switch(rc) {
22155  case MB_ERR_INVALID:
22156  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
22157  break;
22158  case MB_ERR_MEMALLOC:
22159  fprintf(stderr, "\t reason: out of memory\n");
22160  break;
22161  case MB_ERR_INTERNAL:
22162  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22163  break;
22164  default:
22165  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
22166  break;
22167  }
22168 
22169 
22170  exit(rc);
22171  }
22172  #endif
22173 }
22174 
22175  /* Delete any search trees */
22176 
22177  rc = MB_Clear(b_goods_transactions_summary);
22178  #ifdef ERRCHECK
22179  if (rc != MB_SUCCESS)
22180  {
22181  fprintf(stderr, "ERROR: Could not clear 'goods_transactions_summary' board\n");
22182  switch(rc) {
22183  case MB_ERR_INVALID:
22184  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is invalid\n");
22185  break;
22186  case MB_ERR_LOCKED:
22187  fprintf(stderr, "\t reason: 'goods_transactions_summary' board is locked\n");
22188  break;
22189  case MB_ERR_INTERNAL:
22190  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22191  break;
22192  default:
22193  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
22194  break;
22195 
22196  }
22197 
22198 
22199  exit(rc);
22200  }
22201  #endif
22202 
22203  /* DEBUG: States with branching functions */
22206  {
22207  FLAME_debug_count = 0;
22208  /* Function: centralbank_update_price_indices */
22210  { FLAME_debug_count++; }
22211  /* Function: idle */
22213  { FLAME_debug_count++; }
22214  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
22215  if(FLAME_debug_count != 1)
22216  {
22217  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'centralbank' leaving state 'CentralBankConsumptionPrices'\n");
22218  if(FLAME_debug_count > 1)
22219  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
22220  if(FLAME_debug_count == 0)
22221  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
22222  }
22223 
22225  }
22226 
22227  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_update_price_indices\n");
22230  {
22234  /* For backwards compatibility set current_xmachine */
22245 
22247  {
22248 
22249 
22250 
22252 
22253 
22254 
22255  if(i == 1)
22256  {
22258  }
22259  else
22260  {
22262  }
22263  }
22264 
22266 
22268  }
22269  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_update_price_indices\n");
22270 
22271  if(FLAME_centralbank_households_quarterly_cpi_message_board_write == 1)
22272  {
22273 
22274  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_centralbank_households_quarterly_cpi)\n");
22275  rc = MB_SyncStart(b_centralbank_households_quarterly_cpi);
22276  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_centralbank_households_quarterly_cpi)\n");
22277  #ifdef ERRCHECK
22278  if (rc != MB_SUCCESS)
22279  {
22280  fprintf(stderr, "ERROR: Could not start sync of 'centralbank_households_quarterly_cpi' board\n");
22281  switch(rc) {
22282  case MB_ERR_INVALID:
22283  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
22284  break;
22285  case MB_ERR_LOCKED:
22286  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is locked\n");
22287  break;
22288  case MB_ERR_MEMALLOC:
22289  fprintf(stderr, "\t reason: out of memory\n");
22290  break;
22291  case MB_ERR_INTERNAL:
22292  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22293  break;
22294  default:
22295  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
22296  break;
22297  }
22298 
22299 
22300  exit(rc);
22301  }
22302  #endif
22303  }
22304 
22305 
22306 
22307  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
22310  {
22314  /* For backwards compatibility set current_xmachine */
22325 
22327  {
22328 
22329 
22330 
22331  i = idle();
22332 
22333 
22334 
22335  if(i == 1)
22336  {
22338  }
22339  else
22340  {
22342  }
22343  }
22344 
22346 
22348  }
22349  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
22350 
22351 
22352  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
22355  {
22359  /* For backwards compatibility set current_xmachine */
22370 
22372  {
22373 
22374 
22375 
22376  i = idle();
22377 
22378 
22379 
22380  if(i == 1)
22381  {
22383  }
22384  else
22385  {
22387  }
22388  }
22389 
22390  current_xmachine_firm = NULL;
22391 
22393  }
22394  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
22395 
22396 
22397  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
22400  {
22404  /* For backwards compatibility set current_xmachine */
22415 
22417  {
22418 
22419 
22420 
22421  i = idle();
22422 
22423 
22424 
22425  if(i == 1)
22426  {
22428  }
22429  else
22430  {
22432  }
22433  }
22434 
22435  current_xmachine_firm = NULL;
22436 
22438  }
22439  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
22440 
22441 
22442 /* End of layer number 46 */
22443 
22444 /* Clear message boards that have finished being used
22445  * and sync complete if doing late sync complete */
22446 
22447  /* DEBUG: States with branching functions */
22450  {
22451  FLAME_debug_count = 0;
22452  /* Function: firm_housing_enter_market */
22454  { FLAME_debug_count++; }
22455  /* Function: idle */
22457  { FLAME_debug_count++; }
22458  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
22459  if(FLAME_debug_count != 1)
22460  {
22461  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmHousingMarket'\n");
22462  if(FLAME_debug_count > 1)
22463  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
22464  if(FLAME_debug_count == 0)
22465  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
22466  }
22467 
22469  }
22470  /* DEBUG: States with branching functions */
22473  {
22474  FLAME_debug_count = 0;
22475  /* Function: centralbank_trace_housing_prices */
22477  { FLAME_debug_count++; }
22478  /* Function: idle */
22480  { FLAME_debug_count++; }
22481  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
22482  if(FLAME_debug_count != 1)
22483  {
22484  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'centralbank' leaving state 'CentralBankHousing'\n");
22485  if(FLAME_debug_count > 1)
22486  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
22487  if(FLAME_debug_count == 0)
22488  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
22489  }
22490 
22492  }
22493 
22494  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_housing_enter_market\n");
22497  {
22501  /* For backwards compatibility set current_xmachine */
22512 
22514  {
22515 
22516 
22517 
22519 
22520 
22521 
22522  if(i == 1)
22523  {
22525  }
22526  else
22527  {
22529  }
22530  }
22531 
22532  current_xmachine_firm = NULL;
22533 
22535  }
22536  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_housing_enter_market\n");
22537 
22538 
22539  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
22542  {
22546  /* For backwards compatibility set current_xmachine */
22557 
22559  {
22560 
22561 
22562 
22563  i = idle();
22564 
22565 
22566 
22567  if(i == 1)
22568  {
22570  }
22571  else
22572  {
22574  }
22575  }
22576 
22578 
22580  }
22581  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
22582 
22583 
22584  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
22587  {
22591  /* For backwards compatibility set current_xmachine */
22602 
22604  {
22605 
22606 
22607 
22608  i = idle();
22609 
22610 
22611 
22612  if(i == 1)
22613  {
22615  }
22616  else
22617  {
22619  }
22620  }
22621 
22622  current_xmachine_firm = NULL;
22623 
22625  }
22626  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
22627 
22628 
22629  /* If mb is not read then leave sync complete until last possible moment */
22630  if(FLAME_centralbank_households_quarterly_cpi_message_board_read == 1)
22631  {
22632  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_centralbank_households_quarterly_cpi)\n");
22633  rc = MB_SyncComplete(b_centralbank_households_quarterly_cpi);
22634  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_centralbank_households_quarterly_cpi)\n");
22635  #ifdef ERRCHECK
22636  if (rc != MB_SUCCESS)
22637  {
22638  fprintf(stderr, "ERROR: Could not complete sync of 'centralbank_households_quarterly_cpi' board\n");
22639  switch(rc) {
22640  case MB_ERR_INVALID:
22641  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
22642  break;
22643  case MB_ERR_MEMALLOC:
22644  fprintf(stderr, "\t reason: out of memory\n");
22645  break;
22646  case MB_ERR_INTERNAL:
22647  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22648  break;
22649  default:
22650  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
22651  break;
22652  }
22653 
22654 
22655  exit(rc);
22656  }
22657  #endif
22658 
22659 
22660 
22661  }
22662 
22663  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_consumption_trace_cpi\n");
22666  {
22670  /* For backwards compatibility set current_xmachine */
22681 
22683  {
22684 
22685 
22686 
22687 
22689 
22690 
22691  #ifdef ERRCHECK
22692  if (rc != MB_SUCCESS)
22693  {
22694  fprintf(stderr, "ERROR: Could not create Iterator for 'centralbank_households_quarterly_cpi'\n");
22695  switch(rc) {
22696  case MB_ERR_INVALID:
22697  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
22698  break;
22699  case MB_ERR_LOCKED:
22700  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is locked\n");
22701  break;
22702  case MB_ERR_MEMALLOC:
22703  fprintf(stderr, "\t reason: out of memory\n");
22704  break;
22705  case MB_ERR_INTERNAL:
22706  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22707  break;
22708  default:
22709 
22710 
22711  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
22712 
22713  break;
22714  }
22715 
22716 
22717  exit(rc);
22718  }
22719  #endif
22720 
22721 
22722 
22724 
22725 
22726  rc = MB_Iterator_Delete(&i_centralbank_households_quarterly_cpi);
22727  #ifdef ERRCHECK
22728  if (rc != MB_SUCCESS)
22729  {
22730  fprintf(stderr, "ERROR: Could not delete 'centralbank_households_quarterly_cpi' iterator\n");
22731  switch(rc) {
22732  case MB_ERR_INVALID:
22733  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' iterator is invalid\n");
22734  break;
22735  case MB_ERR_INTERNAL:
22736  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22737  break;
22738  default:
22739  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
22740  break;
22741  }
22742 
22743 
22744  exit(rc);
22745  }
22746  #endif
22747 
22748 
22749  if(i == 1)
22750  {
22752  }
22753  else
22754  {
22756  }
22757  }
22758 
22760 
22762  }
22763  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_consumption_trace_cpi\n");
22764 
22765 
22766 /* End of layer number 47 */
22767 
22768 /* Clear message boards that have finished being used
22769  * and sync complete if doing late sync complete */
22770 
22771 if(FLAME_centralbank_households_quarterly_cpi_message_board_read == 0)
22772 {
22773  /*printf("%d> centralbank_households_quarterly_cpi message board sync complete late as no agents reading any messages of this type\n", node_number);*/
22774 
22775  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_centralbank_households_quarterly_cpi)\n");
22776  rc = MB_SyncComplete(b_centralbank_households_quarterly_cpi);
22777  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_centralbank_households_quarterly_cpi)\n");
22778  #ifdef ERRCHECK
22779  if (rc != MB_SUCCESS)
22780  {
22781  fprintf(stderr, "ERROR: Could not complete sync of 'centralbank_households_quarterly_cpi' board\n");
22782  switch(rc) {
22783  case MB_ERR_INVALID:
22784  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
22785  break;
22786  case MB_ERR_MEMALLOC:
22787  fprintf(stderr, "\t reason: out of memory\n");
22788  break;
22789  case MB_ERR_INTERNAL:
22790  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22791  break;
22792  default:
22793  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
22794  break;
22795  }
22796 
22797 
22798  exit(rc);
22799  }
22800  #endif
22801 }
22802 
22803  /* Delete any search trees */
22804 
22806  #ifdef ERRCHECK
22807  if (rc != MB_SUCCESS)
22808  {
22809  fprintf(stderr, "ERROR: Could not clear 'centralbank_households_quarterly_cpi' board\n");
22810  switch(rc) {
22811  case MB_ERR_INVALID:
22812  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is invalid\n");
22813  break;
22814  case MB_ERR_LOCKED:
22815  fprintf(stderr, "\t reason: 'centralbank_households_quarterly_cpi' board is locked\n");
22816  break;
22817  case MB_ERR_INTERNAL:
22818  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
22819  break;
22820  default:
22821  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
22822  break;
22823 
22824  }
22825 
22826 
22827  exit(rc);
22828  }
22829  #endif
22830 
22831  /* DEBUG: States with branching functions */
22834  {
22835  FLAME_debug_count = 0;
22836  /* Function: household_housing_market_role */
22838  { FLAME_debug_count++; }
22839  /* Function: idle */
22841  { FLAME_debug_count++; }
22842  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
22843  if(FLAME_debug_count != 1)
22844  {
22845  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHHousingStart'\n");
22846  if(FLAME_debug_count > 1)
22847  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
22848  if(FLAME_debug_count == 0)
22849  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
22850  }
22851 
22853  }
22854 
22855  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_market_role\n");
22858  {
22862  /* For backwards compatibility set current_xmachine */
22873 
22875  {
22876 
22877 
22878 
22880 
22881 
22882 
22883  if(i == 1)
22884  {
22886  }
22887  else
22888  {
22890  }
22891  }
22892 
22894 
22896  }
22897  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_market_role\n");
22898 
22899 
22900  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
22903  {
22907  /* For backwards compatibility set current_xmachine */
22918 
22920  {
22921 
22922 
22923 
22924  i = idle();
22925 
22926 
22927 
22928  if(i == 1)
22929  {
22931  }
22932  else
22933  {
22935  }
22936  }
22937 
22939 
22941  }
22942  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
22943 
22944 
22945 /* End of layer number 48 */
22946 
22947 /* Clear message boards that have finished being used
22948  * and sync complete if doing late sync complete */
22949 
22950  /* DEBUG: States with branching functions */
22953  {
22954  FLAME_debug_count = 0;
22955  /* Function: household_housing_fire_sell */
22957  { FLAME_debug_count++; }
22958  /* Function: household_housing_sell */
22960  { FLAME_debug_count++; }
22961  /* Function: household_housing_check_wealth */
22963  { FLAME_debug_count++; }
22964  /* Function: idle */
22966  { FLAME_debug_count++; }
22967  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
22968  if(FLAME_debug_count != 1)
22969  {
22970  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHHousingRole'\n");
22971  if(FLAME_debug_count > 1)
22972  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
22973  if(FLAME_debug_count == 0)
22974  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
22975  }
22976 
22978  }
22979 
22980  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_sell\n");
22983  {
22987  /* For backwards compatibility set current_xmachine */
22998 
23000  {
23001 
23002 
23003 
23004  i = household_housing_sell();
23005 
23006 
23007 
23008  if(i == 1)
23009  {
23011  }
23012  else
23013  {
23015  }
23016  }
23017 
23019 
23021  }
23022  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_sell\n");
23023 
23024 
23025  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_fire_sell\n");
23028  {
23032  /* For backwards compatibility set current_xmachine */
23043 
23045  {
23046 
23047 
23048 
23050 
23051 
23052 
23053  if(i == 1)
23054  {
23056  }
23057  else
23058  {
23060  }
23061  }
23062 
23064 
23066  }
23067  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_fire_sell\n");
23068 
23069  if(FLAME_sell_housing_message_board_write == 1)
23070  {
23071 
23072  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sell_housing)\n");
23073  rc = MB_SyncStart(b_sell_housing);
23074  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sell_housing)\n");
23075  #ifdef ERRCHECK
23076  if (rc != MB_SUCCESS)
23077  {
23078  fprintf(stderr, "ERROR: Could not start sync of 'sell_housing' board\n");
23079  switch(rc) {
23080  case MB_ERR_INVALID:
23081  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
23082  break;
23083  case MB_ERR_LOCKED:
23084  fprintf(stderr, "\t reason: 'sell_housing' board is locked\n");
23085  break;
23086  case MB_ERR_MEMALLOC:
23087  fprintf(stderr, "\t reason: out of memory\n");
23088  break;
23089  case MB_ERR_INTERNAL:
23090  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23091  break;
23092  default:
23093  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
23094  break;
23095  }
23096 
23097 
23098  exit(rc);
23099  }
23100  #endif
23101  }
23102 
23103 
23104 
23105  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_check_wealth\n");
23108  {
23112  /* For backwards compatibility set current_xmachine */
23123 
23125  {
23126 
23127 
23128 
23130 
23131 
23132 
23133  if(i == 1)
23134  {
23136  }
23137  else
23138  {
23140  }
23141  }
23142 
23144 
23146  }
23147  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_check_wealth\n");
23148 
23149 
23150  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
23153  {
23157  /* For backwards compatibility set current_xmachine */
23168 
23170  {
23171 
23172 
23173 
23174  i = idle();
23175 
23176 
23177 
23178  if(i == 1)
23179  {
23181  }
23182  else
23183  {
23185  }
23186  }
23187 
23189 
23191  }
23192  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
23193 
23194 
23195 /* End of layer number 49 */
23196 
23197 /* Clear message boards that have finished being used
23198  * and sync complete if doing late sync complete */
23199 
23200  /* DEBUG: States with branching functions */
23203  {
23204  FLAME_debug_count = 0;
23205  /* Function: household_housing_enter_market */
23207  { FLAME_debug_count++; }
23208  /* Function: idle */
23210  { FLAME_debug_count++; }
23211  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
23212  if(FLAME_debug_count != 1)
23213  {
23214  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHHousingCheckWealth'\n");
23215  if(FLAME_debug_count > 1)
23216  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
23217  if(FLAME_debug_count == 0)
23218  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
23219  }
23220 
23222  }
23223 
23224  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_enter_market\n");
23227  {
23231  /* For backwards compatibility set current_xmachine */
23242 
23244  {
23245 
23246 
23247 
23249 
23250 
23251 
23252  if(i == 1)
23253  {
23255  }
23256  else
23257  {
23259  }
23260  }
23261 
23263 
23265  }
23266  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_enter_market\n");
23267 
23268  if(FLAME_buy_housing_message_board_write == 1)
23269  {
23270 
23271  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_buy_housing)\n");
23272  rc = MB_SyncStart(b_buy_housing);
23273  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_buy_housing)\n");
23274  #ifdef ERRCHECK
23275  if (rc != MB_SUCCESS)
23276  {
23277  fprintf(stderr, "ERROR: Could not start sync of 'buy_housing' board\n");
23278  switch(rc) {
23279  case MB_ERR_INVALID:
23280  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
23281  break;
23282  case MB_ERR_LOCKED:
23283  fprintf(stderr, "\t reason: 'buy_housing' board is locked\n");
23284  break;
23285  case MB_ERR_MEMALLOC:
23286  fprintf(stderr, "\t reason: out of memory\n");
23287  break;
23288  case MB_ERR_INTERNAL:
23289  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23290  break;
23291  default:
23292  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
23293  break;
23294  }
23295 
23296 
23297  exit(rc);
23298  }
23299  #endif
23300  }
23301 
23302 
23303 
23304  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
23307  {
23311  /* For backwards compatibility set current_xmachine */
23322 
23324  {
23325 
23326 
23327 
23328  i = idle();
23329 
23330 
23331 
23332  if(i == 1)
23333  {
23335  }
23336  else
23337  {
23339  }
23340  }
23341 
23343 
23345  }
23346  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
23347 
23348 
23349 /* End of layer number 50 */
23350 
23351 /* Clear message boards that have finished being used
23352  * and sync complete if doing late sync complete */
23353 
23354 
23355  /* If mb is not read then leave sync complete until last possible moment */
23356  if(FLAME_bank_reagency_credibility_message_board_read == 1)
23357  {
23358  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_reagency_credibility)\n");
23359  rc = MB_SyncComplete(b_bank_reagency_credibility);
23360  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_reagency_credibility)\n");
23361  #ifdef ERRCHECK
23362  if (rc != MB_SUCCESS)
23363  {
23364  fprintf(stderr, "ERROR: Could not complete sync of 'bank_reagency_credibility' board\n");
23365  switch(rc) {
23366  case MB_ERR_INVALID:
23367  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
23368  break;
23369  case MB_ERR_MEMALLOC:
23370  fprintf(stderr, "\t reason: out of memory\n");
23371  break;
23372  case MB_ERR_INTERNAL:
23373  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23374  break;
23375  default:
23376  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
23377  break;
23378  }
23379 
23380 
23381  exit(rc);
23382  }
23383  #endif
23384 
23385 
23386 
23387  }
23388 
23389  /* If mb is not read then leave sync complete until last possible moment */
23390  if(FLAME_sell_housing_message_board_read == 1)
23391  {
23392  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sell_housing)\n");
23393  rc = MB_SyncComplete(b_sell_housing);
23394  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sell_housing)\n");
23395  #ifdef ERRCHECK
23396  if (rc != MB_SUCCESS)
23397  {
23398  fprintf(stderr, "ERROR: Could not complete sync of 'sell_housing' board\n");
23399  switch(rc) {
23400  case MB_ERR_INVALID:
23401  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
23402  break;
23403  case MB_ERR_MEMALLOC:
23404  fprintf(stderr, "\t reason: out of memory\n");
23405  break;
23406  case MB_ERR_INTERNAL:
23407  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23408  break;
23409  default:
23410  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
23411  break;
23412  }
23413 
23414 
23415  exit(rc);
23416  }
23417  #endif
23418 
23419 
23420 
23421  }
23422 
23423  /* If mb is not read then leave sync complete until last possible moment */
23424  if(FLAME_buy_housing_message_board_read == 1)
23425  {
23426  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_buy_housing)\n");
23427  rc = MB_SyncComplete(b_buy_housing);
23428  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_buy_housing)\n");
23429  #ifdef ERRCHECK
23430  if (rc != MB_SUCCESS)
23431  {
23432  fprintf(stderr, "ERROR: Could not complete sync of 'buy_housing' board\n");
23433  switch(rc) {
23434  case MB_ERR_INVALID:
23435  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
23436  break;
23437  case MB_ERR_MEMALLOC:
23438  fprintf(stderr, "\t reason: out of memory\n");
23439  break;
23440  case MB_ERR_INTERNAL:
23441  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23442  break;
23443  default:
23444  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
23445  break;
23446  }
23447 
23448 
23449  exit(rc);
23450  }
23451  #endif
23452 
23453 
23454 
23455  }
23456 
23457  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start reagency_housing_process\n");
23460  {
23464  /* For backwards compatibility set current_xmachine */
23475 
23477  {
23478 
23479 
23480 
23481 
23482  rc = MB_Iterator_Create(b_buy_housing, &i_buy_housing);
23483 
23484 
23485  #ifdef ERRCHECK
23486  if (rc != MB_SUCCESS)
23487  {
23488  fprintf(stderr, "ERROR: Could not create Iterator for 'buy_housing'\n");
23489  switch(rc) {
23490  case MB_ERR_INVALID:
23491  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
23492  break;
23493  case MB_ERR_LOCKED:
23494  fprintf(stderr, "\t reason: 'buy_housing' board is locked\n");
23495  break;
23496  case MB_ERR_MEMALLOC:
23497  fprintf(stderr, "\t reason: out of memory\n");
23498  break;
23499  case MB_ERR_INTERNAL:
23500  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23501  break;
23502  default:
23503 
23504 
23505  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
23506 
23507  break;
23508  }
23509 
23510 
23511  exit(rc);
23512  }
23513  #endif
23514  MB_Iterator_Randomise(i_buy_housing);
23515 
23516 
23517 
23518 
23520 
23521  #ifdef ERRCHECK
23522  if (rc != MB_SUCCESS)
23523  {
23524  fprintf(stderr, "ERROR: Could not create Iterator for 'sell_housing'\n");
23525  switch(rc) {
23526  case MB_ERR_INVALID:
23527  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
23528  break;
23529  case MB_ERR_LOCKED:
23530  fprintf(stderr, "\t reason: 'sell_housing' board is locked\n");
23531  break;
23532  case MB_ERR_MEMALLOC:
23533  fprintf(stderr, "\t reason: out of memory\n");
23534  break;
23535  case MB_ERR_INTERNAL:
23536  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23537  break;
23538  default:
23539 
23540 
23541  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
23542 
23543  break;
23544  }
23545 
23546 
23547  exit(rc);
23548  }
23549  #endif
23550 
23551 
23552 
23553 
23554  rc = MB_Iterator_Create(b_bank_reagency_credibility, &i_bank_reagency_credibility);
23555 
23556 
23557  #ifdef ERRCHECK
23558  if (rc != MB_SUCCESS)
23559  {
23560  fprintf(stderr, "ERROR: Could not create Iterator for 'bank_reagency_credibility'\n");
23561  switch(rc) {
23562  case MB_ERR_INVALID:
23563  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
23564  break;
23565  case MB_ERR_LOCKED:
23566  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is locked\n");
23567  break;
23568  case MB_ERR_MEMALLOC:
23569  fprintf(stderr, "\t reason: out of memory\n");
23570  break;
23571  case MB_ERR_INTERNAL:
23572  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23573  break;
23574  default:
23575 
23576 
23577  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
23578 
23579  break;
23580  }
23581 
23582 
23583  exit(rc);
23584  }
23585  #endif
23586 
23587 
23588 
23590 
23591 
23592  rc = MB_Iterator_Delete(&i_buy_housing);
23593  #ifdef ERRCHECK
23594  if (rc != MB_SUCCESS)
23595  {
23596  fprintf(stderr, "ERROR: Could not delete 'buy_housing' iterator\n");
23597  switch(rc) {
23598  case MB_ERR_INVALID:
23599  fprintf(stderr, "\t reason: 'buy_housing' iterator is invalid\n");
23600  break;
23601  case MB_ERR_INTERNAL:
23602  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23603  break;
23604  default:
23605  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
23606  break;
23607  }
23608 
23609 
23610  exit(rc);
23611  }
23612  #endif
23613 
23614  rc = MB_Iterator_Delete(&i_sell_housing);
23615  #ifdef ERRCHECK
23616  if (rc != MB_SUCCESS)
23617  {
23618  fprintf(stderr, "ERROR: Could not delete 'sell_housing' iterator\n");
23619  switch(rc) {
23620  case MB_ERR_INVALID:
23621  fprintf(stderr, "\t reason: 'sell_housing' iterator is invalid\n");
23622  break;
23623  case MB_ERR_INTERNAL:
23624  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23625  break;
23626  default:
23627  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
23628  break;
23629  }
23630 
23631 
23632  exit(rc);
23633  }
23634  #endif
23635 
23636  rc = MB_Iterator_Delete(&i_bank_reagency_credibility);
23637  #ifdef ERRCHECK
23638  if (rc != MB_SUCCESS)
23639  {
23640  fprintf(stderr, "ERROR: Could not delete 'bank_reagency_credibility' iterator\n");
23641  switch(rc) {
23642  case MB_ERR_INVALID:
23643  fprintf(stderr, "\t reason: 'bank_reagency_credibility' iterator is invalid\n");
23644  break;
23645  case MB_ERR_INTERNAL:
23646  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23647  break;
23648  default:
23649  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
23650  break;
23651  }
23652 
23653 
23654  exit(rc);
23655  }
23656  #endif
23657 
23658 
23659  if(i == 1)
23660  {
23662  }
23663  else
23664  {
23666  }
23667  }
23668 
23670 
23672  }
23673  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish reagency_housing_process\n");
23674 
23675  if(FLAME_mortgage_requests_message_board_write == 1)
23676  {
23677 
23678  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_requests)\n");
23679  rc = MB_SyncStart(b_mortgage_requests);
23680  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_requests)\n");
23681  #ifdef ERRCHECK
23682  if (rc != MB_SUCCESS)
23683  {
23684  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_requests' board\n");
23685  switch(rc) {
23686  case MB_ERR_INVALID:
23687  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
23688  break;
23689  case MB_ERR_LOCKED:
23690  fprintf(stderr, "\t reason: 'mortgage_requests' board is locked\n");
23691  break;
23692  case MB_ERR_MEMALLOC:
23693  fprintf(stderr, "\t reason: out of memory\n");
23694  break;
23695  case MB_ERR_INTERNAL:
23696  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23697  break;
23698  default:
23699  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
23700  break;
23701  }
23702 
23703 
23704  exit(rc);
23705  }
23706  #endif
23707  }
23708 
23709 
23710  if(FLAME_sold_housing_message_board_write == 1)
23711  {
23712 
23713  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_sold_housing)\n");
23714  rc = MB_SyncStart(b_sold_housing);
23715  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_sold_housing)\n");
23716  #ifdef ERRCHECK
23717  if (rc != MB_SUCCESS)
23718  {
23719  fprintf(stderr, "ERROR: Could not start sync of 'sold_housing' board\n");
23720  switch(rc) {
23721  case MB_ERR_INVALID:
23722  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
23723  break;
23724  case MB_ERR_LOCKED:
23725  fprintf(stderr, "\t reason: 'sold_housing' board is locked\n");
23726  break;
23727  case MB_ERR_MEMALLOC:
23728  fprintf(stderr, "\t reason: out of memory\n");
23729  break;
23730  case MB_ERR_INTERNAL:
23731  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23732  break;
23733  default:
23734  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
23735  break;
23736  }
23737 
23738 
23739  exit(rc);
23740  }
23741  #endif
23742  }
23743 
23744 
23745  if(FLAME_bought_housing_message_board_write == 1)
23746  {
23747 
23748  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_bought_housing)\n");
23749  rc = MB_SyncStart(b_bought_housing);
23750  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_bought_housing)\n");
23751  #ifdef ERRCHECK
23752  if (rc != MB_SUCCESS)
23753  {
23754  fprintf(stderr, "ERROR: Could not start sync of 'bought_housing' board\n");
23755  switch(rc) {
23756  case MB_ERR_INVALID:
23757  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
23758  break;
23759  case MB_ERR_LOCKED:
23760  fprintf(stderr, "\t reason: 'bought_housing' board is locked\n");
23761  break;
23762  case MB_ERR_MEMALLOC:
23763  fprintf(stderr, "\t reason: out of memory\n");
23764  break;
23765  case MB_ERR_INTERNAL:
23766  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23767  break;
23768  default:
23769  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
23770  break;
23771  }
23772 
23773 
23774  exit(rc);
23775  }
23776  #endif
23777  }
23778 
23779 
23780 
23781 /* End of layer number 51 */
23782 
23783 /* Clear message boards that have finished being used
23784  * and sync complete if doing late sync complete */
23785 
23786 if(FLAME_buy_housing_message_board_read == 0)
23787 {
23788  /*printf("%d> buy_housing message board sync complete late as no agents reading any messages of this type\n", node_number);*/
23789 
23790  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_buy_housing)\n");
23791  rc = MB_SyncComplete(b_buy_housing);
23792  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_buy_housing)\n");
23793  #ifdef ERRCHECK
23794  if (rc != MB_SUCCESS)
23795  {
23796  fprintf(stderr, "ERROR: Could not complete sync of 'buy_housing' board\n");
23797  switch(rc) {
23798  case MB_ERR_INVALID:
23799  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
23800  break;
23801  case MB_ERR_MEMALLOC:
23802  fprintf(stderr, "\t reason: out of memory\n");
23803  break;
23804  case MB_ERR_INTERNAL:
23805  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23806  break;
23807  default:
23808  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
23809  break;
23810  }
23811 
23812 
23813  exit(rc);
23814  }
23815  #endif
23816 }
23817 
23818  /* Delete any search trees */
23819 
23820  rc = MB_Clear(b_buy_housing);
23821  #ifdef ERRCHECK
23822  if (rc != MB_SUCCESS)
23823  {
23824  fprintf(stderr, "ERROR: Could not clear 'buy_housing' board\n");
23825  switch(rc) {
23826  case MB_ERR_INVALID:
23827  fprintf(stderr, "\t reason: 'buy_housing' board is invalid\n");
23828  break;
23829  case MB_ERR_LOCKED:
23830  fprintf(stderr, "\t reason: 'buy_housing' board is locked\n");
23831  break;
23832  case MB_ERR_INTERNAL:
23833  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23834  break;
23835  default:
23836  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
23837  break;
23838 
23839  }
23840 
23841 
23842  exit(rc);
23843  }
23844  #endif
23845 
23846 if(FLAME_sell_housing_message_board_read == 0)
23847 {
23848  /*printf("%d> sell_housing message board sync complete late as no agents reading any messages of this type\n", node_number);*/
23849 
23850  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sell_housing)\n");
23851  rc = MB_SyncComplete(b_sell_housing);
23852  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sell_housing)\n");
23853  #ifdef ERRCHECK
23854  if (rc != MB_SUCCESS)
23855  {
23856  fprintf(stderr, "ERROR: Could not complete sync of 'sell_housing' board\n");
23857  switch(rc) {
23858  case MB_ERR_INVALID:
23859  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
23860  break;
23861  case MB_ERR_MEMALLOC:
23862  fprintf(stderr, "\t reason: out of memory\n");
23863  break;
23864  case MB_ERR_INTERNAL:
23865  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23866  break;
23867  default:
23868  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
23869  break;
23870  }
23871 
23872 
23873  exit(rc);
23874  }
23875  #endif
23876 }
23877 
23878  /* Delete any search trees */
23879 
23880  rc = MB_Clear(b_sell_housing);
23881  #ifdef ERRCHECK
23882  if (rc != MB_SUCCESS)
23883  {
23884  fprintf(stderr, "ERROR: Could not clear 'sell_housing' board\n");
23885  switch(rc) {
23886  case MB_ERR_INVALID:
23887  fprintf(stderr, "\t reason: 'sell_housing' board is invalid\n");
23888  break;
23889  case MB_ERR_LOCKED:
23890  fprintf(stderr, "\t reason: 'sell_housing' board is locked\n");
23891  break;
23892  case MB_ERR_INTERNAL:
23893  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23894  break;
23895  default:
23896  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
23897  break;
23898 
23899  }
23900 
23901 
23902  exit(rc);
23903  }
23904  #endif
23905 
23906 if(FLAME_bank_reagency_credibility_message_board_read == 0)
23907 {
23908  /*printf("%d> bank_reagency_credibility message board sync complete late as no agents reading any messages of this type\n", node_number);*/
23909 
23910  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bank_reagency_credibility)\n");
23911  rc = MB_SyncComplete(b_bank_reagency_credibility);
23912  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bank_reagency_credibility)\n");
23913  #ifdef ERRCHECK
23914  if (rc != MB_SUCCESS)
23915  {
23916  fprintf(stderr, "ERROR: Could not complete sync of 'bank_reagency_credibility' board\n");
23917  switch(rc) {
23918  case MB_ERR_INVALID:
23919  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
23920  break;
23921  case MB_ERR_MEMALLOC:
23922  fprintf(stderr, "\t reason: out of memory\n");
23923  break;
23924  case MB_ERR_INTERNAL:
23925  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23926  break;
23927  default:
23928  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
23929  break;
23930  }
23931 
23932 
23933  exit(rc);
23934  }
23935  #endif
23936 }
23937 
23938  /* Delete any search trees */
23939 
23940  rc = MB_Clear(b_bank_reagency_credibility);
23941  #ifdef ERRCHECK
23942  if (rc != MB_SUCCESS)
23943  {
23944  fprintf(stderr, "ERROR: Could not clear 'bank_reagency_credibility' board\n");
23945  switch(rc) {
23946  case MB_ERR_INVALID:
23947  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is invalid\n");
23948  break;
23949  case MB_ERR_LOCKED:
23950  fprintf(stderr, "\t reason: 'bank_reagency_credibility' board is locked\n");
23951  break;
23952  case MB_ERR_INTERNAL:
23953  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
23954  break;
23955  default:
23956  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
23957  break;
23958 
23959  }
23960 
23961 
23962  exit(rc);
23963  }
23964  #endif
23965 
23966 
23967  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start reagency_housing_summary\n");
23970  {
23974  /* For backwards compatibility set current_xmachine */
23985 
23986 
23987 
23988 
23989 
23991 
23992 
23993 
23994  if(i == 1)
23995  {
23997  }
23998  else
23999  {
24001  }
24002 
24003 
24005 
24007  }
24008  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish reagency_housing_summary\n");
24009 
24010  if(FLAME_housing_transactions_summary_message_board_write == 1)
24011  {
24012 
24013  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_housing_transactions_summary)\n");
24014  rc = MB_SyncStart(b_housing_transactions_summary);
24015  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_housing_transactions_summary)\n");
24016  #ifdef ERRCHECK
24017  if (rc != MB_SUCCESS)
24018  {
24019  fprintf(stderr, "ERROR: Could not start sync of 'housing_transactions_summary' board\n");
24020  switch(rc) {
24021  case MB_ERR_INVALID:
24022  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
24023  break;
24024  case MB_ERR_LOCKED:
24025  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is locked\n");
24026  break;
24027  case MB_ERR_MEMALLOC:
24028  fprintf(stderr, "\t reason: out of memory\n");
24029  break;
24030  case MB_ERR_INTERNAL:
24031  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24032  break;
24033  default:
24034  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
24035  break;
24036  }
24037 
24038 
24039  exit(rc);
24040  }
24041  #endif
24042  }
24043 
24044 
24045  if(FLAME_housing_price_message_board_write == 1)
24046  {
24047 
24048  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_housing_price)\n");
24049  rc = MB_SyncStart(b_housing_price);
24050  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_housing_price)\n");
24051  #ifdef ERRCHECK
24052  if (rc != MB_SUCCESS)
24053  {
24054  fprintf(stderr, "ERROR: Could not start sync of 'housing_price' board\n");
24055  switch(rc) {
24056  case MB_ERR_INVALID:
24057  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
24058  break;
24059  case MB_ERR_LOCKED:
24060  fprintf(stderr, "\t reason: 'housing_price' board is locked\n");
24061  break;
24062  case MB_ERR_MEMALLOC:
24063  fprintf(stderr, "\t reason: out of memory\n");
24064  break;
24065  case MB_ERR_INTERNAL:
24066  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24067  break;
24068  default:
24069  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
24070  break;
24071  }
24072 
24073 
24074  exit(rc);
24075  }
24076  #endif
24077  }
24078 
24079 
24080 
24081  /* If mb is not read then leave sync complete until last possible moment */
24082  if(FLAME_sold_housing_message_board_read == 1)
24083  {
24084  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sold_housing)\n");
24085  rc = MB_SyncComplete(b_sold_housing);
24086  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sold_housing)\n");
24087  #ifdef ERRCHECK
24088  if (rc != MB_SUCCESS)
24089  {
24090  fprintf(stderr, "ERROR: Could not complete sync of 'sold_housing' board\n");
24091  switch(rc) {
24092  case MB_ERR_INVALID:
24093  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
24094  break;
24095  case MB_ERR_MEMALLOC:
24096  fprintf(stderr, "\t reason: out of memory\n");
24097  break;
24098  case MB_ERR_INTERNAL:
24099  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24100  break;
24101  default:
24102  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24103  break;
24104  }
24105 
24106 
24107  exit(rc);
24108  }
24109  #endif
24110 
24111 
24112 
24113  }
24114 
24115  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_collect_sale_revenue\n");
24118  {
24122  /* For backwards compatibility set current_xmachine */
24133 
24134 
24135 
24136 
24137 
24138 
24139 
24140 
24142 
24143 
24144 
24145  #ifdef ERRCHECK
24146  if (rc != MB_SUCCESS)
24147  {
24148  fprintf(stderr, "ERROR: Could not create Iterator for 'sold_housing'\n");
24149  switch(rc) {
24150  case MB_ERR_INVALID:
24151  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
24152  break;
24153  case MB_ERR_LOCKED:
24154  fprintf(stderr, "\t reason: 'sold_housing' board is locked\n");
24155  break;
24156  case MB_ERR_MEMALLOC:
24157  fprintf(stderr, "\t reason: out of memory\n");
24158  break;
24159  case MB_ERR_INTERNAL:
24160  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24161  break;
24162  default:
24163 
24164  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
24165 
24166 
24167  break;
24168  }
24169 
24170 
24171  exit(rc);
24172  }
24173  #endif
24174 
24175 
24176 
24178 
24179 
24180  rc = MB_Iterator_Delete(&i_sold_housing);
24181  #ifdef ERRCHECK
24182  if (rc != MB_SUCCESS)
24183  {
24184  fprintf(stderr, "ERROR: Could not delete 'sold_housing' iterator\n");
24185  switch(rc) {
24186  case MB_ERR_INVALID:
24187  fprintf(stderr, "\t reason: 'sold_housing' iterator is invalid\n");
24188  break;
24189  case MB_ERR_INTERNAL:
24190  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24191  break;
24192  default:
24193  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
24194  break;
24195  }
24196 
24197 
24198  exit(rc);
24199  }
24200  #endif
24201 
24202 
24203  if(i == 1)
24204  {
24206  }
24207  else
24208  {
24210  }
24211 
24212 
24214 
24216  }
24217  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_collect_sale_revenue\n");
24218 
24219  if(FLAME_mortgage_payment_from_sale_message_board_write == 1)
24220  {
24221 
24222  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_payment_from_sale)\n");
24223  rc = MB_SyncStart(b_mortgage_payment_from_sale);
24224  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_payment_from_sale)\n");
24225  #ifdef ERRCHECK
24226  if (rc != MB_SUCCESS)
24227  {
24228  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_payment_from_sale' board\n");
24229  switch(rc) {
24230  case MB_ERR_INVALID:
24231  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
24232  break;
24233  case MB_ERR_LOCKED:
24234  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is locked\n");
24235  break;
24236  case MB_ERR_MEMALLOC:
24237  fprintf(stderr, "\t reason: out of memory\n");
24238  break;
24239  case MB_ERR_INTERNAL:
24240  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24241  break;
24242  default:
24243  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
24244  break;
24245  }
24246 
24247 
24248  exit(rc);
24249  }
24250  #endif
24251  }
24252 
24253 
24254 
24255  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_housing_collect_sale_revenues\n");
24258  {
24262  /* For backwards compatibility set current_xmachine */
24273 
24274 
24275 
24276 
24277 
24278 
24279 
24280 
24282 
24283 
24284 
24285  #ifdef ERRCHECK
24286  if (rc != MB_SUCCESS)
24287  {
24288  fprintf(stderr, "ERROR: Could not create Iterator for 'sold_housing'\n");
24289  switch(rc) {
24290  case MB_ERR_INVALID:
24291  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
24292  break;
24293  case MB_ERR_LOCKED:
24294  fprintf(stderr, "\t reason: 'sold_housing' board is locked\n");
24295  break;
24296  case MB_ERR_MEMALLOC:
24297  fprintf(stderr, "\t reason: out of memory\n");
24298  break;
24299  case MB_ERR_INTERNAL:
24300  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24301  break;
24302  default:
24303 
24304  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
24305 
24306 
24307  break;
24308  }
24309 
24310 
24311  exit(rc);
24312  }
24313  #endif
24314 
24315 
24316 
24318 
24319 
24320  rc = MB_Iterator_Delete(&i_sold_housing);
24321  #ifdef ERRCHECK
24322  if (rc != MB_SUCCESS)
24323  {
24324  fprintf(stderr, "ERROR: Could not delete 'sold_housing' iterator\n");
24325  switch(rc) {
24326  case MB_ERR_INVALID:
24327  fprintf(stderr, "\t reason: 'sold_housing' iterator is invalid\n");
24328  break;
24329  case MB_ERR_INTERNAL:
24330  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24331  break;
24332  default:
24333  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
24334  break;
24335  }
24336 
24337 
24338  exit(rc);
24339  }
24340  #endif
24341 
24342 
24343  if(i == 1)
24344  {
24346  }
24347  else
24348  {
24350  }
24351 
24352 
24353  current_xmachine_firm = NULL;
24354 
24356  }
24357  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_housing_collect_sale_revenues\n");
24358 
24359 
24360  /* If mb is not read then leave sync complete until last possible moment */
24361  if(FLAME_bought_housing_message_board_read == 1)
24362  {
24363  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bought_housing)\n");
24364  rc = MB_SyncComplete(b_bought_housing);
24365  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bought_housing)\n");
24366  #ifdef ERRCHECK
24367  if (rc != MB_SUCCESS)
24368  {
24369  fprintf(stderr, "ERROR: Could not complete sync of 'bought_housing' board\n");
24370  switch(rc) {
24371  case MB_ERR_INVALID:
24372  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
24373  break;
24374  case MB_ERR_MEMALLOC:
24375  fprintf(stderr, "\t reason: out of memory\n");
24376  break;
24377  case MB_ERR_INTERNAL:
24378  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24379  break;
24380  default:
24381  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24382  break;
24383  }
24384 
24385 
24386  exit(rc);
24387  }
24388  #endif
24389 
24390 
24391 
24392  }
24393 
24394  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_buy\n");
24397  {
24401  /* For backwards compatibility set current_xmachine */
24412 
24413 
24414 
24415 
24416 
24417 
24418 
24419 
24421 
24422 
24423 
24424  #ifdef ERRCHECK
24425  if (rc != MB_SUCCESS)
24426  {
24427  fprintf(stderr, "ERROR: Could not create Iterator for 'bought_housing'\n");
24428  switch(rc) {
24429  case MB_ERR_INVALID:
24430  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
24431  break;
24432  case MB_ERR_LOCKED:
24433  fprintf(stderr, "\t reason: 'bought_housing' board is locked\n");
24434  break;
24435  case MB_ERR_MEMALLOC:
24436  fprintf(stderr, "\t reason: out of memory\n");
24437  break;
24438  case MB_ERR_INTERNAL:
24439  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24440  break;
24441  default:
24442 
24443  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
24444 
24445 
24446  break;
24447  }
24448 
24449 
24450  exit(rc);
24451  }
24452  #endif
24453 
24454 
24455 
24456  i = household_housing_buy();
24457 
24458 
24459  rc = MB_Iterator_Delete(&i_bought_housing);
24460  #ifdef ERRCHECK
24461  if (rc != MB_SUCCESS)
24462  {
24463  fprintf(stderr, "ERROR: Could not delete 'bought_housing' iterator\n");
24464  switch(rc) {
24465  case MB_ERR_INVALID:
24466  fprintf(stderr, "\t reason: 'bought_housing' iterator is invalid\n");
24467  break;
24468  case MB_ERR_INTERNAL:
24469  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24470  break;
24471  default:
24472  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
24473  break;
24474  }
24475 
24476 
24477  exit(rc);
24478  }
24479  #endif
24480 
24481 
24482  if(i == 1)
24483  {
24485  }
24486  else
24487  {
24489  }
24490 
24491 
24493 
24495  }
24496  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_buy\n");
24497 
24498 
24499  /* If mb is not read then leave sync complete until last possible moment */
24500  if(FLAME_mortgage_requests_message_board_read == 1)
24501  {
24502  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_requests)\n");
24503  rc = MB_SyncComplete(b_mortgage_requests);
24504  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_requests)\n");
24505  #ifdef ERRCHECK
24506  if (rc != MB_SUCCESS)
24507  {
24508  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_requests' board\n");
24509  switch(rc) {
24510  case MB_ERR_INVALID:
24511  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
24512  break;
24513  case MB_ERR_MEMALLOC:
24514  fprintf(stderr, "\t reason: out of memory\n");
24515  break;
24516  case MB_ERR_INTERNAL:
24517  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24518  break;
24519  default:
24520  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24521  break;
24522  }
24523 
24524 
24525  exit(rc);
24526  }
24527  #endif
24528 
24529 
24530 
24531  }
24532 
24533  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_housing_deliver_mortages\n");
24536  {
24540  /* For backwards compatibility set current_xmachine */
24551 
24552 
24553 
24554 
24555 
24556 
24557 
24558 
24560 
24561 
24562 
24563  #ifdef ERRCHECK
24564  if (rc != MB_SUCCESS)
24565  {
24566  fprintf(stderr, "ERROR: Could not create Iterator for 'mortgage_requests'\n");
24567  switch(rc) {
24568  case MB_ERR_INVALID:
24569  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
24570  break;
24571  case MB_ERR_LOCKED:
24572  fprintf(stderr, "\t reason: 'mortgage_requests' board is locked\n");
24573  break;
24574  case MB_ERR_MEMALLOC:
24575  fprintf(stderr, "\t reason: out of memory\n");
24576  break;
24577  case MB_ERR_INTERNAL:
24578  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24579  break;
24580  default:
24581 
24582  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
24583 
24584 
24585  break;
24586  }
24587 
24588 
24589  exit(rc);
24590  }
24591  #endif
24592 
24593 
24594 
24596 
24597 
24598  rc = MB_Iterator_Delete(&i_mortgage_requests);
24599  #ifdef ERRCHECK
24600  if (rc != MB_SUCCESS)
24601  {
24602  fprintf(stderr, "ERROR: Could not delete 'mortgage_requests' iterator\n");
24603  switch(rc) {
24604  case MB_ERR_INVALID:
24605  fprintf(stderr, "\t reason: 'mortgage_requests' iterator is invalid\n");
24606  break;
24607  case MB_ERR_INTERNAL:
24608  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24609  break;
24610  default:
24611  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
24612  break;
24613  }
24614 
24615 
24616  exit(rc);
24617  }
24618  #endif
24619 
24620 
24621  if(i == 1)
24622  {
24624  }
24625  else
24626  {
24628  }
24629 
24630 
24631  current_xmachine_bank = NULL;
24632 
24634  }
24635  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_housing_deliver_mortages\n");
24636 
24637 
24638 /* End of layer number 52 */
24639 
24640 /* Clear message boards that have finished being used
24641  * and sync complete if doing late sync complete */
24642 
24643 if(FLAME_bought_housing_message_board_read == 0)
24644 {
24645  /*printf("%d> bought_housing message board sync complete late as no agents reading any messages of this type\n", node_number);*/
24646 
24647  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_bought_housing)\n");
24648  rc = MB_SyncComplete(b_bought_housing);
24649  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_bought_housing)\n");
24650  #ifdef ERRCHECK
24651  if (rc != MB_SUCCESS)
24652  {
24653  fprintf(stderr, "ERROR: Could not complete sync of 'bought_housing' board\n");
24654  switch(rc) {
24655  case MB_ERR_INVALID:
24656  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
24657  break;
24658  case MB_ERR_MEMALLOC:
24659  fprintf(stderr, "\t reason: out of memory\n");
24660  break;
24661  case MB_ERR_INTERNAL:
24662  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24663  break;
24664  default:
24665  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24666  break;
24667  }
24668 
24669 
24670  exit(rc);
24671  }
24672  #endif
24673 }
24674 
24675  /* Delete any search trees */
24676 
24677  rc = MB_Clear(b_bought_housing);
24678  #ifdef ERRCHECK
24679  if (rc != MB_SUCCESS)
24680  {
24681  fprintf(stderr, "ERROR: Could not clear 'bought_housing' board\n");
24682  switch(rc) {
24683  case MB_ERR_INVALID:
24684  fprintf(stderr, "\t reason: 'bought_housing' board is invalid\n");
24685  break;
24686  case MB_ERR_LOCKED:
24687  fprintf(stderr, "\t reason: 'bought_housing' board is locked\n");
24688  break;
24689  case MB_ERR_INTERNAL:
24690  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24691  break;
24692  default:
24693  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
24694  break;
24695 
24696  }
24697 
24698 
24699  exit(rc);
24700  }
24701  #endif
24702 
24703 if(FLAME_sold_housing_message_board_read == 0)
24704 {
24705  /*printf("%d> sold_housing message board sync complete late as no agents reading any messages of this type\n", node_number);*/
24706 
24707  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_sold_housing)\n");
24708  rc = MB_SyncComplete(b_sold_housing);
24709  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_sold_housing)\n");
24710  #ifdef ERRCHECK
24711  if (rc != MB_SUCCESS)
24712  {
24713  fprintf(stderr, "ERROR: Could not complete sync of 'sold_housing' board\n");
24714  switch(rc) {
24715  case MB_ERR_INVALID:
24716  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
24717  break;
24718  case MB_ERR_MEMALLOC:
24719  fprintf(stderr, "\t reason: out of memory\n");
24720  break;
24721  case MB_ERR_INTERNAL:
24722  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24723  break;
24724  default:
24725  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24726  break;
24727  }
24728 
24729 
24730  exit(rc);
24731  }
24732  #endif
24733 }
24734 
24735  /* Delete any search trees */
24736 
24737  rc = MB_Clear(b_sold_housing);
24738  #ifdef ERRCHECK
24739  if (rc != MB_SUCCESS)
24740  {
24741  fprintf(stderr, "ERROR: Could not clear 'sold_housing' board\n");
24742  switch(rc) {
24743  case MB_ERR_INVALID:
24744  fprintf(stderr, "\t reason: 'sold_housing' board is invalid\n");
24745  break;
24746  case MB_ERR_LOCKED:
24747  fprintf(stderr, "\t reason: 'sold_housing' board is locked\n");
24748  break;
24749  case MB_ERR_INTERNAL:
24750  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24751  break;
24752  default:
24753  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
24754  break;
24755 
24756  }
24757 
24758 
24759  exit(rc);
24760  }
24761  #endif
24762 
24763 if(FLAME_mortgage_requests_message_board_read == 0)
24764 {
24765  /*printf("%d> mortgage_requests message board sync complete late as no agents reading any messages of this type\n", node_number);*/
24766 
24767  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_requests)\n");
24768  rc = MB_SyncComplete(b_mortgage_requests);
24769  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_requests)\n");
24770  #ifdef ERRCHECK
24771  if (rc != MB_SUCCESS)
24772  {
24773  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_requests' board\n");
24774  switch(rc) {
24775  case MB_ERR_INVALID:
24776  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
24777  break;
24778  case MB_ERR_MEMALLOC:
24779  fprintf(stderr, "\t reason: out of memory\n");
24780  break;
24781  case MB_ERR_INTERNAL:
24782  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24783  break;
24784  default:
24785  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24786  break;
24787  }
24788 
24789 
24790  exit(rc);
24791  }
24792  #endif
24793 }
24794 
24795  /* Delete any search trees */
24796 
24797  rc = MB_Clear(b_mortgage_requests);
24798  #ifdef ERRCHECK
24799  if (rc != MB_SUCCESS)
24800  {
24801  fprintf(stderr, "ERROR: Could not clear 'mortgage_requests' board\n");
24802  switch(rc) {
24803  case MB_ERR_INVALID:
24804  fprintf(stderr, "\t reason: 'mortgage_requests' board is invalid\n");
24805  break;
24806  case MB_ERR_LOCKED:
24807  fprintf(stderr, "\t reason: 'mortgage_requests' board is locked\n");
24808  break;
24809  case MB_ERR_INTERNAL:
24810  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24811  break;
24812  default:
24813  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
24814  break;
24815 
24816  }
24817 
24818 
24819  exit(rc);
24820  }
24821  #endif
24822 
24823  /* DEBUG: States with branching functions */
24826  {
24827  FLAME_debug_count = 0;
24828  /* Function: reagency_check_interest_rate */
24830  { FLAME_debug_count++; }
24831  /* Function: idle */
24833  { FLAME_debug_count++; }
24834  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
24835  if(FLAME_debug_count != 1)
24836  {
24837  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'reagency' leaving state 'REAgencyCreditPolicyChecks'\n");
24838  if(FLAME_debug_count > 1)
24839  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
24840  if(FLAME_debug_count == 0)
24841  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
24842  }
24843 
24845  }
24846 
24847  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
24850  {
24854  /* For backwards compatibility set current_xmachine */
24865 
24867  {
24868 
24869 
24870 
24871  i = idle();
24872 
24873 
24874 
24875  if(i == 1)
24876  {
24878  }
24879  else
24880  {
24882  }
24883  }
24884 
24886 
24888  }
24889  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
24890 
24891 
24892  /* If mb is not read then leave sync complete until last possible moment */
24893  if(FLAME_housing_price_message_board_read == 1)
24894  {
24895  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_housing_price)\n");
24896  rc = MB_SyncComplete(b_housing_price);
24897  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_housing_price)\n");
24898  #ifdef ERRCHECK
24899  if (rc != MB_SUCCESS)
24900  {
24901  fprintf(stderr, "ERROR: Could not complete sync of 'housing_price' board\n");
24902  switch(rc) {
24903  case MB_ERR_INVALID:
24904  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
24905  break;
24906  case MB_ERR_MEMALLOC:
24907  fprintf(stderr, "\t reason: out of memory\n");
24908  break;
24909  case MB_ERR_INTERNAL:
24910  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24911  break;
24912  default:
24913  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
24914  break;
24915  }
24916 
24917 
24918  exit(rc);
24919  }
24920  #endif
24921 
24922 
24923 
24924  }
24925 
24926  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_housing_update_market_price\n");
24929  {
24933  /* For backwards compatibility set current_xmachine */
24944 
24945 
24946 
24947 
24948 
24949 
24950  rc = MB_Iterator_Create(b_housing_price, &i_housing_price);
24951 
24952 
24953  #ifdef ERRCHECK
24954  if (rc != MB_SUCCESS)
24955  {
24956  fprintf(stderr, "ERROR: Could not create Iterator for 'housing_price'\n");
24957  switch(rc) {
24958  case MB_ERR_INVALID:
24959  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
24960  break;
24961  case MB_ERR_LOCKED:
24962  fprintf(stderr, "\t reason: 'housing_price' board is locked\n");
24963  break;
24964  case MB_ERR_MEMALLOC:
24965  fprintf(stderr, "\t reason: out of memory\n");
24966  break;
24967  case MB_ERR_INTERNAL:
24968  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24969  break;
24970  default:
24971 
24972 
24973  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
24974 
24975  break;
24976  }
24977 
24978 
24979  exit(rc);
24980  }
24981  #endif
24982 
24983 
24984 
24986 
24987 
24988  rc = MB_Iterator_Delete(&i_housing_price);
24989  #ifdef ERRCHECK
24990  if (rc != MB_SUCCESS)
24991  {
24992  fprintf(stderr, "ERROR: Could not delete 'housing_price' iterator\n");
24993  switch(rc) {
24994  case MB_ERR_INVALID:
24995  fprintf(stderr, "\t reason: 'housing_price' iterator is invalid\n");
24996  break;
24997  case MB_ERR_INTERNAL:
24998  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
24999  break;
25000  default:
25001  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
25002  break;
25003  }
25004 
25005 
25006  exit(rc);
25007  }
25008  #endif
25009 
25010 
25011  if(i == 1)
25012  {
25014  }
25015  else
25016  {
25018  }
25019 
25020 
25021  current_xmachine_firm = NULL;
25022 
25024  }
25025  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_housing_update_market_price\n");
25026 
25027 
25028  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_update_market_price\n");
25031  {
25035  /* For backwards compatibility set current_xmachine */
25046 
25047 
25048 
25049 
25050 
25051 
25052  rc = MB_Iterator_Create(b_housing_price, &i_housing_price);
25053 
25054 
25055  #ifdef ERRCHECK
25056  if (rc != MB_SUCCESS)
25057  {
25058  fprintf(stderr, "ERROR: Could not create Iterator for 'housing_price'\n");
25059  switch(rc) {
25060  case MB_ERR_INVALID:
25061  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
25062  break;
25063  case MB_ERR_LOCKED:
25064  fprintf(stderr, "\t reason: 'housing_price' board is locked\n");
25065  break;
25066  case MB_ERR_MEMALLOC:
25067  fprintf(stderr, "\t reason: out of memory\n");
25068  break;
25069  case MB_ERR_INTERNAL:
25070  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25071  break;
25072  default:
25073 
25074 
25075  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
25076 
25077  break;
25078  }
25079 
25080 
25081  exit(rc);
25082  }
25083  #endif
25084 
25085 
25086 
25088 
25089 
25090  rc = MB_Iterator_Delete(&i_housing_price);
25091  #ifdef ERRCHECK
25092  if (rc != MB_SUCCESS)
25093  {
25094  fprintf(stderr, "ERROR: Could not delete 'housing_price' iterator\n");
25095  switch(rc) {
25096  case MB_ERR_INVALID:
25097  fprintf(stderr, "\t reason: 'housing_price' iterator is invalid\n");
25098  break;
25099  case MB_ERR_INTERNAL:
25100  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25101  break;
25102  default:
25103  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
25104  break;
25105  }
25106 
25107 
25108  exit(rc);
25109  }
25110  #endif
25111 
25112 
25113  if(i == 1)
25114  {
25116  }
25117  else
25118  {
25120  }
25121 
25122 
25124 
25126  }
25127  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_update_market_price\n");
25128 
25129 
25130  /* If mb is not read then leave sync complete until last possible moment */
25131  if(FLAME_housing_transactions_summary_message_board_read == 1)
25132  {
25133  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_housing_transactions_summary)\n");
25134  rc = MB_SyncComplete(b_housing_transactions_summary);
25135  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_housing_transactions_summary)\n");
25136  #ifdef ERRCHECK
25137  if (rc != MB_SUCCESS)
25138  {
25139  fprintf(stderr, "ERROR: Could not complete sync of 'housing_transactions_summary' board\n");
25140  switch(rc) {
25141  case MB_ERR_INVALID:
25142  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
25143  break;
25144  case MB_ERR_MEMALLOC:
25145  fprintf(stderr, "\t reason: out of memory\n");
25146  break;
25147  case MB_ERR_INTERNAL:
25148  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25149  break;
25150  default:
25151  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
25152  break;
25153  }
25154 
25155 
25156  exit(rc);
25157  }
25158  #endif
25159 
25160 
25161 
25162  }
25163 
25164  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_trace_housing_prices\n");
25167  {
25171  /* For backwards compatibility set current_xmachine */
25182 
25184  {
25185 
25186 
25187 
25188 
25190 
25191 
25192  #ifdef ERRCHECK
25193  if (rc != MB_SUCCESS)
25194  {
25195  fprintf(stderr, "ERROR: Could not create Iterator for 'housing_transactions_summary'\n");
25196  switch(rc) {
25197  case MB_ERR_INVALID:
25198  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
25199  break;
25200  case MB_ERR_LOCKED:
25201  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is locked\n");
25202  break;
25203  case MB_ERR_MEMALLOC:
25204  fprintf(stderr, "\t reason: out of memory\n");
25205  break;
25206  case MB_ERR_INTERNAL:
25207  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25208  break;
25209  default:
25210 
25211 
25212  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
25213 
25214  break;
25215  }
25216 
25217 
25218  exit(rc);
25219  }
25220  #endif
25221 
25222 
25223 
25225 
25226 
25227  rc = MB_Iterator_Delete(&i_housing_transactions_summary);
25228  #ifdef ERRCHECK
25229  if (rc != MB_SUCCESS)
25230  {
25231  fprintf(stderr, "ERROR: Could not delete 'housing_transactions_summary' iterator\n");
25232  switch(rc) {
25233  case MB_ERR_INVALID:
25234  fprintf(stderr, "\t reason: 'housing_transactions_summary' iterator is invalid\n");
25235  break;
25236  case MB_ERR_INTERNAL:
25237  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25238  break;
25239  default:
25240  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
25241  break;
25242  }
25243 
25244 
25245  exit(rc);
25246  }
25247  #endif
25248 
25249 
25250  if(i == 1)
25251  {
25253  }
25254  else
25255  {
25257  }
25258  }
25259 
25261 
25263  }
25264  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_trace_housing_prices\n");
25265 
25266 
25267  /* If mb is not read then leave sync complete until last possible moment */
25268  if(FLAME_mortgage_payment_from_sale_message_board_read == 1)
25269  {
25270  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_payment_from_sale)\n");
25271  rc = MB_SyncComplete(b_mortgage_payment_from_sale);
25272  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_payment_from_sale)\n");
25273  #ifdef ERRCHECK
25274  if (rc != MB_SUCCESS)
25275  {
25276  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_payment_from_sale' board\n");
25277  switch(rc) {
25278  case MB_ERR_INVALID:
25279  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
25280  break;
25281  case MB_ERR_MEMALLOC:
25282  fprintf(stderr, "\t reason: out of memory\n");
25283  break;
25284  case MB_ERR_INTERNAL:
25285  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25286  break;
25287  default:
25288  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
25289  break;
25290  }
25291 
25292 
25293  exit(rc);
25294  }
25295  #endif
25296 
25297 
25298 
25299  }
25300 
25301  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_housing_recieve_mortgage_principals\n");
25304  {
25308  /* For backwards compatibility set current_xmachine */
25319 
25320 
25321 
25322 
25323 
25324 
25325 
25326 
25328 
25329 
25330 
25331  #ifdef ERRCHECK
25332  if (rc != MB_SUCCESS)
25333  {
25334  fprintf(stderr, "ERROR: Could not create Iterator for 'mortgage_payment_from_sale'\n");
25335  switch(rc) {
25336  case MB_ERR_INVALID:
25337  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
25338  break;
25339  case MB_ERR_LOCKED:
25340  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is locked\n");
25341  break;
25342  case MB_ERR_MEMALLOC:
25343  fprintf(stderr, "\t reason: out of memory\n");
25344  break;
25345  case MB_ERR_INTERNAL:
25346  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25347  break;
25348  default:
25349 
25350  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
25351 
25352 
25353  break;
25354  }
25355 
25356 
25357  exit(rc);
25358  }
25359  #endif
25360 
25361 
25362 
25364 
25365 
25366  rc = MB_Iterator_Delete(&i_mortgage_payment_from_sale);
25367  #ifdef ERRCHECK
25368  if (rc != MB_SUCCESS)
25369  {
25370  fprintf(stderr, "ERROR: Could not delete 'mortgage_payment_from_sale' iterator\n");
25371  switch(rc) {
25372  case MB_ERR_INVALID:
25373  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' iterator is invalid\n");
25374  break;
25375  case MB_ERR_INTERNAL:
25376  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25377  break;
25378  default:
25379  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
25380  break;
25381  }
25382 
25383 
25384  exit(rc);
25385  }
25386  #endif
25387 
25388 
25389  if(i == 1)
25390  {
25392  }
25393  else
25394  {
25396  }
25397 
25398 
25399  current_xmachine_bank = NULL;
25400 
25402  }
25403  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_housing_recieve_mortgage_principals\n");
25404 
25405 
25406 /* End of layer number 53 */
25407 
25408 /* Clear message boards that have finished being used
25409  * and sync complete if doing late sync complete */
25410 
25411 if(FLAME_housing_price_message_board_read == 0)
25412 {
25413  /*printf("%d> housing_price message board sync complete late as no agents reading any messages of this type\n", node_number);*/
25414 
25415  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_housing_price)\n");
25416  rc = MB_SyncComplete(b_housing_price);
25417  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_housing_price)\n");
25418  #ifdef ERRCHECK
25419  if (rc != MB_SUCCESS)
25420  {
25421  fprintf(stderr, "ERROR: Could not complete sync of 'housing_price' board\n");
25422  switch(rc) {
25423  case MB_ERR_INVALID:
25424  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
25425  break;
25426  case MB_ERR_MEMALLOC:
25427  fprintf(stderr, "\t reason: out of memory\n");
25428  break;
25429  case MB_ERR_INTERNAL:
25430  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25431  break;
25432  default:
25433  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
25434  break;
25435  }
25436 
25437 
25438  exit(rc);
25439  }
25440  #endif
25441 }
25442 
25443  /* Delete any search trees */
25444 
25445  rc = MB_Clear(b_housing_price);
25446  #ifdef ERRCHECK
25447  if (rc != MB_SUCCESS)
25448  {
25449  fprintf(stderr, "ERROR: Could not clear 'housing_price' board\n");
25450  switch(rc) {
25451  case MB_ERR_INVALID:
25452  fprintf(stderr, "\t reason: 'housing_price' board is invalid\n");
25453  break;
25454  case MB_ERR_LOCKED:
25455  fprintf(stderr, "\t reason: 'housing_price' board is locked\n");
25456  break;
25457  case MB_ERR_INTERNAL:
25458  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25459  break;
25460  default:
25461  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
25462  break;
25463 
25464  }
25465 
25466 
25467  exit(rc);
25468  }
25469  #endif
25470 
25471 if(FLAME_mortgage_payment_from_sale_message_board_read == 0)
25472 {
25473  /*printf("%d> mortgage_payment_from_sale message board sync complete late as no agents reading any messages of this type\n", node_number);*/
25474 
25475  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_payment_from_sale)\n");
25476  rc = MB_SyncComplete(b_mortgage_payment_from_sale);
25477  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_payment_from_sale)\n");
25478  #ifdef ERRCHECK
25479  if (rc != MB_SUCCESS)
25480  {
25481  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_payment_from_sale' board\n");
25482  switch(rc) {
25483  case MB_ERR_INVALID:
25484  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
25485  break;
25486  case MB_ERR_MEMALLOC:
25487  fprintf(stderr, "\t reason: out of memory\n");
25488  break;
25489  case MB_ERR_INTERNAL:
25490  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25491  break;
25492  default:
25493  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
25494  break;
25495  }
25496 
25497 
25498  exit(rc);
25499  }
25500  #endif
25501 }
25502 
25503  /* Delete any search trees */
25504 
25505  rc = MB_Clear(b_mortgage_payment_from_sale);
25506  #ifdef ERRCHECK
25507  if (rc != MB_SUCCESS)
25508  {
25509  fprintf(stderr, "ERROR: Could not clear 'mortgage_payment_from_sale' board\n");
25510  switch(rc) {
25511  case MB_ERR_INVALID:
25512  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is invalid\n");
25513  break;
25514  case MB_ERR_LOCKED:
25515  fprintf(stderr, "\t reason: 'mortgage_payment_from_sale' board is locked\n");
25516  break;
25517  case MB_ERR_INTERNAL:
25518  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25519  break;
25520  default:
25521  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
25522  break;
25523 
25524  }
25525 
25526 
25527  exit(rc);
25528  }
25529  #endif
25530 
25531 if(FLAME_housing_transactions_summary_message_board_read == 0)
25532 {
25533  /*printf("%d> housing_transactions_summary message board sync complete late as no agents reading any messages of this type\n", node_number);*/
25534 
25535  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_housing_transactions_summary)\n");
25536  rc = MB_SyncComplete(b_housing_transactions_summary);
25537  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_housing_transactions_summary)\n");
25538  #ifdef ERRCHECK
25539  if (rc != MB_SUCCESS)
25540  {
25541  fprintf(stderr, "ERROR: Could not complete sync of 'housing_transactions_summary' board\n");
25542  switch(rc) {
25543  case MB_ERR_INVALID:
25544  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
25545  break;
25546  case MB_ERR_MEMALLOC:
25547  fprintf(stderr, "\t reason: out of memory\n");
25548  break;
25549  case MB_ERR_INTERNAL:
25550  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25551  break;
25552  default:
25553  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
25554  break;
25555  }
25556 
25557 
25558  exit(rc);
25559  }
25560  #endif
25561 }
25562 
25563  /* Delete any search trees */
25564 
25565  rc = MB_Clear(b_housing_transactions_summary);
25566  #ifdef ERRCHECK
25567  if (rc != MB_SUCCESS)
25568  {
25569  fprintf(stderr, "ERROR: Could not clear 'housing_transactions_summary' board\n");
25570  switch(rc) {
25571  case MB_ERR_INVALID:
25572  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is invalid\n");
25573  break;
25574  case MB_ERR_LOCKED:
25575  fprintf(stderr, "\t reason: 'housing_transactions_summary' board is locked\n");
25576  break;
25577  case MB_ERR_INTERNAL:
25578  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25579  break;
25580  default:
25581  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
25582  break;
25583 
25584  }
25585 
25586 
25587  exit(rc);
25588  }
25589  #endif
25590 
25591  /* DEBUG: States with branching functions */
25594  {
25595  FLAME_debug_count = 0;
25596  /* Function: firm_labour_pay_wages */
25598  { FLAME_debug_count++; }
25599  /* Function: idle */
25601  { FLAME_debug_count++; }
25602  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
25603  if(FLAME_debug_count != 1)
25604  {
25605  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmLabourPayWages'\n");
25606  if(FLAME_debug_count > 1)
25607  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
25608  if(FLAME_debug_count == 0)
25609  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
25610  }
25611 
25613  }
25614  /* DEBUG: States with branching functions */
25617  {
25618  FLAME_debug_count = 0;
25619  /* Function: centralbank_trace_unemployment_status */
25621  { FLAME_debug_count++; }
25622  /* Function: idle */
25624  { FLAME_debug_count++; }
25625  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
25626  if(FLAME_debug_count != 1)
25627  {
25628  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'centralbank' leaving state 'CentralBankLabour'\n");
25629  if(FLAME_debug_count > 1)
25630  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
25631  if(FLAME_debug_count == 0)
25632  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
25633  }
25634 
25636  }
25637 
25638  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_pay_mortgages\n");
25641  {
25645  /* For backwards compatibility set current_xmachine */
25656 
25657 
25658 
25659 
25660 
25662 
25663 
25664 
25665  if(i == 1)
25666  {
25668  }
25669  else
25670  {
25672  }
25673 
25674 
25676 
25678  }
25679  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_pay_mortgages\n");
25680 
25681  if(FLAME_mortgage_payment_message_board_write == 1)
25682  {
25683 
25684  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_payment)\n");
25685  rc = MB_SyncStart(b_mortgage_payment);
25686  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_payment)\n");
25687  #ifdef ERRCHECK
25688  if (rc != MB_SUCCESS)
25689  {
25690  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_payment' board\n");
25691  switch(rc) {
25692  case MB_ERR_INVALID:
25693  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
25694  break;
25695  case MB_ERR_LOCKED:
25696  fprintf(stderr, "\t reason: 'mortgage_payment' board is locked\n");
25697  break;
25698  case MB_ERR_MEMALLOC:
25699  fprintf(stderr, "\t reason: out of memory\n");
25700  break;
25701  case MB_ERR_INTERNAL:
25702  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25703  break;
25704  default:
25705  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
25706  break;
25707  }
25708 
25709 
25710  exit(rc);
25711  }
25712  #endif
25713  }
25714 
25715 
25716 
25717  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_pay_wages\n");
25720  {
25724  /* For backwards compatibility set current_xmachine */
25735 
25737  {
25738 
25739 
25740 
25741  i = firm_labour_pay_wages();
25742 
25743 
25744 
25745  if(i == 1)
25746  {
25748  }
25749  else
25750  {
25752  }
25753  }
25754 
25755  current_xmachine_firm = NULL;
25756 
25758  }
25759  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_pay_wages\n");
25760 
25761  if(FLAME_labour_tax_message_board_write == 1)
25762  {
25763 
25764  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_labour_tax)\n");
25765  rc = MB_SyncStart(b_labour_tax);
25766  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_labour_tax)\n");
25767  #ifdef ERRCHECK
25768  if (rc != MB_SUCCESS)
25769  {
25770  fprintf(stderr, "ERROR: Could not start sync of 'labour_tax' board\n");
25771  switch(rc) {
25772  case MB_ERR_INVALID:
25773  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
25774  break;
25775  case MB_ERR_LOCKED:
25776  fprintf(stderr, "\t reason: 'labour_tax' board is locked\n");
25777  break;
25778  case MB_ERR_MEMALLOC:
25779  fprintf(stderr, "\t reason: out of memory\n");
25780  break;
25781  case MB_ERR_INTERNAL:
25782  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25783  break;
25784  default:
25785  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
25786  break;
25787  }
25788 
25789 
25790  exit(rc);
25791  }
25792  #endif
25793  }
25794 
25795 
25796  if(FLAME_firm_household_wage_payment_message_board_write == 1)
25797  {
25798 
25799  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_household_wage_payment)\n");
25800  rc = MB_SyncStart(b_firm_household_wage_payment);
25801  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_household_wage_payment)\n");
25802  #ifdef ERRCHECK
25803  if (rc != MB_SUCCESS)
25804  {
25805  fprintf(stderr, "ERROR: Could not start sync of 'firm_household_wage_payment' board\n");
25806  switch(rc) {
25807  case MB_ERR_INVALID:
25808  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
25809  break;
25810  case MB_ERR_LOCKED:
25811  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is locked\n");
25812  break;
25813  case MB_ERR_MEMALLOC:
25814  fprintf(stderr, "\t reason: out of memory\n");
25815  break;
25816  case MB_ERR_INTERNAL:
25817  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25818  break;
25819  default:
25820  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
25821  break;
25822  }
25823 
25824 
25825  exit(rc);
25826  }
25827  #endif
25828  }
25829 
25830 
25831 
25832  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
25835  {
25839  /* For backwards compatibility set current_xmachine */
25850 
25852  {
25853 
25854 
25855 
25856  i = idle();
25857 
25858 
25859 
25860  if(i == 1)
25861  {
25863  }
25864  else
25865  {
25867  }
25868  }
25869 
25871 
25873  }
25874  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
25875 
25876 
25877  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
25880  {
25884  /* For backwards compatibility set current_xmachine */
25895 
25897  {
25898 
25899 
25900 
25901  i = idle();
25902 
25903 
25904 
25905  if(i == 1)
25906  {
25908  }
25909  else
25910  {
25912  }
25913  }
25914 
25915  current_xmachine_firm = NULL;
25916 
25918  }
25919  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
25920 
25921 
25922 /* End of layer number 54 */
25923 
25924 /* Clear message boards that have finished being used
25925  * and sync complete if doing late sync complete */
25926 
25927 
25928  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_housing_debt_writeoff\n");
25931  {
25935  /* For backwards compatibility set current_xmachine */
25946 
25947 
25948 
25949 
25950 
25952 
25953 
25954 
25955  if(i == 1)
25956  {
25958  }
25959  else
25960  {
25962  }
25963 
25964 
25966 
25968  }
25969  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_housing_debt_writeoff\n");
25970 
25971  if(FLAME_mortgage_writeoff_message_board_write == 1)
25972  {
25973 
25974  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_mortgage_writeoff)\n");
25975  rc = MB_SyncStart(b_mortgage_writeoff);
25976  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_mortgage_writeoff)\n");
25977  #ifdef ERRCHECK
25978  if (rc != MB_SUCCESS)
25979  {
25980  fprintf(stderr, "ERROR: Could not start sync of 'mortgage_writeoff' board\n");
25981  switch(rc) {
25982  case MB_ERR_INVALID:
25983  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
25984  break;
25985  case MB_ERR_LOCKED:
25986  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is locked\n");
25987  break;
25988  case MB_ERR_MEMALLOC:
25989  fprintf(stderr, "\t reason: out of memory\n");
25990  break;
25991  case MB_ERR_INTERNAL:
25992  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
25993  break;
25994  default:
25995  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
25996  break;
25997  }
25998 
25999 
26000  exit(rc);
26001  }
26002  #endif
26003  }
26004 
26005 
26006 
26007  /* If mb is not read then leave sync complete until last possible moment */
26008  if(FLAME_mortgage_payment_message_board_read == 1)
26009  {
26010  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_payment)\n");
26011  rc = MB_SyncComplete(b_mortgage_payment);
26012  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_payment)\n");
26013  #ifdef ERRCHECK
26014  if (rc != MB_SUCCESS)
26015  {
26016  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_payment' board\n");
26017  switch(rc) {
26018  case MB_ERR_INVALID:
26019  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
26020  break;
26021  case MB_ERR_MEMALLOC:
26022  fprintf(stderr, "\t reason: out of memory\n");
26023  break;
26024  case MB_ERR_INTERNAL:
26025  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26026  break;
26027  default:
26028  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26029  break;
26030  }
26031 
26032 
26033  exit(rc);
26034  }
26035  #endif
26036 
26037 
26038 
26039  }
26040 
26041  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_housing_recieve_mortgages\n");
26044  {
26048  /* For backwards compatibility set current_xmachine */
26059 
26060 
26061 
26062 
26063 
26064 
26065 
26066 
26068 
26069 
26070 
26071  #ifdef ERRCHECK
26072  if (rc != MB_SUCCESS)
26073  {
26074  fprintf(stderr, "ERROR: Could not create Iterator for 'mortgage_payment'\n");
26075  switch(rc) {
26076  case MB_ERR_INVALID:
26077  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
26078  break;
26079  case MB_ERR_LOCKED:
26080  fprintf(stderr, "\t reason: 'mortgage_payment' board is locked\n");
26081  break;
26082  case MB_ERR_MEMALLOC:
26083  fprintf(stderr, "\t reason: out of memory\n");
26084  break;
26085  case MB_ERR_INTERNAL:
26086  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26087  break;
26088  default:
26089 
26090  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
26091 
26092 
26093  break;
26094  }
26095 
26096 
26097  exit(rc);
26098  }
26099  #endif
26100 
26101 
26102 
26104 
26105 
26106  rc = MB_Iterator_Delete(&i_mortgage_payment);
26107  #ifdef ERRCHECK
26108  if (rc != MB_SUCCESS)
26109  {
26110  fprintf(stderr, "ERROR: Could not delete 'mortgage_payment' iterator\n");
26111  switch(rc) {
26112  case MB_ERR_INVALID:
26113  fprintf(stderr, "\t reason: 'mortgage_payment' iterator is invalid\n");
26114  break;
26115  case MB_ERR_INTERNAL:
26116  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26117  break;
26118  default:
26119  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
26120  break;
26121  }
26122 
26123 
26124  exit(rc);
26125  }
26126  #endif
26127 
26128 
26129  if(i == 1)
26130  {
26132  }
26133  else
26134  {
26136  }
26137 
26138 
26139  current_xmachine_bank = NULL;
26140 
26142  }
26143  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_housing_recieve_mortgages\n");
26144 
26145 
26146  /* If mb is not read then leave sync complete until last possible moment */
26147  if(FLAME_labour_tax_message_board_read == 1)
26148  {
26149  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_labour_tax)\n");
26150  rc = MB_SyncComplete(b_labour_tax);
26151  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_labour_tax)\n");
26152  #ifdef ERRCHECK
26153  if (rc != MB_SUCCESS)
26154  {
26155  fprintf(stderr, "ERROR: Could not complete sync of 'labour_tax' board\n");
26156  switch(rc) {
26157  case MB_ERR_INVALID:
26158  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
26159  break;
26160  case MB_ERR_MEMALLOC:
26161  fprintf(stderr, "\t reason: out of memory\n");
26162  break;
26163  case MB_ERR_INTERNAL:
26164  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26165  break;
26166  default:
26167  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26168  break;
26169  }
26170 
26171 
26172  exit(rc);
26173  }
26174  #endif
26175 
26176 
26177 
26178  }
26179 
26180  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_collect_labour_tax\n");
26183  {
26187  /* For backwards compatibility set current_xmachine */
26198 
26199 
26200 
26201 
26202 
26203 
26204  rc = MB_Iterator_Create(b_labour_tax, &i_labour_tax);
26205 
26206 
26207  #ifdef ERRCHECK
26208  if (rc != MB_SUCCESS)
26209  {
26210  fprintf(stderr, "ERROR: Could not create Iterator for 'labour_tax'\n");
26211  switch(rc) {
26212  case MB_ERR_INVALID:
26213  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
26214  break;
26215  case MB_ERR_LOCKED:
26216  fprintf(stderr, "\t reason: 'labour_tax' board is locked\n");
26217  break;
26218  case MB_ERR_MEMALLOC:
26219  fprintf(stderr, "\t reason: out of memory\n");
26220  break;
26221  case MB_ERR_INTERNAL:
26222  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26223  break;
26224  default:
26225 
26226 
26227  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
26228 
26229  break;
26230  }
26231 
26232 
26233  exit(rc);
26234  }
26235  #endif
26236 
26237 
26238 
26240 
26241 
26242  rc = MB_Iterator_Delete(&i_labour_tax);
26243  #ifdef ERRCHECK
26244  if (rc != MB_SUCCESS)
26245  {
26246  fprintf(stderr, "ERROR: Could not delete 'labour_tax' iterator\n");
26247  switch(rc) {
26248  case MB_ERR_INVALID:
26249  fprintf(stderr, "\t reason: 'labour_tax' iterator is invalid\n");
26250  break;
26251  case MB_ERR_INTERNAL:
26252  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26253  break;
26254  default:
26255  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
26256  break;
26257  }
26258 
26259 
26260  exit(rc);
26261  }
26262  #endif
26263 
26264 
26265  if(i == 1)
26266  {
26268  }
26269  else
26270  {
26272  }
26273 
26274 
26276 
26278  }
26279  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_collect_labour_tax\n");
26280 
26281 
26282 /* End of layer number 55 */
26283 
26284 /* Clear message boards that have finished being used
26285  * and sync complete if doing late sync complete */
26286 
26287 if(FLAME_labour_tax_message_board_read == 0)
26288 {
26289  /*printf("%d> labour_tax message board sync complete late as no agents reading any messages of this type\n", node_number);*/
26290 
26291  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_labour_tax)\n");
26292  rc = MB_SyncComplete(b_labour_tax);
26293  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_labour_tax)\n");
26294  #ifdef ERRCHECK
26295  if (rc != MB_SUCCESS)
26296  {
26297  fprintf(stderr, "ERROR: Could not complete sync of 'labour_tax' board\n");
26298  switch(rc) {
26299  case MB_ERR_INVALID:
26300  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
26301  break;
26302  case MB_ERR_MEMALLOC:
26303  fprintf(stderr, "\t reason: out of memory\n");
26304  break;
26305  case MB_ERR_INTERNAL:
26306  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26307  break;
26308  default:
26309  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26310  break;
26311  }
26312 
26313 
26314  exit(rc);
26315  }
26316  #endif
26317 }
26318 
26319  /* Delete any search trees */
26320 
26321  rc = MB_Clear(b_labour_tax);
26322  #ifdef ERRCHECK
26323  if (rc != MB_SUCCESS)
26324  {
26325  fprintf(stderr, "ERROR: Could not clear 'labour_tax' board\n");
26326  switch(rc) {
26327  case MB_ERR_INVALID:
26328  fprintf(stderr, "\t reason: 'labour_tax' board is invalid\n");
26329  break;
26330  case MB_ERR_LOCKED:
26331  fprintf(stderr, "\t reason: 'labour_tax' board is locked\n");
26332  break;
26333  case MB_ERR_INTERNAL:
26334  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26335  break;
26336  default:
26337  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
26338  break;
26339 
26340  }
26341 
26342 
26343  exit(rc);
26344  }
26345  #endif
26346 
26347 if(FLAME_mortgage_payment_message_board_read == 0)
26348 {
26349  /*printf("%d> mortgage_payment message board sync complete late as no agents reading any messages of this type\n", node_number);*/
26350 
26351  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_payment)\n");
26352  rc = MB_SyncComplete(b_mortgage_payment);
26353  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_payment)\n");
26354  #ifdef ERRCHECK
26355  if (rc != MB_SUCCESS)
26356  {
26357  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_payment' board\n");
26358  switch(rc) {
26359  case MB_ERR_INVALID:
26360  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
26361  break;
26362  case MB_ERR_MEMALLOC:
26363  fprintf(stderr, "\t reason: out of memory\n");
26364  break;
26365  case MB_ERR_INTERNAL:
26366  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26367  break;
26368  default:
26369  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26370  break;
26371  }
26372 
26373 
26374  exit(rc);
26375  }
26376  #endif
26377 }
26378 
26379  /* Delete any search trees */
26380 
26381  rc = MB_Clear(b_mortgage_payment);
26382  #ifdef ERRCHECK
26383  if (rc != MB_SUCCESS)
26384  {
26385  fprintf(stderr, "ERROR: Could not clear 'mortgage_payment' board\n");
26386  switch(rc) {
26387  case MB_ERR_INVALID:
26388  fprintf(stderr, "\t reason: 'mortgage_payment' board is invalid\n");
26389  break;
26390  case MB_ERR_LOCKED:
26391  fprintf(stderr, "\t reason: 'mortgage_payment' board is locked\n");
26392  break;
26393  case MB_ERR_INTERNAL:
26394  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26395  break;
26396  default:
26397  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
26398  break;
26399 
26400  }
26401 
26402 
26403  exit(rc);
26404  }
26405  #endif
26406 
26407  /* DEBUG: States with branching functions */
26410  {
26411  FLAME_debug_count = 0;
26412  /* Function: household_labour_receive_wage */
26414  { FLAME_debug_count++; }
26415  /* Function: idle */
26417  { FLAME_debug_count++; }
26418  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
26419  if(FLAME_debug_count != 1)
26420  {
26421  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHLabourPayroll'\n");
26422  if(FLAME_debug_count > 1)
26423  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
26424  if(FLAME_debug_count == 0)
26425  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
26426  }
26427 
26429  }
26430 
26431  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
26434  {
26438  /* For backwards compatibility set current_xmachine */
26449 
26451  {
26452 
26453 
26454 
26455  i = idle();
26456 
26457 
26458 
26459  if(i == 1)
26460  {
26462  }
26463  else
26464  {
26466  }
26467  }
26468 
26470 
26472  }
26473  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
26474 
26475 
26476  /* If mb is not read then leave sync complete until last possible moment */
26477  if(FLAME_firm_household_wage_payment_message_board_read == 1)
26478  {
26479  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_household_wage_payment)\n");
26480  rc = MB_SyncComplete(b_firm_household_wage_payment);
26481  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_household_wage_payment)\n");
26482  #ifdef ERRCHECK
26483  if (rc != MB_SUCCESS)
26484  {
26485  fprintf(stderr, "ERROR: Could not complete sync of 'firm_household_wage_payment' board\n");
26486  switch(rc) {
26487  case MB_ERR_INVALID:
26488  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
26489  break;
26490  case MB_ERR_MEMALLOC:
26491  fprintf(stderr, "\t reason: out of memory\n");
26492  break;
26493  case MB_ERR_INTERNAL:
26494  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26495  break;
26496  default:
26497  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26498  break;
26499  }
26500 
26501 
26502  exit(rc);
26503  }
26504  #endif
26505 
26506 
26507 
26508  }
26509 
26510  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_receive_wage\n");
26513  {
26517  /* For backwards compatibility set current_xmachine */
26528 
26530  {
26531 
26532 
26533 
26534 
26535 
26536 
26538 
26539 
26540 
26541  #ifdef ERRCHECK
26542  if (rc != MB_SUCCESS)
26543  {
26544  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_household_wage_payment'\n");
26545  switch(rc) {
26546  case MB_ERR_INVALID:
26547  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
26548  break;
26549  case MB_ERR_LOCKED:
26550  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is locked\n");
26551  break;
26552  case MB_ERR_MEMALLOC:
26553  fprintf(stderr, "\t reason: out of memory\n");
26554  break;
26555  case MB_ERR_INTERNAL:
26556  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26557  break;
26558  default:
26559 
26560  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
26561 
26562 
26563  break;
26564  }
26565 
26566 
26567  exit(rc);
26568  }
26569  #endif
26570 
26571 
26572 
26574 
26575 
26576  rc = MB_Iterator_Delete(&i_firm_household_wage_payment);
26577  #ifdef ERRCHECK
26578  if (rc != MB_SUCCESS)
26579  {
26580  fprintf(stderr, "ERROR: Could not delete 'firm_household_wage_payment' iterator\n");
26581  switch(rc) {
26582  case MB_ERR_INVALID:
26583  fprintf(stderr, "\t reason: 'firm_household_wage_payment' iterator is invalid\n");
26584  break;
26585  case MB_ERR_INTERNAL:
26586  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26587  break;
26588  default:
26589  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
26590  break;
26591  }
26592 
26593 
26594  exit(rc);
26595  }
26596  #endif
26597 
26598 
26599  if(i == 1)
26600  {
26602  }
26603  else
26604  {
26606  }
26607  }
26608 
26610 
26612  }
26613  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_receive_wage\n");
26614 
26615 
26616  /* If mb is not read then leave sync complete until last possible moment */
26617  if(FLAME_mortgage_writeoff_message_board_read == 1)
26618  {
26619  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_writeoff)\n");
26620  rc = MB_SyncComplete(b_mortgage_writeoff);
26621  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_writeoff)\n");
26622  #ifdef ERRCHECK
26623  if (rc != MB_SUCCESS)
26624  {
26625  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_writeoff' board\n");
26626  switch(rc) {
26627  case MB_ERR_INVALID:
26628  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
26629  break;
26630  case MB_ERR_MEMALLOC:
26631  fprintf(stderr, "\t reason: out of memory\n");
26632  break;
26633  case MB_ERR_INTERNAL:
26634  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26635  break;
26636  default:
26637  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26638  break;
26639  }
26640 
26641 
26642  exit(rc);
26643  }
26644  #endif
26645 
26646 
26647 
26648  }
26649 
26650  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_housing_debt_writeoff\n");
26653  {
26657  /* For backwards compatibility set current_xmachine */
26668 
26669 
26670 
26671 
26672 
26673 
26674 
26675 
26677 
26678 
26679 
26680  #ifdef ERRCHECK
26681  if (rc != MB_SUCCESS)
26682  {
26683  fprintf(stderr, "ERROR: Could not create Iterator for 'mortgage_writeoff'\n");
26684  switch(rc) {
26685  case MB_ERR_INVALID:
26686  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
26687  break;
26688  case MB_ERR_LOCKED:
26689  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is locked\n");
26690  break;
26691  case MB_ERR_MEMALLOC:
26692  fprintf(stderr, "\t reason: out of memory\n");
26693  break;
26694  case MB_ERR_INTERNAL:
26695  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26696  break;
26697  default:
26698 
26699  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
26700 
26701 
26702  break;
26703  }
26704 
26705 
26706  exit(rc);
26707  }
26708  #endif
26709 
26710 
26711 
26713 
26714 
26715  rc = MB_Iterator_Delete(&i_mortgage_writeoff);
26716  #ifdef ERRCHECK
26717  if (rc != MB_SUCCESS)
26718  {
26719  fprintf(stderr, "ERROR: Could not delete 'mortgage_writeoff' iterator\n");
26720  switch(rc) {
26721  case MB_ERR_INVALID:
26722  fprintf(stderr, "\t reason: 'mortgage_writeoff' iterator is invalid\n");
26723  break;
26724  case MB_ERR_INTERNAL:
26725  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26726  break;
26727  default:
26728  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
26729  break;
26730  }
26731 
26732 
26733  exit(rc);
26734  }
26735  #endif
26736 
26737 
26738  if(i == 1)
26739  {
26741  }
26742  else
26743  {
26745  }
26746 
26747 
26748  current_xmachine_bank = NULL;
26749 
26751  }
26752  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_housing_debt_writeoff\n");
26753 
26754 
26755 /* End of layer number 56 */
26756 
26757 /* Clear message boards that have finished being used
26758  * and sync complete if doing late sync complete */
26759 
26760 if(FLAME_firm_household_wage_payment_message_board_read == 0)
26761 {
26762  /*printf("%d> firm_household_wage_payment message board sync complete late as no agents reading any messages of this type\n", node_number);*/
26763 
26764  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_household_wage_payment)\n");
26765  rc = MB_SyncComplete(b_firm_household_wage_payment);
26766  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_household_wage_payment)\n");
26767  #ifdef ERRCHECK
26768  if (rc != MB_SUCCESS)
26769  {
26770  fprintf(stderr, "ERROR: Could not complete sync of 'firm_household_wage_payment' board\n");
26771  switch(rc) {
26772  case MB_ERR_INVALID:
26773  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
26774  break;
26775  case MB_ERR_MEMALLOC:
26776  fprintf(stderr, "\t reason: out of memory\n");
26777  break;
26778  case MB_ERR_INTERNAL:
26779  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26780  break;
26781  default:
26782  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26783  break;
26784  }
26785 
26786 
26787  exit(rc);
26788  }
26789  #endif
26790 }
26791 
26792  /* Delete any search trees */
26793 
26794  rc = MB_Clear(b_firm_household_wage_payment);
26795  #ifdef ERRCHECK
26796  if (rc != MB_SUCCESS)
26797  {
26798  fprintf(stderr, "ERROR: Could not clear 'firm_household_wage_payment' board\n");
26799  switch(rc) {
26800  case MB_ERR_INVALID:
26801  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is invalid\n");
26802  break;
26803  case MB_ERR_LOCKED:
26804  fprintf(stderr, "\t reason: 'firm_household_wage_payment' board is locked\n");
26805  break;
26806  case MB_ERR_INTERNAL:
26807  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26808  break;
26809  default:
26810  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
26811  break;
26812 
26813  }
26814 
26815 
26816  exit(rc);
26817  }
26818  #endif
26819 
26820 if(FLAME_mortgage_writeoff_message_board_read == 0)
26821 {
26822  /*printf("%d> mortgage_writeoff message board sync complete late as no agents reading any messages of this type\n", node_number);*/
26823 
26824  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_mortgage_writeoff)\n");
26825  rc = MB_SyncComplete(b_mortgage_writeoff);
26826  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_mortgage_writeoff)\n");
26827  #ifdef ERRCHECK
26828  if (rc != MB_SUCCESS)
26829  {
26830  fprintf(stderr, "ERROR: Could not complete sync of 'mortgage_writeoff' board\n");
26831  switch(rc) {
26832  case MB_ERR_INVALID:
26833  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
26834  break;
26835  case MB_ERR_MEMALLOC:
26836  fprintf(stderr, "\t reason: out of memory\n");
26837  break;
26838  case MB_ERR_INTERNAL:
26839  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26840  break;
26841  default:
26842  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
26843  break;
26844  }
26845 
26846 
26847  exit(rc);
26848  }
26849  #endif
26850 }
26851 
26852  /* Delete any search trees */
26853 
26854  rc = MB_Clear(b_mortgage_writeoff);
26855  #ifdef ERRCHECK
26856  if (rc != MB_SUCCESS)
26857  {
26858  fprintf(stderr, "ERROR: Could not clear 'mortgage_writeoff' board\n");
26859  switch(rc) {
26860  case MB_ERR_INVALID:
26861  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is invalid\n");
26862  break;
26863  case MB_ERR_LOCKED:
26864  fprintf(stderr, "\t reason: 'mortgage_writeoff' board is locked\n");
26865  break;
26866  case MB_ERR_INTERNAL:
26867  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26868  break;
26869  default:
26870  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
26871  break;
26872 
26873  }
26874 
26875 
26876  exit(rc);
26877  }
26878  #endif
26879 
26880  /* DEBUG: States with branching functions */
26883  {
26884  FLAME_debug_count = 0;
26885  /* Function: bank_update_deposits */
26887  { FLAME_debug_count++; }
26888  /* Function: idle */
26890  { FLAME_debug_count++; }
26891  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
26892  if(FLAME_debug_count != 1)
26893  {
26894  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'bank' leaving state 'BankUpdateDeposits'\n");
26895  if(FLAME_debug_count > 1)
26896  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
26897  if(FLAME_debug_count == 0)
26898  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
26899  }
26900 
26902  }
26903 
26904  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_labour_report_status\n");
26907  {
26911  /* For backwards compatibility set current_xmachine */
26922 
26923 
26924 
26925 
26926 
26928 
26929 
26930 
26931  if(i == 1)
26932  {
26934  }
26935  else
26936  {
26938  }
26939 
26940 
26942 
26944  }
26945  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_labour_report_status\n");
26946 
26947  if(FLAME_employment_status_message_board_write == 1)
26948  {
26949 
26950  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_employment_status)\n");
26951  rc = MB_SyncStart(b_employment_status);
26952  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_employment_status)\n");
26953  #ifdef ERRCHECK
26954  if (rc != MB_SUCCESS)
26955  {
26956  fprintf(stderr, "ERROR: Could not start sync of 'employment_status' board\n");
26957  switch(rc) {
26958  case MB_ERR_INVALID:
26959  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
26960  break;
26961  case MB_ERR_LOCKED:
26962  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
26963  break;
26964  case MB_ERR_MEMALLOC:
26965  fprintf(stderr, "\t reason: out of memory\n");
26966  break;
26967  case MB_ERR_INTERNAL:
26968  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
26969  break;
26970  default:
26971  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
26972  break;
26973  }
26974 
26975 
26976  exit(rc);
26977  }
26978  #endif
26979  }
26980 
26981 
26982 
26983  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
26986  {
26990  /* For backwards compatibility set current_xmachine */
27001 
27003  {
27004 
27005 
27006 
27007  i = idle();
27008 
27009 
27010 
27011  if(i == 1)
27012  {
27014  }
27015  else
27016  {
27018  }
27019  }
27020 
27021  current_xmachine_bank = NULL;
27022 
27024  }
27025  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
27026 
27027 
27028 /* End of layer number 57 */
27029 
27030 /* Clear message boards that have finished being used
27031  * and sync complete if doing late sync complete */
27032 
27033  /* DEBUG: States with branching functions */
27036  {
27037  FLAME_debug_count = 0;
27038  /* Function: household_update_bank_account */
27040  { FLAME_debug_count++; }
27041  /* Function: idle */
27043  { FLAME_debug_count++; }
27044  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
27045  if(FLAME_debug_count != 1)
27046  {
27047  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HouseholdUpdateDeposits'\n");
27048  if(FLAME_debug_count > 1)
27049  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
27050  if(FLAME_debug_count == 0)
27051  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
27052  }
27053 
27055  }
27056 
27057  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_update_bank_account\n");
27060  {
27064  /* For backwards compatibility set current_xmachine */
27075 
27077  {
27078 
27079 
27080 
27082 
27083 
27084 
27085  if(i == 1)
27086  {
27088  }
27089  else
27090  {
27092  }
27093  }
27094 
27096 
27098  }
27099  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_update_bank_account\n");
27100 
27101  if(FLAME_household_bank_update_deposit_message_board_write == 1)
27102  {
27103 
27104  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_household_bank_update_deposit)\n");
27105  rc = MB_SyncStart(b_household_bank_update_deposit);
27106  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_household_bank_update_deposit)\n");
27107  #ifdef ERRCHECK
27108  if (rc != MB_SUCCESS)
27109  {
27110  fprintf(stderr, "ERROR: Could not start sync of 'household_bank_update_deposit' board\n");
27111  switch(rc) {
27112  case MB_ERR_INVALID:
27113  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
27114  break;
27115  case MB_ERR_LOCKED:
27116  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is locked\n");
27117  break;
27118  case MB_ERR_MEMALLOC:
27119  fprintf(stderr, "\t reason: out of memory\n");
27120  break;
27121  case MB_ERR_INTERNAL:
27122  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27123  break;
27124  default:
27125  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
27126  break;
27127  }
27128 
27129 
27130  exit(rc);
27131  }
27132  #endif
27133  }
27134 
27135 
27136 
27137  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
27140  {
27144  /* For backwards compatibility set current_xmachine */
27155 
27157  {
27158 
27159 
27160 
27161  i = idle();
27162 
27163 
27164 
27165  if(i == 1)
27166  {
27168  }
27169  else
27170  {
27172  }
27173  }
27174 
27176 
27178  }
27179  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
27180 
27181 
27182  /* If mb is not read then leave sync complete until last possible moment */
27183  if(FLAME_employment_status_message_board_read == 1)
27184  {
27185  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_employment_status)\n");
27186  rc = MB_SyncComplete(b_employment_status);
27187  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_employment_status)\n");
27188  #ifdef ERRCHECK
27189  if (rc != MB_SUCCESS)
27190  {
27191  fprintf(stderr, "ERROR: Could not complete sync of 'employment_status' board\n");
27192  switch(rc) {
27193  case MB_ERR_INVALID:
27194  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27195  break;
27196  case MB_ERR_MEMALLOC:
27197  fprintf(stderr, "\t reason: out of memory\n");
27198  break;
27199  case MB_ERR_INTERNAL:
27200  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27201  break;
27202  default:
27203  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
27204  break;
27205  }
27206 
27207 
27208  exit(rc);
27209  }
27210  #endif
27211 
27212 
27213 
27214  }
27215 
27216  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_labour_trace_wages\n");
27219  {
27223  /* For backwards compatibility set current_xmachine */
27234 
27235 
27236 
27237 
27238 
27239 
27240  rc = MB_Iterator_Create(b_employment_status, &i_employment_status);
27241 
27242 
27243  #ifdef ERRCHECK
27244  if (rc != MB_SUCCESS)
27245  {
27246  fprintf(stderr, "ERROR: Could not create Iterator for 'employment_status'\n");
27247  switch(rc) {
27248  case MB_ERR_INVALID:
27249  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27250  break;
27251  case MB_ERR_LOCKED:
27252  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
27253  break;
27254  case MB_ERR_MEMALLOC:
27255  fprintf(stderr, "\t reason: out of memory\n");
27256  break;
27257  case MB_ERR_INTERNAL:
27258  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27259  break;
27260  default:
27261 
27262 
27263  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
27264 
27265  break;
27266  }
27267 
27268 
27269  exit(rc);
27270  }
27271  #endif
27272 
27273 
27274 
27276 
27277 
27278  rc = MB_Iterator_Delete(&i_employment_status);
27279  #ifdef ERRCHECK
27280  if (rc != MB_SUCCESS)
27281  {
27282  fprintf(stderr, "ERROR: Could not delete 'employment_status' iterator\n");
27283  switch(rc) {
27284  case MB_ERR_INVALID:
27285  fprintf(stderr, "\t reason: 'employment_status' iterator is invalid\n");
27286  break;
27287  case MB_ERR_INTERNAL:
27288  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27289  break;
27290  default:
27291  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
27292  break;
27293  }
27294 
27295 
27296  exit(rc);
27297  }
27298  #endif
27299 
27300 
27301  if(i == 1)
27302  {
27304  }
27305  else
27306  {
27308  }
27309 
27310 
27311  current_xmachine_firm = NULL;
27312 
27314  }
27315  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_labour_trace_wages\n");
27316 
27317 
27318  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_audit_dividends\n");
27321  {
27325  /* For backwards compatibility set current_xmachine */
27336 
27338  {
27339 
27340 
27341 
27342 
27343  rc = MB_Iterator_Create(b_employment_status, &i_employment_status);
27344 
27345 
27346  #ifdef ERRCHECK
27347  if (rc != MB_SUCCESS)
27348  {
27349  fprintf(stderr, "ERROR: Could not create Iterator for 'employment_status'\n");
27350  switch(rc) {
27351  case MB_ERR_INVALID:
27352  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27353  break;
27354  case MB_ERR_LOCKED:
27355  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
27356  break;
27357  case MB_ERR_MEMALLOC:
27358  fprintf(stderr, "\t reason: out of memory\n");
27359  break;
27360  case MB_ERR_INTERNAL:
27361  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27362  break;
27363  default:
27364 
27365 
27366  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
27367 
27368  break;
27369  }
27370 
27371 
27372  exit(rc);
27373  }
27374  #endif
27375 
27376 
27377 
27379 
27380 
27381  rc = MB_Iterator_Delete(&i_employment_status);
27382  #ifdef ERRCHECK
27383  if (rc != MB_SUCCESS)
27384  {
27385  fprintf(stderr, "ERROR: Could not delete 'employment_status' iterator\n");
27386  switch(rc) {
27387  case MB_ERR_INVALID:
27388  fprintf(stderr, "\t reason: 'employment_status' iterator is invalid\n");
27389  break;
27390  case MB_ERR_INTERNAL:
27391  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27392  break;
27393  default:
27394  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
27395  break;
27396  }
27397 
27398 
27399  exit(rc);
27400  }
27401  #endif
27402 
27403 
27404  if(i == 1)
27405  {
27407  }
27408  else
27409  {
27411  }
27412  }
27413 
27415 
27417  }
27418  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_audit_dividends\n");
27419 
27420 
27421  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_trace_unemployment_status\n");
27424  {
27428  /* For backwards compatibility set current_xmachine */
27439 
27440 
27441 
27442 
27443 
27444 
27445  rc = MB_Iterator_Create(b_employment_status, &i_employment_status);
27446 
27447 
27448  #ifdef ERRCHECK
27449  if (rc != MB_SUCCESS)
27450  {
27451  fprintf(stderr, "ERROR: Could not create Iterator for 'employment_status'\n");
27452  switch(rc) {
27453  case MB_ERR_INVALID:
27454  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27455  break;
27456  case MB_ERR_LOCKED:
27457  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
27458  break;
27459  case MB_ERR_MEMALLOC:
27460  fprintf(stderr, "\t reason: out of memory\n");
27461  break;
27462  case MB_ERR_INTERNAL:
27463  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27464  break;
27465  default:
27466 
27467 
27468  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
27469 
27470  break;
27471  }
27472 
27473 
27474  exit(rc);
27475  }
27476  #endif
27477 
27478 
27479 
27481 
27482 
27483  rc = MB_Iterator_Delete(&i_employment_status);
27484  #ifdef ERRCHECK
27485  if (rc != MB_SUCCESS)
27486  {
27487  fprintf(stderr, "ERROR: Could not delete 'employment_status' iterator\n");
27488  switch(rc) {
27489  case MB_ERR_INVALID:
27490  fprintf(stderr, "\t reason: 'employment_status' iterator is invalid\n");
27491  break;
27492  case MB_ERR_INTERNAL:
27493  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27494  break;
27495  default:
27496  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
27497  break;
27498  }
27499 
27500 
27501  exit(rc);
27502  }
27503  #endif
27504 
27505 
27506  if(i == 1)
27507  {
27509  }
27510  else
27511  {
27513  }
27514 
27515 
27517 
27519  }
27520  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_trace_unemployment_status\n");
27521 
27522 
27523  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_trace_unemployment_status\n");
27526  {
27530  /* For backwards compatibility set current_xmachine */
27541 
27543  {
27544 
27545 
27546 
27547 
27548  rc = MB_Iterator_Create(b_employment_status, &i_employment_status);
27549 
27550 
27551  #ifdef ERRCHECK
27552  if (rc != MB_SUCCESS)
27553  {
27554  fprintf(stderr, "ERROR: Could not create Iterator for 'employment_status'\n");
27555  switch(rc) {
27556  case MB_ERR_INVALID:
27557  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27558  break;
27559  case MB_ERR_LOCKED:
27560  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
27561  break;
27562  case MB_ERR_MEMALLOC:
27563  fprintf(stderr, "\t reason: out of memory\n");
27564  break;
27565  case MB_ERR_INTERNAL:
27566  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27567  break;
27568  default:
27569 
27570 
27571  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
27572 
27573  break;
27574  }
27575 
27576 
27577  exit(rc);
27578  }
27579  #endif
27580 
27581 
27582 
27584 
27585 
27586  rc = MB_Iterator_Delete(&i_employment_status);
27587  #ifdef ERRCHECK
27588  if (rc != MB_SUCCESS)
27589  {
27590  fprintf(stderr, "ERROR: Could not delete 'employment_status' iterator\n");
27591  switch(rc) {
27592  case MB_ERR_INVALID:
27593  fprintf(stderr, "\t reason: 'employment_status' iterator is invalid\n");
27594  break;
27595  case MB_ERR_INTERNAL:
27596  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27597  break;
27598  default:
27599  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
27600  break;
27601  }
27602 
27603 
27604  exit(rc);
27605  }
27606  #endif
27607 
27608 
27609  if(i == 1)
27610  {
27612  }
27613  else
27614  {
27616  }
27617  }
27618 
27620 
27622  }
27623  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_trace_unemployment_status\n");
27624 
27625 
27626 /* End of layer number 58 */
27627 
27628 /* Clear message boards that have finished being used
27629  * and sync complete if doing late sync complete */
27630 
27631 if(FLAME_employment_status_message_board_read == 0)
27632 {
27633  /*printf("%d> employment_status message board sync complete late as no agents reading any messages of this type\n", node_number);*/
27634 
27635  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_employment_status)\n");
27636  rc = MB_SyncComplete(b_employment_status);
27637  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_employment_status)\n");
27638  #ifdef ERRCHECK
27639  if (rc != MB_SUCCESS)
27640  {
27641  fprintf(stderr, "ERROR: Could not complete sync of 'employment_status' board\n");
27642  switch(rc) {
27643  case MB_ERR_INVALID:
27644  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27645  break;
27646  case MB_ERR_MEMALLOC:
27647  fprintf(stderr, "\t reason: out of memory\n");
27648  break;
27649  case MB_ERR_INTERNAL:
27650  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27651  break;
27652  default:
27653  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
27654  break;
27655  }
27656 
27657 
27658  exit(rc);
27659  }
27660  #endif
27661 }
27662 
27663  /* Delete any search trees */
27664 
27665  rc = MB_Clear(b_employment_status);
27666  #ifdef ERRCHECK
27667  if (rc != MB_SUCCESS)
27668  {
27669  fprintf(stderr, "ERROR: Could not clear 'employment_status' board\n");
27670  switch(rc) {
27671  case MB_ERR_INVALID:
27672  fprintf(stderr, "\t reason: 'employment_status' board is invalid\n");
27673  break;
27674  case MB_ERR_LOCKED:
27675  fprintf(stderr, "\t reason: 'employment_status' board is locked\n");
27676  break;
27677  case MB_ERR_INTERNAL:
27678  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27679  break;
27680  default:
27681  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
27682  break;
27683 
27684  }
27685 
27686 
27687  exit(rc);
27688  }
27689  #endif
27690 
27691  /* DEBUG: States with branching functions */
27694  {
27695  FLAME_debug_count = 0;
27696  /* Function: firm_update_bank_account */
27698  { FLAME_debug_count++; }
27699  /* Function: idle */
27701  { FLAME_debug_count++; }
27702  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
27703  if(FLAME_debug_count != 1)
27704  {
27705  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmUpdateDeposits'\n");
27706  if(FLAME_debug_count > 1)
27707  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
27708  if(FLAME_debug_count == 0)
27709  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
27710  }
27711 
27713  }
27714  /* DEBUG: States with branching functions */
27717  {
27718  FLAME_debug_count = 0;
27719  /* Function: household_credit_check_interest_rate */
27721  { FLAME_debug_count++; }
27722  /* Function: idle */
27724  { FLAME_debug_count++; }
27725  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
27726  if(FLAME_debug_count != 1)
27727  {
27728  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'household' leaving state 'HHCreditPolicyChecks'\n");
27729  if(FLAME_debug_count > 1)
27730  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
27731  if(FLAME_debug_count == 0)
27732  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
27733  }
27734 
27736  }
27737  /* DEBUG: States with branching functions */
27740  {
27741  FLAME_debug_count = 0;
27742  /* Function: equityfund_credit_compute_income_statement */
27744  { FLAME_debug_count++; }
27745  /* Function: idle */
27747  { FLAME_debug_count++; }
27748  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
27749  if(FLAME_debug_count != 1)
27750  {
27751  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'equityfund' leaving state 'EFCreditIncomeStatement'\n");
27752  if(FLAME_debug_count > 1)
27753  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
27754  if(FLAME_debug_count == 0)
27755  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
27756  }
27757 
27759  }
27760  /* DEBUG: States with branching functions */
27763  {
27764  FLAME_debug_count = 0;
27765  /* Function: government_collect_centralbank_profit */
27767  { FLAME_debug_count++; }
27768  /* Function: idle */
27770  { FLAME_debug_count++; }
27771  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
27772  if(FLAME_debug_count != 1)
27773  {
27774  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'government' leaving state 'GovernmentFiscalPolicy'\n");
27775  if(FLAME_debug_count > 1)
27776  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
27777  if(FLAME_debug_count == 0)
27778  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
27779  }
27780 
27782  }
27783  /* DEBUG: States with branching functions */
27786  {
27787  FLAME_debug_count = 0;
27788  /* Function: centralbank_compute_income_statement */
27790  { FLAME_debug_count++; }
27791  /* Function: idle */
27793  { FLAME_debug_count++; }
27794  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
27795  if(FLAME_debug_count != 1)
27796  {
27797  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'centralbank' leaving state 'CentralBankPolicy'\n");
27798  if(FLAME_debug_count > 1)
27799  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
27800  if(FLAME_debug_count == 0)
27801  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
27802  }
27803 
27805  }
27806 
27807  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_update_bank_account\n");
27810  {
27814  /* For backwards compatibility set current_xmachine */
27825 
27827  {
27828 
27829 
27830 
27832 
27833 
27834 
27835  if(i == 1)
27836  {
27838  }
27839  else
27840  {
27842  }
27843  }
27844 
27845  current_xmachine_firm = NULL;
27846 
27848  }
27849  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_update_bank_account\n");
27850 
27851  if(FLAME_firm_bank_update_deposit_message_board_write == 1)
27852  {
27853 
27854  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_firm_bank_update_deposit)\n");
27855  rc = MB_SyncStart(b_firm_bank_update_deposit);
27856  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_firm_bank_update_deposit)\n");
27857  #ifdef ERRCHECK
27858  if (rc != MB_SUCCESS)
27859  {
27860  fprintf(stderr, "ERROR: Could not start sync of 'firm_bank_update_deposit' board\n");
27861  switch(rc) {
27862  case MB_ERR_INVALID:
27863  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
27864  break;
27865  case MB_ERR_LOCKED:
27866  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is locked\n");
27867  break;
27868  case MB_ERR_MEMALLOC:
27869  fprintf(stderr, "\t reason: out of memory\n");
27870  break;
27871  case MB_ERR_INTERNAL:
27872  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27873  break;
27874  default:
27875  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
27876  break;
27877  }
27878 
27879 
27880  exit(rc);
27881  }
27882  #endif
27883  }
27884 
27885 
27886 
27887  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_compute_income_statement\n");
27890  {
27894  /* For backwards compatibility set current_xmachine */
27905 
27907  {
27908 
27909 
27910 
27912 
27913 
27914 
27915  if(i == 1)
27916  {
27918  }
27919  else
27920  {
27922  }
27923  }
27924 
27926 
27928  }
27929  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_compute_income_statement\n");
27930 
27931  if(FLAME_centralbank_government_profit_message_board_write == 1)
27932  {
27933 
27934  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_centralbank_government_profit)\n");
27935  rc = MB_SyncStart(b_centralbank_government_profit);
27936  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_centralbank_government_profit)\n");
27937  #ifdef ERRCHECK
27938  if (rc != MB_SUCCESS)
27939  {
27940  fprintf(stderr, "ERROR: Could not start sync of 'centralbank_government_profit' board\n");
27941  switch(rc) {
27942  case MB_ERR_INVALID:
27943  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
27944  break;
27945  case MB_ERR_LOCKED:
27946  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is locked\n");
27947  break;
27948  case MB_ERR_MEMALLOC:
27949  fprintf(stderr, "\t reason: out of memory\n");
27950  break;
27951  case MB_ERR_INTERNAL:
27952  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
27953  break;
27954  default:
27955  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
27956  break;
27957  }
27958 
27959 
27960  exit(rc);
27961  }
27962  #endif
27963  }
27964 
27965 
27966 
27967  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
27970  {
27974  /* For backwards compatibility set current_xmachine */
27985 
27987  {
27988 
27989 
27990 
27991  i = idle();
27992 
27993 
27994 
27995  if(i == 1)
27996  {
27998  }
27999  else
28000  {
28002  }
28003  }
28004 
28006 
28008  }
28009  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
28010 
28011 
28012  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
28015  {
28019  /* For backwards compatibility set current_xmachine */
28030 
28032  {
28033 
28034 
28035 
28036  i = idle();
28037 
28038 
28039 
28040  if(i == 1)
28041  {
28043  }
28044  else
28045  {
28047  }
28048  }
28049 
28051 
28053  }
28054  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
28055 
28056 
28057  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_compute_income_statement\n");
28060  {
28064  /* For backwards compatibility set current_xmachine */
28075 
28077  {
28078 
28079 
28080 
28082 
28083 
28084 
28085  if(i == 1)
28086  {
28088  }
28089  else
28090  {
28092  }
28093  }
28094 
28096 
28098  }
28099  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_compute_income_statement\n");
28100 
28101 
28102  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
28105  {
28109  /* For backwards compatibility set current_xmachine */
28120 
28122  {
28123 
28124 
28125 
28126  i = idle();
28127 
28128 
28129 
28130  if(i == 1)
28131  {
28133  }
28134  else
28135  {
28137  }
28138  }
28139 
28141 
28143  }
28144  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
28145 
28146 
28147  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
28150  {
28154  /* For backwards compatibility set current_xmachine */
28165 
28167  {
28168 
28169 
28170 
28171  i = idle();
28172 
28173 
28174 
28175  if(i == 1)
28176  {
28178  }
28179  else
28180  {
28182  }
28183  }
28184 
28186 
28188  }
28189  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
28190 
28191 
28192  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
28195  {
28199  /* For backwards compatibility set current_xmachine */
28210 
28212  {
28213 
28214 
28215 
28216  i = idle();
28217 
28218 
28219 
28220  if(i == 1)
28221  {
28223  }
28224  else
28225  {
28227  }
28228  }
28229 
28230  current_xmachine_firm = NULL;
28231 
28233  }
28234  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
28235 
28236 
28237 /* End of layer number 59 */
28238 
28239 /* Clear message boards that have finished being used
28240  * and sync complete if doing late sync complete */
28241 
28242  /* DEBUG: States with branching functions */
28245  {
28246  FLAME_debug_count = 0;
28247  /* Function: firm_credit_check_interest_rate */
28249  { FLAME_debug_count++; }
28250  /* Function: idle */
28252  { FLAME_debug_count++; }
28253  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
28254  if(FLAME_debug_count != 1)
28255  {
28256  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'firm' leaving state 'FirmCreditPolicyChecks'\n");
28257  if(FLAME_debug_count > 1)
28258  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
28259  if(FLAME_debug_count == 0)
28260  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
28261  }
28262 
28264  }
28265 
28266  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_do_balance_sheet\n");
28269  {
28273  /* For backwards compatibility set current_xmachine */
28284 
28285 
28286 
28287 
28288 
28290 
28291 
28292 
28293  if(i == 1)
28294  {
28296  }
28297  else
28298  {
28300  }
28301 
28302 
28304 
28306  }
28307  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_do_balance_sheet\n");
28308 
28309  if(FLAME_fund_centralbank_update_deposit_message_board_write == 1)
28310  {
28311 
28312  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_fund_centralbank_update_deposit)\n");
28313  rc = MB_SyncStart(b_fund_centralbank_update_deposit);
28314  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_fund_centralbank_update_deposit)\n");
28315  #ifdef ERRCHECK
28316  if (rc != MB_SUCCESS)
28317  {
28318  fprintf(stderr, "ERROR: Could not start sync of 'fund_centralbank_update_deposit' board\n");
28319  switch(rc) {
28320  case MB_ERR_INVALID:
28321  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
28322  break;
28323  case MB_ERR_LOCKED:
28324  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is locked\n");
28325  break;
28326  case MB_ERR_MEMALLOC:
28327  fprintf(stderr, "\t reason: out of memory\n");
28328  break;
28329  case MB_ERR_INTERNAL:
28330  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28331  break;
28332  default:
28333  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
28334  break;
28335  }
28336 
28337 
28338  exit(rc);
28339  }
28340  #endif
28341  }
28342 
28343 
28344 
28345  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
28348  {
28352  /* For backwards compatibility set current_xmachine */
28363 
28365  {
28366 
28367 
28368 
28369  i = idle();
28370 
28371 
28372 
28373  if(i == 1)
28374  {
28376  }
28377  else
28378  {
28380  }
28381  }
28382 
28383  current_xmachine_firm = NULL;
28384 
28386  }
28387  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
28388 
28389 
28390  /* If mb is not read then leave sync complete until last possible moment */
28391  if(FLAME_household_bank_update_deposit_message_board_read == 1)
28392  {
28393  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_bank_update_deposit)\n");
28394  rc = MB_SyncComplete(b_household_bank_update_deposit);
28395  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_bank_update_deposit)\n");
28396  #ifdef ERRCHECK
28397  if (rc != MB_SUCCESS)
28398  {
28399  fprintf(stderr, "ERROR: Could not complete sync of 'household_bank_update_deposit' board\n");
28400  switch(rc) {
28401  case MB_ERR_INVALID:
28402  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
28403  break;
28404  case MB_ERR_MEMALLOC:
28405  fprintf(stderr, "\t reason: out of memory\n");
28406  break;
28407  case MB_ERR_INTERNAL:
28408  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28409  break;
28410  default:
28411  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
28412  break;
28413  }
28414 
28415 
28416  exit(rc);
28417  }
28418  #endif
28419 
28420 
28421 
28422  }
28423 
28424  /* If mb is not read then leave sync complete until last possible moment */
28425  if(FLAME_firm_bank_update_deposit_message_board_read == 1)
28426  {
28427  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_update_deposit)\n");
28428  rc = MB_SyncComplete(b_firm_bank_update_deposit);
28429  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_update_deposit)\n");
28430  #ifdef ERRCHECK
28431  if (rc != MB_SUCCESS)
28432  {
28433  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_update_deposit' board\n");
28434  switch(rc) {
28435  case MB_ERR_INVALID:
28436  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
28437  break;
28438  case MB_ERR_MEMALLOC:
28439  fprintf(stderr, "\t reason: out of memory\n");
28440  break;
28441  case MB_ERR_INTERNAL:
28442  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28443  break;
28444  default:
28445  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
28446  break;
28447  }
28448 
28449 
28450  exit(rc);
28451  }
28452  #endif
28453 
28454 
28455 
28456  }
28457 
28458  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_update_deposits\n");
28461  {
28465  /* For backwards compatibility set current_xmachine */
28476 
28478  {
28479 
28480 
28481 
28482 
28483 
28484 
28486 
28487 
28488 
28489  #ifdef ERRCHECK
28490  if (rc != MB_SUCCESS)
28491  {
28492  fprintf(stderr, "ERROR: Could not create Iterator for 'household_bank_update_deposit'\n");
28493  switch(rc) {
28494  case MB_ERR_INVALID:
28495  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
28496  break;
28497  case MB_ERR_LOCKED:
28498  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is locked\n");
28499  break;
28500  case MB_ERR_MEMALLOC:
28501  fprintf(stderr, "\t reason: out of memory\n");
28502  break;
28503  case MB_ERR_INTERNAL:
28504  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28505  break;
28506  default:
28507 
28508  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
28509 
28510 
28511  break;
28512  }
28513 
28514 
28515  exit(rc);
28516  }
28517  #endif
28518 
28519 
28520 
28521 
28522 
28523 
28525 
28526 
28527 
28528  #ifdef ERRCHECK
28529  if (rc != MB_SUCCESS)
28530  {
28531  fprintf(stderr, "ERROR: Could not create Iterator for 'firm_bank_update_deposit'\n");
28532  switch(rc) {
28533  case MB_ERR_INVALID:
28534  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
28535  break;
28536  case MB_ERR_LOCKED:
28537  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is locked\n");
28538  break;
28539  case MB_ERR_MEMALLOC:
28540  fprintf(stderr, "\t reason: out of memory\n");
28541  break;
28542  case MB_ERR_INTERNAL:
28543  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28544  break;
28545  default:
28546 
28547  fprintf(stderr, "\t MB_Iterator_CreateFiltered returned error code: %d (see libmboard docs for details)\n", rc);
28548 
28549 
28550  break;
28551  }
28552 
28553 
28554  exit(rc);
28555  }
28556  #endif
28557 
28558 
28559 
28560  i = bank_update_deposits();
28561 
28562 
28563  rc = MB_Iterator_Delete(&i_household_bank_update_deposit);
28564  #ifdef ERRCHECK
28565  if (rc != MB_SUCCESS)
28566  {
28567  fprintf(stderr, "ERROR: Could not delete 'household_bank_update_deposit' iterator\n");
28568  switch(rc) {
28569  case MB_ERR_INVALID:
28570  fprintf(stderr, "\t reason: 'household_bank_update_deposit' iterator is invalid\n");
28571  break;
28572  case MB_ERR_INTERNAL:
28573  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28574  break;
28575  default:
28576  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
28577  break;
28578  }
28579 
28580 
28581  exit(rc);
28582  }
28583  #endif
28584 
28585  rc = MB_Iterator_Delete(&i_firm_bank_update_deposit);
28586  #ifdef ERRCHECK
28587  if (rc != MB_SUCCESS)
28588  {
28589  fprintf(stderr, "ERROR: Could not delete 'firm_bank_update_deposit' iterator\n");
28590  switch(rc) {
28591  case MB_ERR_INVALID:
28592  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' iterator is invalid\n");
28593  break;
28594  case MB_ERR_INTERNAL:
28595  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28596  break;
28597  default:
28598  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
28599  break;
28600  }
28601 
28602 
28603  exit(rc);
28604  }
28605  #endif
28606 
28607 
28608  if(i == 1)
28609  {
28611  }
28612  else
28613  {
28615  }
28616  }
28617 
28618  current_xmachine_bank = NULL;
28619 
28621  }
28622  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_update_deposits\n");
28623 
28624 
28625  /* If mb is not read then leave sync complete until last possible moment */
28626  if(FLAME_centralbank_government_profit_message_board_read == 1)
28627  {
28628  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_centralbank_government_profit)\n");
28629  rc = MB_SyncComplete(b_centralbank_government_profit);
28630  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_centralbank_government_profit)\n");
28631  #ifdef ERRCHECK
28632  if (rc != MB_SUCCESS)
28633  {
28634  fprintf(stderr, "ERROR: Could not complete sync of 'centralbank_government_profit' board\n");
28635  switch(rc) {
28636  case MB_ERR_INVALID:
28637  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
28638  break;
28639  case MB_ERR_MEMALLOC:
28640  fprintf(stderr, "\t reason: out of memory\n");
28641  break;
28642  case MB_ERR_INTERNAL:
28643  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28644  break;
28645  default:
28646  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
28647  break;
28648  }
28649 
28650 
28651  exit(rc);
28652  }
28653  #endif
28654 
28655 
28656 
28657  }
28658 
28659  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_collect_centralbank_profit\n");
28662  {
28666  /* For backwards compatibility set current_xmachine */
28677 
28679  {
28680 
28681 
28682 
28683 
28685 
28686 
28687  #ifdef ERRCHECK
28688  if (rc != MB_SUCCESS)
28689  {
28690  fprintf(stderr, "ERROR: Could not create Iterator for 'centralbank_government_profit'\n");
28691  switch(rc) {
28692  case MB_ERR_INVALID:
28693  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
28694  break;
28695  case MB_ERR_LOCKED:
28696  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is locked\n");
28697  break;
28698  case MB_ERR_MEMALLOC:
28699  fprintf(stderr, "\t reason: out of memory\n");
28700  break;
28701  case MB_ERR_INTERNAL:
28702  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28703  break;
28704  default:
28705 
28706 
28707  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
28708 
28709  break;
28710  }
28711 
28712 
28713  exit(rc);
28714  }
28715  #endif
28716 
28717 
28718 
28720 
28721 
28722  rc = MB_Iterator_Delete(&i_centralbank_government_profit);
28723  #ifdef ERRCHECK
28724  if (rc != MB_SUCCESS)
28725  {
28726  fprintf(stderr, "ERROR: Could not delete 'centralbank_government_profit' iterator\n");
28727  switch(rc) {
28728  case MB_ERR_INVALID:
28729  fprintf(stderr, "\t reason: 'centralbank_government_profit' iterator is invalid\n");
28730  break;
28731  case MB_ERR_INTERNAL:
28732  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28733  break;
28734  default:
28735  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
28736  break;
28737  }
28738 
28739 
28740  exit(rc);
28741  }
28742  #endif
28743 
28744 
28745  if(i == 1)
28746  {
28748  }
28749  else
28750  {
28752  }
28753  }
28754 
28756 
28758  }
28759  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_collect_centralbank_profit\n");
28760 
28761 
28762 /* End of layer number 60 */
28763 
28764 /* Clear message boards that have finished being used
28765  * and sync complete if doing late sync complete */
28766 
28767 if(FLAME_firm_bank_update_deposit_message_board_read == 0)
28768 {
28769  /*printf("%d> firm_bank_update_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
28770 
28771  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_firm_bank_update_deposit)\n");
28772  rc = MB_SyncComplete(b_firm_bank_update_deposit);
28773  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_firm_bank_update_deposit)\n");
28774  #ifdef ERRCHECK
28775  if (rc != MB_SUCCESS)
28776  {
28777  fprintf(stderr, "ERROR: Could not complete sync of 'firm_bank_update_deposit' board\n");
28778  switch(rc) {
28779  case MB_ERR_INVALID:
28780  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
28781  break;
28782  case MB_ERR_MEMALLOC:
28783  fprintf(stderr, "\t reason: out of memory\n");
28784  break;
28785  case MB_ERR_INTERNAL:
28786  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28787  break;
28788  default:
28789  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
28790  break;
28791  }
28792 
28793 
28794  exit(rc);
28795  }
28796  #endif
28797 }
28798 
28799  /* Delete any search trees */
28800 
28801  rc = MB_Clear(b_firm_bank_update_deposit);
28802  #ifdef ERRCHECK
28803  if (rc != MB_SUCCESS)
28804  {
28805  fprintf(stderr, "ERROR: Could not clear 'firm_bank_update_deposit' board\n");
28806  switch(rc) {
28807  case MB_ERR_INVALID:
28808  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is invalid\n");
28809  break;
28810  case MB_ERR_LOCKED:
28811  fprintf(stderr, "\t reason: 'firm_bank_update_deposit' board is locked\n");
28812  break;
28813  case MB_ERR_INTERNAL:
28814  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28815  break;
28816  default:
28817  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
28818  break;
28819 
28820  }
28821 
28822 
28823  exit(rc);
28824  }
28825  #endif
28826 
28827 if(FLAME_household_bank_update_deposit_message_board_read == 0)
28828 {
28829  /*printf("%d> household_bank_update_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
28830 
28831  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_household_bank_update_deposit)\n");
28832  rc = MB_SyncComplete(b_household_bank_update_deposit);
28833  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_household_bank_update_deposit)\n");
28834  #ifdef ERRCHECK
28835  if (rc != MB_SUCCESS)
28836  {
28837  fprintf(stderr, "ERROR: Could not complete sync of 'household_bank_update_deposit' board\n");
28838  switch(rc) {
28839  case MB_ERR_INVALID:
28840  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
28841  break;
28842  case MB_ERR_MEMALLOC:
28843  fprintf(stderr, "\t reason: out of memory\n");
28844  break;
28845  case MB_ERR_INTERNAL:
28846  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28847  break;
28848  default:
28849  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
28850  break;
28851  }
28852 
28853 
28854  exit(rc);
28855  }
28856  #endif
28857 }
28858 
28859  /* Delete any search trees */
28860 
28861  rc = MB_Clear(b_household_bank_update_deposit);
28862  #ifdef ERRCHECK
28863  if (rc != MB_SUCCESS)
28864  {
28865  fprintf(stderr, "ERROR: Could not clear 'household_bank_update_deposit' board\n");
28866  switch(rc) {
28867  case MB_ERR_INVALID:
28868  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is invalid\n");
28869  break;
28870  case MB_ERR_LOCKED:
28871  fprintf(stderr, "\t reason: 'household_bank_update_deposit' board is locked\n");
28872  break;
28873  case MB_ERR_INTERNAL:
28874  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28875  break;
28876  default:
28877  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
28878  break;
28879 
28880  }
28881 
28882 
28883  exit(rc);
28884  }
28885  #endif
28886 
28887 if(FLAME_centralbank_government_profit_message_board_read == 0)
28888 {
28889  /*printf("%d> centralbank_government_profit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
28890 
28891  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_centralbank_government_profit)\n");
28892  rc = MB_SyncComplete(b_centralbank_government_profit);
28893  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_centralbank_government_profit)\n");
28894  #ifdef ERRCHECK
28895  if (rc != MB_SUCCESS)
28896  {
28897  fprintf(stderr, "ERROR: Could not complete sync of 'centralbank_government_profit' board\n");
28898  switch(rc) {
28899  case MB_ERR_INVALID:
28900  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
28901  break;
28902  case MB_ERR_MEMALLOC:
28903  fprintf(stderr, "\t reason: out of memory\n");
28904  break;
28905  case MB_ERR_INTERNAL:
28906  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28907  break;
28908  default:
28909  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
28910  break;
28911  }
28912 
28913 
28914  exit(rc);
28915  }
28916  #endif
28917 }
28918 
28919  /* Delete any search trees */
28920 
28921  rc = MB_Clear(b_centralbank_government_profit);
28922  #ifdef ERRCHECK
28923  if (rc != MB_SUCCESS)
28924  {
28925  fprintf(stderr, "ERROR: Could not clear 'centralbank_government_profit' board\n");
28926  switch(rc) {
28927  case MB_ERR_INVALID:
28928  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is invalid\n");
28929  break;
28930  case MB_ERR_LOCKED:
28931  fprintf(stderr, "\t reason: 'centralbank_government_profit' board is locked\n");
28932  break;
28933  case MB_ERR_INTERNAL:
28934  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
28935  break;
28936  default:
28937  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
28938  break;
28939 
28940  }
28941 
28942 
28943  exit(rc);
28944  }
28945  #endif
28946 
28947  /* DEBUG: States with branching functions */
28950  {
28951  FLAME_debug_count = 0;
28952  /* Function: bank_credit_check_interest_rate */
28954  { FLAME_debug_count++; }
28955  /* Function: idle */
28957  { FLAME_debug_count++; }
28958  /*printf("FLAME_debug_count = %d\n", FLAME_debug_count);*/
28959  if(FLAME_debug_count != 1)
28960  {
28961  fprintf(stderr, "ERROR: A function condition test has failed for agent type 'bank' leaving state 'BankCreditPolicyChecks'\n");
28962  if(FLAME_debug_count > 1)
28963  fprintf(stderr, "\t reason: there was more than one possible outgoing transition function\n");
28964  if(FLAME_debug_count == 0)
28965  fprintf(stderr, "\t reason: there was no possible outgoing transition function\n");
28966  }
28967 
28969  }
28970 
28971  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_compute_income_statement\n");
28974  {
28978  /* For backwards compatibility set current_xmachine */
28989 
28990 
28991 
28992 
28993 
28995 
28996 
28997 
28998  if(i == 1)
28999  {
29001  }
29002  else
29003  {
29005  }
29006 
29007 
29009 
29011  }
29012  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_compute_income_statement\n");
29013 
29014 
29015  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start idle\n");
29018  {
29022  /* For backwards compatibility set current_xmachine */
29033 
29035  {
29036 
29037 
29038 
29039  i = idle();
29040 
29041 
29042 
29043  if(i == 1)
29044  {
29046  }
29047  else
29048  {
29050  }
29051  }
29052 
29053  current_xmachine_bank = NULL;
29054 
29056  }
29057  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish idle\n");
29058 
29059 
29060 /* End of layer number 61 */
29061 
29062 /* Clear message boards that have finished being used
29063  * and sync complete if doing late sync complete */
29064 
29065 
29066  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_do_balance_sheet\n");
29069  {
29073  /* For backwards compatibility set current_xmachine */
29084 
29085 
29086 
29087 
29088 
29090 
29091 
29092 
29093  if(i == 1)
29094  {
29096  }
29097  else
29098  {
29100  }
29101 
29102 
29104 
29106  }
29107  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_do_balance_sheet\n");
29108 
29109  if(FLAME_gov_centralbank_debt_payment_message_board_write == 1)
29110  {
29111 
29112  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_debt_payment)\n");
29113  rc = MB_SyncStart(b_gov_centralbank_debt_payment);
29114  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_debt_payment)\n");
29115  #ifdef ERRCHECK
29116  if (rc != MB_SUCCESS)
29117  {
29118  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_debt_payment' board\n");
29119  switch(rc) {
29120  case MB_ERR_INVALID:
29121  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
29122  break;
29123  case MB_ERR_LOCKED:
29124  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is locked\n");
29125  break;
29126  case MB_ERR_MEMALLOC:
29127  fprintf(stderr, "\t reason: out of memory\n");
29128  break;
29129  case MB_ERR_INTERNAL:
29130  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29131  break;
29132  default:
29133  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
29134  break;
29135  }
29136 
29137 
29138  exit(rc);
29139  }
29140  #endif
29141  }
29142 
29143 
29144  if(FLAME_gov_centralbank_debt_request_message_board_write == 1)
29145  {
29146 
29147  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_debt_request)\n");
29148  rc = MB_SyncStart(b_gov_centralbank_debt_request);
29149  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_debt_request)\n");
29150  #ifdef ERRCHECK
29151  if (rc != MB_SUCCESS)
29152  {
29153  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_debt_request' board\n");
29154  switch(rc) {
29155  case MB_ERR_INVALID:
29156  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
29157  break;
29158  case MB_ERR_LOCKED:
29159  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is locked\n");
29160  break;
29161  case MB_ERR_MEMALLOC:
29162  fprintf(stderr, "\t reason: out of memory\n");
29163  break;
29164  case MB_ERR_INTERNAL:
29165  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29166  break;
29167  default:
29168  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
29169  break;
29170  }
29171 
29172 
29173  exit(rc);
29174  }
29175  #endif
29176  }
29177 
29178 
29179  if(FLAME_gov_centralbank_update_deposit_message_board_write == 1)
29180  {
29181 
29182  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_gov_centralbank_update_deposit)\n");
29183  rc = MB_SyncStart(b_gov_centralbank_update_deposit);
29184  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_gov_centralbank_update_deposit)\n");
29185  #ifdef ERRCHECK
29186  if (rc != MB_SUCCESS)
29187  {
29188  fprintf(stderr, "ERROR: Could not start sync of 'gov_centralbank_update_deposit' board\n");
29189  switch(rc) {
29190  case MB_ERR_INVALID:
29191  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
29192  break;
29193  case MB_ERR_LOCKED:
29194  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is locked\n");
29195  break;
29196  case MB_ERR_MEMALLOC:
29197  fprintf(stderr, "\t reason: out of memory\n");
29198  break;
29199  case MB_ERR_INTERNAL:
29200  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29201  break;
29202  default:
29203  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
29204  break;
29205  }
29206 
29207 
29208  exit(rc);
29209  }
29210  #endif
29211  }
29212 
29213 
29214 
29215 /* End of layer number 62 */
29216 
29217 /* Clear message boards that have finished being used
29218  * and sync complete if doing late sync complete */
29219 
29220 
29221  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start government_update_fiscal_policy\n");
29224  {
29228  /* For backwards compatibility set current_xmachine */
29239 
29240 
29241 
29242 
29243 
29245 
29246 
29247 
29248  if(i == 1)
29249  {
29251  }
29252  else
29253  {
29255  }
29256 
29257 
29259 
29261  }
29262  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish government_update_fiscal_policy\n");
29263 
29264  if(FLAME_labour_tax_rate_message_board_write == 1)
29265  {
29266 
29267  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_labour_tax_rate)\n");
29268  rc = MB_SyncStart(b_labour_tax_rate);
29269  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_labour_tax_rate)\n");
29270  #ifdef ERRCHECK
29271  if (rc != MB_SUCCESS)
29272  {
29273  fprintf(stderr, "ERROR: Could not start sync of 'labour_tax_rate' board\n");
29274  switch(rc) {
29275  case MB_ERR_INVALID:
29276  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
29277  break;
29278  case MB_ERR_LOCKED:
29279  fprintf(stderr, "\t reason: 'labour_tax_rate' board is locked\n");
29280  break;
29281  case MB_ERR_MEMALLOC:
29282  fprintf(stderr, "\t reason: out of memory\n");
29283  break;
29284  case MB_ERR_INTERNAL:
29285  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29286  break;
29287  default:
29288  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
29289  break;
29290  }
29291 
29292 
29293  exit(rc);
29294  }
29295  #endif
29296  }
29297 
29298 
29299  if(FLAME_capital_tax_rate_message_board_write == 1)
29300  {
29301 
29302  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_capital_tax_rate)\n");
29303  rc = MB_SyncStart(b_capital_tax_rate);
29304  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_capital_tax_rate)\n");
29305  #ifdef ERRCHECK
29306  if (rc != MB_SUCCESS)
29307  {
29308  fprintf(stderr, "ERROR: Could not start sync of 'capital_tax_rate' board\n");
29309  switch(rc) {
29310  case MB_ERR_INVALID:
29311  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
29312  break;
29313  case MB_ERR_LOCKED:
29314  fprintf(stderr, "\t reason: 'capital_tax_rate' board is locked\n");
29315  break;
29316  case MB_ERR_MEMALLOC:
29317  fprintf(stderr, "\t reason: out of memory\n");
29318  break;
29319  case MB_ERR_INTERNAL:
29320  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29321  break;
29322  default:
29323  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
29324  break;
29325  }
29326 
29327 
29328  exit(rc);
29329  }
29330  #endif
29331  }
29332 
29333 
29334 
29335  /* If mb is not read then leave sync complete until last possible moment */
29336  if(FLAME_gov_centralbank_debt_payment_message_board_read == 1)
29337  {
29338  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_debt_payment)\n");
29339  rc = MB_SyncComplete(b_gov_centralbank_debt_payment);
29340  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_debt_payment)\n");
29341  #ifdef ERRCHECK
29342  if (rc != MB_SUCCESS)
29343  {
29344  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_debt_payment' board\n");
29345  switch(rc) {
29346  case MB_ERR_INVALID:
29347  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
29348  break;
29349  case MB_ERR_MEMALLOC:
29350  fprintf(stderr, "\t reason: out of memory\n");
29351  break;
29352  case MB_ERR_INTERNAL:
29353  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29354  break;
29355  default:
29356  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29357  break;
29358  }
29359 
29360 
29361  exit(rc);
29362  }
29363  #endif
29364 
29365 
29366 
29367  }
29368 
29369  /* If mb is not read then leave sync complete until last possible moment */
29370  if(FLAME_gov_centralbank_debt_request_message_board_read == 1)
29371  {
29372  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_debt_request)\n");
29373  rc = MB_SyncComplete(b_gov_centralbank_debt_request);
29374  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_debt_request)\n");
29375  #ifdef ERRCHECK
29376  if (rc != MB_SUCCESS)
29377  {
29378  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_debt_request' board\n");
29379  switch(rc) {
29380  case MB_ERR_INVALID:
29381  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
29382  break;
29383  case MB_ERR_MEMALLOC:
29384  fprintf(stderr, "\t reason: out of memory\n");
29385  break;
29386  case MB_ERR_INTERNAL:
29387  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29388  break;
29389  default:
29390  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29391  break;
29392  }
29393 
29394 
29395  exit(rc);
29396  }
29397  #endif
29398 
29399 
29400 
29401  }
29402 
29403  /* If mb is not read then leave sync complete until last possible moment */
29404  if(FLAME_gov_centralbank_update_deposit_message_board_read == 1)
29405  {
29406  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_update_deposit)\n");
29407  rc = MB_SyncComplete(b_gov_centralbank_update_deposit);
29408  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_update_deposit)\n");
29409  #ifdef ERRCHECK
29410  if (rc != MB_SUCCESS)
29411  {
29412  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_update_deposit' board\n");
29413  switch(rc) {
29414  case MB_ERR_INVALID:
29415  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
29416  break;
29417  case MB_ERR_MEMALLOC:
29418  fprintf(stderr, "\t reason: out of memory\n");
29419  break;
29420  case MB_ERR_INTERNAL:
29421  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29422  break;
29423  default:
29424  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29425  break;
29426  }
29427 
29428 
29429  exit(rc);
29430  }
29431  #endif
29432 
29433 
29434 
29435  }
29436 
29437  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_process_government_requests\n");
29440  {
29444  /* For backwards compatibility set current_xmachine */
29455 
29456 
29457 
29458 
29459 
29460 
29462 
29463 
29464  #ifdef ERRCHECK
29465  if (rc != MB_SUCCESS)
29466  {
29467  fprintf(stderr, "ERROR: Could not create Iterator for 'gov_centralbank_debt_request'\n");
29468  switch(rc) {
29469  case MB_ERR_INVALID:
29470  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
29471  break;
29472  case MB_ERR_LOCKED:
29473  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is locked\n");
29474  break;
29475  case MB_ERR_MEMALLOC:
29476  fprintf(stderr, "\t reason: out of memory\n");
29477  break;
29478  case MB_ERR_INTERNAL:
29479  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29480  break;
29481  default:
29482 
29483 
29484  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
29485 
29486  break;
29487  }
29488 
29489 
29490  exit(rc);
29491  }
29492  #endif
29493 
29494 
29495 
29496 
29498 
29499 
29500  #ifdef ERRCHECK
29501  if (rc != MB_SUCCESS)
29502  {
29503  fprintf(stderr, "ERROR: Could not create Iterator for 'gov_centralbank_debt_payment'\n");
29504  switch(rc) {
29505  case MB_ERR_INVALID:
29506  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
29507  break;
29508  case MB_ERR_LOCKED:
29509  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is locked\n");
29510  break;
29511  case MB_ERR_MEMALLOC:
29512  fprintf(stderr, "\t reason: out of memory\n");
29513  break;
29514  case MB_ERR_INTERNAL:
29515  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29516  break;
29517  default:
29518 
29519 
29520  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
29521 
29522  break;
29523  }
29524 
29525 
29526  exit(rc);
29527  }
29528  #endif
29529 
29530 
29531 
29532 
29534 
29535 
29536  #ifdef ERRCHECK
29537  if (rc != MB_SUCCESS)
29538  {
29539  fprintf(stderr, "ERROR: Could not create Iterator for 'gov_centralbank_update_deposit'\n");
29540  switch(rc) {
29541  case MB_ERR_INVALID:
29542  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
29543  break;
29544  case MB_ERR_LOCKED:
29545  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is locked\n");
29546  break;
29547  case MB_ERR_MEMALLOC:
29548  fprintf(stderr, "\t reason: out of memory\n");
29549  break;
29550  case MB_ERR_INTERNAL:
29551  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29552  break;
29553  default:
29554 
29555 
29556  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
29557 
29558  break;
29559  }
29560 
29561 
29562  exit(rc);
29563  }
29564  #endif
29565 
29566 
29567 
29569 
29570 
29571  rc = MB_Iterator_Delete(&i_gov_centralbank_debt_request);
29572  #ifdef ERRCHECK
29573  if (rc != MB_SUCCESS)
29574  {
29575  fprintf(stderr, "ERROR: Could not delete 'gov_centralbank_debt_request' iterator\n");
29576  switch(rc) {
29577  case MB_ERR_INVALID:
29578  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' iterator is invalid\n");
29579  break;
29580  case MB_ERR_INTERNAL:
29581  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29582  break;
29583  default:
29584  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
29585  break;
29586  }
29587 
29588 
29589  exit(rc);
29590  }
29591  #endif
29592 
29593  rc = MB_Iterator_Delete(&i_gov_centralbank_debt_payment);
29594  #ifdef ERRCHECK
29595  if (rc != MB_SUCCESS)
29596  {
29597  fprintf(stderr, "ERROR: Could not delete 'gov_centralbank_debt_payment' iterator\n");
29598  switch(rc) {
29599  case MB_ERR_INVALID:
29600  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' iterator is invalid\n");
29601  break;
29602  case MB_ERR_INTERNAL:
29603  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29604  break;
29605  default:
29606  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
29607  break;
29608  }
29609 
29610 
29611  exit(rc);
29612  }
29613  #endif
29614 
29615  rc = MB_Iterator_Delete(&i_gov_centralbank_update_deposit);
29616  #ifdef ERRCHECK
29617  if (rc != MB_SUCCESS)
29618  {
29619  fprintf(stderr, "ERROR: Could not delete 'gov_centralbank_update_deposit' iterator\n");
29620  switch(rc) {
29621  case MB_ERR_INVALID:
29622  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' iterator is invalid\n");
29623  break;
29624  case MB_ERR_INTERNAL:
29625  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29626  break;
29627  default:
29628  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
29629  break;
29630  }
29631 
29632 
29633  exit(rc);
29634  }
29635  #endif
29636 
29637 
29638  if(i == 1)
29639  {
29641  }
29642  else
29643  {
29645  }
29646 
29647 
29649 
29651  }
29652  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_process_government_requests\n");
29653 
29654 
29655 /* End of layer number 63 */
29656 
29657 /* Clear message boards that have finished being used
29658  * and sync complete if doing late sync complete */
29659 
29660 if(FLAME_gov_centralbank_update_deposit_message_board_read == 0)
29661 {
29662  /*printf("%d> gov_centralbank_update_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
29663 
29664  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_update_deposit)\n");
29665  rc = MB_SyncComplete(b_gov_centralbank_update_deposit);
29666  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_update_deposit)\n");
29667  #ifdef ERRCHECK
29668  if (rc != MB_SUCCESS)
29669  {
29670  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_update_deposit' board\n");
29671  switch(rc) {
29672  case MB_ERR_INVALID:
29673  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
29674  break;
29675  case MB_ERR_MEMALLOC:
29676  fprintf(stderr, "\t reason: out of memory\n");
29677  break;
29678  case MB_ERR_INTERNAL:
29679  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29680  break;
29681  default:
29682  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29683  break;
29684  }
29685 
29686 
29687  exit(rc);
29688  }
29689  #endif
29690 }
29691 
29692  /* Delete any search trees */
29693 
29694  rc = MB_Clear(b_gov_centralbank_update_deposit);
29695  #ifdef ERRCHECK
29696  if (rc != MB_SUCCESS)
29697  {
29698  fprintf(stderr, "ERROR: Could not clear 'gov_centralbank_update_deposit' board\n");
29699  switch(rc) {
29700  case MB_ERR_INVALID:
29701  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is invalid\n");
29702  break;
29703  case MB_ERR_LOCKED:
29704  fprintf(stderr, "\t reason: 'gov_centralbank_update_deposit' board is locked\n");
29705  break;
29706  case MB_ERR_INTERNAL:
29707  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29708  break;
29709  default:
29710  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
29711  break;
29712 
29713  }
29714 
29715 
29716  exit(rc);
29717  }
29718  #endif
29719 
29720 if(FLAME_gov_centralbank_debt_request_message_board_read == 0)
29721 {
29722  /*printf("%d> gov_centralbank_debt_request message board sync complete late as no agents reading any messages of this type\n", node_number);*/
29723 
29724  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_debt_request)\n");
29725  rc = MB_SyncComplete(b_gov_centralbank_debt_request);
29726  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_debt_request)\n");
29727  #ifdef ERRCHECK
29728  if (rc != MB_SUCCESS)
29729  {
29730  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_debt_request' board\n");
29731  switch(rc) {
29732  case MB_ERR_INVALID:
29733  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
29734  break;
29735  case MB_ERR_MEMALLOC:
29736  fprintf(stderr, "\t reason: out of memory\n");
29737  break;
29738  case MB_ERR_INTERNAL:
29739  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29740  break;
29741  default:
29742  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29743  break;
29744  }
29745 
29746 
29747  exit(rc);
29748  }
29749  #endif
29750 }
29751 
29752  /* Delete any search trees */
29753 
29754  rc = MB_Clear(b_gov_centralbank_debt_request);
29755  #ifdef ERRCHECK
29756  if (rc != MB_SUCCESS)
29757  {
29758  fprintf(stderr, "ERROR: Could not clear 'gov_centralbank_debt_request' board\n");
29759  switch(rc) {
29760  case MB_ERR_INVALID:
29761  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is invalid\n");
29762  break;
29763  case MB_ERR_LOCKED:
29764  fprintf(stderr, "\t reason: 'gov_centralbank_debt_request' board is locked\n");
29765  break;
29766  case MB_ERR_INTERNAL:
29767  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29768  break;
29769  default:
29770  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
29771  break;
29772 
29773  }
29774 
29775 
29776  exit(rc);
29777  }
29778  #endif
29779 
29780 if(FLAME_gov_centralbank_debt_payment_message_board_read == 0)
29781 {
29782  /*printf("%d> gov_centralbank_debt_payment message board sync complete late as no agents reading any messages of this type\n", node_number);*/
29783 
29784  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_gov_centralbank_debt_payment)\n");
29785  rc = MB_SyncComplete(b_gov_centralbank_debt_payment);
29786  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_gov_centralbank_debt_payment)\n");
29787  #ifdef ERRCHECK
29788  if (rc != MB_SUCCESS)
29789  {
29790  fprintf(stderr, "ERROR: Could not complete sync of 'gov_centralbank_debt_payment' board\n");
29791  switch(rc) {
29792  case MB_ERR_INVALID:
29793  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
29794  break;
29795  case MB_ERR_MEMALLOC:
29796  fprintf(stderr, "\t reason: out of memory\n");
29797  break;
29798  case MB_ERR_INTERNAL:
29799  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29800  break;
29801  default:
29802  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29803  break;
29804  }
29805 
29806 
29807  exit(rc);
29808  }
29809  #endif
29810 }
29811 
29812  /* Delete any search trees */
29813 
29814  rc = MB_Clear(b_gov_centralbank_debt_payment);
29815  #ifdef ERRCHECK
29816  if (rc != MB_SUCCESS)
29817  {
29818  fprintf(stderr, "ERROR: Could not clear 'gov_centralbank_debt_payment' board\n");
29819  switch(rc) {
29820  case MB_ERR_INVALID:
29821  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is invalid\n");
29822  break;
29823  case MB_ERR_LOCKED:
29824  fprintf(stderr, "\t reason: 'gov_centralbank_debt_payment' board is locked\n");
29825  break;
29826  case MB_ERR_INTERNAL:
29827  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29828  break;
29829  default:
29830  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
29831  break;
29832 
29833  }
29834 
29835 
29836  exit(rc);
29837  }
29838  #endif
29839 
29840 
29841  /* If mb is not read then leave sync complete until last possible moment */
29842  if(FLAME_fund_centralbank_update_deposit_message_board_read == 1)
29843  {
29844  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_centralbank_update_deposit)\n");
29845  rc = MB_SyncComplete(b_fund_centralbank_update_deposit);
29846  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_centralbank_update_deposit)\n");
29847  #ifdef ERRCHECK
29848  if (rc != MB_SUCCESS)
29849  {
29850  fprintf(stderr, "ERROR: Could not complete sync of 'fund_centralbank_update_deposit' board\n");
29851  switch(rc) {
29852  case MB_ERR_INVALID:
29853  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
29854  break;
29855  case MB_ERR_MEMALLOC:
29856  fprintf(stderr, "\t reason: out of memory\n");
29857  break;
29858  case MB_ERR_INTERNAL:
29859  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29860  break;
29861  default:
29862  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29863  break;
29864  }
29865 
29866 
29867  exit(rc);
29868  }
29869  #endif
29870 
29871 
29872 
29873  }
29874 
29875  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_do_balance_sheet\n");
29878  {
29882  /* For backwards compatibility set current_xmachine */
29893 
29894 
29895 
29896 
29897 
29898 
29900 
29901 
29902  #ifdef ERRCHECK
29903  if (rc != MB_SUCCESS)
29904  {
29905  fprintf(stderr, "ERROR: Could not create Iterator for 'fund_centralbank_update_deposit'\n");
29906  switch(rc) {
29907  case MB_ERR_INVALID:
29908  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
29909  break;
29910  case MB_ERR_LOCKED:
29911  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is locked\n");
29912  break;
29913  case MB_ERR_MEMALLOC:
29914  fprintf(stderr, "\t reason: out of memory\n");
29915  break;
29916  case MB_ERR_INTERNAL:
29917  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29918  break;
29919  default:
29920 
29921 
29922  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
29923 
29924  break;
29925  }
29926 
29927 
29928  exit(rc);
29929  }
29930  #endif
29931 
29932 
29933 
29935 
29936 
29937  rc = MB_Iterator_Delete(&i_fund_centralbank_update_deposit);
29938  #ifdef ERRCHECK
29939  if (rc != MB_SUCCESS)
29940  {
29941  fprintf(stderr, "ERROR: Could not delete 'fund_centralbank_update_deposit' iterator\n");
29942  switch(rc) {
29943  case MB_ERR_INVALID:
29944  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' iterator is invalid\n");
29945  break;
29946  case MB_ERR_INTERNAL:
29947  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29948  break;
29949  default:
29950  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
29951  break;
29952  }
29953 
29954 
29955  exit(rc);
29956  }
29957  #endif
29958 
29959 
29960  if(i == 1)
29961  {
29963  }
29964  else
29965  {
29967  }
29968 
29969 
29971 
29973  }
29974  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_do_balance_sheet\n");
29975 
29976 
29977  /* If mb is not read then leave sync complete until last possible moment */
29978  if(FLAME_capital_tax_rate_message_board_read == 1)
29979  {
29980  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_capital_tax_rate)\n");
29981  rc = MB_SyncComplete(b_capital_tax_rate);
29982  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_capital_tax_rate)\n");
29983  #ifdef ERRCHECK
29984  if (rc != MB_SUCCESS)
29985  {
29986  fprintf(stderr, "ERROR: Could not complete sync of 'capital_tax_rate' board\n");
29987  switch(rc) {
29988  case MB_ERR_INVALID:
29989  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
29990  break;
29991  case MB_ERR_MEMALLOC:
29992  fprintf(stderr, "\t reason: out of memory\n");
29993  break;
29994  case MB_ERR_INTERNAL:
29995  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
29996  break;
29997  default:
29998  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
29999  break;
30000  }
30001 
30002 
30003  exit(rc);
30004  }
30005  #endif
30006 
30007 
30008 
30009  }
30010 
30011  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start equityfund_credit_check_tax_rate\n");
30014  {
30018  /* For backwards compatibility set current_xmachine */
30029 
30030 
30031 
30032 
30033 
30034 
30035  rc = MB_Iterator_Create(b_capital_tax_rate, &i_capital_tax_rate);
30036 
30037 
30038  #ifdef ERRCHECK
30039  if (rc != MB_SUCCESS)
30040  {
30041  fprintf(stderr, "ERROR: Could not create Iterator for 'capital_tax_rate'\n");
30042  switch(rc) {
30043  case MB_ERR_INVALID:
30044  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
30045  break;
30046  case MB_ERR_LOCKED:
30047  fprintf(stderr, "\t reason: 'capital_tax_rate' board is locked\n");
30048  break;
30049  case MB_ERR_MEMALLOC:
30050  fprintf(stderr, "\t reason: out of memory\n");
30051  break;
30052  case MB_ERR_INTERNAL:
30053  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30054  break;
30055  default:
30056 
30057 
30058  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
30059 
30060  break;
30061  }
30062 
30063 
30064  exit(rc);
30065  }
30066  #endif
30067 
30068 
30069 
30071 
30072 
30073  rc = MB_Iterator_Delete(&i_capital_tax_rate);
30074  #ifdef ERRCHECK
30075  if (rc != MB_SUCCESS)
30076  {
30077  fprintf(stderr, "ERROR: Could not delete 'capital_tax_rate' iterator\n");
30078  switch(rc) {
30079  case MB_ERR_INVALID:
30080  fprintf(stderr, "\t reason: 'capital_tax_rate' iterator is invalid\n");
30081  break;
30082  case MB_ERR_INTERNAL:
30083  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30084  break;
30085  default:
30086  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
30087  break;
30088  }
30089 
30090 
30091  exit(rc);
30092  }
30093  #endif
30094 
30095 
30096  if(i == 1)
30097  {
30099  }
30100  else
30101  {
30103  }
30104 
30105 
30107 
30109  }
30110  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish equityfund_credit_check_tax_rate\n");
30111 
30112 
30113 /* End of layer number 64 */
30114 
30115 /* Clear message boards that have finished being used
30116  * and sync complete if doing late sync complete */
30117 
30118 if(FLAME_fund_centralbank_update_deposit_message_board_read == 0)
30119 {
30120  /*printf("%d> fund_centralbank_update_deposit message board sync complete late as no agents reading any messages of this type\n", node_number);*/
30121 
30122  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_fund_centralbank_update_deposit)\n");
30123  rc = MB_SyncComplete(b_fund_centralbank_update_deposit);
30124  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_fund_centralbank_update_deposit)\n");
30125  #ifdef ERRCHECK
30126  if (rc != MB_SUCCESS)
30127  {
30128  fprintf(stderr, "ERROR: Could not complete sync of 'fund_centralbank_update_deposit' board\n");
30129  switch(rc) {
30130  case MB_ERR_INVALID:
30131  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
30132  break;
30133  case MB_ERR_MEMALLOC:
30134  fprintf(stderr, "\t reason: out of memory\n");
30135  break;
30136  case MB_ERR_INTERNAL:
30137  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30138  break;
30139  default:
30140  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
30141  break;
30142  }
30143 
30144 
30145  exit(rc);
30146  }
30147  #endif
30148 }
30149 
30150  /* Delete any search trees */
30151 
30152  rc = MB_Clear(b_fund_centralbank_update_deposit);
30153  #ifdef ERRCHECK
30154  if (rc != MB_SUCCESS)
30155  {
30156  fprintf(stderr, "ERROR: Could not clear 'fund_centralbank_update_deposit' board\n");
30157  switch(rc) {
30158  case MB_ERR_INVALID:
30159  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is invalid\n");
30160  break;
30161  case MB_ERR_LOCKED:
30162  fprintf(stderr, "\t reason: 'fund_centralbank_update_deposit' board is locked\n");
30163  break;
30164  case MB_ERR_INTERNAL:
30165  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30166  break;
30167  default:
30168  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
30169  break;
30170 
30171  }
30172 
30173 
30174  exit(rc);
30175  }
30176  #endif
30177 
30178 if(FLAME_capital_tax_rate_message_board_read == 0)
30179 {
30180  /*printf("%d> capital_tax_rate message board sync complete late as no agents reading any messages of this type\n", node_number);*/
30181 
30182  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_capital_tax_rate)\n");
30183  rc = MB_SyncComplete(b_capital_tax_rate);
30184  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_capital_tax_rate)\n");
30185  #ifdef ERRCHECK
30186  if (rc != MB_SUCCESS)
30187  {
30188  fprintf(stderr, "ERROR: Could not complete sync of 'capital_tax_rate' board\n");
30189  switch(rc) {
30190  case MB_ERR_INVALID:
30191  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
30192  break;
30193  case MB_ERR_MEMALLOC:
30194  fprintf(stderr, "\t reason: out of memory\n");
30195  break;
30196  case MB_ERR_INTERNAL:
30197  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30198  break;
30199  default:
30200  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
30201  break;
30202  }
30203 
30204 
30205  exit(rc);
30206  }
30207  #endif
30208 }
30209 
30210  /* Delete any search trees */
30211 
30212  rc = MB_Clear(b_capital_tax_rate);
30213  #ifdef ERRCHECK
30214  if (rc != MB_SUCCESS)
30215  {
30216  fprintf(stderr, "ERROR: Could not clear 'capital_tax_rate' board\n");
30217  switch(rc) {
30218  case MB_ERR_INVALID:
30219  fprintf(stderr, "\t reason: 'capital_tax_rate' board is invalid\n");
30220  break;
30221  case MB_ERR_LOCKED:
30222  fprintf(stderr, "\t reason: 'capital_tax_rate' board is locked\n");
30223  break;
30224  case MB_ERR_INTERNAL:
30225  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30226  break;
30227  default:
30228  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
30229  break;
30230 
30231  }
30232 
30233 
30234  exit(rc);
30235  }
30236  #endif
30237 
30238 
30239  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start centralbank_set_interest_rate\n");
30242  {
30246  /* For backwards compatibility set current_xmachine */
30257 
30258 
30259 
30260 
30261 
30263 
30264 
30265 
30266  if(i == 1)
30267  {
30269  }
30270  else
30271  {
30273  }
30274 
30275 
30277 
30279  }
30280  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish centralbank_set_interest_rate\n");
30281 
30282  if(FLAME_interest_rate_message_board_write == 1)
30283  {
30284 
30285  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncStart(b_interest_rate)\n");
30286  rc = MB_SyncStart(b_interest_rate);
30287  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finish MB_SyncStart(b_interest_rate)\n");
30288  #ifdef ERRCHECK
30289  if (rc != MB_SUCCESS)
30290  {
30291  fprintf(stderr, "ERROR: Could not start sync of 'interest_rate' board\n");
30292  switch(rc) {
30293  case MB_ERR_INVALID:
30294  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30295  break;
30296  case MB_ERR_LOCKED:
30297  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
30298  break;
30299  case MB_ERR_MEMALLOC:
30300  fprintf(stderr, "\t reason: out of memory\n");
30301  break;
30302  case MB_ERR_INTERNAL:
30303  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30304  break;
30305  default:
30306  fprintf(stderr, "\t MB_SyncStart returned error code: %d (see libmboard docs for details)\n", rc);
30307  break;
30308  }
30309 
30310 
30311  exit(rc);
30312  }
30313  #endif
30314  }
30315 
30316 
30317 
30318 /* End of layer number 65 */
30319 
30320 /* Clear message boards that have finished being used
30321  * and sync complete if doing late sync complete */
30322 
30323 
30324  /* If mb is not read then leave sync complete until last possible moment */
30325  if(FLAME_interest_rate_message_board_read == 1)
30326  {
30327  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_interest_rate)\n");
30328  rc = MB_SyncComplete(b_interest_rate);
30329  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_interest_rate)\n");
30330  #ifdef ERRCHECK
30331  if (rc != MB_SUCCESS)
30332  {
30333  fprintf(stderr, "ERROR: Could not complete sync of 'interest_rate' board\n");
30334  switch(rc) {
30335  case MB_ERR_INVALID:
30336  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30337  break;
30338  case MB_ERR_MEMALLOC:
30339  fprintf(stderr, "\t reason: out of memory\n");
30340  break;
30341  case MB_ERR_INTERNAL:
30342  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30343  break;
30344  default:
30345  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
30346  break;
30347  }
30348 
30349 
30350  exit(rc);
30351  }
30352  #endif
30353 
30354 
30355 
30356  }
30357 
30358  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_check_interest_rate\n");
30361  {
30365  /* For backwards compatibility set current_xmachine */
30376 
30378  {
30379 
30380 
30381 
30382 
30383  rc = MB_Iterator_Create(b_interest_rate, &i_interest_rate);
30384 
30385 
30386  #ifdef ERRCHECK
30387  if (rc != MB_SUCCESS)
30388  {
30389  fprintf(stderr, "ERROR: Could not create Iterator for 'interest_rate'\n");
30390  switch(rc) {
30391  case MB_ERR_INVALID:
30392  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30393  break;
30394  case MB_ERR_LOCKED:
30395  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
30396  break;
30397  case MB_ERR_MEMALLOC:
30398  fprintf(stderr, "\t reason: out of memory\n");
30399  break;
30400  case MB_ERR_INTERNAL:
30401  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30402  break;
30403  default:
30404 
30405 
30406  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
30407 
30408  break;
30409  }
30410 
30411 
30412  exit(rc);
30413  }
30414  #endif
30415 
30416 
30417 
30419 
30420 
30421  rc = MB_Iterator_Delete(&i_interest_rate);
30422  #ifdef ERRCHECK
30423  if (rc != MB_SUCCESS)
30424  {
30425  fprintf(stderr, "ERROR: Could not delete 'interest_rate' iterator\n");
30426  switch(rc) {
30427  case MB_ERR_INVALID:
30428  fprintf(stderr, "\t reason: 'interest_rate' iterator is invalid\n");
30429  break;
30430  case MB_ERR_INTERNAL:
30431  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30432  break;
30433  default:
30434  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
30435  break;
30436  }
30437 
30438 
30439  exit(rc);
30440  }
30441  #endif
30442 
30443 
30444  if(i == 1)
30445  {
30447  }
30448  else
30449  {
30451  }
30452  }
30453 
30454  current_xmachine_firm = NULL;
30455 
30457  }
30458  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_check_interest_rate\n");
30459 
30460 
30461  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_credit_check_interest_rate\n");
30464  {
30468  /* For backwards compatibility set current_xmachine */
30479 
30481  {
30482 
30483 
30484 
30485 
30486  rc = MB_Iterator_Create(b_interest_rate, &i_interest_rate);
30487 
30488 
30489  #ifdef ERRCHECK
30490  if (rc != MB_SUCCESS)
30491  {
30492  fprintf(stderr, "ERROR: Could not create Iterator for 'interest_rate'\n");
30493  switch(rc) {
30494  case MB_ERR_INVALID:
30495  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30496  break;
30497  case MB_ERR_LOCKED:
30498  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
30499  break;
30500  case MB_ERR_MEMALLOC:
30501  fprintf(stderr, "\t reason: out of memory\n");
30502  break;
30503  case MB_ERR_INTERNAL:
30504  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30505  break;
30506  default:
30507 
30508 
30509  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
30510 
30511  break;
30512  }
30513 
30514 
30515  exit(rc);
30516  }
30517  #endif
30518 
30519 
30520 
30522 
30523 
30524  rc = MB_Iterator_Delete(&i_interest_rate);
30525  #ifdef ERRCHECK
30526  if (rc != MB_SUCCESS)
30527  {
30528  fprintf(stderr, "ERROR: Could not delete 'interest_rate' iterator\n");
30529  switch(rc) {
30530  case MB_ERR_INVALID:
30531  fprintf(stderr, "\t reason: 'interest_rate' iterator is invalid\n");
30532  break;
30533  case MB_ERR_INTERNAL:
30534  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30535  break;
30536  default:
30537  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
30538  break;
30539  }
30540 
30541 
30542  exit(rc);
30543  }
30544  #endif
30545 
30546 
30547  if(i == 1)
30548  {
30550  }
30551  else
30552  {
30554  }
30555  }
30556 
30558 
30560  }
30561  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_credit_check_interest_rate\n");
30562 
30563 
30564  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start bank_credit_check_interest_rate\n");
30567  {
30571  /* For backwards compatibility set current_xmachine */
30582 
30584  {
30585 
30586 
30587 
30588 
30589  rc = MB_Iterator_Create(b_interest_rate, &i_interest_rate);
30590 
30591 
30592  #ifdef ERRCHECK
30593  if (rc != MB_SUCCESS)
30594  {
30595  fprintf(stderr, "ERROR: Could not create Iterator for 'interest_rate'\n");
30596  switch(rc) {
30597  case MB_ERR_INVALID:
30598  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30599  break;
30600  case MB_ERR_LOCKED:
30601  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
30602  break;
30603  case MB_ERR_MEMALLOC:
30604  fprintf(stderr, "\t reason: out of memory\n");
30605  break;
30606  case MB_ERR_INTERNAL:
30607  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30608  break;
30609  default:
30610 
30611 
30612  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
30613 
30614  break;
30615  }
30616 
30617 
30618  exit(rc);
30619  }
30620  #endif
30621 
30622 
30623 
30625 
30626 
30627  rc = MB_Iterator_Delete(&i_interest_rate);
30628  #ifdef ERRCHECK
30629  if (rc != MB_SUCCESS)
30630  {
30631  fprintf(stderr, "ERROR: Could not delete 'interest_rate' iterator\n");
30632  switch(rc) {
30633  case MB_ERR_INVALID:
30634  fprintf(stderr, "\t reason: 'interest_rate' iterator is invalid\n");
30635  break;
30636  case MB_ERR_INTERNAL:
30637  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30638  break;
30639  default:
30640  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
30641  break;
30642  }
30643 
30644 
30645  exit(rc);
30646  }
30647  #endif
30648 
30649 
30650  if(i == 1)
30651  {
30653  }
30654  else
30655  {
30657  }
30658  }
30659 
30660  current_xmachine_bank = NULL;
30661 
30663  }
30664  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish bank_credit_check_interest_rate\n");
30665 
30666 
30667  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start reagency_check_interest_rate\n");
30670  {
30674  /* For backwards compatibility set current_xmachine */
30685 
30687  {
30688 
30689 
30690 
30691 
30692  rc = MB_Iterator_Create(b_interest_rate, &i_interest_rate);
30693 
30694 
30695  #ifdef ERRCHECK
30696  if (rc != MB_SUCCESS)
30697  {
30698  fprintf(stderr, "ERROR: Could not create Iterator for 'interest_rate'\n");
30699  switch(rc) {
30700  case MB_ERR_INVALID:
30701  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30702  break;
30703  case MB_ERR_LOCKED:
30704  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
30705  break;
30706  case MB_ERR_MEMALLOC:
30707  fprintf(stderr, "\t reason: out of memory\n");
30708  break;
30709  case MB_ERR_INTERNAL:
30710  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30711  break;
30712  default:
30713 
30714 
30715  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
30716 
30717  break;
30718  }
30719 
30720 
30721  exit(rc);
30722  }
30723  #endif
30724 
30725 
30726 
30728 
30729 
30730  rc = MB_Iterator_Delete(&i_interest_rate);
30731  #ifdef ERRCHECK
30732  if (rc != MB_SUCCESS)
30733  {
30734  fprintf(stderr, "ERROR: Could not delete 'interest_rate' iterator\n");
30735  switch(rc) {
30736  case MB_ERR_INVALID:
30737  fprintf(stderr, "\t reason: 'interest_rate' iterator is invalid\n");
30738  break;
30739  case MB_ERR_INTERNAL:
30740  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30741  break;
30742  default:
30743  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
30744  break;
30745  }
30746 
30747 
30748  exit(rc);
30749  }
30750  #endif
30751 
30752 
30753  if(i == 1)
30754  {
30756  }
30757  else
30758  {
30760  }
30761  }
30762 
30764 
30766  }
30767  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish reagency_check_interest_rate\n");
30768 
30769 
30770 /* End of layer number 66 */
30771 
30772 /* Clear message boards that have finished being used
30773  * and sync complete if doing late sync complete */
30774 
30775 if(FLAME_interest_rate_message_board_read == 0)
30776 {
30777  /*printf("%d> interest_rate message board sync complete late as no agents reading any messages of this type\n", node_number);*/
30778 
30779  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_interest_rate)\n");
30780  rc = MB_SyncComplete(b_interest_rate);
30781  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_interest_rate)\n");
30782  #ifdef ERRCHECK
30783  if (rc != MB_SUCCESS)
30784  {
30785  fprintf(stderr, "ERROR: Could not complete sync of 'interest_rate' board\n");
30786  switch(rc) {
30787  case MB_ERR_INVALID:
30788  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30789  break;
30790  case MB_ERR_MEMALLOC:
30791  fprintf(stderr, "\t reason: out of memory\n");
30792  break;
30793  case MB_ERR_INTERNAL:
30794  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30795  break;
30796  default:
30797  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
30798  break;
30799  }
30800 
30801 
30802  exit(rc);
30803  }
30804  #endif
30805 }
30806 
30807  /* Delete any search trees */
30808 
30809  rc = MB_Clear(b_interest_rate);
30810  #ifdef ERRCHECK
30811  if (rc != MB_SUCCESS)
30812  {
30813  fprintf(stderr, "ERROR: Could not clear 'interest_rate' board\n");
30814  switch(rc) {
30815  case MB_ERR_INVALID:
30816  fprintf(stderr, "\t reason: 'interest_rate' board is invalid\n");
30817  break;
30818  case MB_ERR_LOCKED:
30819  fprintf(stderr, "\t reason: 'interest_rate' board is locked\n");
30820  break;
30821  case MB_ERR_INTERNAL:
30822  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30823  break;
30824  default:
30825  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
30826  break;
30827 
30828  }
30829 
30830 
30831  exit(rc);
30832  }
30833  #endif
30834 
30835 
30836  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_credit_update_mortgage_rates\n");
30839  {
30843  /* For backwards compatibility set current_xmachine */
30854 
30855 
30856 
30857 
30858 
30860 
30861 
30862 
30863  if(i == 1)
30864  {
30866  }
30867  else
30868  {
30870  }
30871 
30872 
30874 
30876  }
30877  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_credit_update_mortgage_rates\n");
30878 
30879 
30880  /* If mb is not read then leave sync complete until last possible moment */
30881  if(FLAME_labour_tax_rate_message_board_read == 1)
30882  {
30883  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_labour_tax_rate)\n");
30884  rc = MB_SyncComplete(b_labour_tax_rate);
30885  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_labour_tax_rate)\n");
30886  #ifdef ERRCHECK
30887  if (rc != MB_SUCCESS)
30888  {
30889  fprintf(stderr, "ERROR: Could not complete sync of 'labour_tax_rate' board\n");
30890  switch(rc) {
30891  case MB_ERR_INVALID:
30892  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
30893  break;
30894  case MB_ERR_MEMALLOC:
30895  fprintf(stderr, "\t reason: out of memory\n");
30896  break;
30897  case MB_ERR_INTERNAL:
30898  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30899  break;
30900  default:
30901  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
30902  break;
30903  }
30904 
30905 
30906  exit(rc);
30907  }
30908  #endif
30909 
30910 
30911 
30912  }
30913 
30914  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start firm_credit_check_tax_rate\n");
30917  {
30921  /* For backwards compatibility set current_xmachine */
30932 
30933 
30934 
30935 
30936 
30937 
30938  rc = MB_Iterator_Create(b_labour_tax_rate, &i_labour_tax_rate);
30939 
30940 
30941  #ifdef ERRCHECK
30942  if (rc != MB_SUCCESS)
30943  {
30944  fprintf(stderr, "ERROR: Could not create Iterator for 'labour_tax_rate'\n");
30945  switch(rc) {
30946  case MB_ERR_INVALID:
30947  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
30948  break;
30949  case MB_ERR_LOCKED:
30950  fprintf(stderr, "\t reason: 'labour_tax_rate' board is locked\n");
30951  break;
30952  case MB_ERR_MEMALLOC:
30953  fprintf(stderr, "\t reason: out of memory\n");
30954  break;
30955  case MB_ERR_INTERNAL:
30956  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30957  break;
30958  default:
30959 
30960 
30961  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
30962 
30963  break;
30964  }
30965 
30966 
30967  exit(rc);
30968  }
30969  #endif
30970 
30971 
30972 
30974 
30975 
30976  rc = MB_Iterator_Delete(&i_labour_tax_rate);
30977  #ifdef ERRCHECK
30978  if (rc != MB_SUCCESS)
30979  {
30980  fprintf(stderr, "ERROR: Could not delete 'labour_tax_rate' iterator\n");
30981  switch(rc) {
30982  case MB_ERR_INVALID:
30983  fprintf(stderr, "\t reason: 'labour_tax_rate' iterator is invalid\n");
30984  break;
30985  case MB_ERR_INTERNAL:
30986  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
30987  break;
30988  default:
30989  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
30990  break;
30991  }
30992 
30993 
30994  exit(rc);
30995  }
30996  #endif
30997 
30998 
30999  if(i == 1)
31000  {
31002  }
31003  else
31004  {
31006  }
31007 
31008 
31009  current_xmachine_firm = NULL;
31010 
31012  }
31013  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish firm_credit_check_tax_rate\n");
31014 
31015 
31016 /* End of layer number 67 */
31017 
31018 /* Clear message boards that have finished being used
31019  * and sync complete if doing late sync complete */
31020 
31021 
31022  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("start household_credit_check_tax_rate\n");
31025  {
31029  /* For backwards compatibility set current_xmachine */
31040 
31041 
31042 
31043 
31044 
31045 
31046  rc = MB_Iterator_Create(b_labour_tax_rate, &i_labour_tax_rate);
31047 
31048 
31049  #ifdef ERRCHECK
31050  if (rc != MB_SUCCESS)
31051  {
31052  fprintf(stderr, "ERROR: Could not create Iterator for 'labour_tax_rate'\n");
31053  switch(rc) {
31054  case MB_ERR_INVALID:
31055  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
31056  break;
31057  case MB_ERR_LOCKED:
31058  fprintf(stderr, "\t reason: 'labour_tax_rate' board is locked\n");
31059  break;
31060  case MB_ERR_MEMALLOC:
31061  fprintf(stderr, "\t reason: out of memory\n");
31062  break;
31063  case MB_ERR_INTERNAL:
31064  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
31065  break;
31066  default:
31067 
31068 
31069  fprintf(stderr, "\t MB_Iterator_Create returned error code: %d (see libmboard docs for details)\n", rc);
31070 
31071  break;
31072  }
31073 
31074 
31075  exit(rc);
31076  }
31077  #endif
31078 
31079 
31080 
31082 
31083 
31084  rc = MB_Iterator_Delete(&i_labour_tax_rate);
31085  #ifdef ERRCHECK
31086  if (rc != MB_SUCCESS)
31087  {
31088  fprintf(stderr, "ERROR: Could not delete 'labour_tax_rate' iterator\n");
31089  switch(rc) {
31090  case MB_ERR_INVALID:
31091  fprintf(stderr, "\t reason: 'labour_tax_rate' iterator is invalid\n");
31092  break;
31093  case MB_ERR_INTERNAL:
31094  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
31095  break;
31096  default:
31097  fprintf(stderr, "\t MB_Iterator_Delete returned error code: %d (see libmboard docs for details)\n", rc);
31098  break;
31099  }
31100 
31101 
31102  exit(rc);
31103  }
31104  #endif
31105 
31106 
31107  if(i == 1)
31108  {
31110  }
31111  else
31112  {
31114  }
31115 
31116 
31118 
31120  }
31121  if(FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS) printf("finish household_credit_check_tax_rate\n");
31122 
31123 
31124 /* End of layer number 68 */
31125 
31126 /* Clear message boards that have finished being used
31127  * and sync complete if doing late sync complete */
31128 
31129 if(FLAME_labour_tax_rate_message_board_read == 0)
31130 {
31131  /*printf("%d> labour_tax_rate message board sync complete late as no agents reading any messages of this type\n", node_number);*/
31132 
31133  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("start MB_SyncComplete(b_labour_tax_rate)\n");
31134  rc = MB_SyncComplete(b_labour_tax_rate);
31135  if(FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS) printf("finsh MB_SyncComplete(b_labour_tax_rate)\n");
31136  #ifdef ERRCHECK
31137  if (rc != MB_SUCCESS)
31138  {
31139  fprintf(stderr, "ERROR: Could not complete sync of 'labour_tax_rate' board\n");
31140  switch(rc) {
31141  case MB_ERR_INVALID:
31142  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
31143  break;
31144  case MB_ERR_MEMALLOC:
31145  fprintf(stderr, "\t reason: out of memory\n");
31146  break;
31147  case MB_ERR_INTERNAL:
31148  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
31149  break;
31150  default:
31151  fprintf(stderr, "\t MB_SyncComplete returned error code: %d (see libmboard docs for details)\n", rc);
31152  break;
31153  }
31154 
31155 
31156  exit(rc);
31157  }
31158  #endif
31159 }
31160 
31161  /* Delete any search trees */
31162 
31163  rc = MB_Clear(b_labour_tax_rate);
31164  #ifdef ERRCHECK
31165  if (rc != MB_SUCCESS)
31166  {
31167  fprintf(stderr, "ERROR: Could not clear 'labour_tax_rate' board\n");
31168  switch(rc) {
31169  case MB_ERR_INVALID:
31170  fprintf(stderr, "\t reason: 'labour_tax_rate' board is invalid\n");
31171  break;
31172  case MB_ERR_LOCKED:
31173  fprintf(stderr, "\t reason: 'labour_tax_rate' board is locked\n");
31174  break;
31175  case MB_ERR_INTERNAL:
31176  fprintf(stderr, "\t reason: internal error. Recompile libmoard in debug mode for more info \n");
31177  break;
31178  default:
31179  fprintf(stderr, "\t MB_Clear returned error code: %d (see libmboard docs for details)\n", rc);
31180  break;
31181 
31182  }
31183 
31184 
31185  exit(rc);
31186  }
31187  #endif
31188 
31189 
31190 
31191  /*printf("firm_FirmHousingPrice_state->count = %d\n", firm_FirmHousingPrice_state->count);*/
31193 
31194  /*printf("firm_FirmHousingSell_state->count = %d\n", firm_FirmHousingSell_state->count);*/
31196 
31197  /*printf("firm_FirmHousingMarket_state->count = %d\n", firm_FirmHousingMarket_state->count);*/
31199 
31200  /*printf("firm_FirmCreditCheckTaxRate_state->count = %d\n", firm_FirmCreditCheckTaxRate_state->count);*/
31202 
31203  /*printf("firm_end_state->count = %d\n", firm_end_state->count);*/
31204  firm_end_state->count = 0;
31205 
31206  /*printf("firm_FirmCreditInsolvencyCheck_state->count = %d\n", firm_FirmCreditInsolvencyCheck_state->count);*/
31208 
31209  /*printf("firm_FirmCreditDividendPayments_state->count = %d\n", firm_FirmCreditDividendPayments_state->count);*/
31211 
31212  /*printf("firm_FirmCreditBalanceSheet_state->count = %d\n", firm_FirmCreditBalanceSheet_state->count);*/
31214 
31215  /*printf("firm_FirmCreditBankruptcy_state->count = %d\n", firm_FirmCreditBankruptcy_state->count);*/
31217 
31218  /*printf("firm_FirmCreditLiquidityRecheck_state->count = %d\n", firm_FirmCreditLiquidityRecheck_state->count);*/
31220 
31221  /*printf("firm_FirmCreditIlliquidityStatus_state->count = %d\n", firm_FirmCreditIlliquidityStatus_state->count);*/
31223 
31224  /*printf("firm_FirmCreditLoanBorrow2_state->count = %d\n", firm_FirmCreditLoanBorrow2_state->count);*/
31226 
31227  /*printf("firm_FirmCreditLoanBorrow1_state->count = %d\n", firm_FirmCreditLoanBorrow1_state->count);*/
31229 
31230  /*printf("firm_FirmCreditPayments_state->count = %d\n", firm_FirmCreditPayments_state->count);*/
31232 
31233  /*printf("firm_FirmCreditStatus_state->count = %d\n", firm_FirmCreditStatus_state->count);*/
31235 
31236  /*printf("firm_FirmCreditLiquidityNeed_state->count = %d\n", firm_FirmCreditLiquidityNeed_state->count);*/
31238 
31239  /*printf("firm_FirmCreditComputeDividends_state->count = %d\n", firm_FirmCreditComputeDividends_state->count);*/
31241 
31242  /*printf("firm_FirmCreditInvestment_state->count = %d\n", firm_FirmCreditInvestment_state->count);*/
31244 
31245  /*printf("firm_FirmConstructionLabourDemand_state->count = %d\n", firm_FirmConstructionLabourDemand_state->count);*/
31247 
31248  /*printf("firm_FirmProductionLabourDemand_state->count = %d\n", firm_FirmProductionLabourDemand_state->count);*/
31250 
31251  /*printf("firm_FirmProductionPlanning_state->count = %d\n", firm_FirmProductionPlanning_state->count);*/
31253 
31254  /*printf("firm_FirmProductionConstructor_state->count = %d\n", firm_FirmProductionConstructor_state->count);*/
31256 
31257  /*printf("firm_FirmProductionRegular_state->count = %d\n", firm_FirmProductionRegular_state->count);*/
31259 
31260  /*printf("firm_FirmProductionRoleCheck_state->count = %d\n", firm_FirmProductionRoleCheck_state->count);*/
31262 
31263  /*printf("firm_FirmProductionSkip_state->count = %d\n", firm_FirmProductionSkip_state->count);*/
31265 
31266  /*printf("firm_FirmProductionStart_state->count = %d\n", firm_FirmProductionStart_state->count);*/
31268 
31269  /*printf("firm_FirmLabourWageAdjustment_state->count = %d\n", firm_FirmLabourWageAdjustment_state->count);*/
31271 
31272  /*printf("firm_FirmLabourPayWages_state->count = %d\n", firm_FirmLabourPayWages_state->count);*/
31274 
31275  /*printf("firm_FirmLabourStage2End_state->count = %d\n", firm_FirmLabourStage2End_state->count);*/
31277 
31278  /*printf("firm_FirmLabourStage2_state->count = %d\n", firm_FirmLabourStage2_state->count);*/
31280 
31281  /*printf("firm_FirmLabourStage1Application_state->count = %d\n", firm_FirmLabourStage1Application_state->count);*/
31283 
31284  /*printf("firm_FirmLabourStage1End_state->count = %d\n", firm_FirmLabourStage1End_state->count);*/
31286 
31287  /*printf("firm_FirmLabourStage1_state->count = %d\n", firm_FirmLabourStage1_state->count);*/
31289 
31290  /*printf("firm_FirmLabourStart_state->count = %d\n", firm_FirmLabourStart_state->count);*/
31292 
31293  /*printf("firm_FirmConsumptionPrice_state->count = %d\n", firm_FirmConsumptionPrice_state->count);*/
31295 
31296  /*printf("firm_FirmReceiveSales_state->count = %d\n", firm_FirmReceiveSales_state->count);*/
31298 
31299  /*printf("firm_FirmConsumptionMarket_state->count = %d\n", firm_FirmConsumptionMarket_state->count);*/
31301 
31302  /*printf("firm_FirmHousingStart_state->count = %d\n", firm_FirmHousingStart_state->count);*/
31304 
31305  /*printf("firm_FirmConsumptionStart_state->count = %d\n", firm_FirmConsumptionStart_state->count);*/
31307 
31308  /*printf("firm_FirmCreditPolicyChecks_state->count = %d\n", firm_FirmCreditPolicyChecks_state->count);*/
31310 
31311  /*printf("firm_FirmUpdateDeposits_state->count = %d\n", firm_FirmUpdateDeposits_state->count);*/
31313 
31314  /*printf("firm_FirmCreditStart_state->count = %d\n", firm_FirmCreditStart_state->count);*/
31316 
31317  /*printf("firm_FirmInitBalanceSheet_state->count = %d\n", firm_FirmInitBalanceSheet_state->count);*/
31319 
31320  /*printf("firm_FirmInitEmployment_state->count = %d\n", firm_FirmInitEmployment_state->count);*/
31322 
31323  /*printf("firm_FirmLoop_state->count = %d\n", firm_FirmLoop_state->count);*/
31325 
31326  /*printf("firm_FirmInitPostId_state->count = %d\n", firm_FirmInitPostId_state->count);*/
31328 
31329  /*printf("firm_start_state->count = %d\n", firm_start_state->count);*/
31330  firm_start_state->count = 0;
31331 
31332  /*printf("household_HHHousingWriteOff_state->count = %d\n", household_HHHousingWriteOff_state->count);*/
31334 
31335  /*printf("household_HHHousingPayments_state->count = %d\n", household_HHHousingPayments_state->count);*/
31337 
31338  /*printf("household_HHHousingBargain_state->count = %d\n", household_HHHousingBargain_state->count);*/
31340 
31341  /*printf("household_HHHousingRevenue_state->count = %d\n", household_HHHousingRevenue_state->count);*/
31343 
31344  /*printf("household_HHHousingCheckWealth_state->count = %d\n", household_HHHousingCheckWealth_state->count);*/
31346 
31347  /*printf("household_HHHousingPrice_state->count = %d\n", household_HHHousingPrice_state->count);*/
31349 
31350  /*printf("household_HHHousingRole_state->count = %d\n", household_HHHousingRole_state->count);*/
31352 
31353  /*printf("household_HHCreditCheckTaxRate_state->count = %d\n", household_HHCreditCheckTaxRate_state->count);*/
31355 
31356  /*printf("household_HHCreditUpdateAnnuity_state->count = %d\n", household_HHCreditUpdateAnnuity_state->count);*/
31358 
31359  /*printf("household_end_state->count = %d\n", household_end_state->count);*/
31361 
31362  /*printf("household_HHCreditBalanceSheet_state->count = %d\n", household_HHCreditBalanceSheet_state->count);*/
31364 
31365  /*printf("household_HHCreditIsCapitalist_state->count = %d\n", household_HHCreditIsCapitalist_state->count);*/
31367 
31368  /*printf("household_HHCreditMonthly_state->count = %d\n", household_HHCreditMonthly_state->count);*/
31370 
31371  /*printf("household_HHLabourEmploymentStatus_state->count = %d\n", household_HHLabourEmploymentStatus_state->count);*/
31373 
31374  /*printf("household_HHLabourPayroll_state->count = %d\n", household_HHLabourPayroll_state->count);*/
31376 
31377  /*printf("household_HHLabourStage1Placement_state->count = %d\n", household_HHLabourStage1Placement_state->count);*/
31379 
31380  /*printf("household_HHLabourStage1Applications_state->count = %d\n", household_HHLabourStage1Applications_state->count);*/
31382 
31383  /*printf("household_HHLabourStage2_state->count = %d\n", household_HHLabourStage2_state->count);*/
31385 
31386  /*printf("household_HHLabourStage1_state->count = %d\n", household_HHLabourStage1_state->count);*/
31388 
31389  /*printf("household_HHLabourStart_state->count = %d\n", household_HHLabourStart_state->count);*/
31391 
31392  /*printf("household_HHHousingStart_state->count = %d\n", household_HHHousingStart_state->count);*/
31394 
31395  /*printf("household_HHConsumptionRecieveGoods_state->count = %d\n", household_HHConsumptionRecieveGoods_state->count);*/
31397 
31398  /*printf("household_HHConsumptionMonthly_state->count = %d\n", household_HHConsumptionMonthly_state->count);*/
31400 
31401  /*printf("household_HHConsumptionWeekly_state->count = %d\n", household_HHConsumptionWeekly_state->count);*/
31403 
31404  /*printf("household_HHConsumptionStart_state->count = %d\n", household_HHConsumptionStart_state->count);*/
31406 
31407  /*printf("household_HHCreditPolicyChecks_state->count = %d\n", household_HHCreditPolicyChecks_state->count);*/
31409 
31410  /*printf("household_HouseholdUpdateDeposits_state->count = %d\n", household_HouseholdUpdateDeposits_state->count);*/
31412 
31413  /*printf("household_HHCreditStart_state->count = %d\n", household_HHCreditStart_state->count);*/
31415 
31416  /*printf("household_HouseholdInitBalanceSheet_state->count = %d\n", household_HouseholdInitBalanceSheet_state->count);*/
31418 
31419  /*printf("household_HouseholdInitEmployment_state->count = %d\n", household_HouseholdInitEmployment_state->count);*/
31421 
31422  /*printf("household_HouseholdLoop_state->count = %d\n", household_HouseholdLoop_state->count);*/
31424 
31425  /*printf("household_HouseholdInitPostId_state->count = %d\n", household_HouseholdInitPostId_state->count);*/
31427 
31428  /*printf("household_start_state->count = %d\n", household_start_state->count);*/
31430 
31431  /*printf("equityfund_EFCreditPolicyChecks_state->count = %d\n", equityfund_EFCreditPolicyChecks_state->count);*/
31433 
31434  /*printf("equityfund_EFCreditBalanceSheet_state->count = %d\n", equityfund_EFCreditBalanceSheet_state->count);*/
31436 
31437  /*printf("equityfund_end_state->count = %d\n", equityfund_end_state->count);*/
31439 
31440  /*printf("equityfund_EFCreditDistributeShares_state->count = %d\n", equityfund_EFCreditDistributeShares_state->count);*/
31442 
31443  /*printf("equityfund_EFCreditShareCollectionFirms_state->count = %d\n", equityfund_EFCreditShareCollectionFirms_state->count);*/
31445 
31446  /*printf("equityfund_EFCreditShareCollectionBanks_state->count = %d\n", equityfund_EFCreditShareCollectionBanks_state->count);*/
31448 
31449  /*printf("equityfund_EFCreditIncomeStatement_state->count = %d\n", equityfund_EFCreditIncomeStatement_state->count);*/
31451 
31452  /*printf("equityfund_EFLabourMarket_state->count = %d\n", equityfund_EFLabourMarket_state->count);*/
31454 
31455  /*printf("equityfund_EquityFundCredit_state->count = %d\n", equityfund_EquityFundCredit_state->count);*/
31457 
31458  /*printf("equityfund_EquityFundLoop_state->count = %d\n", equityfund_EquityFundLoop_state->count);*/
31460 
31461  /*printf("equityfund_start_state->count = %d\n", equityfund_start_state->count);*/
31463 
31464  /*printf("bank_BankHousingWriteOff_state->count = %d\n", bank_BankHousingWriteOff_state->count);*/
31466 
31467  /*printf("bank_BankHousingMortgages_state->count = %d\n", bank_BankHousingMortgages_state->count);*/
31469 
31470  /*printf("bank_BankHousingSales_state->count = %d\n", bank_BankHousingSales_state->count);*/
31472 
31473  /*printf("bank_BankHousingCrediting_state->count = %d\n", bank_BankHousingCrediting_state->count);*/
31475 
31476  /*printf("bank_end_state->count = %d\n", bank_end_state->count);*/
31477  bank_end_state->count = 0;
31478 
31479  /*printf("bank_BankCreditLoanInterests_state->count = %d\n", bank_BankCreditLoanInterests_state->count);*/
31481 
31482  /*printf("bank_BankCreditNewEntrants_state->count = %d\n", bank_BankCreditNewEntrants_state->count);*/
31484 
31485  /*printf("bank_BankCreditLoanWriteOffs_state->count = %d\n", bank_BankCreditLoanWriteOffs_state->count);*/
31487 
31488  /*printf("bank_BankCreditRequest2_state->count = %d\n", bank_BankCreditRequest2_state->count);*/
31490 
31491  /*printf("bank_BankCreditRequest1_state->count = %d\n", bank_BankCreditRequest1_state->count);*/
31493 
31494  /*printf("bank_BankCreditBalanceSheet_state->count = %d\n", bank_BankCreditBalanceSheet_state->count);*/
31496 
31497  /*printf("bank_BankCreditDividends_state->count = %d\n", bank_BankCreditDividends_state->count);*/
31499 
31500  /*printf("bank_BankHousingMarket_state->count = %d\n", bank_BankHousingMarket_state->count);*/
31502 
31503  /*printf("bank_BankCreditPolicyChecks_state->count = %d\n", bank_BankCreditPolicyChecks_state->count);*/
31505 
31506  /*printf("bank_BankUpdateDeposits_state->count = %d\n", bank_BankUpdateDeposits_state->count);*/
31508 
31509  /*printf("bank_BankCreditStart_state->count = %d\n", bank_BankCreditStart_state->count);*/
31511 
31512  /*printf("bank_BankInitBalanceSheet_state->count = %d\n", bank_BankInitBalanceSheet_state->count);*/
31514 
31515  /*printf("bank_BankInitDeposits_state->count = %d\n", bank_BankInitDeposits_state->count);*/
31517 
31518  /*printf("bank_BankInitMortgages_state->count = %d\n", bank_BankInitMortgages_state->count);*/
31520 
31521  /*printf("bank_BankLoop_state->count = %d\n", bank_BankLoop_state->count);*/
31523 
31524  /*printf("bank_BankInitLoans_state->count = %d\n", bank_BankInitLoans_state->count);*/
31526 
31527  /*printf("bank_start_state->count = %d\n", bank_start_state->count);*/
31528  bank_start_state->count = 0;
31529 
31530  /*printf("government_GovernmentUpdatePolicy_state->count = %d\n", government_GovernmentUpdatePolicy_state->count);*/
31532 
31533  /*printf("government_GovernmentBalanceSheet_state->count = %d\n", government_GovernmentBalanceSheet_state->count);*/
31535 
31536  /*printf("government_GovernmentIncomeStatement_state->count = %d\n", government_GovernmentIncomeStatement_state->count);*/
31538 
31539  /*printf("government_end_state->count = %d\n", government_end_state->count);*/
31541 
31542  /*printf("government_GovernmentLabourTax_state->count = %d\n", government_GovernmentLabourTax_state->count);*/
31544 
31545  /*printf("government_GovernmentUnemploymentBenefits_state->count = %d\n", government_GovernmentUnemploymentBenefits_state->count);*/
31547 
31548  /*printf("government_GovernmentMonthly_state->count = %d\n", government_GovernmentMonthly_state->count);*/
31550 
31551  /*printf("government_GovernmentFiscalPolicy_state->count = %d\n", government_GovernmentFiscalPolicy_state->count);*/
31553 
31554  /*printf("government_GovernmentLabourStatus_state->count = %d\n", government_GovernmentLabourStatus_state->count);*/
31556 
31557  /*printf("government_GovernmentCredit_state->count = %d\n", government_GovernmentCredit_state->count);*/
31559 
31560  /*printf("government_GovernmentLoop_state->count = %d\n", government_GovernmentLoop_state->count);*/
31562 
31563  /*printf("government_start_state->count = %d\n", government_start_state->count);*/
31565 
31566  /*printf("centralbank_CentralBankUpdateInterestRate_state->count = %d\n", centralbank_CentralBankUpdateInterestRate_state->count);*/
31568 
31569  /*printf("centralbank_CentralBankBalanceSheet_state->count = %d\n", centralbank_CentralBankBalanceSheet_state->count);*/
31571 
31572  /*printf("centralbank_CentralBankGovernmentRequests_state->count = %d\n", centralbank_CentralBankGovernmentRequests_state->count);*/
31574 
31575  /*printf("centralbank_end_state->count = %d\n", centralbank_end_state->count);*/
31577 
31578  /*printf("centralbank_CentralBankDebtRequests_state->count = %d\n", centralbank_CentralBankDebtRequests_state->count);*/
31580 
31581  /*printf("centralbank_CentralBankPolicy_state->count = %d\n", centralbank_CentralBankPolicy_state->count);*/
31583 
31584  /*printf("centralbank_CentralBankLabour_state->count = %d\n", centralbank_CentralBankLabour_state->count);*/
31586 
31587  /*printf("centralbank_CentralBankHousing_state->count = %d\n", centralbank_CentralBankHousing_state->count);*/
31589 
31590  /*printf("centralbank_CentralBankConsumptionPrices_state->count = %d\n", centralbank_CentralBankConsumptionPrices_state->count);*/
31592 
31593  /*printf("centralbank_CentralBankConsumption_state->count = %d\n", centralbank_CentralBankConsumption_state->count);*/
31595 
31596  /*printf("centralbank_CentralBankCredit_state->count = %d\n", centralbank_CentralBankCredit_state->count);*/
31598 
31599  /*printf("centralbank_CentralBankLoop_state->count = %d\n", centralbank_CentralBankLoop_state->count);*/
31601 
31602  /*printf("centralbank_CentralBankInitBalanceSheet_state->count = %d\n", centralbank_CentralBankInitBalanceSheet_state->count);*/
31604 
31605  /*printf("centralbank_start_state->count = %d\n", centralbank_start_state->count);*/
31607 
31608  /*printf("jpoffice_JPOLabourStage2_state->count = %d\n", jpoffice_JPOLabourStage2_state->count);*/
31610 
31611  /*printf("jpoffice_end_state->count = %d\n", jpoffice_end_state->count);*/
31613 
31614  /*printf("jpoffice_JPOLabourMarket_state->count = %d\n", jpoffice_JPOLabourMarket_state->count);*/
31616 
31617  /*printf("jpoffice_JPOfficeLoop_state->count = %d\n", jpoffice_JPOfficeLoop_state->count);*/
31619 
31620  /*printf("jpoffice_JPOfficeInitEmployment_state->count = %d\n", jpoffice_JPOfficeInitEmployment_state->count);*/
31622 
31623  /*printf("jpoffice_start_state->count = %d\n", jpoffice_start_state->count);*/
31625 
31626  /*printf("mall_MallConsumptionSummary_state->count = %d\n", mall_MallConsumptionSummary_state->count);*/
31628 
31629  /*printf("mall_end_state->count = %d\n", mall_end_state->count);*/
31630  mall_end_state->count = 0;
31631 
31632  /*printf("mall_MallConsumptionMarket_state->count = %d\n", mall_MallConsumptionMarket_state->count);*/
31634 
31635  /*printf("mall_start_state->count = %d\n", mall_start_state->count);*/
31636  mall_start_state->count = 0;
31637 
31638  /*printf("reagency_REAgencyHousingSummary_state->count = %d\n", reagency_REAgencyHousingSummary_state->count);*/
31640 
31641  /*printf("reagency_end_state->count = %d\n", reagency_end_state->count);*/
31643 
31644  /*printf("reagency_REAgencyCreditPolicyChecks_state->count = %d\n", reagency_REAgencyCreditPolicyChecks_state->count);*/
31646 
31647  /*printf("reagency_REAgencyHousingMarket_state->count = %d\n", reagency_REAgencyHousingMarket_state->count);*/
31649 
31650  /*printf("reagency_start_state->count = %d\n", reagency_start_state->count);*/
31652 
31653  /* Move agents to their start states */
31654 
31657  {
31660 
31662  }
31663 
31666  {
31669 
31671  }
31672 
31675  {
31678 
31680  }
31681 
31684  {
31687 
31689  }
31690 
31693  {
31696 
31698  }
31699 
31702  {
31705 
31707  }
31708 
31711  {
31714 
31716  }
31717 
31720  {
31723 
31725  }
31726 
31729  {
31732 
31734  }
31735 
31737  {
31739  }
31740 
31741  /* Calculate if any agents need to jump S.P. */
31742  /* propagate_agents(); */
31743  /* Save iteration time to log file */
31744 
31745  if((file = fopen(logfilepath, "a"))==NULL)
31746  {
31747  printf("Error: cannot open file '%s' for writing\n", logfilepath);
31748  exit(0);
31749  }
31750  (void)fputs("<iteration><no>", file);
31751  sprintf(data, "%i", iteration_loop);
31752  (void)fputs(data, file);
31753  (void)fputs("</no><time>", file);
31754  sprintf(data, "%d", (int)((get_time() - interval) * 1000) );
31755  (void)fputs(data, file);
31756  (void)fputs("</time></iteration>\n", file);
31757  (void)fclose(file);
31758 
31759  }
31760 
31761 
31762 
31763  /* Stop timing and print total time */
31764  stop = get_time();
31765  total_time = stop - start;
31766  printf("Execution time - %d:%02d:%03d [mins:secs:msecs]\n",
31767  (int)(total_time/60), ((int)total_time)%60, (((int)(total_time * 1000.0)) % 1000));
31768 
31769  clean_up(0);
31770 
31771  /* Exit successfully by returning zero to Operating System */
31772  return 0;
31773 }