From d1c49caa68e9747a3d303b205e3a41da8c4bda29 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 29 Jul 2011 20:10:55 +0900 Subject: c2nim,pas2nim: bugfix: --out:FILE option does not work as documented --- compiler/c2nim/c2nim.nim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'compiler/c2nim') diff --git a/compiler/c2nim/c2nim.nim b/compiler/c2nim/c2nim.nim index beb4465fc..0e39f5976 100755 --- a/compiler/c2nim/c2nim.nim +++ b/compiler/c2nim/c2nim.nim @@ -7,7 +7,7 @@ # distribution, for details about the copyright. # -import +import strutils, os, times, parseopt, llstream, ast, renderer, options, msgs, clex, cparse @@ -17,16 +17,16 @@ const c2nim - C to Nimrod source converter (c) 2011 Andreas Rumpf Usage: c2nim [options] inputfile [options] -Options: +Options: -o, --out:FILE set output filename --dynlib:SYMBOL import from dynlib: SYMBOL will be used for the import --header:HEADER_FILE import from a HEADER_FILE (discouraged!) - --cdecl annotate procs with ``{.cdecl.}`` + --cdecl annotate procs with ``{.cdecl.}`` --stdcall annotate procs with ``{.stdcall.}`` --ref convert typ* to ref typ (default: ptr typ) - --prefix:PREFIX strip prefix for the generated Nimrod identifiers + --prefix:PREFIX strip prefix for the generated Nimrod identifiers (multiple --prefix options are supported) - --suffix:SUFFIX strip suffix for the generated Nimrod identifiers + --suffix:SUFFIX strip suffix for the generated Nimrod identifiers (multiple --suffix options are supported) --skipinclude do not convert ``#include`` to ``import`` --typeprefixes generate ``T`` and ``P`` type prefixes @@ -35,7 +35,7 @@ Options: -h, --help show this help """ -proc main(infile, outfile: string, options: PParserOptions) = +proc main(infile, outfile: string, options: PParserOptions) = var start = getTime() var stream = LLStreamOpen(infile, fmRead) if stream == nil: rawMessage(errCannotOpenFile, infile) @@ -61,7 +61,7 @@ for kind, key, val in getopt(): of "version", "v": stdout.write(Version & "\n") quit(0) - of "o", "out": outfile = key + of "o", "out": outfile = val else: if not parserOptions.setOption(key, val): stdout.write("[Error] unknown option: " & key) -- cgit 1.4.1-2-gfad0 From 19f6750b92f6acd2d4bbfd2046a87f2976c631f8 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 29 Jul 2011 20:21:29 +0900 Subject: c2nim,pas2nim: use the stdout.writeln to display the "unknown option" message --- compiler/c2nim/c2nim.nim | 2 +- compiler/pas2nim/pas2nim.nim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/c2nim') diff --git a/compiler/c2nim/c2nim.nim b/compiler/c2nim/c2nim.nim index 0e39f5976..6d7a0d6c1 100755 --- a/compiler/c2nim/c2nim.nim +++ b/compiler/c2nim/c2nim.nim @@ -64,7 +64,7 @@ for kind, key, val in getopt(): of "o", "out": outfile = val else: if not parserOptions.setOption(key, val): - stdout.write("[Error] unknown option: " & key) + stdout.writeln("[Error] unknown option: " & key) of cmdEnd: assert(false) if infile.len == 0: # no filename has been given, so we show the help: diff --git a/compiler/pas2nim/pas2nim.nim b/compiler/pas2nim/pas2nim.nim index 11aa53f20..4102c33cd 100755 --- a/compiler/pas2nim/pas2nim.nim +++ b/compiler/pas2nim/pas2nim.nim @@ -52,7 +52,7 @@ for kind, key, val in getopt(): of "o", "out": outfile = val of "ref": incl(flags, pfRefs) of "boot": flags = flags + {pfRefs, pfMoreReplacements, pfImportBlackList} - else: stdout.write("[Error] unknown option: " & key) + else: stdout.writeln("[Error] unknown option: " & key) of cmdEnd: assert(false) if infile.len == 0: # no filename has been given, so we show the help: -- cgit 1.4.1-2-gfad0