Try to warn the user if they forgot to declare the function

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7257 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2021-01-27 02:27:53 +00:00
parent 47e9a6d5ba
commit 1cae67f562
2 changed files with 16 additions and 4 deletions

View file

@ -274,13 +274,13 @@ Standard predefines that contain information about the current code scope.
Defined in the global scope. Defined in the global scope.
\c Section test \c Section test
\c !ifdef ${__GLOBAL__} \c !ifdef __GLOBAL__
\c !error "this shouldn't be here!" \c !error "this shouldn't be here!"
\c !endif \c !endif
\c SectionEnd \c SectionEnd
\c \c
\c PageEx instfiles \c PageEx instfiles
\c !ifdef ${__GLOBAL__} \c !ifdef __GLOBAL__
\c !error "this shouldn't be here!" \c !error "this shouldn't be here!"
\c !endif \c !endif
\c PageExEnd \c PageExEnd

View file

@ -6,6 +6,15 @@ o-----------------------------------------------------------------------------o
| <cevo_deguix@yahoo.com.br> -------------------------------| | <cevo_deguix@yahoo.com.br> -------------------------------|
| | | |
| This header file contains NSIS functions for string manipulation. | | This header file contains NSIS functions for string manipulation. |
| ---------|
| !include "StrFunc.nsh" / Example |
| ${Using:StrFunc} StrRep -----------|
| |
| Section |
| ${StrRep} $0 "Hello world!" "world" "everyone" |
| MessageBox mb_ok $0 |
| SectionEnd |
| |
o-----------------------------------------------------------------------------o o-----------------------------------------------------------------------------o
*/ */
@ -86,12 +95,15 @@ o-----------------------------------------------------------------------------o
!define `${Name}` `!insertmacro STRFUNC_CALL_${Name} "${un}" ` !define `${Name}` `!insertmacro STRFUNC_CALL_${Name} "${un}" `
!define `Un${Name}` `!insertmacro STRFUNC_CALL_${Name} "${un}" ` !define `Un${Name}` `!insertmacro STRFUNC_CALL_${Name} "${un}" `
!else !else
!define `${Name}` `!insertmacro STRFUNC_MAKEFUNC ${Name} ""` !define `${Name}` `!insertmacro STRFUNC_MAKEFUNC ${Name} "" #`
!define `Un${Name}` `!insertmacro STRFUNC_MAKEFUNC ${Name} Un` !define `Un${Name}` `!insertmacro STRFUNC_MAKEFUNC ${Name} Un #`
!endif !endif
!macroend !macroend
!macro STRFUNC_MAKEFUNC basename un !macro STRFUNC_MAKEFUNC basename un
!ifndef __GLOBAL__
!error "You forgot ${U+24}{Using:StrFunc} ${un}${basename}"
!endif
!insertmacro STRFUNC_MAKEFUNC_${basename} !insertmacro STRFUNC_MAKEFUNC_${basename}
!macroend !macroend