From fc9cad5978078243ea544d79edd83f28b2c50d47 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 4 Sep 2019 12:54:55 -0400 Subject: [PATCH] rename --- ExampleExtension/ExtensionImpl.cpp | 6 +++--- README.md | 21 +++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/ExampleExtension/ExtensionImpl.cpp b/ExampleExtension/ExtensionImpl.cpp index 8decc99..366045f 100644 --- a/ExampleExtension/ExtensionImpl.cpp +++ b/ExampleExtension/ExtensionImpl.cpp @@ -8,18 +8,18 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo); 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. + Param sentenceInfo: 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) +extern "C" __declspec(dllexport) wchar_t* OnNewSentence(wchar_t* sentence, const InfoForExtension* sentenceInfo) { try { std::wstring sentenceStr(sentence); int origLength = sentenceStr.size(); - if (ProcessSentence(sentenceStr, SentenceInfo{ miscInfo })) + if (ProcessSentence(sentenceStr, SentenceInfo{ sentenceInfo })) { if (sentenceStr.size() > origLength) sentence = (wchar_t*)HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sentence, (sentenceStr.size() + 1) * sizeof(wchar_t)); wcscpy_s(sentence, sentenceStr.size() + 1, sentenceStr.c_str()); diff --git a/README.md b/README.md index 658fb37..b8924ab 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,18 @@ # Example Extension -Every time Textractor has a sentence of text ready, -it will call ```OnNewSentence``` on all extensions it finds sequentially, -plugging the output of ```OnNewSentence``` from the previous extension into the next extension.
+Every time Textractor has a sentence of text ready, it will call `ProcessSentence` on all extensions it finds sequentially (via `OnNewSentence`) After the sentence has been processed by all extensions, it will be displayed. # SentenceInfo -## The following properties are in ```SentenceInfo``` -```"current select"```: always 0 unless the sentence is in the text thread selected by the user.
-```"process id"```: process id that the sentence is coming from. 0 for console and clipboard.
-```"text number"```: number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.
-```"text name"```: pointer to start of a wchar array of the name of the current text thread.
-```"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.
-```"this"```: context pointer used for aforementioned function. +## The following properties are in `SentenceInfo` +`"current select"`: always 0 unless the sentence is in the text thread selected by the user.
+`"process id"`: process id that the sentence is coming from. 0 for console and clipboard.
+`"text number"`: number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.
+`"text name"`: pointer to start of a wchar array of the name of the current text thread.
+`"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.
+`"this"`: context pointer used for aforementioned function. # Notes -You just need Visual Studio with basic C++ support to compile this project.
-Compile targeting x86 for Textractor and x64 for Textractor64. +You just need Visual Studio with basic C++ support to compile this project.