From a43456eaa9919c2571fa961213ac6847225a3b4b Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Thu, 22 Nov 2018 23:26:47 +0000 Subject: [PATCH] Brainfuck interpreter update git-svn-id: svn://kolibrios.org@7560 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/BrainFuck/brainfuck.c | 16 ++++++++++------ programs/cmm/BrainFuck/compile.sh | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/programs/cmm/BrainFuck/brainfuck.c b/programs/cmm/BrainFuck/brainfuck.c index 0ae7011bca..ca124a6482 100644 --- a/programs/cmm/BrainFuck/brainfuck.c +++ b/programs/cmm/BrainFuck/brainfuck.c @@ -94,6 +94,7 @@ void evalBrainFuckCode(dword code) void main() { dword brainFuckCode = 0; + word maxLoop = 1000; buffer = malloc(bufferSize); memory = malloc(memoryBrainfuck); @@ -106,16 +107,19 @@ void main() ELSE { consoleInit(); - con_printf stdcall ("BrainF*ck interpreter v1.01\r\n"); - loop() + con_printf stdcall ("BrainF*ck interpreter v1.05"); + WHILE(maxLoop) { - con_printf stdcall ("\r\nEnter BrainF*ck code:\r\n"); + con_printf stdcall ("\r\n\r\nEnter code: "); con_gets stdcall(buffer, bufferSize); - evalBrainFuckCode(EAX); - con_printf stdcall ("\r\nOutput BrainF*ck:\r\n"); + brainFuckCode = EAX; + con_printf stdcall ("Output: "); + evalBrainFuckCode(brainFuckCode); + maxLoop--; } } - ExitProcess(); + IF(initConsole) con_exit stdcall (0); + ExitProcess(); } diff --git a/programs/cmm/BrainFuck/compile.sh b/programs/cmm/BrainFuck/compile.sh index 1be419bf24..ddd47b53e8 100755 --- a/programs/cmm/BrainFuck/compile.sh +++ b/programs/cmm/BrainFuck/compile.sh @@ -1,5 +1,5 @@ #!/bin/bash for file in `find ./ -type f -name "*.c"` do - ./cmm $file; + cmm $file; done \ No newline at end of file