From 6244cc2e4fb7aaabd14352a21add5236220a8198 Mon Sep 17 00:00:00 2001 From: def Date: Sat, 14 Feb 2015 23:43:31 +0100 Subject: [PATCH] Fix cross_calculator example --- .../{nimrod_backend => nim_backend}/backend.nim | 0 .../nimrod.cfg => nim_commandline/nim.cfg} | 2 +- .../nimcalculator.nim | 6 +++--- .../{nimrod_commandline => nim_commandline}/readme.txt | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) rename examples/cross_calculator/{nimrod_backend => nim_backend}/backend.nim (100%) rename examples/cross_calculator/{nimrod_commandline/nimrod.cfg => nim_commandline/nim.cfg} (81%) rename examples/cross_calculator/{nimrod_commandline => nim_commandline}/nimcalculator.nim (97%) rename examples/cross_calculator/{nimrod_commandline => nim_commandline}/readme.txt (60%) diff --git a/examples/cross_calculator/nimrod_backend/backend.nim b/examples/cross_calculator/nim_backend/backend.nim similarity index 100% rename from examples/cross_calculator/nimrod_backend/backend.nim rename to examples/cross_calculator/nim_backend/backend.nim diff --git a/examples/cross_calculator/nimrod_commandline/nimrod.cfg b/examples/cross_calculator/nim_commandline/nim.cfg similarity index 81% rename from examples/cross_calculator/nimrod_commandline/nimrod.cfg rename to examples/cross_calculator/nim_commandline/nim.cfg index c1aedcf6ae..41c0344309 100644 --- a/examples/cross_calculator/nimrod_commandline/nimrod.cfg +++ b/examples/cross_calculator/nim_commandline/nim.cfg @@ -1,4 +1,4 @@ # Nimrod configuration file. # The file is used only to add the path of the backend to the compiler options. -path="../nimrod_backend" +path="../nim_backend" diff --git a/examples/cross_calculator/nimrod_commandline/nimcalculator.nim b/examples/cross_calculator/nim_commandline/nimcalculator.nim similarity index 97% rename from examples/cross_calculator/nimrod_commandline/nimcalculator.nim rename to examples/cross_calculator/nim_commandline/nimcalculator.nim index 440834ca81..69d62a90ca 100644 --- a/examples/cross_calculator/nimrod_commandline/nimcalculator.nim +++ b/examples/cross_calculator/nim_commandline/nimcalculator.nim @@ -21,7 +21,7 @@ type cmdParams, # Two valid parameters were provided cmdInteractive # No parameters were provided, run interactive mode - TParamConfig = object of TObject + TParamConfig = object of RootObj action: TCommand # store the type of operation paramA, paramB: int # possibly store the valid parameters @@ -63,7 +63,7 @@ proc parseCmdLine(): TParamConfig = stdout.write USAGE quit "Unexpected option: " & key, 2 of cmdEnd: break - except EInvalidValue: + except ValueError: stdout.write USAGE quit "Invalid value " & val & " for parameter " & key, 3 @@ -85,7 +85,7 @@ proc parseUserInput(question: string): int = try: result = input.parseInt break - except EInvalidValue: + except ValueError: if input.len < 1: quit "Blank line detected, quitting.", 0 echo "Sorry, `$1' doesn't seem to be a valid integer" % input diff --git a/examples/cross_calculator/nimrod_commandline/readme.txt b/examples/cross_calculator/nim_commandline/readme.txt similarity index 60% rename from examples/cross_calculator/nimrod_commandline/readme.txt rename to examples/cross_calculator/nim_commandline/readme.txt index 5430e7b47b..f95bd962e0 100644 --- a/examples/cross_calculator/nimrod_commandline/readme.txt +++ b/examples/cross_calculator/nim_commandline/readme.txt @@ -1,10 +1,10 @@ -In this directory you will find the nimrod commandline version of the +In this directory you will find the nim commandline version of the cross-calculator sample. The commandline interface can be used non interactively through switches, or interactively when running the command without parameters. Compilation is fairly easy despite having the source split in different -directories. Thanks to the nimrod.cfg file, which adds the ../nimrod_backend +directories. Thanks to the nim.cfg file, which adds the ../nim_backend directory as a search path, you can compile and run the example just fine from -the command line with 'nimrod c -r nimcalculator.nim'. +the command line with 'nim c -r nimcalculator.nim'.