b4n commented on this pull request.
> +
+# extract variable names (then sort the result, conver to lowercase and
replace new lines by spaces)
+variables=$(\
+ sed --silent --regexp-extended\
+ --expression 's/^[
]*m_ShellConstants.add\(_T\("(.*)"\),.*,.*\);.*$/\1/p' \
+ --expression 's/^[ ]*m_UserVarNames.add\(_T\("(.*)"\),.*\);.*$/\1/p'
"${BUILD_CPP_FILE}" | \
+ sort | \
+ tr '[:upper:]' '[:lower:]' | \
+ tr '\n' ' ')
+
+# hardcode a few more, as found in the documentation ("4.2.2 Other Writable
Variables")
+variables_extra='{nsisdir} 0 1 2 3 4 5 6 7 8 9 r0 r1 r2 r3 r4 r5 r6 r7 r8 r9
\\n \\r \\t $'
+variables="${variables_extra} ${variables}"
+# remove leading and trailing whitespaces
+variables="$(echo "$variables" | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')"
+functions="$(echo "$functions" | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')"
what about moving that in the initial generation next to the other ones? also
it looks like a little bit of duplication, so what about adding a small
function like this:
```shell
normalize() {
sort | tr '[:upper:]' '[:lower:]' | tr '\n' ' ' | sed
's/^[[:blank:]]*//;s/[[:blank:]]*$//'
}
functions=$(
sed --silent --regexp-extended 's/^\{TOK_.*,_T\("(.*)"\),[0-9]+,.*$/\1/p'
"${TOKENS_CPP_FILE}" | \
normalize
)
variables=$(
sed --silent --regexp-extended \
--expression 's/^[
]*m_ShellConstants.add\(_T\("(.*)"\),.*,.*\);.*$/\1/p' \
--expression 's/^[ ]*m_UserVarNames.add\(_T\("(.*)"\),.*\);.*$/\1/p'
"${BUILD_CPP_FILE}" | \
normalize
)
# […]
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2181#pullrequestreview-253091152