Changeset 3248

Show
Ignore:
Timestamp:
01/26/12 21:05:29 (4 months ago)
Author:
erkn
Message:

cogen: moved init after all positioning and assignment of setting parameters.

This caused some target_index used in init to use not yet assigned pos/rot.

Guide_anyshape: get rid of a compilation warning (access null pointer) for an

other one (format ‘%s’ expects type ‘char *’, but argument 4 has type ‘int’)

Location:
branches/mcxtrace-1.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/mcxtrace-1.0/nlib/optics/Guide_anyshape.comp

    r3117 r3248  
    103103  if (reflect && strlen(reflect)) { 
    104104    if (Table_Read(&pTable, reflect, 1) <= 0) /* read 1st block data from file into pTable */ 
    105       exit(fprintf(stderr,"Guide_anyshape: %s: can not read file %s. Aborting coating used.\n", NAME_CURRENT_COMP, (char*)reflect)); 
     105      exit(fprintf(stderr,"Guide_anyshape: %s: can not read file %s. Aborting.\n", NAME_CURRENT_COMP, reflect)); 
    106106    else  
    107107      Table_Rebin(&pTable);         /* rebin as evenly, increasing array */ 
  • branches/mcxtrace-1.0/src/cogen.c.in

    r3164 r3248  
    944944    last = comp; 
    945945 
    946     coutf("  /* Initializations for component %s. */", comp->name); 
    947     coutf("  SIG_MESSAGE(\"%s (Init)\");", comp->name); /* signal handler message */ 
    948     /* Initialization of the component setting parameters. */ 
     946    coutf("  /* Setting parameters for component %s. */", comp->name); 
     947    coutf("  SIG_MESSAGE(\"%s (Init:SetPar)\");", comp->name); /* signal handler message */ 
     948    /* Setting parameters of the component setting parameters. */ 
    949949    setpar = list_iterate(comp->def->set_par); 
    950950    while((par = list_next(setpar)) != NULL) 
     
    971971    cout(""); 
    972972 
     973  } /* end while instr->complist */ 
     974  list_iterate_end(liter); 
     975   
     976  /* Initialization of component and user initialization code. */ 
     977  cout("  /* Component initializations. */"); 
     978  liter = list_iterate(instr->complist); 
     979  while((comp = list_next(liter)) != NULL) 
     980  { 
     981    List_handle setpar; 
     982    struct comp_iformal *par; 
     983 
     984    coutf("  /* Initializations for component %s. */", comp->name); 
     985    coutf("  SIG_MESSAGE(\"%s (Init)\");", comp->name); /* signal handler message */ 
     986 
    973987    /* Users initializations. */ 
    974988    if(list_len(comp->def->init_code->lines) > 0) 
     
    976990                            comp->def->init_code); 
    977991    cout(""); 
    978   } /* end while instr->complist */ 
     992  } 
    979993  list_iterate_end(liter); 
    980994