Ignore:
Timestamp:
Aug 9, 2010, 3:05:26 PM (14 years ago)
Author:
george
Message:

Added support for loop for-to-do.
System types and functions are not generated to output code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/Produce/UProducerC.pas

    r48 r50  
    9898procedure TCProducer.GenerateModule(Module: TModule);
    9999begin
     100  Emit('#define int8 char');
     101  Emit('#define int16 int');
     102  Emit('#define int32 long');
     103  Emit('#define uint8 unsigned char');
     104  Emit('#define uint16 unsigned int');
     105  Emit('#define uint32 unsigned long');
     106  Emit('');
    100107  GenerateUses(Module.UsedModules);
    101108  GenerateCommonBlock(Module, '');
     
    127134  for I := 0 to Functions.Count - 1 do
    128135  with TFunction(Functions[I]) do
     136  if not System then
    129137  begin
    130138    if HaveResult then Line := TranslateType(ResultType.Name) + ' '
     
    195203procedure TCProducer.GenerateAssignment(Assignment: TAssignment);
    196204begin
    197   Emit(Assignment.Target.Name + ' = ' + GenerateExpression(Assignment.Source) + ';');
     205  if Assignment.Target.Name = 'Result' then Emit('return(' + GenerateExpression(Assignment.Source) + ');')
     206    else Emit(Assignment.Target.Name + ' = ' + GenerateExpression(Assignment.Source) + ';');
    198207end;
    199208
     
    201210var
    202211  Line: string;
    203 begin
    204   Line := FunctionCall.FunctionRef.Name + '(';
    205   Line := Line + ');';
    206   Emit(Line);
     212  I: Integer;
     213begin
     214  with FunctionCall do begin
     215    Line := FunctionRef.Name + '(';
     216    if ParameterExpression.Count > 0 then begin
     217      for I := 0 to ParameterExpression.Count - 1 do begin
     218        Line := Line + GenerateExpression(TExpression(ParameterExpression[I]));
     219        if I < ParameterExpression.Count - 1 then Line := Line + ', ';
     220      end;
     221    end;
     222    Line := Line + ');';
     223    Emit(Line);
     224  end;
    207225end;
    208226
Note: See TracChangeset for help on using the changeset viewer.