Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions call_dynamic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "pbvm.h"

// any Call_Dynamic( powerobject apow, "function_name", ... / * arguments * / )
// With this function we can dynamically choose the name of the function to call.

DWORD __declspec(dllexport) __stdcall Call_Dynamic (vm_state *vm, DWORD arg_count){
value ret;
LONG _Result;
value * arguments = GET_EVALEDARGLIST( vm );
pb_object * objInst = (pb_object*) arguments[0].value;
//TODO : check for valid instance of objInst
wchar_t* method = (wchar_t*)arguments[1].value;
DWORD *vmptr = (DWORD*)vm;
vmptr[ 0x0204 / 4 ] = arg_count;
vmptr[ 0x015c / 4 ] = 0;
vmptr[ 0x0158 / 4 ] = 0;
vmptr[ 0x0154 / 4 ] = (DWORD)&arguments[2];//skip first and second args
_Result = ob_invoke_dynamic (
(value*)objInst,
NULL,
0 ,//FUNCTION
method,
arg_count - 2,
(void*)&arguments[2],
&ret );
//check for exception
if(GET_THROWNEXCEPTION(vm)){
DWORD unk_struct_ptr = vmptr[ 0x0160 ];
*((WORD*)(unk_struct_ptr + 6)) = 8;
WORD* unk_struct_mbr_ptr = (WORD*)(unk_struct_ptr + 4);
*unk_struct_mbr_ptr &= 0x0FFFE;
*unk_struct_mbr_ptr |= 1;
}
value * called_return_value = GET_CALLEDRETURNVALUE(vm);
if(ret.flags == 0x1d01){ //try to know if "ret" is valid or not
ot_no_return_val(vm);
}
else {
ot_set_return_val(vm, &ret);
}
return 1;
}

//TODO:
//any Call_Dynamic_Event( powerobject apow, "event_name", ... / * arguments * / )
//any Call_Dynamic_Transpose( powerobject apow, "method", any args[] ) : so that arguments can be pushed dynamically in powerscript.
1 change: 1 addition & 0 deletions fastfuncs.def
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Orca_Destroy
Orca_Import
Orca_Regenerate
Orca_Rebuild
Call_Dynamic
20 changes: 17 additions & 3 deletions fastfuncs.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastfuncs", "fastfuncs.vcproj", "{49C7C013-8F72-4D66-87B4-42F44AB496B0}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastfuncs", "fastfuncs.vcxproj", "{49C7C013-8F72-4D66-87B4-42F44AB496B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug105|Win32 = Debug105|Win32
Release100|Win32 = Release100|Win32
Release105|Win32 = Release105|Win32
Release110|Win32 = Release110|Win32
Release115|Win32 = Release115|Win32
Release120|Win32 = Release120|Win32
Release125|Win32 = Release125|Win32
Release170|Win32 = Release170|Win32
Release190|Win32 = Release190|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Debug|Win32.ActiveCfg = Debug|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Debug|Win32.Build.0 = Debug|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Debug105|Win32.ActiveCfg = Debug105|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Debug105|Win32.Build.0 = Debug105|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release100|Win32.ActiveCfg = Release100|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release100|Win32.Build.0 = Release100|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release105|Win32.ActiveCfg = Release105|Win32
Expand All @@ -28,8 +35,15 @@ Global
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release120|Win32.Build.0 = Release120|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release125|Win32.ActiveCfg = Release125|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release125|Win32.Build.0 = Release125|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release170|Win32.ActiveCfg = Release170|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release170|Win32.Build.0 = Release170|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release190|Win32.ActiveCfg = Release190|Win32
{49C7C013-8F72-4D66-87B4-42F44AB496B0}.Release190|Win32.Build.0 = Release190|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81143B54-D5B5-48D2-87E2-AFEE03D49068}
EndGlobalSection
EndGlobal
91 changes: 90 additions & 1 deletion fastfuncs.vcproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="fastfuncs"
ProjectGUID="{49C7C013-8F72-4D66-87B4-42F44AB496B0}"
RootNamespace="pbvm_calling"
Expand Down Expand Up @@ -578,6 +578,82 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug105|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PBVM_CALLING_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Shlwapi.lib pbvm105.lib pbshr105.lib"
OutputFile="$(OutDir)\fastfuncs105.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="libs"
ModuleDefinitionFile="fastfuncs.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
Expand All @@ -595,6 +671,10 @@
RelativePath=".\blob_funcs.cpp"
>
</File>
<File
RelativePath=".\call_dynamic.cpp"
>
</File>
<File
RelativePath=".\dllmain.cpp"
>
Expand Down Expand Up @@ -659,6 +739,15 @@
CompileAsManaged="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug105|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\orca.cpp"
Expand Down
8 changes: 8 additions & 0 deletions fastfuncs100/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs100.dll" alias for "Call_Dynamic"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs105/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs105.dll" alias for "Call_Dynamic"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs110/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs110.dll" alias for "Call_Dynamic"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs115/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs115.dll" alias for "Call_Dynamic"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs120/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs120.dll" alias for "Call_Dynamic"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs125/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs125.dll" alias for "Call_Dynamic"
end prototypes

9 changes: 9 additions & 0 deletions fastfuncs170/append.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$PBExportHeader$append.srf
global type append from function_object
end type

type prototypes
global function boolean append (ref blob ab_source, readonly string as_append, ...) system library "fastfuncs170.dll" alias for "Append"
global function boolean append (ref string as_source, readonly string as_append, ...) system library "fastfuncs170.dll" alias for "Append"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs170/bitwise_and.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$bitwise_and.srf
global type bitwise_and from function_object
end type

type prototypes
global intrinsic function unsignedlong bitwise_and (unsignedlong x, unsignedlong y) system library "fastfuncs170.dll" alias for "Bitwise_And"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs170/bitwise_or.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$bitwise_or.srf
global type bitwise_or from function_object
end type

type prototypes
global intrinsic function unsignedlong bitwise_or (unsignedlong x, unsignedlong y) system library "fastfuncs170.dll" alias for "Bitwise_Or"
end prototypes

9 changes: 9 additions & 0 deletions fastfuncs170/blob_alloc.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$PBExportHeader$blob_alloc.srf
global type blob_alloc from function_object
end type

type prototypes
global function blob blob_alloc (unsignedlong length) system library "fastfuncs170.dll" alias for 'Blob_Alloc'
global function blob blob_alloc (unsignedlong length, boolean zero_memory) system library "fastfuncs170.dll" alias for 'Blob_Alloc'
end prototypes

39 changes: 39 additions & 0 deletions fastfuncs170/blob_extract.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
$PBExportHeader$blob_extract.srf
global type blob_extract from function_object
end type

type prototypes
global function boolean blob_extract (ref powerobject ai_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref boolean ai_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref real ai_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref char ai_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref integer ai_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref uint ai_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref long al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref ulong al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref string al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref longlong al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref dec al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref double al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref date al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref time al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref datetime al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref byte al_val, readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref powerobject ai_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref boolean ai_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref real ai_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref char ai_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref integer ai_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref uint ai_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref long al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref ulong al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref string al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref longlong al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref dec al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref double al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref date al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref time al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref datetime al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
global function boolean blob_extract (ref byte al_val[], readonly blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Extract'
end prototypes

9 changes: 9 additions & 0 deletions fastfuncs170/blob_import.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$PBExportHeader$blob_import.srf
global type blob_import from function_object
end type

type prototypes
global function boolean blob_import (readonly any aa_value, ref blob ab_data, ref long al_pos) system library "fastfuncs170.dll" alias for 'Blob_Import'
global function boolean blob_import (readonly any aa_value, ref blob ab_data) system library "fastfuncs170.dll" alias for 'Blob_Import'
end prototypes

9 changes: 9 additions & 0 deletions fastfuncs170/blob_mid.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$PBExportHeader$blob_mid.srf
global type blob_mid from function_object
end type

type prototypes
global function blob blob_mid (readonly blob ab_in, unsignedlong al_start) system library "fastfuncs170.dll" alias for 'Blob_Mid'
global function blob blob_mid (readonly blob ab_in, unsignedlong al_start, unsignedlong al_len) system library "fastfuncs170.dll" alias for 'Blob_Mid'
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs170/call_dynamic.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$call_dynamic.srf
global type call_dynamic from function_object
end type

type prototypes
global function any call_dynamic (powerobject apow_obj, readonly string as_method, ...) system library "fastfuncs170.dll" alias for "Call_Dynamic"
end prototypes

8 changes: 8 additions & 0 deletions fastfuncs170/fast_pos.srf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$PBExportHeader$fast_pos.srf
global type fast_pos from function_object
end type

type prototypes
global function long fast_pos (readonly string as_source, readonly string as_find) system library "fastfuncs170.dll" alias for 'Fast_Pos'
end prototypes

Loading