├── .gitignore ├── Common └── KernelUserCommon.h ├── KnComm ├── KnComm.h ├── KnCommUser.h ├── amd64 │ ├── KnComm.lib │ ├── KnComm.sys │ └── KnCommUser.dll └── x86 │ ├── KnComm.lib │ ├── KnComm.sys │ └── KnCommUser.dll ├── README.md ├── knprocfilter ├── knprocfilter.cpp ├── knprocfilter.h ├── knprocfilter.rc ├── knprocfilter.vcxproj ├── knprocfilter.vcxproj.filters └── resource.h ├── py ├── pyprocfilterhelper.py └── sample.py ├── pyprocfilter.sln └── pyprocfilter ├── KnProcFilterManager.cpp ├── KnProcFilterManager.h ├── ReadMe.txt ├── dllmain.cpp ├── pyprocfilter.cpp ├── pyprocfilter.h ├── pyprocfilter.rc ├── pyprocfilter.vcxproj ├── pyprocfilter.vcxproj.filters ├── python ├── include │ ├── Python-ast.h │ ├── Python.h │ ├── abstract.h │ ├── accu.h │ ├── asdl.h │ ├── ast.h │ ├── bitset.h │ ├── bltinmodule.h │ ├── boolobject.h │ ├── bytearrayobject.h │ ├── bytes_methods.h │ ├── bytesobject.h │ ├── cellobject.h │ ├── ceval.h │ ├── classobject.h │ ├── code.h │ ├── codecs.h │ ├── compile.h │ ├── complexobject.h │ ├── datetime.h │ ├── descrobject.h │ ├── dictobject.h │ ├── dtoa.h │ ├── dynamic_annotations.h │ ├── enumobject.h │ ├── errcode.h │ ├── eval.h │ ├── fileobject.h │ ├── fileutils.h │ ├── floatobject.h │ ├── frameobject.h │ ├── funcobject.h │ ├── genobject.h │ ├── graminit.h │ ├── grammar.h │ ├── import.h │ ├── intrcheck.h │ ├── iterobject.h │ ├── listobject.h │ ├── longintrepr.h │ ├── longobject.h │ ├── marshal.h │ ├── memoryobject.h │ ├── metagrammar.h │ ├── methodobject.h │ ├── modsupport.h │ ├── moduleobject.h │ ├── namespaceobject.h │ ├── node.h │ ├── object.h │ ├── objimpl.h │ ├── odictobject.h │ ├── opcode.h │ ├── osdefs.h │ ├── parsetok.h │ ├── patchlevel.h │ ├── pgen.h │ ├── pgenheaders.h │ ├── py_curses.h │ ├── pyarena.h │ ├── pyatomic.h │ ├── pycapsule.h │ ├── pyconfig.h │ ├── pyctype.h │ ├── pydebug.h │ ├── pyerrors.h │ ├── pyexpat.h │ ├── pyfpe.h │ ├── pygetopt.h │ ├── pyhash.h │ ├── pylifecycle.h │ ├── pymacconfig.h │ ├── pymacro.h │ ├── pymath.h │ ├── pymem.h │ ├── pyport.h │ ├── pystate.h │ ├── pystrcmp.h │ ├── pystrhex.h │ ├── pystrtod.h │ ├── pythonrun.h │ ├── pythread.h │ ├── pytime.h │ ├── rangeobject.h │ ├── setobject.h │ ├── sliceobject.h │ ├── structmember.h │ ├── structseq.h │ ├── symtable.h │ ├── sysmodule.h │ ├── token.h │ ├── traceback.h │ ├── tupleobject.h │ ├── typeslots.h │ ├── ucnhash.h │ ├── unicodeobject.h │ ├── warnings.h │ └── weakrefobject.h └── libs │ ├── amd64 │ ├── _tkinter.lib │ ├── libpython35.a │ ├── python3.lib │ ├── python35.lib │ ├── python35_d.lib │ └── python3_d.lib │ └── x86 │ ├── _tkinter.lib │ ├── libpython35.a │ ├── python3.lib │ ├── python35.lib │ ├── python35_d.lib │ └── python3_d.lib ├── resource.h ├── stdafx.cpp ├── stdafx.h └── targetver.h /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | bld/ 20 | [Bb]in/ 21 | [Oo]bj/ 22 | 23 | # Visual Studio 2015 cache/options directory 24 | .vs/ 25 | # Uncomment if you have tasks that create the project's static files in wwwroot 26 | #wwwroot/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opendb 78 | *.opensdf 79 | *.sdf 80 | *.cachefile 81 | 82 | # Visual Studio profiler 83 | *.psess 84 | *.vsp 85 | *.vspx 86 | *.sap 87 | 88 | # TFS 2012 Local Workspace 89 | $tf/ 90 | 91 | # Guidance Automation Toolkit 92 | *.gpState 93 | 94 | # ReSharper is a .NET coding add-in 95 | _ReSharper*/ 96 | *.[Rr]e[Ss]harper 97 | *.DotSettings.user 98 | 99 | # JustCode is a .NET coding add-in 100 | .JustCode 101 | 102 | # TeamCity is a build add-in 103 | _TeamCity* 104 | 105 | # DotCover is a Code Coverage Tool 106 | *.dotCover 107 | 108 | # NCrunch 109 | _NCrunch_* 110 | .*crunch*.local.xml 111 | nCrunchTemp_* 112 | 113 | # MightyMoose 114 | *.mm.* 115 | AutoTest.Net/ 116 | 117 | # Web workbench (sass) 118 | .sass-cache/ 119 | 120 | # Installshield output folder 121 | [Ee]xpress/ 122 | 123 | # DocProject is a documentation generator add-in 124 | DocProject/buildhelp/ 125 | DocProject/Help/*.HxT 126 | DocProject/Help/*.HxC 127 | DocProject/Help/*.hhc 128 | DocProject/Help/*.hhk 129 | DocProject/Help/*.hhp 130 | DocProject/Help/Html2 131 | DocProject/Help/html 132 | 133 | # Click-Once directory 134 | publish/ 135 | 136 | # Publish Web Output 137 | *.[Pp]ublish.xml 138 | *.azurePubxml 139 | # TODO: Comment the next line if you want to checkin your web deploy settings 140 | # but database connection strings (with potential passwords) will be unencrypted 141 | *.pubxml 142 | *.publishproj 143 | 144 | # NuGet Packages 145 | *.nupkg 146 | # The packages folder can be ignored because of Package Restore 147 | **/packages/* 148 | # except build/, which is used as an MSBuild target. 149 | !**/packages/build/ 150 | # Uncomment if necessary however generally it will be regenerated when needed 151 | #!**/packages/repositories.config 152 | 153 | # Microsoft Azure Build Output 154 | csx/ 155 | *.build.csdef 156 | 157 | # Microsoft Azure Emulator 158 | ecf/ 159 | rcf/ 160 | 161 | # Microsoft Azure ApplicationInsights config file 162 | ApplicationInsights.config 163 | 164 | # Windows Store app package directory 165 | AppPackages/ 166 | BundleArtifacts/ 167 | 168 | # Visual Studio cache files 169 | # files ending in .cache can be ignored 170 | *.[Cc]ache 171 | # but keep track of directories ending in .cache 172 | !*.[Cc]ache/ 173 | 174 | # Others 175 | ClientBin/ 176 | ~$* 177 | *~ 178 | *.dbmdl 179 | *.dbproj.schemaview 180 | *.pfx 181 | *.publishsettings 182 | node_modules/ 183 | orleans.codegen.cs 184 | 185 | # RIA/Silverlight projects 186 | Generated_Code/ 187 | 188 | # Backup & report files from converting an old project file 189 | # to a newer Visual Studio version. Backup files are not needed, 190 | # because we have git ;-) 191 | _UpgradeReport_Files/ 192 | Backup*/ 193 | UpgradeLog*.XML 194 | UpgradeLog*.htm 195 | 196 | # SQL Server files 197 | *.mdf 198 | *.ldf 199 | 200 | # Business Intelligence projects 201 | *.rdl.data 202 | *.bim.layout 203 | *.bim_*.settings 204 | 205 | # Microsoft Fakes 206 | FakesAssemblies/ 207 | 208 | # GhostDoc plugin setting file 209 | *.GhostDoc.xml 210 | 211 | # Node.js Tools for Visual Studio 212 | .ntvs_analysis.dat 213 | 214 | # Visual Studio 6 build log 215 | *.plg 216 | 217 | # Visual Studio 6 workspace options file 218 | *.opt 219 | 220 | # Visual Studio LightSwitch build output 221 | **/*.HTMLClient/GeneratedArtifacts 222 | **/*.DesktopClient/GeneratedArtifacts 223 | **/*.DesktopClient/ModelManifest.xml 224 | **/*.Server/GeneratedArtifacts 225 | **/*.Server/ModelManifest.xml 226 | _Pvt_Extensions 227 | 228 | # Paket dependency manager 229 | .paket/paket.exe 230 | 231 | # FAKE - F# Make 232 | .fake/ 233 | -------------------------------------------------------------------------------- /Common/KernelUserCommon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #define KN_MAX_PATH (512) 5 | 6 | 7 | #pragma pack (push, 1) 8 | 9 | typedef struct _KN_PROCESS_INFO 10 | { 11 | ULONG parentProcessId; 12 | ULONG processId; 13 | wchar_t processPath[KN_MAX_PATH]; 14 | 15 | } KN_PROCESS_INFO, *PKN_PROCESS_INFO; 16 | 17 | 18 | typedef struct _KN_PROCESS_DECISION 19 | { 20 | ULONG processId; 21 | ULONG isAllowed; 22 | 23 | } KN_PROCESS_DECISION, *PKN_PROCESS_DECISION; 24 | 25 | 26 | #pragma pack (pop) -------------------------------------------------------------------------------- /KnComm/KnComm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/KnComm.h -------------------------------------------------------------------------------- /KnComm/KnCommUser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include 5 | 6 | 7 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 8 | typedef HANDLE KNCOMM, *PKNCOMM; 9 | 10 | typedef void (CALLBACK* FN_ONDATARECV)( 11 | IN ULONG dataId, 12 | IN PVOID pData, 13 | IN SIZE_T dataSize, 14 | IN BOOL isReplyRequired, 15 | IN PVOID pContext 16 | ); 17 | 18 | typedef struct _KNCOMM_CB_INFO 19 | { 20 | FN_ONDATARECV pfnOnDataRecv; 21 | PVOID pCallbackContext; 22 | 23 | } KNCOMM_CB_INFO, *PKNCOMM_CB_INFO; 24 | 25 | 26 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 27 | #ifdef __cplusplus 28 | extern "C" 29 | { 30 | #endif 31 | 32 | BOOL 33 | WINAPI 34 | ConnectToKnComm( 35 | IN PCWSTR pUniqueName, 36 | IN PKNCOMM_CB_INFO pKnCommCallbackInfo, 37 | OUT PKNCOMM pKnCommHandle 38 | ); 39 | 40 | BOOL 41 | WINAPI 42 | DisconnectFromKnComm( 43 | IN KNCOMM knCommHandle 44 | ); 45 | 46 | BOOL 47 | WINAPI 48 | ReplyDataViaKnComm( 49 | IN KNCOMM knCommHandle, 50 | IN ULONG dataId, 51 | IN PVOID pData, 52 | IN SIZE_T dataSize 53 | ); 54 | 55 | BOOL 56 | WINAPI 57 | IoctlViaKnComm( 58 | IN KNCOMM knCommHandle, 59 | IN ULONG controlCode, 60 | IN PVOID pInputBuffer, 61 | IN ULONG inputBufferSize, 62 | OUT PVOID pOutputBuffer, 63 | IN ULONG outputBufferSize 64 | ); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | 71 | #ifndef KNCOMMUSER_EXPORTS 72 | 73 | typedef BOOL (WINAPI* FN_ConnectToKnComm)( 74 | IN PCWSTR pUniqueName, 75 | IN PKNCOMM_CB_INFO pKnCommCallbackInfo, 76 | OUT PKNCOMM pKnCommHandle 77 | ); 78 | 79 | typedef BOOL (WINAPI* FN_DisconnectFromKnComm)( 80 | IN KNCOMM knCommHandle 81 | ); 82 | 83 | typedef BOOL (WINAPI* FN_ReplyDataViaKnComm)( 84 | IN KNCOMM knCommHandle, 85 | IN ULONG dataId, 86 | IN PVOID pData, 87 | IN SIZE_T dataSize 88 | ); 89 | 90 | typedef BOOL (WINAPI* FN_IoctlViaKnComm)( 91 | IN KNCOMM knCommHandle, 92 | IN ULONG controlCode, 93 | IN PVOID pInputBuffer, 94 | IN ULONG inputBufferSize, 95 | OUT PVOID pOutputBuffer, 96 | IN ULONG outputBufferSize 97 | ); 98 | 99 | #endif -------------------------------------------------------------------------------- /KnComm/amd64/KnComm.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/amd64/KnComm.lib -------------------------------------------------------------------------------- /KnComm/amd64/KnComm.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/amd64/KnComm.sys -------------------------------------------------------------------------------- /KnComm/amd64/KnCommUser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/amd64/KnCommUser.dll -------------------------------------------------------------------------------- /KnComm/x86/KnComm.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/x86/KnComm.lib -------------------------------------------------------------------------------- /KnComm/x86/KnComm.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/x86/KnComm.sys -------------------------------------------------------------------------------- /KnComm/x86/KnCommUser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/KnComm/x86/KnCommUser.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PyProcFilter 2 | Process Filter for Python 3 | 4 | # What 5 | 프로세스 실행 감시 및 차단을 간단하게 할 수 있도록 해주는 파이썬 도우미 6 | 7 | # Target Environment 8 | - Windows (x86 / x64) 9 | - Python 3.5 10 | 11 | # Development Environment 12 | - Visual Studio 2015 13 | - WDK 10586 14 | - Python 3.5 15 | 16 | # Demo 17 | [![Demo Video](http://img.youtube.com/vi/6GtyZO-OHY8/0.jpg)](http://www.youtube.com/watch?v=6GtyZO-OHY8) 18 | 19 | 20 | # Example 21 | ```python 22 | import sys 23 | from pyprocfilterhelper import * 24 | 25 | # 프로세스 실행시 호출되는 콜백 26 | # True 리턴시 실행 허용 27 | # False 리턴시 실행 차단 28 | def process_callback(parentPid, processPid, processPath): 29 | print("{:d} ==> {:d} path : {:s}".format(parentPid, processPid, processPath)) 30 | 31 | # 메모장 실행 차단! 32 | if str(processPath).lower().find("c:\\windows\\system32\\notepad.exe") != -1: 33 | print("Block!!!") 34 | return False 35 | 36 | return True 37 | 38 | 39 | if __name__ == '__main__': 40 | 41 | pf = pyprocfilterhelper() 42 | 43 | # 필터 설치 44 | if pf.install() is False: 45 | print("install error") 46 | sys.exit(0) 47 | 48 | # 필터링 시작 49 | ret = pf.start(process_callback) 50 | if ret is True: 51 | print("Process Filtering Started..."); 52 | try: 53 | while True: 54 | pass 55 | except KeyboardInterrupt: 56 | # 필터링 중지 57 | pf.stop() 58 | print("Process Filtering Stoped..."); 59 | else: 60 | print("Error pyprocfilter()") 61 | 62 | # 필터 제거 63 | pf.uninstall() 64 | ``` -------------------------------------------------------------------------------- /knprocfilter/knprocfilter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/knprocfilter/knprocfilter.cpp -------------------------------------------------------------------------------- /knprocfilter/knprocfilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern "C" 4 | { 5 | #include 6 | #include 7 | } 8 | 9 | 10 | #define _FN_ __FUNCTION__ 11 | 12 | #define _LN_ __LINE__ 13 | 14 | #define TAG_NAME 'FPNK' 15 | 16 | 17 | EXTERN_C 18 | NTSTATUS 19 | DriverEntry( 20 | IN PDRIVER_OBJECT pDriverObject, 21 | IN PUNICODE_STRING pRegistryPath 22 | ); 23 | 24 | void 25 | UnloadRoutine( 26 | IN PDRIVER_OBJECT pDriverObject 27 | ); 28 | 29 | NTSTATUS 30 | PassRoutine( 31 | IN PDEVICE_OBJECT pDeviceObject, 32 | IN PIRP pIrp 33 | ); 34 | 35 | void 36 | NTAPI 37 | OnUserConnect( 38 | IN HANDLE processId, 39 | IN PVOID pContext 40 | ); 41 | 42 | void 43 | NTAPI 44 | OnUserDisconnect( 45 | IN HANDLE processId, 46 | IN PVOID pContext 47 | ); 48 | 49 | void 50 | KnProcessNotifyRoutineEx( 51 | PEPROCESS pProcess, 52 | HANDLE processId, 53 | PPS_CREATE_NOTIFY_INFO pCreateInfo 54 | ); 55 | -------------------------------------------------------------------------------- /knprocfilter/knprocfilter.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/knprocfilter/knprocfilter.rc -------------------------------------------------------------------------------- /knprocfilter/knprocfilter.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58} 23 | {dd38f7fc-d7bd-488b-9242-7d8754cde80d} 24 | v4.5 25 | 12.0 26 | Debug 27 | Win32 28 | knprocfilter 29 | 30 | 31 | 32 | Windows10 33 | true 34 | WindowsKernelModeDriver10.0 35 | Driver 36 | WDM 37 | 38 | 39 | Windows10 40 | false 41 | WindowsKernelModeDriver10.0 42 | Driver 43 | WDM 44 | 45 | 46 | Windows10 47 | true 48 | WindowsKernelModeDriver10.0 49 | Driver 50 | WDM 51 | 52 | 53 | Windows10 54 | false 55 | WindowsKernelModeDriver10.0 56 | Driver 57 | WDM 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | DbgengKernelDebugger 69 | 70 | 71 | DbgengKernelDebugger 72 | false 73 | 74 | 75 | DbgengKernelDebugger 76 | 77 | 78 | DbgengKernelDebugger 79 | false 80 | 81 | 82 | 83 | $(SolutionDir)KnComm;%(AdditionalIncludeDirectories) 84 | 4603;4627;4986;4987;4996;4302;4311;%(DisableSpecificWarnings) 85 | 86 | 87 | $(SolutionDir)KnComm\$(ProcessorArchitecture) 88 | %(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;KnComm.lib 89 | /INTEGRITYCHECK %(AdditionalOptions) 90 | 91 | 92 | 93 | 94 | $(SolutionDir)KnComm;%(AdditionalIncludeDirectories) 95 | 4603;4627;4986;4987;4996;4302;4311;%(DisableSpecificWarnings) 96 | 97 | 98 | $(SolutionDir)KnComm\$(ProcessorArchitecture) 99 | %(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;KnComm.lib 100 | /INTEGRITYCHECK %(AdditionalOptions) 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /knprocfilter/knprocfilter.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | {4af86e20-8960-408e-8efa-436796e9fa2f} 22 | 23 | 24 | 25 | 26 | Header Files 27 | 28 | 29 | Header Files 30 | 31 | 32 | Common 33 | 34 | 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Resource Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /knprocfilter/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by knprocfilter.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /py/pyprocfilterhelper.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on 2016. 1.18. 3 | 4 | @author: kernullist.gloryo 5 | ''' 6 | 7 | import os 8 | import subprocess 9 | import shutil 10 | import shlex 11 | import pyprocfilter 12 | 13 | 14 | # status 15 | ERROR_SUCCESS = 0 16 | ERROR_SERVICE_ALREADY_RUNNING = 1056 17 | ERROR_SERVICE_DOES_NOT_EXIST = 1060 18 | ERROR_SERVICE_NOT_ACTIVE = 1062 19 | ERROR_SERVICE_EXISTS = 1073 20 | 21 | 22 | # pyprocfilterhelper 23 | class pyprocfilterhelper(object): 24 | def __init__(self): 25 | self.sysname = "knprocfilter" 26 | self.windows_path = os.environ.get("windir") 27 | self.drivers_path = os.path.join(self.windows_path, "system32\\drivers") 28 | self.knprocfilter_path = os.path.join(self.drivers_path, "knprocfilter.sys") 29 | self.kncomm_path = os.path.join(self.drivers_path, "kncomm.sys") 30 | 31 | def __del__(self): 32 | self.__stop_service(self.sysname) 33 | 34 | def print_paths(self): 35 | print("windows_path : ", self.windows_path) 36 | print("drivers_path : ", self.drivers_path) 37 | print("knprocfilter_path : ", self.knprocfilter_path) 38 | print("kncomm_path : ", self.kncomm_path) 39 | 40 | def __copy_sys_to_drivers(self): 41 | shutil.copy2("knprocfilter.sys", self.drivers_path) 42 | shutil.copy2("kncomm.sys", self.drivers_path) 43 | 44 | def __delete_sys_from_drivers(self): 45 | os.remove(self.knprocfilter_path) 46 | os.remove(self.kncomm_path) 47 | 48 | def __execute(self, cmd): 49 | sc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) 50 | sc.communicate() 51 | rc = sc.wait() 52 | return rc 53 | 54 | def __create_service(self, svcname, binpath): 55 | cmd = "sc create {:s} binPath= '{:s}' type= kernel start= demand displayname= {:s}".format(svcname, binpath, svcname) 56 | rc = self.__execute(cmd) 57 | if rc == ERROR_SUCCESS or rc == ERROR_SERVICE_EXISTS: 58 | return True 59 | return False 60 | 61 | def __delete_service(self, svcname): 62 | cmd = "sc delete {:s}".format(svcname) 63 | rc = self.__execute(cmd) 64 | if rc == ERROR_SUCCESS or rc == ERROR_SERVICE_DOES_NOT_EXIST: 65 | return True 66 | return False 67 | 68 | def __start_service(self, svcname): 69 | cmd = "sc start {:s}".format(svcname) 70 | rc = self.__execute(cmd) 71 | if rc == ERROR_SUCCESS or rc == ERROR_SERVICE_ALREADY_RUNNING: 72 | return True 73 | return False 74 | 75 | def __stop_service(self, svcname): 76 | cmd = "sc stop {:s}".format(svcname) 77 | rc = self.__execute(cmd) 78 | if rc == ERROR_SUCCESS or rc == ERROR_SERVICE_NOT_ACTIVE: 79 | return True 80 | return False 81 | 82 | def install(self): 83 | self.__copy_sys_to_drivers() 84 | ret = self.__create_service(self.sysname, self.knprocfilter_path) 85 | if ret is not True: 86 | return False 87 | ret = self.__start_service(self.sysname) 88 | if ret is not True: 89 | return False 90 | return True 91 | 92 | def uninstall(self): 93 | self.__stop_service(self.sysname) 94 | self.__delete_service(self.sysname) 95 | self.__delete_sys_from_drivers() 96 | 97 | def start(self, process_callback): 98 | return pyprocfilter.start(process_callback) 99 | 100 | def stop(self): 101 | return pyprocfilter.stop() 102 | -------------------------------------------------------------------------------- /py/sample.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from pyprocfilterhelper import * 3 | 4 | # 프로세스 실행시 호출되는 콜백 5 | # True 리턴시 실행 허용 6 | # False 리턴시 실행 차단 7 | def process_callback(parentPid, processPid, processPath): 8 | print("{:d} ==> {:d} path : {:s}".format(parentPid, processPid, processPath)) 9 | 10 | # 메모장 실행 차단! 11 | if str(processPath).lower().find("c:\\windows\\system32\\notepad.exe") != -1: 12 | print("Block!!!") 13 | return False 14 | 15 | return True 16 | 17 | 18 | if __name__ == '__main__': 19 | 20 | pf = pyprocfilterhelper() 21 | 22 | # 필터 설치 23 | if pf.install() is False: 24 | print("install error") 25 | sys.exit(0) 26 | 27 | # 필터링 시작 28 | ret = pf.start(process_callback) 29 | if ret is True: 30 | print("Process Filtering Started..."); 31 | try: 32 | while True: 33 | pass 34 | except KeyboardInterrupt: 35 | # 필터링 중지 36 | pf.stop() 37 | print("Process Filtering Stoped..."); 38 | else: 39 | print("Error pyprocfilter()") 40 | 41 | # 필터 제거 42 | pf.uninstall() 43 | -------------------------------------------------------------------------------- /pyprocfilter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyprocfilter", "pyprocfilter\pyprocfilter.vcxproj", "{316243EB-53E9-4BCC-A164-33582429A8CC}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "knprocfilter", "knprocfilter\knprocfilter.vcxproj", "{6EEDB758-96E4-4944-8D90-E1B3E0722B58}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {316243EB-53E9-4BCC-A164-33582429A8CC}.Release|x64.ActiveCfg = Release|x64 17 | {316243EB-53E9-4BCC-A164-33582429A8CC}.Release|x64.Build.0 = Release|x64 18 | {316243EB-53E9-4BCC-A164-33582429A8CC}.Release|x86.ActiveCfg = Release|Win32 19 | {316243EB-53E9-4BCC-A164-33582429A8CC}.Release|x86.Build.0 = Release|Win32 20 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58}.Release|x64.ActiveCfg = Release|x64 21 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58}.Release|x64.Build.0 = Release|x64 22 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58}.Release|x64.Deploy.0 = Release|x64 23 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58}.Release|x86.ActiveCfg = Release|Win32 24 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58}.Release|x86.Build.0 = Release|Win32 25 | {6EEDB758-96E4-4944-8D90-E1B3E0722B58}.Release|x86.Deploy.0 = Release|Win32 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /pyprocfilter/KnProcFilterManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "KnProcFilterManager.h" 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 6 | std::tr1::shared_ptr KnProcFilterManager::_Instance; 7 | 8 | 9 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 10 | KnProcFilterManager::KnProcFilterManager() 11 | { 12 | } 13 | 14 | 15 | KnProcFilterManager::~KnProcFilterManager() 16 | { 17 | } 18 | 19 | 20 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | KnProcFilterManager& KnProcFilterManager::GetInstance(void) 22 | { 23 | if (_Instance.get() == nullptr) 24 | { 25 | _Instance.reset(new (std::nothrow) KnProcFilterManager); 26 | } 27 | 28 | return *_Instance.get(); 29 | } 30 | 31 | 32 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /pyprocfilter/KnProcFilterManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | class KnProcFilterManager final 5 | { 6 | private: 7 | KnProcFilterManager(void); 8 | KnProcFilterManager(const KnProcFilterManager&); 9 | KnProcFilterManager& operator=(const KnProcFilterManager&); 10 | 11 | public: 12 | ~KnProcFilterManager(void); 13 | 14 | public: 15 | static KnProcFilterManager& GetInstance(void); 16 | 17 | private: 18 | static std::tr1::shared_ptr _Instance; 19 | 20 | private: 21 | HMODULE m_dll; 22 | }; 23 | 24 | 25 | #define MANAGER (KnProcFilterManager::GetInstance()) 26 | -------------------------------------------------------------------------------- /pyprocfilter/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | DYNAMIC LINK LIBRARY : pyprocfilter Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this pyprocfilter DLL for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your pyprocfilter application. 9 | 10 | 11 | pyprocfilter.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | pyprocfilter.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | pyprocfilter.cpp 25 | This is the main DLL source file. 26 | 27 | When created, this DLL does not export any symbols. As a result, it 28 | will not produce a .lib file when it is built. If you wish this project 29 | to be a project dependency of some other project, you will either need to 30 | add code to export some symbols from the DLL so that an export library 31 | will be produced, or you can set the Ignore Input Library property to Yes 32 | on the General propert page of the Linker folder in the project's Property 33 | Pages dialog box. 34 | 35 | ///////////////////////////////////////////////////////////////////////////// 36 | Other standard files: 37 | 38 | StdAfx.h, StdAfx.cpp 39 | These files are used to build a precompiled header (PCH) file 40 | named pyprocfilter.pch and a precompiled types file named StdAfx.obj. 41 | 42 | ///////////////////////////////////////////////////////////////////////////// 43 | Other notes: 44 | 45 | AppWizard uses "TODO:" comments to indicate parts of the source code you 46 | should add to or customize. 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | -------------------------------------------------------------------------------- /pyprocfilter/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /pyprocfilter/pyprocfilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "python.h" 4 | 5 | 6 | static PyObject* start(PyObject* pSelf, PyObject* pArgs); 7 | 8 | static PyObject* stop(PyObject* pSelf, PyObject* pArgs); 9 | 10 | static void CALLBACK OnDataRecvWrapper( 11 | IN ULONG dataId, 12 | IN PVOID pData, 13 | IN SIZE_T dataSize, 14 | IN BOOL isReplyRequired, 15 | IN PVOID pContext 16 | ); 17 | 18 | static void CALLBACK OnDataRecv( 19 | IN ULONG dataId, 20 | IN PVOID pData, 21 | IN SIZE_T dataSize, 22 | IN BOOL isReplyRequired, 23 | IN PVOID pContext 24 | ); -------------------------------------------------------------------------------- /pyprocfilter/pyprocfilter.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/pyprocfilter.rc -------------------------------------------------------------------------------- /pyprocfilter/pyprocfilter.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {e3067f5c-ce96-47de-9d7f-1363e143ac74} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Common 38 | 39 | 40 | Header Files 41 | 42 | 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | 58 | 59 | Resource Files 60 | 61 | 62 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/Python.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PYTHON_H 2 | #define Py_PYTHON_H 3 | /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ 4 | 5 | /* Include nearly all Python header files */ 6 | 7 | #include "patchlevel.h" 8 | #include "pyconfig.h" 9 | #include "pymacconfig.h" 10 | 11 | #include 12 | 13 | #ifndef UCHAR_MAX 14 | #error "Something's broken. UCHAR_MAX should be defined in limits.h." 15 | #endif 16 | 17 | #if UCHAR_MAX != 255 18 | #error "Python's source code assumes C's unsigned char is an 8-bit type." 19 | #endif 20 | 21 | #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) 22 | #define _SGI_MP_SOURCE 23 | #endif 24 | 25 | #include 26 | #ifndef NULL 27 | # error "Python.h requires that stdio.h define NULL." 28 | #endif 29 | 30 | #include 31 | #ifdef HAVE_ERRNO_H 32 | #include 33 | #endif 34 | #include 35 | #ifdef HAVE_UNISTD_H 36 | #include 37 | #endif 38 | 39 | /* For size_t? */ 40 | #ifdef HAVE_STDDEF_H 41 | #include 42 | #endif 43 | 44 | /* CAUTION: Build setups should ensure that NDEBUG is defined on the 45 | * compiler command line when building Python in release mode; else 46 | * assert() calls won't be removed. 47 | */ 48 | #include 49 | 50 | #include "pyport.h" 51 | #include "pymacro.h" 52 | 53 | #include "pyatomic.h" 54 | 55 | /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. 56 | * PYMALLOC_DEBUG is in error if pymalloc is not in use. 57 | */ 58 | #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) 59 | #define PYMALLOC_DEBUG 60 | #endif 61 | #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) 62 | #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" 63 | #endif 64 | #include "pymath.h" 65 | #include "pytime.h" 66 | #include "pymem.h" 67 | 68 | #include "object.h" 69 | #include "objimpl.h" 70 | #include "typeslots.h" 71 | #include "pyhash.h" 72 | 73 | #include "pydebug.h" 74 | 75 | #include "bytearrayobject.h" 76 | #include "bytesobject.h" 77 | #include "unicodeobject.h" 78 | #include "longobject.h" 79 | #include "longintrepr.h" 80 | #include "boolobject.h" 81 | #include "floatobject.h" 82 | #include "complexobject.h" 83 | #include "rangeobject.h" 84 | #include "memoryobject.h" 85 | #include "tupleobject.h" 86 | #include "listobject.h" 87 | #include "dictobject.h" 88 | #include "odictobject.h" 89 | #include "enumobject.h" 90 | #include "setobject.h" 91 | #include "methodobject.h" 92 | #include "moduleobject.h" 93 | #include "funcobject.h" 94 | #include "classobject.h" 95 | #include "fileobject.h" 96 | #include "pycapsule.h" 97 | #include "traceback.h" 98 | #include "sliceobject.h" 99 | #include "cellobject.h" 100 | #include "iterobject.h" 101 | #include "genobject.h" 102 | #include "descrobject.h" 103 | #include "warnings.h" 104 | #include "weakrefobject.h" 105 | #include "structseq.h" 106 | #include "namespaceobject.h" 107 | 108 | #include "codecs.h" 109 | #include "pyerrors.h" 110 | 111 | #include "pystate.h" 112 | 113 | #include "pyarena.h" 114 | #include "modsupport.h" 115 | #include "pythonrun.h" 116 | #include "pylifecycle.h" 117 | #include "ceval.h" 118 | #include "sysmodule.h" 119 | #include "intrcheck.h" 120 | #include "import.h" 121 | 122 | #include "abstract.h" 123 | #include "bltinmodule.h" 124 | 125 | #include "compile.h" 126 | #include "eval.h" 127 | 128 | #include "pyctype.h" 129 | #include "pystrtod.h" 130 | #include "pystrcmp.h" 131 | #include "dtoa.h" 132 | #include "fileutils.h" 133 | #include "pyfpe.h" 134 | 135 | #endif /* !Py_PYTHON_H */ 136 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/accu.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_ACCU_H 3 | #define Py_ACCU_H 4 | 5 | /*** This is a private API for use by the interpreter and the stdlib. 6 | *** Its definition may be changed or removed at any moment. 7 | ***/ 8 | 9 | /* 10 | * A two-level accumulator of unicode objects that avoids both the overhead 11 | * of keeping a huge number of small separate objects, and the quadratic 12 | * behaviour of using a naive repeated concatenation scheme. 13 | */ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #undef small /* defined by some Windows headers */ 20 | 21 | typedef struct { 22 | PyObject *large; /* A list of previously accumulated large strings */ 23 | PyObject *small; /* Pending small strings */ 24 | } _PyAccu; 25 | 26 | PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); 27 | PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); 28 | PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); 29 | PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); 30 | PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* Py_ACCU_H */ 37 | #endif /* Py_LIMITED_API */ 38 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/asdl.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ASDL_H 2 | #define Py_ASDL_H 3 | 4 | typedef PyObject * identifier; 5 | typedef PyObject * string; 6 | typedef PyObject * bytes; 7 | typedef PyObject * object; 8 | typedef PyObject * singleton; 9 | 10 | /* It would be nice if the code generated by asdl_c.py was completely 11 | independent of Python, but it is a goal the requires too much work 12 | at this stage. So, for example, I'll represent identifiers as 13 | interned Python strings. 14 | */ 15 | 16 | /* XXX A sequence should be typed so that its use can be typechecked. */ 17 | 18 | typedef struct { 19 | Py_ssize_t size; 20 | void *elements[1]; 21 | } asdl_seq; 22 | 23 | typedef struct { 24 | Py_ssize_t size; 25 | int elements[1]; 26 | } asdl_int_seq; 27 | 28 | asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena); 29 | asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena); 30 | 31 | #define asdl_seq_GET(S, I) (S)->elements[(I)] 32 | #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) 33 | #ifdef Py_DEBUG 34 | #define asdl_seq_SET(S, I, V) \ 35 | do { \ 36 | Py_ssize_t _asdl_i = (I); \ 37 | assert((S) != NULL); \ 38 | assert(_asdl_i < (S)->size); \ 39 | (S)->elements[_asdl_i] = (V); \ 40 | } while (0) 41 | #else 42 | #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) 43 | #endif 44 | 45 | #endif /* !Py_ASDL_H */ 46 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/ast.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_AST_H 2 | #define Py_AST_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_FUNC(int) PyAST_Validate(mod_ty); 8 | PyAPI_FUNC(mod_ty) PyAST_FromNode( 9 | const node *n, 10 | PyCompilerFlags *flags, 11 | const char *filename, /* decoded from the filesystem encoding */ 12 | PyArena *arena); 13 | PyAPI_FUNC(mod_ty) PyAST_FromNodeObject( 14 | const node *n, 15 | PyCompilerFlags *flags, 16 | PyObject *filename, 17 | PyArena *arena); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif /* !Py_AST_H */ 23 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/bitset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_BITSET_H 3 | #define Py_BITSET_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* Bitset interface */ 9 | 10 | #define BYTE char 11 | 12 | typedef BYTE *bitset; 13 | 14 | bitset newbitset(int nbits); 15 | void delbitset(bitset bs); 16 | #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) 17 | int addbit(bitset bs, int ibit); /* Returns 0 if already set */ 18 | int samebitset(bitset bs1, bitset bs2, int nbits); 19 | void mergebitset(bitset bs1, bitset bs2, int nbits); 20 | 21 | #define BITSPERBYTE (8*sizeof(BYTE)) 22 | #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) 23 | 24 | #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) 25 | #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) 26 | #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) 27 | #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE) 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif /* !Py_BITSET_H */ 33 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/bltinmodule.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_BLTINMODULE_H 2 | #define Py_BLTINMODULE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_DATA(PyTypeObject) PyFilter_Type; 8 | PyAPI_DATA(PyTypeObject) PyMap_Type; 9 | PyAPI_DATA(PyTypeObject) PyZip_Type; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif /* !Py_BLTINMODULE_H */ 15 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/boolobject.h: -------------------------------------------------------------------------------- 1 | /* Boolean object interface */ 2 | 3 | #ifndef Py_BOOLOBJECT_H 4 | #define Py_BOOLOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | PyAPI_DATA(PyTypeObject) PyBool_Type; 11 | 12 | #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) 13 | 14 | /* Py_False and Py_True are the only two bools in existence. 15 | Don't forget to apply Py_INCREF() when returning either!!! */ 16 | 17 | /* Don't use these directly */ 18 | PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct; 19 | 20 | /* Use these macros */ 21 | #define Py_False ((PyObject *) &_Py_FalseStruct) 22 | #define Py_True ((PyObject *) &_Py_TrueStruct) 23 | 24 | /* Macros for returning Py_True or Py_False, respectively */ 25 | #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True 26 | #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False 27 | 28 | /* Function to return a bool from a C long */ 29 | PyAPI_FUNC(PyObject *) PyBool_FromLong(long); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif /* !Py_BOOLOBJECT_H */ 35 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/bytearrayobject.h: -------------------------------------------------------------------------------- 1 | /* ByteArray object interface */ 2 | 3 | #ifndef Py_BYTEARRAYOBJECT_H 4 | #define Py_BYTEARRAYOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include 10 | 11 | /* Type PyByteArrayObject represents a mutable array of bytes. 12 | * The Python API is that of a sequence; 13 | * the bytes are mapped to ints in [0, 256). 14 | * Bytes are not characters; they may be used to encode characters. 15 | * The only way to go between bytes and str/unicode is via encoding 16 | * and decoding. 17 | * For the convenience of C programmers, the bytes type is considered 18 | * to contain a char pointer, not an unsigned char pointer. 19 | */ 20 | 21 | /* Object layout */ 22 | #ifndef Py_LIMITED_API 23 | typedef struct { 24 | PyObject_VAR_HEAD 25 | Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */ 26 | char *ob_bytes; /* Physical backing buffer */ 27 | char *ob_start; /* Logical start inside ob_bytes */ 28 | /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ 29 | int ob_exports; /* How many buffer exports */ 30 | } PyByteArrayObject; 31 | #endif 32 | 33 | /* Type object */ 34 | PyAPI_DATA(PyTypeObject) PyByteArray_Type; 35 | PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; 36 | 37 | /* Type check macros */ 38 | #define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) 39 | #define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) 40 | 41 | /* Direct API functions */ 42 | PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); 43 | PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); 44 | PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); 45 | PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); 46 | PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); 47 | PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); 48 | 49 | /* Macros, trading safety for speed */ 50 | #ifndef Py_LIMITED_API 51 | #define PyByteArray_AS_STRING(self) \ 52 | (assert(PyByteArray_Check(self)), \ 53 | Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string) 54 | #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self)) 55 | 56 | PyAPI_DATA(char) _PyByteArray_empty_string[]; 57 | #endif 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | #endif /* !Py_BYTEARRAYOBJECT_H */ 63 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/bytes_methods.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_BYTES_CTYPE_H 3 | #define Py_BYTES_CTYPE_H 4 | 5 | /* 6 | * The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray) 7 | * methods of the given names, they operate on ASCII byte strings. 8 | */ 9 | extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); 10 | extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); 11 | extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); 12 | extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); 13 | extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); 14 | extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); 15 | extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); 16 | 17 | /* These store their len sized answer in the given preallocated *result arg. */ 18 | extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); 19 | extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); 20 | extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); 21 | extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); 22 | extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); 23 | 24 | /* The maketrans() static method. */ 25 | extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to); 26 | 27 | /* Shared __doc__ strings. */ 28 | extern const char _Py_isspace__doc__[]; 29 | extern const char _Py_isalpha__doc__[]; 30 | extern const char _Py_isalnum__doc__[]; 31 | extern const char _Py_isdigit__doc__[]; 32 | extern const char _Py_islower__doc__[]; 33 | extern const char _Py_isupper__doc__[]; 34 | extern const char _Py_istitle__doc__[]; 35 | extern const char _Py_lower__doc__[]; 36 | extern const char _Py_upper__doc__[]; 37 | extern const char _Py_title__doc__[]; 38 | extern const char _Py_capitalize__doc__[]; 39 | extern const char _Py_swapcase__doc__[]; 40 | extern const char _Py_maketrans__doc__[]; 41 | 42 | /* this is needed because some docs are shared from the .o, not static */ 43 | #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) 44 | 45 | #endif /* !Py_BYTES_CTYPE_H */ 46 | #endif /* !Py_LIMITED_API */ 47 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/bytesobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Bytes (String) object interface */ 3 | 4 | #ifndef Py_BYTESOBJECT_H 5 | #define Py_BYTESOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include 11 | 12 | /* 13 | Type PyBytesObject represents a character string. An extra zero byte is 14 | reserved at the end to ensure it is zero-terminated, but a size is 15 | present so strings with null bytes in them can be represented. This 16 | is an immutable object type. 17 | 18 | There are functions to create new string objects, to test 19 | an object for string-ness, and to get the 20 | string value. The latter function returns a null pointer 21 | if the object is not of the proper type. 22 | There is a variant that takes an explicit size as well as a 23 | variant that assumes a zero-terminated string. Note that none of the 24 | functions should be applied to nil objects. 25 | */ 26 | 27 | /* Caching the hash (ob_shash) saves recalculation of a string's hash value. 28 | This significantly speeds up dict lookups. */ 29 | 30 | #ifndef Py_LIMITED_API 31 | typedef struct { 32 | PyObject_VAR_HEAD 33 | Py_hash_t ob_shash; 34 | char ob_sval[1]; 35 | 36 | /* Invariants: 37 | * ob_sval contains space for 'ob_size+1' elements. 38 | * ob_sval[ob_size] == 0. 39 | * ob_shash is the hash of the string or -1 if not computed yet. 40 | */ 41 | } PyBytesObject; 42 | #endif 43 | 44 | PyAPI_DATA(PyTypeObject) PyBytes_Type; 45 | PyAPI_DATA(PyTypeObject) PyBytesIter_Type; 46 | 47 | #define PyBytes_Check(op) \ 48 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) 49 | #define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) 50 | 51 | PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); 52 | PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); 53 | PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); 54 | PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) 55 | Py_GCC_ATTRIBUTE((format(printf, 1, 0))); 56 | PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) 57 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 58 | PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); 59 | PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); 60 | PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); 61 | PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); 62 | PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); 63 | #ifndef Py_LIMITED_API 64 | PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); 65 | PyAPI_FUNC(PyObject *) _PyBytes_Format(PyObject *, PyObject *); 66 | #endif 67 | PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, 68 | const char *, Py_ssize_t, 69 | const char *); 70 | 71 | /* Macro, trading safety for speed */ 72 | #ifndef Py_LIMITED_API 73 | #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \ 74 | (((PyBytesObject *)(op))->ob_sval)) 75 | #define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op)) 76 | #endif 77 | 78 | /* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, 79 | x must be an iterable object. */ 80 | #ifndef Py_LIMITED_API 81 | PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); 82 | #endif 83 | 84 | /* Provides access to the internal data buffer and size of a string 85 | object or the default encoded version of an Unicode object. Passing 86 | NULL as *len parameter will force the string buffer to be 87 | 0-terminated (passing a string with embedded NULL characters will 88 | cause an exception). */ 89 | PyAPI_FUNC(int) PyBytes_AsStringAndSize( 90 | PyObject *obj, /* string or Unicode object */ 91 | char **s, /* pointer to buffer variable */ 92 | Py_ssize_t *len /* pointer to length variable or NULL 93 | (only possible for 0-terminated 94 | strings) */ 95 | ); 96 | 97 | /* Using the current locale, insert the thousands grouping 98 | into the string pointed to by buffer. For the argument descriptions, 99 | see Objects/stringlib/localeutil.h */ 100 | #ifndef Py_LIMITED_API 101 | PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer, 102 | Py_ssize_t n_buffer, 103 | char *digits, 104 | Py_ssize_t n_digits, 105 | Py_ssize_t min_width); 106 | 107 | /* Using explicit passed-in values, insert the thousands grouping 108 | into the string pointed to by buffer. For the argument descriptions, 109 | see Objects/stringlib/localeutil.h */ 110 | PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer, 111 | Py_ssize_t n_buffer, 112 | char *digits, 113 | Py_ssize_t n_digits, 114 | Py_ssize_t min_width, 115 | const char *grouping, 116 | const char *thousands_sep); 117 | #endif 118 | 119 | /* Flags used by string formatting */ 120 | #define F_LJUST (1<<0) 121 | #define F_SIGN (1<<1) 122 | #define F_BLANK (1<<2) 123 | #define F_ALT (1<<3) 124 | #define F_ZERO (1<<4) 125 | 126 | #ifdef __cplusplus 127 | } 128 | #endif 129 | #endif /* !Py_BYTESOBJECT_H */ 130 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/cellobject.h: -------------------------------------------------------------------------------- 1 | /* Cell object interface */ 2 | #ifndef Py_LIMITED_API 3 | #ifndef Py_CELLOBJECT_H 4 | #define Py_CELLOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct { 10 | PyObject_HEAD 11 | PyObject *ob_ref; /* Content of the cell or NULL when empty */ 12 | } PyCellObject; 13 | 14 | PyAPI_DATA(PyTypeObject) PyCell_Type; 15 | 16 | #define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) 17 | 18 | PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); 19 | PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); 20 | PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); 21 | 22 | #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) 23 | #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /* !Py_TUPLEOBJECT_H */ 29 | #endif /* Py_LIMITED_API */ 30 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/classobject.h: -------------------------------------------------------------------------------- 1 | /* Former class object interface -- now only bound methods are here */ 2 | 3 | /* Revealing some structures (not for general use) */ 4 | 5 | #ifndef Py_LIMITED_API 6 | #ifndef Py_CLASSOBJECT_H 7 | #define Py_CLASSOBJECT_H 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct { 13 | PyObject_HEAD 14 | PyObject *im_func; /* The callable object implementing the method */ 15 | PyObject *im_self; /* The instance it is bound to */ 16 | PyObject *im_weakreflist; /* List of weak references */ 17 | } PyMethodObject; 18 | 19 | PyAPI_DATA(PyTypeObject) PyMethod_Type; 20 | 21 | #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) 22 | 23 | PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); 24 | 25 | PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); 26 | PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); 27 | 28 | /* Macros for direct access to these values. Type checks are *not* 29 | done, so use with care. */ 30 | #define PyMethod_GET_FUNCTION(meth) \ 31 | (((PyMethodObject *)meth) -> im_func) 32 | #define PyMethod_GET_SELF(meth) \ 33 | (((PyMethodObject *)meth) -> im_self) 34 | 35 | PyAPI_FUNC(int) PyMethod_ClearFreeList(void); 36 | 37 | typedef struct { 38 | PyObject_HEAD 39 | PyObject *func; 40 | } PyInstanceMethodObject; 41 | 42 | PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; 43 | 44 | #define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type) 45 | 46 | PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); 47 | PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); 48 | 49 | /* Macros for direct access to these values. Type checks are *not* 50 | done, so use with care. */ 51 | #define PyInstanceMethod_GET_FUNCTION(meth) \ 52 | (((PyInstanceMethodObject *)meth) -> func) 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | #endif /* !Py_CLASSOBJECT_H */ 58 | #endif /* Py_LIMITED_API */ 59 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/code.h: -------------------------------------------------------------------------------- 1 | /* Definitions for bytecode */ 2 | 3 | #ifndef Py_LIMITED_API 4 | #ifndef Py_CODE_H 5 | #define Py_CODE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* Bytecode object */ 11 | typedef struct { 12 | PyObject_HEAD 13 | int co_argcount; /* #arguments, except *args */ 14 | int co_kwonlyargcount; /* #keyword only arguments */ 15 | int co_nlocals; /* #local variables */ 16 | int co_stacksize; /* #entries needed for evaluation stack */ 17 | int co_flags; /* CO_..., see below */ 18 | PyObject *co_code; /* instruction opcodes */ 19 | PyObject *co_consts; /* list (constants used) */ 20 | PyObject *co_names; /* list of strings (names used) */ 21 | PyObject *co_varnames; /* tuple of strings (local variable names) */ 22 | PyObject *co_freevars; /* tuple of strings (free variable names) */ 23 | PyObject *co_cellvars; /* tuple of strings (cell variable names) */ 24 | /* The rest aren't used in either hash or comparisons, except for 25 | co_name (used in both) and co_firstlineno (used only in 26 | comparisons). This is done to preserve the name and line number 27 | for tracebacks and debuggers; otherwise, constant de-duplication 28 | would collapse identical functions/lambdas defined on different lines. 29 | */ 30 | unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */ 31 | PyObject *co_filename; /* unicode (where it was loaded from) */ 32 | PyObject *co_name; /* unicode (name, for reference) */ 33 | int co_firstlineno; /* first source line number */ 34 | PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See 35 | Objects/lnotab_notes.txt for details. */ 36 | void *co_zombieframe; /* for optimization only (see frameobject.c) */ 37 | PyObject *co_weakreflist; /* to support weakrefs to code objects */ 38 | } PyCodeObject; 39 | 40 | /* Masks for co_flags above */ 41 | #define CO_OPTIMIZED 0x0001 42 | #define CO_NEWLOCALS 0x0002 43 | #define CO_VARARGS 0x0004 44 | #define CO_VARKEYWORDS 0x0008 45 | #define CO_NESTED 0x0010 46 | #define CO_GENERATOR 0x0020 47 | /* The CO_NOFREE flag is set if there are no free or cell variables. 48 | This information is redundant, but it allows a single flag test 49 | to determine whether there is any extra work to be done when the 50 | call frame it setup. 51 | */ 52 | #define CO_NOFREE 0x0040 53 | 54 | /* The CO_COROUTINE flag is set for coroutine functions (defined with 55 | ``async def`` keywords) */ 56 | #define CO_COROUTINE 0x0080 57 | #define CO_ITERABLE_COROUTINE 0x0100 58 | 59 | /* These are no longer used. */ 60 | #if 0 61 | #define CO_GENERATOR_ALLOWED 0x1000 62 | #endif 63 | #define CO_FUTURE_DIVISION 0x2000 64 | #define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ 65 | #define CO_FUTURE_WITH_STATEMENT 0x8000 66 | #define CO_FUTURE_PRINT_FUNCTION 0x10000 67 | #define CO_FUTURE_UNICODE_LITERALS 0x20000 68 | 69 | #define CO_FUTURE_BARRY_AS_BDFL 0x40000 70 | #define CO_FUTURE_GENERATOR_STOP 0x80000 71 | 72 | /* This value is found in the co_cell2arg array when the associated cell 73 | variable does not correspond to an argument. The maximum number of 74 | arguments is 255 (indexed up to 254), so 255 work as a special flag.*/ 75 | #define CO_CELL_NOT_AN_ARG 255 76 | 77 | /* This should be defined if a future statement modifies the syntax. 78 | For example, when a keyword is added. 79 | */ 80 | #define PY_PARSER_REQUIRES_FUTURE_KEYWORD 81 | 82 | #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ 83 | 84 | PyAPI_DATA(PyTypeObject) PyCode_Type; 85 | 86 | #define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) 87 | #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) 88 | 89 | /* Public interface */ 90 | PyAPI_FUNC(PyCodeObject *) PyCode_New( 91 | int, int, int, int, int, PyObject *, PyObject *, 92 | PyObject *, PyObject *, PyObject *, PyObject *, 93 | PyObject *, PyObject *, int, PyObject *); 94 | /* same as struct above */ 95 | 96 | /* Creates a new empty code object with the specified source location. */ 97 | PyAPI_FUNC(PyCodeObject *) 98 | PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); 99 | 100 | /* Return the line number associated with the specified bytecode index 101 | in this code object. If you just need the line number of a frame, 102 | use PyFrame_GetLineNumber() instead. */ 103 | PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); 104 | 105 | /* for internal use only */ 106 | typedef struct _addr_pair { 107 | int ap_lower; 108 | int ap_upper; 109 | } PyAddrPair; 110 | 111 | /* Update *bounds to describe the first and one-past-the-last instructions in the 112 | same line as lasti. Return the number of that line. 113 | */ 114 | #ifndef Py_LIMITED_API 115 | PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, 116 | int lasti, PyAddrPair *bounds); 117 | #endif 118 | 119 | PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, 120 | PyObject *names, PyObject *lineno_obj); 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #endif /* !Py_CODE_H */ 126 | #endif /* Py_LIMITED_API */ 127 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/compile.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_COMPILE_H 2 | #define Py_COMPILE_H 3 | 4 | #ifndef Py_LIMITED_API 5 | #include "code.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /* Public interface */ 12 | struct _node; /* Declare the existence of this type */ 13 | PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); 14 | 15 | /* Future feature support */ 16 | 17 | typedef struct { 18 | int ff_features; /* flags set by future statements */ 19 | int ff_lineno; /* line number of last future statement */ 20 | } PyFutureFeatures; 21 | 22 | #define FUTURE_NESTED_SCOPES "nested_scopes" 23 | #define FUTURE_GENERATORS "generators" 24 | #define FUTURE_DIVISION "division" 25 | #define FUTURE_ABSOLUTE_IMPORT "absolute_import" 26 | #define FUTURE_WITH_STATEMENT "with_statement" 27 | #define FUTURE_PRINT_FUNCTION "print_function" 28 | #define FUTURE_UNICODE_LITERALS "unicode_literals" 29 | #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" 30 | #define FUTURE_GENERATOR_STOP "generator_stop" 31 | 32 | struct _mod; /* Declare the existence of this type */ 33 | #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar) 34 | PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx( 35 | struct _mod *mod, 36 | const char *filename, /* decoded from the filesystem encoding */ 37 | PyCompilerFlags *flags, 38 | int optimize, 39 | PyArena *arena); 40 | PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject( 41 | struct _mod *mod, 42 | PyObject *filename, 43 | PyCompilerFlags *flags, 44 | int optimize, 45 | PyArena *arena); 46 | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST( 47 | struct _mod * mod, 48 | const char *filename /* decoded from the filesystem encoding */ 49 | ); 50 | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject( 51 | struct _mod * mod, 52 | PyObject *filename 53 | ); 54 | 55 | /* _Py_Mangle is defined in compile.c */ 56 | PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); 57 | 58 | #define PY_INVALID_STACK_EFFECT INT_MAX 59 | PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* !Py_LIMITED_API */ 66 | 67 | /* These definitions must match corresponding definitions in graminit.h. 68 | There's code in compile.c that checks that they are the same. */ 69 | #define Py_single_input 256 70 | #define Py_file_input 257 71 | #define Py_eval_input 258 72 | 73 | #endif /* !Py_COMPILE_H */ 74 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/complexobject.h: -------------------------------------------------------------------------------- 1 | /* Complex number structure */ 2 | 3 | #ifndef Py_COMPLEXOBJECT_H 4 | #define Py_COMPLEXOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifndef Py_LIMITED_API 10 | typedef struct { 11 | double real; 12 | double imag; 13 | } Py_complex; 14 | 15 | /* Operations on complex numbers from complexmodule.c */ 16 | 17 | PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); 18 | PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); 19 | PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); 20 | PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); 21 | PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); 22 | PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); 23 | PyAPI_FUNC(double) _Py_c_abs(Py_complex); 24 | #endif 25 | 26 | /* Complex object interface */ 27 | 28 | /* 29 | PyComplexObject represents a complex number with double-precision 30 | real and imaginary parts. 31 | */ 32 | #ifndef Py_LIMITED_API 33 | typedef struct { 34 | PyObject_HEAD 35 | Py_complex cval; 36 | } PyComplexObject; 37 | #endif 38 | 39 | PyAPI_DATA(PyTypeObject) PyComplex_Type; 40 | 41 | #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) 42 | #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) 43 | 44 | #ifndef Py_LIMITED_API 45 | PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); 46 | #endif 47 | PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); 48 | 49 | PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); 50 | PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); 51 | #ifndef Py_LIMITED_API 52 | PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); 53 | #endif 54 | 55 | /* Format the object based on the format_spec, as defined in PEP 3101 56 | (Advanced String Formatting). */ 57 | #ifndef Py_LIMITED_API 58 | PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter( 59 | _PyUnicodeWriter *writer, 60 | PyObject *obj, 61 | PyObject *format_spec, 62 | Py_ssize_t start, 63 | Py_ssize_t end); 64 | #endif 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | #endif /* !Py_COMPLEXOBJECT_H */ 70 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/descrobject.h: -------------------------------------------------------------------------------- 1 | /* Descriptors */ 2 | #ifndef Py_DESCROBJECT_H 3 | #define Py_DESCROBJECT_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef PyObject *(*getter)(PyObject *, void *); 9 | typedef int (*setter)(PyObject *, PyObject *, void *); 10 | 11 | typedef struct PyGetSetDef { 12 | char *name; 13 | getter get; 14 | setter set; 15 | char *doc; 16 | void *closure; 17 | } PyGetSetDef; 18 | 19 | #ifndef Py_LIMITED_API 20 | typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, 21 | void *wrapped); 22 | 23 | typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, 24 | void *wrapped, PyObject *kwds); 25 | 26 | struct wrapperbase { 27 | char *name; 28 | int offset; 29 | void *function; 30 | wrapperfunc wrapper; 31 | char *doc; 32 | int flags; 33 | PyObject *name_strobj; 34 | }; 35 | 36 | /* Flags for above struct */ 37 | #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ 38 | 39 | /* Various kinds of descriptor objects */ 40 | 41 | typedef struct { 42 | PyObject_HEAD 43 | PyTypeObject *d_type; 44 | PyObject *d_name; 45 | PyObject *d_qualname; 46 | } PyDescrObject; 47 | 48 | #define PyDescr_COMMON PyDescrObject d_common 49 | 50 | #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) 51 | #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) 52 | 53 | typedef struct { 54 | PyDescr_COMMON; 55 | PyMethodDef *d_method; 56 | } PyMethodDescrObject; 57 | 58 | typedef struct { 59 | PyDescr_COMMON; 60 | struct PyMemberDef *d_member; 61 | } PyMemberDescrObject; 62 | 63 | typedef struct { 64 | PyDescr_COMMON; 65 | PyGetSetDef *d_getset; 66 | } PyGetSetDescrObject; 67 | 68 | typedef struct { 69 | PyDescr_COMMON; 70 | struct wrapperbase *d_base; 71 | void *d_wrapped; /* This can be any function pointer */ 72 | } PyWrapperDescrObject; 73 | #endif /* Py_LIMITED_API */ 74 | 75 | PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; 76 | PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; 77 | PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; 78 | PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; 79 | PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; 80 | PyAPI_DATA(PyTypeObject) PyDictProxy_Type; 81 | PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; 82 | 83 | PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); 84 | PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); 85 | struct PyMemberDef; /* forward declaration for following prototype */ 86 | PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, 87 | struct PyMemberDef *); 88 | PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, 89 | struct PyGetSetDef *); 90 | #ifndef Py_LIMITED_API 91 | PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, 92 | struct wrapperbase *, void *); 93 | #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) 94 | #endif 95 | 96 | PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); 97 | PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); 98 | 99 | 100 | PyAPI_DATA(PyTypeObject) PyProperty_Type; 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | #endif /* !Py_DESCROBJECT_H */ 105 | 106 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/dtoa.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef PY_NO_SHORT_FLOAT_REPR 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); 8 | PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, 9 | int *decpt, int *sign, char **rve); 10 | PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); 11 | PyAPI_FUNC(double) _Py_dg_stdnan(int sign); 12 | PyAPI_FUNC(double) _Py_dg_infinity(int sign); 13 | 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/enumobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ENUMOBJECT_H 2 | #define Py_ENUMOBJECT_H 3 | 4 | /* Enumerate Object */ 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_DATA(PyTypeObject) PyEnum_Type; 11 | PyAPI_DATA(PyTypeObject) PyReversed_Type; 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* !Py_ENUMOBJECT_H */ 18 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/errcode.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ERRCODE_H 2 | #define Py_ERRCODE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Error codes passed around between file input, tokenizer, parser and 9 | interpreter. This is necessary so we can turn them into Python 10 | exceptions at a higher level. Note that some errors have a 11 | slightly different meaning when passed from the tokenizer to the 12 | parser than when passed from the parser to the interpreter; e.g. 13 | the parser only returns E_EOF when it hits EOF immediately, and it 14 | never returns E_OK. */ 15 | 16 | #define E_OK 10 /* No error */ 17 | #define E_EOF 11 /* End Of File */ 18 | #define E_INTR 12 /* Interrupted */ 19 | #define E_TOKEN 13 /* Bad token */ 20 | #define E_SYNTAX 14 /* Syntax error */ 21 | #define E_NOMEM 15 /* Ran out of memory */ 22 | #define E_DONE 16 /* Parsing complete */ 23 | #define E_ERROR 17 /* Execution error */ 24 | #define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ 25 | #define E_OVERFLOW 19 /* Node had too many children */ 26 | #define E_TOODEEP 20 /* Too many indentation levels */ 27 | #define E_DEDENT 21 /* No matching outer block for dedent */ 28 | #define E_DECODE 22 /* Error in decoding into Unicode */ 29 | #define E_EOFS 23 /* EOF in triple-quoted string */ 30 | #define E_EOLS 24 /* EOL in single-quoted string */ 31 | #define E_LINECONT 25 /* Unexpected characters after a line continuation */ 32 | #define E_IDENTIFIER 26 /* Invalid characters in identifier */ 33 | #define E_BADSINGLE 27 /* Ill-formed single statement input */ 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | #endif /* !Py_ERRCODE_H */ 39 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/eval.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interface to execute compiled code */ 3 | 4 | #ifndef Py_EVAL_H 5 | #define Py_EVAL_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); 11 | 12 | PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, 13 | PyObject *globals, 14 | PyObject *locals, 15 | PyObject **args, int argc, 16 | PyObject **kwds, int kwdc, 17 | PyObject **defs, int defc, 18 | PyObject *kwdefs, PyObject *closure); 19 | 20 | #ifndef Py_LIMITED_API 21 | PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); 22 | #endif 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* !Py_EVAL_H */ 28 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/fileobject.h: -------------------------------------------------------------------------------- 1 | /* File object interface (what's left of it -- see io.py) */ 2 | 3 | #ifndef Py_FILEOBJECT_H 4 | #define Py_FILEOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #define PY_STDIOTEXTMODE "b" 10 | 11 | PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int, 12 | const char *, const char *, 13 | const char *, int); 14 | PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); 15 | PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); 16 | PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); 17 | PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); 18 | #ifndef Py_LIMITED_API 19 | PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); 20 | #endif 21 | 22 | /* The default encoding used by the platform file system APIs 23 | If non-NULL, this is different than the default encoding for strings 24 | */ 25 | PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; 26 | PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; 27 | 28 | /* Internal API 29 | 30 | The std printer acts as a preliminary sys.stderr until the new io 31 | infrastructure is in place. */ 32 | #ifndef Py_LIMITED_API 33 | PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); 34 | PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; 35 | #endif /* Py_LIMITED_API */ 36 | 37 | /* A routine to check if a file descriptor can be select()-ed. */ 38 | #ifdef HAVE_SELECT 39 | #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) 40 | #else 41 | #define _PyIsSelectable_fd(FD) (1) 42 | #endif /* HAVE_SELECT */ 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | #endif /* !Py_FILEOBJECT_H */ 48 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/fileutils.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_FILEUTILS_H 2 | #define Py_FILEUTILS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(PyObject *) _Py_device_encoding(int); 9 | 10 | PyAPI_FUNC(wchar_t *) Py_DecodeLocale( 11 | const char *arg, 12 | size_t *size); 13 | 14 | PyAPI_FUNC(char*) Py_EncodeLocale( 15 | const wchar_t *text, 16 | size_t *error_pos); 17 | 18 | #ifndef Py_LIMITED_API 19 | 20 | #ifdef MS_WINDOWS 21 | struct _Py_stat_struct { 22 | unsigned long st_dev; 23 | __int64 st_ino; 24 | unsigned short st_mode; 25 | int st_nlink; 26 | int st_uid; 27 | int st_gid; 28 | unsigned long st_rdev; 29 | __int64 st_size; 30 | time_t st_atime; 31 | int st_atime_nsec; 32 | time_t st_mtime; 33 | int st_mtime_nsec; 34 | time_t st_ctime; 35 | int st_ctime_nsec; 36 | unsigned long st_file_attributes; 37 | }; 38 | #else 39 | # define _Py_stat_struct stat 40 | #endif 41 | 42 | PyAPI_FUNC(int) _Py_fstat( 43 | int fd, 44 | struct _Py_stat_struct *status); 45 | 46 | PyAPI_FUNC(int) _Py_fstat_noraise( 47 | int fd, 48 | struct _Py_stat_struct *status); 49 | #endif /* Py_LIMITED_API */ 50 | 51 | PyAPI_FUNC(int) _Py_stat( 52 | PyObject *path, 53 | struct stat *status); 54 | 55 | #ifndef Py_LIMITED_API 56 | PyAPI_FUNC(int) _Py_open( 57 | const char *pathname, 58 | int flags); 59 | 60 | PyAPI_FUNC(int) _Py_open_noraise( 61 | const char *pathname, 62 | int flags); 63 | #endif 64 | 65 | PyAPI_FUNC(FILE *) _Py_wfopen( 66 | const wchar_t *path, 67 | const wchar_t *mode); 68 | 69 | PyAPI_FUNC(FILE*) _Py_fopen( 70 | const char *pathname, 71 | const char *mode); 72 | 73 | PyAPI_FUNC(FILE*) _Py_fopen_obj( 74 | PyObject *path, 75 | const char *mode); 76 | 77 | PyAPI_FUNC(Py_ssize_t) _Py_read( 78 | int fd, 79 | void *buf, 80 | size_t count); 81 | 82 | PyAPI_FUNC(Py_ssize_t) _Py_write( 83 | int fd, 84 | const void *buf, 85 | size_t count); 86 | 87 | PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( 88 | int fd, 89 | const void *buf, 90 | size_t count); 91 | 92 | #ifdef HAVE_READLINK 93 | PyAPI_FUNC(int) _Py_wreadlink( 94 | const wchar_t *path, 95 | wchar_t *buf, 96 | size_t bufsiz); 97 | #endif 98 | 99 | #ifdef HAVE_REALPATH 100 | PyAPI_FUNC(wchar_t*) _Py_wrealpath( 101 | const wchar_t *path, 102 | wchar_t *resolved_path, 103 | size_t resolved_path_size); 104 | #endif 105 | 106 | PyAPI_FUNC(wchar_t*) _Py_wgetcwd( 107 | wchar_t *buf, 108 | size_t size); 109 | 110 | #ifndef Py_LIMITED_API 111 | PyAPI_FUNC(int) _Py_get_inheritable(int fd); 112 | 113 | PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, 114 | int *atomic_flag_works); 115 | 116 | PyAPI_FUNC(int) _Py_dup(int fd); 117 | 118 | #ifndef MS_WINDOWS 119 | PyAPI_FUNC(int) _Py_get_blocking(int fd); 120 | 121 | PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); 122 | #endif /* !MS_WINDOWS */ 123 | 124 | #if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 125 | /* A routine to check if a file descriptor is valid on Windows. Returns 0 126 | * and sets errno to EBADF if it isn't. This is to avoid Assertions 127 | * from various functions in the Windows CRT beginning with 128 | * Visual Studio 2005 129 | */ 130 | int _PyVerify_fd(int fd); 131 | 132 | #else 133 | #define _PyVerify_fd(A) (1) /* dummy */ 134 | #endif 135 | 136 | #endif /* Py_LIMITED_API */ 137 | 138 | #ifdef __cplusplus 139 | } 140 | #endif 141 | 142 | #endif /* !Py_FILEUTILS_H */ 143 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/floatobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Float object interface */ 3 | 4 | /* 5 | PyFloatObject represents a (double precision) floating point number. 6 | */ 7 | 8 | #ifndef Py_FLOATOBJECT_H 9 | #define Py_FLOATOBJECT_H 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef Py_LIMITED_API 15 | typedef struct { 16 | PyObject_HEAD 17 | double ob_fval; 18 | } PyFloatObject; 19 | #endif 20 | 21 | PyAPI_DATA(PyTypeObject) PyFloat_Type; 22 | 23 | #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) 24 | #define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) 25 | 26 | #ifdef Py_NAN 27 | #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) 28 | #endif 29 | 30 | #define Py_RETURN_INF(sign) do \ 31 | if (copysign(1., sign) == 1.) { \ 32 | return PyFloat_FromDouble(Py_HUGE_VAL); \ 33 | } else { \ 34 | return PyFloat_FromDouble(-Py_HUGE_VAL); \ 35 | } while(0) 36 | 37 | PyAPI_FUNC(double) PyFloat_GetMax(void); 38 | PyAPI_FUNC(double) PyFloat_GetMin(void); 39 | PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void); 40 | 41 | /* Return Python float from string PyObject. */ 42 | PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*); 43 | 44 | /* Return Python float from C double. */ 45 | PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); 46 | 47 | /* Extract C double from Python float. The macro version trades safety for 48 | speed. */ 49 | PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); 50 | #ifndef Py_LIMITED_API 51 | #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) 52 | #endif 53 | 54 | #ifndef Py_LIMITED_API 55 | /* _PyFloat_{Pack,Unpack}{4,8} 56 | * 57 | * The struct and pickle (at least) modules need an efficient platform- 58 | * independent way to store floating-point values as byte strings. 59 | * The Pack routines produce a string from a C double, and the Unpack 60 | * routines produce a C double from such a string. The suffix (4 or 8) 61 | * specifies the number of bytes in the string. 62 | * 63 | * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats 64 | * these functions work by copying bits. On other platforms, the formats the 65 | * 4- byte format is identical to the IEEE-754 single precision format, and 66 | * the 8-byte format to the IEEE-754 double precision format, although the 67 | * packing of INFs and NaNs (if such things exist on the platform) isn't 68 | * handled correctly, and attempting to unpack a string containing an IEEE 69 | * INF or NaN will raise an exception. 70 | * 71 | * On non-IEEE platforms with more precision, or larger dynamic range, than 72 | * 754 supports, not all values can be packed; on non-IEEE platforms with less 73 | * precision, or smaller dynamic range, not all values can be unpacked. What 74 | * happens in such cases is partly accidental (alas). 75 | */ 76 | 77 | /* The pack routines write 4 or 8 bytes, starting at p. le is a bool 78 | * argument, true if you want the string in little-endian format (exponent 79 | * last, at p+3 or p+7), false if you want big-endian format (exponent 80 | * first, at p). 81 | * Return value: 0 if all is OK, -1 if error (and an exception is 82 | * set, most likely OverflowError). 83 | * There are two problems on non-IEEE platforms: 84 | * 1): What this does is undefined if x is a NaN or infinity. 85 | * 2): -0.0 and +0.0 produce the same string. 86 | */ 87 | PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); 88 | PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); 89 | 90 | /* Needed for the old way for marshal to store a floating point number. 91 | Returns the string length copied into p, -1 on error. 92 | */ 93 | PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len); 94 | 95 | /* Used to get the important decimal digits of a double */ 96 | PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); 97 | PyAPI_FUNC(void) _PyFloat_DigitsInit(void); 98 | 99 | /* The unpack routines read 4 or 8 bytes, starting at p. le is a bool 100 | * argument, true if the string is in little-endian format (exponent 101 | * last, at p+3 or p+7), false if big-endian (exponent first, at p). 102 | * Return value: The unpacked double. On error, this is -1.0 and 103 | * PyErr_Occurred() is true (and an exception is set, most likely 104 | * OverflowError). Note that on a non-IEEE platform this will refuse 105 | * to unpack a string that represents a NaN or infinity. 106 | */ 107 | PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); 108 | PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); 109 | 110 | /* free list api */ 111 | PyAPI_FUNC(int) PyFloat_ClearFreeList(void); 112 | 113 | PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out); 114 | 115 | /* Format the object based on the format_spec, as defined in PEP 3101 116 | (Advanced String Formatting). */ 117 | PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter( 118 | _PyUnicodeWriter *writer, 119 | PyObject *obj, 120 | PyObject *format_spec, 121 | Py_ssize_t start, 122 | Py_ssize_t end); 123 | #endif /* Py_LIMITED_API */ 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | #endif /* !Py_FLOATOBJECT_H */ 129 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/frameobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Frame object interface */ 3 | 4 | #ifndef Py_LIMITED_API 5 | #ifndef Py_FRAMEOBJECT_H 6 | #define Py_FRAMEOBJECT_H 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct { 12 | int b_type; /* what kind of block this is */ 13 | int b_handler; /* where to jump to find handler */ 14 | int b_level; /* value stack level to pop to */ 15 | } PyTryBlock; 16 | 17 | typedef struct _frame { 18 | PyObject_VAR_HEAD 19 | struct _frame *f_back; /* previous frame, or NULL */ 20 | PyCodeObject *f_code; /* code segment */ 21 | PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ 22 | PyObject *f_globals; /* global symbol table (PyDictObject) */ 23 | PyObject *f_locals; /* local symbol table (any mapping) */ 24 | PyObject **f_valuestack; /* points after the last local */ 25 | /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. 26 | Frame evaluation usually NULLs it, but a frame that yields sets it 27 | to the current stack top. */ 28 | PyObject **f_stacktop; 29 | PyObject *f_trace; /* Trace function */ 30 | 31 | /* In a generator, we need to be able to swap between the exception 32 | state inside the generator and the exception state of the calling 33 | frame (which shouldn't be impacted when the generator "yields" 34 | from an except handler). 35 | These three fields exist exactly for that, and are unused for 36 | non-generator frames. See the save_exc_state and swap_exc_state 37 | functions in ceval.c for details of their use. */ 38 | PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; 39 | /* Borrowed reference to a generator, or NULL */ 40 | PyObject *f_gen; 41 | 42 | int f_lasti; /* Last instruction if called */ 43 | /* Call PyFrame_GetLineNumber() instead of reading this field 44 | directly. As of 2.3 f_lineno is only valid when tracing is 45 | active (i.e. when f_trace is set). At other times we use 46 | PyCode_Addr2Line to calculate the line from the current 47 | bytecode index. */ 48 | int f_lineno; /* Current line number */ 49 | int f_iblock; /* index in f_blockstack */ 50 | char f_executing; /* whether the frame is still executing */ 51 | PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ 52 | PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ 53 | } PyFrameObject; 54 | 55 | 56 | /* Standard object interface */ 57 | 58 | PyAPI_DATA(PyTypeObject) PyFrame_Type; 59 | 60 | #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) 61 | 62 | PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, 63 | PyObject *, PyObject *); 64 | 65 | 66 | /* The rest of the interface is specific for frame objects */ 67 | 68 | /* Block management functions */ 69 | 70 | PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); 71 | PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); 72 | 73 | /* Extend the value stack */ 74 | 75 | PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); 76 | 77 | /* Conversions between "fast locals" and locals in dictionary */ 78 | 79 | PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); 80 | 81 | PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f); 82 | PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); 83 | 84 | PyAPI_FUNC(int) PyFrame_ClearFreeList(void); 85 | 86 | PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out); 87 | 88 | /* Return the line of code the frame is currently executing. */ 89 | PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | #endif /* !Py_FRAMEOBJECT_H */ 95 | #endif /* Py_LIMITED_API */ 96 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/funcobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Function object interface */ 3 | #ifndef Py_LIMITED_API 4 | #ifndef Py_FUNCOBJECT_H 5 | #define Py_FUNCOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* Function objects and code objects should not be confused with each other: 11 | * 12 | * Function objects are created by the execution of the 'def' statement. 13 | * They reference a code object in their __code__ attribute, which is a 14 | * purely syntactic object, i.e. nothing more than a compiled version of some 15 | * source code lines. There is one code object per source code "fragment", 16 | * but each code object can be referenced by zero or many function objects 17 | * depending only on how many times the 'def' statement in the source was 18 | * executed so far. 19 | */ 20 | 21 | typedef struct { 22 | PyObject_HEAD 23 | PyObject *func_code; /* A code object, the __code__ attribute */ 24 | PyObject *func_globals; /* A dictionary (other mappings won't do) */ 25 | PyObject *func_defaults; /* NULL or a tuple */ 26 | PyObject *func_kwdefaults; /* NULL or a dict */ 27 | PyObject *func_closure; /* NULL or a tuple of cell objects */ 28 | PyObject *func_doc; /* The __doc__ attribute, can be anything */ 29 | PyObject *func_name; /* The __name__ attribute, a string object */ 30 | PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ 31 | PyObject *func_weakreflist; /* List of weak references */ 32 | PyObject *func_module; /* The __module__ attribute, can be anything */ 33 | PyObject *func_annotations; /* Annotations, a dict or NULL */ 34 | PyObject *func_qualname; /* The qualified name */ 35 | 36 | /* Invariant: 37 | * func_closure contains the bindings for func_code->co_freevars, so 38 | * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) 39 | * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). 40 | */ 41 | } PyFunctionObject; 42 | 43 | PyAPI_DATA(PyTypeObject) PyFunction_Type; 44 | 45 | #define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) 46 | 47 | PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); 48 | PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *); 49 | PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); 50 | PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); 51 | PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); 52 | PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); 53 | PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); 54 | PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *); 55 | PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *); 56 | PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); 57 | PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); 58 | PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); 59 | PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); 60 | 61 | /* Macros for direct access to these values. Type checks are *not* 62 | done, so use with care. */ 63 | #define PyFunction_GET_CODE(func) \ 64 | (((PyFunctionObject *)func) -> func_code) 65 | #define PyFunction_GET_GLOBALS(func) \ 66 | (((PyFunctionObject *)func) -> func_globals) 67 | #define PyFunction_GET_MODULE(func) \ 68 | (((PyFunctionObject *)func) -> func_module) 69 | #define PyFunction_GET_DEFAULTS(func) \ 70 | (((PyFunctionObject *)func) -> func_defaults) 71 | #define PyFunction_GET_KW_DEFAULTS(func) \ 72 | (((PyFunctionObject *)func) -> func_kwdefaults) 73 | #define PyFunction_GET_CLOSURE(func) \ 74 | (((PyFunctionObject *)func) -> func_closure) 75 | #define PyFunction_GET_ANNOTATIONS(func) \ 76 | (((PyFunctionObject *)func) -> func_annotations) 77 | 78 | /* The classmethod and staticmethod types lives here, too */ 79 | PyAPI_DATA(PyTypeObject) PyClassMethod_Type; 80 | PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; 81 | 82 | PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); 83 | PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif /* !Py_FUNCOBJECT_H */ 89 | #endif /* Py_LIMITED_API */ 90 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/genobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Generator object interface */ 3 | 4 | #ifndef Py_LIMITED_API 5 | #ifndef Py_GENOBJECT_H 6 | #define Py_GENOBJECT_H 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | struct _frame; /* Avoid including frameobject.h */ 12 | 13 | /* _PyGenObject_HEAD defines the initial segment of generator 14 | and coroutine objects. */ 15 | #define _PyGenObject_HEAD(prefix) \ 16 | PyObject_HEAD \ 17 | /* Note: gi_frame can be NULL if the generator is "finished" */ \ 18 | struct _frame *prefix##_frame; \ 19 | /* True if generator is being executed. */ \ 20 | char prefix##_running; \ 21 | /* The code object backing the generator */ \ 22 | PyObject *prefix##_code; \ 23 | /* List of weak reference. */ \ 24 | PyObject *prefix##_weakreflist; \ 25 | /* Name of the generator. */ \ 26 | PyObject *prefix##_name; \ 27 | /* Qualified name of the generator. */ \ 28 | PyObject *prefix##_qualname; 29 | 30 | typedef struct { 31 | /* The gi_ prefix is intended to remind of generator-iterator. */ 32 | _PyGenObject_HEAD(gi) 33 | } PyGenObject; 34 | 35 | PyAPI_DATA(PyTypeObject) PyGen_Type; 36 | 37 | #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) 38 | #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) 39 | 40 | PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); 41 | PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *, 42 | PyObject *name, PyObject *qualname); 43 | PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); 44 | PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); 45 | PyObject *_PyGen_Send(PyGenObject *, PyObject *); 46 | PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self); 47 | 48 | #ifndef Py_LIMITED_API 49 | typedef struct { 50 | _PyGenObject_HEAD(cr) 51 | } PyCoroObject; 52 | 53 | PyAPI_DATA(PyTypeObject) PyCoro_Type; 54 | PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; 55 | 56 | #define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type) 57 | PyObject *_PyCoro_GetAwaitableIter(PyObject *o); 58 | PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *, 59 | PyObject *name, PyObject *qualname); 60 | #endif 61 | 62 | #undef _PyGenObject_HEAD 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #endif /* !Py_GENOBJECT_H */ 68 | #endif /* Py_LIMITED_API */ 69 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/graminit.h: -------------------------------------------------------------------------------- 1 | /* Generated by Parser/pgen */ 2 | 3 | #define single_input 256 4 | #define file_input 257 5 | #define eval_input 258 6 | #define decorator 259 7 | #define decorators 260 8 | #define decorated 261 9 | #define async_funcdef 262 10 | #define funcdef 263 11 | #define parameters 264 12 | #define typedargslist 265 13 | #define tfpdef 266 14 | #define varargslist 267 15 | #define vfpdef 268 16 | #define stmt 269 17 | #define simple_stmt 270 18 | #define small_stmt 271 19 | #define expr_stmt 272 20 | #define testlist_star_expr 273 21 | #define augassign 274 22 | #define del_stmt 275 23 | #define pass_stmt 276 24 | #define flow_stmt 277 25 | #define break_stmt 278 26 | #define continue_stmt 279 27 | #define return_stmt 280 28 | #define yield_stmt 281 29 | #define raise_stmt 282 30 | #define import_stmt 283 31 | #define import_name 284 32 | #define import_from 285 33 | #define import_as_name 286 34 | #define dotted_as_name 287 35 | #define import_as_names 288 36 | #define dotted_as_names 289 37 | #define dotted_name 290 38 | #define global_stmt 291 39 | #define nonlocal_stmt 292 40 | #define assert_stmt 293 41 | #define compound_stmt 294 42 | #define async_stmt 295 43 | #define if_stmt 296 44 | #define while_stmt 297 45 | #define for_stmt 298 46 | #define try_stmt 299 47 | #define with_stmt 300 48 | #define with_item 301 49 | #define except_clause 302 50 | #define suite 303 51 | #define test 304 52 | #define test_nocond 305 53 | #define lambdef 306 54 | #define lambdef_nocond 307 55 | #define or_test 308 56 | #define and_test 309 57 | #define not_test 310 58 | #define comparison 311 59 | #define comp_op 312 60 | #define star_expr 313 61 | #define expr 314 62 | #define xor_expr 315 63 | #define and_expr 316 64 | #define shift_expr 317 65 | #define arith_expr 318 66 | #define term 319 67 | #define factor 320 68 | #define power 321 69 | #define atom_expr 322 70 | #define atom 323 71 | #define testlist_comp 324 72 | #define trailer 325 73 | #define subscriptlist 326 74 | #define subscript 327 75 | #define sliceop 328 76 | #define exprlist 329 77 | #define testlist 330 78 | #define dictorsetmaker 331 79 | #define classdef 332 80 | #define arglist 333 81 | #define argument 334 82 | #define comp_iter 335 83 | #define comp_for 336 84 | #define comp_if 337 85 | #define encoding_decl 338 86 | #define yield_expr 339 87 | #define yield_arg 340 88 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/grammar.h: -------------------------------------------------------------------------------- 1 | 2 | /* Grammar interface */ 3 | 4 | #ifndef Py_GRAMMAR_H 5 | #define Py_GRAMMAR_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include "bitset.h" /* Sigh... */ 11 | 12 | /* A label of an arc */ 13 | 14 | typedef struct { 15 | int lb_type; 16 | char *lb_str; 17 | } label; 18 | 19 | #define EMPTY 0 /* Label number 0 is by definition the empty label */ 20 | 21 | /* A list of labels */ 22 | 23 | typedef struct { 24 | int ll_nlabels; 25 | label *ll_label; 26 | } labellist; 27 | 28 | /* An arc from one state to another */ 29 | 30 | typedef struct { 31 | short a_lbl; /* Label of this arc */ 32 | short a_arrow; /* State where this arc goes to */ 33 | } arc; 34 | 35 | /* A state in a DFA */ 36 | 37 | typedef struct { 38 | int s_narcs; 39 | arc *s_arc; /* Array of arcs */ 40 | 41 | /* Optional accelerators */ 42 | int s_lower; /* Lowest label index */ 43 | int s_upper; /* Highest label index */ 44 | int *s_accel; /* Accelerator */ 45 | int s_accept; /* Nonzero for accepting state */ 46 | } state; 47 | 48 | /* A DFA */ 49 | 50 | typedef struct { 51 | int d_type; /* Non-terminal this represents */ 52 | char *d_name; /* For printing */ 53 | int d_initial; /* Initial state */ 54 | int d_nstates; 55 | state *d_state; /* Array of states */ 56 | bitset d_first; 57 | } dfa; 58 | 59 | /* A grammar */ 60 | 61 | typedef struct { 62 | int g_ndfas; 63 | dfa *g_dfa; /* Array of DFAs */ 64 | labellist g_ll; 65 | int g_start; /* Start symbol of the grammar */ 66 | int g_accel; /* Set if accelerators present */ 67 | } grammar; 68 | 69 | /* FUNCTIONS */ 70 | 71 | grammar *newgrammar(int start); 72 | dfa *adddfa(grammar *g, int type, const char *name); 73 | int addstate(dfa *d); 74 | void addarc(dfa *d, int from, int to, int lbl); 75 | dfa *PyGrammar_FindDFA(grammar *g, int type); 76 | 77 | int addlabel(labellist *ll, int type, const char *str); 78 | int findlabel(labellist *ll, int type, const char *str); 79 | const char *PyGrammar_LabelRepr(label *lb); 80 | void translatelabels(grammar *g); 81 | 82 | void addfirstsets(grammar *g); 83 | 84 | void PyGrammar_AddAccelerators(grammar *g); 85 | void PyGrammar_RemoveAccelerators(grammar *); 86 | 87 | void printgrammar(grammar *g, FILE *fp); 88 | void printnonterminals(grammar *g, FILE *fp); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #endif /* !Py_GRAMMAR_H */ 94 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/import.h: -------------------------------------------------------------------------------- 1 | 2 | /* Module definition and import interface */ 3 | 4 | #ifndef Py_IMPORT_H 5 | #define Py_IMPORT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(void) _PyImportZip_Init(void); 11 | 12 | PyMODINIT_FUNC PyInit_imp(void); 13 | PyAPI_FUNC(long) PyImport_GetMagicNumber(void); 14 | PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); 15 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( 16 | const char *name, /* UTF-8 encoded string */ 17 | PyObject *co 18 | ); 19 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( 20 | const char *name, /* UTF-8 encoded string */ 21 | PyObject *co, 22 | const char *pathname /* decoded from the filesystem encoding */ 23 | ); 24 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( 25 | const char *name, /* UTF-8 encoded string */ 26 | PyObject *co, 27 | const char *pathname, /* decoded from the filesystem encoding */ 28 | const char *cpathname /* decoded from the filesystem encoding */ 29 | ); 30 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( 31 | PyObject *name, 32 | PyObject *co, 33 | PyObject *pathname, 34 | PyObject *cpathname 35 | ); 36 | PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); 37 | PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( 38 | PyObject *name 39 | ); 40 | PyAPI_FUNC(PyObject *) PyImport_AddModule( 41 | const char *name /* UTF-8 encoded string */ 42 | ); 43 | PyAPI_FUNC(PyObject *) PyImport_ImportModule( 44 | const char *name /* UTF-8 encoded string */ 45 | ); 46 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock( 47 | const char *name /* UTF-8 encoded string */ 48 | ); 49 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel( 50 | const char *name, /* UTF-8 encoded string */ 51 | PyObject *globals, 52 | PyObject *locals, 53 | PyObject *fromlist, 54 | int level 55 | ); 56 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( 57 | PyObject *name, 58 | PyObject *globals, 59 | PyObject *locals, 60 | PyObject *fromlist, 61 | int level 62 | ); 63 | 64 | #define PyImport_ImportModuleEx(n, g, l, f) \ 65 | PyImport_ImportModuleLevel(n, g, l, f, 0) 66 | 67 | PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); 68 | PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); 69 | PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); 70 | PyAPI_FUNC(void) PyImport_Cleanup(void); 71 | PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( 72 | PyObject *name 73 | ); 74 | PyAPI_FUNC(int) PyImport_ImportFrozenModule( 75 | const char *name /* UTF-8 encoded string */ 76 | ); 77 | 78 | #ifndef Py_LIMITED_API 79 | #ifdef WITH_THREAD 80 | PyAPI_FUNC(void) _PyImport_AcquireLock(void); 81 | PyAPI_FUNC(int) _PyImport_ReleaseLock(void); 82 | #else 83 | #define _PyImport_AcquireLock() 84 | #define _PyImport_ReleaseLock() 1 85 | #endif 86 | 87 | PyAPI_FUNC(void) _PyImport_ReInitLock(void); 88 | 89 | PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( 90 | const char *name /* UTF-8 encoded string */ 91 | ); 92 | PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); 93 | PyAPI_FUNC(int) _PyImport_FixupBuiltin( 94 | PyObject *mod, 95 | const char *name /* UTF-8 encoded string */ 96 | ); 97 | PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); 98 | 99 | struct _inittab { 100 | const char *name; /* ASCII encoded string */ 101 | PyObject* (*initfunc)(void); 102 | }; 103 | PyAPI_DATA(struct _inittab *) PyImport_Inittab; 104 | PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); 105 | #endif /* Py_LIMITED_API */ 106 | 107 | PyAPI_DATA(PyTypeObject) PyNullImporter_Type; 108 | 109 | PyAPI_FUNC(int) PyImport_AppendInittab( 110 | const char *name, /* ASCII encoded string */ 111 | PyObject* (*initfunc)(void) 112 | ); 113 | 114 | #ifndef Py_LIMITED_API 115 | struct _frozen { 116 | const char *name; /* ASCII encoded string */ 117 | const unsigned char *code; 118 | int size; 119 | }; 120 | 121 | /* Embedding apps may change this pointer to point to their favorite 122 | collection of frozen modules: */ 123 | 124 | PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules; 125 | #endif 126 | 127 | #ifdef __cplusplus 128 | } 129 | #endif 130 | #endif /* !Py_IMPORT_H */ 131 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/intrcheck.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_INTRCHECK_H 3 | #define Py_INTRCHECK_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(int) PyOS_InterruptOccurred(void); 9 | PyAPI_FUNC(void) PyOS_InitInterrupts(void); 10 | PyAPI_FUNC(void) PyOS_AfterFork(void); 11 | PyAPI_FUNC(int) _PyOS_IsMainThread(void); 12 | 13 | #ifdef MS_WINDOWS 14 | /* windows.h is not included by Python.h so use void* instead of HANDLE */ 15 | PyAPI_FUNC(void*) _PyOS_SigintEvent(void); 16 | #endif 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif /* !Py_INTRCHECK_H */ 22 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/iterobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ITEROBJECT_H 2 | #define Py_ITEROBJECT_H 3 | /* Iterators (the basic kind, over a sequence) */ 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_DATA(PyTypeObject) PySeqIter_Type; 9 | PyAPI_DATA(PyTypeObject) PyCallIter_Type; 10 | PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type; 11 | 12 | #define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) 13 | 14 | PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); 15 | 16 | 17 | #define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) 18 | 19 | PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif /* !Py_ITEROBJECT_H */ 25 | 26 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/listobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* List object interface */ 3 | 4 | /* 5 | Another generally useful object type is an list of object pointers. 6 | This is a mutable type: the list items can be changed, and items can be 7 | added or removed. Out-of-range indices or non-list objects are ignored. 8 | 9 | *** WARNING *** PyList_SetItem does not increment the new item's reference 10 | count, but does decrement the reference count of the item it replaces, 11 | if not nil. It does *decrement* the reference count if it is *not* 12 | inserted in the list. Similarly, PyList_GetItem does not increment the 13 | returned item's reference count. 14 | */ 15 | 16 | #ifndef Py_LISTOBJECT_H 17 | #define Py_LISTOBJECT_H 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #ifndef Py_LIMITED_API 23 | typedef struct { 24 | PyObject_VAR_HEAD 25 | /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ 26 | PyObject **ob_item; 27 | 28 | /* ob_item contains space for 'allocated' elements. The number 29 | * currently in use is ob_size. 30 | * Invariants: 31 | * 0 <= ob_size <= allocated 32 | * len(list) == ob_size 33 | * ob_item == NULL implies ob_size == allocated == 0 34 | * list.sort() temporarily sets allocated to -1 to detect mutations. 35 | * 36 | * Items must normally not be NULL, except during construction when 37 | * the list is not yet visible outside the function that builds it. 38 | */ 39 | Py_ssize_t allocated; 40 | } PyListObject; 41 | #endif 42 | 43 | PyAPI_DATA(PyTypeObject) PyList_Type; 44 | PyAPI_DATA(PyTypeObject) PyListIter_Type; 45 | PyAPI_DATA(PyTypeObject) PyListRevIter_Type; 46 | PyAPI_DATA(PyTypeObject) PySortWrapper_Type; 47 | 48 | #define PyList_Check(op) \ 49 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) 50 | #define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) 51 | 52 | PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); 53 | PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); 54 | PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); 55 | PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); 56 | PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); 57 | PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); 58 | PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 59 | PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); 60 | PyAPI_FUNC(int) PyList_Sort(PyObject *); 61 | PyAPI_FUNC(int) PyList_Reverse(PyObject *); 62 | PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); 63 | #ifndef Py_LIMITED_API 64 | PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); 65 | 66 | PyAPI_FUNC(int) PyList_ClearFreeList(void); 67 | PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); 68 | #endif 69 | 70 | /* Macro, trading safety for speed */ 71 | #ifndef Py_LIMITED_API 72 | #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) 73 | #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) 74 | #define PyList_GET_SIZE(op) Py_SIZE(op) 75 | #define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item) 76 | #endif 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | #endif /* !Py_LISTOBJECT_H */ 82 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/longintrepr.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_LONGINTREPR_H 3 | #define Py_LONGINTREPR_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | /* This is published for the benefit of "friends" marshal.c and _decimal.c. */ 10 | 11 | /* Parameters of the integer representation. There are two different 12 | sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit 13 | integer type, and one set for 15-bit digits with each digit stored in an 14 | unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at 15 | configure time or in pyport.h, is used to decide which digit size to use. 16 | 17 | Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' 18 | should be an unsigned integer type able to hold all integers up to 19 | PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, 20 | and that overflow is handled by taking the result modulo 2**N for some N > 21 | PyLong_SHIFT. The majority of the code doesn't care about the precise 22 | value of PyLong_SHIFT, but there are some notable exceptions: 23 | 24 | - long_pow() requires that PyLong_SHIFT be divisible by 5 25 | 26 | - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 27 | 28 | - long_hash() requires that PyLong_SHIFT is *strictly* less than the number 29 | of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) 30 | conversion functions 31 | 32 | - the Python int <-> size_t/Py_ssize_t conversion functions expect that 33 | PyLong_SHIFT is strictly less than the number of bits in a size_t 34 | 35 | - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 36 | 37 | - NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single 38 | digit; with the current values this forces PyLong_SHIFT >= 9 39 | 40 | The values 15 and 30 should fit all of the above requirements, on any 41 | platform. 42 | */ 43 | 44 | #if PYLONG_BITS_IN_DIGIT == 30 45 | #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ 46 | defined HAVE_INT64_T && defined HAVE_INT32_T) 47 | #error "30-bit long digits requested, but the necessary types are not available on this platform" 48 | #endif 49 | typedef PY_UINT32_T digit; 50 | typedef PY_INT32_T sdigit; /* signed variant of digit */ 51 | typedef PY_UINT64_T twodigits; 52 | typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ 53 | #define PyLong_SHIFT 30 54 | #define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ 55 | #define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ 56 | #elif PYLONG_BITS_IN_DIGIT == 15 57 | typedef unsigned short digit; 58 | typedef short sdigit; /* signed variant of digit */ 59 | typedef unsigned long twodigits; 60 | typedef long stwodigits; /* signed variant of twodigits */ 61 | #define PyLong_SHIFT 15 62 | #define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ 63 | #define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ 64 | #else 65 | #error "PYLONG_BITS_IN_DIGIT should be 15 or 30" 66 | #endif 67 | #define PyLong_BASE ((digit)1 << PyLong_SHIFT) 68 | #define PyLong_MASK ((digit)(PyLong_BASE - 1)) 69 | 70 | #if PyLong_SHIFT % 5 != 0 71 | #error "longobject.c requires that PyLong_SHIFT be divisible by 5" 72 | #endif 73 | 74 | /* Long integer representation. 75 | The absolute value of a number is equal to 76 | SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) 77 | Negative numbers are represented with ob_size < 0; 78 | zero is represented by ob_size == 0. 79 | In a normalized number, ob_digit[abs(ob_size)-1] (the most significant 80 | digit) is never zero. Also, in all cases, for all valid i, 81 | 0 <= ob_digit[i] <= MASK. 82 | The allocation function takes care of allocating extra memory 83 | so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. 84 | 85 | CAUTION: Generic code manipulating subtypes of PyVarObject has to 86 | aware that ints abuse ob_size's sign bit. 87 | */ 88 | 89 | struct _longobject { 90 | PyObject_VAR_HEAD 91 | digit ob_digit[1]; 92 | }; 93 | 94 | PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); 95 | 96 | /* Return a copy of src. */ 97 | PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | #endif /* !Py_LONGINTREPR_H */ 103 | #endif /* Py_LIMITED_API */ 104 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/marshal.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interface for marshal.c */ 3 | 4 | #ifndef Py_MARSHAL_H 5 | #define Py_MARSHAL_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define Py_MARSHAL_VERSION 4 11 | 12 | PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); 13 | PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); 14 | PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); 15 | 16 | #ifndef Py_LIMITED_API 17 | PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); 18 | PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); 19 | PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); 20 | PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); 21 | #endif 22 | PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *, 23 | Py_ssize_t); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /* !Py_MARSHAL_H */ 29 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/memoryobject.h: -------------------------------------------------------------------------------- 1 | /* Memory view object. In Python this is available as "memoryview". */ 2 | 3 | #ifndef Py_MEMORYOBJECT_H 4 | #define Py_MEMORYOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifndef Py_LIMITED_API 10 | PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type; 11 | #endif 12 | PyAPI_DATA(PyTypeObject) PyMemoryView_Type; 13 | 14 | #define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) 15 | 16 | #ifndef Py_LIMITED_API 17 | /* Get a pointer to the memoryview's private copy of the exporter's buffer. */ 18 | #define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) 19 | /* Get a pointer to the exporting object (this may be NULL!). */ 20 | #define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) 21 | #endif 22 | 23 | PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); 24 | PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, 25 | int flags); 26 | #ifndef Py_LIMITED_API 27 | PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); 28 | #endif 29 | PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, 30 | int buffertype, 31 | char order); 32 | 33 | 34 | /* The structs are declared here so that macros can work, but they shouldn't 35 | be considered public. Don't access their fields directly, use the macros 36 | and functions instead! */ 37 | #ifndef Py_LIMITED_API 38 | #define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */ 39 | #define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */ 40 | typedef struct { 41 | PyObject_HEAD 42 | int flags; /* state flags */ 43 | Py_ssize_t exports; /* number of direct memoryview exports */ 44 | Py_buffer master; /* snapshot buffer obtained from the original exporter */ 45 | } _PyManagedBufferObject; 46 | 47 | 48 | /* memoryview state flags */ 49 | #define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */ 50 | #define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */ 51 | #define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */ 52 | #define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */ 53 | #define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */ 54 | 55 | typedef struct { 56 | PyObject_VAR_HEAD 57 | _PyManagedBufferObject *mbuf; /* managed buffer */ 58 | Py_hash_t hash; /* hash value for read-only views */ 59 | int flags; /* state flags */ 60 | Py_ssize_t exports; /* number of buffer re-exports */ 61 | Py_buffer view; /* private copy of the exporter's view */ 62 | PyObject *weakreflist; 63 | Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */ 64 | } PyMemoryViewObject; 65 | #endif 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | #endif /* !Py_MEMORYOBJECT_H */ 71 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/metagrammar.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_METAGRAMMAR_H 2 | #define Py_METAGRAMMAR_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | #define MSTART 256 9 | #define RULE 257 10 | #define RHS 258 11 | #define ALT 259 12 | #define ITEM 260 13 | #define ATOM 261 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif /* !Py_METAGRAMMAR_H */ 19 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/methodobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Method object interface */ 3 | 4 | #ifndef Py_METHODOBJECT_H 5 | #define Py_METHODOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* This is about the type 'builtin_function_or_method', 11 | not Python methods in user-defined classes. See classobject.h 12 | for the latter. */ 13 | 14 | PyAPI_DATA(PyTypeObject) PyCFunction_Type; 15 | 16 | #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) 17 | 18 | typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); 19 | typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, 20 | PyObject *); 21 | typedef PyObject *(*PyNoArgsFunction)(PyObject *); 22 | 23 | PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); 24 | PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); 25 | PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); 26 | 27 | /* Macros for direct access to these values. Type checks are *not* 28 | done, so use with care. */ 29 | #ifndef Py_LIMITED_API 30 | #define PyCFunction_GET_FUNCTION(func) \ 31 | (((PyCFunctionObject *)func) -> m_ml -> ml_meth) 32 | #define PyCFunction_GET_SELF(func) \ 33 | (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \ 34 | NULL : ((PyCFunctionObject *)func) -> m_self) 35 | #define PyCFunction_GET_FLAGS(func) \ 36 | (((PyCFunctionObject *)func) -> m_ml -> ml_flags) 37 | #endif 38 | PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); 39 | 40 | struct PyMethodDef { 41 | const char *ml_name; /* The name of the built-in function/method */ 42 | PyCFunction ml_meth; /* The C function that implements it */ 43 | int ml_flags; /* Combination of METH_xxx flags, which mostly 44 | describe the args expected by the C func */ 45 | const char *ml_doc; /* The __doc__ attribute, or NULL */ 46 | }; 47 | typedef struct PyMethodDef PyMethodDef; 48 | 49 | #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) 50 | PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, 51 | PyObject *); 52 | 53 | /* Flag passed to newmethodobject */ 54 | /* #define METH_OLDARGS 0x0000 -- unsupported now */ 55 | #define METH_VARARGS 0x0001 56 | #define METH_KEYWORDS 0x0002 57 | /* METH_NOARGS and METH_O must not be combined with the flags above. */ 58 | #define METH_NOARGS 0x0004 59 | #define METH_O 0x0008 60 | 61 | /* METH_CLASS and METH_STATIC are a little different; these control 62 | the construction of methods for a class. These cannot be used for 63 | functions in modules. */ 64 | #define METH_CLASS 0x0010 65 | #define METH_STATIC 0x0020 66 | 67 | /* METH_COEXIST allows a method to be entered even though a slot has 68 | already filled the entry. When defined, the flag allows a separate 69 | method, "__contains__" for example, to coexist with a defined 70 | slot like sq_contains. */ 71 | 72 | #define METH_COEXIST 0x0040 73 | 74 | #ifndef Py_LIMITED_API 75 | typedef struct { 76 | PyObject_HEAD 77 | PyMethodDef *m_ml; /* Description of the C function to call */ 78 | PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ 79 | PyObject *m_module; /* The __module__ attribute, can be anything */ 80 | PyObject *m_weakreflist; /* List of weak references */ 81 | } PyCFunctionObject; 82 | #endif 83 | 84 | PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); 85 | 86 | #ifndef Py_LIMITED_API 87 | PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out); 88 | PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out); 89 | #endif 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | #endif /* !Py_METHODOBJECT_H */ 95 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/moduleobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Module object interface */ 3 | 4 | #ifndef Py_MODULEOBJECT_H 5 | #define Py_MODULEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_DATA(PyTypeObject) PyModule_Type; 11 | 12 | #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) 13 | #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) 14 | 15 | PyAPI_FUNC(PyObject *) PyModule_NewObject( 16 | PyObject *name 17 | ); 18 | PyAPI_FUNC(PyObject *) PyModule_New( 19 | const char *name /* UTF-8 encoded string */ 20 | ); 21 | PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); 22 | PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); 23 | PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); 24 | PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); 25 | PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); 26 | #ifndef Py_LIMITED_API 27 | PyAPI_FUNC(void) _PyModule_Clear(PyObject *); 28 | PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *); 29 | #endif 30 | PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); 31 | PyAPI_FUNC(void*) PyModule_GetState(PyObject*); 32 | 33 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 34 | /* New in 3.5 */ 35 | PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*); 36 | PyAPI_DATA(PyTypeObject) PyModuleDef_Type; 37 | #endif 38 | 39 | typedef struct PyModuleDef_Base { 40 | PyObject_HEAD 41 | PyObject* (*m_init)(void); 42 | Py_ssize_t m_index; 43 | PyObject* m_copy; 44 | } PyModuleDef_Base; 45 | 46 | #define PyModuleDef_HEAD_INIT { \ 47 | PyObject_HEAD_INIT(NULL) \ 48 | NULL, /* m_init */ \ 49 | 0, /* m_index */ \ 50 | NULL, /* m_copy */ \ 51 | } 52 | 53 | struct PyModuleDef_Slot; 54 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 55 | /* New in 3.5 */ 56 | typedef struct PyModuleDef_Slot{ 57 | int slot; 58 | void *value; 59 | } PyModuleDef_Slot; 60 | 61 | #define Py_mod_create 1 62 | #define Py_mod_exec 2 63 | 64 | #ifndef Py_LIMITED_API 65 | #define _Py_mod_LAST_SLOT 2 66 | #endif 67 | 68 | #endif /* New in 3.5 */ 69 | 70 | typedef struct PyModuleDef{ 71 | PyModuleDef_Base m_base; 72 | const char* m_name; 73 | const char* m_doc; 74 | Py_ssize_t m_size; 75 | PyMethodDef *m_methods; 76 | struct PyModuleDef_Slot* m_slots; 77 | traverseproc m_traverse; 78 | inquiry m_clear; 79 | freefunc m_free; 80 | }PyModuleDef; 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | #endif /* !Py_MODULEOBJECT_H */ 86 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/namespaceobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* simple namespace object interface */ 3 | 4 | #ifndef NAMESPACEOBJECT_H 5 | #define NAMESPACEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_DATA(PyTypeObject) _PyNamespace_Type; 11 | 12 | PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | #endif /* !NAMESPACEOBJECT_H */ 18 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/node.h: -------------------------------------------------------------------------------- 1 | 2 | /* Parse tree node interface */ 3 | 4 | #ifndef Py_NODE_H 5 | #define Py_NODE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct _node { 11 | short n_type; 12 | char *n_str; 13 | int n_lineno; 14 | int n_col_offset; 15 | int n_nchildren; 16 | struct _node *n_child; 17 | } node; 18 | 19 | PyAPI_FUNC(node *) PyNode_New(int type); 20 | PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, 21 | char *str, int lineno, int col_offset); 22 | PyAPI_FUNC(void) PyNode_Free(node *n); 23 | #ifndef Py_LIMITED_API 24 | PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); 25 | #endif 26 | 27 | /* Node access functions */ 28 | #define NCH(n) ((n)->n_nchildren) 29 | 30 | #define CHILD(n, i) (&(n)->n_child[i]) 31 | #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) 32 | #define TYPE(n) ((n)->n_type) 33 | #define STR(n) ((n)->n_str) 34 | #define LINENO(n) ((n)->n_lineno) 35 | 36 | /* Assert that the type of a node is what we expect */ 37 | #define REQ(n, type) assert(TYPE(n) == (type)) 38 | 39 | PyAPI_FUNC(void) PyNode_ListTree(node *); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif /* !Py_NODE_H */ 45 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/odictobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ODICTOBJECT_H 2 | #define Py_ODICTOBJECT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* OrderedDict */ 9 | 10 | #ifndef Py_LIMITED_API 11 | 12 | typedef struct _odictobject PyODictObject; 13 | 14 | PyAPI_DATA(PyTypeObject) PyODict_Type; 15 | PyAPI_DATA(PyTypeObject) PyODictIter_Type; 16 | PyAPI_DATA(PyTypeObject) PyODictKeys_Type; 17 | PyAPI_DATA(PyTypeObject) PyODictItems_Type; 18 | PyAPI_DATA(PyTypeObject) PyODictValues_Type; 19 | 20 | #endif /* Py_LIMITED_API */ 21 | 22 | #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) 23 | #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) 24 | #define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used 25 | #define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key) 26 | 27 | PyAPI_FUNC(PyObject *) PyODict_New(void); 28 | PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); 29 | PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); 30 | 31 | /* wrappers around PyDict* functions */ 32 | #define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key) 33 | #define PyODict_GetItemWithError(od, key) \ 34 | PyDict_GetItemWithError((PyObject *)od, key) 35 | #define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key) 36 | #define PyODict_Size(od) PyDict_Size((PyObject *)od) 37 | #define PyODict_GetItemString(od, key) \ 38 | PyDict_GetItemString((PyObject *)od, key) 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | #endif /* !Py_ODICTOBJECT_H */ 44 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/opcode.h: -------------------------------------------------------------------------------- 1 | /* Auto-generated by Tools/scripts/generate_opcode_h.py */ 2 | #ifndef Py_OPCODE_H 3 | #define Py_OPCODE_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | /* Instruction opcodes for compiled code */ 10 | #define POP_TOP 1 11 | #define ROT_TWO 2 12 | #define ROT_THREE 3 13 | #define DUP_TOP 4 14 | #define DUP_TOP_TWO 5 15 | #define NOP 9 16 | #define UNARY_POSITIVE 10 17 | #define UNARY_NEGATIVE 11 18 | #define UNARY_NOT 12 19 | #define UNARY_INVERT 15 20 | #define BINARY_MATRIX_MULTIPLY 16 21 | #define INPLACE_MATRIX_MULTIPLY 17 22 | #define BINARY_POWER 19 23 | #define BINARY_MULTIPLY 20 24 | #define BINARY_MODULO 22 25 | #define BINARY_ADD 23 26 | #define BINARY_SUBTRACT 24 27 | #define BINARY_SUBSCR 25 28 | #define BINARY_FLOOR_DIVIDE 26 29 | #define BINARY_TRUE_DIVIDE 27 30 | #define INPLACE_FLOOR_DIVIDE 28 31 | #define INPLACE_TRUE_DIVIDE 29 32 | #define GET_AITER 50 33 | #define GET_ANEXT 51 34 | #define BEFORE_ASYNC_WITH 52 35 | #define INPLACE_ADD 55 36 | #define INPLACE_SUBTRACT 56 37 | #define INPLACE_MULTIPLY 57 38 | #define INPLACE_MODULO 59 39 | #define STORE_SUBSCR 60 40 | #define DELETE_SUBSCR 61 41 | #define BINARY_LSHIFT 62 42 | #define BINARY_RSHIFT 63 43 | #define BINARY_AND 64 44 | #define BINARY_XOR 65 45 | #define BINARY_OR 66 46 | #define INPLACE_POWER 67 47 | #define GET_ITER 68 48 | #define GET_YIELD_FROM_ITER 69 49 | #define PRINT_EXPR 70 50 | #define LOAD_BUILD_CLASS 71 51 | #define YIELD_FROM 72 52 | #define GET_AWAITABLE 73 53 | #define INPLACE_LSHIFT 75 54 | #define INPLACE_RSHIFT 76 55 | #define INPLACE_AND 77 56 | #define INPLACE_XOR 78 57 | #define INPLACE_OR 79 58 | #define BREAK_LOOP 80 59 | #define WITH_CLEANUP_START 81 60 | #define WITH_CLEANUP_FINISH 82 61 | #define RETURN_VALUE 83 62 | #define IMPORT_STAR 84 63 | #define YIELD_VALUE 86 64 | #define POP_BLOCK 87 65 | #define END_FINALLY 88 66 | #define POP_EXCEPT 89 67 | #define HAVE_ARGUMENT 90 68 | #define STORE_NAME 90 69 | #define DELETE_NAME 91 70 | #define UNPACK_SEQUENCE 92 71 | #define FOR_ITER 93 72 | #define UNPACK_EX 94 73 | #define STORE_ATTR 95 74 | #define DELETE_ATTR 96 75 | #define STORE_GLOBAL 97 76 | #define DELETE_GLOBAL 98 77 | #define LOAD_CONST 100 78 | #define LOAD_NAME 101 79 | #define BUILD_TUPLE 102 80 | #define BUILD_LIST 103 81 | #define BUILD_SET 104 82 | #define BUILD_MAP 105 83 | #define LOAD_ATTR 106 84 | #define COMPARE_OP 107 85 | #define IMPORT_NAME 108 86 | #define IMPORT_FROM 109 87 | #define JUMP_FORWARD 110 88 | #define JUMP_IF_FALSE_OR_POP 111 89 | #define JUMP_IF_TRUE_OR_POP 112 90 | #define JUMP_ABSOLUTE 113 91 | #define POP_JUMP_IF_FALSE 114 92 | #define POP_JUMP_IF_TRUE 115 93 | #define LOAD_GLOBAL 116 94 | #define CONTINUE_LOOP 119 95 | #define SETUP_LOOP 120 96 | #define SETUP_EXCEPT 121 97 | #define SETUP_FINALLY 122 98 | #define LOAD_FAST 124 99 | #define STORE_FAST 125 100 | #define DELETE_FAST 126 101 | #define RAISE_VARARGS 130 102 | #define CALL_FUNCTION 131 103 | #define MAKE_FUNCTION 132 104 | #define BUILD_SLICE 133 105 | #define MAKE_CLOSURE 134 106 | #define LOAD_CLOSURE 135 107 | #define LOAD_DEREF 136 108 | #define STORE_DEREF 137 109 | #define DELETE_DEREF 138 110 | #define CALL_FUNCTION_VAR 140 111 | #define CALL_FUNCTION_KW 141 112 | #define CALL_FUNCTION_VAR_KW 142 113 | #define SETUP_WITH 143 114 | #define EXTENDED_ARG 144 115 | #define LIST_APPEND 145 116 | #define SET_ADD 146 117 | #define MAP_ADD 147 118 | #define LOAD_CLASSDEREF 148 119 | #define BUILD_LIST_UNPACK 149 120 | #define BUILD_MAP_UNPACK 150 121 | #define BUILD_MAP_UNPACK_WITH_CALL 151 122 | #define BUILD_TUPLE_UNPACK 152 123 | #define BUILD_SET_UNPACK 153 124 | #define SETUP_ASYNC_WITH 154 125 | 126 | /* EXCEPT_HANDLER is a special, implicit block type which is created when 127 | entering an except handler. It is not an opcode but we define it here 128 | as we want it to be available to both frameobject.c and ceval.c, while 129 | remaining private.*/ 130 | #define EXCEPT_HANDLER 257 131 | 132 | 133 | enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, 134 | PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN, 135 | PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; 136 | 137 | #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) 138 | 139 | #ifdef __cplusplus 140 | } 141 | #endif 142 | #endif /* !Py_OPCODE_H */ 143 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/osdefs.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_OSDEFS_H 2 | #define Py_OSDEFS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Operating system dependencies */ 9 | 10 | #ifdef MS_WINDOWS 11 | #define SEP L'\\' 12 | #define ALTSEP L'/' 13 | #define MAXPATHLEN 256 14 | #define DELIM L';' 15 | #endif 16 | 17 | /* Filename separator */ 18 | #ifndef SEP 19 | #define SEP L'/' 20 | #endif 21 | 22 | /* Max pathname length */ 23 | #ifdef __hpux 24 | #include 25 | #include 26 | #ifndef PATH_MAX 27 | #define PATH_MAX MAXPATHLEN 28 | #endif 29 | #endif 30 | 31 | #ifndef MAXPATHLEN 32 | #if defined(PATH_MAX) && PATH_MAX > 1024 33 | #define MAXPATHLEN PATH_MAX 34 | #else 35 | #define MAXPATHLEN 1024 36 | #endif 37 | #endif 38 | 39 | /* Search path entry delimiter */ 40 | #ifndef DELIM 41 | #define DELIM L':' 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | #endif /* !Py_OSDEFS_H */ 48 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/parsetok.h: -------------------------------------------------------------------------------- 1 | 2 | /* Parser-tokenizer link interface */ 3 | #ifndef Py_LIMITED_API 4 | #ifndef Py_PARSETOK_H 5 | #define Py_PARSETOK_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct { 11 | int error; 12 | #ifndef PGEN 13 | /* The filename is useless for pgen, see comment in tok_state structure */ 14 | PyObject *filename; 15 | #endif 16 | int lineno; 17 | int offset; 18 | char *text; /* UTF-8-encoded string */ 19 | int token; 20 | int expected; 21 | } perrdetail; 22 | 23 | #if 0 24 | #define PyPARSE_YIELD_IS_KEYWORD 0x0001 25 | #endif 26 | 27 | #define PyPARSE_DONT_IMPLY_DEDENT 0x0002 28 | 29 | #if 0 30 | #define PyPARSE_WITH_IS_KEYWORD 0x0003 31 | #define PyPARSE_PRINT_IS_FUNCTION 0x0004 32 | #define PyPARSE_UNICODE_LITERALS 0x0008 33 | #endif 34 | 35 | #define PyPARSE_IGNORE_COOKIE 0x0010 36 | #define PyPARSE_BARRY_AS_BDFL 0x0020 37 | 38 | PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, 39 | perrdetail *); 40 | PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, 41 | const char *, const char *, 42 | perrdetail *); 43 | 44 | PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, 45 | perrdetail *, int); 46 | PyAPI_FUNC(node *) PyParser_ParseFileFlags( 47 | FILE *fp, 48 | const char *filename, /* decoded from the filesystem encoding */ 49 | const char *enc, 50 | grammar *g, 51 | int start, 52 | const char *ps1, 53 | const char *ps2, 54 | perrdetail *err_ret, 55 | int flags); 56 | PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx( 57 | FILE *fp, 58 | const char *filename, /* decoded from the filesystem encoding */ 59 | const char *enc, 60 | grammar *g, 61 | int start, 62 | const char *ps1, 63 | const char *ps2, 64 | perrdetail *err_ret, 65 | int *flags); 66 | PyAPI_FUNC(node *) PyParser_ParseFileObject( 67 | FILE *fp, 68 | PyObject *filename, 69 | const char *enc, 70 | grammar *g, 71 | int start, 72 | const char *ps1, 73 | const char *ps2, 74 | perrdetail *err_ret, 75 | int *flags); 76 | 77 | PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename( 78 | const char *s, 79 | const char *filename, /* decoded from the filesystem encoding */ 80 | grammar *g, 81 | int start, 82 | perrdetail *err_ret, 83 | int flags); 84 | PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx( 85 | const char *s, 86 | const char *filename, /* decoded from the filesystem encoding */ 87 | grammar *g, 88 | int start, 89 | perrdetail *err_ret, 90 | int *flags); 91 | PyAPI_FUNC(node *) PyParser_ParseStringObject( 92 | const char *s, 93 | PyObject *filename, 94 | grammar *g, 95 | int start, 96 | perrdetail *err_ret, 97 | int *flags); 98 | 99 | /* Note that the following functions are defined in pythonrun.c, 100 | not in parsetok.c */ 101 | PyAPI_FUNC(void) PyParser_SetError(perrdetail *); 102 | PyAPI_FUNC(void) PyParser_ClearError(perrdetail *); 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | #endif /* !Py_PARSETOK_H */ 108 | #endif /* !Py_LIMITED_API */ 109 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/patchlevel.h: -------------------------------------------------------------------------------- 1 | 2 | /* Python version identification scheme. 3 | 4 | When the major or minor version changes, the VERSION variable in 5 | configure.ac must also be changed. 6 | 7 | There is also (independent) API version information in modsupport.h. 8 | */ 9 | 10 | /* Values for PY_RELEASE_LEVEL */ 11 | #define PY_RELEASE_LEVEL_ALPHA 0xA 12 | #define PY_RELEASE_LEVEL_BETA 0xB 13 | #define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ 14 | #define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ 15 | /* Higher for patch releases */ 16 | 17 | /* Version parsed out into numeric values */ 18 | /*--start constants--*/ 19 | #define PY_MAJOR_VERSION 3 20 | #define PY_MINOR_VERSION 5 21 | #define PY_MICRO_VERSION 1 22 | #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL 23 | #define PY_RELEASE_SERIAL 0 24 | 25 | /* Version as a string */ 26 | #define PY_VERSION "3.5.1" 27 | /*--end constants--*/ 28 | 29 | /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. 30 | Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ 31 | #define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ 32 | (PY_MINOR_VERSION << 16) | \ 33 | (PY_MICRO_VERSION << 8) | \ 34 | (PY_RELEASE_LEVEL << 4) | \ 35 | (PY_RELEASE_SERIAL << 0)) 36 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pgen.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PGEN_H 2 | #define Py_PGEN_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Parser generator interface */ 9 | 10 | extern grammar *meta_grammar(void); 11 | 12 | struct _node; 13 | extern grammar *pgen(struct _node *); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif /* !Py_PGEN_H */ 19 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pgenheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PGENHEADERS_H 2 | #define Py_PGENHEADERS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Include files and extern declarations used by most of the parser. */ 9 | 10 | #include "Python.h" 11 | 12 | PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) 13 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 14 | PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) 15 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 16 | 17 | #define addarc _Py_addarc 18 | #define addbit _Py_addbit 19 | #define adddfa _Py_adddfa 20 | #define addfirstsets _Py_addfirstsets 21 | #define addlabel _Py_addlabel 22 | #define addstate _Py_addstate 23 | #define delbitset _Py_delbitset 24 | #define dumptree _Py_dumptree 25 | #define findlabel _Py_findlabel 26 | #define mergebitset _Py_mergebitset 27 | #define meta_grammar _Py_meta_grammar 28 | #define newbitset _Py_newbitset 29 | #define newgrammar _Py_newgrammar 30 | #define pgen _Py_pgen 31 | #define printgrammar _Py_printgrammar 32 | #define printnonterminals _Py_printnonterminals 33 | #define printtree _Py_printtree 34 | #define samebitset _Py_samebitset 35 | #define showtree _Py_showtree 36 | #define tok_dump _Py_tok_dump 37 | #define translatelabels _Py_translatelabels 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | #endif /* !Py_PGENHEADERS_H */ 43 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/py_curses.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_CURSES_H 3 | #define Py_CURSES_H 4 | 5 | #ifdef __APPLE__ 6 | /* 7 | ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards 8 | ** against multiple definition of wchar_t. 9 | */ 10 | #ifdef _BSD_WCHAR_T_DEFINED_ 11 | #define _WCHAR_T 12 | #endif 13 | 14 | /* the following define is necessary for OS X 10.6; without it, the 15 | Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python 16 | can't get at the WINDOW flags field. */ 17 | #define NCURSES_OPAQUE 0 18 | #endif /* __APPLE__ */ 19 | 20 | #ifdef __FreeBSD__ 21 | /* 22 | ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards 23 | ** against multiple definition of wchar_t and wint_t. 24 | */ 25 | #ifdef _XOPEN_SOURCE_EXTENDED 26 | #ifndef __FreeBSD_version 27 | #include 28 | #endif 29 | #if __FreeBSD_version >= 500000 30 | #ifndef __wchar_t 31 | #define __wchar_t 32 | #endif 33 | #ifndef __wint_t 34 | #define __wint_t 35 | #endif 36 | #else 37 | #ifndef _WCHAR_T 38 | #define _WCHAR_T 39 | #endif 40 | #ifndef _WINT_T 41 | #define _WINT_T 42 | #endif 43 | #endif 44 | #endif 45 | #endif 46 | 47 | #ifdef HAVE_NCURSES_H 48 | #include 49 | #else 50 | #include 51 | #ifdef HAVE_TERM_H 52 | /* for tigetstr, which is not declared in SysV curses */ 53 | #include 54 | #endif 55 | #endif 56 | 57 | #ifdef HAVE_NCURSES_H 58 | /* configure was checking , but we will 59 | use , which has all these features. */ 60 | #ifndef WINDOW_HAS_FLAGS 61 | #define WINDOW_HAS_FLAGS 1 62 | #endif 63 | #ifndef MVWDELCH_IS_EXPRESSION 64 | #define MVWDELCH_IS_EXPRESSION 1 65 | #endif 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | extern "C" { 70 | #endif 71 | 72 | #define PyCurses_API_pointers 4 73 | 74 | /* Type declarations */ 75 | 76 | typedef struct { 77 | PyObject_HEAD 78 | WINDOW *win; 79 | char *encoding; 80 | } PyCursesWindowObject; 81 | 82 | #define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) 83 | 84 | #define PyCurses_CAPSULE_NAME "_curses._C_API" 85 | 86 | 87 | #ifdef CURSES_MODULE 88 | /* This section is used when compiling _cursesmodule.c */ 89 | 90 | #else 91 | /* This section is used in modules that use the _cursesmodule API */ 92 | 93 | static void **PyCurses_API; 94 | 95 | #define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) 96 | #define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} 97 | #define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} 98 | #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} 99 | 100 | #define import_curses() \ 101 | PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); 102 | 103 | #endif 104 | 105 | /* general error messages */ 106 | static char *catchall_ERR = "curses function returned ERR"; 107 | static char *catchall_NULL = "curses function returned NULL"; 108 | 109 | /* Function Prototype Macros - They are ugly but very, very useful. ;-) 110 | 111 | X - function name 112 | TYPE - parameter Type 113 | ERGSTR - format string for construction of the return value 114 | PARSESTR - format string for argument parsing 115 | */ 116 | 117 | #define NoArgNoReturnFunction(X) \ 118 | static PyObject *PyCurses_ ## X (PyObject *self) \ 119 | { \ 120 | PyCursesInitialised \ 121 | return PyCursesCheckERR(X(), # X); } 122 | 123 | #define NoArgOrFlagNoReturnFunction(X) \ 124 | static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \ 125 | { \ 126 | int flag = 0; \ 127 | PyCursesInitialised \ 128 | switch(PyTuple_Size(args)) { \ 129 | case 0: \ 130 | return PyCursesCheckERR(X(), # X); \ 131 | case 1: \ 132 | if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \ 133 | if (flag) return PyCursesCheckERR(X(), # X); \ 134 | else return PyCursesCheckERR(no ## X (), # X); \ 135 | default: \ 136 | PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \ 137 | return NULL; } } 138 | 139 | #define NoArgReturnIntFunction(X) \ 140 | static PyObject *PyCurses_ ## X (PyObject *self) \ 141 | { \ 142 | PyCursesInitialised \ 143 | return PyLong_FromLong((long) X()); } 144 | 145 | 146 | #define NoArgReturnStringFunction(X) \ 147 | static PyObject *PyCurses_ ## X (PyObject *self) \ 148 | { \ 149 | PyCursesInitialised \ 150 | return PyBytes_FromString(X()); } 151 | 152 | #define NoArgTrueFalseFunction(X) \ 153 | static PyObject *PyCurses_ ## X (PyObject *self) \ 154 | { \ 155 | PyCursesInitialised \ 156 | if (X () == FALSE) { \ 157 | Py_INCREF(Py_False); \ 158 | return Py_False; \ 159 | } \ 160 | Py_INCREF(Py_True); \ 161 | return Py_True; } 162 | 163 | #define NoArgNoReturnVoidFunction(X) \ 164 | static PyObject *PyCurses_ ## X (PyObject *self) \ 165 | { \ 166 | PyCursesInitialised \ 167 | X(); \ 168 | Py_INCREF(Py_None); \ 169 | return Py_None; } 170 | 171 | #ifdef __cplusplus 172 | } 173 | #endif 174 | 175 | #endif /* !defined(Py_CURSES_H) */ 176 | 177 | 178 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pyarena.h: -------------------------------------------------------------------------------- 1 | /* An arena-like memory interface for the compiler. 2 | */ 3 | 4 | #ifndef Py_LIMITED_API 5 | #ifndef Py_PYARENA_H 6 | #define Py_PYARENA_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct _arena PyArena; 13 | 14 | /* PyArena_New() and PyArena_Free() create a new arena and free it, 15 | respectively. Once an arena has been created, it can be used 16 | to allocate memory via PyArena_Malloc(). Pointers to PyObject can 17 | also be registered with the arena via PyArena_AddPyObject(), and the 18 | arena will ensure that the PyObjects stay alive at least until 19 | PyArena_Free() is called. When an arena is freed, all the memory it 20 | allocated is freed, the arena releases internal references to registered 21 | PyObject*, and none of its pointers are valid. 22 | XXX (tim) What does "none of its pointers are valid" mean? Does it 23 | XXX mean that pointers previously obtained via PyArena_Malloc() are 24 | XXX no longer valid? (That's clearly true, but not sure that's what 25 | XXX the text is trying to say.) 26 | 27 | PyArena_New() returns an arena pointer. On error, it 28 | returns a negative number and sets an exception. 29 | XXX (tim): Not true. On error, PyArena_New() actually returns NULL, 30 | XXX and looks like it may or may not set an exception (e.g., if the 31 | XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on 32 | XXX and an exception is set; OTOH, if the internal 33 | XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but 34 | XXX an exception is not set in that case). 35 | */ 36 | PyAPI_FUNC(PyArena *) PyArena_New(void); 37 | PyAPI_FUNC(void) PyArena_Free(PyArena *); 38 | 39 | /* Mostly like malloc(), return the address of a block of memory spanning 40 | * `size` bytes, or return NULL (without setting an exception) if enough 41 | * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with 42 | * size=0 does not guarantee to return a unique pointer (the pointer 43 | * returned may equal one or more other pointers obtained from 44 | * PyArena_Malloc()). 45 | * Note that pointers obtained via PyArena_Malloc() must never be passed to 46 | * the system free() or realloc(), or to any of Python's similar memory- 47 | * management functions. PyArena_Malloc()-obtained pointers remain valid 48 | * until PyArena_Free(ar) is called, at which point all pointers obtained 49 | * from the arena `ar` become invalid simultaneously. 50 | */ 51 | PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); 52 | 53 | /* This routine isn't a proper arena allocation routine. It takes 54 | * a PyObject* and records it so that it can be DECREFed when the 55 | * arena is freed. 56 | */ 57 | PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* !Py_PYARENA_H */ 64 | #endif /* Py_LIMITED_API */ 65 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pycapsule.h: -------------------------------------------------------------------------------- 1 | 2 | /* Capsule objects let you wrap a C "void *" pointer in a Python 3 | object. They're a way of passing data through the Python interpreter 4 | without creating your own custom type. 5 | 6 | Capsules are used for communication between extension modules. 7 | They provide a way for an extension module to export a C interface 8 | to other extension modules, so that extension modules can use the 9 | Python import mechanism to link to one another. 10 | 11 | For more information, please see "c-api/capsule.html" in the 12 | documentation. 13 | */ 14 | 15 | #ifndef Py_CAPSULE_H 16 | #define Py_CAPSULE_H 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PyAPI_DATA(PyTypeObject) PyCapsule_Type; 22 | 23 | typedef void (*PyCapsule_Destructor)(PyObject *); 24 | 25 | #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) 26 | 27 | 28 | PyAPI_FUNC(PyObject *) PyCapsule_New( 29 | void *pointer, 30 | const char *name, 31 | PyCapsule_Destructor destructor); 32 | 33 | PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); 34 | 35 | PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); 36 | 37 | PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); 38 | 39 | PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); 40 | 41 | PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); 42 | 43 | PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); 44 | 45 | PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); 46 | 47 | PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); 48 | 49 | PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); 50 | 51 | PyAPI_FUNC(void *) PyCapsule_Import( 52 | const char *name, /* UTF-8 encoded string */ 53 | int no_block); 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #endif /* !Py_CAPSULE_H */ 60 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pyctype.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef PYCTYPE_H 3 | #define PYCTYPE_H 4 | 5 | #define PY_CTF_LOWER 0x01 6 | #define PY_CTF_UPPER 0x02 7 | #define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) 8 | #define PY_CTF_DIGIT 0x04 9 | #define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) 10 | #define PY_CTF_SPACE 0x08 11 | #define PY_CTF_XDIGIT 0x10 12 | 13 | PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; 14 | 15 | /* Unlike their C counterparts, the following macros are not meant to 16 | * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument 17 | * must be a signed/unsigned char. */ 18 | #define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) 19 | #define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) 20 | #define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) 21 | #define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) 22 | #define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) 23 | #define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) 24 | #define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) 25 | 26 | PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; 27 | PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; 28 | 29 | #define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) 30 | #define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) 31 | 32 | #endif /* !PYCTYPE_H */ 33 | #endif /* !Py_LIMITED_API */ 34 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pydebug.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_PYDEBUG_H 3 | #define Py_PYDEBUG_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* These global variable are defined in pylifecycle.c */ 9 | /* XXX (ncoghlan): move these declarations to pylifecycle.h? */ 10 | PyAPI_DATA(int) Py_DebugFlag; 11 | PyAPI_DATA(int) Py_VerboseFlag; 12 | PyAPI_DATA(int) Py_QuietFlag; 13 | PyAPI_DATA(int) Py_InteractiveFlag; 14 | PyAPI_DATA(int) Py_InspectFlag; 15 | PyAPI_DATA(int) Py_OptimizeFlag; 16 | PyAPI_DATA(int) Py_NoSiteFlag; 17 | PyAPI_DATA(int) Py_BytesWarningFlag; 18 | PyAPI_DATA(int) Py_UseClassExceptionsFlag; 19 | PyAPI_DATA(int) Py_FrozenFlag; 20 | PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; 21 | PyAPI_DATA(int) Py_DontWriteBytecodeFlag; 22 | PyAPI_DATA(int) Py_NoUserSiteDirectory; 23 | PyAPI_DATA(int) Py_UnbufferedStdioFlag; 24 | PyAPI_DATA(int) Py_HashRandomizationFlag; 25 | PyAPI_DATA(int) Py_IsolatedFlag; 26 | 27 | /* this is a wrapper around getenv() that pays attention to 28 | Py_IgnoreEnvironmentFlag. It should be used for getting variables like 29 | PYTHONPATH and PYTHONHOME from the environment */ 30 | #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif /* !Py_PYDEBUG_H */ 36 | #endif /* Py_LIMITED_API */ 37 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pyexpat.h: -------------------------------------------------------------------------------- 1 | /* Stuff to export relevant 'expat' entry points from pyexpat to other 2 | * parser modules, such as cElementTree. */ 3 | 4 | /* note: you must import expat.h before importing this module! */ 5 | 6 | #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" 7 | #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" 8 | 9 | struct PyExpat_CAPI 10 | { 11 | char* magic; /* set to PyExpat_CAPI_MAGIC */ 12 | int size; /* set to sizeof(struct PyExpat_CAPI) */ 13 | int MAJOR_VERSION; 14 | int MINOR_VERSION; 15 | int MICRO_VERSION; 16 | /* pointers to selected expat functions. add new functions at 17 | the end, if needed */ 18 | const XML_LChar * (*ErrorString)(enum XML_Error code); 19 | enum XML_Error (*GetErrorCode)(XML_Parser parser); 20 | XML_Size (*GetErrorColumnNumber)(XML_Parser parser); 21 | XML_Size (*GetErrorLineNumber)(XML_Parser parser); 22 | enum XML_Status (*Parse)( 23 | XML_Parser parser, const char *s, int len, int isFinal); 24 | XML_Parser (*ParserCreate_MM)( 25 | const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, 26 | const XML_Char *namespaceSeparator); 27 | void (*ParserFree)(XML_Parser parser); 28 | void (*SetCharacterDataHandler)( 29 | XML_Parser parser, XML_CharacterDataHandler handler); 30 | void (*SetCommentHandler)( 31 | XML_Parser parser, XML_CommentHandler handler); 32 | void (*SetDefaultHandlerExpand)( 33 | XML_Parser parser, XML_DefaultHandler handler); 34 | void (*SetElementHandler)( 35 | XML_Parser parser, XML_StartElementHandler start, 36 | XML_EndElementHandler end); 37 | void (*SetNamespaceDeclHandler)( 38 | XML_Parser parser, XML_StartNamespaceDeclHandler start, 39 | XML_EndNamespaceDeclHandler end); 40 | void (*SetProcessingInstructionHandler)( 41 | XML_Parser parser, XML_ProcessingInstructionHandler handler); 42 | void (*SetUnknownEncodingHandler)( 43 | XML_Parser parser, XML_UnknownEncodingHandler handler, 44 | void *encodingHandlerData); 45 | void (*SetUserData)(XML_Parser parser, void *userData); 46 | void (*SetStartDoctypeDeclHandler)(XML_Parser parser, 47 | XML_StartDoctypeDeclHandler start); 48 | enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding); 49 | int (*DefaultUnknownEncodingHandler)( 50 | void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); 51 | /* always add new stuff to the end! */ 52 | }; 53 | 54 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pygetopt.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_PYGETOPT_H 3 | #define Py_PYGETOPT_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifndef Py_LIMITED_API 9 | PyAPI_DATA(int) _PyOS_opterr; 10 | PyAPI_DATA(int) _PyOS_optind; 11 | PyAPI_DATA(wchar_t *) _PyOS_optarg; 12 | 13 | PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); 14 | #endif 15 | 16 | PyAPI_FUNC(int) _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif /* !Py_PYGETOPT_H */ 22 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pyhash.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_HASH_H 2 | 3 | #define Py_HASH_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* Helpers for hash functions */ 9 | #ifndef Py_LIMITED_API 10 | PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double); 11 | PyAPI_FUNC(Py_hash_t) _Py_HashPointer(void*); 12 | PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t); 13 | #endif 14 | 15 | /* Prime multiplier used in string and various other hashes. */ 16 | #define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */ 17 | 18 | /* Parameters used for the numeric hash implementation. See notes for 19 | _Py_HashDouble in Objects/object.c. Numeric hashes are based on 20 | reduction modulo the prime 2**_PyHASH_BITS - 1. */ 21 | 22 | #if SIZEOF_VOID_P >= 8 23 | # define _PyHASH_BITS 61 24 | #else 25 | # define _PyHASH_BITS 31 26 | #endif 27 | 28 | #define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) 29 | #define _PyHASH_INF 314159 30 | #define _PyHASH_NAN 0 31 | #define _PyHASH_IMAG _PyHASH_MULTIPLIER 32 | 33 | 34 | /* hash secret 35 | * 36 | * memory layout on 64 bit systems 37 | * cccccccc cccccccc cccccccc uc -- unsigned char[24] 38 | * pppppppp ssssssss ........ fnv -- two Py_hash_t 39 | * k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T 40 | * ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t 41 | * ........ ........ eeeeeeee pyexpat XML hash salt 42 | * 43 | * memory layout on 32 bit systems 44 | * cccccccc cccccccc cccccccc uc 45 | * ppppssss ........ ........ fnv -- two Py_hash_t 46 | * k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T (*) 47 | * ........ ........ ssss.... djbx33a -- 16 bytes padding + one Py_hash_t 48 | * ........ ........ eeee.... pyexpat XML hash salt 49 | * 50 | * (*) The siphash member may not be available on 32 bit platforms without 51 | * an unsigned int64 data type. 52 | */ 53 | #ifndef Py_LIMITED_API 54 | typedef union { 55 | /* ensure 24 bytes */ 56 | unsigned char uc[24]; 57 | /* two Py_hash_t for FNV */ 58 | struct { 59 | Py_hash_t prefix; 60 | Py_hash_t suffix; 61 | } fnv; 62 | #ifdef PY_UINT64_T 63 | /* two uint64 for SipHash24 */ 64 | struct { 65 | PY_UINT64_T k0; 66 | PY_UINT64_T k1; 67 | } siphash; 68 | #endif 69 | /* a different (!) Py_hash_t for small string optimization */ 70 | struct { 71 | unsigned char padding[16]; 72 | Py_hash_t suffix; 73 | } djbx33a; 74 | struct { 75 | unsigned char padding[16]; 76 | Py_hash_t hashsalt; 77 | } expat; 78 | } _Py_HashSecret_t; 79 | PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; 80 | #endif 81 | 82 | #ifdef Py_DEBUG 83 | PyAPI_DATA(int) _Py_HashSecret_Initialized; 84 | #endif 85 | 86 | 87 | /* hash function definition */ 88 | #ifndef Py_LIMITED_API 89 | typedef struct { 90 | Py_hash_t (*const hash)(const void *, Py_ssize_t); 91 | const char *name; 92 | const int hash_bits; 93 | const int seed_bits; 94 | } PyHash_FuncDef; 95 | 96 | PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void); 97 | #endif 98 | 99 | 100 | /* cutoff for small string DJBX33A optimization in range [1, cutoff). 101 | * 102 | * About 50% of the strings in a typical Python application are smaller than 103 | * 6 to 7 chars. However DJBX33A is vulnerable to hash collision attacks. 104 | * NEVER use DJBX33A for long strings! 105 | * 106 | * A Py_HASH_CUTOFF of 0 disables small string optimization. 32 bit platforms 107 | * should use a smaller cutoff because it is easier to create colliding 108 | * strings. A cutoff of 7 on 64bit platforms and 5 on 32bit platforms should 109 | * provide a decent safety margin. 110 | */ 111 | #ifndef Py_HASH_CUTOFF 112 | # define Py_HASH_CUTOFF 0 113 | #elif (Py_HASH_CUTOFF > 7 || Py_HASH_CUTOFF < 0) 114 | # error Py_HASH_CUTOFF must in range 0...7. 115 | #endif /* Py_HASH_CUTOFF */ 116 | 117 | 118 | /* hash algorithm selection 119 | * 120 | * The values for Py_HASH_SIPHASH24 and Py_HASH_FNV are hard-coded in the 121 | * configure script. 122 | * 123 | * - FNV is available on all platforms and architectures. 124 | * - SIPHASH24 only works on plaforms that provide PY_UINT64_T and doesn't 125 | * require aligned memory for integers. 126 | * - With EXTERNAL embedders can provide an alternative implementation with:: 127 | * 128 | * PyHash_FuncDef PyHash_Func = {...}; 129 | * 130 | * XXX: Figure out __declspec() for extern PyHash_FuncDef. 131 | */ 132 | #define Py_HASH_EXTERNAL 0 133 | #define Py_HASH_SIPHASH24 1 134 | #define Py_HASH_FNV 2 135 | 136 | #ifndef Py_HASH_ALGORITHM 137 | # if (defined(PY_UINT64_T) && defined(PY_UINT32_T) \ 138 | && !defined(HAVE_ALIGNED_REQUIRED)) 139 | # define Py_HASH_ALGORITHM Py_HASH_SIPHASH24 140 | # else 141 | # define Py_HASH_ALGORITHM Py_HASH_FNV 142 | # endif /* uint64_t && uint32_t && aligned */ 143 | #endif /* Py_HASH_ALGORITHM */ 144 | 145 | #ifdef __cplusplus 146 | } 147 | #endif 148 | 149 | #endif /* !Py_HASH_H */ 150 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pylifecycle.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interfaces to configure, query, create & destroy the Python runtime */ 3 | 4 | #ifndef Py_PYLIFECYCLE_H 5 | #define Py_PYLIFECYCLE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(void) Py_SetProgramName(wchar_t *); 11 | PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); 12 | 13 | PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *); 14 | PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void); 15 | 16 | #ifndef Py_LIMITED_API 17 | /* Only used by applications that embed the interpreter and need to 18 | * override the standard encoding determination mechanism 19 | */ 20 | PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding, 21 | const char *errors); 22 | #endif 23 | 24 | PyAPI_FUNC(void) Py_Initialize(void); 25 | PyAPI_FUNC(void) Py_InitializeEx(int); 26 | #ifndef Py_LIMITED_API 27 | PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int); 28 | #endif 29 | PyAPI_FUNC(void) Py_Finalize(void); 30 | PyAPI_FUNC(int) Py_IsInitialized(void); 31 | PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); 32 | PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); 33 | 34 | 35 | /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level 36 | * exit functions. 37 | */ 38 | #ifndef Py_LIMITED_API 39 | PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void)); 40 | #endif 41 | PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); 42 | 43 | PyAPI_FUNC(void) Py_Exit(int); 44 | 45 | /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ 46 | #ifndef Py_LIMITED_API 47 | PyAPI_FUNC(void) _Py_RestoreSignals(void); 48 | 49 | PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); 50 | #endif 51 | 52 | /* Bootstrap __main__ (defined in Modules/main.c) */ 53 | PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); 54 | 55 | /* In getpath.c */ 56 | PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void); 57 | PyAPI_FUNC(wchar_t *) Py_GetPrefix(void); 58 | PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); 59 | PyAPI_FUNC(wchar_t *) Py_GetPath(void); 60 | PyAPI_FUNC(void) Py_SetPath(const wchar_t *); 61 | #ifdef MS_WINDOWS 62 | int _Py_CheckPython3(); 63 | #endif 64 | 65 | /* In their own files */ 66 | PyAPI_FUNC(const char *) Py_GetVersion(void); 67 | PyAPI_FUNC(const char *) Py_GetPlatform(void); 68 | PyAPI_FUNC(const char *) Py_GetCopyright(void); 69 | PyAPI_FUNC(const char *) Py_GetCompiler(void); 70 | PyAPI_FUNC(const char *) Py_GetBuildInfo(void); 71 | #ifndef Py_LIMITED_API 72 | PyAPI_FUNC(const char *) _Py_hgidentifier(void); 73 | PyAPI_FUNC(const char *) _Py_hgversion(void); 74 | #endif 75 | 76 | /* Internal -- various one-time initializations */ 77 | #ifndef Py_LIMITED_API 78 | PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); 79 | PyAPI_FUNC(PyObject *) _PySys_Init(void); 80 | PyAPI_FUNC(void) _PyImport_Init(void); 81 | PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod); 82 | PyAPI_FUNC(void) _PyImportHooks_Init(void); 83 | PyAPI_FUNC(int) _PyFrame_Init(void); 84 | PyAPI_FUNC(int) _PyFloat_Init(void); 85 | PyAPI_FUNC(int) PyByteArray_Init(void); 86 | PyAPI_FUNC(void) _PyRandom_Init(void); 87 | #endif 88 | 89 | /* Various internal finalizers */ 90 | #ifndef Py_LIMITED_API 91 | PyAPI_FUNC(void) _PyExc_Fini(void); 92 | PyAPI_FUNC(void) _PyImport_Fini(void); 93 | PyAPI_FUNC(void) PyMethod_Fini(void); 94 | PyAPI_FUNC(void) PyFrame_Fini(void); 95 | PyAPI_FUNC(void) PyCFunction_Fini(void); 96 | PyAPI_FUNC(void) PyDict_Fini(void); 97 | PyAPI_FUNC(void) PyTuple_Fini(void); 98 | PyAPI_FUNC(void) PyList_Fini(void); 99 | PyAPI_FUNC(void) PySet_Fini(void); 100 | PyAPI_FUNC(void) PyBytes_Fini(void); 101 | PyAPI_FUNC(void) PyByteArray_Fini(void); 102 | PyAPI_FUNC(void) PyFloat_Fini(void); 103 | PyAPI_FUNC(void) PyOS_FiniInterrupts(void); 104 | PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void); 105 | PyAPI_FUNC(void) _PyGC_Fini(void); 106 | PyAPI_FUNC(void) PySlice_Fini(void); 107 | PyAPI_FUNC(void) _PyType_Fini(void); 108 | PyAPI_FUNC(void) _PyRandom_Fini(void); 109 | 110 | PyAPI_DATA(PyThreadState *) _Py_Finalizing; 111 | #endif 112 | 113 | /* Signals */ 114 | typedef void (*PyOS_sighandler_t)(int); 115 | PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); 116 | PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); 117 | 118 | /* Random */ 119 | PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size); 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | #endif /* !Py_PYLIFECYCLE_H */ 125 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pymacconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef PYMACCONFIG_H 2 | #define PYMACCONFIG_H 3 | /* 4 | * This file moves some of the autoconf magic to compile-time 5 | * when building on MacOSX. This is needed for building 4-way 6 | * universal binaries and for 64-bit universal binaries because 7 | * the values redefined below aren't configure-time constant but 8 | * only compile-time constant in these scenarios. 9 | */ 10 | 11 | #if defined(__APPLE__) 12 | 13 | # undef SIZEOF_LONG 14 | # undef SIZEOF_PTHREAD_T 15 | # undef SIZEOF_SIZE_T 16 | # undef SIZEOF_TIME_T 17 | # undef SIZEOF_VOID_P 18 | # undef SIZEOF__BOOL 19 | # undef SIZEOF_UINTPTR_T 20 | # undef SIZEOF_PTHREAD_T 21 | # undef WORDS_BIGENDIAN 22 | # undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 23 | # undef DOUBLE_IS_BIG_ENDIAN_IEEE754 24 | # undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 25 | # undef HAVE_GCC_ASM_FOR_X87 26 | 27 | # undef VA_LIST_IS_ARRAY 28 | # if defined(__LP64__) && defined(__x86_64__) 29 | # define VA_LIST_IS_ARRAY 1 30 | # endif 31 | 32 | # undef HAVE_LARGEFILE_SUPPORT 33 | # ifndef __LP64__ 34 | # define HAVE_LARGEFILE_SUPPORT 1 35 | # endif 36 | 37 | # undef SIZEOF_LONG 38 | # ifdef __LP64__ 39 | # define SIZEOF__BOOL 1 40 | # define SIZEOF__BOOL 1 41 | # define SIZEOF_LONG 8 42 | # define SIZEOF_PTHREAD_T 8 43 | # define SIZEOF_SIZE_T 8 44 | # define SIZEOF_TIME_T 8 45 | # define SIZEOF_VOID_P 8 46 | # define SIZEOF_UINTPTR_T 8 47 | # define SIZEOF_PTHREAD_T 8 48 | # else 49 | # ifdef __ppc__ 50 | # define SIZEOF__BOOL 4 51 | # else 52 | # define SIZEOF__BOOL 1 53 | # endif 54 | # define SIZEOF_LONG 4 55 | # define SIZEOF_PTHREAD_T 4 56 | # define SIZEOF_SIZE_T 4 57 | # define SIZEOF_TIME_T 4 58 | # define SIZEOF_VOID_P 4 59 | # define SIZEOF_UINTPTR_T 4 60 | # define SIZEOF_PTHREAD_T 4 61 | # endif 62 | 63 | # if defined(__LP64__) 64 | /* MacOSX 10.4 (the first release to support 64-bit code 65 | * at all) only supports 64-bit in the UNIX layer. 66 | * Therefore surpress the toolbox-glue in 64-bit mode. 67 | */ 68 | 69 | /* In 64-bit mode setpgrp always has no argments, in 32-bit 70 | * mode that depends on the compilation environment 71 | */ 72 | # undef SETPGRP_HAVE_ARG 73 | 74 | # endif 75 | 76 | #ifdef __BIG_ENDIAN__ 77 | #define WORDS_BIGENDIAN 1 78 | #define DOUBLE_IS_BIG_ENDIAN_IEEE754 79 | #else 80 | #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 81 | #endif /* __BIG_ENDIAN */ 82 | 83 | #ifdef __i386__ 84 | # define HAVE_GCC_ASM_FOR_X87 85 | #endif 86 | 87 | /* 88 | * The definition in pyconfig.h is only valid on the OS release 89 | * where configure ran on and not necessarily for all systems where 90 | * the executable can be used on. 91 | * 92 | * Specifically: OSX 10.4 has limited supported for '%zd', while 93 | * 10.5 has full support for '%zd'. A binary built on 10.5 won't 94 | * work properly on 10.4 unless we surpress the definition 95 | * of PY_FORMAT_SIZE_T 96 | */ 97 | #undef PY_FORMAT_SIZE_T 98 | 99 | 100 | #endif /* defined(_APPLE__) */ 101 | 102 | #endif /* PYMACCONFIG_H */ 103 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pymacro.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PYMACRO_H 2 | #define Py_PYMACRO_H 3 | 4 | /* Minimum value between x and y */ 5 | #define Py_MIN(x, y) (((x) > (y)) ? (y) : (x)) 6 | 7 | /* Maximum value between x and y */ 8 | #define Py_MAX(x, y) (((x) > (y)) ? (x) : (y)) 9 | 10 | /* Absolute value of the number x */ 11 | #define Py_ABS(x) ((x) < 0 ? -(x) : (x)) 12 | 13 | #define _Py_XSTRINGIFY(x) #x 14 | 15 | /* Convert the argument to a string. For example, Py_STRINGIFY(123) is replaced 16 | with "123" by the preprocessor. Defines are also replaced by their value. 17 | For example Py_STRINGIFY(__LINE__) is replaced by the line number, not 18 | by "__LINE__". */ 19 | #define Py_STRINGIFY(x) _Py_XSTRINGIFY(x) 20 | 21 | /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ 22 | #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) 23 | 24 | /* Assert a build-time dependency, as an expression. 25 | 26 | Your compile will fail if the condition isn't true, or can't be evaluated 27 | by the compiler. This can be used in an expression: its value is 0. 28 | 29 | Example: 30 | 31 | #define foo_to_char(foo) \ 32 | ((char *)(foo) \ 33 | + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0)) 34 | 35 | Written by Rusty Russell, public domain, http://ccodearchive.net/ */ 36 | #define Py_BUILD_ASSERT_EXPR(cond) \ 37 | (sizeof(char [1 - 2*!(cond)]) - 1) 38 | 39 | /* Get the number of elements in a visible array 40 | 41 | This does not work on pointers, or arrays declared as [], or function 42 | parameters. With correct compiler support, such usage will cause a build 43 | error (see Py_BUILD_ASSERT_EXPR). 44 | 45 | Written by Rusty Russell, public domain, http://ccodearchive.net/ 46 | 47 | Requires at GCC 3.1+ */ 48 | #if (defined(__GNUC__) && !defined(__STRICT_ANSI__) && \ 49 | (((__GNUC__ == 3) && (__GNU_MINOR__ >= 1)) || (__GNUC__ >= 4))) 50 | /* Two gcc extensions. 51 | &a[0] degrades to a pointer: a different type from an array */ 52 | #define Py_ARRAY_LENGTH(array) \ 53 | (sizeof(array) / sizeof((array)[0]) \ 54 | + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \ 55 | typeof(&(array)[0])))) 56 | #else 57 | #define Py_ARRAY_LENGTH(array) \ 58 | (sizeof(array) / sizeof((array)[0])) 59 | #endif 60 | 61 | 62 | /* Define macros for inline documentation. */ 63 | #define PyDoc_VAR(name) static char name[] 64 | #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) 65 | #ifdef WITH_DOC_STRINGS 66 | #define PyDoc_STR(str) str 67 | #else 68 | #define PyDoc_STR(str) "" 69 | #endif 70 | 71 | /* Below "a" is a power of 2. */ 72 | /* Round down size "n" to be a multiple of "a". */ 73 | #define _Py_SIZE_ROUND_DOWN(n, a) ((size_t)(n) & ~(size_t)((a) - 1)) 74 | /* Round up size "n" to be a multiple of "a". */ 75 | #define _Py_SIZE_ROUND_UP(n, a) (((size_t)(n) + \ 76 | (size_t)((a) - 1)) & ~(size_t)((a) - 1)) 77 | /* Round pointer "p" down to the closest "a"-aligned address <= "p". */ 78 | #define _Py_ALIGN_DOWN(p, a) ((void *)((Py_uintptr_t)(p) & ~(Py_uintptr_t)((a) - 1))) 79 | /* Round pointer "p" up to the closest "a"-aligned address >= "p". */ 80 | #define _Py_ALIGN_UP(p, a) ((void *)(((Py_uintptr_t)(p) + \ 81 | (Py_uintptr_t)((a) - 1)) & ~(Py_uintptr_t)((a) - 1))) 82 | /* Check if pointer "p" is aligned to "a"-bytes boundary. */ 83 | #define _Py_IS_ALIGNED(p, a) (!((Py_uintptr_t)(p) & (Py_uintptr_t)((a) - 1))) 84 | 85 | #ifdef __GNUC__ 86 | #define Py_UNUSED(name) _unused_ ## name __attribute__((unused)) 87 | #else 88 | #define Py_UNUSED(name) _unused_ ## name 89 | #endif 90 | 91 | #endif /* Py_PYMACRO_H */ 92 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pystrcmp.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRCMP_H 2 | #define Py_STRCMP_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); 9 | PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); 10 | 11 | #ifdef MS_WINDOWS 12 | #define PyOS_strnicmp strnicmp 13 | #define PyOS_stricmp stricmp 14 | #else 15 | #define PyOS_strnicmp PyOS_mystrnicmp 16 | #define PyOS_stricmp PyOS_mystricmp 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* !Py_STRCMP_H */ 24 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pystrhex.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRHEX_H 2 | #define Py_STRHEX_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* Returns a str() containing the hex representation of argbuf. */ 9 | PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen); 10 | /* Returns a bytes() containing the ASCII hex representation of argbuf. */ 11 | PyAPI_FUNC(PyObject*) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* !Py_STRHEX_H */ 18 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pystrtod.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRTOD_H 2 | #define Py_STRTOD_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | PyAPI_FUNC(double) PyOS_string_to_double(const char *str, 10 | char **endptr, 11 | PyObject *overflow_exception); 12 | 13 | /* The caller is responsible for calling PyMem_Free to free the buffer 14 | that's is returned. */ 15 | PyAPI_FUNC(char *) PyOS_double_to_string(double val, 16 | char format_code, 17 | int precision, 18 | int flags, 19 | int *type); 20 | 21 | #ifndef Py_LIMITED_API 22 | PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); 23 | #endif 24 | 25 | 26 | /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ 27 | #define Py_DTSF_SIGN 0x01 /* always add the sign */ 28 | #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ 29 | #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code 30 | specific */ 31 | 32 | /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ 33 | #define Py_DTST_FINITE 0 34 | #define Py_DTST_INFINITE 1 35 | #define Py_DTST_NAN 2 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* !Py_STRTOD_H */ 42 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/pythread.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_PYTHREAD_H 3 | #define Py_PYTHREAD_H 4 | 5 | typedef void *PyThread_type_lock; 6 | typedef void *PyThread_type_sema; 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Return status codes for Python lock acquisition. Chosen for maximum 13 | * backwards compatibility, ie failure -> 0, success -> 1. */ 14 | typedef enum PyLockStatus { 15 | PY_LOCK_FAILURE = 0, 16 | PY_LOCK_ACQUIRED = 1, 17 | PY_LOCK_INTR 18 | } PyLockStatus; 19 | 20 | PyAPI_FUNC(void) PyThread_init_thread(void); 21 | PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); 22 | PyAPI_FUNC(void) PyThread_exit_thread(void); 23 | PyAPI_FUNC(long) PyThread_get_thread_ident(void); 24 | 25 | PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); 26 | PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); 27 | PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); 28 | #define WAIT_LOCK 1 29 | #define NOWAIT_LOCK 0 30 | 31 | /* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting 32 | on a lock (see PyThread_acquire_lock_timed() below). 33 | PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that 34 | type, and depends on the system threading API. 35 | 36 | NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread 37 | module exposes a higher-level API, with timeouts expressed in seconds 38 | and floating-point numbers allowed. 39 | */ 40 | #if defined(HAVE_LONG_LONG) 41 | #define PY_TIMEOUT_T PY_LONG_LONG 42 | #define PY_TIMEOUT_MAX PY_LLONG_MAX 43 | #else 44 | #define PY_TIMEOUT_T long 45 | #define PY_TIMEOUT_MAX LONG_MAX 46 | #endif 47 | 48 | /* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ 49 | #if defined (NT_THREADS) 50 | #if (Py_LL(0xFFFFFFFF) * 1000 < PY_TIMEOUT_MAX) 51 | #undef PY_TIMEOUT_MAX 52 | #define PY_TIMEOUT_MAX (Py_LL(0xFFFFFFFF) * 1000) 53 | #endif 54 | #endif 55 | 56 | /* If microseconds == 0, the call is non-blocking: it returns immediately 57 | even when the lock can't be acquired. 58 | If microseconds > 0, the call waits up to the specified duration. 59 | If microseconds < 0, the call waits until success (or abnormal failure) 60 | 61 | microseconds must be less than PY_TIMEOUT_MAX. Behaviour otherwise is 62 | undefined. 63 | 64 | If intr_flag is true and the acquire is interrupted by a signal, then the 65 | call will return PY_LOCK_INTR. The caller may reattempt to acquire the 66 | lock. 67 | */ 68 | PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed(PyThread_type_lock, 69 | PY_TIMEOUT_T microseconds, 70 | int intr_flag); 71 | 72 | PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); 73 | 74 | PyAPI_FUNC(size_t) PyThread_get_stacksize(void); 75 | PyAPI_FUNC(int) PyThread_set_stacksize(size_t); 76 | 77 | PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); 78 | 79 | /* Thread Local Storage (TLS) API */ 80 | PyAPI_FUNC(int) PyThread_create_key(void); 81 | PyAPI_FUNC(void) PyThread_delete_key(int); 82 | PyAPI_FUNC(int) PyThread_set_key_value(int, void *); 83 | PyAPI_FUNC(void *) PyThread_get_key_value(int); 84 | PyAPI_FUNC(void) PyThread_delete_key_value(int key); 85 | 86 | /* Cleanup after a fork */ 87 | PyAPI_FUNC(void) PyThread_ReInitTLS(void); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif /* !Py_PYTHREAD_H */ 94 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/rangeobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Range object interface */ 3 | 4 | #ifndef Py_RANGEOBJECT_H 5 | #define Py_RANGEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* 11 | A range object represents an integer range. This is an immutable object; 12 | a range cannot change its value after creation. 13 | 14 | Range objects behave like the corresponding tuple objects except that 15 | they are represented by a start, stop, and step datamembers. 16 | */ 17 | 18 | PyAPI_DATA(PyTypeObject) PyRange_Type; 19 | PyAPI_DATA(PyTypeObject) PyRangeIter_Type; 20 | PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type; 21 | 22 | #define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* !Py_RANGEOBJECT_H */ 28 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/setobject.h: -------------------------------------------------------------------------------- 1 | /* Set object interface */ 2 | 3 | #ifndef Py_SETOBJECT_H 4 | #define Py_SETOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifndef Py_LIMITED_API 10 | 11 | /* There are three kinds of entries in the table: 12 | 13 | 1. Unused: key == NULL 14 | 2. Active: key != NULL and key != dummy 15 | 3. Dummy: key == dummy 16 | 17 | The hash field of Unused slots have no meaning. 18 | The hash field of Dummny slots are set to -1 19 | meaning that dummy entries can be detected by 20 | either entry->key==dummy or by entry->hash==-1. 21 | */ 22 | 23 | #define PySet_MINSIZE 8 24 | 25 | typedef struct { 26 | PyObject *key; 27 | Py_hash_t hash; /* Cached hash code of the key */ 28 | } setentry; 29 | 30 | /* The SetObject data structure is shared by set and frozenset objects. 31 | 32 | Invariant for sets: 33 | - hash is -1 34 | 35 | Invariants for frozensets: 36 | - data is immutable. 37 | - hash is the hash of the frozenset or -1 if not computed yet. 38 | 39 | */ 40 | 41 | typedef struct { 42 | PyObject_HEAD 43 | 44 | Py_ssize_t fill; /* Number active and dummy entries*/ 45 | Py_ssize_t used; /* Number active entries */ 46 | 47 | /* The table contains mask + 1 slots, and that's a power of 2. 48 | * We store the mask instead of the size because the mask is more 49 | * frequently needed. 50 | */ 51 | Py_ssize_t mask; 52 | 53 | /* The table points to a fixed-size smalltable for small tables 54 | * or to additional malloc'ed memory for bigger tables. 55 | * The table pointer is never NULL which saves us from repeated 56 | * runtime null-tests. 57 | */ 58 | setentry *table; 59 | Py_hash_t hash; /* Only used by frozenset objects */ 60 | Py_ssize_t finger; /* Search finger for pop() */ 61 | 62 | setentry smalltable[PySet_MINSIZE]; 63 | PyObject *weakreflist; /* List of weak references */ 64 | } PySetObject; 65 | 66 | #define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) 67 | 68 | PyAPI_DATA(PyObject *) _PySet_Dummy; 69 | 70 | PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash); 71 | PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); 72 | PyAPI_FUNC(int) PySet_ClearFreeList(void); 73 | 74 | #endif /* Section excluded by Py_LIMITED_API */ 75 | 76 | PyAPI_DATA(PyTypeObject) PySet_Type; 77 | PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; 78 | PyAPI_DATA(PyTypeObject) PySetIter_Type; 79 | 80 | PyAPI_FUNC(PyObject *) PySet_New(PyObject *); 81 | PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); 82 | 83 | PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); 84 | PyAPI_FUNC(int) PySet_Clear(PyObject *set); 85 | PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); 86 | PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); 87 | PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); 88 | PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); 89 | 90 | #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) 91 | #define PyAnySet_CheckExact(ob) \ 92 | (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) 93 | #define PyAnySet_Check(ob) \ 94 | (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ 95 | PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ 96 | PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) 97 | #define PySet_Check(ob) \ 98 | (Py_TYPE(ob) == &PySet_Type || \ 99 | PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) 100 | #define PyFrozenSet_Check(ob) \ 101 | (Py_TYPE(ob) == &PyFrozenSet_Type || \ 102 | PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | #endif /* !Py_SETOBJECT_H */ 108 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/sliceobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_SLICEOBJECT_H 2 | #define Py_SLICEOBJECT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | /* The unique ellipsis object "..." */ 8 | 9 | PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ 10 | 11 | #define Py_Ellipsis (&_Py_EllipsisObject) 12 | 13 | /* Slice object interface */ 14 | 15 | /* 16 | 17 | A slice object containing start, stop, and step data members (the 18 | names are from range). After much talk with Guido, it was decided to 19 | let these be any arbitrary python type. Py_None stands for omitted values. 20 | */ 21 | #ifndef Py_LIMITED_API 22 | typedef struct { 23 | PyObject_HEAD 24 | PyObject *start, *stop, *step; /* not NULL */ 25 | } PySliceObject; 26 | #endif 27 | 28 | PyAPI_DATA(PyTypeObject) PySlice_Type; 29 | PyAPI_DATA(PyTypeObject) PyEllipsis_Type; 30 | 31 | #define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) 32 | 33 | PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, 34 | PyObject* step); 35 | #ifndef Py_LIMITED_API 36 | PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); 37 | PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, 38 | PyObject **start_ptr, PyObject **stop_ptr, 39 | PyObject **step_ptr); 40 | #endif 41 | PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, 42 | Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); 43 | PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, 44 | Py_ssize_t *start, Py_ssize_t *stop, 45 | Py_ssize_t *step, Py_ssize_t *slicelength); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | #endif /* !Py_SLICEOBJECT_H */ 51 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/structmember.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRUCTMEMBER_H 2 | #define Py_STRUCTMEMBER_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Interface to map C struct members to Python object attributes */ 9 | 10 | #include /* For offsetof */ 11 | 12 | /* An array of PyMemberDef structures defines the name, type and offset 13 | of selected members of a C structure. These can be read by 14 | PyMember_GetOne() and set by PyMember_SetOne() (except if their READONLY 15 | flag is set). The array must be terminated with an entry whose name 16 | pointer is NULL. */ 17 | 18 | typedef struct PyMemberDef { 19 | char *name; 20 | int type; 21 | Py_ssize_t offset; 22 | int flags; 23 | char *doc; 24 | } PyMemberDef; 25 | 26 | /* Types */ 27 | #define T_SHORT 0 28 | #define T_INT 1 29 | #define T_LONG 2 30 | #define T_FLOAT 3 31 | #define T_DOUBLE 4 32 | #define T_STRING 5 33 | #define T_OBJECT 6 34 | /* XXX the ordering here is weird for binary compatibility */ 35 | #define T_CHAR 7 /* 1-character string */ 36 | #define T_BYTE 8 /* 8-bit signed int */ 37 | /* unsigned variants: */ 38 | #define T_UBYTE 9 39 | #define T_USHORT 10 40 | #define T_UINT 11 41 | #define T_ULONG 12 42 | 43 | /* Added by Jack: strings contained in the structure */ 44 | #define T_STRING_INPLACE 13 45 | 46 | /* Added by Lillo: bools contained in the structure (assumed char) */ 47 | #define T_BOOL 14 48 | 49 | #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError 50 | when the value is NULL, instead of 51 | converting to None. */ 52 | #ifdef HAVE_LONG_LONG 53 | #define T_LONGLONG 17 54 | #define T_ULONGLONG 18 55 | #endif /* HAVE_LONG_LONG */ 56 | 57 | #define T_PYSSIZET 19 /* Py_ssize_t */ 58 | #define T_NONE 20 /* Value is always None */ 59 | 60 | 61 | /* Flags */ 62 | #define READONLY 1 63 | #define READ_RESTRICTED 2 64 | #define PY_WRITE_RESTRICTED 4 65 | #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) 66 | 67 | 68 | /* Current API, use this */ 69 | PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); 70 | PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); 71 | 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | #endif /* !Py_STRUCTMEMBER_H */ 77 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/structseq.h: -------------------------------------------------------------------------------- 1 | 2 | /* Named tuple object interface */ 3 | 4 | #ifndef Py_STRUCTSEQ_H 5 | #define Py_STRUCTSEQ_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct PyStructSequence_Field { 11 | char *name; 12 | char *doc; 13 | } PyStructSequence_Field; 14 | 15 | typedef struct PyStructSequence_Desc { 16 | char *name; 17 | char *doc; 18 | struct PyStructSequence_Field *fields; 19 | int n_in_sequence; 20 | } PyStructSequence_Desc; 21 | 22 | extern char* PyStructSequence_UnnamedField; 23 | 24 | #ifndef Py_LIMITED_API 25 | PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, 26 | PyStructSequence_Desc *desc); 27 | PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, 28 | PyStructSequence_Desc *desc); 29 | #endif 30 | PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); 31 | 32 | PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); 33 | 34 | #ifndef Py_LIMITED_API 35 | typedef PyTupleObject PyStructSequence; 36 | 37 | /* Macro, *only* to be used to fill in brand new objects */ 38 | #define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) 39 | 40 | #define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) 41 | #endif 42 | 43 | PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); 44 | PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | #endif /* !Py_STRUCTSEQ_H */ 50 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/symtable.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_SYMTABLE_H 3 | #define Py_SYMTABLE_H 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | /* XXX(ncoghlan): This is a weird mix of public names and interpreter internal 10 | * names. 11 | */ 12 | 13 | typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } 14 | _Py_block_ty; 15 | 16 | struct _symtable_entry; 17 | 18 | struct symtable { 19 | PyObject *st_filename; /* name of file being compiled, 20 | decoded from the filesystem encoding */ 21 | struct _symtable_entry *st_cur; /* current symbol table entry */ 22 | struct _symtable_entry *st_top; /* symbol table entry for module */ 23 | PyObject *st_blocks; /* dict: map AST node addresses 24 | * to symbol table entries */ 25 | PyObject *st_stack; /* list: stack of namespace info */ 26 | PyObject *st_global; /* borrowed ref to st_top->ste_symbols */ 27 | int st_nblocks; /* number of blocks used. kept for 28 | consistency with the corresponding 29 | compiler structure */ 30 | PyObject *st_private; /* name of current class or NULL */ 31 | PyFutureFeatures *st_future; /* module's future features that affect 32 | the symbol table */ 33 | int recursion_depth; /* current recursion depth */ 34 | int recursion_limit; /* recursion limit */ 35 | }; 36 | 37 | typedef struct _symtable_entry { 38 | PyObject_HEAD 39 | PyObject *ste_id; /* int: key in ste_table->st_blocks */ 40 | PyObject *ste_symbols; /* dict: variable names to flags */ 41 | PyObject *ste_name; /* string: name of current block */ 42 | PyObject *ste_varnames; /* list of function parameters */ 43 | PyObject *ste_children; /* list of child blocks */ 44 | PyObject *ste_directives;/* locations of global and nonlocal statements */ 45 | _Py_block_ty ste_type; /* module, class, or function */ 46 | int ste_nested; /* true if block is nested */ 47 | unsigned ste_free : 1; /* true if block has free variables */ 48 | unsigned ste_child_free : 1; /* true if a child block has free vars, 49 | including free refs to globals */ 50 | unsigned ste_generator : 1; /* true if namespace is a generator */ 51 | unsigned ste_varargs : 1; /* true if block has varargs */ 52 | unsigned ste_varkeywords : 1; /* true if block has varkeywords */ 53 | unsigned ste_returns_value : 1; /* true if namespace uses return with 54 | an argument */ 55 | unsigned ste_needs_class_closure : 1; /* for class scopes, true if a 56 | closure over __class__ 57 | should be created */ 58 | int ste_lineno; /* first line of block */ 59 | int ste_col_offset; /* offset of first line of block */ 60 | int ste_opt_lineno; /* lineno of last exec or import * */ 61 | int ste_opt_col_offset; /* offset of last exec or import * */ 62 | int ste_tmpname; /* counter for listcomp temp vars */ 63 | struct symtable *ste_table; 64 | } PySTEntryObject; 65 | 66 | PyAPI_DATA(PyTypeObject) PySTEntry_Type; 67 | 68 | #define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) 69 | 70 | PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); 71 | 72 | PyAPI_FUNC(struct symtable *) PySymtable_Build( 73 | mod_ty mod, 74 | const char *filename, /* decoded from the filesystem encoding */ 75 | PyFutureFeatures *future); 76 | PyAPI_FUNC(struct symtable *) PySymtable_BuildObject( 77 | mod_ty mod, 78 | PyObject *filename, 79 | PyFutureFeatures *future); 80 | PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); 81 | 82 | PyAPI_FUNC(void) PySymtable_Free(struct symtable *); 83 | 84 | /* Flags for def-use information */ 85 | 86 | #define DEF_GLOBAL 1 /* global stmt */ 87 | #define DEF_LOCAL 2 /* assignment in code block */ 88 | #define DEF_PARAM 2<<1 /* formal parameter */ 89 | #define DEF_NONLOCAL 2<<2 /* nonlocal stmt */ 90 | #define USE 2<<3 /* name is used */ 91 | #define DEF_FREE 2<<4 /* name used but not defined in nested block */ 92 | #define DEF_FREE_CLASS 2<<5 /* free variable from class's method */ 93 | #define DEF_IMPORT 2<<6 /* assignment occurred via import */ 94 | 95 | #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) 96 | 97 | /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol 98 | table. GLOBAL is returned from PyST_GetScope() for either of them. 99 | It is stored in ste_symbols at bits 12-15. 100 | */ 101 | #define SCOPE_OFFSET 11 102 | #define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) 103 | 104 | #define LOCAL 1 105 | #define GLOBAL_EXPLICIT 2 106 | #define GLOBAL_IMPLICIT 3 107 | #define FREE 4 108 | #define CELL 5 109 | 110 | #define GENERATOR 1 111 | #define GENERATOR_EXPRESSION 2 112 | 113 | #ifdef __cplusplus 114 | } 115 | #endif 116 | #endif /* !Py_SYMTABLE_H */ 117 | #endif /* Py_LIMITED_API */ 118 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/sysmodule.h: -------------------------------------------------------------------------------- 1 | 2 | /* System module interface */ 3 | 4 | #ifndef Py_SYSMODULE_H 5 | #define Py_SYSMODULE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) PySys_GetObject(const char *); 11 | #ifndef Py_LIMITED_API 12 | PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key); 13 | #endif 14 | PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *); 15 | PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *); 16 | 17 | PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **); 18 | PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int); 19 | PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); 20 | 21 | PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) 22 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 23 | PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) 24 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 25 | PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); 26 | PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); 27 | 28 | PyAPI_FUNC(void) PySys_ResetWarnOptions(void); 29 | PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *); 30 | PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject *); 31 | PyAPI_FUNC(int) PySys_HasWarnOptions(void); 32 | 33 | PyAPI_FUNC(void) PySys_AddXOption(const wchar_t *); 34 | PyAPI_FUNC(PyObject *) PySys_GetXOptions(void); 35 | 36 | #ifndef Py_LIMITED_API 37 | PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); 38 | #endif 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | #endif /* !Py_SYSMODULE_H */ 44 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/token.h: -------------------------------------------------------------------------------- 1 | 2 | /* Token types */ 3 | #ifndef Py_LIMITED_API 4 | #ifndef Py_TOKEN_H 5 | #define Py_TOKEN_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ 11 | 12 | #define ENDMARKER 0 13 | #define NAME 1 14 | #define NUMBER 2 15 | #define STRING 3 16 | #define NEWLINE 4 17 | #define INDENT 5 18 | #define DEDENT 6 19 | #define LPAR 7 20 | #define RPAR 8 21 | #define LSQB 9 22 | #define RSQB 10 23 | #define COLON 11 24 | #define COMMA 12 25 | #define SEMI 13 26 | #define PLUS 14 27 | #define MINUS 15 28 | #define STAR 16 29 | #define SLASH 17 30 | #define VBAR 18 31 | #define AMPER 19 32 | #define LESS 20 33 | #define GREATER 21 34 | #define EQUAL 22 35 | #define DOT 23 36 | #define PERCENT 24 37 | #define LBRACE 25 38 | #define RBRACE 26 39 | #define EQEQUAL 27 40 | #define NOTEQUAL 28 41 | #define LESSEQUAL 29 42 | #define GREATEREQUAL 30 43 | #define TILDE 31 44 | #define CIRCUMFLEX 32 45 | #define LEFTSHIFT 33 46 | #define RIGHTSHIFT 34 47 | #define DOUBLESTAR 35 48 | #define PLUSEQUAL 36 49 | #define MINEQUAL 37 50 | #define STAREQUAL 38 51 | #define SLASHEQUAL 39 52 | #define PERCENTEQUAL 40 53 | #define AMPEREQUAL 41 54 | #define VBAREQUAL 42 55 | #define CIRCUMFLEXEQUAL 43 56 | #define LEFTSHIFTEQUAL 44 57 | #define RIGHTSHIFTEQUAL 45 58 | #define DOUBLESTAREQUAL 46 59 | #define DOUBLESLASH 47 60 | #define DOUBLESLASHEQUAL 48 61 | #define AT 49 62 | #define ATEQUAL 50 63 | #define RARROW 51 64 | #define ELLIPSIS 52 65 | /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ 66 | #define OP 53 67 | #define AWAIT 54 68 | #define ASYNC 55 69 | #define ERRORTOKEN 56 70 | #define N_TOKENS 57 71 | 72 | /* Special definitions for cooperation with parser */ 73 | 74 | #define NT_OFFSET 256 75 | 76 | #define ISTERMINAL(x) ((x) < NT_OFFSET) 77 | #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) 78 | #define ISEOF(x) ((x) == ENDMARKER) 79 | 80 | 81 | PyAPI_DATA(const char *) _PyParser_TokenNames[]; /* Token names */ 82 | PyAPI_FUNC(int) PyToken_OneChar(int); 83 | PyAPI_FUNC(int) PyToken_TwoChars(int, int); 84 | PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #endif /* !Py_TOKEN_H */ 90 | #endif /* Py_LIMITED_API */ 91 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/traceback.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_TRACEBACK_H 3 | #define Py_TRACEBACK_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "pystate.h" 9 | 10 | struct _frame; 11 | 12 | /* Traceback interface */ 13 | #ifndef Py_LIMITED_API 14 | typedef struct _traceback { 15 | PyObject_HEAD 16 | struct _traceback *tb_next; 17 | struct _frame *tb_frame; 18 | int tb_lasti; 19 | int tb_lineno; 20 | } PyTracebackObject; 21 | #endif 22 | 23 | PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); 24 | PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); 25 | #ifndef Py_LIMITED_API 26 | PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int); 27 | PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int); 28 | #endif 29 | 30 | /* Reveal traceback type so we can typecheck traceback objects */ 31 | PyAPI_DATA(PyTypeObject) PyTraceBack_Type; 32 | #define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) 33 | 34 | /* Write the Python traceback into the file 'fd'. For example: 35 | 36 | Traceback (most recent call first): 37 | File "xxx", line xxx in 38 | File "xxx", line xxx in 39 | ... 40 | File "xxx", line xxx in 41 | 42 | This function is written for debug purpose only, to dump the traceback in 43 | the worst case: after a segmentation fault, at fatal error, etc. That's why, 44 | it is very limited. Strings are truncated to 100 characters and encoded to 45 | ASCII with backslashreplace. It doesn't write the source code, only the 46 | function name, filename and line number of each frame. Write only the first 47 | 100 frames: if the traceback is truncated, write the line " ...". 48 | 49 | This function is signal safe. */ 50 | 51 | PyAPI_DATA(void) _Py_DumpTraceback( 52 | int fd, 53 | PyThreadState *tstate); 54 | 55 | /* Write the traceback of all threads into the file 'fd'. current_thread can be 56 | NULL. Return NULL on success, or an error message on error. 57 | 58 | This function is written for debug purpose only. It calls 59 | _Py_DumpTraceback() for each thread, and so has the same limitations. It 60 | only write the traceback of the first 100 threads: write "..." if there are 61 | more threads. 62 | 63 | This function is signal safe. */ 64 | 65 | PyAPI_DATA(const char*) _Py_DumpTracebackThreads( 66 | int fd, PyInterpreterState *interp, 67 | PyThreadState *current_thread); 68 | 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | #endif /* !Py_TRACEBACK_H */ 74 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/tupleobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Tuple object interface */ 3 | 4 | #ifndef Py_TUPLEOBJECT_H 5 | #define Py_TUPLEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* 11 | Another generally useful object type is a tuple of object pointers. 12 | For Python, this is an immutable type. C code can change the tuple items 13 | (but not their number), and even use tuples are general-purpose arrays of 14 | object references, but in general only brand new tuples should be mutated, 15 | not ones that might already have been exposed to Python code. 16 | 17 | *** WARNING *** PyTuple_SetItem does not increment the new item's reference 18 | count, but does decrement the reference count of the item it replaces, 19 | if not nil. It does *decrement* the reference count if it is *not* 20 | inserted in the tuple. Similarly, PyTuple_GetItem does not increment the 21 | returned item's reference count. 22 | */ 23 | 24 | #ifndef Py_LIMITED_API 25 | typedef struct { 26 | PyObject_VAR_HEAD 27 | PyObject *ob_item[1]; 28 | 29 | /* ob_item contains space for 'ob_size' elements. 30 | * Items must normally not be NULL, except during construction when 31 | * the tuple is not yet visible outside the function that builds it. 32 | */ 33 | } PyTupleObject; 34 | #endif 35 | 36 | PyAPI_DATA(PyTypeObject) PyTuple_Type; 37 | PyAPI_DATA(PyTypeObject) PyTupleIter_Type; 38 | 39 | #define PyTuple_Check(op) \ 40 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) 41 | #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) 42 | 43 | PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); 44 | PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); 45 | PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); 46 | PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); 47 | PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 48 | #ifndef Py_LIMITED_API 49 | PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); 50 | #endif 51 | PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); 52 | #ifndef Py_LIMITED_API 53 | PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); 54 | #endif 55 | 56 | /* Macro, trading safety for speed */ 57 | #ifndef Py_LIMITED_API 58 | #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) 59 | #define PyTuple_GET_SIZE(op) Py_SIZE(op) 60 | 61 | /* Macro, *only* to be used to fill in brand new tuples */ 62 | #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) 63 | #endif 64 | 65 | PyAPI_FUNC(int) PyTuple_ClearFreeList(void); 66 | #ifndef Py_LIMITED_API 67 | PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); 68 | #endif /* Py_LIMITED_API */ 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | #endif /* !Py_TUPLEOBJECT_H */ 74 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/typeslots.h: -------------------------------------------------------------------------------- 1 | /* Do not renumber the file; these numbers are part of the stable ABI. */ 2 | /* Disabled, see #10181 */ 3 | #undef Py_bf_getbuffer 4 | #undef Py_bf_releasebuffer 5 | #define Py_mp_ass_subscript 3 6 | #define Py_mp_length 4 7 | #define Py_mp_subscript 5 8 | #define Py_nb_absolute 6 9 | #define Py_nb_add 7 10 | #define Py_nb_and 8 11 | #define Py_nb_bool 9 12 | #define Py_nb_divmod 10 13 | #define Py_nb_float 11 14 | #define Py_nb_floor_divide 12 15 | #define Py_nb_index 13 16 | #define Py_nb_inplace_add 14 17 | #define Py_nb_inplace_and 15 18 | #define Py_nb_inplace_floor_divide 16 19 | #define Py_nb_inplace_lshift 17 20 | #define Py_nb_inplace_multiply 18 21 | #define Py_nb_inplace_or 19 22 | #define Py_nb_inplace_power 20 23 | #define Py_nb_inplace_remainder 21 24 | #define Py_nb_inplace_rshift 22 25 | #define Py_nb_inplace_subtract 23 26 | #define Py_nb_inplace_true_divide 24 27 | #define Py_nb_inplace_xor 25 28 | #define Py_nb_int 26 29 | #define Py_nb_invert 27 30 | #define Py_nb_lshift 28 31 | #define Py_nb_multiply 29 32 | #define Py_nb_negative 30 33 | #define Py_nb_or 31 34 | #define Py_nb_positive 32 35 | #define Py_nb_power 33 36 | #define Py_nb_remainder 34 37 | #define Py_nb_rshift 35 38 | #define Py_nb_subtract 36 39 | #define Py_nb_true_divide 37 40 | #define Py_nb_xor 38 41 | #define Py_sq_ass_item 39 42 | #define Py_sq_concat 40 43 | #define Py_sq_contains 41 44 | #define Py_sq_inplace_concat 42 45 | #define Py_sq_inplace_repeat 43 46 | #define Py_sq_item 44 47 | #define Py_sq_length 45 48 | #define Py_sq_repeat 46 49 | #define Py_tp_alloc 47 50 | #define Py_tp_base 48 51 | #define Py_tp_bases 49 52 | #define Py_tp_call 50 53 | #define Py_tp_clear 51 54 | #define Py_tp_dealloc 52 55 | #define Py_tp_del 53 56 | #define Py_tp_descr_get 54 57 | #define Py_tp_descr_set 55 58 | #define Py_tp_doc 56 59 | #define Py_tp_getattr 57 60 | #define Py_tp_getattro 58 61 | #define Py_tp_hash 59 62 | #define Py_tp_init 60 63 | #define Py_tp_is_gc 61 64 | #define Py_tp_iter 62 65 | #define Py_tp_iternext 63 66 | #define Py_tp_methods 64 67 | #define Py_tp_new 65 68 | #define Py_tp_repr 66 69 | #define Py_tp_richcompare 67 70 | #define Py_tp_setattr 68 71 | #define Py_tp_setattro 69 72 | #define Py_tp_str 70 73 | #define Py_tp_traverse 71 74 | #define Py_tp_members 72 75 | #define Py_tp_getset 73 76 | #define Py_tp_free 74 77 | #define Py_nb_matrix_multiply 75 78 | #define Py_nb_inplace_matrix_multiply 76 79 | #define Py_am_await 77 80 | #define Py_am_aiter 78 81 | #define Py_am_anext 79 82 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 83 | /* New in 3.5 */ 84 | #define Py_tp_finalize 80 85 | #endif 86 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/ucnhash.h: -------------------------------------------------------------------------------- 1 | /* Unicode name database interface */ 2 | #ifndef Py_LIMITED_API 3 | #ifndef Py_UCNHASH_H 4 | #define Py_UCNHASH_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | /* revised ucnhash CAPI interface (exported through a "wrapper") */ 10 | 11 | #define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" 12 | 13 | typedef struct { 14 | 15 | /* Size of this struct */ 16 | int size; 17 | 18 | /* Get name for a given character code. Returns non-zero if 19 | success, zero if not. Does not set Python exceptions. 20 | If self is NULL, data come from the default version of the database. 21 | If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ 22 | int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen, 23 | int with_alias_and_seq); 24 | 25 | /* Get character code for a given name. Same error handling 26 | as for getname. */ 27 | int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code, 28 | int with_named_seq); 29 | 30 | } _PyUnicode_Name_CAPI; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif /* !Py_UCNHASH_H */ 36 | #endif /* !Py_LIMITED_API */ 37 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/warnings.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_WARNINGS_H 2 | #define Py_WARNINGS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_LIMITED_API 8 | PyAPI_FUNC(PyObject*) _PyWarnings_Init(void); 9 | #endif 10 | 11 | PyAPI_FUNC(int) PyErr_WarnEx( 12 | PyObject *category, 13 | const char *message, /* UTF-8 encoded string */ 14 | Py_ssize_t stack_level); 15 | PyAPI_FUNC(int) PyErr_WarnFormat( 16 | PyObject *category, 17 | Py_ssize_t stack_level, 18 | const char *format, /* ASCII-encoded string */ 19 | ...); 20 | #ifndef Py_LIMITED_API 21 | PyAPI_FUNC(int) PyErr_WarnExplicitObject( 22 | PyObject *category, 23 | PyObject *message, 24 | PyObject *filename, 25 | int lineno, 26 | PyObject *module, 27 | PyObject *registry); 28 | #endif 29 | PyAPI_FUNC(int) PyErr_WarnExplicit( 30 | PyObject *category, 31 | const char *message, /* UTF-8 encoded string */ 32 | const char *filename, /* decoded from the filesystem encoding */ 33 | int lineno, 34 | const char *module, /* UTF-8 encoded string */ 35 | PyObject *registry); 36 | 37 | #ifndef Py_LIMITED_API 38 | PyAPI_FUNC(int) 39 | PyErr_WarnExplicitFormat(PyObject *category, 40 | const char *filename, int lineno, 41 | const char *module, PyObject *registry, 42 | const char *format, ...); 43 | #endif 44 | 45 | /* DEPRECATED: Use PyErr_WarnEx() instead. */ 46 | #ifndef Py_LIMITED_API 47 | #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | #endif /* !Py_WARNINGS_H */ 54 | 55 | -------------------------------------------------------------------------------- /pyprocfilter/python/include/weakrefobject.h: -------------------------------------------------------------------------------- 1 | /* Weak references objects for Python. */ 2 | 3 | #ifndef Py_WEAKREFOBJECT_H 4 | #define Py_WEAKREFOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | typedef struct _PyWeakReference PyWeakReference; 11 | 12 | /* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, 13 | * and CallableProxyType. 14 | */ 15 | #ifndef Py_LIMITED_API 16 | struct _PyWeakReference { 17 | PyObject_HEAD 18 | 19 | /* The object to which this is a weak reference, or Py_None if none. 20 | * Note that this is a stealth reference: wr_object's refcount is 21 | * not incremented to reflect this pointer. 22 | */ 23 | PyObject *wr_object; 24 | 25 | /* A callable to invoke when wr_object dies, or NULL if none. */ 26 | PyObject *wr_callback; 27 | 28 | /* A cache for wr_object's hash code. As usual for hashes, this is -1 29 | * if the hash code isn't known yet. 30 | */ 31 | Py_hash_t hash; 32 | 33 | /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- 34 | * terminated list of weak references to it. These are the list pointers. 35 | * If wr_object goes away, wr_object is set to Py_None, and these pointers 36 | * have no meaning then. 37 | */ 38 | PyWeakReference *wr_prev; 39 | PyWeakReference *wr_next; 40 | }; 41 | #endif 42 | 43 | PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; 44 | PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; 45 | PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; 46 | 47 | #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) 48 | #define PyWeakref_CheckRefExact(op) \ 49 | (Py_TYPE(op) == &_PyWeakref_RefType) 50 | #define PyWeakref_CheckProxy(op) \ 51 | ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ 52 | (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) 53 | 54 | #define PyWeakref_Check(op) \ 55 | (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) 56 | 57 | 58 | PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, 59 | PyObject *callback); 60 | PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, 61 | PyObject *callback); 62 | PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); 63 | 64 | #ifndef Py_LIMITED_API 65 | PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); 66 | 67 | PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); 68 | #endif 69 | 70 | /* Explanation for the Py_REFCNT() check: when a weakref's target is part 71 | of a long chain of deallocations which triggers the trashcan mechanism, 72 | clearing the weakrefs can be delayed long after the target's refcount 73 | has dropped to zero. In the meantime, code accessing the weakref will 74 | be able to "see" the target object even though it is supposed to be 75 | unreachable. See issue #16602. */ 76 | 77 | #define PyWeakref_GET_OBJECT(ref) \ 78 | (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ 79 | ? ((PyWeakReference *)(ref))->wr_object \ 80 | : Py_None) 81 | 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | #endif /* !Py_WEAKREFOBJECT_H */ 87 | -------------------------------------------------------------------------------- /pyprocfilter/python/libs/amd64/_tkinter.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/amd64/_tkinter.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/amd64/libpython35.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/amd64/libpython35.a -------------------------------------------------------------------------------- /pyprocfilter/python/libs/amd64/python3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/amd64/python3.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/amd64/python35.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/amd64/python35.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/amd64/python35_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/amd64/python35_d.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/amd64/python3_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/amd64/python3_d.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/x86/_tkinter.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/x86/_tkinter.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/x86/libpython35.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/x86/libpython35.a -------------------------------------------------------------------------------- /pyprocfilter/python/libs/x86/python3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/x86/python3.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/x86/python35.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/x86/python35.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/x86/python35_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/x86/python35_d.lib -------------------------------------------------------------------------------- /pyprocfilter/python/libs/x86/python3_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kernullist/PyProcFilter/fb45a9a592e885919cbd7d5881a0ffa0ce0b94b0/pyprocfilter/python/libs/x86/python3_d.lib -------------------------------------------------------------------------------- /pyprocfilter/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by pyprocfilter.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /pyprocfilter/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // pyprocfilter.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /pyprocfilter/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #pragma warning (disable : 4995) 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | -------------------------------------------------------------------------------- /pyprocfilter/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | --------------------------------------------------------------------------------