Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: src/flags.h

Issue 10252: * Added d8 flag "--" (alias "--js-arguments"). (Closed)
Patch Set: Addressed reviews, added tests Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 #define V8_FLAGS_H_ 28 #define V8_FLAGS_H_
29 29
30 #include "checks.h" 30 #include "checks.h"
31 31
32 namespace v8 { namespace internal { 32 namespace v8 { namespace internal {
33 33
34 // Declare all of our flags. 34 // Declare all of our flags.
35 #define FLAG_MODE_DECLARE 35 #define FLAG_MODE_DECLARE
36 #include "flag-definitions.h" 36 #include "flag-definitions.h"
37 37
38
38 // The global list of all flags. 39 // The global list of all flags.
39 class FlagList { 40 class FlagList {
40 public: 41 public:
41 // The list of all flags with a value different from the default 42 // The list of all flags with a value different from the default
42 // and their values. The format of the list is like the format of the 43 // and their values. The format of the list is like the format of the
43 // argv array passed to the main function, e.g. 44 // argv array passed to the main function, e.g.
44 // ("--prof", "--log-file", "v8.prof", "--nolazy"). 45 // ("--prof", "--log-file", "v8.prof", "--nolazy").
45 // 46 //
46 // The caller is responsible for disposing the list. 47 // The caller is responsible for disposing the list.
47 static List<char *>* argv(); 48 static List<char *>* argv();
48 49
49 // Set the flag values by parsing the command line. If remove_flags is 50 // Set the flag values by parsing the command line. If remove_flags is
50 // set, the flags and associated values are removed from (argc, 51 // set, the flags and associated values are removed from (argc,
51 // argv). Returns 0 if no error occurred. Otherwise, returns the argv 52 // argv). Returns 0 if no error occurred. Otherwise, returns the argv
52 // index > 0 for the argument where an error occurred. In that case, 53 // index > 0 for the argument where an error occurred. In that case,
53 // (argc, argv) will remain unchanged indepdendent of the remove_flags 54 // (argc, argv) will remain unchanged independent of the remove_flags
54 // value, and no assumptions about flag settings should be made. 55 // value, and no assumptions about flag settings should be made.
55 // 56 //
56 // The following syntax for flags is accepted (both '-' and '--' are ok): 57 // The following syntax for flags is accepted (both '-' and '--' are ok):
57 // 58 //
58 // --flag (bool flags only) 59 // --flag (bool flags only)
59 // --noflag (bool flags only) 60 // --noflag (bool flags only)
60 // --flag=value (non-bool flags only, no spaces around '=') 61 // --flag=value (non-bool flags only, no spaces around '=')
61 // --flag value (non-bool flags only) 62 // --flag value (non-bool flags only)
63 // -- (equivalent to --js_arguments, captures all remaining args)
62 static int SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags); 64 static int SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags);
63 65
64 // Set the flag values by parsing the string str. Splits string into argc 66 // Set the flag values by parsing the string str. Splits string into argc
65 // substrings argv[], each of which consisting of non-white-space chars, 67 // substrings argv[], each of which consisting of non-white-space chars,
66 // and then calls SetFlagsFromCommandLine() and returns its result. 68 // and then calls SetFlagsFromCommandLine() and returns its result.
67 static int SetFlagsFromString(const char* str, int len); 69 static int SetFlagsFromString(const char* str, int len);
68 70
69 // Reset all flags to their default value. 71 // Reset all flags to their default value.
70 static void ResetAllFlags(); 72 static void ResetAllFlags();
71 73
72 // Print help to stdout with flags, types, and default values. 74 // Print help to stdout with flags, types, and default values.
73 static void PrintHelp(); 75 static void PrintHelp();
74 }; 76 };
75 77
76 } } // namespace v8::internal 78 } } // namespace v8::internal
77 79
78 #endif // V8_FLAGS_H_ 80 #endif // V8_FLAGS_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698