From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QJ3iX-0000uq-T8 for garchives@archives.gentoo.org; Sun, 08 May 2011 13:08:14 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 05E681C03F; Sun, 8 May 2011 13:07:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C66E11C03F for ; Sun, 8 May 2011 13:07:15 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 49EA31B4062 for ; Sun, 8 May 2011 13:07:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 5C13845C56 for ; Sun, 8 May 2011 13:07:14 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: Subject: [gentoo-commits] proj/libbash:master commit in: / X-VCS-Repository: proj/libbash X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: d99d179bbe397cf69bca41b0dd3962b1676676f9 Date: Sun, 8 May 2011 13:07:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 473450e25a8aa6e24f15d0a38fc0bc5e commit: d99d179bbe397cf69bca41b0dd3962b1676676f9 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Sun May 8 13:04:54 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun May 8 13:04:54 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dd99d179b Merge remote-tracking branch 'mu/variable_setup' Conflicts: src/builtins/source_builtin.cpp .gitignore | 2 + Makefile.am | 15 ++- configure.ac | 2 + src/builtins/source_builtin.cpp | 19 ++- src/core/symbols.hpp | 2 +- src/core/tests/symbols_test.cpp | 2 + src/libbash.cpp | 5 + src/libbash.h | 3 +- utils/command_line.cpp | 88 +++++++++ utils/command_line.h | 62 ++++++ utils/instruo.cpp | 251 ++++++++++++++++++= ++++++ utils/{metadata_generator.cpp =3D> metadata.cpp} | 35 +--- src/common.h =3D> utils/metadata.h | 20 +- utils/metadata_generator.cpp | 84 +-------- 14 files changed, 465 insertions(+), 125 deletions(-) diff --cc src/builtins/source_builtin.cpp index 1e82c77,6ba6b11..277eb94 --- a/src/builtins/source_builtin.cpp +++ b/src/builtins/source_builtin.cpp @@@ -26,8 -26,8 +26,9 @@@ =20 #include #include + #include =20 +#include "builtins/builtin_exceptions.h" #include "cppbash_builtin.h" #include "core/interpreter.h" #include "core/interpreter_exception.h" @@@ -40,16 -42,17 +43,22 @@@ int source_builtin::exec(const std::vec =20 // we need fix this to pass extra arguments as positional parameters const std::string& path =3D bash_args[0]; - std::ifstream input(path); - if(!input) - throw interpreter_exception(path + " can't be read"); =20 - bash_ast ast(input); + auto& stored_ast =3D ast_cache[path]; + if(!stored_ast) + { + std::ifstream input(path); + if(!input) + throw interpreter_exception(path + " can't be read"); +=20 + stored_ast.reset(new bash_ast(input)); + } - stored_ast->interpret_with(_walker); ++ =20 + try + { - ast.interpret_with(_walker); ++ stored_ast->interpret_with(_walker); + } + catch(return_exception& e) {} =20 return _walker.get_status(); }