From 61a7b6381a456c7554f7688c7cdad4c6c70d1091 Mon Sep 17 00:00:00 2001 From: Ivan Denisov Date: Mon, 9 May 2016 15:38:11 +0700 Subject: [PATCH] console example improved --- examples/console/README | 22 +++++++++++++++ examples/console/System/Mod/Init.odc | Bin 2699 -> 0 bytes examples/console/System/Mod/Init.txt | 39 +++++++++++++++++++++++++++ examples/console/run-dev | 10 ------- 4 files changed, 61 insertions(+), 10 deletions(-) create mode 100755 examples/console/README delete mode 100644 examples/console/System/Mod/Init.odc create mode 100644 examples/console/System/Mod/Init.txt delete mode 100755 examples/console/run-dev diff --git a/examples/console/README b/examples/console/README new file mode 100755 index 0000000..852c2b5 --- /dev/null +++ b/examples/console/README @@ -0,0 +1,22 @@ +Example to demonstrate ConsCompiler and ConsLog. + +ConsCompiler allows to compile sources stored in "txt" format. +ConsLog provides realisation for the Log abstract interface. + +Author of the example: Ivan Denisov, denisov@molpit.org + +Installation and demonstration + +1. Prepare Interp version of BlackBox in "Linux_Interp" folder: + ./switch-target `uname -s` Interp + ./build + ./export ../Linux_Interp + +2. Compile this example: + cd ../examples/console + echo "ConsCompiler.Compile('System/Mod', 'Init.txt')" | ./runc + +3. For demonstration run: + ./runc 123 123 + +Output will contain: "Summ: 246.0". diff --git a/examples/console/System/Mod/Init.odc b/examples/console/System/Mod/Init.odc deleted file mode 100644 index f32fe066e78bb32d80528145e7333e14569cbaf6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2699 zcmb7GTW=dh6ds#fjk-`#5QPUcs!~W&Yl{;VAzMXF>`h|fTx7dJP$98iPm)!3cg$Ym zAR!)-S04I?ct9Zafd~Eq|D;0VC$xS*eFDxoGvi&SE)pYq=i77n&N;JlYqoYJgLd|$ zCA};ZQJUDjbZA~$BJo&3H7jq*D0Tfv#EHG{i?K3BRCs^fOJyvO6gslNaM)gf|D{(6 zo)r>RO2%FMIQ#Z%d& ztbFK+$v(YA@SHew7C=%+1X-R*Z}PI{`5VCNfd4WA#xR7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 0000000..190d9df --- /dev/null +++ b/examples/console/System/Mod/Init.txt @@ -0,0 +1,39 @@ +MODULE Init; + + IMPORT + Kernel, + HostConsole (* Console.SetHook *) , + + HostFonts (* Fonts.SetHook; required for Texts *), + HostWindows (* Windows.SetHook *), + HostDates (* Dates.SetHook *), + HostDialog (* Dialog.SetShowHook *), + StdInterpreter (* Dialog.SetCallHook *) , + StdDialog (* Views.SetViewHook *), + + Log, ConsLog, (* Log.Hook *) + Strings, + Converters (* .odc *), + Dialog; + + PROCEDURE Init; + VAR + c1, c2, res: INTEGER; a, b: REAL; + BEGIN + IF Kernel.bootInfo.argc = 3 THEN + Strings.StringToReal(Kernel.bootInfo.argv[1]$, a, c1); + Strings.StringToReal(Kernel.bootInfo.argv[2]$, b, c2); + IF (c1 = 0) & (c2 = 0) THEN + Log.String("Summ: "); Log.Real(a + b); Log.Ln + ELSE + Log.String("The arguments should be in the form of real: 13123.556"); Log.Ln + END + ELSE + Log.String("Example of simple console application based on BlackBox Component Builder."); Log.Ln; + Log.String("You can pass two arguments and sum of them will be returned."); Log.Ln + END + END Init; + +BEGIN + Init +END Init. \ No newline at end of file diff --git a/examples/console/run-dev b/examples/console/run-dev deleted file mode 100755 index 50874c1..0000000 --- a/examples/console/run-dev +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# fix Ubuntu-specific problems: -unset UBUNTU_MENUPROXY -unset GTK_MODULES -export LIBOVERLAY_SCROLLBAR=0 -mv Code Code_ -env \ - BB_PRIMARY_DIR="../../BlackBox" BB_SECONDARY_DIR="$PWD" \ -../../BlackBox/blackbox -- 2.29.2