From 1b6abccba2c220ba153e29b8a6ae4ad3038a00c3 Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Tue, 29 Jul 2014 21:13:21 -0400 Subject: Fix #813 Also add a notice that the linked list stuff in the compiler should be (one day) removed. --- compiler/commands.nim | 12 +++++++++--- compiler/lists.nim | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'compiler') diff --git a/compiler/commands.nim b/compiler/commands.nim index 38c8dd294..6edbbd61a 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -290,9 +290,15 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = options.gNoBabelPath = true of "excludepath": expectArg(switch, arg, pass, info) - let path = processPath(arg) - lists.excludeStr(options.searchPaths, path) - lists.excludeStr(options.lazyPaths, path) + let + path = processPath(arg) + strippedPath = removeTrailingDirSep(path) + echo repr(options.searchPaths) + lists.excludePath(options.searchPaths, path) + lists.excludePath(options.lazyPaths, path) + lists.excludePath(options.searchPaths, strippedPath) + lists.excludePath(options.lazyPaths, strippedPath) + echo repr(options.searchPaths) of "nimcache": expectArg(switch, arg, pass, info) options.nimcacheDir = processPath(arg) diff --git a/compiler/lists.nim b/compiler/lists.nim index dd4f5d6be..efffe60fe 100644 --- a/compiler/lists.nim +++ b/compiler/lists.nim @@ -8,7 +8,8 @@ # # This module implements a generic doubled linked list. - +# TODO Remove this and replace it with something sensible +import os type PListEntry* = ref TListEntry TListEntry* = object of TObject @@ -103,11 +104,12 @@ proc bringToFront*(list: var TLinkedList, entry: PListEntry) = entry.next = list.head list.head = entry -proc excludeStr*(list: var TLinkedList, data: string) = +proc excludePath*(list: var TLinkedList, data: string) = var it = list.head while it != nil: let nxt = it.next - if PStrEntry(it).data == data: remove(list, it) + if cmpPaths(PStrEntry(it).data, data) == 0: + remove(list, it) it = nxt proc find*(list: TLinkedList, fn: TCompareProc, closure: pointer): PListEntry = -- cgit 1.4.1-2-gfad0 From 6a09fc358e5e799fdf5c0f79774d475d2fb02e6f Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Tue, 29 Jul 2014 21:23:18 -0400 Subject: Clean up a bit. --- compiler/commands.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler') diff --git a/compiler/commands.nim b/compiler/commands.nim index 6edbbd61a..ee2f2a7f7 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -290,14 +290,14 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = options.gNoBabelPath = true of "excludepath": expectArg(switch, arg, pass, info) - let - path = processPath(arg) - strippedPath = removeTrailingDirSep(path) + let path = processPath(arg) echo repr(options.searchPaths) lists.excludePath(options.searchPaths, path) lists.excludePath(options.lazyPaths, path) - lists.excludePath(options.searchPaths, strippedPath) - lists.excludePath(options.lazyPaths, strippedPath) + if (len(path) > 0) and (path[len(path) - 1] == DirSep):: + let strippedPath = removeTrailingDirSep(path) + lists.excludePath(options.searchPaths, strippedPath) + lists.excludePath(options.lazyPaths, strippedPath) echo repr(options.searchPaths) of "nimcache": expectArg(switch, arg, pass, info) -- cgit 1.4.1-2-gfad0 From 9b4b4bcbc5b6464da31b75ab6bf529066bf8315d Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Tue, 29 Jul 2014 21:31:46 -0400 Subject: Clean up more --- compiler/commands.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler') diff --git a/compiler/commands.nim b/compiler/commands.nim index ee2f2a7f7..4fec420f7 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -294,8 +294,8 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = echo repr(options.searchPaths) lists.excludePath(options.searchPaths, path) lists.excludePath(options.lazyPaths, path) - if (len(path) > 0) and (path[len(path) - 1] == DirSep):: - let strippedPath = removeTrailingDirSep(path) + if (len(path) > 0) and (path[len(path) - 1] == DirSep): + let strippedPath = path[0 .. (len(path) - 2)] lists.excludePath(options.searchPaths, strippedPath) lists.excludePath(options.lazyPaths, strippedPath) echo repr(options.searchPaths) -- cgit 1.4.1-2-gfad0 From 23f64dd63d6c8f178f5fca1ec6e7706844808359 Mon Sep 17 00:00:00 2001 From: Varriount Date: Sat, 2 Aug 2014 00:16:10 -0400 Subject: Update commands.nim --- compiler/commands.nim | 2 -- 1 file changed, 2 deletions(-) (limited to 'compiler') diff --git a/compiler/commands.nim b/compiler/commands.nim index 4fec420f7..7219c168a 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -291,14 +291,12 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = of "excludepath": expectArg(switch, arg, pass, info) let path = processPath(arg) - echo repr(options.searchPaths) lists.excludePath(options.searchPaths, path) lists.excludePath(options.lazyPaths, path) if (len(path) > 0) and (path[len(path) - 1] == DirSep): let strippedPath = path[0 .. (len(path) - 2)] lists.excludePath(options.searchPaths, strippedPath) lists.excludePath(options.lazyPaths, strippedPath) - echo repr(options.searchPaths) of "nimcache": expectArg(switch, arg, pass, info) options.nimcacheDir = processPath(arg) -- cgit 1.4.1-2-gfad0