/[ascend]/trunk/base/generic/compiler/instantiate.c
ViewVC logotype

Diff of /trunk/base/generic/compiler/instantiate.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 909 by johnpye, Thu Oct 26 12:44:41 2006 UTC revision 910 by johnpye, Thu Oct 26 13:35:25 2006 UTC
# Line 5349  int Pass2ExecuteBlackBoxEXTLoop(struct I Line 5349  int Pass2ExecuteBlackBoxEXTLoop(struct I
5349    unsigned long start,end;    unsigned long start,end;
5350    struct Set *extrange= NULL;    struct Set *extrange= NULL;
5351    
5352  /* common stuff do once ------------ */    /* common stuff do once ------------ */
5353  /* note ignoring return codes as all is guaranteed to work by passing  
5354  the checks done before this statement was attempted. */    /*
5355        note ignoring return codes as all is guaranteed to work by passing
5356        the checks done before this statement was attempted.
5357      */
5358    if (ExternalStatDataBlackBox(statement) != NULL) {    if (ExternalStatDataBlackBox(statement) != NULL) {
5359      data = CheckExtCallData(inst, statement, &ferr);      data = CheckExtCallData(inst, statement, &ferr);
5360      assert( ferr == correct_instance );      assert( ferr == correct_instance );
5361    }    }
5362        /* expand the formal args into a list of lists of realatom args. */    
5363      /* expand the formal args into a list of lists of realatom args. */
5364    arglist = GetExtCallArgs(inst, statement, &ferr);    arglist = GetExtCallArgs(inst, statement, &ferr);
5365    if (arglist==NULL){    if (arglist==NULL){
5366      assert(ferr == correct_instance);      asc_assert(ferr == correct_instance);
5367      /* should never be here. */      /* should never be here. */
5368      switch(ferr){      switch(ferr){
5369      case unmade_instance:      case unmade_instance:
# Line 5379  the checks done before this statement wa Line 5383  the checks done before this statement wa
5383    if (efunc == NULL) {    if (efunc == NULL) {
5384      return 1;      return 1;
5385    }    }
5386    
5387      CONSOLE_DEBUG("...");
5388    
5389    n_input_args = NumberInputArgs(efunc);    n_input_args = NumberInputArgs(efunc);
5390    n_output_args = NumberOutputArgs(efunc);    n_output_args = NumberOutputArgs(efunc);
5391    if ((len =gl_length(arglist)) != (n_input_args + n_output_args)) {    if ((len =gl_length(arglist)) != (n_input_args + n_output_args)) {
# Line 5387  the checks done before this statement wa Line 5394  the checks done before this statement wa
5394      );      );
5395      return 1;      return 1;
5396    }    }
5397    
5398      CONSOLE_DEBUG("...");
5399    
5400    /* we should have a valid arglist at this stage */    /* we should have a valid arglist at this stage */
5401    if (CheckExtCallArgTypes(arglist)) {    if (CheckExtCallArgTypes(arglist)) {
5402      instantiation_error(ASC_USER_ERROR,statement,"Wrong type of args to external statement");      instantiation_error(ASC_USER_ERROR,statement,"Wrong type of args to external statement");
# Line 5398  the checks done before this statement wa Line 5408  the checks done before this statement wa
5408    inputs = LinearizeArgList(arglist,start,end);    inputs = LinearizeArgList(arglist,start,end);
5409    n_inputs_actual = gl_length(inputs);    n_inputs_actual = gl_length(inputs);
5410    
5411      CONSOLE_DEBUG("...");
5412    
5413    /* Now process the outputs */    /* Now process the outputs */
5414    start = n_input_args+1;    start = n_input_args+1;
5415    end = n_input_args + n_output_args;    end = n_input_args + n_output_args;
5416    outputs = LinearizeArgList(arglist,start,end);    outputs = LinearizeArgList(arglist,start,end);
5417    n_outputs_actual = gl_length(outputs);    n_outputs_actual = gl_length(outputs);
5418    
5419      CONSOLE_DEBUG("...");
5420    
5421    /* Now create the relations, all with the same    /* Now create the relations, all with the same
5422     * common.     * common.
5423     */     */
# Line 5411  the checks done before this statement wa Line 5425  the checks done before this statement wa
5425    common->interp.task = bb_first_call;    common->interp.task = bb_first_call;
5426    context = WriteInstanceNameString(inst, NULL);    context = WriteInstanceNameString(inst, NULL);
5427  /* ------------ */ /* ------------ */  /* ------------ */ /* ------------ */
5428    
5429      CONSOLE_DEBUG("...");
5430    
5431    /* now set up the for loop index --------------------------------*/    /* now set up the for loop index --------------------------------*/
5432    name = AddSymbolL(BBOX_RESERVED_INDEX, BBOX_RESERVED_INDEX_LEN);    name = AddSymbolL(BBOX_RESERVED_INDEX, BBOX_RESERVED_INDEX_LEN);
5433    /* using a reserved character not legal in user level modeling. */    /* using a reserved character not legal in user level modeling. */
# Line 5418  the checks done before this statement wa Line 5435  the checks done before this statement wa
5435    /* cannot happen as bbox definitions don't nest as statements and    /* cannot happen as bbox definitions don't nest as statements and
5436      user identifiers cannot contain ?.      user identifiers cannot contain ?.
5437   */   */
5438    
5439      CONSOLE_DEBUG("...");
5440    
5441    assert(GetEvaluationContext()==NULL);    assert(GetEvaluationContext()==NULL);
5442    SetEvaluationContext(inst);    SetEvaluationContext(inst);
5443    /* construct a set value of 1..bbox_arraysize */    /* construct a set value of 1..bbox_arraysize */
# Line 5463  the checks done before this statement wa Line 5483  the checks done before this statement wa
5483      assert(0);      assert(0);
5484      break;      break;
5485    }    }
5486    
5487      CONSOLE_DEBUG("...");
5488    
5489  /* ------------ */ /* ------------ */  /* ------------ */ /* ------------ */
5490    /* and now for cleaning up shared data. */    /* and now for cleaning up shared data. */
5491    init = GetInitFunc(efunc);    init = GetInitFunc(efunc);
5492    (*init)( &(common->interp), data, arglist);    if(init){
5493          (*init)( &(common->interp), data, arglist);
5494      }
5495    common->interp.task = bb_none;    common->interp.task = bb_none;
5496    ascfree(context);    ascfree(context);
5497    DeleteRefBlackBoxCache(NULL, &common);    DeleteRefBlackBoxCache(NULL, &common);
# Line 5474  the checks done before this statement wa Line 5499  the checks done before this statement wa
5499    gl_destroy(outputs);    gl_destroy(outputs);
5500    DestroySpecialList(arglist);    DestroySpecialList(arglist);
5501  /* ------------ */ /* ------------ */  /* ------------ */ /* ------------ */
5502    
5503      CONSOLE_DEBUG("...");
5504    
5505    /*  currently designed to always succeed or fail permanently.    /*  currently designed to always succeed or fail permanently.
5506     *  We reached this point meaning we've processed everything.     *  We reached this point meaning we've processed everything.
5507     *  Therefore the statment returns 1 and becomes no longer pending.     *  Therefore the statment returns 1 and becomes no longer pending.

Legend:
Removed from v.909  
changed lines
  Added in v.910

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22