OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkFlags.h" | 8 #include "SkFlags.h" |
9 | 9 |
10 SkFlagInfo* SkFlags::gHead; | 10 SkFlagInfo* SkFlags::gHead; |
(...skipping 20 matching lines...) Expand all Loading... |
31 bool helpPrinted = false; | 31 bool helpPrinted = false; |
32 // Loop over argv, starting with 1, since the first is just the name of the
program. | 32 // Loop over argv, starting with 1, since the first is just the name of the
program. |
33 for (int i = 1; i < argc; i++) { | 33 for (int i = 1; i < argc; i++) { |
34 if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--h", argv[i]) | 34 if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--h", argv[i]) |
35 || 0 == strcmp("-help", argv[i]) || 0 == strcmp("--help", argv[i
])) { | 35 || 0 == strcmp("-help", argv[i]) || 0 == strcmp("--help", argv[i
])) { |
36 // Print help message. | 36 // Print help message. |
37 SkDebugf("%s\n%s\n", argv[0], gUsage.c_str()); | 37 SkDebugf("%s\n%s\n", argv[0], gUsage.c_str()); |
38 SkDebugf("Flags:\n"); | 38 SkDebugf("Flags:\n"); |
39 SkFlagInfo* flag = SkFlags::gHead; | 39 SkFlagInfo* flag = SkFlags::gHead; |
40 while (flag != NULL) { | 40 while (flag != NULL) { |
41 SkDebugf("\t--%s:\ttype: %s", flag->name().c_str(), | 41 SkDebugf("\t--%s:\ttype: %s\tdefault: %s\n", flag->name().c_str(
), |
42 flag->typeAsString().c_str()); | 42 flag->typeAsString().c_str(), flag->defaultValue().c_s
tr()); |
43 if (flag->defaultValue().size() > 0) { | |
44 SkDebugf("\tdefault: %s", flag->defaultValue().c_str()); | |
45 } | |
46 SkDebugf("\n"); | |
47 const SkString& help = flag->help(); | 43 const SkString& help = flag->help(); |
48 size_t length = help.size(); | 44 size_t length = help.size(); |
49 const char* currLine = help.c_str(); | 45 const char* currLine = help.c_str(); |
50 const char* stop = currLine + length; | 46 const char* stop = currLine + length; |
51 while (currLine < stop) { | 47 while (currLine < stop) { |
52 if (strlen(currLine) < LINE_LENGTH) { | 48 if (strlen(currLine) < LINE_LENGTH) { |
53 // Only one line length's worth of text left. | 49 // Only one line length's worth of text left. |
54 SkDebugf("\t\t%s\n", currLine); | 50 SkDebugf("\t\t%s\n", currLine); |
55 break; | 51 break; |
56 } | 52 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 gHead = NULL; | 125 gHead = NULL; |
130 while (flag != NULL) { | 126 while (flag != NULL) { |
131 SkFlagInfo* next = flag->next(); | 127 SkFlagInfo* next = flag->next(); |
132 SkDELETE(flag); | 128 SkDELETE(flag); |
133 flag = next; | 129 flag = next; |
134 } | 130 } |
135 if (helpPrinted) { | 131 if (helpPrinted) { |
136 exit(0); | 132 exit(0); |
137 } | 133 } |
138 } | 134 } |
OLD | NEW |