├── .gitattributes ├── source ├── lib_pcre │ ├── pcre │ │ ├── ChangeLog │ │ ├── COPYING │ │ ├── AUTHORS │ │ ├── pcre16_get.c │ │ ├── pcre16_ucd.c │ │ ├── pcre16_exec.c │ │ ├── pcre16_config.c │ │ ├── pcre16_study.c │ │ ├── pcre16_tables.c │ │ ├── pcre16_xclass.c │ │ ├── pcre16_compile.c │ │ ├── pcre16_fullinfo.c │ │ ├── pcre16_globals.c │ │ ├── pcre16_newline.c │ │ ├── pcre16_refcount.c │ │ ├── pcre16_version.c │ │ ├── pcre16_chartables.c │ │ ├── pcre16_jit_compile.c │ │ ├── pcre16_string_utils.c │ │ ├── LICENCE │ │ ├── pcret.h │ │ ├── pcre_ord2utf8.c │ │ ├── pcre16_ord2utf16.c │ │ ├── pcre_refcount.c │ │ ├── pcre_globals.c │ │ ├── sljit │ │ │ └── sljitConfig.h │ │ ├── ucp.h │ │ ├── pcre_version.c │ │ ├── pcre_config.c │ │ ├── pcre16_valid_utf16.c │ │ ├── pcre_string_utils.c │ │ └── pcre_maketables.c │ └── lib_pcre.vcxproj.filters ├── resources │ ├── icon_main.ico │ ├── icon_pause.ico │ ├── icon_filetype.ico │ ├── icon_suspend.ico │ ├── icon_pause_suspend.ico │ ├── icon_filetype_small.ico │ ├── icons-export.ahk │ ├── resource.h │ ├── AutoHotkey.exe.manifest │ └── icons.svg ├── pch.cpp ├── ahkversion.cpp ├── libx64call │ ├── HowToCompile.txt │ ├── x64stub.asm │ └── x64call.asm ├── pch_min.cpp ├── ahkversion.h ├── scripts │ └── minman.js ├── cpp.hint ├── config.h ├── MdFunc.h ├── debug.h ├── x86call.asm ├── script_module.h ├── input_object.h ├── ahklib.idl ├── abi.h ├── StrRet.h ├── os_version.h ├── clipboard.h ├── stdafx.h ├── StringConv.cpp ├── SimpleHeap.h ├── DispObject.h ├── script_func_impl.h ├── WinGroup.h ├── application.h ├── lib │ └── Gui.StatusBar.cpp ├── StringConv.h └── script_com.h ├── .gitignore ├── vsc-build-env.cmd ├── .vscode ├── launch.json └── tasks.json ├── README.md ├── AutoHotkeyx.sln ├── Config.vcxproj └── debug.natvis /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/lib_pcre/pcre/ChangeLog -------------------------------------------------------------------------------- /source/resources/icon_main.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/resources/icon_main.ico -------------------------------------------------------------------------------- /source/resources/icon_pause.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/resources/icon_pause.ico -------------------------------------------------------------------------------- /source/resources/icon_filetype.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/resources/icon_filetype.ico -------------------------------------------------------------------------------- /source/resources/icon_suspend.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/resources/icon_suspend.ico -------------------------------------------------------------------------------- /source/resources/icon_pause_suspend.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/resources/icon_pause_suspend.ico -------------------------------------------------------------------------------- /source/resources/icon_filetype_small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sulhan12/AutoHotkey/HEAD/source/resources/icon_filetype_small.ico -------------------------------------------------------------------------------- /source/lib_pcre/pcre/COPYING: -------------------------------------------------------------------------------- 1 | PCRE LICENCE 2 | 3 | Please see the file LICENCE in the PCRE distribution for licensing details. 4 | 5 | End 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | temp/ 2 | bin*/ 3 | ipch/ 4 | .vs/ 5 | source/autogenerated/ 6 | source/resources/png/ 7 | *.suo 8 | *.user 9 | *.ncb 10 | *.aps 11 | *.sdf 12 | *.opensdf 13 | -------------------------------------------------------------------------------- /source/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp : source file for generating the default precompiled header. 2 | 3 | #include "stdafx.h" 4 | 5 | // reference any additional headers you need in STDAFX.H 6 | // and not in this file 7 | -------------------------------------------------------------------------------- /source/ahkversion.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "ahkversion.h" 4 | 5 | LPSTR AHK_VERSION = RAW_AHK_VERSION; 6 | LPTSTR T_AHK_VERSION = _T(RAW_AHK_VERSION); 7 | LPTSTR T_AHK_NAME_VERSION = T_AHK_NAME _T(" v") _T(RAW_AHK_VERSION); 8 | -------------------------------------------------------------------------------- /source/libx64call/HowToCompile.txt: -------------------------------------------------------------------------------- 1 | x64call.asm was adapted from http://dyncall.org/ 2 | 3 | - Open a Windows 7.1 SDK command prompt 4 | - setenv /Release /x64 5 | - Navigate to this folder 6 | - ml64 /c x64call.asm x64stub.asm 7 | - lib /out:x64call.lib x64call.obj x64stub.obj 8 | -------------------------------------------------------------------------------- /source/pch_min.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp : source file for generating the MinSize.pch precompiled header. 2 | // See the ApplyMinSizePCH target in AutoHotkey.vcxproj for details. 3 | 4 | #include "stdafx.h" 5 | 6 | // reference any additional headers you need in STDAFX.H 7 | // and not in this file 8 | -------------------------------------------------------------------------------- /source/ahkversion.h: -------------------------------------------------------------------------------- 1 | 2 | #define AHK_NAME "AutoHotkey" 3 | #define T_AHK_NAME _T(AHK_NAME) 4 | 5 | #ifndef RAW_AHK_VERSION 6 | // Fallback version string for when `git describe` fails during build. 7 | #define RAW_AHK_VERSION "2.0" 8 | #endif 9 | #ifdef RC_INVOKED 10 | #define AHK_VERSION RAW_AHK_VERSION 11 | #ifndef AHK_VERSION_N 12 | #define AHK_VERSION_N 2,0,0,0 13 | #endif 14 | #else 15 | // Use global variables rather than macros so only ahkversion.cpp needs to be recompiled 16 | // whenever GITDESC changes. 17 | extern LPSTR AHK_VERSION; 18 | extern LPTSTR T_AHK_VERSION; 19 | extern LPTSTR T_AHK_NAME_VERSION; 20 | #endif 21 | -------------------------------------------------------------------------------- /source/scripts/minman.js: -------------------------------------------------------------------------------- 1 | // This script minimizes the size of AutoHotkey.exe.manifest. 2 | // Using JS because it doesn't depend on AutoHotkey having already been compiled... 3 | 4 | try 5 | { 6 | var args = WScript.Arguments; 7 | if (args.length < 2) 8 | throw new Error("Too few arguments!"); 9 | var source = args(0); 10 | var dest = args(1); 11 | 12 | var fs = new ActiveXObject("Scripting.FileSystemObject"); 13 | 14 | var xml = fs.OpenTextFile(source).ReadAll(); 15 | 16 | xml = xml 17 | .replace(//g, "") // Remove comments 18 | .replace(/>\s*<") // Remove space between elements 19 | .replace(/\r?\n\s*/g, " ") // Replace line breaks+indent with one space 20 | .replace(/<\?xml.*?\?>/, "") // The VS manifest tool seems to strip this out, so we will too 21 | 22 | fs.CreateTextFile(dest, true).Write(xml); 23 | 24 | //WScript.Echo("Finished processing manifest '"+dest+"'"); 25 | } 26 | catch (ex) 27 | { 28 | WScript.Echo("Error in minman.js: " + ex.message); 29 | WScript.Quit(1); 30 | } -------------------------------------------------------------------------------- /source/cpp.hint: -------------------------------------------------------------------------------- 1 | #define BIF_DECL(name) void name(ResultType &aResult, ExprTokenType &aResultToken, ExprTokenType *aParam[], int aParamCount) 2 | #define BIF_DECL_GUICTRL(name) void name(ResultType &aResult, ExprTokenType &aResultToken, ExprTokenType *aParam[], int aParamCount, GuiControlType& control) 3 | #define IObject_Type_Impl(name) LPTSTR Type() { return _T(name); } 4 | #define _T(x) (x) 5 | #define Exp32or64(a, b) (b) 6 | #define bif_impl 7 | 8 | #define WINTITLE_PARAMETERS_DECL ExprTokenType *aWinTitle, optl aWinText, optl aExcludeTitle, optl aExcludeText 9 | #define WINTITLE_PARAMETERS aWinTitle, aWinText, aExcludeTitle, aExcludeText 10 | #define CONTROL_PARAMETERS_DECL ExprTokenType &aControlSpec, WINTITLE_PARAMETERS_DECL 11 | #define CONTROL_PARAMETERS_DECL_OPT ExprTokenType *aControlSpec, WINTITLE_PARAMETERS_DECL 12 | #define CONTROL_PARAMETERS aControlSpec, WINTITLE_PARAMETERS 13 | 14 | #define DEBUGGER_COMMAND(cmd) int cmd(char **aArgV, int aArgCount, char *aTransactionId) 15 | #define BOOL_OPTION(OPT) -------------------------------------------------------------------------------- /source/libx64call/x64stub.asm: -------------------------------------------------------------------------------- 1 | ;/////////////////////////////////////////////////////////////////////// 2 | ; 3 | ; Windows x64 RegisterCallback stub 4 | ; written by fincs 5 | ; 6 | ;/////////////////////////////////////////////////////////////////////// 7 | 8 | .code 9 | 10 | CallbackFunctionOffset = 8*3 11 | 12 | RegisterCallbackAsmStub proc frame 13 | option prologue:none, epilogue:none 14 | .allocstack 8*5 15 | .endprolog 16 | 17 | ; For the 'mov' further below 18 | add rsp, 8 19 | 20 | ; Save the parameters in the spill area for consistency 21 | mov qword ptr[rsp+8*0], rcx 22 | mov qword ptr[rsp+8*1], rdx 23 | mov qword ptr[rsp+8*2], r8 24 | mov qword ptr[rsp+8*3], r9 25 | 26 | ; Set parameters for the upcoming function call 27 | mov rcx, rsp ; UINT_PTR* aParams 28 | mov rdx, rax ; RCCallbackFunc* cbAddress 29 | 30 | ; Call callback stub function 31 | sub rsp, 8*6 ; retaddr+padding+spill area 32 | call qword ptr[rax+CallbackFunctionOffset] 33 | add rsp, 8*5 34 | 35 | ; Return 36 | ret 37 | RegisterCallbackAsmStub endp 38 | 39 | end 40 | -------------------------------------------------------------------------------- /source/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // This file defines some macros for compile-time configurations. 3 | // (Like many projects on *nix that using autotools.) 4 | 5 | #if defined(WIN32) && !defined(_WIN64) 6 | #define WIN32_PLATFORM 7 | #endif 8 | 9 | #ifdef _MSC_VER 10 | #if defined(WIN32_PLATFORM) || defined(_WIN64) 11 | #define ENABLE_DLLCALL 12 | #define ENABLE_REGISTERCALLBACK 13 | #endif 14 | #endif 15 | 16 | #if !defined(_MBCS) && !defined(_UNICODE) && !defined(UNICODE) // If not set in project settings... 17 | 18 | // L: Comment out the next line to enable UNICODE: 19 | //#define _MBCS 20 | 21 | #ifndef _MBCS 22 | #define _UNICODE 23 | #define UNICODE 24 | #endif 25 | #endif 26 | 27 | #ifndef AUTOHOTKEYSC 28 | // DBGp 29 | #define CONFIG_DEBUGGER 30 | #endif 31 | 32 | // Generates warnings to help we check whether the codes are ready to handle Unicode or not. 33 | //#define CONFIG_UNICODE_CHECK 34 | 35 | // This is now defined via Config.vcxproj if supported by the current platform toolset. 36 | //#ifndef _WIN64 37 | //#define CONFIG_WIN2K 38 | //#endif -------------------------------------------------------------------------------- /source/lib_pcre/pcre/AUTHORS: -------------------------------------------------------------------------------- 1 | THE MAIN PCRE LIBRARY 2 | --------------------- 3 | 4 | Written by: Philip Hazel 5 | Email local part: ph10 6 | Email domain: cam.ac.uk 7 | 8 | University of Cambridge Computing Service, 9 | Cambridge, England. 10 | 11 | Copyright (c) 1997-2012 University of Cambridge 12 | All rights reserved 13 | 14 | 15 | PCRE JUST-IN-TIME COMPILATION SUPPORT 16 | ------------------------------------- 17 | 18 | Written by: Zoltan Herczeg 19 | Email local part: hzmester 20 | Emain domain: freemail.hu 21 | 22 | Copyright(c) 2010-2012 Zoltan Herczeg 23 | All rights reserved. 24 | 25 | 26 | STACK-LESS JUST-IN-TIME COMPILER 27 | -------------------------------- 28 | 29 | Written by: Zoltan Herczeg 30 | Email local part: hzmester 31 | Emain domain: freemail.hu 32 | 33 | Copyright(c) 2009-2012 Zoltan Herczeg 34 | All rights reserved. 35 | 36 | 37 | THE C++ WRAPPER LIBRARY 38 | ----------------------- 39 | 40 | Written by: Google Inc. 41 | 42 | Copyright (c) 2007-2012 Google Inc 43 | All rights reserved 44 | 45 | #### 46 | -------------------------------------------------------------------------------- /source/MdFunc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "script.h" 4 | #include "MdType.h" 5 | 6 | 7 | void TypedPtrToToken(MdType aType, void *aPtr, ExprTokenType &aToken); 8 | 9 | 10 | class MdFunc : public NativeFunc 11 | { 12 | void *mMcFunc; // Pointer to native function. 13 | Object *mPrototype; // Prototype object used for type checking; a non-null value implies mMcFunc is a member function. 14 | MdType *mArgType; // Sequence of native arg types and modifiers. 15 | MdType mRetType; // Type of native return value (not necessarily the script return value). 16 | UINT8 mMaxResultTokens; // Number of ResultTokens that might be allocated for conversions. 17 | UINT8 mArgSlots; // Number of DWORD_PTRs needed for the parameter list. 18 | bool mThisCall; 19 | 20 | public: 21 | MdFunc(LPCTSTR aName, void *aMcFunc, MdType aRetType, MdType *aArg, UINT aArgSize, Object *aPrototype = nullptr); 22 | 23 | bool Call(ResultToken &aResultToken, ExprTokenType *aParam[], int aParamCount) override; 24 | bool ArgIsOutputVar(int aIndex) override; 25 | bool ArgIsOptional(int aIndex) override; 26 | }; -------------------------------------------------------------------------------- /source/debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // This file debugging defines some macros like MFC does. 3 | 4 | #ifndef TRACE 5 | #ifdef _DEBUG 6 | #ifdef _MSC_VER 7 | #define TRACE OutputDebugStringFormat 8 | #else 9 | #define TRACE(...) _ftprintf(stderr, __VA_ARGS__) 10 | #endif 11 | #else 12 | #define TRACE(...) 13 | #endif 14 | #endif 15 | 16 | /* 17 | This part of codes map the new operator to the debug version. Although the map is contains in "crtdbg.h", 18 | it is not really work (we will always get a wrong information show us the leaked memory blocks are allocated in "crtdbg.h"). 19 | */ 20 | #ifdef _MSC_VER 21 | // #define _CRTDBG_MAP_ALLOC 22 | #include 23 | // #ifdef _DEBUG 24 | // #define new new(_NORMAL_BLOCK, __FILE__, __LINE__) 25 | // #endif 26 | #endif 27 | 28 | #ifndef ASSERT 29 | #ifdef _ASSERTE 30 | #define ASSERT(expr) _ASSERTE(expr) 31 | #else 32 | #ifdef _DEBUG 33 | #include 34 | #define ASSERT(expr) assert(expr) 35 | #else 36 | #define ASSERT(expr) 37 | #endif 38 | #endif 39 | #endif 40 | 41 | #ifndef VERIFY 42 | #ifdef _DEBUG 43 | #define VERIFY(expr) ASSERT(expr) 44 | #else 45 | #define VERIFY(expr) expr 46 | #endif 47 | #endif 48 | -------------------------------------------------------------------------------- /source/x86call.asm: -------------------------------------------------------------------------------- 1 | 2 | .model flat, C 3 | .code 4 | 5 | DynaCall proc cargs:dword, pargs:dword, pfn:dword, opt:dword 6 | mov ecx, cargs 7 | mov edx, ecx ; keep ecx = cargs for rep movsd 8 | shl edx, 2 9 | sub esp, edx ; allocate cargs*4 bytes on stack 10 | 11 | ; MASM inserts a prolog/epilog which restores esp before return, but if we relied 12 | ; on it to also save/restore esi and edi, it would do so in a way that requires our 13 | ; call below to account for cdecl vs stdcall. So we just do this manually. 14 | push esi 15 | push edi 16 | mov esi, pargs ; set source 17 | lea edi, [esp+8] ; set dest (+8 to adjust for pushing esi/edi) 18 | rep movsd ; copy ecx (cargs) dwords from esi (pargs) to edi (stack) 19 | pop edi 20 | pop esi 21 | 22 | cmp opt, 0 23 | je over 24 | pop ecx ; for thiscall 25 | 26 | over: 27 | call pfn 28 | 29 | ret 30 | DynaCall endp 31 | 32 | GetFloatRetval proc 33 | ; Nothing is actually done here - we just declare the appropriate return type in C++. 34 | ret 35 | GetFloatRetval endp 36 | 37 | GetDoubleRetval proc 38 | ; See above. 39 | ret 40 | GetDoubleRetval endp 41 | 42 | end -------------------------------------------------------------------------------- /source/resources/icons-export.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | This script exports a PNG file for each size of each icon from icons.svg. 3 | It requires Inkscape to be somewhere on the PATH. 4 | It does not currently automate conversion of the groups of PNG files to ICO. 5 | */ 6 | 7 | #Requires AutoHotkey v2.0-beta.6 8 | 9 | ; Using WScript.Shell & Exec didn't work out well... 10 | cmds := FileOpen(tmpname := 'inkscape-commands.tmp', 'w') 11 | 12 | for size in [16, 20, 24, 28, 32, 40, 48, 64] { 13 | export size, 'main' 14 | } 15 | 16 | for size in [16, 20, 24, 28, 32] { 17 | export size, 'p', 'bg, left, right' 18 | export size, 's', 'bg-h' 19 | export size, 'ps', 'bg-ii' 20 | } 21 | 22 | cmds.WriteLine 'quit-immediate' 23 | cmds.Close() 24 | cmds := '' 25 | Run 'cmd /k "(type ' tmpname ' | inkscape icons.svg --shell) && del ' tmpname '"' 26 | 27 | export(size, prefix, ids?) { 28 | if IsSet(ids) 29 | cmds.WriteLine Format( 30 | 'unhide-all; select-clear; select-by-id: {1}; select-invert; selection-hide' 31 | , ids) 32 | cmds.WriteLine Format(' 33 | ( 34 | export-filename: png\{2}{1}.png 35 | export-area-page 36 | export-width: {1}; export-height: {1} 37 | export-do 38 | )', size, prefix) 39 | } -------------------------------------------------------------------------------- /vsc-build-env.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Assume build environment is already setup if msbuild can be located 4 | where msbuild >nul 2>nul && exit /b 0 5 | 6 | :: Allow the path to vsdevcmd to be provided by our caller 7 | if exist "%vsdevcmd%" "%vsdevcmd%" 8 | :: If we're still running, must be no vsdevcmd 9 | 10 | if "%ProgramFiles(x86)%"=="" set ProgramFiles(x86)=%ProgramFiles% 11 | set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" 12 | if not exist %vswhere% ( 13 | echo vswhere.exe not found; unable to locate build tools. 14 | exit 1 15 | ) 16 | 17 | :: This should work for Visual Studio 18 | for /f "usebackq delims=" %%i in (`%vswhere% -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -find *\Tools\vsdevcmd.bat`) do "%%i" 19 | :: This should work with Visual Studio Build Tools 20 | for /f "usebackq delims=" %%i in (`%vswhere% -latest -products * -requires Microsoft.VisualStudio.Workload.VCTools -find *\Tools\vsdevcmd.bat`) do "%%i" 21 | :: As a last resort, try without specifying the required workload 22 | for /f "usebackq delims=" %%i in (`%vswhere% -latest -products * -find *\Tools\vsdevcmd.bat`) do "%%i" 23 | :: If we're still running, vsdevcmd wasn't executed 24 | echo Unable to locate build tools. 25 | exit 1 -------------------------------------------------------------------------------- /source/script_module.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | struct ScriptImport 5 | { 6 | LPTSTR names = nullptr; 7 | ScriptModule *mod = nullptr; 8 | ScriptImport *next = nullptr; 9 | LineNumberType line_number = 0; 10 | FileIndexType file_index = 0; 11 | 12 | ScriptImport() {} 13 | ScriptImport(ScriptModule *aMod) : mod(aMod), names(_T("*")) {} 14 | 15 | void *operator new(size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 16 | void *operator new[](size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 17 | void operator delete(void *aPtr) {} 18 | void operator delete[](void *aPtr) {} 19 | }; 20 | 21 | 22 | class ScriptModule : public ObjectBase 23 | { 24 | public: 25 | LPCTSTR mName = nullptr; 26 | Line *mFirstLine = nullptr; 27 | Label *mFirstLabel = nullptr; 28 | ScriptImport *mImports = nullptr; 29 | ScriptModule *mPrev = nullptr; 30 | VarList mVars; 31 | Var *mSelf = nullptr; 32 | UnresolvedBaseClass *mUnresolvedBaseClass = nullptr; 33 | FileIndexType *mFiles = nullptr, mFilesCount = 0, mFilesCountMax = 0; 34 | bool mExecuted = false; 35 | bool mIsBuiltinModule = false; 36 | 37 | // #Warn settings 38 | WarnMode Warn_LocalSameAsGlobal = WARNMODE_OFF; 39 | WarnMode Warn_Unreachable = WARNMODE_ON; 40 | WarnMode Warn_VarUnset = WARNMODE_ON; 41 | 42 | bool HasFileIndex(FileIndexType aFile); 43 | ResultType AddFileIndex(FileIndexType aFile); 44 | 45 | IObject *FindGlobalObject(LPCTSTR aName); 46 | 47 | ScriptModule() {} 48 | ScriptModule(LPCTSTR aName) : mName(aName) {} 49 | 50 | void *operator new(size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 51 | void *operator new[](size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 52 | void operator delete(void *aPtr) {} 53 | void operator delete[](void *aPtr) {} 54 | 55 | IObject_Type_Impl("Module"); 56 | ResultType Invoke(IObject_Invoke_PARAMS_DECL) override; 57 | Object *Base() override { return sPrototype; } 58 | static Object *sPrototype; 59 | }; 60 | 61 | typedef ScriptItemList ScriptModuleList; 62 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_get.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_get.c" 44 | 45 | /* End of pcre16_get.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_ucd.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_ucd.c" 44 | 45 | /* End of pcre16_ucd.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_exec.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_exec.c" 44 | 45 | /* End of pcre16_exec.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_config.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_config.c" 44 | 45 | /* End of pcre16_config.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_study.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_study.c" 44 | 45 | /* End of pcre16_study.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_tables.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_tables.c" 44 | 45 | /* End of pcre16_tables.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_xclass.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_xclass.c" 44 | 45 | /* End of pcre16_xclass.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_compile.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_compile.c" 44 | 45 | /* End of pcre16_compile.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_fullinfo.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_fullinfo.c" 44 | 45 | /* End of pcre16_fullinfo.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_globals.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_globals.c" 44 | 45 | /* End of pcre16_globals.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_newline.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_newline.c" 44 | 45 | /* End of pcre16_newline.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_refcount.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_refcount.c" 44 | 45 | /* End of pcre16_refcount.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_version.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_version.c" 44 | 45 | /* End of pcre16_version.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_chartables.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_chartables.c" 44 | 45 | /* End of pcre16_chartables.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_jit_compile.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_jit_compile.c" 44 | 45 | /* End of pcre16_jit_compile.c */ 46 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_string_utils.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | /* Generate code with 16 bit character support. */ 41 | #define COMPILE_PCRE16 42 | 43 | #include "pcre_string_utils.c" 44 | 45 | /* End of pcre16_string_utils.c */ 46 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug x64w C++", 9 | "type": "cppvsdbg", 10 | "request": "launch", 11 | "program": "bin_debug/AutoHotkey64.exe", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${workspaceRoot}", 15 | "preLaunchTask": "build-debug" 16 | }, 17 | { 18 | "name": "Debug x64w AHK", 19 | "type": "autohotkey", 20 | "request": "launch", 21 | "program": "${file}", 22 | "runtime": "${workspaceRoot}/bin_debug/AutoHotkey64.exe", 23 | "useDebugDirective": true, 24 | "args": [], 25 | "variableCategories": [ 26 | { 27 | "label": "Local", 28 | "source": "Local", 29 | }, 30 | { 31 | "label": "Static", 32 | "source": "Static", 33 | }, 34 | { 35 | "label": "Global", 36 | "source": "Global", 37 | "noduplicate": true, 38 | }, 39 | { 40 | "label": "Global Classes", 41 | "source": "Global", 42 | "matchers": [ 43 | { 44 | "className": "Class", 45 | }, 46 | ], 47 | }, 48 | { 49 | "label": "Global Functions", 50 | "source": "Global", 51 | "matchers": [ 52 | { 53 | "className": "Func", 54 | }, 55 | ], 56 | }, 57 | { 58 | "label": "Built-in Global", 59 | "source": "Global", 60 | "matchers": [ 61 | { 62 | "builtin": true 63 | }, 64 | ], 65 | }, 66 | ] 67 | } 68 | ] 69 | } -------------------------------------------------------------------------------- /source/input_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class InputObject : public Object 4 | { 5 | input_type input; 6 | 7 | FResult get_On(IObject *&aRetVal, IObject *&aOn); 8 | FResult set_On(ExprTokenType &aValue, IObject *&aOn, int aValidParamCount); 9 | 10 | public: 11 | IObject *onEnd = nullptr, *onKeyDown = nullptr, *onChar = nullptr, *onKeyUp = nullptr; 12 | 13 | static Object *sPrototype; 14 | static ObjectMemberMd sMembers[]; 15 | static int sMemberCount; 16 | 17 | InputObject(); 18 | ~InputObject() 19 | { 20 | if (onEnd) 21 | onEnd->Release(); 22 | if (onKeyDown) 23 | onKeyDown->Release(); 24 | if (onChar) 25 | onChar->Release(); 26 | if (onKeyUp) 27 | onKeyUp->Release(); 28 | } 29 | 30 | static Object *Create(); 31 | 32 | FResult __New(optl aOptions, optl aEndKeys, optl aMatchList); 33 | 34 | FResult Start(); 35 | FResult Wait(optl aMaxTime, StrRet &aRetVal); 36 | FResult Stop(); 37 | FResult KeyOpt(StrArg aKeys, StrArg aKeyOptions); 38 | 39 | FResult get_InProgress(BOOL &aRetVal) { aRetVal = input.InProgress(); return OK; } 40 | 41 | FResult get_EndReason(StrRet &aRetVal); 42 | FResult get_EndKey(StrRet &aRetVal); 43 | FResult get_EndMods(StrRet &aRetVal); 44 | FResult get_Input(StrRet &aRetVal); 45 | FResult get_Match(StrRet &aRetVal); 46 | 47 | #define ONX_OPTION(X, N) \ 48 | FResult get_On##X(IObject *&aRetVal) { \ 49 | return get_On(aRetVal, on##X); \ 50 | } \ 51 | FResult set_On##X(ExprTokenType &aValue) { \ 52 | return set_On(aValue, on##X, N); \ 53 | } 54 | ONX_OPTION(End, 1); 55 | ONX_OPTION(Char, 2); 56 | ONX_OPTION(KeyDown, 3); 57 | ONX_OPTION(KeyUp, 3); 58 | #undef ONX_OPTION 59 | 60 | #define BOOL_OPTION(OPT) \ 61 | FResult get_##OPT(BOOL &aRetVal) { \ 62 | aRetVal = input.OPT; \ 63 | return OK; \ 64 | } \ 65 | FResult set_##OPT(BOOL aValue) { \ 66 | input.OPT = aValue; \ 67 | return OK; \ 68 | } 69 | BOOL_OPTION(BackspaceIsUndo); 70 | BOOL_OPTION(CaseSensitive); 71 | BOOL_OPTION(FindAnywhere); 72 | BOOL_OPTION(NotifyNonText); 73 | BOOL_OPTION(VisibleNonText); 74 | BOOL_OPTION(VisibleText); 75 | #undef BOOL_OPTION 76 | 77 | FResult get_MinSendLevel(int &aRetVal) { aRetVal = input.MinSendLevel; return OK; } 78 | FResult set_MinSendLevel(int aValue); 79 | 80 | FResult get_Timeout(double &aRetVal) { aRetVal = input.Timeout / 1000.0; return OK; } 81 | FResult set_Timeout(double aValue); 82 | }; 83 | -------------------------------------------------------------------------------- /source/ahklib.idl: -------------------------------------------------------------------------------- 1 | import "oaidl.idl"; 2 | import "ocidl.idl"; 3 | 4 | [uuid(BF08F948-5CFB-490D-9750-8C23E08183E0)] 5 | library ComLib { 6 | [object, uuid(27151110-4186-487A-AFC8-EB5A0D8F684A), dual] 7 | interface IAutoHotkeyLib : IDispatch { 8 | HRESULT Main([in] BSTR CmdLine, [out, retval] int* ExitCode); 9 | HRESULT LoadFile([in] BSTR FileName); 10 | HRESULT Execute([out, retval] int* ExitCode); 11 | HRESULT OnProblem([in] IDispatch* Callback); 12 | [propget] HRESULT Script([out, retval] IDispatch** Value); 13 | [propget] HRESULT Funcs([out, retval] IDispatch** Value); 14 | [propget] HRESULT Vars([out, retval] IDispatch** Value); 15 | [propget] HRESULT Labels([out, retval] IDispatch** Value); 16 | [propget] HRESULT Files([out, retval] SAFEARRAY(BSTR)* Value); 17 | } 18 | [object, uuid(DA16C631-D15A-44E6-A113-9601CC1310AA), dual] 19 | interface IDispCollection : IDispatch { 20 | [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT* Index, [out, retval] VARIANT* Value); 21 | [propget] HRESULT Count([out, retval] int* Value); 22 | [id(DISPID_NEWENUM)] HRESULT _NewEnum([out, retval] IEnumVARIANT** Enum); 23 | }; 24 | [object, uuid(BAE19F06-2AD0-48F3-BD63-796029479953), dual] 25 | interface IDescribeVar : IDispatch { 26 | [propget] BSTR Name(); 27 | [propget] BOOL IsReadOnly(); 28 | [propget] BOOL IsVirtual(); 29 | [propget] BOOL IsDeclared(); 30 | [propget] BOOL IsSuperGlobal(); 31 | }; 32 | [object, uuid(53C5E58D-DB47-47A3-8C41-6456D0B7E8B9), dual] 33 | interface IDescribeLabel : IDispatch { 34 | [propget] BSTR Name(); 35 | [propget] BSTR File(); 36 | [propget] UINT Line(); 37 | }; 38 | [object, uuid(A6C6F0BE-D527-4B5A-9F24-567C283A0C7B), dual] 39 | interface IDescribeParam : IDispatch { 40 | [propget] BSTR Name(); 41 | [propget] BOOL IsByRef(); 42 | [propget] BOOL IsOptional(); 43 | [propget] BOOL IsRest(); 44 | [propget] HRESULT Default([out, retval] VARIANT* Value); 45 | }; 46 | [object, uuid(63FBF386-F43B-4B4E-8E73-20B8D9CCA4B1), dual] 47 | interface IDescribeFunc : IDescribeLabel { 48 | [propget] UINT EndLine(); 49 | [propget] BOOL IsBuiltIn(); 50 | [propget] BOOL IsVariadic(); 51 | [propget] int MinParams(); 52 | [propget] int MaxParams(); 53 | [propget] HRESULT Params([out, retval] IDispatch** Value); 54 | [propget] HRESULT Vars([out, retval] IDispatch** Value); 55 | [propget] HRESULT Globals([out, retval] IDispatch** Value); 56 | [propget] BSTR DefaultVarType(); 57 | }; 58 | } -------------------------------------------------------------------------------- /source/resources/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by AutoHotkey.rc 4 | // 5 | #define VS_VERSION_INFO 1 6 | #define IDS_PROJNAME 100 7 | #define IDR_WMDMLOGGER 101 8 | #define IDI_MAIN 159 9 | #define IDI_FILETYPE 160 10 | #define IDS_LOG_SEV_INFO 201 11 | #define IDC_INPUTEDIT 201 12 | #define IDS_LOG_SEV_WARN 202 13 | #define IDR_MENU1 202 14 | #define IDS_LOG_SEV_ERROR 203 15 | #define IDS_LOG_DATETIME 204 16 | #define IDC_INPUTPROMPT 204 17 | #define IDS_LOG_SRCNAME 205 18 | #define IDD_INPUTBOX 205 19 | #define IDI_SUSPEND 206 20 | #define IDI_PAUSE 207 21 | #define IDI_PAUSE_SUSPEND 208 22 | #define IDR_MENU_MAIN 211 23 | #define IDR_ACCELERATOR1 212 24 | #define IDS_DEF_LOGFILE 301 25 | #define IDS_DEF_MAXSIZE 302 26 | #define IDS_DEF_SHRINKTOSIZE 303 27 | #define IDS_DEF_LOGENABLED 304 28 | #define IDS_MUTEX_TIMEOUT 401 29 | #define ID_FILE_RELOADSCRIPT 65400 30 | #define ID_FILE_EDITSCRIPT 65401 31 | #define ID_FILE_WINDOWSPY 65402 32 | #define ID_FILE_PAUSE 65403 33 | #define ID_FILE_SUSPEND 65404 34 | #define ID_FILE_EXIT 65405 35 | #define ID_VIEW_LINES 65406 36 | #define ID_VIEW_VARIABLES 65407 37 | #define ID_VIEW_HOTKEYS 65408 38 | #define ID_VIEW_KEYHISTORY 65409 39 | #define ID_VIEW_REFRESH 65410 40 | #define ID_HELP_USERMANUAL 65411 41 | #define ID_HELP_WEBSITE 65412 42 | #define IDD_ERRORBOX 500 43 | #define IDC_ERR_EDIT 501 44 | 45 | // Next default values for new objects 46 | // 47 | #ifdef APSTUDIO_INVOKED 48 | #ifndef APSTUDIO_READONLY_SYMBOLS 49 | #define _APS_NEXT_RESOURCE_VALUE 236 50 | #define _APS_NEXT_COMMAND_VALUE 65414 51 | #define _APS_NEXT_CONTROL_VALUE 206 52 | #define _APS_NEXT_SYMED_VALUE 101 53 | #endif 54 | #endif 55 | 56 | 57 | 58 | #ifdef _WIN64 59 | #define AHK_BIT "64-bit" 60 | #else 61 | #define AHK_BIT "32-bit" 62 | #endif 63 | 64 | #define AHK_DESCRIPTION "AutoHotkey " AHK_BIT 65 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "windows": { 6 | "options": { 7 | "shell": { 8 | "executable": "cmd.exe", 9 | "args": ["/C", "${workspaceFolder}/vsc-build-env.cmd", "&&"] 10 | } 11 | }, 12 | "problemMatcher": "$msCompile" 13 | }, 14 | "tasks": [ 15 | { 16 | "label": "build", 17 | "type": "shell", 18 | "command": "msbuild", 19 | "args": [ 20 | "/p:Platform=${input:platform}", 21 | "/p:Configuration=${input:buildconfig}", 22 | "/t:build", 23 | "/p:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary", 25 | "${workspaceFolder}/AutoHotkeyx.sln" 26 | ], 27 | "group": { 28 | "kind": "build", 29 | "isDefault": true 30 | } 31 | }, 32 | { 33 | "label": "rebuild", 34 | "type": "shell", 35 | "command": "msbuild", 36 | "args": [ 37 | "/p:Platform=${input:platform}", 38 | "/p:Configuration=${input:buildconfig}", 39 | "/t:Rebuild", 40 | "/p:GenerateFullPaths=true", 41 | "/consoleloggerparameters:NoSummary", 42 | "${workspaceFolder}/AutoHotkeyx.sln" 43 | ], 44 | "group": "build" 45 | }, 46 | { 47 | "label": "build-debug", 48 | "type": "shell", 49 | "command": "msbuild", 50 | "args": [ 51 | "/p:Platform=x64", 52 | "/p:Configuration=Debug", 53 | "/t:build", 54 | "/p:GenerateFullPaths=true", 55 | "/consoleloggerparameters:NoSummary", 56 | "${workspaceFolder}/AutoHotkeyx.sln" 57 | ], 58 | "group": "build" 59 | } 60 | ], 61 | "inputs": [ 62 | { 63 | "id": "platform", 64 | "description": "Platform", 65 | "type": "pickString", 66 | "options": [ 67 | "x64", 68 | "Win32" 69 | ], 70 | "default": "x64" 71 | }, 72 | { 73 | "id": "buildconfig", 74 | "description": "Build Configuration", 75 | "type": "pickString", 76 | "options": [ 77 | "Release", 78 | "Debug" 79 | ], 80 | "default": "Release" 81 | } 82 | ] 83 | } -------------------------------------------------------------------------------- /source/abi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "StrRet.h" 4 | 5 | // Marks functions which are called by script, for clarity and possible future use. 6 | #define bif_impl 7 | 8 | constexpr int FR_OUR_FLAG = 0x20000000; 9 | constexpr int FR_INT_FLAG = 0x40000000; 10 | constexpr int FR_FACILITY_CONTROL = 0; 11 | constexpr int FR_FACILITY_INT = 9; 12 | constexpr int FR_FACILITY_ARG = 0xA; 13 | constexpr int FR_FACILITY_ERR = 0xE; 14 | constexpr FResult FR_FAIL = FR_OUR_FLAG | MAKE_HRESULT(SEVERITY_ERROR, FR_FACILITY_CONTROL, 0); // Error already shown/thrown. 15 | constexpr FResult FR_ABORTED = FR_OUR_FLAG | MAKE_HRESULT(SEVERITY_SUCCESS, FR_FACILITY_CONTROL, 0); // Continuing after an error; return blank. 16 | 17 | constexpr FResult FR_E_WIN32 = FR_OUR_FLAG | MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, 0); // 0xA0070000 18 | #define FR_E_WIN32(n) (FR_E_WIN32 | (n)) 19 | constexpr FResult FR_E_ARG_ZERO = FR_OUR_FLAG | MAKE_HRESULT(SEVERITY_ERROR, FR_FACILITY_ARG, 0); // 0xA00A0000 20 | #define FR_E_ARG(n) (FR_E_ARG_ZERO | (n)) 21 | constexpr FResult FR_E_ARGS = FR_E_ARG(0xFFFF); 22 | 23 | #define FR_THROW_INT(n) ((n) & 0xF0000000 ? FR_E_FAILED \ 24 | : ((SEVERITY_ERROR << 31) | FR_OUR_FLAG | FR_INT_FLAG | (n))) // Throw an Error where Extra = an int in the range 0..0x0FFFFFFF. 25 | #define FR_GET_THROWN_INT(fr) ((fr) & 0x0FFFFFFF) 26 | 27 | constexpr int FR_ERR_BASE = FR_OUR_FLAG | MAKE_HRESULT(SEVERITY_ERROR, FR_FACILITY_ERR, 0); // 0xA00E0000 28 | constexpr int FR_E_OUTOFMEM = FR_ERR_BASE | 1; 29 | constexpr int FR_E_FAILED = FR_ERR_BASE | 2; 30 | 31 | 32 | typedef LPCTSTR StrArg; 33 | 34 | template class optl 35 | { 36 | const T *_value; 37 | public: 38 | optl(const T &&v) : _value {&v} {} 39 | optl(const T &v) : _value {&v} {} 40 | optl(T &v) : _value {&v} {} 41 | optl(nullptr_t) : _value {nullptr} {} 42 | bool has_value() { return _value != nullptr; } 43 | T operator* () { return *_value; } 44 | T value() { return *_value; } 45 | T value_or(T aDefault) { return _value ? *_value : aDefault; } 46 | }; 47 | 48 | template<> class optl 49 | { 50 | const StrArg _value; 51 | public: 52 | optl(StrArg v) : _value {v} {} 53 | bool has_value() { return _value != nullptr; } 54 | bool has_nonempty_value() { return _value && *_value; } 55 | bool is_blank() { return _value && !*_value; } 56 | bool is_blank_or_omitted() { return !has_nonempty_value(); } 57 | StrArg value() { ASSERT(_value); return _value; } 58 | StrArg value_or(StrArg aDefault) { return _value ? _value : aDefault; } 59 | StrArg value_or_null() { return _value; } 60 | StrArg value_or_empty() { return _value ? _value : _T(""); } 61 | }; 62 | 63 | template<> class optl 64 | { 65 | IObject *_value; 66 | public: 67 | optl(IObject *v) : _value {v} {} 68 | optl(nullptr_t) : _value {nullptr} {} 69 | bool has_value() { return _value != nullptr; } 70 | IObject *value() { return _value; } 71 | }; 72 | 73 | 74 | struct VariantParams 75 | { 76 | ExprTokenType **value; 77 | int count; 78 | }; 79 | -------------------------------------------------------------------------------- /source/resources/AutoHotkey.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | true 53 | true 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /source/StrRet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | 5 | class StrRet 6 | { 7 | LPCTSTR mValue = nullptr; 8 | LPTSTR mCallerBuf = nullptr, mAllocated = nullptr; 9 | size_t mLength = -1; 10 | 11 | public: 12 | static constexpr size_t CallerBufSize = 256; 13 | 14 | StrRet(LPTSTR aBuf) : mCallerBuf(aBuf) {} 15 | 16 | // Allocate a buffer large enough for n characters plus a null-terminator, 17 | // and sets it as the return value. Must be called only once. 18 | LPTSTR Alloc(size_t n) 19 | { 20 | ASSERT(!mAllocated && !mValue && n); 21 | LPTSTR buf; 22 | if (n < CallerBufSize) 23 | buf = mCallerBuf; 24 | else 25 | buf = mAllocated = tmalloc(n + 1); 26 | mValue = buf; 27 | return buf; 28 | } 29 | 30 | // Set value to a copy of the string in memory that can be returned to the caller. 31 | bool Copy(LPCTSTR s, size_t n) 32 | { 33 | ASSERT(!mAllocated && !mValue); 34 | if (!n) 35 | return true; 36 | LPTSTR buf = Alloc(n); 37 | if (buf) 38 | { 39 | tmemcpy(buf, s, n); 40 | buf[n] = '\0'; 41 | } 42 | return buf; 43 | } 44 | 45 | // Set value to a copy of the string in memory that can be returned to the caller. 46 | bool Copy(LPCTSTR s) 47 | { 48 | return Copy(s, _tcslen(s)); 49 | } 50 | 51 | // Returns a buffer of size StrRet::CallerBufSize allocated by the caller for use by the callee. 52 | LPTSTR CallerBuf() 53 | { 54 | return mCallerBuf; 55 | } 56 | 57 | bool UsedMalloc() 58 | { 59 | ASSERT(!mAllocated || mAllocated == mValue); 60 | return mAllocated != nullptr; 61 | } 62 | 63 | LPCTSTR Value() 64 | { 65 | ASSERT(!mAllocated || mAllocated == mValue); 66 | return mValue; 67 | } 68 | 69 | size_t Length() 70 | { 71 | return mLength; 72 | } 73 | 74 | // Used by callee to declare that the value should be empty, for clarity and 75 | // in case the default state is ever interpreted as something other than "". 76 | void SetEmpty() 77 | { 78 | ASSERT(!mValue); 79 | } 80 | 81 | // Set the return value. 82 | // s must be in static memory, such as a literal string. 83 | void SetStatic(LPCTSTR s) 84 | { 85 | ASSERT(!mValue); 86 | mValue = s; 87 | } 88 | 89 | // Set the return value and length. 90 | // s must be in static memory, such as a literal string. 91 | void SetStatic(LPCTSTR s, size_t n) 92 | { 93 | ASSERT(!mValue); 94 | mValue = s; 95 | mLength = n; 96 | } 97 | 98 | // Set the return value. 99 | // s must be in memory that will persist until the caller has an opportunity to 100 | // copy it, such as in CallerBuf(). 101 | // Alias of SetStatic(), used to show that retaining the pointer indefinitely 102 | // wouldn't be safe. 103 | void SetTemp(LPCTSTR s) 104 | { 105 | SetStatic(s); 106 | } 107 | void SetTemp(LPCTSTR s, size_t n) 108 | { 109 | SetStatic(s, n); 110 | } 111 | 112 | // Set the length of the string which has been written into the buffer returned by Alloc(). 113 | // Calling this is optional. 114 | void SetLength(size_t n) 115 | { 116 | ASSERT(mValue); 117 | mLength = n; 118 | } 119 | }; 120 | -------------------------------------------------------------------------------- /source/os_version.h: -------------------------------------------------------------------------------- 1 | #ifndef __OS_VERSION_H 2 | #define __OS_VERSION_H 3 | 4 | /////////////////////////////////////////////////////////////////////////////// 5 | // 6 | // AutoIt 7 | // 8 | // Copyright (C)1999-2003: 9 | // - Jonathan Bennett 10 | // - Others listed at http://www.autoitscript.com/autoit3/docs/credits.htm 11 | // 12 | // This program is free software; you can redistribute it and/or modify 13 | // it under the terms of the GNU General Public License as published by 14 | // the Free Software Foundation; either version 2 of the License, or 15 | // (at your option) any later version. 16 | // 17 | /////////////////////////////////////////////////////////////////////////////// 18 | // 19 | // os_version.h 20 | // 21 | // A standalone class for easy checking of the OS version. 22 | // 23 | /////////////////////////////////////////////////////////////////////////////// 24 | 25 | 26 | // Includes 27 | #include 28 | 29 | class OS_Version 30 | { 31 | public: 32 | // Functions 33 | OS_Version() { Init(); } // Constructor 34 | void Init(void); // Call first before use 35 | 36 | bool IsWinVista(void) {return m_bWinVista;} // Returns true if WinVista (v1.0.44.13) 37 | bool IsWin7(void) {return m_bWin7; } // Returns true if Win7 38 | bool IsWin8(void) {return m_bWin8; } // Returns true if Win8 39 | bool IsWin8orLater() {return m_dwMajorVersion > 6 || m_dwMinorVersion > 1;} 40 | bool IsWin8_1(void) {return m_bWin8_1; } // Returns true if Win8.1 41 | bool IsWin7OrLater(void) {return m_bWin7OrLater; } // Returns true if Win7+ 42 | bool IsWin10OrLater(void) {return m_dwMajorVersion >= 10;} // Excludes early pre-release builds. 43 | 44 | DWORD BuildNumber(void) {return m_dwBuildNumber;} 45 | //LPCTSTR CSD(void) {return m_szCSDVersion;} 46 | LPCTSTR Version() {return m_szVersion;} 47 | 48 | private: 49 | // Variables 50 | OSVERSIONINFOW m_OSvi; // OS Version data 51 | 52 | DWORD m_dwMajorVersion; // Major OS version 53 | DWORD m_dwMinorVersion; // Minor OS version 54 | DWORD m_dwBuildNumber; // Build number 55 | //TCHAR m_szCSDVersion[128]; 56 | TCHAR m_szVersion[32]; // "Major.Minor.Build" -- longest known number is 9 chars (plus terminator), but 32 should be future-proof. 57 | 58 | #ifdef CONFIG_WIN9X 59 | bool m_bWinNT; 60 | bool m_bWin9x; 61 | 62 | bool m_bWin95; 63 | bool m_bWin95orLater; 64 | bool m_bWin98; 65 | bool m_bWin98orLater; 66 | bool m_bWinMe; 67 | bool m_bWinMeorLater; 68 | #endif 69 | #ifdef CONFIG_WINNT4 70 | bool m_bWinNT4; 71 | bool m_bWinNT4orLater; 72 | #endif 73 | #ifdef CONFIG_WIN2K 74 | bool m_bWin2000; 75 | bool m_bWin2000orLater; // For simplicity, this is always left in even though it is not used when !(CONFIG_WIN9X || CONFIG_WINNT4). 76 | bool m_bWinXPorLater; 77 | #endif 78 | bool m_bWinXP; 79 | bool m_bWin2003; 80 | bool m_bWinVista; 81 | bool m_bWinVistaOrLater; 82 | bool m_bWin7; 83 | bool m_bWin7OrLater; 84 | bool m_bWin8; 85 | bool m_bWin8_1; 86 | }; 87 | 88 | /////////////////////////////////////////////////////////////////////////////// 89 | 90 | #endif 91 | 92 | -------------------------------------------------------------------------------- /source/clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | AutoHotkey 3 | 4 | Copyright 2003-2009 Chris Mallett (support@autohotkey.com) 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | 17 | #ifndef clipboard_h 18 | #define clipboard_h 19 | 20 | #include "defines.h" 21 | 22 | 23 | #define CANT_OPEN_CLIPBOARD_READ _T("Can't open clipboard for reading.") 24 | #define CANT_OPEN_CLIPBOARD_WRITE _T("Can't open clipboard for writing.") 25 | 26 | #ifdef UNICODE 27 | // In unicode version, always try CF_UNICODETEXT first, then CF_TEXT. 28 | #define CF_NATIVETEXT CF_UNICODETEXT 29 | #define CF_OTHERTEXT CF_TEXT 30 | #else 31 | #define CF_NATIVETEXT CF_TEXT 32 | #define CF_OTHERTEXT CF_UNICODETEXT 33 | #endif 34 | 35 | 36 | class Clipboard 37 | { 38 | public: 39 | HGLOBAL mClipMemNow, mClipMemNew; 40 | LPTSTR mClipMemNowLocked, mClipMemNewLocked; 41 | // NOTE: Both mLength and mCapacity are count in characters (NOT in bytes). 42 | size_t mLength; // Last-known length of the clipboard contents (for internal use only because it's valid only during certain specific times). 43 | UINT mCapacity; // Capacity of mClipMemNewLocked. 44 | BOOL mIsOpen; // Whether the clipboard is physically open due to action by this class. BOOL vs. bool improves some benchmarks slightly due to this item being frequently checked. 45 | 46 | // It seems best to default to many attempts, because a failure 47 | // to open the clipboard may result in the early termination 48 | // of a large script due to the fear that it's generally 49 | // unsafe to continue in such cases. Update: Increased default 50 | // number of attempts from 20 to 40 because Jason (Payam) reported 51 | // that he was getting an error on rare occasions (but not reproducible). 52 | ResultType Open(); 53 | HANDLE GetClipboardDataTimeout(UINT uFormat, BOOL *aNullIsOkay = NULL); 54 | 55 | // Below: Whether the clipboard is ready to be written to. Note that the clipboard is not 56 | // usually physically open even when this is true, unless the caller specifically opened 57 | // it in that mode also: 58 | bool IsReadyForWrite() {return mClipMemNewLocked != NULL;} 59 | 60 | #define CLIPBOARD_FAILURE UINT_MAX 61 | size_t Get(LPTSTR aBuf = NULL); 62 | 63 | ResultType Set(LPCTSTR aBuf = NULL, UINT_PTR aLength = UINT_MAX); 64 | LPTSTR PrepareForWrite(size_t aAllocSize); 65 | ResultType Commit(UINT aFormat = CF_NATIVETEXT); 66 | ResultType AbortWrite(LPTSTR aErrorMessage = _T("")); 67 | ResultType Close(LPTSTR aErrorMessage = NULL); 68 | 69 | Clipboard() // Constructor 70 | : mIsOpen(false) // Assumes our app doesn't already have it open. 71 | , mClipMemNow(NULL), mClipMemNew(NULL) 72 | , mClipMemNowLocked(NULL), mClipMemNewLocked(NULL) 73 | , mLength(0), mCapacity(0) 74 | {} 75 | }; 76 | 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/LICENCE: -------------------------------------------------------------------------------- 1 | PCRE LICENCE 2 | ------------ 3 | 4 | PCRE is a library of functions to support regular expressions whose syntax 5 | and semantics are as close as possible to those of the Perl 5 language. 6 | 7 | Release 8 of PCRE is distributed under the terms of the "BSD" licence, as 8 | specified below. The documentation for PCRE, supplied in the "doc" 9 | directory, is distributed under the same terms as the software itself. 10 | 11 | The basic library functions are written in C and are freestanding. Also 12 | included in the distribution is a set of C++ wrapper functions, and a 13 | just-in-time compiler that can be used to optimize pattern matching. These 14 | are both optional features that can be omitted when the library is built. 15 | 16 | 17 | THE BASIC LIBRARY FUNCTIONS 18 | --------------------------- 19 | 20 | Written by: Philip Hazel 21 | Email local part: ph10 22 | Email domain: cam.ac.uk 23 | 24 | University of Cambridge Computing Service, 25 | Cambridge, England. 26 | 27 | Copyright (c) 1997-2012 University of Cambridge 28 | All rights reserved. 29 | 30 | 31 | PCRE JUST-IN-TIME COMPILATION SUPPORT 32 | ------------------------------------- 33 | 34 | Written by: Zoltan Herczeg 35 | Email local part: hzmester 36 | Emain domain: freemail.hu 37 | 38 | Copyright(c) 2010-2012 Zoltan Herczeg 39 | All rights reserved. 40 | 41 | 42 | STACK-LESS JUST-IN-TIME COMPILER 43 | -------------------------------- 44 | 45 | Written by: Zoltan Herczeg 46 | Email local part: hzmester 47 | Emain domain: freemail.hu 48 | 49 | Copyright(c) 2009-2012 Zoltan Herczeg 50 | All rights reserved. 51 | 52 | 53 | THE C++ WRAPPER FUNCTIONS 54 | ------------------------- 55 | 56 | Contributed by: Google Inc. 57 | 58 | Copyright (c) 2007-2012, Google Inc. 59 | All rights reserved. 60 | 61 | 62 | THE "BSD" LICENCE 63 | ----------------- 64 | 65 | Redistribution and use in source and binary forms, with or without 66 | modification, are permitted provided that the following conditions are met: 67 | 68 | * Redistributions of source code must retain the above copyright notice, 69 | this list of conditions and the following disclaimer. 70 | 71 | * Redistributions in binary form must reproduce the above copyright 72 | notice, this list of conditions and the following disclaimer in the 73 | documentation and/or other materials provided with the distribution. 74 | 75 | * Neither the name of the University of Cambridge nor the name of Google 76 | Inc. nor the names of their contributors may be used to endorse or 77 | promote products derived from this software without specific prior 78 | written permission. 79 | 80 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 81 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 82 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 83 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 84 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 85 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 88 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 89 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 90 | POSSIBILITY OF SUCH DAMAGE. 91 | 92 | End 93 | -------------------------------------------------------------------------------- /source/stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | AutoHotkey 3 | 4 | Copyright 2003-2009 Chris Mallett (support@autohotkey.com) 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | 17 | // stdafx.h : include file for standard system include files, 18 | // or project specific include files that are used frequently, but 19 | // are changed infrequently 20 | // 21 | 22 | #pragma once 23 | 24 | #define _CRT_SECURE_NO_DEPRECATE // Avoid compiler warnings in VC++ 8.x/2005 that urge the use of lower-performing C library functions that protect against buffer overruns. 25 | #define _CRT_NON_CONFORMING_SWPRINTFS // We don't want ISO version of swprintf, which has similar interface with snwprintf (different from sprintf) 26 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 27 | #define _WINSOCK_DEPRECATED_NO_WARNINGS // Primarily for WSAAsyncSelect, since the recommended replacement is inadequate. 28 | #pragma warning (disable:4351) // Suppress spurious warning about "new behavior" for some compilers. 29 | 30 | // Windows Header Files: 31 | // Necessary to do this prior to including windows.h so that NT functions are unlocked: 32 | #define _WIN32_WINNT 0x0600 33 | #define _WIN32_IE _WIN32_IE_IE70 // Added for TVN_ITEMCHANGED, which most likely requires Vista. 34 | 35 | #ifdef _MSC_VER 36 | #include "config.h" // compile-time configurations 37 | #include "debug.h" 38 | 39 | // C RunTime Header Files 40 | #include 41 | #include 42 | #include // used by snprintfcat() 43 | #include // for UINT_MAX, UCHAR_MAX, etc. 44 | #include // For _alloca() 45 | //#include 46 | 47 | #include 48 | #include 49 | #include // for status bar functions. Must be included after . 50 | #include // for ShellExecute() 51 | #include // for SHGetMalloc() 52 | #include // for mciSendString() and waveOutSetVolume() 53 | #include // for OPENFILENAME 54 | 55 | // ATL alternatives 56 | #include "KuString.h" 57 | #include "StringConv.h" 58 | 59 | // It's probably best not to do these, because I think they would then be included 60 | // for everything, even modules that don't need it, which might result in undesired 61 | // dependencies sneaking in, or subtle naming conflicts: 62 | // ... 63 | //#include "defines.h" 64 | //#include "application.h" 65 | //#include "globaldata.h" 66 | //#include "window.h" // Not to be confused with "windows.h" 67 | //#include "util.h" 68 | //#include "SimpleHeap.h" 69 | #endif 70 | 71 | #include 72 | using std::swap; 73 | 74 | // Lexikos: Defining _WIN32_WINNT 0x0600 seems to break TrayTip in non-English Windows, 75 | // and possibly other things. Instead, define any Vista constants we need here. 76 | #if (_WIN32_WINNT < 0x0600) 77 | #define WM_MOUSEHWHEEL 0x020E 78 | #define MOUSEEVENTF_HWHEEL 0x01000 /* hwheel button rolled */ 79 | #define LWS_NOPREFIX 0x0004 // SysLink control 80 | #define LWS_RIGHT 0x0020 // SysLink control 81 | #endif 82 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcret.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef UNICODE 3 | 4 | #define pcret pcre16 5 | #define pcret_extra pcre16_extra 6 | #define pcret_callout_block pcre16_callout_block 7 | #define pcret_malloc pcre16_malloc 8 | #define pcret_free pcre16_free 9 | #define pcret_stack_malloc pcre16_stack_malloc 10 | #define pcret_stack_free pcre16_stack_free 11 | #define pcret_callout pcre16_callout 12 | 13 | #define pcret_compile pcre16_compile 14 | #define pcret_compile2 pcre16_compile2 15 | #define pcret_config pcre16_config 16 | #define pcret_copy_named_substring pcre16_copy_named_substring 17 | #define pcret_copy_substring pcre16_copy_substring 18 | #define pcret_dfa_exec pcre16_dfa_exec 19 | #define pcret_exec pcre16_exec 20 | #define pcret_free_substring pcre16_free_substring 21 | #define pcret_free_substring_list pcre16_free_substring_list 22 | #define pcret_fullinfo pcre16_fullinfo 23 | #define pcret_get_named_substring pcre16_get_named_substring 24 | #define pcret_get_stringnumber pcre16_get_stringnumber 25 | #define pcret_get_first_set pcre16_get_first_set 26 | #define pcret_get_stringtable_entries pcre16_get_stringtable_entries 27 | #define pcret_get_substring pcre16_get_substring 28 | #define pcret_get_substring_list pcre16_get_substring_list 29 | #define pcret_maketables pcre16_maketables 30 | #define pcret_refcount pcre16_refcount 31 | #define pcret_study pcre16_study 32 | #define pcret_free_study pcre16_free_study 33 | #define pcret_version pcre16_version 34 | #define pcret_pattern_to_host_byte_order pcre16_pattern_to_host_byte_order 35 | #define pcret_jit_stack_alloc pcre16_jit_stack_alloc 36 | #define pcret_jit_stack_free pcre16_jit_stack_free 37 | #define pcret_assign_jit_stack pcre16_assign_jit_stack 38 | 39 | #else 40 | 41 | #define pcret pcre 42 | #define pcret_extra pcre_extra 43 | #define pcret_callout_block pcre_callout_block 44 | #define pcret_malloc pcre_malloc 45 | #define pcret_free pcre_free 46 | #define pcret_stack_malloc pcre_stack_malloc 47 | #define pcret_stack_free pcre_stack_free 48 | #define pcret_callout pcre_callout 49 | 50 | #define pcret_compile pcre_compile 51 | #define pcret_compile2 pcre_compile2 52 | #define pcret_config pcre_config 53 | #define pcret_copy_named_substring pcre_copy_named_substring 54 | #define pcret_copy_substring pcre_copy_substring 55 | #define pcret_dfa_exec pcre_dfa_exec 56 | #define pcret_exec pcre_exec 57 | #define pcret_free_substring pcre_free_substring 58 | #define pcret_free_substring_list pcre_free_substring_list 59 | #define pcret_fullinfo pcre_fullinfo 60 | #define pcret_get_named_substring pcre_get_named_substring 61 | #define pcret_get_stringnumber pcre_get_stringnumber 62 | #define pcret_get_first_set pcre_get_first_set 63 | #define pcret_get_stringtable_entries pcre_get_stringtable_entries 64 | #define pcret_get_substring pcre_get_substring 65 | #define pcret_get_substring_list pcre_get_substring_list 66 | #define pcret_maketables pcre_maketables 67 | #define pcret_refcount pcre_refcount 68 | #define pcret_study pcre_study 69 | #define pcret_free_study pcre_free_study 70 | #define pcret_version pcre_version 71 | #define pcret_pattern_to_host_byte_order pcre_pattern_to_host_byte_order 72 | #define pcret_jit_stack_alloc pcre_jit_stack_alloc 73 | #define pcret_jit_stack_free pcre_jit_stack_free 74 | #define pcret_assign_jit_stack pcre_assign_jit_stack 75 | 76 | #endif -------------------------------------------------------------------------------- /source/StringConv.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "KuString.h" 3 | #include "StringConv.h" 4 | #include "util.h" 5 | 6 | #ifdef _WIN32 7 | LPCWSTR StringUTF8ToWChar(LPCSTR sUTF8, CStringW &sWChar, int iChars/* = -1*/) 8 | { 9 | if (!sUTF8) 10 | return NULL; 11 | 12 | sWChar.Empty(); 13 | int iLen = MultiByteToWideChar(CP_UTF8, 0, sUTF8, iChars, NULL, 0); 14 | if (iLen > 0) { 15 | LPWSTR sBuf = sWChar.GetBufferSetLength(iLen); 16 | iLen = MultiByteToWideChar(CP_UTF8, 0, sUTF8, iChars, sBuf, iLen); 17 | sWChar.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1); 18 | return (iLen > 0) ? sWChar.GetString() : NULL; 19 | } 20 | 21 | return *sUTF8 != 0 ? sWChar.GetString() : NULL; 22 | } 23 | 24 | LPCWSTR StringCharToWChar(LPCSTR sChar, CStringW &sWChar, int iChars/* = -1*/, UINT codepage/* = CP_ACP*/) 25 | { 26 | if (!sChar) 27 | return NULL; 28 | 29 | sWChar.Empty(); 30 | int iLen = MultiByteToWideChar(codepage, 0, sChar, iChars, NULL, 0); 31 | if (iLen > 0) { 32 | LPWSTR sBuf = sWChar.GetBufferSetLength(iLen); 33 | MultiByteToWideChar(codepage, 0, sChar, iChars, sBuf, iLen); 34 | sWChar.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1); 35 | return (iLen > 0) ? sWChar.GetString() : NULL; 36 | } 37 | 38 | return (*sChar != 0) ? sWChar.GetString() : NULL; 39 | } 40 | 41 | LPCSTR StringWCharToUTF8(LPCWSTR sWChar, CStringA &sUTF8, int iChars/* = -1*/) 42 | { 43 | if (!sWChar) 44 | return NULL; 45 | 46 | sUTF8.Empty(); 47 | int iLen = WideCharToMultiByte(CP_UTF8, 0, sWChar, iChars, NULL, 0, NULL, NULL); 48 | if (iLen > 0) { 49 | LPSTR sBuf = sUTF8.GetBufferSetLength(iLen); 50 | WideCharToMultiByte(CP_UTF8, 0, sWChar, iChars, sBuf, iLen, NULL, NULL); 51 | sUTF8.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1); 52 | return (iLen > 0) ? sUTF8.GetString() : NULL; 53 | } 54 | 55 | return (*sWChar != 0) ? sUTF8.GetString() : NULL; 56 | } 57 | 58 | LPCSTR StringCharToUTF8(LPCSTR sChar, CStringA &sUTF8, int iChars/* = -1*/, UINT codepage/* = CP_ACP*/) 59 | { 60 | return StringWCharToUTF8(CStringWCharFromChar(sChar, iChars, codepage), sUTF8); 61 | } 62 | 63 | LPCSTR StringWCharToChar(LPCWSTR sWChar, CStringA &sChar, int iChars/* = -1*/, char chDef/* = '?'*/, UINT codepage/* = CP_ACP*/) 64 | { 65 | if (!sWChar) 66 | return NULL; 67 | 68 | sChar.Empty(); 69 | int iLen = WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, sWChar, iChars, NULL, 0, &chDef, NULL); 70 | if (iLen > 0) { 71 | LPSTR sBuf = sChar.GetBufferSetLength(iLen); 72 | WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, sWChar, iChars, sBuf, iLen, &chDef, NULL); 73 | sChar.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1); 74 | return (iLen > 0) ? sChar.GetString() : NULL; 75 | } 76 | 77 | return (*sWChar != 0) ? sChar.GetString() : NULL; 78 | } 79 | 80 | LPCSTR StringUTF8ToChar(LPCSTR sUTF8, CStringA &sChar, int iChars/* = -1*/, char chDef/* = '?'*/, UINT codepage/* = CP_ACP*/) 81 | { 82 | return StringWCharToChar(CStringWCharFromUTF8(sUTF8, iChars), sChar, iChars, chDef, codepage); 83 | } 84 | #endif 85 | 86 | template 87 | SRC_T _StringDummyConv(SRC_T sSrc, DEST_T &sDest, int iChars = -1) 88 | { 89 | if (!sSrc) 90 | return NULL; 91 | if (iChars >= 0) 92 | sDest.SetString(sSrc, iChars); 93 | else 94 | sDest = sSrc; 95 | return sDest; 96 | } 97 | 98 | LPCWSTR _StringDummyConvW(LPCWSTR sSrc, CStringW &sDest, int iChars/* = -1*/) 99 | { 100 | return _StringDummyConv(sSrc, sDest, iChars); 101 | } 102 | 103 | LPCSTR _StringDummyConvA(LPCSTR sSrc, CStringA &sDest, int iChars/* = -1*/) 104 | { 105 | return _StringDummyConv(sSrc, sDest, iChars); 106 | } 107 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_ord2utf8.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This file contains a private PCRE function that converts an ordinal 42 | character value into a UTF8 string. */ 43 | 44 | #ifdef HAVE_CONFIG_H 45 | #include "config.h" 46 | #endif 47 | 48 | #include "pcre_internal.h" 49 | 50 | 51 | /************************************************* 52 | * Convert character value to UTF-8 * 53 | *************************************************/ 54 | 55 | /* This function takes an integer value in the range 0 - 0x10ffff 56 | and encodes it as a UTF-8 character in 1 to 6 pcre_uchars. 57 | 58 | Arguments: 59 | cvalue the character value 60 | buffer pointer to buffer for result - at least 6 pcre_uchars long 61 | 62 | Returns: number of characters placed in the buffer 63 | */ 64 | 65 | int 66 | PRIV(ord2utf)(pcre_uint32 cvalue, pcre_uchar *buffer) 67 | { 68 | #ifdef SUPPORT_UTF 69 | 70 | register int i, j; 71 | 72 | /* Checking invalid cvalue character, encoded as invalid UTF-16 character. 73 | Should never happen in practice. */ 74 | if ((cvalue & 0xf800) == 0xd800 || cvalue >= 0x110000) 75 | cvalue = 0xfffe; 76 | 77 | for (i = 0; i < PRIV(utf8_table1_size); i++) 78 | if ((int)cvalue <= PRIV(utf8_table1)[i]) break; 79 | buffer += i; 80 | for (j = i; j > 0; j--) 81 | { 82 | *buffer-- = 0x80 | (cvalue & 0x3f); 83 | cvalue >>= 6; 84 | } 85 | *buffer = PRIV(utf8_table2)[i] | cvalue; 86 | return i + 1; 87 | 88 | #else 89 | 90 | (void)(cvalue); /* Keep compiler happy; this function won't ever be */ 91 | (void)(buffer); /* called when SUPPORT_UTF is not defined. */ 92 | return 0; 93 | 94 | #endif 95 | } 96 | 97 | /* End of pcre_ord2utf8.c */ 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoHotkey # 2 | 3 | AutoHotkey is a free, open source macro-creation and automation software utility that allows users to automate repetitive tasks. It is driven by a custom scripting language that has special provision for defining keyboard shortcuts, otherwise known as hotkeys. 4 | 5 | https://www.autohotkey.com/ 6 | 7 | 8 | ## Support ## 9 | 10 | The [AutoHotkey Community forum](https://www.autohotkey.com/boards/) is the primary source of support for AutoHotkey. 11 | 12 | AutoHotkey v1 is not being maintained, but support is provided by community members. 13 | 14 | * **Scripts not working**: For assistance getting code AutoHotkey scripts to work the way you want, start a topic in the [Ask for Help (v2)](https://www.autohotkey.com/boards/viewforum.php?f=82) or [Ask for Help (v1)](https://www.autohotkey.com/boards/viewforum.php?f=76) subforum, depending on your AutoHotkey version. 15 | * **Bug reporting**: If in doubt about the nature of your issue, please post in [Ask for Help (v2)](https://www.autohotkey.com/boards/viewforum.php?f=82) for confirmation. Otherwise, bugs should be reported in the [Bug Reports](https://www.autohotkey.com/boards/viewforum.php?f=14) subforum. 16 | * **False positives**: If you notice any AutoHotkey files (downloaded from official sources) are being flagged as suspicious or a virus, they are likely false positives. Please refer to our page on how to resolve or report these [here](https://www.autohotkey.com/download/safe.htm). 17 | * **Other development topics**: For any other development related enquiries, please utilize the [AutoHotkey Development](https://www.autohotkey.com/boards/viewforum.php?f=37) subforum. 18 | 19 | 20 | ## How to Compile ## 21 | 22 | AutoHotkey is developed with [Microsoft Visual Studio Community 2022](https://www.visualstudio.com/products/visual-studio-community-vs), which is a free download from Microsoft. 23 | 24 | - Get the source code. 25 | - Open AutoHotkeyx.sln in Visual Studio. 26 | - Select the appropriate Build and Platform. 27 | - Build. 28 | 29 | The project is configured in a way that allows building with Visual Studio 2012 or later, but only the 2022 toolset is regularly tested. Some newer C++ language features are used and therefore a later version of the compiler might be required. 30 | 31 | 32 | ## Developing in VS Code ## 33 | 34 | AutoHotkey v2 can also be built and debugged in VS Code. 35 | 36 | Requirements: 37 | - [C/C++ for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools). VS Code might prompt you to install this if you open a .cpp file. 38 | - [Build Tools for Visual Studio 2022](https://aka.ms/vs/17/release/vs_BuildTools.exe) with the "Desktop development with C++" workload, or similar (some older or newer versions and different products should work). 39 | 40 | 41 | 42 | ## Build Configurations ## 43 | 44 | AutoHotkeyx.vcxproj contains several combinations of build configurations. The main configurations are: 45 | 46 | - **Debug**: AutoHotkey.exe in debug mode. 47 | - **Release**: AutoHotkey.exe for general use. 48 | - **Self-contained**: AutoHotkeySC.bin, used for compiled scripts. 49 | 50 | Secondary configurations are: 51 | 52 | - **(mbcs)**: ANSI (multi-byte character set). Configurations without this suffix are Unicode. 53 | - **.dll**: Builds an experimental dll for use hosting the interpreter, such as to enable the use of v1 libraries in a v2 script. See [README-LIB.md](README-LIB.md). 54 | 55 | 56 | ## Platforms ## 57 | 58 | AutoHotkeyx.vcxproj includes the following Platforms: 59 | 60 | - **Win32**: for Windows 32-bit. 61 | - **x64**: for Windows x64. 62 | 63 | AutoHotkey supports Windows XP with or without service packs and Windows 2000 via an asm patch (win2kcompat.asm). Support may be removed if maintaining it becomes non-trivial. Older versions are not supported. 64 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_ord2utf16.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This file contains a private PCRE function that converts an ordinal 42 | character value into a UTF16 string. */ 43 | 44 | #ifdef HAVE_CONFIG_H 45 | #include "config.h" 46 | #endif 47 | 48 | /* Generate code with 16 bit character support. */ 49 | #define COMPILE_PCRE16 50 | 51 | #include "pcre_internal.h" 52 | 53 | /************************************************* 54 | * Convert character value to UTF-16 * 55 | *************************************************/ 56 | 57 | /* This function takes an integer value in the range 0 - 0x10ffff 58 | and encodes it as a UTF-16 character in 1 to 2 pcre_uchars. 59 | 60 | Arguments: 61 | cvalue the character value 62 | buffer pointer to buffer for result - at least 2 pcre_uchars long 63 | 64 | Returns: number of characters placed in the buffer 65 | */ 66 | 67 | int 68 | PRIV(ord2utf)(pcre_uint32 cvalue, pcre_uchar *buffer) 69 | { 70 | #ifdef SUPPORT_UTF 71 | 72 | /* Checking invalid cvalue character, encoded as invalid UTF-16 character. 73 | Should never happen in practice. */ 74 | if ((cvalue & 0xf800) == 0xd800 || cvalue >= 0x110000) 75 | cvalue = 0xfffe; 76 | 77 | if (cvalue <= 0xffff) 78 | { 79 | *buffer = (pcre_uchar)cvalue; 80 | return 1; 81 | } 82 | 83 | cvalue -= 0x10000; 84 | *buffer++ = 0xd800 | (cvalue >> 10); 85 | *buffer = 0xdc00 | (cvalue & 0x3ff); 86 | return 2; 87 | 88 | #else /* SUPPORT_UTF */ 89 | (void)(cvalue); /* Keep compiler happy; this function won't ever be */ 90 | (void)(buffer); /* called when SUPPORT_UTF is not defined. */ 91 | return 0; 92 | #endif /* SUPPORT_UTF */ 93 | } 94 | 95 | /* End of pcre16_ord2utf16.c */ 96 | -------------------------------------------------------------------------------- /source/SimpleHeap.h: -------------------------------------------------------------------------------- 1 | /* 2 | AutoHotkey 3 | 4 | Copyright 2003-2009 Chris Mallett (support@autohotkey.com) 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | 17 | #ifndef SimpleHeap_h 18 | #define SimpleHeap_h 19 | 20 | // In a large script (200 KB of text) of a typical nature, using SimpleHeap rather than malloc() saves 21 | // nearly 200 KB of memory as shown by Task Manager's "VM Size" column (2384 vs. 2580 KB). 22 | // This is because many callers allocate chunks of memory that are very small on average. If each 23 | // such chunk were allocated with malloc (or worse, "new"), the percentage of system overhead 24 | // compared to the memory actually used for such blocks would be enormous (perhaps 40 bytes of 25 | // overhead for each malloc(), even if it's only for 3 or 4 bytes). In addition, SimpleHeap improves 26 | // performance to the extent that it is faster than malloc(), which it almost certainly is. Finally, 27 | // the OS's overall memory fragmentation may be reduced, especially if the app uses this class over 28 | // a long period of time (hours or days). 29 | 30 | // The size of each block in bytes. Use a size that's a good compromise 31 | // of avg. wastage vs. reducing memory fragmentation and overhead. 32 | // Update: reduced it from 64K to 32K since many scripts tend to be small. 33 | // Update 2 (fincs): Use twice as big blocks when compiling for Unicode because 34 | // Unicode strings are twice as large. 35 | #define BLOCK_SIZE (32 * 1024 * sizeof(TCHAR)) // Relied upon by Malloc() to be a multiple of 4. 36 | // The maximum size for a new allocation when a new block must be created to fulfill it. 37 | // Allocations under this size might cause wasted space at the end of the previous block. 38 | #define MAX_ALLOC_IN_NEW_BLOCK (1024 * sizeof(TCHAR)) 39 | 40 | class SimpleHeap 41 | { 42 | private: 43 | char *mBlock; // This object's memory block. Although private, its contents are public. 44 | char *mFreeMarker; // Address inside the above block of the first unused byte. 45 | size_t mSpaceAvailable; 46 | static UINT sBlockCount; 47 | static SimpleHeap *sFirst, *sLast; // The first and last objects in the linked list. 48 | static char *sMostRecentlyAllocated; // For use with Delete(). 49 | SimpleHeap *mNextBlock; // The object after this one in the linked list; NULL if none. 50 | 51 | static SimpleHeap *CreateBlock(); 52 | SimpleHeap(); // Private constructor, since we want only the static methods to be able to create new objects. 53 | ~SimpleHeap(); 54 | 55 | static LPTSTR strDup(LPCTSTR aBuf, size_t aLength = -1); // Return a block of memory to the caller and copy aBuf into it. 56 | 57 | public: 58 | // Return a block of memory to the caller with aBuf copied into it. Returns nullptr on failure. 59 | static LPTSTR Malloc(LPCTSTR aBuf, size_t aLength = -1); 60 | 61 | // Return a block of memory to the caller with aBuf copied into it. Terminates app on failure. 62 | static LPTSTR Alloc(LPCTSTR aBuf, size_t aLength = -1); 63 | 64 | // Return a block of memory to the caller, or nullptr on failure. 65 | static void* Malloc(size_t aSize); 66 | 67 | // Return a block of memory to the caller, or terminate app on failure. 68 | static void* Alloc(size_t aSize); 69 | 70 | static void Delete(void *aPtr); 71 | //static void DeleteAll(); 72 | 73 | static void CriticalFail(); 74 | 75 | template 76 | static T* Alloc(size_t aCount = 1) 77 | { 78 | return (T *)Alloc(sizeof(T) * aCount); 79 | } 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /source/DispObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | DispObject.h 3 | 4 | Original code by Steve Gray. 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, without restriction. 13 | */ 14 | 15 | #pragma once 16 | 17 | 18 | // DispObject : Template for boiler-plate IDispatch objects. 19 | template 20 | class DispObject : public I { 21 | public: 22 | // IUnknown 23 | STDMETHOD_(ULONG, AddRef)(); 24 | STDMETHOD_(ULONG, Release)(); 25 | STDMETHOD(QueryInterface)(REFIID iid, void** ppv); 26 | 27 | // IDispatch 28 | STDMETHOD(GetTypeInfoCount)(UINT* pCountTypeInfo); 29 | STDMETHOD(GetTypeInfo)(UINT iTypeInfo, LCID lcid, ITypeInfo** ppITypeInfo); 30 | STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId); 31 | STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams 32 | , VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr); 33 | 34 | DispObject(ITypeInfo *typeInfo) : m_cRef(1), m_pTypeInfo(typeInfo) {} 35 | ~DispObject(); 36 | 37 | typedef I *DispInterface; 38 | 39 | private: 40 | ULONG m_cRef; 41 | ITypeInfo* m_pTypeInfo; 42 | }; 43 | 44 | 45 | HRESULT LoadMyTypeInfo(REFIID riid, ITypeInfo **ppTypeInfo); 46 | 47 | 48 | template 49 | HRESULT CreateDispatchInstance(I **ppInst) 50 | { 51 | ITypeInfo *typeInfo; 52 | auto hr = LoadMyTypeInfo(__uuidof(T::DispInterface), &typeInfo); 53 | if (FAILED(hr)) 54 | { 55 | *ppInst = nullptr; 56 | return hr; 57 | } 58 | *ppInst = new T(typeInfo); 59 | return S_OK; 60 | } 61 | 62 | 63 | template 64 | DispObject::~DispObject() 65 | { 66 | if (m_pTypeInfo) 67 | m_pTypeInfo->Release(); 68 | } 69 | 70 | 71 | // 72 | // IUnknown methods 73 | // 74 | 75 | template 76 | STDMETHODIMP DispObject::QueryInterface(REFIID iid, void ** ppv) 77 | { 78 | if (iid == IID_IUnknown) 79 | *ppv = static_cast(this); 80 | else if (iid == __uuidof(I)) 81 | *ppv = static_cast(this); 82 | else if (iid == IID_IDispatch) 83 | *ppv = static_cast(this); 84 | else 85 | { 86 | *ppv = NULL; 87 | return E_NOINTERFACE; 88 | } 89 | AddRef(); 90 | return S_OK; 91 | } 92 | 93 | template 94 | STDMETHODIMP_(ULONG) DispObject::AddRef() 95 | { 96 | return ++m_cRef; 97 | } 98 | 99 | template 100 | STDMETHODIMP_(ULONG) DispObject::Release() 101 | { 102 | if (--m_cRef != 0) 103 | return m_cRef; 104 | delete this; 105 | return 0; 106 | } 107 | 108 | 109 | // 110 | // IDispatch methods 111 | // 112 | 113 | template 114 | STDMETHODIMP DispObject::GetTypeInfoCount(UINT * pCountTypeInfo) 115 | { 116 | *pCountTypeInfo = 1; 117 | return S_OK; 118 | } 119 | 120 | template 121 | STDMETHODIMP DispObject::GetTypeInfo(UINT iTypeInfo, LCID lcid, ITypeInfo ** ppITypeInfo) 122 | { 123 | if (iTypeInfo != 0) 124 | return DISP_E_BADINDEX; 125 | m_pTypeInfo->AddRef(); 126 | *ppITypeInfo = m_pTypeInfo; 127 | return S_OK; 128 | } 129 | 130 | template 131 | STDMETHODIMP DispObject::GetIDsOfNames(REFIID riid, LPOLESTR * rgszNames, UINT cNames, LCID lcid, DISPID * rgDispId) 132 | { 133 | return m_pTypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId); 134 | } 135 | 136 | template 137 | STDMETHODIMP DispObject::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pDispParams, VARIANT * pVarResult, EXCEPINFO * pExcepInfo, UINT * puArgErr) 138 | { 139 | return m_pTypeInfo->Invoke(static_cast(this), dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 140 | } -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_refcount.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains the external function pcre_refcount(), which is an 42 | auxiliary function that can be used to maintain a reference count in a compiled 43 | pattern data block. This might be helpful in applications where the block is 44 | shared by different users. */ 45 | 46 | 47 | #ifdef HAVE_CONFIG_H 48 | #include "config.h" 49 | #endif 50 | 51 | #include "pcre_internal.h" 52 | 53 | 54 | /************************************************* 55 | * Maintain reference count * 56 | *************************************************/ 57 | 58 | /* The reference count is a 16-bit field, initialized to zero. It is not 59 | possible to transfer a non-zero count from one host to a different host that 60 | has a different byte order - though I can't see why anyone in their right mind 61 | would ever want to do that! 62 | 63 | Arguments: 64 | argument_re points to compiled code 65 | adjust value to add to the count 66 | 67 | Returns: the (possibly updated) count value (a non-negative number), or 68 | a negative error number 69 | */ 70 | 71 | #ifdef COMPILE_PCRE8 72 | PCRE_EXP_DEFN int PCRE_CALL_CONVENTION 73 | pcre_refcount(pcre *argument_re, int adjust) 74 | #else 75 | PCRE_EXP_DEFN int PCRE_CALL_CONVENTION 76 | pcre16_refcount(pcre16 *argument_re, int adjust) 77 | #endif 78 | { 79 | REAL_PCRE *re = (REAL_PCRE *)argument_re; 80 | if (re == NULL) return PCRE_ERROR_NULL; 81 | if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; 82 | if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE; 83 | re->ref_count = (-adjust > re->ref_count)? 0 : 84 | (adjust + re->ref_count > 65535)? 65535 : 85 | re->ref_count + adjust; 86 | return re->ref_count; 87 | } 88 | 89 | /* End of pcre_refcount.c */ 90 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_globals.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains global variables that are exported by the PCRE library. 42 | PCRE is thread-clean and doesn't use any global variables in the normal sense. 43 | However, it calls memory allocation and freeing functions via the four 44 | indirections below, and it can optionally do callouts, using the fifth 45 | indirection. These values can be changed by the caller, but are shared between 46 | all threads. 47 | 48 | For MS Visual Studio and Symbian OS, there are problems in initializing these 49 | variables to non-local functions. In these cases, therefore, an indirection via 50 | a local function is used. 51 | 52 | Also, when compiling for Virtual Pascal, things are done differently, and 53 | global variables are not used. */ 54 | 55 | #ifdef HAVE_CONFIG_H 56 | #include "config.h" 57 | #endif 58 | 59 | #include "pcre_internal.h" 60 | 61 | #if defined _MSC_VER || defined __SYMBIAN32__ 62 | static void* LocalPcreMalloc(size_t aSize) 63 | { 64 | return malloc(aSize); 65 | } 66 | static void LocalPcreFree(void* aPtr) 67 | { 68 | free(aPtr); 69 | } 70 | PCRE_EXP_DATA_DEFN void *(*PUBL(malloc))(size_t) = LocalPcreMalloc; 71 | PCRE_EXP_DATA_DEFN void (*PUBL(free))(void *) = LocalPcreFree; 72 | PCRE_EXP_DATA_DEFN void *(*PUBL(stack_malloc))(size_t) = LocalPcreMalloc; 73 | PCRE_EXP_DATA_DEFN void (*PUBL(stack_free))(void *) = LocalPcreFree; 74 | PCRE_EXP_DATA_DEFN int (*PUBL(callout))(PUBL(callout_block) *) = NULL; 75 | 76 | #elif !defined VPCOMPAT 77 | PCRE_EXP_DATA_DEFN void *(*PUBL(malloc))(size_t) = malloc; 78 | PCRE_EXP_DATA_DEFN void (*PUBL(free))(void *) = free; 79 | PCRE_EXP_DATA_DEFN void *(*PUBL(stack_malloc))(size_t) = malloc; 80 | PCRE_EXP_DATA_DEFN void (*PUBL(stack_free))(void *) = free; 81 | PCRE_EXP_DATA_DEFN int (*PUBL(callout))(PUBL(callout_block) *) = NULL; 82 | 83 | #endif 84 | 85 | /* End of pcre_globals.c */ 86 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/sljit/sljitConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Stack-less Just-In-Time compiler 3 | * 4 | * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without modification, are 7 | * permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, this list of 10 | * conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 13 | * of conditions and the following disclaimer in the documentation and/or other materials 14 | * provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 22 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef _SLJIT_CONFIG_H_ 28 | #define _SLJIT_CONFIG_H_ 29 | 30 | /* --------------------------------------------------------------------- */ 31 | /* Architecture */ 32 | /* --------------------------------------------------------------------- */ 33 | 34 | /* Architecture selection */ 35 | /* #define SLJIT_CONFIG_X86_32 1 */ 36 | /* #define SLJIT_CONFIG_X86_64 1 */ 37 | /* #define SLJIT_CONFIG_ARM_V5 1 */ 38 | /* #define SLJIT_CONFIG_ARM_V7 1 */ 39 | /* #define SLJIT_CONFIG_ARM_THUMB2 1 */ 40 | /* #define SLJIT_CONFIG_PPC_32 1 */ 41 | /* #define SLJIT_CONFIG_PPC_64 1 */ 42 | /* #define SLJIT_CONFIG_MIPS_32 1 */ 43 | 44 | /* #define SLJIT_CONFIG_AUTO 1 */ 45 | /* #define SLJIT_CONFIG_UNSUPPORTED 1 */ 46 | 47 | /* --------------------------------------------------------------------- */ 48 | /* Utilities */ 49 | /* --------------------------------------------------------------------- */ 50 | 51 | /* Useful for thread-safe compiling of global functions. */ 52 | #ifndef SLJIT_UTIL_GLOBAL_LOCK 53 | /* Enabled by default */ 54 | #define SLJIT_UTIL_GLOBAL_LOCK 1 55 | #endif 56 | 57 | /* Implements a stack like data structure (by using mmap / VirtualAlloc). */ 58 | #ifndef SLJIT_UTIL_STACK 59 | /* Enabled by default */ 60 | #define SLJIT_UTIL_STACK 1 61 | #endif 62 | 63 | /* --------------------------------------------------------------------- */ 64 | /* Configuration */ 65 | /* --------------------------------------------------------------------- */ 66 | 67 | /* If SLJIT_STD_MACROS_DEFINED is not defined, the application should 68 | define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMMOVE, and NULL. */ 69 | #ifndef SLJIT_STD_MACROS_DEFINED 70 | /* Disabled by default. */ 71 | #define SLJIT_STD_MACROS_DEFINED 0 72 | #endif 73 | 74 | /* Executable code allocation: 75 | If SLJIT_EXECUTABLE_ALLOCATOR is not defined, the application should 76 | define both SLJIT_MALLOC_EXEC and SLJIT_FREE_EXEC. */ 77 | #ifndef SLJIT_EXECUTABLE_ALLOCATOR 78 | /* Enabled by default. */ 79 | #define SLJIT_EXECUTABLE_ALLOCATOR 1 80 | #endif 81 | 82 | /* Debug checks (assertions, etc.). */ 83 | #ifndef SLJIT_DEBUG 84 | /* Enabled by default */ 85 | #define SLJIT_DEBUG 1 86 | #endif 87 | 88 | /* Verbose operations */ 89 | #ifndef SLJIT_VERBOSE 90 | /* Enabled by default */ 91 | #define SLJIT_VERBOSE 1 92 | #endif 93 | 94 | /* See the beginning of sljitConfigInternal.h */ 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/ucp.h: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Unicode Property Table handler * 3 | *************************************************/ 4 | 5 | #ifndef _UCP_H 6 | #define _UCP_H 7 | 8 | /* This file contains definitions of the property values that are returned by 9 | the UCD access macros. New values that are added for new releases of Unicode 10 | should always be at the end of each enum, for backwards compatibility. */ 11 | 12 | /* These are the general character categories. */ 13 | 14 | enum { 15 | ucp_C, /* Other */ 16 | ucp_L, /* Letter */ 17 | ucp_M, /* Mark */ 18 | ucp_N, /* Number */ 19 | ucp_P, /* Punctuation */ 20 | ucp_S, /* Symbol */ 21 | ucp_Z /* Separator */ 22 | }; 23 | 24 | /* These are the particular character types. */ 25 | 26 | enum { 27 | ucp_Cc, /* Control */ 28 | ucp_Cf, /* Format */ 29 | ucp_Cn, /* Unassigned */ 30 | ucp_Co, /* Private use */ 31 | ucp_Cs, /* Surrogate */ 32 | ucp_Ll, /* Lower case letter */ 33 | ucp_Lm, /* Modifier letter */ 34 | ucp_Lo, /* Other letter */ 35 | ucp_Lt, /* Title case letter */ 36 | ucp_Lu, /* Upper case letter */ 37 | ucp_Mc, /* Spacing mark */ 38 | ucp_Me, /* Enclosing mark */ 39 | ucp_Mn, /* Non-spacing mark */ 40 | ucp_Nd, /* Decimal number */ 41 | ucp_Nl, /* Letter number */ 42 | ucp_No, /* Other number */ 43 | ucp_Pc, /* Connector punctuation */ 44 | ucp_Pd, /* Dash punctuation */ 45 | ucp_Pe, /* Close punctuation */ 46 | ucp_Pf, /* Final punctuation */ 47 | ucp_Pi, /* Initial punctuation */ 48 | ucp_Po, /* Other punctuation */ 49 | ucp_Ps, /* Open punctuation */ 50 | ucp_Sc, /* Currency symbol */ 51 | ucp_Sk, /* Modifier symbol */ 52 | ucp_Sm, /* Mathematical symbol */ 53 | ucp_So, /* Other symbol */ 54 | ucp_Zl, /* Line separator */ 55 | ucp_Zp, /* Paragraph separator */ 56 | ucp_Zs /* Space separator */ 57 | }; 58 | 59 | /* These are the script identifications. */ 60 | 61 | enum { 62 | ucp_Arabic, 63 | ucp_Armenian, 64 | ucp_Bengali, 65 | ucp_Bopomofo, 66 | ucp_Braille, 67 | ucp_Buginese, 68 | ucp_Buhid, 69 | ucp_Canadian_Aboriginal, 70 | ucp_Cherokee, 71 | ucp_Common, 72 | ucp_Coptic, 73 | ucp_Cypriot, 74 | ucp_Cyrillic, 75 | ucp_Deseret, 76 | ucp_Devanagari, 77 | ucp_Ethiopic, 78 | ucp_Georgian, 79 | ucp_Glagolitic, 80 | ucp_Gothic, 81 | ucp_Greek, 82 | ucp_Gujarati, 83 | ucp_Gurmukhi, 84 | ucp_Han, 85 | ucp_Hangul, 86 | ucp_Hanunoo, 87 | ucp_Hebrew, 88 | ucp_Hiragana, 89 | ucp_Inherited, 90 | ucp_Kannada, 91 | ucp_Katakana, 92 | ucp_Kharoshthi, 93 | ucp_Khmer, 94 | ucp_Lao, 95 | ucp_Latin, 96 | ucp_Limbu, 97 | ucp_Linear_B, 98 | ucp_Malayalam, 99 | ucp_Mongolian, 100 | ucp_Myanmar, 101 | ucp_New_Tai_Lue, 102 | ucp_Ogham, 103 | ucp_Old_Italic, 104 | ucp_Old_Persian, 105 | ucp_Oriya, 106 | ucp_Osmanya, 107 | ucp_Runic, 108 | ucp_Shavian, 109 | ucp_Sinhala, 110 | ucp_Syloti_Nagri, 111 | ucp_Syriac, 112 | ucp_Tagalog, 113 | ucp_Tagbanwa, 114 | ucp_Tai_Le, 115 | ucp_Tamil, 116 | ucp_Telugu, 117 | ucp_Thaana, 118 | ucp_Thai, 119 | ucp_Tibetan, 120 | ucp_Tifinagh, 121 | ucp_Ugaritic, 122 | ucp_Yi, 123 | /* New for Unicode 5.0: */ 124 | ucp_Balinese, 125 | ucp_Cuneiform, 126 | ucp_Nko, 127 | ucp_Phags_Pa, 128 | ucp_Phoenician, 129 | /* New for Unicode 5.1: */ 130 | ucp_Carian, 131 | ucp_Cham, 132 | ucp_Kayah_Li, 133 | ucp_Lepcha, 134 | ucp_Lycian, 135 | ucp_Lydian, 136 | ucp_Ol_Chiki, 137 | ucp_Rejang, 138 | ucp_Saurashtra, 139 | ucp_Sundanese, 140 | ucp_Vai, 141 | /* New for Unicode 5.2: */ 142 | ucp_Avestan, 143 | ucp_Bamum, 144 | ucp_Egyptian_Hieroglyphs, 145 | ucp_Imperial_Aramaic, 146 | ucp_Inscriptional_Pahlavi, 147 | ucp_Inscriptional_Parthian, 148 | ucp_Javanese, 149 | ucp_Kaithi, 150 | ucp_Lisu, 151 | ucp_Meetei_Mayek, 152 | ucp_Old_South_Arabian, 153 | ucp_Old_Turkic, 154 | ucp_Samaritan, 155 | ucp_Tai_Tham, 156 | ucp_Tai_Viet, 157 | /* New for Unicode 6.0.0: */ 158 | ucp_Batak, 159 | ucp_Brahmi, 160 | ucp_Mandaic 161 | }; 162 | 163 | #endif 164 | 165 | /* End of ucp.h */ 166 | -------------------------------------------------------------------------------- /source/script_func_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #define ParamIndexToString(index, ...) TokenToString(*aParam[(index)], __VA_ARGS__) 3 | #define ParamIndexToInt64(index) TokenToInt64(*aParam[(index)]) 4 | #define ParamIndexToInt(index) (int)ParamIndexToInt64(index) 5 | #define ParamIndexToIntPtr(index) (INT_PTR)ParamIndexToInt64(index) 6 | #define ParamIndexToDouble(index) TokenToDouble(*aParam[(index)]) 7 | #define ParamIndexToNumber(index, output) TokenToDoubleOrInt64(*aParam[(index)], output) 8 | #define ParamIndexToBOOL(index) TokenToBOOL(*aParam[(index)]) 9 | #define ParamIndexToObject(index) TokenToObject(*aParam[(index)]) 10 | #define ParamIndexToToggleValue(index) TokenToToggleValue(*aParam[(index)]) 11 | 12 | #define ParamIndexToOutputVar(index) ((index) < aParamCount ? TokenToOutputVar(*aParam[(index)]) : nullptr) 13 | 14 | // Omitted parameter returns SCS_INSENSITIVE. 15 | #define ParamIndexToCaseSense(index) (ParamIndexIsOmitted((index)) ? SCS_INSENSITIVE : TokenToStringCase(*aParam[(index)])) 16 | 17 | #define ParamIndexIsNumeric(index) (TokenIsNumeric(*aParam[(index)])) 18 | 19 | // For functions that allow "" to mean parameter is omitted. 20 | #define ParamIndexIsOmittedOrEmpty(index) (ParamIndexIsOmitted(index) || TokenIsEmptyString(*aParam[(index)])) 21 | 22 | // For functions that don't allow "" to mean parameter is omitted. 23 | #define ParamIndexIsOmitted(index) ((index) >= aParamCount || aParam[(index)]->symbol == SYM_MISSING) 24 | 25 | #define PASTE(a, b) a##b 26 | 27 | #define ParamIndexToOptionalType(type, index, def) (ParamIndexIsOmitted(index) ? (def) : PASTE(ParamIndexTo,type)(index)) 28 | #define ParamIndexToOptionalInt(index, def) ParamIndexToOptionalType(Int, index, def) 29 | #define ParamIndexToOptionalIntPtr(index, def) ParamIndexToOptionalType(IntPtr, index, def) 30 | #define ParamIndexToOptionalDouble(index, def) ParamIndexToOptionalType(Double, index, def) 31 | #define ParamIndexToOptionalInt64(index, def) ParamIndexToOptionalType(Int64, index, def) 32 | #define ParamIndexToOptionalBOOL(index, def) ParamIndexToOptionalType(BOOL, index, def) 33 | #define ParamIndexToOptionalVar(index) (((index) < aParamCount && aParam[index]->symbol == SYM_VAR) ? aParam[index]->var : NULL) 34 | 35 | inline LPTSTR _OptionalStringDefaultHelper(LPTSTR aDef, LPTSTR aBuf = NULL, size_t *aLength = NULL, bool aPermitObject = false) 36 | { 37 | if (aLength) 38 | *aLength = _tcslen(aDef); 39 | return aDef; 40 | } 41 | #define ParamIndexToOptionalStringDef(index, def, ...) \ 42 | (ParamIndexIsOmitted(index) ? _OptionalStringDefaultHelper(def, __VA_ARGS__) \ 43 | : ParamIndexToString(index, __VA_ARGS__)) 44 | // The macro below defaults to "", since that is by far the most common default. 45 | // No check for SYM_MISSING is needed since TokenToString() returns "" for that. 46 | #define ParamIndexToOptionalString(index, ...) \ 47 | (((index) < aParamCount) ? ParamIndexToString(index, __VA_ARGS__) \ 48 | : _OptionalStringDefaultHelper(_T(""), __VA_ARGS__)) 49 | 50 | #define ParamIndexToOptionalObject(index) ((index) < aParamCount ? ParamIndexToObject(index) : NULL) 51 | 52 | #define _f_param_string(name, index, ...) \ 53 | TCHAR name##_buf[MAX_NUMBER_SIZE], *name; \ 54 | if (!TokenToStringParam(aResultToken, aParam, index, name##_buf, name, __VA_ARGS__)) return 55 | #define _f_param_string_opt_def(name, index, def, ...) \ 56 | TCHAR name##_buf[MAX_NUMBER_SIZE], *name; \ 57 | if (ParamIndexIsOmitted(index)) name = _OptionalStringDefaultHelper(def, name##_buf, __VA_ARGS__); else \ 58 | if (!TokenToStringParam(aResultToken, aParam, index, name##_buf, name, __VA_ARGS__)) return 59 | #define _f_param_string_opt(name, index, ...) \ 60 | _f_param_string_opt_def(name, index, _T(""), __VA_ARGS__) 61 | 62 | #define Throw_if_Param_NaN(ParamIndex) \ 63 | if (!TokenIsNumeric(*aParam[(ParamIndex)])) \ 64 | _f_throw_param((ParamIndex), _T("Number")) 65 | 66 | 67 | #define Throw_if_RValue_NaN() \ 68 | if (!TokenIsNumeric(aValue)) \ 69 | _f_throw_type(_T("Number"), aValue) 70 | 71 | #define BivRValueToString(...) TokenToString(aValue, _f_number_buf, __VA_ARGS__) 72 | #define BivRValueToInt64() TokenToInt64(aValue) 73 | #define BivRValueToBOOL() TokenToBOOL(aValue) 74 | #define BivRValueToObject() TokenToObject(aValue) 75 | 76 | 77 | template 78 | BIF_DECL(NewObject) 79 | { 80 | Object *obj = T::Create(); 81 | if (!obj) 82 | _f_throw_oom; 83 | obj->New(aResultToken, aParam, aParamCount); 84 | } 85 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_version.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains the external function pcre_version(), which returns a 42 | string that identifies the PCRE version that is in use. */ 43 | 44 | 45 | #ifdef HAVE_CONFIG_H 46 | #include "config.h" 47 | #endif 48 | 49 | #include "pcre_internal.h" 50 | 51 | 52 | /************************************************* 53 | * Return version string * 54 | *************************************************/ 55 | 56 | /* These macros are the standard way of turning unquoted text into C strings. 57 | They allow macros like PCRE_MAJOR to be defined without quotes, which is 58 | convenient for user programs that want to test its value. */ 59 | 60 | #define STRING(a) # a 61 | #define XSTRING(s) STRING(s) 62 | 63 | /* A problem turned up with PCRE_PRERELEASE, which is defined empty for 64 | production releases. Originally, it was used naively in this code: 65 | 66 | return XSTRING(PCRE_MAJOR) 67 | "." XSTRING(PCRE_MINOR) 68 | XSTRING(PCRE_PRERELEASE) 69 | " " XSTRING(PCRE_DATE); 70 | 71 | However, when PCRE_PRERELEASE is empty, this leads to an attempted expansion of 72 | STRING(). The C standard states: "If (before argument substitution) any 73 | argument consists of no preprocessing tokens, the behavior is undefined." It 74 | turns out the gcc treats this case as a single empty string - which is what we 75 | really want - but Visual C grumbles about the lack of an argument for the 76 | macro. Unfortunately, both are within their rights. To cope with both ways of 77 | handling this, I had resort to some messy hackery that does a test at run time. 78 | I could find no way of detecting that a macro is defined as an empty string at 79 | pre-processor time. This hack uses a standard trick for avoiding calling 80 | the STRING macro with an empty argument when doing the test. */ 81 | 82 | #ifdef COMPILE_PCRE8 83 | PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION 84 | pcre_version(void) 85 | #else 86 | PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION 87 | pcre16_version(void) 88 | #endif 89 | { 90 | return (XSTRING(Z PCRE_PRERELEASE)[1] == 0)? 91 | XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE) : 92 | XSTRING(PCRE_MAJOR.PCRE_MINOR) XSTRING(PCRE_PRERELEASE PCRE_DATE); 93 | } 94 | 95 | /* End of pcre_version.c */ 96 | -------------------------------------------------------------------------------- /source/WinGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | AutoHotkey 3 | 4 | Copyright 2003-2009 Chris Mallett (support@autohotkey.com) 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | 17 | #ifndef wingroup_h 18 | #define wingroup_h 19 | 20 | #include "defines.h" 21 | #include "SimpleHeap.h" // for WinGroup's overloaded new/delete operators. 22 | 23 | 24 | // NOTE: This module is separate from the others because: 25 | // 1) If it were in script.h/cpp it would add clutter to that already large file. 26 | // 2) If it were in window.h/cpp it causes mutual-dependency problems between header 27 | // (probably correctible, but it's fine this way). 28 | 29 | 30 | class Label; 31 | class WindowSpec 32 | { 33 | public: 34 | LPTSTR mTitle, mText, mExcludeTitle, mExcludeText; 35 | WindowSpec *mNextWindow; // Next item in linked list. 36 | WindowSpec(LPTSTR aTitle = _T(""), LPTSTR aText = _T("") 37 | , LPTSTR aExcludeTitle = _T(""), LPTSTR aExcludeText = _T("")) 38 | // Caller should have allocated some dynamic memory for the given args if they're not 39 | // the empty string. We just set our member variables to be equal to the given pointers. 40 | : mTitle(aTitle), mText(aText), mExcludeTitle(aExcludeTitle), mExcludeText(aExcludeText) 41 | , mNextWindow(NULL) // mNextWindow(NULL) is also required for thread-safety. 42 | {} 43 | void *operator new(size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 44 | void *operator new[](size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 45 | void operator delete(void *aPtr) {} 46 | void operator delete[](void *aPtr) {} 47 | }; 48 | 49 | 50 | 51 | enum BuiltInFunctionID; 52 | class WinGroup 53 | { 54 | private: 55 | // The maximum number of windows to keep track of: 56 | #define MAX_ALREADY_VISITED 500 57 | static WinGroup *sGroupLastUsed; 58 | static HWND *sAlreadyVisited; // Array. It will be dynamically allocated on first use. 59 | static int sAlreadyVisitedCount; 60 | bool mIsModeActivate; 61 | 62 | static void MarkAsVisited(HWND aWnd) 63 | { 64 | // For peace of mind, do dupe-check to rule out, once and for all, 65 | // the possibility of any unusual conditions where the list might get 66 | // quickly filled up with dupes: 67 | for (int i = 0; i < sAlreadyVisitedCount; ++i) 68 | if (sAlreadyVisited[i] == aWnd) // It's already in the list. 69 | return; 70 | if (sAlreadyVisitedCount >= MAX_ALREADY_VISITED) 71 | // Can't store any more. Don't bother displaying an error (too unlikely). 72 | return; 73 | sAlreadyVisited[sAlreadyVisitedCount++] = aWnd; 74 | } 75 | 76 | void Update(bool aIsModeActivate); 77 | 78 | public: 79 | LPTSTR mName; // The name of the group. 80 | WindowSpec *mFirstWindow, *mLastWindow; 81 | WinGroup *mNextGroup; // Next item in linked list. 82 | UINT mWindowCount; 83 | 84 | ResultType AddWindow(LPCTSTR aTitle, LPCTSTR aText, LPCTSTR aExcludeTitle, LPCTSTR aExcludeText); 85 | void ActUponAll(BuiltInFunctionID aActionType, int aTimeToWaitForClose); 86 | void CloseAndGoToNext(bool aStartWithMostRecent); 87 | HWND Activate(bool aStartWithMostRecent); 88 | void Deactivate(bool aStartWithMostRecent); 89 | bool IsEmpty() {return mFirstWindow == NULL;} 90 | WindowSpec *IsMember(HWND aWnd, ScriptThreadSettings &aSettings); 91 | WinGroup(LPTSTR aGroupName) 92 | // The caller must ensure that aGroupName is non-null and non-empty-string. 93 | : mName(aGroupName) // Caller gave us a pointer to dynamic memory for this. 94 | , mFirstWindow(NULL), mLastWindow(NULL) 95 | , mWindowCount(0) 96 | , mNextGroup(NULL) // v1.0.41: Required for thread-safety, but also for maintainability. 97 | , mIsModeActivate(true) // arbitrary default. 98 | {} 99 | void *operator new(size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 100 | void *operator new[](size_t aBytes) {return SimpleHeap::Alloc(aBytes);} 101 | void operator delete(void *aPtr) {} 102 | void operator delete[](void *aPtr) {} 103 | }; 104 | 105 | 106 | BOOL CALLBACK EnumParentFindAnyExcept(HWND aWnd, LPARAM lParam); 107 | BOOL CALLBACK EnumParentActUponAll(HWND aWnd, LPARAM lParam); 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /source/application.h: -------------------------------------------------------------------------------- 1 | /* 2 | AutoHotkey 3 | 4 | Copyright 2003-2009 Chris Mallett (support@autohotkey.com) 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | 17 | #ifndef application_h 18 | #define application_h 19 | 20 | #include "defines.h" 21 | 22 | // Callers should note that using INTERVAL_UNSPECIFIED might not rest the CPU at all if there is 23 | // already at least one msg waiting in our thread's msg queue: 24 | // Use some negative value unlikely to ever be passed explicitly: 25 | #define INTERVAL_UNSPECIFIED (INT_MIN + 303) 26 | #define NO_SLEEP -1 27 | enum MessageMode {WAIT_FOR_MESSAGES, RETURN_AFTER_MESSAGES, RETURN_AFTER_MESSAGES_SPECIAL_FILTER}; 28 | bool MsgSleep(int aSleepDuration = INTERVAL_UNSPECIFIED, MessageMode aMode = RETURN_AFTER_MESSAGES); 29 | 30 | // This macro is used to Sleep without the possibility of a new hotkey subroutine being launched. 31 | // Timed subroutines will also be prevented from running while it is enabled. 32 | // It should be used when an operation needs to sleep, but doesn't want to be interrupted (suspended) 33 | // by any hotkeys the user might press during that time. Reasons why the caller wouldn't want to 34 | // be suspended: 35 | // 1) If it's doing something with a window -- such as sending keys or clicking the mouse or trying 36 | // to activate it -- that might get messed up if a new hotkey fires in the middle of the operation. 37 | // 2) If its a command that's still using some of its parameters that might reside in the deref buffer. 38 | // In this case, the launching of a new hotkey would likely overwrite those values, causing 39 | // unpredictable behavior. 40 | #define SLEEP_WITHOUT_INTERRUPTION(aSleepTime) \ 41 | {\ 42 | g_AllowInterruption = FALSE;\ 43 | MsgSleep(aSleepTime);\ 44 | g_AllowInterruption = TRUE;\ 45 | } 46 | 47 | // Have this be dynamically resolved each time. For example, when MsgSleep() uses this 48 | // while in mode WAIT_FOR_MESSSAGES, its msg loop should use this macro in case the 49 | // value of g_AllowInterruption changes from one iteration to the next. Thankfully, 50 | // MS made WM_HOTKEY have a very high value, so filtering in this way should not exclude 51 | // any other important types of messages: 52 | #define MSG_FILTER_MAX (IsInterruptible() ? 0 : WM_HOTKEY - 1) 53 | #define INTERRUPTIBLE_IN_EMERGENCY (g_AllowInterruption && !g_MenuIsVisible) 54 | 55 | #define DoWinDelay \ 56 | if (::g->WinDelay > -1)\ 57 | {\ 58 | MsgSleep(::g->WinDelay);\ 59 | } 60 | 61 | #define DoControlDelay \ 62 | if (g->ControlDelay > -1)\ 63 | {\ 64 | MsgSleep(g->ControlDelay);\ 65 | } 66 | 67 | ResultType IsCycleComplete(int aSleepDuration, DWORD aStartTime, bool aAllowEarlyReturn); 68 | 69 | // These should only be called from MsgSleep() (or something called by MsgSleep()) because 70 | // we don't want to be in the situation where a thread launched by CheckScriptTimers() returns 71 | // first to a dialog's message pump rather than MsgSleep's pump. That's because our thread 72 | // might then have queued messages that would be stuck in the queue (due to the possible absence 73 | // of the main timer) until the dialog's msg pump ended. 74 | bool CheckScriptTimers(); 75 | #define CHECK_SCRIPT_TIMERS_IF_NEEDED if (g_script.mTimerEnabledCount && CheckScriptTimers()) return_value = true; // Change the existing value only if it returned true. 76 | 77 | void PollJoysticks(); 78 | #define POLL_JOYSTICK_IF_NEEDED if (Hotkey::sJoyHotkeyCount) PollJoysticks(); 79 | 80 | bool MsgMonitor(HWND aWnd, UINT aMsg, WPARAM awParam, LPARAM alParam, MSG *apMsg, LRESULT &aMsgReply); 81 | 82 | void InitNewThread(int aPriority, bool aSkipUninterruptible, bool aIncrementThreadCountAndUpdateTrayIcon 83 | , bool aIsCritical = false); 84 | void ResumeUnderlyingThread(); 85 | BOOL IsInterruptible(); 86 | 87 | void MsgWaitUnpause(); 88 | 89 | VOID CALLBACK MsgBoxTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); 90 | VOID CALLBACK InputTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); 91 | VOID CALLBACK RefreshInterruptibility(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); 92 | 93 | void InitMenuPopup(HMENU aMenu); 94 | void UninitMenuPopup(HMENU aMenu); 95 | bool MenuIsModeless(HMENU aMenu); 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /source/libx64call/x64call.asm: -------------------------------------------------------------------------------- 1 | ;/////////////////////////////////////////////////////////////////////// 2 | ; 3 | ; Windows x64 dynamic function call 4 | ; Code adapted from http://www.dyncall.org/ by fincs. 5 | ; Prolog directives added by Lexikos to fix exception handling. 6 | ; Get*RetVal procs added by Lexikos for retrieving float return values. 7 | ; Simplified DynaCall by Lexikos, based on PerformDynaCall. 8 | ; 9 | ;/////////////////////////////////////////////////////////////////////// 10 | 11 | ;////////////////////////////////////////////////////////////////////////////// 12 | ; 13 | ; Copyright (c) 2007-2009 Daniel Adler , 14 | ; Tassilo Philipp 15 | ; 16 | ; Permission to use, copy, modify, and distribute this software for any 17 | ; purpose with or without fee is hereby granted, provided that the above 18 | ; copyright notice and this permission notice appear in all copies. 19 | ; 20 | ; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 21 | ; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 22 | ; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 23 | ; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 24 | ; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 25 | ; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 26 | ; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 27 | ; 28 | ;////////////////////////////////////////////////////////////////////////////// 29 | 30 | .code 31 | 32 | include ksamd64.inc 33 | 34 | PerformDynaCall proc frame 35 | push_reg rbp 36 | push_reg rsi 37 | push_reg rdi 38 | set_frame rbp, 0 39 | .endprolog 40 | 41 | ; Arguments: 42 | ; rcx: size of arguments to be passed via stack 43 | ; rdx: pointer to arguments to be passed via stack 44 | ; r8: pointer to arguments to be passed by registers 45 | ; r9: target function pointer 46 | 47 | ; Setup stack frame by subtracting the size of the arguments 48 | sub rsp, rcx 49 | 50 | ; Ensure the stack is 16-byte aligned 51 | mov rax, rcx 52 | and rax, 15 53 | mov rsi, 16 54 | sub rsi, rax 55 | sub rsp, rsi 56 | 57 | ; Save function address 58 | mov rax, r9 59 | 60 | ; Copy the stack arguments 61 | mov rsi, rdx ; let rsi point to the arguments. 62 | mov rdi, rsp ; store pointer to beginning of stack arguments in rdi (for rep movsb). 63 | rep movsb ; @@@ should be optimized (e.g. movq) 64 | 65 | ; Copy the register arguments 66 | mov rcx, qword ptr[r8 ] ; copy first four arguments to rcx, rdx, r8, r9 and xmm0-xmm3. 67 | mov rdx, qword ptr[r8+ 8] 68 | mov r9, qword ptr[r8+24] ; set r9 first to not overwrite r8 too soon. 69 | mov r8, qword ptr[r8+16] 70 | movd xmm0, rcx 71 | movd xmm1, rdx 72 | movd xmm2, r8 73 | movd xmm3, r9 74 | 75 | ; Call function 76 | sub rsp, 8*4 ; spill area 77 | call rax 78 | 79 | ; Restore stack pointer 80 | ;mov rsp, rbp ; Although mov works too, MSDN says "add RSP,constant or lea RSP,constant[FPReg]" must be used for exception-handling to work reliably. http://msdn.microsoft.com/en-us/library/tawsa7cb.aspx 81 | lea rsp, [rbp] 82 | 83 | ; Restore some registers and return 84 | pop rdi 85 | pop rsi 86 | pop rbp 87 | ret 88 | PerformDynaCall endp 89 | 90 | DynaCall proc frame 91 | push_reg rbp 92 | push_reg rsi 93 | push_reg rdi 94 | set_frame rbp, 0 95 | .endprolog 96 | 97 | ; Arguments: 98 | ; rcx: number of QWORDs to be passed as arguments 99 | ; rdx: pointer to arguments 100 | ; r8: target function pointer 101 | ; r9: not used 102 | 103 | ; Setup stack frame by subtracting the max(num_args,4) * 8 104 | mov rax, 4 105 | cmp rax, rcx 106 | cmovl rax, rcx 107 | shl rax, 3 108 | sub rsp, rax 109 | 110 | ; Ensure the stack is 16-byte aligned 111 | and rsp, -16 112 | 113 | ; Save function address 114 | mov rax, r8 115 | 116 | ; Copy the arguments (for simplicity, the register arguments are included) 117 | mov rsi, rdx ; let rsi point to the source arguments. 118 | mov rdi, rsp ; let rdi point to the destination on the stack (for rep movsq). 119 | rep movsq 120 | 121 | ; Copy the register arguments 122 | mov rcx, qword ptr[rsp ] 123 | mov rdx, qword ptr[rsp+ 8] 124 | mov r8, qword ptr[rsp+16] 125 | mov r9, qword ptr[rsp+24] 126 | movd xmm0, rcx 127 | movd xmm1, rdx 128 | movd xmm2, r8 129 | movd xmm3, r9 130 | 131 | ; Call function 132 | call rax 133 | 134 | ; Restore stack pointer 135 | ;mov rsp, rbp ; Although mov works too, MSDN says "add RSP,constant or lea RSP,constant[FPReg]" must be used for exception-handling to work reliably. http://msdn.microsoft.com/en-us/library/tawsa7cb.aspx 136 | lea rsp, [rbp] 137 | 138 | ; Restore some registers and return 139 | pop rdi 140 | pop rsi 141 | pop rbp 142 | ret 143 | DynaCall endp 144 | 145 | GetFloatRetval proc 146 | ; Nothing is actually done here - we just declare the appropriate return type in C++. 147 | ret 148 | GetFloatRetval endp 149 | 150 | GetDoubleRetval proc 151 | ; See above. 152 | ret 153 | GetDoubleRetval endp 154 | 155 | end -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_config.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains the external function pcre_config(). */ 42 | 43 | 44 | #ifdef HAVE_CONFIG_H 45 | #include "config.h" 46 | #endif 47 | 48 | /* Keep the original link size. */ 49 | static int real_link_size = LINK_SIZE; 50 | 51 | #include "pcre_internal.h" 52 | 53 | 54 | /************************************************* 55 | * Return info about what features are configured * 56 | *************************************************/ 57 | 58 | /* This function has an extensible interface so that additional items can be 59 | added compatibly. 60 | 61 | Arguments: 62 | what what information is required 63 | where where to put the information 64 | 65 | Returns: 0 if data returned, negative on error 66 | */ 67 | 68 | #ifdef COMPILE_PCRE8 69 | PCRE_EXP_DEFN int PCRE_CALL_CONVENTION 70 | pcre_config(int what, void *where) 71 | #else 72 | PCRE_EXP_DEFN int PCRE_CALL_CONVENTION 73 | pcre16_config(int what, void *where) 74 | #endif 75 | { 76 | switch (what) 77 | { 78 | case PCRE_CONFIG_UTF8: 79 | #if defined COMPILE_PCRE16 80 | *((int *)where) = 0; 81 | return PCRE_ERROR_BADOPTION; 82 | #else 83 | #if defined SUPPORT_UTF 84 | *((int *)where) = 1; 85 | #else 86 | *((int *)where) = 0; 87 | #endif 88 | break; 89 | #endif 90 | 91 | case PCRE_CONFIG_UTF16: 92 | #if defined COMPILE_PCRE8 93 | *((int *)where) = 0; 94 | return PCRE_ERROR_BADOPTION; 95 | #else 96 | #if defined SUPPORT_UTF 97 | *((int *)where) = 1; 98 | #else 99 | *((int *)where) = 0; 100 | #endif 101 | break; 102 | #endif 103 | 104 | case PCRE_CONFIG_UNICODE_PROPERTIES: 105 | #ifdef SUPPORT_UCP 106 | *((int *)where) = 1; 107 | #else 108 | *((int *)where) = 0; 109 | #endif 110 | break; 111 | 112 | case PCRE_CONFIG_JIT: 113 | #ifdef SUPPORT_JIT 114 | *((int *)where) = 1; 115 | #else 116 | *((int *)where) = 0; 117 | #endif 118 | break; 119 | 120 | case PCRE_CONFIG_JITTARGET: 121 | #ifdef SUPPORT_JIT 122 | *((const char **)where) = PRIV(jit_get_target)(); 123 | #else 124 | *((const char **)where) = NULL; 125 | #endif 126 | break; 127 | 128 | case PCRE_CONFIG_NEWLINE: 129 | *((int *)where) = NEWLINE; 130 | break; 131 | 132 | case PCRE_CONFIG_BSR: 133 | #ifdef BSR_ANYCRLF 134 | *((int *)where) = 1; 135 | #else 136 | *((int *)where) = 0; 137 | #endif 138 | break; 139 | 140 | case PCRE_CONFIG_LINK_SIZE: 141 | *((int *)where) = real_link_size; 142 | break; 143 | 144 | case PCRE_CONFIG_POSIX_MALLOC_THRESHOLD: 145 | *((int *)where) = POSIX_MALLOC_THRESHOLD; 146 | break; 147 | 148 | case PCRE_CONFIG_MATCH_LIMIT: 149 | *((unsigned long int *)where) = MATCH_LIMIT; 150 | break; 151 | 152 | case PCRE_CONFIG_MATCH_LIMIT_RECURSION: 153 | *((unsigned long int *)where) = MATCH_LIMIT_RECURSION; 154 | break; 155 | 156 | case PCRE_CONFIG_STACKRECURSE: 157 | #ifdef NO_RECURSE 158 | *((int *)where) = 0; 159 | #else 160 | *((int *)where) = 1; 161 | #endif 162 | break; 163 | 164 | default: return PCRE_ERROR_BADOPTION; 165 | } 166 | 167 | return 0; 168 | } 169 | 170 | /* End of pcre_config.c */ 171 | -------------------------------------------------------------------------------- /source/lib/Gui.StatusBar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | AutoHotkey 3 | 4 | Copyright 2003-2009 Chris Mallett (support@autohotkey.com) 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | 17 | #include "stdafx.h" 18 | #include "script.h" 19 | #include "script_gui.h" 20 | 21 | 22 | 23 | FResult GuiControlType::SB_SetIcon(StrArg aFilename, optl aIconNumber, optl aPartNumber, UINT_PTR &aRetVal) 24 | { 25 | GuiType& gui = *this->gui; 26 | 27 | UINT part_index = aPartNumber.value_or(1) - 1; 28 | if (part_index > 255) // Also covers wrapped negative values. 29 | return FR_E_ARG(2); 30 | 31 | int unused, icon_number = aIconNumber.value_or(1); 32 | if (icon_number == 0) // Must be != 0 to tell LoadPicture that "icon must be loaded, never a bitmap". 33 | icon_number = 1; 34 | auto hicon = (HICON)LoadPicture(aFilename // Load-time validation has ensured there is at least one parameter. 35 | , GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON) // Apparently the bar won't scale them for us. 36 | , unused, icon_number, false); // Defaulting to "false" for "use GDIplus" provides more consistent appearance across multiple OSes. 37 | if (!hicon) 38 | return FError(ERR_LOAD_ICON, aFilename); 39 | 40 | HICON hicon_old = (HICON)SendMessage(hwnd, SB_GETICON, part_index, 0); // Get the old one before setting the new one. 41 | // There's no need to keep track of the icon handle since it will be destroyed automatically if the 42 | // window is destroyed or the program exits. 43 | if (!SendMessage(hwnd, SB_SETICON, part_index, (LPARAM)hicon)) 44 | { 45 | DestroyIcon(hicon); 46 | return FR_E_FAILED; 47 | } 48 | if (hicon_old) 49 | // Although the old icon is automatically destroyed here, the script can call SendMessage(SB_SETICON) 50 | // itself if it wants to work with HICONs directly (for performance reasons, etc.) 51 | DestroyIcon(hicon_old); 52 | // Return the icon handle mainly for historical reasons. Old comments indicated the return value was 53 | // to allow the script to destroy the HICON later when it doesn't need it, but that doesn't make sense 54 | // since destroying the Gui or setting a new icon would implicitly cause the old icon to be destroyed. 55 | aRetVal = (UINT_PTR)hicon; 56 | return OK; 57 | } 58 | 59 | 60 | 61 | FResult GuiControlType::SB_SetParts(VariantParams &aParam, UINT& aRetVal) 62 | { 63 | GuiType& gui = *this->gui; 64 | 65 | int old_part_count, new_part_count; 66 | int edge, part[256]; // Load-time validation has ensured aParamCount is under 255, so it shouldn't overflow. 67 | for (edge = 0, new_part_count = 0; new_part_count < aParam.count; ++new_part_count) 68 | { 69 | auto &value = *aParam.value[new_part_count]; 70 | if (!TokenIsNumeric(value)) 71 | return FParamError(new_part_count, &value, _T("Number")); 72 | int width = (int)TokenToInt64(value); 73 | if (width < 0) 74 | return FR_E_ARG(new_part_count); 75 | edge += gui.Scale(width); 76 | part[new_part_count] = edge; 77 | } 78 | // For code simplicity, there is currently no means to have the last part of the bar use less than 79 | // all of the bar's remaining width. The desire to do so seems rare, especially since the script can 80 | // add an extra/unused part at the end to achieve nearly (or perhaps exactly) the same effect. 81 | part[new_part_count++] = -1; // Make the last part use the remaining width of the bar. 82 | 83 | old_part_count = (int)SendMessage(hwnd, SB_GETPARTS, 0, NULL); // MSDN: "This message always returns the number of parts in the status bar [regardless of how it is called]". 84 | if (old_part_count > new_part_count) // Some parts are being deleted, so destroy their icons. See other notes in GuiType::Destroy() for explanation. 85 | for (int i = new_part_count; i < old_part_count; ++i) // Verified correct. 86 | if (auto hicon = (HICON)SendMessage(hwnd, SB_GETICON, i, 0)) 87 | DestroyIcon(hicon); 88 | 89 | if (!SendMessage(hwnd, SB_SETPARTS, new_part_count, (LPARAM)part)) 90 | return FR_E_FAILED; 91 | 92 | // hwnd is returned for historical reasons; there are more direct and ubiquitous ways to get it. 93 | aRetVal = (UINT)(size_t)hwnd; 94 | return OK; 95 | } 96 | 97 | 98 | 99 | FResult GuiControlType::SB_SetText(StrArg aNewText, optl aPartNumber, optl aStyle) 100 | { 101 | UINT part_index = aPartNumber.value_or(1) - 1; 102 | if (part_index > 255) // Also covers wrapped negative values. 103 | return FR_E_ARG(2); 104 | UINT style = aStyle.value_or(0); 105 | if (style > 0xFF) 106 | return FR_E_ARG(3); 107 | return SendMessage(hwnd, SB_SETTEXT, (part_index | (style << 8)), (LPARAM)aNewText) ? OK : FR_E_FAILED; 108 | } 109 | 110 | 111 | -------------------------------------------------------------------------------- /AutoHotkeyx.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoHotkeyx", "AutoHotkeyx.vcxproj", "{76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_pcre", "source\lib_pcre\lib_pcre.vcxproj", "{39037993-9571-4DF2-8E39-CD2909043574}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug.dll|Win32 = Debug.dll|Win32 13 | Debug.dll|x64 = Debug.dll|x64 14 | Debug|Win32 = Debug|Win32 15 | Debug|x64 = Debug|x64 16 | Release.dll|Win32 = Release.dll|Win32 17 | Release.dll|x64 = Release.dll|x64 18 | Release|Win32 = Release|Win32 19 | Release|x64 = Release|x64 20 | Self-contained(debug)|Win32 = Self-contained(debug)|Win32 21 | Self-contained(debug)|x64 = Self-contained(debug)|x64 22 | Self-contained|Win32 = Self-contained|Win32 23 | Self-contained|x64 = Self-contained|x64 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug.dll|Win32.ActiveCfg = Debug.dll|Win32 27 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug.dll|Win32.Build.0 = Debug.dll|Win32 28 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug.dll|x64.ActiveCfg = Debug.dll|x64 29 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug.dll|x64.Build.0 = Debug.dll|x64 30 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug|Win32.ActiveCfg = Debug|Win32 31 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug|Win32.Build.0 = Debug|Win32 32 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug|x64.ActiveCfg = Debug|x64 33 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Debug|x64.Build.0 = Debug|x64 34 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release.dll|Win32.ActiveCfg = Release.dll|Win32 35 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release.dll|Win32.Build.0 = Release.dll|Win32 36 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release.dll|x64.ActiveCfg = Release.dll|x64 37 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release.dll|x64.Build.0 = Release.dll|x64 38 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release|Win32.ActiveCfg = Release|Win32 39 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release|Win32.Build.0 = Release|Win32 40 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release|x64.ActiveCfg = Release|x64 41 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Release|x64.Build.0 = Release|x64 42 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained(debug)|Win32.ActiveCfg = Self-contained(debug)|Win32 43 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained(debug)|Win32.Build.0 = Self-contained(debug)|Win32 44 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained(debug)|x64.ActiveCfg = Self-contained(debug)|x64 45 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained(debug)|x64.Build.0 = Self-contained(debug)|x64 46 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained|Win32.ActiveCfg = Self-contained|Win32 47 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained|Win32.Build.0 = Self-contained|Win32 48 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained|x64.ActiveCfg = Self-contained|x64 49 | {76EFDEE3-81CF-4ADA-94DC-EA5509FF6FFC}.Self-contained|x64.Build.0 = Self-contained|x64 50 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug.dll|Win32.ActiveCfg = Debug|Win32 51 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug.dll|Win32.Build.0 = Debug|Win32 52 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug.dll|x64.ActiveCfg = Debug|x64 53 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug.dll|x64.Build.0 = Debug|x64 54 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug|Win32.ActiveCfg = Debug|Win32 55 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug|Win32.Build.0 = Debug|Win32 56 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug|x64.ActiveCfg = Debug|x64 57 | {39037993-9571-4DF2-8E39-CD2909043574}.Debug|x64.Build.0 = Debug|x64 58 | {39037993-9571-4DF2-8E39-CD2909043574}.Release.dll|Win32.ActiveCfg = Release|Win32 59 | {39037993-9571-4DF2-8E39-CD2909043574}.Release.dll|Win32.Build.0 = Release|Win32 60 | {39037993-9571-4DF2-8E39-CD2909043574}.Release.dll|x64.ActiveCfg = Release|x64 61 | {39037993-9571-4DF2-8E39-CD2909043574}.Release.dll|x64.Build.0 = Release|x64 62 | {39037993-9571-4DF2-8E39-CD2909043574}.Release|Win32.ActiveCfg = Release|Win32 63 | {39037993-9571-4DF2-8E39-CD2909043574}.Release|Win32.Build.0 = Release|Win32 64 | {39037993-9571-4DF2-8E39-CD2909043574}.Release|x64.ActiveCfg = Release|x64 65 | {39037993-9571-4DF2-8E39-CD2909043574}.Release|x64.Build.0 = Release|x64 66 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained(debug)|Win32.ActiveCfg = Release|x64 67 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained(debug)|x64.ActiveCfg = Debug|x64 68 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained(debug)|x64.Build.0 = Debug|x64 69 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained|Win32.ActiveCfg = Release|Win32 70 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained|Win32.Build.0 = Release|Win32 71 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained|x64.ActiveCfg = Release|x64 72 | {39037993-9571-4DF2-8E39-CD2909043574}.Self-contained|x64.Build.0 = Release|x64 73 | EndGlobalSection 74 | GlobalSection(SolutionProperties) = preSolution 75 | HideSolutionNode = FALSE 76 | EndGlobalSection 77 | GlobalSection(ExtensibilityGlobals) = postSolution 78 | SolutionGuid = {DBF8DD38-93B7-4FCA-BFFC-FF166FCCD044} 79 | EndGlobalSection 80 | EndGlobal 81 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre16_valid_utf16.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains an internal function for validating UTF-16 character 42 | strings. */ 43 | 44 | 45 | #ifdef HAVE_CONFIG_H 46 | #include "config.h" 47 | #endif 48 | 49 | /* Generate code with 16 bit character support. */ 50 | #define COMPILE_PCRE16 51 | 52 | #include "pcre_internal.h" 53 | 54 | 55 | /************************************************* 56 | * Validate a UTF-16 string * 57 | *************************************************/ 58 | 59 | /* This function is called (optionally) at the start of compile or match, to 60 | check that a supposed UTF-16 string is actually valid. The early check means 61 | that subsequent code can assume it is dealing with a valid string. The check 62 | can be turned off for maximum performance, but the consequences of supplying an 63 | invalid string are then undefined. 64 | 65 | From release 8.21 more information about the details of the error are passed 66 | back in the returned value: 67 | 68 | PCRE_UTF16_ERR0 No error 69 | PCRE_UTF16_ERR1 Missing low surrogate at the end of the string 70 | PCRE_UTF16_ERR2 Invalid low surrogate 71 | PCRE_UTF16_ERR3 Isolated low surrogate 72 | PCRE_UTF16_ERR4 Not allowed character 73 | 74 | Arguments: 75 | string points to the string 76 | length length of string, or -1 if the string is zero-terminated 77 | errp pointer to an error position offset variable 78 | 79 | Returns: = 0 if the string is a valid UTF-16 string 80 | > 0 otherwise, setting the offset of the bad character 81 | */ 82 | 83 | int 84 | PRIV(valid_utf)(PCRE_PUCHAR string, int length, int *erroroffset) 85 | { 86 | #if defined(SUPPORT_UTF) && defined(SUPPORT_UTF_VALIDATION) 87 | register PCRE_PUCHAR p; 88 | register pcre_uchar c; 89 | 90 | if (length < 0) 91 | { 92 | for (p = string; *p != 0; p++); 93 | length = p - string; 94 | } 95 | 96 | for (p = string; length-- > 0; p++) 97 | { 98 | c = *p; 99 | 100 | if ((c & 0xf800) != 0xd800) 101 | { 102 | /* Normal UTF-16 code point. Neither high nor low surrogate. */ 103 | 104 | /* This is probably a BOM from a different byte-order. 105 | Regardless, the string is rejected. */ 106 | if (c == 0xfffe) 107 | { 108 | *erroroffset = p - string; 109 | return PCRE_UTF16_ERR4; 110 | } 111 | } 112 | else if ((c & 0x0400) == 0) 113 | { 114 | /* High surrogate. */ 115 | 116 | /* Must be a followed by a low surrogate. */ 117 | if (length == 0) 118 | { 119 | *erroroffset = p - string; 120 | return PCRE_UTF16_ERR1; 121 | } 122 | p++; 123 | length--; 124 | if ((*p & 0xfc00) != 0xdc00) 125 | { 126 | *erroroffset = p - string; 127 | return PCRE_UTF16_ERR2; 128 | } 129 | } 130 | else 131 | { 132 | /* Isolated low surrogate. Always an error. */ 133 | *erroroffset = p - string; 134 | return PCRE_UTF16_ERR3; 135 | } 136 | } 137 | 138 | #else /* SUPPORT_UTF */ 139 | (void)(string); /* Keep picky compilers happy */ 140 | (void)(length); 141 | #endif /* SUPPORT_UTF */ 142 | 143 | return PCRE_UTF16_ERR0; /* This indicates success */ 144 | } 145 | 146 | /* End of pcre16_valid_utf16.c */ 147 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_string_utils.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains an internal function that is used to match an extended 42 | class. It is used by both pcre_exec() and pcre_def_exec(). */ 43 | 44 | 45 | #ifdef HAVE_CONFIG_H 46 | #include "config.h" 47 | #endif 48 | 49 | #include "pcre_internal.h" 50 | 51 | #ifndef COMPILE_PCRE8 52 | 53 | /************************************************* 54 | * Compare string utilities * 55 | *************************************************/ 56 | 57 | /* The following two functions compares two strings. Basically an strcmp 58 | for non 8 bit characters. 59 | 60 | Arguments: 61 | str1 first string 62 | str2 second string 63 | 64 | Returns: 0 if both string are equal (like strcmp), 1 otherwise 65 | */ 66 | 67 | int 68 | PRIV(strcmp_uc_uc)(const pcre_uchar *str1, const pcre_uchar *str2) 69 | { 70 | pcre_uchar c1; 71 | pcre_uchar c2; 72 | 73 | while (*str1 != '\0' || *str2 != '\0') 74 | { 75 | c1 = *str1++; 76 | c2 = *str2++; 77 | if (c1 != c2) 78 | return ((c1 > c2) << 1) - 1; 79 | } 80 | /* Both length and characters must be equal. */ 81 | return 0; 82 | } 83 | 84 | int 85 | PRIV(strcmp_uc_c8)(const pcre_uchar *str1, const char *str2) 86 | { 87 | const pcre_uint8 *ustr2 = (pcre_uint8 *)str2; 88 | pcre_uchar c1; 89 | pcre_uchar c2; 90 | 91 | while (*str1 != '\0' || *ustr2 != '\0') 92 | { 93 | c1 = *str1++; 94 | c2 = (pcre_uchar)*ustr2++; 95 | if (c1 != c2) 96 | return ((c1 > c2) << 1) - 1; 97 | } 98 | /* Both length and characters must be equal. */ 99 | return 0; 100 | } 101 | 102 | /* The following two functions compares two, fixed length 103 | strings. Basically an strncmp for non 8 bit characters. 104 | 105 | Arguments: 106 | str1 first string 107 | str2 second string 108 | num size of the string 109 | 110 | Returns: 0 if both string are equal (like strcmp), 1 otherwise 111 | */ 112 | 113 | int 114 | PRIV(strncmp_uc_uc)(const pcre_uchar *str1, const pcre_uchar *str2, unsigned int num) 115 | { 116 | pcre_uchar c1; 117 | pcre_uchar c2; 118 | 119 | while (num-- > 0) 120 | { 121 | c1 = *str1++; 122 | c2 = *str2++; 123 | if (c1 != c2) 124 | return ((c1 > c2) << 1) - 1; 125 | } 126 | /* Both length and characters must be equal. */ 127 | return 0; 128 | } 129 | 130 | int 131 | PRIV(strncmp_uc_c8)(const pcre_uchar *str1, const char *str2, unsigned int num) 132 | { 133 | const pcre_uint8 *ustr2 = (pcre_uint8 *)str2; 134 | pcre_uchar c1; 135 | pcre_uchar c2; 136 | 137 | while (num-- > 0) 138 | { 139 | c1 = *str1++; 140 | c2 = (pcre_uchar)*ustr2++; 141 | if (c1 != c2) 142 | return ((c1 > c2) << 1) - 1; 143 | } 144 | /* Both length and characters must be equal. */ 145 | return 0; 146 | } 147 | 148 | /* The following function returns with the length of 149 | a zero terminated string. Basically an strlen for non 8 bit characters. 150 | 151 | Arguments: 152 | str string 153 | 154 | Returns: length of the string 155 | */ 156 | 157 | unsigned int 158 | PRIV(strlen_uc)(const pcre_uchar *str) 159 | { 160 | unsigned int len = 0; 161 | while (*str++ != 0) 162 | len++; 163 | return len; 164 | } 165 | 166 | #endif /* COMPILE_PCRE8 */ 167 | 168 | /* End of pcre_string_utils.c */ 169 | -------------------------------------------------------------------------------- /Config.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | false 8 | false 9 | false 10 | false 11 | false 12 | true 13 | true 14 | true 15 | true 16 | 17 | 19 | Unicode 20 | 21 | MultiByte 22 | 23 | 24 | true 25 | false 26 | 27 | 28 | 29 | 30 | 31 | 32 | NDEBUG;%(PreprocessorDefinitions) 33 | _DEBUG;%(PreprocessorDefinitions) 34 | 35 | 36 | true 37 | Level3 38 | true 39 | 40 | 41 | MultiThreaded 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | MaxSpeed 50 | true 51 | true 52 | 53 | false 54 | /Zc:threadSafeInit- %(AdditionalOptions) 55 | 56 | 57 | false 58 | 59 | true 60 | true 61 | 65 | /SAFESEH:NO %(AdditionalOptions) 66 | 67 | 68 | 69 | false 70 | 71 | 72 | 73 | 74 | 75 | MultiThreadedDLL 76 | MinSpace 77 | 78 | 79 | libcmt;%(IgnoreSpecificDefaultLibraries) 80 | 81 | 82 | 83 | 84 | 85 | 86 | Disabled 87 | EnableFastChecks 88 | MultiThreadedDebug 89 | ProgramDatabase 90 | 91 | 92 | true 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | $(DefaultPlatformToolset) 102 | $(PlatformToolset)_xp 103 | 104 | 105 | 106 | NoUpgrade 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /source/lib_pcre/lib_pcre.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx 11 | 12 | 13 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 14 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 15 | 16 | 17 | {de846519-68f9-410f-8918-15084d6b0e00} 18 | 19 | 20 | {45529d78-f22e-471e-8d00-37fc44c21bc6} 21 | 22 | 23 | 24 | 25 | Source Files\16-bit 26 | 27 | 28 | Source Files\16-bit 29 | 30 | 31 | Source Files\16-bit 32 | 33 | 34 | Source Files\16-bit 35 | 36 | 37 | Source Files\16-bit 38 | 39 | 40 | Source Files\16-bit 41 | 42 | 43 | Source Files\16-bit 44 | 45 | 46 | Source Files\16-bit 47 | 48 | 49 | Source Files\16-bit 50 | 51 | 52 | Source Files\16-bit 53 | 54 | 55 | Source Files\16-bit 56 | 57 | 58 | Source Files\16-bit 59 | 60 | 61 | Source Files\16-bit 62 | 63 | 64 | Source Files\16-bit 65 | 66 | 67 | Source Files\16-bit 68 | 69 | 70 | Source Files\16-bit 71 | 72 | 73 | Source Files\16-bit 74 | 75 | 76 | Source Files\16-bit 77 | 78 | 79 | Source Files\8-bit 80 | 81 | 82 | Source Files\8-bit 83 | 84 | 85 | Source Files\8-bit 86 | 87 | 88 | Source Files\8-bit 89 | 90 | 91 | Source Files\8-bit 92 | 93 | 94 | Source Files\8-bit 95 | 96 | 97 | Source Files\8-bit 98 | 99 | 100 | Source Files\8-bit 101 | 102 | 103 | Source Files\8-bit 104 | 105 | 106 | Source Files\8-bit 107 | 108 | 109 | Source Files\8-bit 110 | 111 | 112 | Source Files\8-bit 113 | 114 | 115 | Source Files\8-bit 116 | 117 | 118 | Source Files\8-bit 119 | 120 | 121 | Source Files\8-bit 122 | 123 | 124 | Source Files\8-bit 125 | 126 | 127 | Source Files\8-bit 128 | 129 | 130 | 131 | 132 | Header Files 133 | 134 | 135 | Header Files 136 | 137 | 138 | -------------------------------------------------------------------------------- /source/StringConv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN32 4 | 5 | #define IsValidUTF8(str, cch) MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, (str), (cch), NULL, 0) 6 | #define IsValidACP(str, cch) MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, (str), (cch), NULL, 0) 7 | 8 | LPCWSTR StringUTF8ToWChar(LPCSTR sUTF8, CStringW &sWChar, int iChars = -1); 9 | LPCWSTR StringCharToWChar(LPCSTR sChar, CStringW &sWChar, int iChars = -1, UINT codepage = CP_ACP); 10 | LPCSTR StringWCharToUTF8(LPCWSTR sWChar, CStringA &sUTF8, int iChars = -1); 11 | LPCSTR StringCharToUTF8(LPCSTR sChar, CStringA &sUTF8, int iChars = -1, UINT codepage = CP_ACP); 12 | LPCSTR StringWCharToChar(LPCWSTR sWChar, CStringA &sChar, int iChars = -1, char chDef = '?', UINT codepage = CP_ACP); 13 | LPCSTR StringUTF8ToChar(LPCSTR sUTF8, CStringA &sChar, int iChars = -1, char chDef = '?', UINT codepage = CP_ACP); 14 | 15 | LPCWSTR _StringDummyConvW(LPCWSTR sSrc, CStringW &sDest, int iChars = -1); 16 | LPCSTR _StringDummyConvA(LPCSTR sSrc, CStringA &sDest, int iChars = -1); 17 | 18 | #ifdef UNICODE 19 | 20 | #define StringTCharToWChar _StringDummyConvW 21 | #define StringTCharToUTF8 StringWCharToUTF8 22 | #define StringTCharToChar StringWCharToChar 23 | inline LPCWSTR StringWCharToTChar(LPCWSTR sWChar, CStringW &sTChar, int iChars = -1, char chDef = '?') 24 | { return _StringDummyConvW(sWChar, sTChar, iChars); } 25 | inline LPCWSTR StringUTF8ToTChar(LPCSTR sUTF8, CStringW &sTChar, int iChars = -1, char chDef = '?') 26 | { return StringUTF8ToWChar(sUTF8, sTChar, iChars); } 27 | #define StringCharToTChar StringCharToWChar 28 | 29 | #else 30 | // ! _UNICODE 31 | #define StringTCharToWChar StringCharToWChar 32 | #define StringTCharToUTF8 StringCharToUTF8 33 | #define StringTCharToChar _StringDummyConvA 34 | #define StringWCharToTChar StringWCharToChar 35 | #define StringUTF8ToTChar StringUTF8ToChar 36 | #define StringCharToTChar _StringDummyConvA 37 | 38 | #endif // _UNICODE 39 | 40 | class CStringWCharFromUTF8 : public CStringW 41 | { 42 | public: 43 | CStringWCharFromUTF8(LPCSTR sUTF8, int iChars = -1) 44 | { StringUTF8ToWChar(sUTF8, *this, iChars); } 45 | }; 46 | 47 | class CStringWCharFromChar : public CStringW 48 | { 49 | public: 50 | CStringWCharFromChar(LPCSTR sChar, int iChars = -1, UINT codepage = CP_ACP) 51 | { StringCharToWChar(sChar, *this, iChars, codepage); } 52 | }; 53 | 54 | class CStringUTF8FromWChar : public CStringA 55 | { 56 | public: 57 | CStringUTF8FromWChar(LPCWSTR sWChar, int iChars = -1) 58 | { StringWCharToUTF8(sWChar, *this, iChars); } 59 | }; 60 | 61 | class CStringUTF8FromChar : public CStringA 62 | { 63 | public: 64 | CStringUTF8FromChar(LPCSTR sChar, int iChars = -1, UINT codepage = CP_ACP) 65 | { StringCharToUTF8(sChar, *this, iChars, codepage); } 66 | }; 67 | 68 | class CStringCharFromWChar : public CStringA 69 | { 70 | public: 71 | CStringCharFromWChar(LPCWSTR sWChar, int iChars = -1, char chDef = '?', UINT codepage = CP_ACP) 72 | { StringWCharToChar(sWChar, *this, iChars, chDef, codepage); } 73 | }; 74 | 75 | class CStringCharFromUTF8 : public CStringA 76 | { 77 | public: 78 | CStringCharFromUTF8(LPCSTR sUTF8, int iChars = -1, char chDef = '?', UINT codepage = CP_ACP) 79 | { StringUTF8ToChar(sUTF8, *this, iChars, chDef, codepage); } 80 | }; 81 | 82 | #ifdef UNICODE 83 | #define CStringTCharFromWCharIfNeeded(s, ...) (s) 84 | #define CStringWCharFromTCharIfNeeded(s, ...) (s) 85 | #define CStringTCharFromCharIfNeeded(s, ...) CStringTCharFromChar((s), __VA_ARGS__) 86 | #define CStringCharFromTCharIfNeeded(s, ...) CStringCharFromTChar((s), __VA_ARGS__) 87 | 88 | class CStringTCharFromWChar : public CStringW 89 | { 90 | public: 91 | CStringTCharFromWChar(LPCWSTR sWChar, int iChars = -1, char chDef = '?') 92 | { _StringDummyConvW(sWChar, *this, iChars); } 93 | }; 94 | class CStringTCharFromUTF8 : public CStringW 95 | { 96 | public: 97 | CStringTCharFromUTF8(LPCSTR sUTF8, int iChars = -1, char chDef = '?') 98 | { StringUTF8ToWChar(sUTF8, *this, iChars); } 99 | }; 100 | typedef CStringWCharFromChar CStringTCharFromChar; 101 | typedef CStringW CStringWCharFromTChar; 102 | typedef CStringUTF8FromWChar CStringUTF8FromTChar; 103 | typedef CStringCharFromWChar CStringCharFromTChar; 104 | 105 | #else 106 | // ! _UNICODE 107 | #define CStringTCharFromWCharIfNeeded(s, ...) CStringTCharFromWChar((s), __VA_ARGS__) 108 | #define CStringWCharFromTCharIfNeeded(s, ...) CStringWCharFromTChar((s), __VA_ARGS__) 109 | #define CStringTCharFromCharIfNeeded(s, ...) (s) 110 | #define CStringCharFromTCharIfNeeded(s, ...) (s) 111 | 112 | typedef CStringCharFromWChar CStringTCharFromWChar; 113 | typedef CStringCharFromUTF8 CStringTCharFromUTF8; 114 | typedef CStringA CStringTCharFromChar; 115 | typedef CStringWCharFromChar CStringWCharFromTChar; 116 | typedef CStringUTF8FromChar CStringUTF8FromTChar; 117 | typedef CStringA CStringCharFromTChar; 118 | #endif // _UNICODE 119 | 120 | typedef CStringTCharFromWChar CStringFromWChar; 121 | typedef CStringTCharFromUTF8 CStringFromUTF8; 122 | typedef CStringTCharFromChar CStringFromChar; 123 | 124 | #endif // _WIN32 125 | 126 | template 127 | void CharConvEndian(CHAR_T *pChar) 128 | { 129 | BYTE *pCh = (BYTE *) pChar, chTemp; 130 | int i, j; 131 | for (i = 0, j = sizeof(CHAR_T) - 1;i < (sizeof(CHAR_T) >> 1);i++, j--) { 132 | chTemp = pCh[i]; 133 | pCh[i] = pCh[j]; 134 | pCh[j] = chTemp; 135 | } 136 | } 137 | 138 | // uChars = 0 ==> treat 'sSrc' as NULL-terminal 139 | template 140 | unsigned long StringConvEndian(CHAR_T *sSrc, ULONG_PTR uChars = 0) 141 | { 142 | ULONG_PTR i; 143 | for (i = 0;sSrc[i] && (uChars == 0 || i < uChars);i++) 144 | CharConvEndian(sSrc + i); 145 | return i; 146 | } 147 | -------------------------------------------------------------------------------- /source/resources/icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 90 | -------------------------------------------------------------------------------- /source/lib_pcre/pcre/pcre_maketables.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* PCRE is a library of functions to support regular expressions whose syntax 6 | and semantics are as close as possible to those of the Perl 5 language. 7 | 8 | Written by Philip Hazel 9 | Copyright (c) 1997-2012 University of Cambridge 10 | 11 | ----------------------------------------------------------------------------- 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the University of Cambridge nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | ----------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | /* This module contains the external function pcre_maketables(), which builds 42 | character tables for PCRE in the current locale. The file is compiled on its 43 | own as part of the PCRE library. However, it is also included in the 44 | compilation of dftables.c, in which case the macro DFTABLES is defined. */ 45 | 46 | 47 | #ifndef DFTABLES 48 | # ifdef HAVE_CONFIG_H 49 | # include "config.h" 50 | # endif 51 | # include "pcre_internal.h" 52 | #endif 53 | 54 | 55 | /************************************************* 56 | * Create PCRE character tables * 57 | *************************************************/ 58 | 59 | /* This function builds a set of character tables for use by PCRE and returns 60 | a pointer to them. They are build using the ctype functions, and consequently 61 | their contents will depend upon the current locale setting. When compiled as 62 | part of the library, the store is obtained via PUBL(malloc)(), but when 63 | compiled inside dftables, use malloc(). 64 | 65 | Arguments: none 66 | Returns: pointer to the contiguous block of data 67 | */ 68 | 69 | #ifdef COMPILE_PCRE8 70 | const unsigned char * 71 | pcre_maketables(void) 72 | #else 73 | const unsigned char * 74 | pcre16_maketables(void) 75 | #endif 76 | { 77 | unsigned char *yield, *p; 78 | int i; 79 | 80 | #ifndef DFTABLES 81 | yield = (unsigned char*)(PUBL(malloc))(tables_length); 82 | #else 83 | yield = (unsigned char*)malloc(tables_length); 84 | #endif 85 | 86 | if (yield == NULL) return NULL; 87 | p = yield; 88 | 89 | /* First comes the lower casing table */ 90 | 91 | for (i = 0; i < 256; i++) *p++ = tolower(i); 92 | 93 | /* Next the case-flipping table */ 94 | 95 | for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i); 96 | 97 | /* Then the character class tables. Don't try to be clever and save effort on 98 | exclusive ones - in some locales things may be different. Note that the table 99 | for "space" includes everything "isspace" gives, including VT in the default 100 | locale. This makes it work for the POSIX class [:space:]. Note also that it is 101 | possible for a character to be alnum or alpha without being lower or upper, 102 | such as "male and female ordinals" (\xAA and \xBA) in the fr_FR locale (at 103 | least under Debian Linux's locales as of 12/2005). So we must test for alnum 104 | specially. */ 105 | 106 | memset(p, 0, cbit_length); 107 | for (i = 0; i < 256; i++) 108 | { 109 | if (isdigit(i)) p[cbit_digit + i/8] |= 1 << (i&7); 110 | if (isupper(i)) p[cbit_upper + i/8] |= 1 << (i&7); 111 | if (islower(i)) p[cbit_lower + i/8] |= 1 << (i&7); 112 | if (isalnum(i)) p[cbit_word + i/8] |= 1 << (i&7); 113 | if (i == '_') p[cbit_word + i/8] |= 1 << (i&7); 114 | if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7); 115 | if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7); 116 | if (isgraph(i)) p[cbit_graph + i/8] |= 1 << (i&7); 117 | if (isprint(i)) p[cbit_print + i/8] |= 1 << (i&7); 118 | if (ispunct(i)) p[cbit_punct + i/8] |= 1 << (i&7); 119 | if (iscntrl(i)) p[cbit_cntrl + i/8] |= 1 << (i&7); 120 | } 121 | p += cbit_length; 122 | 123 | /* Finally, the character type table. In this, we exclude VT from the white 124 | space chars, because Perl doesn't recognize it as such for \s and for comments 125 | within regexes. */ 126 | 127 | for (i = 0; i < 256; i++) 128 | { 129 | int x = 0; 130 | if (i != 0x0b && isspace(i)) x += ctype_space; 131 | if (isalpha(i)) x += ctype_letter; 132 | if (isdigit(i)) x += ctype_digit; 133 | if (isxdigit(i)) x += ctype_xdigit; 134 | if (isalnum(i) || i == '_') x += ctype_word; 135 | 136 | /* Note: strchr includes the terminating zero in the characters it considers. 137 | In this instance, that is ok because we want binary zero to be flagged as a 138 | meta-character, which in this sense is any character that terminates a run 139 | of data characters. */ 140 | 141 | if (strchr("\\*+?{^.$|()[", i) != 0) x += ctype_meta; 142 | *p++ = x; 143 | } 144 | 145 | return yield; 146 | } 147 | 148 | /* End of pcre_maketables.c */ 149 | -------------------------------------------------------------------------------- /debug.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {(enum_act)mActionType} ln {mLineNumber} 5 | 6 | (enum_act)mActionType 7 | sSourceFile[mFileIndex],sub 8 | mLineNumber,d 9 | mArg,[mArgc] 10 | (UserFunc*)mAttribute 11 | 12 | 13 | 14 | {text,sub} 15 | {text,su} 16 | 17 | 18 | {marker} 19 | {value_int64} 20 | {value_double} 21 | {object} 22 | {*var} 23 | {*var_deref} 24 | (end marker) 25 | {symbol,en} {error_reporting_marker,sub} 26 | {symbol,en} 27 | 28 | marker 29 | marker_length 30 | value_int64 31 | value_double 32 | object 33 | var 34 | var_deref 35 | callsite 36 | marker 37 | 38 | 39 | 40 | {mName,sub} = {mContentsInt64} 41 | {mName,sub} = {mContentsDouble} 42 | {mName,sub} = {mObject} 43 | {mName,sub} -> {mAliasFor} 44 | {mName,sub} is unset 45 | {mName,sub} = {mCharContents,su} 46 | 47 | mObject 48 | 49 | 50 | 51 | {marker,[length]sub} 52 | 53 | 54 | {mName,sub}() 55 | 56 | 57 | {((FieldType *)(mFields.data + 1))[0]}, {((FieldType *)(mFields.data + 1))[1]}, {((FieldType *)(mFields.data + 1))[2]}, {((FieldType *)(mFields.data + 1))[3]} 58 | {((FieldType *)(mFields.data + 1))[0]}, {((FieldType *)(mFields.data + 1))[1]}, {((FieldType *)(mFields.data + 1))[2]} 59 | {((FieldType *)(mFields.data + 1))[0]}, {((FieldType *)(mFields.data + 1))[1]} 60 | {((FieldType *)(mFields.data + 1))[0]} 61 | (no properties) 62 | 63 | 64 | 65 | 66 | mFields.data->length 67 | (FieldType *)(mFields.data + 1) 68 | 69 | 70 | 71 | 72 | 73 | 74 | {string} 75 | {n_int64} 76 | {n_double} 77 | {{{*object}}} 78 | {*prop} 79 | unset 80 | (bad symbol: {symbol}) 81 | 82 | 83 | {name,sub} = {*(Variant *)this,nd} 84 | 85 | name,sub 86 | string 87 | n_int64 88 | n_double 89 | *object 90 | *prop 91 | *(Variant *)this,nd 92 | 93 | 94 | 95 | 96 | *mGet 97 | *mSet 98 | *mCall 99 | 100 | 101 | 102 | 103 | 104 | mLength 105 | mItem 106 | 107 | 108 | 109 | 110 | {(wchar_t*)(data + 1),su} 111 | 112 | -------------------------------------------------------------------------------- /source/script_com.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | extern bool g_ComErrorNotify; 5 | 6 | 7 | class ComObject; 8 | class ComEvent : public ObjectBase 9 | { 10 | DWORD mCookie = 0; 11 | ComObject *mObject; 12 | ITypeInfo *mTypeInfo = nullptr; 13 | IID mIID; 14 | IObject *mAhkObject = nullptr; 15 | ScriptModule *mModule = nullptr; 16 | TCHAR mPrefix[64]; 17 | 18 | public: 19 | STDMETHODIMP QueryInterface(REFIID riid, void **ppv); 20 | STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId); 21 | STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); 22 | 23 | // IObject::Invoke() and Type() are unlikely to be called, since that would mean 24 | // the script has a reference to the object, which means either that the script 25 | // itself has implemented IConnectionPoint (and why would it?), or has used the 26 | // IEnumConnections interface to retrieve its own object (unlikely). 27 | //ResultType Invoke(IObject_Invoke_PARAMS_DECL); // ObjectBase::Invoke is sufficient. 28 | IObject_Type_Impl("ComEvent") // Unlikely to be called; see above. 29 | Object *Base() { return nullptr; } 30 | 31 | HRESULT Connect(ITypeInfo *tinfo = nullptr, IID *iid = nullptr); 32 | void SetPrefixOrSink(LPCTSTR pfx, IObject *ahkObject); 33 | 34 | ComEvent(ComObject *obj) : mObject(obj) { } 35 | ~ComEvent(); 36 | 37 | friend class ComObject; 38 | }; 39 | 40 | 41 | class ComObject : public ObjectBase 42 | { 43 | public: 44 | union 45 | { 46 | IDispatch *mDispatch; 47 | IUnknown *mUnknown; 48 | SAFEARRAY *mArray; 49 | void *mValPtr; 50 | __int64 mVal64; // Allow 64-bit values when ComObject is used as a VARIANT in 32-bit builds. 51 | }; 52 | ComEvent *mEventSink; 53 | VARTYPE mVarType; 54 | enum { F_OWNVALUE = 1 }; 55 | USHORT mFlags; 56 | 57 | enum 58 | { 59 | P_Ptr, 60 | // ComValueRef 61 | P___Item, // v2.0: Allows accessing a VT_BYREF value via comobj[]. 62 | P___Value = P___Item, // v2.1: Alias to allow use with VAR_VIRTUAL_OBJ (ByRef parameters). 63 | }; 64 | static ObjectMember sRefMembers[], sValueMembers[]; 65 | static ObjectMemberMd sArrayMembers[]; 66 | 67 | FResult SafeArray_Item(VariantParams &aParam, ExprTokenType *aNewValue, ResultToken *aResultToken); 68 | FResult set_SafeArray_Item(ExprTokenType &aNewValue, VariantParams &aParam) { return SafeArray_Item(aParam, &aNewValue, nullptr); } 69 | FResult get_SafeArray_Item(ResultToken &aResultToken, VariantParams &aParam) { return SafeArray_Item(aParam, nullptr, &aResultToken); } 70 | 71 | FResult SafeArray_Clone(IObject *&aRetVal); 72 | FResult SafeArray_Enum(optl, IObject *&aRetVal); 73 | FResult SafeArray_MaxIndex(optl aDims, int &aRetVal); 74 | FResult SafeArray_MinIndex(optl aDims, int &aRetVal); 75 | 76 | ResultType Invoke(IObject_Invoke_PARAMS_DECL); 77 | void Invoke(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount); 78 | LPTSTR Type(); 79 | Object *Base(); 80 | 81 | void ToVariant(VARIANT &aVar) 82 | { 83 | aVar.vt = mVarType; 84 | aVar.llVal = mVal64; 85 | // Caller handles this if needed: 86 | //if (VT_DISPATCH == mVarType && mDispatch) 87 | // mDispatch->AddRef(); 88 | } 89 | 90 | ComObject(IDispatch *pdisp) 91 | : mVal64((__int64)pdisp), mVarType(VT_DISPATCH), mEventSink(NULL), mFlags(0) { } 92 | ComObject(__int64 llVal, VARTYPE vt, USHORT flags = 0) 93 | : mVal64(llVal), mVarType(vt), mEventSink(NULL), mFlags(flags) { } 94 | ~ComObject() 95 | { 96 | if ((VT_DISPATCH == mVarType || VT_UNKNOWN == mVarType) && mUnknown) 97 | { 98 | if (mEventSink) 99 | { 100 | mEventSink->Connect(FALSE); 101 | if (mEventSink) // i.e. it wasn't fully released as a result of calling Unadvise(). 102 | mEventSink->mObject = nullptr; 103 | } 104 | mUnknown->Release(); 105 | } 106 | else if ((mVarType & (VT_BYREF|VT_ARRAY)) == VT_ARRAY && (mFlags & F_OWNVALUE)) 107 | { 108 | SafeArrayDestroy(mArray); 109 | } 110 | else if (mVarType == VT_BSTR && (mFlags & F_OWNVALUE)) 111 | { 112 | SysFreeString((BSTR)mValPtr); 113 | } 114 | } 115 | }; 116 | 117 | 118 | class ComEnum : public EnumBase 119 | { 120 | IEnumVARIANT *penum; 121 | bool cheat; 122 | 123 | public: 124 | ResultType Next(Var *aOutput, Var *aOutputType); 125 | 126 | ComEnum(IEnumVARIANT *enm); 127 | ~ComEnum() 128 | { 129 | penum->Release(); 130 | } 131 | }; 132 | 133 | 134 | class ComArrayEnum : public EnumBase 135 | { 136 | ComObject *mArrayObject; 137 | void *mData; 138 | long mLBound, mUBound; 139 | UINT mElemSize; 140 | VARTYPE mType; 141 | bool mIndexMode; 142 | long mOffset = -1; 143 | 144 | ComArrayEnum(ComObject *aObj, void *aData, long aLBound, long aUBound, UINT aElemSize, VARTYPE aType, bool aIndexMode) 145 | : mArrayObject(aObj), mData(aData), mLBound(aLBound), mUBound(aUBound), mElemSize(aElemSize), mType(aType), mIndexMode(aIndexMode) 146 | { 147 | } 148 | 149 | public: 150 | static HRESULT Begin(ComObject *aArrayObject, ComArrayEnum *&aOutput, int aMode); 151 | ResultType Next(Var *aVar1, Var *aVar2); 152 | ~ComArrayEnum(); 153 | }; 154 | 155 | 156 | // Adapts an AutoHotkey enumerator object to the IEnumVARIANT COM interface. 157 | class EnumComCompat : public IEnumVARIANT, public IServiceProvider 158 | { 159 | IObject *mEnum; 160 | int mRefCount; 161 | bool mCheat; 162 | 163 | public: 164 | EnumComCompat(IObject *enumObj) : mEnum(enumObj), mRefCount(1), mCheat(false) {} 165 | ~EnumComCompat() { mEnum->Release(); } 166 | 167 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject); 168 | STDMETHODIMP_(ULONG) AddRef(); 169 | STDMETHODIMP_(ULONG) Release(); 170 | 171 | STDMETHODIMP Next(ULONG celt, /*out*/ VARIANT *rgVar, /*out*/ ULONG *pCeltFetched); 172 | STDMETHODIMP Skip(ULONG celt); 173 | STDMETHODIMP Reset(); 174 | STDMETHODIMP Clone(/*out*/ IEnumVARIANT **ppEnum); 175 | 176 | STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void **ppvObject); 177 | }; 178 | 179 | 180 | enum TTVArgType 181 | { 182 | VariantIsValue, 183 | VariantIsAllocatedString, 184 | VariantIsVarRef 185 | }; 186 | void TokenToVariant(ExprTokenType &aToken, VARIANT &aVar, TTVArgType *aVarIsArg = FALSE); 187 | HRESULT TokenToVarType(ExprTokenType &aToken, VARTYPE aVarType, void *apValue, bool aCallerIsComValue = false); 188 | 189 | void ComError(HRESULT, ResultToken &, LPTSTR = _T(""), EXCEPINFO* = NULL); 190 | 191 | bool SafeSetTokenObject(ExprTokenType &aToken, IObject *aObject); 192 | 193 | --------------------------------------------------------------------------------