update documentation

This commit is contained in:
Akash Mozumdar 2019-06-29 15:28:12 +05:30
parent 1afad7165c
commit 52db7e6b48
3 changed files with 21 additions and 16 deletions

View File

@ -17,19 +17,21 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
//#define COPY_CLIPBOARD
//#define EXTRA_NEWLINES
/**
* Param sentence: sentence received by Textractor (UTF-16).
* Param sentenceInfo: contains miscellaneous info about the sentence (see README).
* Return value: whether the sentence was modified.
* Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
* THIS FUNCTION MAY BE RUN SEVERAL TIMES CONCURRENTLY: PLEASE ENSURE THAT IT IS THREAD SAFE!
/*
Param sentence: sentence received by Textractor (UTF-16). Can be modified, Textractor will receive this modification only if true is returned.
Param sentenceInfo: contains miscellaneous info about the sentence (see README).
Return value: whether the sentence was modified.
Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
The sentence will be destroyed if it is empty or if you call Skip().
This function may be run concurrently with itself: please make sure it's thread safe.
It will not be run concurrently with DllMain.
*/
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
// Your code here...
#ifdef COPY_CLIPBOARD
// This example extension automatically copies sentences from the hook currently selected by the user into the clipboard.
if (sentenceInfo["current select"] == 1)
if (sentenceInfo["current select"])
{
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (sentence.size() + 2) * sizeof(wchar_t));
memcpy(GlobalLock(hMem), sentence.c_str(), (sentence.size() + 2) * sizeof(wchar_t));

View File

@ -2,15 +2,16 @@
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo);
/**
* You shouldn't mess with this or even look at it unless you're certain you know what you're doing.
* Param sentence: pointer to sentence received by Textractor (UTF-16).
* This can be modified. Textractor uses the modified sentence for future processing and display. If empty (starts with null terminator), Textractor will destroy it.
* Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
* The buffer is allocated using HeapAlloc(). If you want to make it larger, please use HeapReAlloc().
* Param miscInfo: pointer to array containing misc info about the sentence. End of array is marked with name being nullptr.
* Return value: the buffer used for the sentence. Remember to return a new pointer if HeapReAlloc() gave you one.
* THIS FUNCTION MAY BE RUN SEVERAL TIMES CONCURRENTLY: PLEASE ENSURE THAT IT IS THREAD SAFE!
/*
You shouldn't mess with this or even look at it unless you're certain you know what you're doing.
Param sentence: pointer to sentence received by Textractor (UTF-16).
This can be modified. Textractor uses the modified sentence for future processing and display. If empty (starts with null terminator), Textractor will destroy it.
Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
The buffer is allocated using HeapAlloc(). If you want to make it larger, please use HeapReAlloc().
Param miscInfo: pointer to array containing misc info about the sentence. End of array is marked with name being nullptr.
Return value: the buffer used for the sentence. Remember to return a new pointer if HeapReAlloc() gave you one.
This function may be run concurrently with itself: please make sure it's thread safe.
It will not be run concurrently with DllMain.
*/
extern "C" __declspec(dllexport) wchar_t* OnNewSentence(wchar_t* sentence, const InfoForExtension* miscInfo)
{

View File

@ -12,6 +12,8 @@ After the sentence has been processed by all extensions, it will be displayed.
```"process id"```: process id that the sentence is coming from. 0 for console and clipboard.<br>
```"text number"```: number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.<br>
```"text name"```: pointer to start of a wchar array of the name of the current text thread.<br>
```"void (*AddSentence)(void* this, int64_t number, const wchar_t* sentence)"```: pointer to function that adds a sentence to the text thread with the specified number.<br>
```"this"```: context pointer used for aforementioned function.
# Notes