[m-rev.] for review: all --search-all option

Peter Wang wangp at students.csse.unimelb.edu.au
Tue Sep 19 18:18:23 AEST 2006


As proposed on mercury-users.  Suggestions for the option name?

It doesn't add --runtime-library-directory as I'm not sure that's a good
idea.


Estimated hours taken: 1
Branches: main

compiler/options.m:
doc/user_guide.texi:
	Add `--search-all <directory>' option which is
        equivalent to adding <directory> using all of the
        `--search-directory', `--library-directory',
        `--init-file-directory' and `--c-include-directory' options.

Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.525
diff -u -r1.525 options.m
--- compiler/options.m	4 Sep 2006 01:47:33 -0000	1.525
+++ compiler/options.m	11 Sep 2006 03:46:24 -0000
@@ -60,6 +60,13 @@
 :- func option_table_add_mercury_library_directory(option_table, string)
     = option_table.
 
+    % Equivalent to adding a directory using all of the
+    % `--search-directory', `--library-directory',
+    % `--init-file-directory' and `--c-include-directory' options.
+    %
+:- func option_table_add_search_all_directory(option_table,
+    string) = option_table.
+
     % Quote an argument to a shell command.
     %
 :- func quote_arg(string) = string.
@@ -676,6 +683,7 @@
     ;       link_objects
     ;       mercury_library_directories
     ;       mercury_library_directory_special
+    ;       search_all_special
     ;       mercury_libraries
     ;       mercury_library_special
     ;       mercury_standard_library_directory
@@ -1398,6 +1406,7 @@
     link_libraries                      -   accumulating([]),
     link_objects                        -   accumulating([]),
     mercury_library_directory_special   -   string_special,
+    search_all_special                  -   string_special,
     mercury_library_directories         -   accumulating([]),
     mercury_library_special             -   string_special,
     mercury_libraries                   -   accumulating([]),
@@ -2159,6 +2168,7 @@
 long_option("ml",                   mercury_library_special).
 long_option("mercury-library-directory", mercury_library_directory_special).
 long_option("mld",                  mercury_library_directory_special).
+long_option("search-all",           search_all_special).
 long_option("mercury-standard-library-directory",
                 mercury_standard_library_directory_special).
 long_option("mercury-stdlib-dir",
@@ -2386,6 +2396,10 @@
         OptionTable0, ok(OptionTable)) :-
     OptionTable = option_table_add_mercury_library_directory(
         OptionTable0, Dir).
+special_handler(search_all_special, string(Dir),
+        OptionTable0, ok(OptionTable)) :-
+    OptionTable = option_table_add_search_all_directory(
+        OptionTable0, Dir).
 special_handler(mercury_library_special, string(Lib),
         OptionTable0, ok(OptionTable)) :-
     OptionTable =
@@ -2456,6 +2470,14 @@
         mercury_library_directories - Dir
     ], OptionTable0).
 
+option_table_add_search_all_directory(OptionTable0, Dir) =
+    list__foldl(append_to_accumulating_option, [
+        search_directories          - Dir,
+        c_include_directory         - Dir,
+        init_file_directories       - Dir,
+        link_library_directories    - Dir
+    ], OptionTable0).
+
 :- func append_to_accumulating_option(pair(option, string),
         option_table) = option_table.
 
@@ -4424,6 +4446,10 @@
         "\tLink with the specified library.",
         "--link-object <object-file>",
         "\tLink with the specified object file.",
+        "--search-all <directory>",
+        "\tEquivalent to adding <directory> using all of the",
+        "\t`--search-directory', `--library-directory',",
+        "\t`--init-file-directory' and `--c-include-directory' options.",
         "--mld <directory>, --mercury-library-directory <directory>",
         "\tAppend <directory> to the list of directories to",
         "\tbe searched for Mercury libraries. This will add",
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.489
diff -u -r1.489 user_guide.texi
--- doc/user_guide.texi	4 Sep 2006 01:47:34 -0000	1.489
+++ doc/user_guide.texi	19 Sep 2006 04:19:00 -0000
@@ -7995,6 +7995,15 @@
 Link with the specified object file.
 
 @sp 1
+ at item --search-all @var{directory}
+ at findex --search-all
+ at cindex Directories for libraries
+ at cindex Search path for libraries
+Equivalent to adding @var{directory} using all of the
+ at samp{--search-directory}, @samp{--library-directory},
+ at samp{--init-file-directory} and @samp{--c-include-directory} options.
+
+ at sp 1
 @item --mld @var{directory}
 @itemx --mercury-library-directory @var{directory}
 @findex --mld

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list