All pastes #19100 Raw Edit

Something

public text v1 · immutable
#19100 ·published 2005-08-02 16:35 UTC
rendered paste body
procedure coc_codegen_expression(c : TcocILCode);
var
  i : Integer;
  pf0 : PvmpfConvContext;
  postfixdata : array[0..9999] of TcocILCode;
  cur : TcocILCode;
begin
  // create postfix representation
  pf0 := vmpf_ConvContextGen;
  vmpf_SetConvCBGetID(pf0, @cocOnGetTalID);
  vmpf_SetConvCBGetHigherPrec(pf0, @cocOnGetHigherPrec);
  for i:=0 to c.GetCodeCount-1 do
    vmpf_AddConvToken(pf0, c.GetCode(i));
  vmpf_ConvTokenFlush(pf0);
  vmpf_ConvTokenCopy(pf0, @postfixdata[0]);

  // generate code for each token
  for i:=0 to vmpf_GetConvTokenCount(pf0)-1 do
    begin
      cur := postfixdata[i];
      case postfixdata[i].Kind of
        tckOperator     : coc_codegen_emitoperator_clean(cur, 'i', '');
        tckIdentresolve : coc_codegen_emitident(cur);
        tckConstant     : coc_codegen_emitconst(cur);
        tckExpression   : coc_codegen_expression(cur);
      end;
    end;

  // free postfix context
  vmpf_ConvContextDel(pf0);
end;