diff --git a/Contrib/System/System.html b/Contrib/System/System.html index 01080c8c..5daeb37b 100644 --- a/Contrib/System/System.html +++ b/Contrib/System/System.html @@ -69,13 +69,13 @@ System::Free $0
# allocate a buffer and put 'test string' and an int in it -System::Call "*(&t1024 'test string', i 5) i .s" +System::Call "*(&t1024 'test string', i 5) i .s" Pop $0 # copy to an automatically created buffer System::Copy 0 $0 Pop $1 # get string and int in $1 buffer -System::Call "*$1(&t1024 .r2, i .r3)" +System::Call "*$1(&t1024 .r2, i .r3)" # free buffer System::Free $1 # print result @@ -86,7 +86,7 @@ System::Alloc 1028 Pop $1 System::Copy $1 $0 # get string and int in $1 buffer -System::Call "*$1(&t1024 .r2, i .r3)" +System::Call "*$1(&t1024 .r2, i .r3)" # free System::Free $0 System::Free $1 @@ -351,25 +351,27 @@ DetailPrint $4Callback functions are simply functions which are passed to a function and called back by it. They are frequently used to pass a possibly large set of data item by item. For example, EnumChildWindows uses a callback function. As NSIS functions are not quite regular functions, the System plug-in provides its own mechanism to support callback functions. It allows you to create callback functions and notifies you each time a callback function was called.
-Creation of callback functions is done using Get and the callback creation syntax. As you will not call the callbacks yourself, the source of the parameters should be omitted using a dot. When the callback is called, the destination of the parameters will be filled with the values passed on to the callback. The value the callback will return is set by the source of the return "parameter". The destination of the return "parameter" should always be set as that's where System will notify you the callback was called. -
- +System::Get "(i .r0, i .r1) iss"Creation of callback functions is done using Get and the callback creation syntax. As you will not call the callbacks yourself, the source of the parameters should be omitted using a dot. When the callback is called, the destination of the parameters will be filled with the values passed on to the callback. The value the callback will return is set by the source of the return "parameter". The destination of the return "parameter" should always be set as that's where System will notify you the callback was called.
+ ++ +System::Get "(i .r0, i .r1) iss"To pass a callback to a function, use the k type.
-To pass a callback to a function, use the k type.
- -System::Get "(i .r0, i .r1) isR0" Pop $0 System::Call "dll::UseCallback(k r0)"Each time the callback is called, the string callback#, where # is the number of the callback, will be placed in the destination of the return "parameter". The number of the first callback created is 1, the second's is 2, the third's is 3 and so on. As System is single threaded, a callback can only be called while calling another function. For example, EnumChildWindows's callback can only be called when EnumChildWindows is being called. You should therefore check for callback# after each function call that might call your callback. +
Each time the callback is called, the string callback#, where # is the number of the callback, will be placed in the destination of the return "parameter". The number of the first callback created is 1, the second's is 2, the third's is 3 and so on. As System is single threaded, a callback can only be called while calling another function. For example, EnumChildWindows's callback can only be called when EnumChildWindows is being called. You should therefore check for callback# after each function call that might call your callback.
++System::Call "(i .r0, i .r1) isR0" Pop $0 System::Call "dll::UseCallback(k r0)" StrCmp $R0 "callback1" 0 +2 DetailPrint "UseCallback passed ($0, $1) to the callback" -
After you've processed the callback call, you should use Call, passing it the value returned by Get - the callback. This tells System to return from the callback. If you've specified a source for the return "parameter" when the callback was created, you should fill that source with the appropriate return value.
+System::Call "(i .r0, i .r1) isR0" Pop $0 System::Call "dll::UseCallback(k r0)" @@ -384,8 +386,6 @@ done:A complete working example is available in the usage examples section.
- -