Changeset 50 for branches/DelphiToC/Produce/UProducerC.pas
- Timestamp:
- Aug 9, 2010, 3:05:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/Produce/UProducerC.pas
r48 r50 98 98 procedure TCProducer.GenerateModule(Module: TModule); 99 99 begin 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(''); 100 107 GenerateUses(Module.UsedModules); 101 108 GenerateCommonBlock(Module, ''); … … 127 134 for I := 0 to Functions.Count - 1 do 128 135 with TFunction(Functions[I]) do 136 if not System then 129 137 begin 130 138 if HaveResult then Line := TranslateType(ResultType.Name) + ' ' … … 195 203 procedure TCProducer.GenerateAssignment(Assignment: TAssignment); 196 204 begin 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) + ';'); 198 207 end; 199 208 … … 201 210 var 202 211 Line: string; 203 begin 204 Line := FunctionCall.FunctionRef.Name + '('; 205 Line := Line + ');'; 206 Emit(Line); 212 I: Integer; 213 begin 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; 207 225 end; 208 226
Note:
See TracChangeset
for help on using the changeset viewer.