Changeset 5
- Timestamp:
- Feb 9, 2012, 2:51:41 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LazFuckIDE.lps
r4 r5 10 10 <IsPartOfProject Value="True"/> 11 11 <UnitName Value="LazFuckIDE"/> 12 <UsageCount Value="2 3"/>12 <UsageCount Value="25"/> 13 13 </Unit0> 14 14 <Unit1> … … 18 18 <ResourceBaseClass Value="Form"/> 19 19 <UnitName Value="UMainForm"/> 20 <IsVisibleTab Value="True"/>21 20 <EditorIndex Value="0"/> 22 21 <WindowIndex Value="0"/> 23 <TopLine Value="1 33"/>24 <CursorPos X="1 0" Y="146"/>25 <UsageCount Value="2 3"/>22 <TopLine Value="116"/> 23 <CursorPos X="1" Y="131"/> 24 <UsageCount Value="25"/> 26 25 <Loaded Value="True"/> 27 26 <LoadedDesigner Value="True"/> … … 33 32 <EditorIndex Value="3"/> 34 33 <WindowIndex Value="0"/> 35 <TopLine Value="1 04"/>36 <CursorPos X=" 1" Y="117"/>37 <UsageCount Value="2 3"/>34 <TopLine Value="1"/> 35 <CursorPos X="50" Y="2"/> 36 <UsageCount Value="25"/> 38 37 <Loaded Value="True"/> 39 38 </Unit2> … … 44 43 <ResourceBaseClass Value="Form"/> 45 44 <UnitName Value="UInterpreterForm"/> 45 <IsVisibleTab Value="True"/> 46 46 <EditorIndex Value="2"/> 47 47 <WindowIndex Value="0"/> 48 <TopLine Value=" 11"/>49 <CursorPos X=" 19" Y="6"/>50 <UsageCount Value="2 3"/>48 <TopLine Value="51"/> 49 <CursorPos X="37" Y="64"/> 50 <UsageCount Value="25"/> 51 51 <Loaded Value="True"/> 52 52 <LoadedDesigner Value="True"/> … … 78 78 <TopLine Value="46"/> 79 79 <CursorPos X="47" Y="65"/> 80 <UsageCount Value="2 0"/>80 <UsageCount Value="22"/> 81 81 <Loaded Value="True"/> 82 82 </Unit6> … … 87 87 <JumpHistory Count="30" HistoryIndex="29"> 88 88 <Position1> 89 <Filename Value="U BrainFuck.pas"/>90 <Caret Line=" 121" Column="1" TopLine="104"/>89 <Filename Value="UMainForm.pas"/> 90 <Caret Line="90" Column="29" TopLine="77"/> 91 91 </Position1> 92 92 <Position2> 93 <Filename Value="U BrainFuck.pas"/>94 <Caret Line=" 125" Column="1" TopLine="104"/>93 <Filename Value="UMainForm.pas"/> 94 <Caret Line="79" Column="37" TopLine="61"/> 95 95 </Position2> 96 96 <Position3> 97 <Filename Value="U BrainFuck.pas"/>98 <Caret Line=" 121" Column="1" TopLine="104"/>97 <Filename Value="UMainForm.pas"/> 98 <Caret Line="70" Column="13" TopLine="63"/> 99 99 </Position3> 100 100 <Position4> 101 <Filename Value="U BrainFuck.pas"/>102 <Caret Line="1 23" Column="1" TopLine="104"/>101 <Filename Value="UMainForm.pas"/> 102 <Caret Line="118" Column="1" TopLine="116"/> 103 103 </Position4> 104 104 <Position5> 105 <Filename Value="U BrainFuck.pas"/>106 <Caret Line="1 25" Column="1" TopLine="104"/>105 <Filename Value="UMainForm.pas"/> 106 <Caret Line="130" Column="1" TopLine="124"/> 107 107 </Position5> 108 108 <Position6> 109 <Filename Value="U BrainFuck.pas"/>110 <Caret Line="1 30" Column="1" TopLine="117"/>109 <Filename Value="UMainForm.pas"/> 110 <Caret Line="140" Column="3" TopLine="132"/> 111 111 </Position6> 112 112 <Position7> 113 <Filename Value="U BrainFuck.pas"/>114 <Caret Line="12 3" Column="14" TopLine="117"/>113 <Filename Value="UMainForm.pas"/> 114 <Caret Line="129" Column="10" TopLine="126"/> 115 115 </Position7> 116 116 <Position8> 117 <Filename Value="U BrainFuck.pas"/>118 <Caret Line=" 117" Column="1" TopLine="104"/>117 <Filename Value="UMainForm.pas"/> 118 <Caret Line="72" Column="15" TopLine="59"/> 119 119 </Position8> 120 120 <Position9> 121 <Filename Value="U BrainFuck.pas"/>122 <Caret Line="1 23" Column="1" TopLine="104"/>121 <Filename Value="UMainForm.pas"/> 122 <Caret Line="130" Column="3" TopLine="127"/> 123 123 </Position9> 124 124 <Position10> 125 <Filename Value="U BrainFuck.pas"/>126 <Caret Line="1 25" Column="1" TopLine="104"/>125 <Filename Value="UMainForm.pas"/> 126 <Caret Line="157" Column="42" TopLine="132"/> 127 127 </Position10> 128 128 <Position11> 129 <Filename Value="U BrainFuck.pas"/>130 <Caret Line=" 71" Column="42" TopLine="67"/>129 <Filename Value="UMainForm.pas"/> 130 <Caret Line="59" Column="15" TopLine="46"/> 131 131 </Position11> 132 132 <Position12> 133 133 <Filename Value="UMainForm.pas"/> 134 <Caret Line=" 98" Column="35" TopLine="40"/>134 <Caret Line="106" Column="24" TopLine="89"/> 135 135 </Position12> 136 136 <Position13> 137 137 <Filename Value="UMainForm.pas"/> 138 <Caret Line="9 9" Column="35" TopLine="74"/>138 <Caret Line="97" Column="19" TopLine="94"/> 139 139 </Position13> 140 140 <Position14> 141 141 <Filename Value="UMainForm.pas"/> 142 <Caret Line="1 01" Column="35" TopLine="76"/>142 <Caret Line="110" Column="54" TopLine="100"/> 143 143 </Position14> 144 144 <Position15> 145 145 <Filename Value="UMainForm.pas"/> 146 <Caret Line="1 14" Column="1" TopLine="91"/>146 <Caret Line="146" Column="12" TopLine="133"/> 147 147 </Position15> 148 148 <Position16> 149 149 <Filename Value="UMainForm.pas"/> 150 <Caret Line=" 68" Column="31" TopLine="48"/>150 <Caret Line="102" Column="42" TopLine="100"/> 151 151 </Position16> 152 152 <Position17> 153 153 <Filename Value="UMainForm.pas"/> 154 <Caret Line=" 90" Column="29" TopLine="77"/>154 <Caret Line="125" Column="54" TopLine="100"/> 155 155 </Position17> 156 156 <Position18> 157 <Filename Value="U MainForm.pas"/>158 <Caret Line=" 79" Column="37" TopLine="61"/>157 <Filename Value="UInterpreterForm.pas"/> 158 <Caret Line="6" Column="19" TopLine="9"/> 159 159 </Position18> 160 160 <Position19> 161 <Filename Value="U MainForm.pas"/>162 <Caret Line=" 70" Column="13" TopLine="63"/>161 <Filename Value="UInterpreterForm.pas"/> 162 <Caret Line="53" Column="1" TopLine="23"/> 163 163 </Position19> 164 164 <Position20> 165 <Filename Value="U MainForm.pas"/>166 <Caret Line=" 118" Column="1" TopLine="116"/>165 <Filename Value="UInterpreterForm.pas"/> 166 <Caret Line="54" Column="1" TopLine="29"/> 167 167 </Position20> 168 168 <Position21> 169 <Filename Value="U MainForm.pas"/>170 <Caret Line=" 130" Column="1" TopLine="124"/>169 <Filename Value="UInterpreterForm.pas"/> 170 <Caret Line="56" Column="77" TopLine="34"/> 171 171 </Position21> 172 172 <Position22> 173 <Filename Value="U MainForm.pas"/>174 <Caret Line=" 140" Column="3" TopLine="132"/>173 <Filename Value="UBrainFuck.pas"/> 174 <Caret Line="37" Column="5" TopLine="24"/> 175 175 </Position22> 176 176 <Position23> 177 <Filename Value="U MainForm.pas"/>178 <Caret Line=" 129" Column="10" TopLine="126"/>177 <Filename Value="UInterpreterForm.pas"/> 178 <Caret Line="56" Column="77" TopLine="34"/> 179 179 </Position23> 180 180 <Position24> 181 <Filename Value="U MainForm.pas"/>182 <Caret Line=" 72" Column="15" TopLine="59"/>181 <Filename Value="UInterpreterForm.pas"/> 182 <Caret Line="57" Column="77" TopLine="35"/> 183 183 </Position24> 184 184 <Position25> 185 <Filename Value="U MainForm.pas"/>186 <Caret Line=" 130" Column="3" TopLine="127"/>185 <Filename Value="UInterpreterForm.pas"/> 186 <Caret Line="59" Column="77" TopLine="36"/> 187 187 </Position25> 188 188 <Position26> 189 <Filename Value="U MainForm.pas"/>190 <Caret Line=" 157" Column="42" TopLine="132"/>189 <Filename Value="UInterpreterForm.pas"/> 190 <Caret Line="40" Column="15" TopLine="22"/> 191 191 </Position26> 192 192 <Position27> 193 <Filename Value="U MainForm.pas"/>194 <Caret Line=" 59" Column="15" TopLine="46"/>193 <Filename Value="UInterpreterForm.pas"/> 194 <Caret Line="14" Column="1" TopLine="19"/> 195 195 </Position27> 196 196 <Position28> 197 <Filename Value="U MainForm.pas"/>198 <Caret Line=" 106" Column="24" TopLine="89"/>197 <Filename Value="UInterpreterForm.pas"/> 198 <Caret Line="67" Column="24" TopLine="54"/> 199 199 </Position28> 200 200 <Position29> 201 <Filename Value="U MainForm.pas"/>202 <Caret Line=" 97" Column="19" TopLine="94"/>201 <Filename Value="UInterpreterForm.pas"/> 202 <Caret Line="81" Column="21" TopLine="63"/> 203 203 </Position29> 204 204 <Position30> 205 <Filename Value="U MainForm.pas"/>206 <Caret Line=" 110" Column="54" TopLine="100"/>205 <Filename Value="UInterpreterForm.pas"/> 206 <Caret Line="64" Column="3" TopLine="51"/> 207 207 </Position30> 208 208 </JumpHistory> -
trunk/UBrainFuck.pas
r3 r5 6 6 7 7 uses 8 Classes, SysUtils, Dialogs ;8 Classes, SysUtils, Dialogs, Forms; 9 9 10 10 type … … 35 35 Input: string; 36 36 InputPosition: Integer; 37 StepCount: Integer; 37 38 procedure Reset; 38 39 procedure SingleStep; … … 48 49 SProgramLowerLimit = 'Program run over lower limit'; 49 50 SProgramUpperLimit = 'Program run over upper limit'; 51 SReadInputError = 'Read input error'; 50 52 51 53 { TBrainFuckInterpreter } … … 60 62 Character: string; 61 63 begin 62 Character := Copy(Input, InputPosition, 1); 63 Result := Ord(Character[1]); 64 Inc(InputPosition); 64 if InputPosition < Length(Input) then begin 65 Character := Copy(Input, InputPosition, 1); 66 Result := Ord(Character[1]); 67 Inc(InputPosition); 68 end else 69 raise Exception.Create(SReadInputError); 65 70 end; 66 71 … … 84 89 Memory[I] := 0; 85 90 SetLength(Loop, 0); 91 StepCount := 0; 86 92 end; 87 93 … … 129 135 end; 130 136 Inc(SourcePosition); 137 Inc(StepCount); 131 138 end; 132 139 … … 134 141 begin 135 142 Reset; 136 while SourcePosition < Length(Source) do 143 while SourcePosition < Length(Source) do begin 137 144 SingleStep; 145 Application.ProcessMessages; 146 end; 138 147 end; 139 148 -
trunk/UInterpreterForm.lfm
r2 r5 1 1 object InterpreterForm: TInterpreterForm 2 Left = 3053 Height = 4504 Top = 1 245 Width = 6142 Left = 242 3 Height = 509 4 Top = 116 5 Width = 762 6 6 Caption = 'Runtime' 7 ClientHeight = 4508 ClientWidth = 6147 ClientHeight = 509 8 ClientWidth = 762 9 9 LCLVersion = '0.9.31' 10 object Panel 1: TPanel10 object Panel3: TPanel 11 11 Left = 0 12 Height = 23412 Height = 509 13 13 Top = 0 14 Width = 61415 Align = al Top14 Width = 323 15 Align = alLeft 16 16 BevelOuter = bvNone 17 ClientHeight = 23418 ClientWidth = 61417 ClientHeight = 509 18 ClientWidth = 323 19 19 TabOrder = 0 20 object MemoInput: TMemo 20 object Panel1: TPanel 21 Left = 0 22 Height = 242 23 Top = 0 24 Width = 323 25 Align = alTop 26 BevelOuter = bvNone 27 ClientHeight = 242 28 ClientWidth = 323 29 TabOrder = 0 30 object MemoInput: TMemo 31 Left = 8 32 Height = 210 33 Top = 24 34 Width = 309 35 Anchors = [akTop, akLeft, akRight, akBottom] 36 TabOrder = 0 37 end 38 object Label1: TLabel 39 Left = 8 40 Height = 14 41 Top = 8 42 Width = 31 43 Caption = 'Input:' 44 ParentColor = False 45 end 46 end 47 object Splitter1: TSplitter 48 Cursor = crVSplit 49 Left = 0 50 Height = 5 51 Top = 242 52 Width = 323 53 Align = alTop 54 ResizeAnchor = akTop 55 end 56 object Panel2: TPanel 57 Left = 0 58 Height = 262 59 Top = 247 60 Width = 323 61 Align = alClient 62 BevelOuter = bvNone 63 ClientHeight = 262 64 ClientWidth = 323 65 TabOrder = 2 66 object Label2: TLabel 67 Left = 8 68 Height = 14 69 Top = 6 70 Width = 39 71 Caption = 'Output:' 72 ParentColor = False 73 end 74 object MemoOutput: TMemo 75 Left = 8 76 Height = 237 77 Top = 22 78 Width = 309 79 Anchors = [akTop, akLeft, akRight, akBottom] 80 TabOrder = 0 81 end 82 end 83 end 84 object Splitter2: TSplitter 85 Left = 323 86 Height = 509 87 Top = 0 88 Width = 5 89 end 90 object Panel4: TPanel 91 Left = 328 92 Height = 509 93 Top = 0 94 Width = 434 95 Align = alClient 96 BevelOuter = bvNone 97 ClientHeight = 509 98 ClientWidth = 434 99 TabOrder = 2 100 object Label3: TLabel 101 Left = 0 102 Height = 14 103 Top = 8 104 Width = 82 105 Caption = 'Program pointer:' 106 ParentColor = False 107 end 108 object LabelProgramPointer: TLabel 109 Left = 112 110 Height = 14 111 Top = 8 112 Width = 10 113 Caption = ' ' 114 ParentColor = False 115 end 116 object Label5: TLabel 117 Left = 1 118 Height = 14 119 Top = 24 120 Width = 80 121 Caption = 'Memory pointer:' 122 ParentColor = False 123 end 124 object LabelMemoryPointer: TLabel 125 Left = 112 126 Height = 14 127 Top = 24 128 Width = 10 129 Caption = ' ' 130 ParentColor = False 131 end 132 object Label4: TLabel 133 Left = 1 134 Height = 14 135 Top = 42 136 Width = 67 137 Caption = 'Step counter:' 138 ParentColor = False 139 end 140 object LabelStepCounter: TLabel 141 Left = 112 142 Height = 14 143 Top = 42 144 Width = 10 145 Caption = ' ' 146 ParentColor = False 147 end 148 object ListViewMemory: TListView 21 149 Left = 8 22 Height = 20223 Top = 2424 Width = 600150 Height = 384 151 Top = 120 152 Width = 422 25 153 Anchors = [akTop, akLeft, akRight, akBottom] 154 Columns = < 155 item 156 Caption = 'Address' 157 Width = 80 158 end 159 item 160 Caption = 'Data' 161 Width = 300 162 end> 163 Font.Height = -11 164 Font.Name = 'Courier New' 165 OwnerData = True 166 ParentFont = False 167 ReadOnly = True 26 168 TabOrder = 0 169 ViewStyle = vsReport 170 OnData = ListViewMemoryData 27 171 end 28 object Label 1: TLabel172 object Label6: TLabel 29 173 Left = 8 30 174 Height = 14 31 Top = 832 Width = 3133 Caption = ' Input:'175 Top = 104 176 Width = 43 177 Caption = 'Memory:' 34 178 ParentColor = False 35 179 end 36 180 end 37 object Panel2: TPanel 38 Left = 0 39 Height = 216 40 Top = 234 41 Width = 614 42 Align = alClient 43 BevelOuter = bvNone 44 ClientHeight = 216 45 ClientWidth = 614 46 TabOrder = 1 47 object Label2: TLabel 48 Left = 8 49 Height = 14 50 Top = 6 51 Width = 39 52 Caption = 'Output:' 53 ParentColor = False 54 end 55 object MemoOutput: TMemo 56 Left = 8 57 Height = 191 58 Top = 22 59 Width = 600 60 Anchors = [akTop, akLeft, akRight, akBottom] 61 TabOrder = 0 62 end 181 object Timer1: TTimer 182 Interval = 500 183 OnTimer = Timer1Timer 184 left = 495 185 top = 61 63 186 end 64 187 end -
trunk/UInterpreterForm.pas
r2 r5 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ExtCtrls; 9 ExtCtrls, ComCtrls; 10 11 const 12 RowSize = 16; 10 13 11 14 type … … 16 19 Label1: TLabel; 17 20 Label2: TLabel; 21 Label3: TLabel; 22 Label4: TLabel; 23 Label6: TLabel; 24 LabelStepCounter: TLabel; 25 LabelProgramPointer: TLabel; 26 Label5: TLabel; 27 LabelMemoryPointer: TLabel; 28 ListViewMemory: TListView; 18 29 MemoInput: TMemo; 19 30 MemoOutput: TMemo; 20 31 Panel1: TPanel; 21 32 Panel2: TPanel; 33 Panel3: TPanel; 34 Panel4: TPanel; 35 Splitter1: TSplitter; 36 Splitter2: TSplitter; 37 Timer1: TTimer; 38 procedure ListViewMemoryData(Sender: TObject; Item: TListItem); 39 procedure Timer1Timer(Sender: TObject); 22 40 private 23 41 { private declarations } 24 42 public 25 { public declarations }43 procedure RefreshListViewMemory; 26 44 end; 27 45 … … 31 49 implementation 32 50 51 uses 52 UMainForm; 53 33 54 {$R *.lfm} 55 56 { TInterpreterForm } 57 58 procedure TInterpreterForm.Timer1Timer(Sender: TObject); 59 begin 60 LabelProgramPointer.Caption := IntToStr(MainForm.BrainFuckInterpreter.SourcePosition); 61 LabelMemoryPointer.Caption := IntToStr(MainForm.BrainFuckInterpreter.MemoryPosition); 62 LabelStepCounter.Caption := IntToStr(MainForm.BrainFuckInterpreter.StepCount); 63 RefreshListViewMemory; 64 MemoOutput.Lines.Text := MainForm.BrainFuckInterpreter.Output; 65 end; 66 67 procedure TInterpreterForm.RefreshListViewMemory; 68 begin 69 ListViewMemory.Items.Count := Trunc(Length(MainForm.BrainFuckInterpreter.Memory) / RowSize); 70 ListViewMemory.Refresh; 71 end; 72 73 procedure TInterpreterForm.ListViewMemoryData(Sender: TObject; Item: TListItem); 74 var 75 Row: string; 76 I: Integer; 77 begin 78 with MainForm.BrainFuckInterpreter do 79 if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin 80 Item.Caption := IntToHex(Item.Index * RowSize, 8); 81 Row := ''; 82 for I := 0 to RowSize - 1 do 83 Row := Row + ' ' + IntToHex(Memory[Item.Index * RowSize + I], 2); 84 Item.SubItems.Add(Row); 85 end; 86 end; 34 87 35 88 end. -
trunk/UMainForm.lfm
r4 r5 840 840 end 841 841 object OpenDialog1: TOpenDialog 842 DefaultExt = '.b f'843 Filter = 'BrainFuck (*.b f)|*.bf|Any file (*.*)|*.*'842 DefaultExt = '.b' 843 Filter = 'BrainFuck (*.b)|*.b|Any file (*.*)|*.*' 844 844 left = 192 845 845 top = 157 846 846 end 847 847 object SaveDialog1: TSaveDialog 848 DefaultExt = '.b f'849 Filter = 'BrainFuck (*.b f)|*.bf|Any file (*.*)|*.*'848 DefaultExt = '.b' 849 Filter = 'BrainFuck (*.b)|*.b|Any file (*.*)|*.*' 850 850 left = 192 851 851 top = 208 -
trunk/UMainForm.pas
r4 r5 89 89 procedure TMainForm.FormShow(Sender: TObject); 90 90 begin 91 UpdateInterface;91 AProjectNew.Execute; 92 92 end; 93 93 … … 129 129 BrainFuckInterpreter.Source := MemoSource.Lines.Text; 130 130 BrainFuckInterpreter.Run; 131 InterpreterForm.MemoOutput.Lines.Text := BrainFuckInterpreter.Output;132 131 end; 133 132
Note:
See TracChangeset
for help on using the changeset viewer.