1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
; Licensed under the zlib/libpng license (same as NSIS)
!ifndef STDMACROS_INCLUDED
!define STDMACROS_INCLUDED
; Please use \ (backslash) in !include directives for compatibility
; between Windows and POSIX like systems
!define STDMACROS_UNFUNC "un."
; Redefine function macro (switch from include to call function mode)
!macro STDMACROS_FUNCREDEF PREFIX UN FUNCNAME
!ifndef `${UN}${PREFIX}${FUNCNAME}_INCLUDED`
!insertmacro ${PREFIX}${FUNCNAME} "${UN}"
!endif
!define /redef `${UN}${PREFIX}${FUNCNAME}` \
`!insertmacro ${PREFIX}${FUNCNAME}_Call "${UN}"`
!macroend
; Define function macro
!macro STDMACROS_FUNCDEF PREFIX FUNCNAME
!define `${PREFIX}${FUNCNAME}` \
`!insertmacro STDMACROS_FUNCREDEF ${PREFIX} "" ${FUNCNAME}`
!define `${STDMACROS_UNFUNC}${PREFIX}${FUNCNAME}` \
`!insertmacro STDMACROS_FUNCREDEF ${PREFIX} ${STDMACROS_UNFUNC} ${FUNCNAME}`
!macroend
; Provide function prolog for installer and uninstaller
!macro STDMACROS_FUNCPROLOG PREFIX UN FUNCNAME
!define `${UN}${PREFIX}${FUNCNAME}_INCLUDED`
Function `${UN}${PREFIX}${FUNCNAME}`
!macroend
; Include required function
!macro STDMACROS_FUNCINC PREFIX UN FUNCNAME
!ifndef `${UN}${PREFIX}${FUNCNAME}_INCLUDED`
!insertmacro ${PREFIX}${FUNCNAME} "${UN}"
!endif
!macroend
; Define identifier with value if it is not defined
; Issue an error if identifier is defined and original value differs
!macro STDMACROS_DefIfNotDef NAME VALUE
!ifdef ${NAME}
!if ${${NAME}} != ${VALUE}
!error "Wrong value for ${NAME} should be ${VALUE} instead of ${${NAME}}"
!endif
!else
!define ${NAME} ${VALUE}
!endif
!macroend
!define STDMACROS_DefIfNotDef `!insertmacro STDMACROS_DefIfNotDef`
; Translate register name into System plug-in register name
; Parameter:
; reg - register
; Return value:
; System plug-in register name
!macro STDMACROS_ToSystemReg reg sysreg
!searchreplace reg ${reg} "R" "1"
!searchreplace ${sysreg} ${reg} "$" "r"
!macroend
!endif ; STDMACROS_INCLUDED
|