Commit e58c589
committed
show_help: static string improvements
Fix warnings from older C compilers that do not like literal strings
that are over 4095 characters line. Admittedly do this by hueristic:
make each line in a show_help INI help file be its own string (rather
than joining all the lines in a given [section] together). I.e.,
assume that each individual line is less than 4095 characters.
Also make a few other improvements:
* Remove an unused string in show_help.c
* Fixed a problem where leading spaces were trimmed from the help text
files in the resulting C strings.
* Fixed a problem where blank lines were snipped from the help text
files in the resulting C strings.
* Simplify the Python generation script by statically initialzing one
large struct named help_files (vs. initializing a struct per help
file, and then initializing a 2nd struct to map the filenames to all
the individual per-file structs).
* Also use C99-style name-specified initializers, making the
resulting code mode human-readable.
* Also add comments at the end of each INI section and filename to
make the resulting code more human readable.
* Use C99-style "{0}" to mark empty / end-of-array sentinel values.
* At run time, the individual lines of a given show_help section are
opal_argv_join()'ed together and emitted. The alloc'ed string is
cached (just in case it is used again -- which it likely won't be)
and freed during opal_finalize().
The resulting generated static initialization code looks like this:
```c
static file_entry help_files[] = {
{
.filename = "help-opal-wrapper.txt",
.entries = (ini_entry[]) {
{
.section = "no-language-support",
.content = (const char*[]) {
"Unfortunately, this installation of Open MPI was not compiled with",
"%s support. As such, the %s compiler is non-functional.",
NULL
},
}, // End of section no-language-support
{0}
}, // End of file help-opal-wrapper.txt
},
{0}
};
```
Signed-off-by: Jeff Squyres <jeff@squyres.com>1 parent 120b71b commit e58c589
File tree
3 files changed
+73
-32
lines changed- opal/util
3 files changed
+73
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | | - | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
82 | | - | |
| 88 | + | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
107 | 123 | | |
108 | 124 | | |
109 | | - | |
| 125 | + | |
110 | 126 | | |
111 | 127 | | |
112 | 128 | | |
| |||
115 | 131 | | |
116 | 132 | | |
117 | 133 | | |
118 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
119 | 138 | | |
120 | 139 | | |
121 | 140 | | |
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
125 | 144 | | |
126 | | - | |
127 | 145 | | |
128 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
129 | 160 | | |
130 | 161 | | |
131 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
182 | 190 | | |
183 | 191 | | |
184 | 192 | | |
0 commit comments