Changeset 91 for trunk


Ignore:
Timestamp:
Jul 20, 2018, 9:41:37 AM (6 years ago)
Author:
chronos
Message:
  • Added: Allow to enable individual code optimization from settings dialog.
  • Added: Actions to format or shrink target BF code.
Location:
trunk
Files:
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms

    • Property svn:ignore set to
      *.lrj
  • trunk/Forms/UFormMain.lfm

    r88 r91  
    11object FormMain: TFormMain
    2   Left = 490
     2  Left = 405
    33  Height = 586
    4   Top = 315
     4  Top = 226
    55  Width = 860
    66  Caption = 'LazFuck'
    7   ClientHeight = 554
     7  ClientHeight = 561
    88  ClientWidth = 860
     9  DesignTimePPI = 120
    910  Menu = MainMenu1
    1011  OnClose = FormClose
     
    1314  OnDestroy = FormDestroy
    1415  OnShow = FormShow
    15   LCLVersion = '1.6.4.0'
     16  LCLVersion = '1.8.2.0'
    1617  WindowState = wsMaximized
    1718  object StatusBarMain: TStatusBar
    1819    Left = 0
    1920    Height = 28
    20     Top = 526
     21    Top = 533
    2122    Width = 860
    2223    Panels = <   
     
    4748    end
    4849    object ToolButton2: TToolButton
    49       Left = 24
     50      Left = 30
    5051      Top = 2
    5152      Action = AProjectOpen
     
    5455    end
    5556    object ToolButton3: TToolButton
    56       Left = 59
     57      Left = 74
    5758      Top = 2
    5859      Action = AProjectSave
    5960    end
    6061    object ToolButton4: TToolButton
    61       Left = 82
     62      Left = 103
    6263      Top = 2
    6364      Action = AProjectClose
    6465    end
    6566    object ToolButton5: TToolButton
    66       Left = 128
    67       Height = 22
    68       Top = 2
    69       Width = 10
     67      Left = 161
     68      Height = 28
     69      Top = 2
    7070      Style = tbsSeparator
    7171    end
    7272    object ToolButton6: TToolButton
    73       Left = 161
     73      Left = 198
    7474      Top = 2
    7575      Action = AProgramRun
    7676    end
    7777    object ToolButton7: TToolButton
    78       Left = 138
     78      Left = 169
    7979      Top = 2
    8080      Action = AProgramCompile
    8181    end
    8282    object ToolButton8: TToolButton
    83       Left = 105
     83      Left = 132
    8484      Top = 2
    8585      Action = AOptions
    8686    end
    8787    object ToolButton9: TToolButton
    88       Left = 230
     88      Left = 285
    8989      Top = 2
    9090      Action = ABreakpointToggle
    9191    end
    9292    object ToolButton10: TToolButton
    93       Left = 184
     93      Left = 227
    9494      Top = 2
    9595      Action = AProgramPause
    9696    end
    9797    object ToolButton11: TToolButton
    98       Left = 207
     98      Left = 256
    9999      Top = 2
    100100      Action = AProgramStop
    101101    end
    102102    object ToolButton12: TToolButton
    103       Left = 253
     103      Left = 314
    104104      Top = 2
    105105      Action = AProgramStepOver
    106106    end
    107107    object ToolButton13: TToolButton
    108       Left = 276
     108      Left = 343
    109109      Top = 2
    110110      Action = AProgramStepInto
    111111    end
    112112    object ToolButton14: TToolButton
    113       Left = 299
     113      Left = 372
    114114      Top = 2
    115115      Action = AProgramStepOut
    116116    end
    117117    object ToolButton15: TToolButton
    118       Left = 322
     118      Left = 401
    119119      Top = 2
    120120      Action = AProgramRunToCursor
    121121    end
    122122    object ToolButtonTarget: TToolButton
    123       Left = 345
     123      Left = 430
    124124      Hint = 'Target select'
    125125      Top = 2
     
    131131  object PageControlRight: TPageControl
    132132    Left = 467
    133     Height = 500
     133    Height = 507
    134134    Top = 26
    135135    Width = 393
     
    141141    object TabSheetDebug: TTabSheet
    142142      Caption = 'Debug'
    143       ClientHeight = 494
    144       ClientWidth = 319
     143      ClientHeight = 499
     144      ClientWidth = 359
    145145      object PanelInput: TPanel
    146146        Left = 0
    147147        Height = 64
    148148        Top = 0
    149         Width = 319
     149        Width = 359
    150150        Align = alTop
    151151        BevelOuter = bvNone
     
    157157        Height = 5
    158158        Top = 64
    159         Width = 319
     159        Width = 359
    160160        Align = alTop
    161161        ResizeAnchor = akTop
     
    165165        Height = 259
    166166        Top = 69
    167         Width = 319
     167        Width = 359
    168168        Align = alTop
    169169        BevelOuter = bvNone
     
    175175        Height = 5
    176176        Top = 328
    177         Width = 319
     177        Width = 359
    178178        Align = alTop
    179179        ResizeAnchor = akTop
     
    183183        Height = 86
    184184        Top = 333
    185         Width = 319
     185        Width = 359
    186186        Align = alTop
    187187        BevelOuter = bvNone
     
    193193        Height = 5
    194194        Top = 419
    195         Width = 319
     195        Width = 359
    196196        Align = alTop
    197197        ResizeAnchor = akTop
     
    199199      object PanelMemory: TPanel
    200200        Left = 0
    201         Height = 70
     201        Height = 75
    202202        Top = 424
    203         Width = 319
     203        Width = 359
    204204        Align = alClient
    205205        BevelOuter = bvNone
     
    210210  object Splitter1: TSplitter
    211211    Left = 462
    212     Height = 500
     212    Height = 507
    213213    Top = 26
    214214    Width = 5
     
    218218  object PanelLeft: TPanel
    219219    Left = 0
    220     Height = 500
     220    Height = 507
    221221    Top = 26
    222222    Width = 462
    223223    Align = alClient
    224224    BevelOuter = bvNone
    225     ClientHeight = 500
     225    ClientHeight = 507
    226226    ClientWidth = 462
    227227    TabOrder = 4
    228228    object PageControlMain: TPageControl
    229229      Left = 0
    230       Height = 377
     230      Height = 384
    231231      Top = 0
    232232      Width = 462
     
    246246      Left = 0
    247247      Height = 118
    248       Top = 382
     248      Top = 389
    249249      Width = 462
    250250      ActivePage = TabSheetMessages
     
    261261      Left = 0
    262262      Height = 5
    263       Top = 377
     263      Top = 384
    264264      Width = 462
    265265      Align = alBottom
  • trunk/Forms/UFormMain.pas

    r90 r91  
    77uses
    88  Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs,
    9   Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry, URegistry, Process,
     9  Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry, URegistry,
    1010  LazFileUtils;
    1111
     
    305305    if not Assigned(Core.CurrentTarget) then
    306306      Core.CurrentTarget := TTarget(Core.Targets[0]);
     307    Core.Optimizations.AddSub := ReadBoolWithDefault('OptimizationAddSubEnabled', True);
     308    Core.Optimizations.Merge := ReadBoolWithDefault('OptimizationMerge', True);
     309    Core.Optimizations.CopyMultiply := ReadBoolWithDefault('OptimizationCopyMultiplyEnabled', True);
     310    Core.Optimizations.RelativeIndexes := ReadBoolWithDefault('OptimizationRelativeIndexesEnabled', True);
    307311  finally
    308312    Free;
     
    317321    OpenKey(Key, True);
    318322    WriteString('TargetName', Core.CurrentTarget.Name);
     323    WriteBool('OptimizationAddSubEnabled', Core.Optimizations.AddSub);
     324    WriteBool('OptimizationMerge', Core.Optimizations.Merge);
     325    WriteBool('OptimizationCopyMultiplyEnabled', Core.Optimizations.CopyMultiply);
     326    WriteBool('OptimizationRelativeIndexesEnabled', Core.Optimizations.RelativeIndexes);
    319327  finally
    320328    Free;
     
    458466procedure TFormMain.AOptionsExecute(Sender: TObject);
    459467begin
    460   OptionsForm.Load;
    461   if OptionsForm.ShowModal = mrOK then begin
    462     OptionsForm.Save;
    463     if Assigned(Core.CurrentTarget) then begin
    464       Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
    465       if Core.CurrentTarget is TBFTarget then begin
    466         TBFTarget(Core.CurrentTarget).CellSize := Core.CellSize;
    467         TBFTarget(Core.CurrentTarget).MemorySize := Core.MemorySize;
     468  FormOptions := TFormOptions.Create(nil);
     469  try
     470    FormOptions.Load;
     471    if FormOptions.ShowModal = mrOK then begin
     472      FormOptions.Save;
     473      if Assigned(Core.CurrentTarget) then begin
     474        Core.CurrentTarget.OptimizationLevel := Core.OptimizationLevel;
     475        if Core.CurrentTarget is TBFTarget then begin
     476          TBFTarget(Core.CurrentTarget).CellSize := Core.CellSize;
     477          TBFTarget(Core.CurrentTarget).MemorySize := Core.MemorySize;
     478        end;
    468479      end;
    469480    end;
     481  finally
     482    FormOptions.Free;
    470483  end;
    471484end;
     
    479492    ProjectFileName := Core.Project.FileName;
    480493    ProgramName := ExtractFileNameOnly(Core.Project.FileName);
     494    if Core.CurrentTarget is TBFTarget then
     495      TBFTarget(Core.CurrentTarget).Optimizations := Core.Optimizations;
    481496    Core.CurrentTarget.Messages.AddMessage(SCompileStart);
    482497    Application.ProcessMessages;
  • trunk/Forms/UFormOptions.lfm

    r70 r91  
    1 object OptionsForm: TOptionsForm
    2   Left = 665
    3   Height = 339
    4   Top = 370
    5   Width = 468
     1object FormOptions: TFormOptions
     2  Left = 510
     3  Height = 418
     4  Top = 324
     5  Width = 511
    66  Caption = 'Options'
    7   ClientHeight = 339
    8   ClientWidth = 468
     7  ClientHeight = 418
     8  ClientWidth = 511
     9  DesignTimePPI = 120
     10  OnClose = FormClose
     11  OnCreate = FormCreate
    912  OnShow = FormShow
    10   LCLVersion = '1.5'
     13  LCLVersion = '1.8.2.0'
    1114  object ButtonOk: TButton
    12     Left = 389
     15    Left = 422
    1316    Height = 25
    14     Top = 307
     17    Top = 386
    1518    Width = 75
    1619    Anchors = [akRight, akBottom]
     
    2124  end
    2225  object ButtonCancel: TButton
    23     Left = 304
     26    Left = 334
    2427    Height = 25
    25     Top = 307
     28    Top = 386
    2629    Width = 75
    2730    Anchors = [akRight, akBottom]
     
    3235  object SpinEditCellSize: TSpinEdit
    3336    Left = 165
    34     Height = 35
     37    Height = 28
    3538    Top = 40
    3639    Width = 130
     
    4043  object SpinEditMemorySize: TSpinEdit
    4144    Left = 165
    42     Height = 35
     45    Height = 28
    4346    Top = 6
    4447    Width = 130
     
    4851  object Label1: TLabel
    4952    Left = 8
    50     Height = 25
     53    Height = 20
    5154    Top = 8
    52     Width = 123
     55    Width = 87
    5356    Caption = 'Memory size:'
    5457    ParentColor = False
     
    5659  object Label2: TLabel
    5760    Left = 8
    58     Height = 25
     61    Height = 20
    5962    Top = 40
    60     Width = 79
     63    Width = 57
    6164    Caption = 'Cell size:'
    6265    ParentColor = False
     
    6467  object Label3: TLabel
    6568    Left = 8
    66     Height = 25
     69    Height = 20
    6770    Top = 95
    68     Width = 179
     71    Width = 127
    6972    Caption = 'Interface language:'
    7073    ParentColor = False
     
    7477    Height = 27
    7578    Top = 128
    76     Width = 456
     79    Width = 499
    7780    Anchors = [akTop, akLeft, akRight]
    7881    AutoSize = False
     
    8285  object SpinEditDPIX: TSpinEdit
    8386    Left = 104
    84     Height = 35
     87    Height = 28
    8588    Top = 193
    8689    Width = 80
     
    9295  object LabelDPI: TLabel
    9396    Left = 24
    94     Height = 25
     97    Height = 20
    9598    Top = 201
    96     Width = 39
     99    Width = 26
    97100    Caption = 'DPI:'
    98101    ParentColor = False
     
    100103  object SpinEditDPIY: TSpinEdit
    101104    Left = 208
    102     Height = 35
     105    Height = 28
    103106    Top = 193
    104107    Width = 80
     
    110113  object LabelX: TLabel
    111114    Left = 192
    112     Height = 25
     115    Height = 20
    113116    Top = 201
    114     Width = 10
     117    Width = 7
    115118    Caption = 'x'
    116119    ParentColor = False
     
    120123    Height = 27
    121124    Top = 168
    122     Width = 448
     125    Width = 491
    123126    Anchors = [akTop, akLeft, akRight]
    124127    AutoSize = False
     
    129132  object Label4: TLabel
    130133    Left = 16
    131     Height = 25
     134    Height = 20
    132135    Top = 248
    133     Width = 221
     136    Width = 159
    134137    Caption = 'Compiler optimizations:'
    135138    ParentColor = False
     
    137140  object ComboBoxLanguage: TComboBox
    138141    Left = 248
    139     Height = 37
     142    Height = 28
    140143    Top = 83
    141144    Width = 188
    142     ItemHeight = 0
     145    ItemHeight = 20
    143146    Style = csDropDownList
    144147    TabOrder = 8
    145148  end
    146   object ComboBoxOptimizatipn: TComboBox
     149  object CheckBoxOptimizeAddSub: TCheckBox
     150    Left = 39
     151    Height = 24
     152    Top = 280
     153    Width = 189
     154    Caption = 'Addition and subtraction'
     155    TabOrder = 9
     156  end
     157  object CheckBoxOptimizeMerge: TCheckBox
     158    Left = 39
     159    Height = 24
     160    Top = 304
     161    Width = 181
     162    Caption = 'Merge same operations'
     163    TabOrder = 10
     164  end
     165  object CheckBoxOptimizeRelativeIndexes: TCheckBox
     166    Left = 39
     167    Height = 24
     168    Top = 328
     169    Width = 131
     170    Caption = 'Relative indexes'
     171    TabOrder = 11
     172  end
     173  object CheckBoxOptimizeCopyMultiply: TCheckBox
     174    Left = 39
     175    Height = 24
     176    Top = 352
     177    Width = 116
     178    Caption = 'Copy multiply'
     179    TabOrder = 12
     180  end
     181  object ComboBoxOptimization: TComboBox
    147182    Left = 256
    148     Height = 37
    149     Top = 240
     183    Height = 28
     184    Top = 248
    150185    Width = 188
    151     ItemHeight = 0
     186    ItemHeight = 20
    152187    Items.Strings = (
    153188      'None'
    154189      'Normal'
    155190    )
     191    OnSelect = CheckBoxDPIAutoChange
    156192    Style = csDropDownList
    157     TabOrder = 9
     193    TabOrder = 13
    158194  end
    159195end
  • trunk/Forms/UFormOptions.pas

    r88 r91  
    1111type
    1212
    13   { TOptionsForm }
     13  { TFormOptions }
    1414
    15   TOptionsForm = class(TForm)
     15  TFormOptions = class(TForm)
    1616    ButtonOk: TButton;
    1717    ButtonCancel: TButton;
    1818    CheckBox1: TCheckBox;
     19    CheckBoxOptimizeAddSub: TCheckBox;
    1920    CheckBoxDPIAuto: TCheckBox;
     21    CheckBoxOptimizeMerge: TCheckBox;
     22    CheckBoxOptimizeRelativeIndexes: TCheckBox;
     23    CheckBoxOptimizeCopyMultiply: TCheckBox;
    2024    ComboBoxLanguage: TComboBox;
    21     ComboBoxOptimizatipn: TComboBox;
     25    ComboBoxOptimization: TComboBox;
    2226    Label1: TLabel;
    2327    Label2: TLabel;
     
    3236    procedure ButtonOkClick(Sender: TObject);
    3337    procedure CheckBoxDPIAutoChange(Sender: TObject);
     38    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     39    procedure FormCreate(Sender: TObject);
    3440    procedure FormShow(Sender: TObject);
    3541  private
     
    4248
    4349var
    44   OptionsForm: TOptionsForm;
     50  FormOptions: TFormOptions;
    4551
    4652implementation
     
    5157  UCore, ULanguages;
    5258
    53 { TOptionsForm }
     59{ TFormOptions }
    5460
    55 procedure TOptionsForm.FormShow(Sender: TObject);
     61procedure TFormOptions.FormShow(Sender: TObject);
    5662begin
     63  Core.PersistentForm1.Load(Self);
     64
    5765  Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    5866  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
     
    6169end;
    6270
    63 procedure TOptionsForm.UpdateInterface;
     71procedure TFormOptions.UpdateInterface;
    6472begin
    6573  SpinEditDPIX.Enabled := not CheckBoxDPIAuto.Checked;
     
    7179    SpinEditDPIY.Value := ScreenInfo.PixelsPerInchY;
    7280  end;
     81  CheckBoxOptimizeAddSub.Enabled := ComboBoxOptimization.ItemIndex > 0;
     82  CheckBoxOptimizeMerge.Enabled := ComboBoxOptimization.ItemIndex > 0;
     83  CheckBoxOptimizeRelativeIndexes.Enabled := ComboBoxOptimization.ItemIndex > 0;
     84  CheckBoxOptimizeCopyMultiply.Enabled := ComboBoxOptimization.ItemIndex > 0;
    7385end;
    7486
    75 procedure TOptionsForm.Load;
     87procedure TFormOptions.Load;
    7688begin
     89  CheckBoxOptimizeAddSub.Checked := Core.Optimizations.AddSub;
     90  CheckBoxOptimizeMerge.Checked := Core.Optimizations.Merge;
     91  CheckBoxOptimizeRelativeIndexes.Checked := Core.Optimizations.RelativeIndexes;
     92  CheckBoxOptimizeCopyMultiply.Checked := Core.Optimizations.CopyMultiply;
    7793  SpinEditDPIX.Value := Core.ScaleDPI1.DPI.X;
    7894  SpinEditDPIY.Value := Core.ScaleDPI1.DPI.Y;
    7995  CheckBoxDPIAuto.Checked := Core.ScaleDPI1.AutoDetect;
    80   ComboBoxOptimizatipn.ItemIndex := Integer(Core.OptimizationLevel);
     96  ComboBoxOptimization.ItemIndex := Integer(Core.OptimizationLevel);
    8197  SpinEditCellSize.Value := Core.CellSize;
    8298  SpinEditMemorySize.Value := Core.MemorySize;
     
    84100end;
    85101
    86 procedure TOptionsForm.Save;
     102procedure TFormOptions.Save;
    87103begin
    88104  Core.ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value);
    89105  Core.ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked;
    90   Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimizatipn.ItemIndex);
     106  Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex);
    91107  Core.CellSize := SpinEditCellSize.Value;
    92108  Core.MemorySize := SpinEditMemorySize.Value;
     109  Core.Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked;
     110  Core.Optimizations.Merge := CheckBoxOptimizeMerge.Checked;
     111  Core.Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked;
     112  Core.Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked;
    93113end;
    94114
    95 procedure TOptionsForm.ButtonOkClick(Sender: TObject);
     115procedure TFormOptions.ButtonOkClick(Sender: TObject);
    96116begin
    97117  if ComboBoxLanguage.ItemIndex <> -1 then
     
    100120end;
    101121
    102 procedure TOptionsForm.CheckBoxDPIAutoChange(Sender: TObject);
     122procedure TFormOptions.CheckBoxDPIAutoChange(Sender: TObject);
    103123begin
    104124  UpdateInterface;
    105125end;
    106126
     127procedure TFormOptions.FormClose(Sender: TObject; var CloseAction: TCloseAction
     128  );
     129begin
     130  Core.PersistentForm1.Save(Self);
     131end;
     132
     133procedure TFormOptions.FormCreate(Sender: TObject);
     134begin
     135  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     136end;
     137
    107138end.
    108139
  • trunk/Forms/UFormTargetCode.lfm

    r64 r91  
    11object FormTargetCode: TFormTargetCode
    2   Left = 306
     2  Left = 682
    33  Height = 240
    4   Top = 75
     4  Top = 485
    55  Width = 320
    66  Caption = 'Target code'
    77  ClientHeight = 240
    88  ClientWidth = 320
    9   LCLVersion = '1.3'
     9  DesignTimePPI = 120
     10  LCLVersion = '1.8.2.0'
    1011  object MemoTarget: TMemo
    1112    Left = 0
     
    2223  end
    2324  object PopupMenuTarget: TPopupMenu
    24     Images = MainForm.ImageListMain
     25    Images = Core.ImageListMain
    2526    left = 84
    2627    top = 100
    2728    object MenuItem20: TMenuItem
    28       Action = MainForm.AShowSourcePosition
     29      Action = AFormatCode
     30    end
     31    object MenuItem1: TMenuItem
     32      Action = AShrinkCode
     33    end
     34  end
     35  object ActionList1: TActionList
     36    Images = Core.ImageListMain
     37    left = 199
     38    top = 39
     39    object AFormatCode: TAction
     40      Caption = 'Format code'
     41      OnExecute = AFormatCodeExecute
     42    end
     43    object AShrinkCode: TAction
     44      Caption = 'Shrink code'
     45      OnExecute = AShrinkCodeExecute
    2946    end
    3047  end
  • trunk/Forms/UFormTargetCode.pas

    r46 r91  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Menus;
     9  Menus, ActnList, strutils;
    1010
    1111type
     
    1414
    1515  TFormTargetCode = class(TForm)
     16    AShrinkCode: TAction;
     17    AFormatCode: TAction;
     18    ActionList1: TActionList;
    1619    MemoTarget: TMemo;
     20    MenuItem1: TMenuItem;
    1721    MenuItem20: TMenuItem;
    1822    PopupMenuTarget: TPopupMenu;
     23    procedure AFormatCodeExecute(Sender: TObject);
     24    procedure AShrinkCodeExecute(Sender: TObject);
    1925  private
    2026    { private declarations }
     
    3036{$R *.lfm}
    3137
     38{ TFormTargetCode }
     39
     40procedure TFormTargetCode.AFormatCodeExecute(Sender: TObject);
     41var
     42  Source: string;
     43  NewSource: string;
     44  Indent: Integer;
     45  I: Integer;
     46const
     47  IndentText = '  ';
     48begin
     49  Source := MemoTarget.Text;
     50  NewSource := '';
     51  Indent := 0;
     52  for I := 1 to Length(Source) do begin
     53    if Source[I] = '[' then begin
     54      NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding ;
     55      Inc(Indent);
     56      NewSource := NewSource + DupeString(IndentText, Indent);
     57    end
     58    else if Source[I] = ']' then begin
     59      Dec(Indent);
     60      NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding + DupeString(IndentText, Indent);
     61    end
     62    else if Ord(Source[I]) > $20 then
     63      NewSource := NewSource + Source[I];
     64  end;
     65  MemoTarget.Text := NewSource;
     66end;
     67
     68procedure TFormTargetCode.AShrinkCodeExecute(Sender: TObject);
     69var
     70  Source: string;
     71  Pos: Integer;
     72  I: Integer;
     73begin
     74  Source := MemoTarget.Text;
     75  Pos := 1;
     76  for I := 1 to Length(Source) do begin
     77    if Source[I] > ' ' then begin
     78      Source[Pos] := Source[I];
     79      Inc(Pos);
     80    end;
     81  end;
     82  SetLength(Source, Pos - 1);
     83  MemoTarget.Text := Source;
     84end;
     85
    3286end.
    3387
  • trunk/Languages

    • Property svn:ignore
      •  

        old new  
        11LazFuckIDE.cs.mo
         2*.mo
  • trunk/Languages/LazFuck.cs.po

    r88 r91  
    248248msgstr "Nápověda"
    249249
    250 #: tformmain.menuitem17.caption
    251 msgctxt "tformmain.menuitem17.caption"
    252 msgid "-"
    253 msgstr "-"
    254 
    255250#: tformmain.menuitem18.caption
    256251msgctxt "tformmain.menuitem18.caption"
     
    263258msgstr "Nástroje"
    264259
    265 #: tformmain.menuitem5.caption
    266 msgctxt "tformmain.menuitem5.caption"
    267 msgid "-"
    268 msgstr "-"
    269 
    270260#: tformmain.menuitem9.caption
    271261msgctxt "tformmain.menuitem9.caption"
     
    337327msgstr "Zprávy"
    338328
     329#: tformoptions.buttoncancel.caption
     330msgctxt "tformoptions.buttoncancel.caption"
     331msgid "Cancel"
     332msgstr "ZruÅ¡it"
     333
     334#: tformoptions.buttonok.caption
     335msgctxt "tformoptions.buttonok.caption"
     336msgid "Ok"
     337msgstr "Ok"
     338
     339#: tformoptions.caption
     340msgctxt "tformoptions.caption"
     341msgid "Options"
     342msgstr "Volby"
     343
     344#: tformoptions.checkbox1.caption
     345msgctxt "tformoptions.checkbox1.caption"
     346msgid "Reopend last opened project"
     347msgstr "Otevřít naposledy otevřenÃœ projekt"
     348
     349#: tformoptions.checkboxdpiauto.caption
     350msgctxt "tformoptions.checkboxdpiauto.caption"
     351msgid "Automatic DPI"
     352msgstr "Automatické DPI"
     353
     354#: tformoptions.checkboxoptimizeaddsub.caption
     355msgctxt "tformoptions.checkboxoptimizeaddsub.caption"
     356msgid "Addition and subtraction"
     357msgstr "Sčítání a odečítání"
     358
     359#: tformoptions.checkboxoptimizecopymultiply.caption
     360msgctxt "tformoptions.checkboxoptimizecopymultiply.caption"
     361msgid "Copy multiply"
     362msgstr "Kopírování a násobení"
     363
     364#: tformoptions.checkboxoptimizemerge.caption
     365msgctxt "tformoptions.checkboxoptimizemerge.caption"
     366msgid "Merge same operations"
     367msgstr "Sloučit stejné operace"
     368
     369#: tformoptions.checkboxoptimizerelativeindexes.caption
     370msgctxt "tformoptions.checkboxoptimizerelativeindexes.caption"
     371msgid "Relative indexes"
     372msgstr "Relativní indexy"
     373
     374#: tformoptions.label1.caption
     375msgctxt "tformoptions.label1.caption"
     376msgid "Memory size:"
     377msgstr "Velikost paměti:"
     378
     379#: tformoptions.label2.caption
     380msgctxt "tformoptions.label2.caption"
     381msgid "Cell size:"
     382msgstr "Velikost buňky:"
     383
     384#: tformoptions.label3.caption
     385msgctxt "tformoptions.label3.caption"
     386msgid "Interface language:"
     387msgstr "Jazyk rozhraní:"
     388
     389#: tformoptions.label4.caption
     390msgctxt "tformoptions.label4.caption"
     391msgid "Compiler optimizations:"
     392msgstr "Optimalizace překladače:"
     393
     394#: tformoptions.labeldpi.caption
     395msgctxt "tformoptions.labeldpi.caption"
     396msgid "DPI:"
     397msgstr "DPI:"
     398
     399#: tformoptions.labelx.caption
     400msgctxt "tformoptions.labelx.caption"
     401msgid "x"
     402msgstr "x"
     403
    339404#: tformoutput.caption
    340405msgid "Output"
     
    430495msgstr "-"
    431496
     497#: tformtargetcode.aformatcode.caption
     498msgid "Format code"
     499msgstr "Formátovat kód"
     500
     501#: tformtargetcode.ashrinkcode.caption
     502msgid "Shrink code"
     503msgstr "Srazit kód"
     504
    432505#: tformtargetcode.caption
    433506msgctxt "tformtargetcode.caption"
     
    483556
    484557#: toptionsform.checkbox1.caption
     558msgctxt "toptionsform.checkbox1.caption"
    485559msgid "Reopend last opened project"
    486560msgstr "Otevřít naposledy otevřenÃœ projekt"
    487561
    488562#: toptionsform.checkboxdpiauto.caption
     563msgctxt "toptionsform.checkboxdpiauto.caption"
    489564msgid "Automatic DPI"
    490565msgstr "Automatické DPI"
    491566
     567#: toptionsform.checkboxoptimizeaddsub.caption
     568msgctxt "toptionsform.checkboxoptimizeaddsub.caption"
     569msgid "Addition and subtraction"
     570msgstr "Sčítání a odečítání"
     571
     572#: toptionsform.checkboxoptimizecopymultiply.caption
     573msgctxt "toptionsform.checkboxoptimizecopymultiply.caption"
     574msgid "Copy multiply"
     575msgstr "Kopírování a násobení"
     576
     577#: toptionsform.checkboxoptimizemerge.caption
     578msgctxt "toptionsform.checkboxoptimizemerge.caption"
     579msgid "Merge same operations"
     580msgstr "Sloučit stejné operace"
     581
     582#: toptionsform.checkboxoptimizerelativeindexes.caption
     583msgctxt "toptionsform.checkboxoptimizerelativeindexes.caption"
     584msgid "Relative indexes"
     585msgstr "Relativní indexy"
     586
    492587#: toptionsform.label1.caption
     588msgctxt "toptionsform.label1.caption"
    493589msgid "Memory size:"
    494590msgstr "Velikost paměti:"
    495591
    496592#: toptionsform.label2.caption
     593msgctxt "toptionsform.label2.caption"
    497594msgid "Cell size:"
    498595msgstr "Velikost buňky:"
    499596
    500597#: toptionsform.label3.caption
     598msgctxt "toptionsform.label3.caption"
    501599msgid "Interface language:"
    502600msgstr "Jazyk rozhraní:"
    503601
    504602#: toptionsform.label4.caption
     603msgctxt "toptionsform.label4.caption"
    505604msgid "Compiler optimizations:"
    506605msgstr "Optimalizace překladače:"
     
    624723msgid "Unsupported command"
    625724msgstr "NepodporovanÃœ příkaz"
    626 
  • trunk/Languages/LazFuck.po

    r83 r91  
    212212msgstr ""
    213213
    214 #: tformmain.menuitem17.caption
    215 msgctxt "TFORMMAIN.MENUITEM17.CAPTION"
    216 msgid "-"
    217 msgstr ""
    218 
    219214#: tformmain.menuitem18.caption
    220215msgid "View"
     
    223218#: tformmain.menuitem24.caption
    224219msgid "Tools"
    225 msgstr ""
    226 
    227 #: tformmain.menuitem5.caption
    228 msgctxt "tformmain.menuitem5.caption"
    229 msgid "-"
    230220msgstr ""
    231221
     
    292282msgstr ""
    293283
     284#: tformoptions.buttoncancel.caption
     285msgctxt "tformoptions.buttoncancel.caption"
     286msgid "Cancel"
     287msgstr ""
     288
     289#: tformoptions.buttonok.caption
     290msgctxt "tformoptions.buttonok.caption"
     291msgid "Ok"
     292msgstr ""
     293
     294#: tformoptions.caption
     295msgctxt "tformoptions.caption"
     296msgid "Options"
     297msgstr ""
     298
     299#: tformoptions.checkbox1.caption
     300msgctxt "tformoptions.checkbox1.caption"
     301msgid "Reopend last opened project"
     302msgstr ""
     303
     304#: tformoptions.checkboxdpiauto.caption
     305msgctxt "tformoptions.checkboxdpiauto.caption"
     306msgid "Automatic DPI"
     307msgstr ""
     308
     309#: tformoptions.checkboxoptimizeaddsub.caption
     310msgctxt "tformoptions.checkboxoptimizeaddsub.caption"
     311msgid "Addition and subtraction"
     312msgstr ""
     313
     314#: tformoptions.checkboxoptimizecopymultiply.caption
     315msgctxt "tformoptions.checkboxoptimizecopymultiply.caption"
     316msgid "Copy multiply"
     317msgstr ""
     318
     319#: tformoptions.checkboxoptimizemerge.caption
     320msgctxt "tformoptions.checkboxoptimizemerge.caption"
     321msgid "Merge same operations"
     322msgstr ""
     323
     324#: tformoptions.checkboxoptimizerelativeindexes.caption
     325msgctxt "tformoptions.checkboxoptimizerelativeindexes.caption"
     326msgid "Relative indexes"
     327msgstr ""
     328
     329#: tformoptions.label1.caption
     330msgctxt "tformoptions.label1.caption"
     331msgid "Memory size:"
     332msgstr ""
     333
     334#: tformoptions.label2.caption
     335msgctxt "tformoptions.label2.caption"
     336msgid "Cell size:"
     337msgstr ""
     338
     339#: tformoptions.label3.caption
     340msgctxt "tformoptions.label3.caption"
     341msgid "Interface language:"
     342msgstr ""
     343
     344#: tformoptions.label4.caption
     345msgctxt "tformoptions.label4.caption"
     346msgid "Compiler optimizations:"
     347msgstr ""
     348
     349#: tformoptions.labeldpi.caption
     350msgctxt "tformoptions.labeldpi.caption"
     351msgid "DPI:"
     352msgstr ""
     353
     354#: tformoptions.labelx.caption
     355msgctxt "tformoptions.labelx.caption"
     356msgid "x"
     357msgstr ""
     358
    294359#: tformoutput.caption
    295360msgid "Output"
     
    384449msgstr ""
    385450
     451#: tformtargetcode.aformatcode.caption
     452msgid "Format code"
     453msgstr ""
     454
     455#: tformtargetcode.ashrinkcode.caption
     456msgid "Shrink code"
     457msgstr ""
     458
    386459#: tformtargetcode.caption
    387460msgctxt "TFORMTARGETCODE.CAPTION"
     
    437510
    438511#: toptionsform.checkbox1.caption
     512msgctxt "toptionsform.checkbox1.caption"
    439513msgid "Reopend last opened project"
    440514msgstr ""
    441515
    442516#: toptionsform.checkboxdpiauto.caption
     517msgctxt "toptionsform.checkboxdpiauto.caption"
    443518msgid "Automatic DPI"
    444519msgstr ""
    445520
     521#: toptionsform.checkboxoptimizeaddsub.caption
     522msgctxt "toptionsform.checkboxoptimizeaddsub.caption"
     523msgid "Addition and subtraction"
     524msgstr ""
     525
     526#: toptionsform.checkboxoptimizecopymultiply.caption
     527msgctxt "toptionsform.checkboxoptimizecopymultiply.caption"
     528msgid "Copy multiply"
     529msgstr ""
     530
     531#: toptionsform.checkboxoptimizemerge.caption
     532msgctxt "toptionsform.checkboxoptimizemerge.caption"
     533msgid "Merge same operations"
     534msgstr ""
     535
     536#: toptionsform.checkboxoptimizerelativeindexes.caption
     537msgctxt "toptionsform.checkboxoptimizerelativeindexes.caption"
     538msgid "Relative indexes"
     539msgstr ""
     540
    446541#: toptionsform.label1.caption
     542msgctxt "toptionsform.label1.caption"
    447543msgid "Memory size:"
    448544msgstr ""
    449545
    450546#: toptionsform.label2.caption
     547msgctxt "toptionsform.label2.caption"
    451548msgid "Cell size:"
    452549msgstr ""
    453550
    454551#: toptionsform.label3.caption
     552msgctxt "toptionsform.label3.caption"
    455553msgid "Interface language:"
    456554msgstr ""
    457555
    458556#: toptionsform.label4.caption
     557msgctxt "toptionsform.label4.caption"
    459558msgid "Compiler optimizations:"
    460559msgstr ""
    461560
    462561#: toptionsform.labeldpi.caption
     562msgctxt "toptionsform.labeldpi.caption"
    463563msgid "DPI:"
    464564msgstr ""
    465565
    466566#: toptionsform.labelx.caption
     567msgctxt "toptionsform.labelx.caption"
    467568msgid "x"
    468569msgstr ""
  • trunk/LazFuck.lpi

    r88 r91  
    1919      <OutDir Value="Languages"/>
    2020    </i18n>
    21     <VersionInfo>
    22       <StringTable ProductVersion=""/>
    23     </VersionInfo>
    2421    <MacroValues Count="1"/>
    2522    <BuildModes Count="4">
     
    195192        <Filename Value="Forms\UFormOptions.pas"/>
    196193        <IsPartOfProject Value="True"/>
    197         <ComponentName Value="OptionsForm"/>
     194        <ComponentName Value="FormOptions"/>
    198195        <HasResources Value="True"/>
    199196        <ResourceBaseClass Value="Form"/>
  • trunk/LazFuck.lpr

    r78 r91  
    3636  Application.CreateForm(TFormMain, FormMain);
    3737  Application.CreateForm(TFormCPU, FormCPU);
    38   Application.CreateForm(TOptionsForm, OptionsForm);
    3938  Application.CreateForm(TFormCompilers, FormCompilers);
    4039  Application.CreateForm(TFormOutput, FormOutput);
  • trunk/Target/UTargetInterpretter.pas

    r88 r91  
    302302  for I := 0 to Length(FProgram) - 1 do begin
    303303    Result := Result + BrainFuckCommandText[FProgram[I].Command];
    304     if FProgram[I].Command in [cmInc, cmDec, cmSet, cmPointerInc, cmPointerDec] then begin
    305       if FProgram[I].Parameter > 1 then
    306         Result := Result + IntToStr(FProgram[I].Parameter);
    307     end;
     304    //if FProgram[I].Command in [cmInc, cmDec, cmPointerInc, cmPointerDec,
     305    //cmSet, cmMultipy] then begin
     306    if FProgram[I].Parameter > 1 then
     307      Result := Result + IntToStr(FProgram[I].Parameter);
     308    if FProgram[I].RelIndex > 1 then
     309      Result := Result + 'R' + IntToStr(FProgram[I].RelIndex);
     310    //end;
    308311  end;
    309312end;
  • trunk/UBFTarget.pas

    r90 r91  
    1717    Parameter: Integer;
    1818    RelIndex: Integer;
     19  end;
     20
     21  TOptimizations = record
     22    AddSub: Boolean;
     23    Merge: Boolean;
     24    RelativeIndexes: Boolean;
     25    CopyMultiply: Boolean;
    1926  end;
    2027
     
    3946    MemoryMaxUsed: Integer;
    4047    CellSize: Integer;
     48    Optimizations: TOptimizations;
    4149    constructor Create; override;
    4250    procedure OptimizeSource; override;
     
    259267procedure TBFTarget.OptimizeZeroInitMemory;
    260268begin
    261   // Here optimization related to assumption that initial memory is filled with zeroes
     269  // Here Optimizations related to assumption that initial memory is filled with zeroes
    262270  // Then code for constants preparation can be translated to cmSet commands
    263271  // To eliminate also loops for building constants code need to be somehow interpretted partialy
     
    516524begin
    517525  inherited;
    518   OptimizeAddSub;
     526  if Optimizations.AddSub then OptimizeAddSub;
     527  if Optimizations.Merge then
    519528  repeat
    520529    OldLength := Length(FProgram);
     
    522531  until Length(FProgram) = OldLength;
    523532  OptimizeZeroInitMemory;
    524   OptimizeRelativeIndexes;
    525   OptimizeCopyMultiply;
     533  if Optimizations.RelativeIndexes then OptimizeRelativeIndexes;
     534  if Optimizations.CopyMultiply then OptimizeCopyMultiply;
    526535end;
    527536
  • trunk/UCore.lfm

    r88 r91  
    33  OnDestroy = DataModuleDestroy
    44  OldCreateOrder = False
    5   Height = 289
    6   HorizontalOffset = 529
    7   VerticalOffset = 296
    8   Width = 339
     5  Height = 361
     6  HorizontalOffset = 661
     7  VerticalOffset = 370
     8  Width = 424
     9  PPI = 120
    910  object ApplicationInfo: TApplicationInfo
    1011    Identification = 1
     
    2324    RegistryRoot = rrKeyCurrentUser
    2425    License = 'CC0'
    25     left = 72
    26     top = 16
     26    left = 90
     27    top = 20
    2728  end
    2829  object CoolTranslator1: TCoolTranslator
    2930    POFilesFolder = 'Languages'
    30     left = 72
    31     top = 72
     31    left = 90
     32    top = 90
    3233  end
    3334  object LastOpenedList: TLastOpenedList
    3435    MaxCount = 10
    35     left = 72
    36     top = 128
     36    left = 90
     37    top = 160
    3738  end
    3839  object PersistentForm1: TPersistentForm
    3940    MinVisiblePart = 50
    4041    EntireVisible = False
    41     left = 72
    42     top = 184
     42    left = 90
     43    top = 230
    4344  end
    4445  object ImageListMain: TImageList
    45     left = 248
    46     top = 16
     46    left = 310
     47    top = 20
    4748    Bitmap = {
    4849      4C691C0000001000000010000000000000000000000000000000000000000000
     
    947948  object ScaleDPI1: TScaleDPI
    948949    AutoDetect = False
    949     left = 248
    950     top = 80
     950    left = 310
     951    top = 100
    951952  end
    952953end
  • trunk/UCore.pas

    r88 r91  
    88  Classes, SysUtils, FileUtil, UApplicationInfo, ULastOpenedList, UProject,
    99  UCoolTranslator, UTarget, URegistry, Registry, Graphics, Controls, UScaleDPI,
    10   UPersistentForm;
     10  UPersistentForm, UBFTarget;
    1111
    1212type
     
    3535    CellSize: Integer;
    3636    MemorySize: Integer;
     37    Optimizations: TOptimizations;
    3738    procedure Init;
    3839    procedure LoadFromRegistry(Root: HKEY; Key: string);
     
    5253  UFormMain, Forms, LazFileUtils,
    5354  // Targets
    54   UTargetInterpretter, UTargetFPC, UBFTarget, UTargetJava, UTargetDelphi,
     55  UTargetInterpretter, UTargetFPC, UTargetJava, UTargetDelphi,
    5556  UTargetPHP, UTargetC, UTargetPython, UTargetCSharp;
    5657
Note: See TracChangeset for help on using the changeset viewer.