- Timestamp:
- Dec 3, 2014, 10:45:24 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Examples/Fibonacci_comments.b
r41 r60 1 +++++++++++ number of digits to output 2 > #1 3 + initial number 4 >>>> #5 5 ++++++++++++++++++++++++++++++++++++++++++++ (comma) 6 > #6 7 ++++++++++++++++++++++++++++++++ (space) 8 <<<<<< #0 9 [ 10 > #1 11 copy #1 to #7 12 [>>>>>>+>+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-] 13 14 < 15 divide #7 by 10 (begins in #7) 16 [ 17 > 18 ++++++++++ set the divisor #8 19 [ 20 subtract from the dividend and divisor 21 -<- 22 if dividend reaches zero break out 23 copy dividend to #9 24 [>>+>+<<<-]>>>[<<<+>>>-] 25 set #10 26 + 27 if #9 clear #10 28 <[>[-]<[-]] 29 if #10 move remaining divisor to #11 30 >[<<[>>>+<<<-]>>[-]] 31 jump back to #8 (divisor possition) 32 << 33 ] 34 if #11 is empty (no remainder) increment the quotient #12 35 >>> #11 36 copy to #13 37 [>>+>+<<<-]>>>[<<<+>>>-] 38 set #14 39 + 40 if #13 clear #14 41 <[>[-]<[-]] 42 if #14 increment quotient 43 >[<<+>>[-]] 44 <<<<<<< #7 45 ] 46 47 quotient is in #12 and remainder is in #11 48 >>>>> #12 49 if #12 output value plus offset to ascii 0 50 [++++++++++++++++++++++++++++++++++++++++++++++++.[-]] 51 subtract #11 from 10 52 ++++++++++ #12 is now 10 53 < #11 54 [->-<] 55 > #12 56 output #12 even if it's zero 57 ++++++++++++++++++++++++++++++++++++++++++++++++.[-] 58 <<<<<<<<<<< #1 59 60 check for final number 61 copy #0 to #3 62 <[>>>+>+<<<<-]>>>>[<<<<+>>>>-] 63 <- #3 64 if #3 output (comma) and (space) 65 [>>.>.<<<[-]] 66 << #1 67 68 [>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<- 69 ] 1 [ This program prints Sierpinski triangle on 80-column display. ] 2 > 3 + + 4 + + 5 [ < + + 6 j + + 7 + + + + 8 > - ] > 9 + + + + + + + + 10 [ > 11 + + + + 12 < - ] > 13 > + + > > > + > 14 > > + < 15 < < < < < < < < 16 < [ - [ - > + < 17 ] > [ - < + > > > . < < ] > > > 18 [ [ 19 - > + + 20 + + + + 21 + + [ > + + + + 22 < - ] > 23 . < < [ - > + < 24 ] + > [ - > + + 25 + + + + + + + + < < + > ] > . [ 26 - ] > ] 27 ] + < < < [ - [ 28 - > + < ] + > [ 29 - < + > > > - [ - > + < ] + + > 30 [ - < - > ] < < 31 < ] < < < < ] + + + + + + + + + 32 + . + + + . [ - ] < ] + + + + + 33 * * * * * M a d e * B y : * N Y Y R I K K I * 2 0 0 2 * * * * * -
trunk/Forms/UFormMain.lfm
r59 r60 889 889 } 890 890 end 891 object MenuItem19: TMenuItem 892 Action = AViewLog 893 end 891 894 object MenuItem30: TMenuItem 892 895 Action = AViewCompilers … … 1076 1079 Caption = 'Show execution point' 1077 1080 OnExecute = AProgramShowExecutionPointExecute 1081 end 1082 object AViewLog: TAction 1083 Category = 'View' 1084 Caption = 'Log' 1085 OnExecute = AViewLogExecute 1078 1086 end 1079 1087 end -
trunk/Forms/UFormMain.lrt
r59 r60 37 37 TMAINFORM.ASHOWSOURCEPOSITION.CAPTION=Show position in source 38 38 TMAINFORM.APROGRAMSHOWEXECUTIONPOINT.CAPTION=Show execution point 39 TMAINFORM.AVIEWLOG.CAPTION=Log -
trunk/Forms/UFormMain.pas
r59 r60 16 16 17 17 TMainForm = class(TForm) 18 AViewLog: TAction; 18 19 AProgramShowExecutionPoint: TAction; 19 20 AShowSourcePosition: TAction; … … 51 52 MenuItem17: TMenuItem; 52 53 MenuItem18: TMenuItem; 54 MenuItem19: TMenuItem; 53 55 MenuItem2: TMenuItem; 54 56 MenuItem22: TMenuItem; … … 133 135 procedure AViewCompilersExecute(Sender: TObject); 134 136 procedure AViewInterpretterExecute(Sender: TObject); 137 procedure AViewLogExecute(Sender: TObject); 135 138 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); 136 139 procedure FormCreate(Sender: TObject); … … 140 143 private 141 144 FCurrentTarget: TTarget; 145 procedure TargetLogExecute(Lines: TStrings); 142 146 procedure SetCurrentTarget(AValue: TTarget); 143 147 procedure AProjectOpenRecentExecute(Sender: TObject); … … 169 173 uses 170 174 UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput, 171 UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter ;175 UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog; 172 176 173 177 resourcestring … … 189 193 for I := 0 to Core.Targets.Count - 1 do 190 194 TTarget(Core.Targets[I]).OnChangeState := nil; 191 FCurrentTarget.OnChangeState := TargetStateChanged; 192 FCurrentTarget.Messages.OnChange := MessagesChanged; 195 if Assigned(FCurrentTarget) then begin 196 FCurrentTarget.OnChangeState := TargetStateChanged; 197 FCurrentTarget.OnLog := TargetLogExecute; 198 FCurrentTarget.Messages.OnChange := MessagesChanged; 199 end; 193 200 UpdateTargetList; 194 201 UpdateInterface; … … 218 225 FormOutput.Reload; 219 226 FormMemory.Reload; 227 end; 228 229 procedure TMainForm.TargetLogExecute(Lines: TStrings); 230 begin 231 FormLog.Memo1.Lines.AddStrings(Lines); 220 232 end; 221 233 … … 438 450 end; 439 451 452 procedure TMainForm.AViewLogExecute(Sender: TObject); 453 begin 454 FormLog.Show; 455 end; 456 440 457 procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean); 441 458 begin -
trunk/Languages/LazFuckIDE.cs.po
r59 r60 101 101 msgstr "Vstup:" 102 102 103 #: tformlog.caption 104 msgctxt "tformlog.caption" 105 msgid "Log" 106 msgstr "" 107 103 108 #: tformmemory.caption 104 109 msgid "Memory" … … 428 433 msgstr "PÅekladaÄe" 429 434 435 #: tmainform.aviewlog.caption 436 msgctxt "tmainform.aviewlog.caption" 437 msgid "Log" 438 msgstr "" 439 430 440 #: tmainform.caption 431 441 msgid "LazFuck" … … 729 739 msgid "Read input error" 730 740 msgstr "Chyba Ätenà vstupu" 741 -
trunk/Languages/LazFuckIDE.po
r59 r60 90 90 msgstr "" 91 91 92 #: tformlog.caption 93 msgctxt "tformlog.caption" 94 msgid "Log" 95 msgstr "" 96 92 97 #: tformmemory.caption 93 98 msgid "Memory" … … 415 420 msgstr "" 416 421 422 #: tmainform.aviewlog.caption 423 msgctxt "TMAINFORM.AVIEWLOG.CAPTION" 424 msgid "Log" 425 msgstr "" 426 417 427 #: tmainform.caption 418 428 msgid "LazFuck" -
trunk/LazFuckIDE.lpi
r59 r60 96 96 </Item6> 97 97 </RequiredPackages> 98 <Units Count=" 19">98 <Units Count="21"> 99 99 <Unit0> 100 100 <Filename Value="LazFuckIDE.lpr"/> … … 223 223 <UnitName Value="UCore"/> 224 224 </Unit18> 225 <Unit19> 226 <Filename Value="Target\UTargetFPC.pas"/> 227 <IsPartOfProject Value="True"/> 228 <UnitName Value="UTargetFPC"/> 229 </Unit19> 230 <Unit20> 231 <Filename Value="Forms\UFormLog.pas"/> 232 <IsPartOfProject Value="True"/> 233 <ComponentName Value="FormLog"/> 234 <ResourceBaseClass Value="Form"/> 235 <UnitName Value="UFormLog"/> 236 </Unit20> 225 237 </Units> 226 238 </ProjectOptions> -
trunk/LazFuckIDE.lpr
r59 r60 10 10 Interfaces, // this includes the LCL widgetset 11 11 Forms, UTarget, UTargetC, UTargetDelphi, UTargetInterpretter, UTargetPHP, 12 UTargetJava, UFormCPU, UFormMain, UFormOptions, UFormTargets, UFormOutput, 13 UFormInput, UFormMemory, UFormMessages, UFormSourceCode, UFormTargetCode, 14 UFormTargetOptions, UCore, Common, TemplateGenerics, CoolTranslator; 12 UTargetJava, UTargetFPC, UFormCPU, UFormMain, UFormOptions, UFormTargets, 13 UFormOutput, UFormInput, UFormMemory, UFormMessages, UFormSourceCode, 14 UFormTargetCode, UFormTargetOptions, UCore, Common, TemplateGenerics, 15 CoolTranslator, UFormLog; 15 16 16 17 {$R *.res} … … 32 33 Application.CreateForm(TFormTargetCode, FormTargetCode); 33 34 Application.CreateForm(TFormTargetOptions, FormTargetOptions); 35 Application.CreateForm(TFormLog, FormLog); 34 36 Application.Run; 35 37 end. -
trunk/Target/UTarget.pas
r58 r60 69 69 cmOutput, cmInput, cmLoopStart, cmLoopEnd, cmDebug); 70 70 71 TLogEvent = procedure (Lines: TStrings) of object; 72 71 73 { TTarget } 72 74 73 75 TTarget = class 76 private 77 FOnLog: TLogEvent; 74 78 protected 75 79 FCompiled: Boolean; … … 101 105 ExecutorPath: string; 102 106 SourceExtension: string; 107 RunExtension: string; 103 108 CompiledExtension: string; 104 109 ProjectFileName: string; … … 124 129 procedure SaveToRegistry(Root: HKEY; Key: string); virtual; 125 130 property State: TRunState read FState write SetState; 126 property OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState;127 131 property SourceCode: string write SetSourceCode; 128 132 property TargetCode: string read GetTargetCode; … … 130 134 property ExecutionPosition: Integer read GetExecutionPosition; 131 135 property ProgramIndex: Integer read FProgramIndex; 136 property OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState; 137 property OnLog: TLogEvent read FOnLog write FOnLog; 132 138 end; 133 139 … … 396 402 Process: TProcess; 397 403 CompiledFile: string; 404 Lines: TStringList; 405 I: Integer; 398 406 begin 399 407 CompiledFile := ExtractFilePath(ProjectFileName) + … … 412 420 try 413 421 Process := TProcess.Create(nil); 414 Process.CurrentDirectory := ExtractFilePath(CompilerPath); 415 Process.CommandLine := LongFileName(CompilerPath) + ' ' + LongFileName(CompiledFile); 416 Process.Options := [poWaitOnExit]; 422 Process.CurrentDirectory := ExtractFilePath(CompiledFile); 423 Process.Executable := LongFileName(CompilerPath); 424 Process.Parameters.Add(LongFileName(CompiledFile)); 425 for I := 0 to GetEnvironmentVariableCount - 1 do 426 Process.Environment.Add(GetEnvironmentString(I)); 427 Process.Options := [poWaitOnExit, poUsePipes]; 417 428 Process.Execute; 429 if Assigned(FOnLog) then begin 430 Lines := TStringList.Create; 431 Lines.LoadFromStream(Process.Output); 432 Lines.Insert(0, Process.Executable + ' ' + Process.Parameters.Text); 433 FOnLog(Lines); 434 Lines.Free; 435 end; 418 436 finally 419 437 Process.Free; … … 426 444 Process: TProcess; 427 445 CompiledFile: string; 446 RunFile: string; 428 447 begin 429 448 CompiledFile := ExtractFilePath(ProjectFileName) + 430 449 'compiled' + DirectorySeparator + Name + DirectorySeparator + 431 450 ExtractFileNameOnly(ProjectFileName) + CompiledExtension; 451 RunFile := ExtractFilePath(ProjectFileName) + 452 'compiled' + DirectorySeparator + Name + DirectorySeparator + 453 ExtractFileNameOnly(ProjectFileName) + RunExtension; 432 454 if FileExistsUTF8(CompiledFile) then 433 455 try 434 456 Process := TProcess.Create(nil); 435 if ExecutorPath <> '' then Process.CommandLine := LongFileName(ExecutorPath) + ' '; 436 Process.CommandLine := Process.CommandLine + LongFileName(CompiledFile); 437 Process.Options := [poWaitOnExit]; 457 if ExecutorPath <> '' then begin 458 Process.Executable := LongFileName(ExecutorPath); 459 Process.Parameters.Add(LongFileName(RunFile)); 460 end else Process.Executable := LongFileName(RunFile); 461 Process.ShowWindow := swoShow; 462 Process.Options := [poWaitOnExit, poNewConsole]; 438 463 Process.Execute; 439 464 finally -
trunk/Target/UTargetC.pas
r52 r60 31 31 Name := 'C'; 32 32 SourceExtension := '.c'; 33 CompiledExtension := '.exe';34 33 ImageIndex := 23; 35 34 Capabilities := [tcCompile, tcRun]; 36 35 {$IFDEF Windows} 37 36 CompilerPath := 'c:\Program Files\MinGW\bin\gcc.exe'; 37 CompiledExtension := '.exe'; 38 RunExtension := ''; 38 39 {$ENDIF} 39 40 {$IFDEF Linux} 40 41 CompilerPath := '/usr/bin/gcc'; 42 CompiledExtension := ''; 43 RunExtension := ''; 41 44 {$ENDIF} 42 45 end; -
trunk/Target/UTargetDelphi.pas
r52 r60 30 30 SourceExtension := '.pas'; 31 31 ImageIndex := 22; 32 CompiledExtension := '.exe';33 32 Capabilities := [tcCompile, tcRun]; 34 33 {$IFDEF Windows} 35 34 CompilerPath := 'c:\Program Files\Embarcadero\RAD Studio\9.0\bin\DCC32.EXE'; 35 CompiledExtension := '.exe'; 36 RunExtension := ''; 36 37 {$ENDIF} 37 38 end; -
trunk/Target/UTargetJava.pas
r52 r60 31 31 SourceExtension := '.java'; 32 32 CompiledExtension := '.class'; 33 RunExtension := ''; 33 34 ImageIndex := 24; 34 35 Capabilities := [tcCompile, tcRun]; -
trunk/Target/UTargetPHP.pas
r59 r60 30 30 Name := 'PHP'; 31 31 SourceExtension := '.php'; 32 RunExtension := '.php'; 33 CompiledExtension := '.php'; 32 34 ImageIndex := 21; 33 35 Capabilities := [tcCompile, tcRun]; -
trunk/UCore.pas
r59 r60 39 39 40 40 uses 41 UTargetJava, UTargetDelphi, UTargetPHP, UTargetC, UTargetInterpretter ;41 UTargetJava, UTargetDelphi, UTargetPHP, UTargetC, UTargetInterpretter, UTargetFPC; 42 42 43 43 … … 50 50 Targets.Add(TTargetInterpretter.Create); 51 51 Targets.Add(TTargetDelphi.Create); 52 Targets.Add(TTargetFPC.Create); 52 53 Targets.Add(TTargetPHP.Create); 53 54 Targets.Add(TTargetC.Create);
Note:
See TracChangeset
for help on using the changeset viewer.