From 8ffe70423fba84f37da2aaadb87001a35a50ee54 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 14 Sep 2004 13:50:45 +0000 Subject: [PATCH] Add new 'common-scanner' class, which makes writing scanners for custom types are piece of cake. [SVN r25086] --- v2/build/scanner.jam | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/v2/build/scanner.jam b/v2/build/scanner.jam index b62c82a90..10af04c07 100644 --- a/v2/build/scanner.jam +++ b/v2/build/scanner.jam @@ -60,6 +60,31 @@ rule register ( scanner-class : relevant-properties * ) .relevant-properties.$(scanner-class) = $(relevant-properties) ; } +# Common scanner class, which can be used when there's only one +# kind of includes (unlike C, where "" and <> includes have different +# search paths). +class common-scanner : scanner +{ + import scanner ; + rule __init__ ( includes * ) + { + scanner.__init__ ; + self.includes = $(includes) ; + } + + rule process ( target : matches * : binding ) + { + local target_path = [ NORMALIZE_PATH $(binding:D) ] ; + + NOCARE $(matches) ; + INCLUDES $(target) : $(matches) ; + SEARCH on $(matches) = $(target_path) $(self.includes:G=) ; + + scanner.propagate $(__name__) : $(matches) : $(target) ; + } +} + + # Returns an instance of previously registered scanner, # with the specified properties. rule get ( scanner-class : properties * )