Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An array of variant types
#4
Function VariantArgsToArray
 
Code:
Copy      Help
;/
function ARRAY(VARIANT)&a VARIANT&firstParam nParamsBefore

;Creates ARRAY(VARIANT) a and moves VARIANT parameters of the caller function to it.

;a - ARRAY(VARIANT) variable. This function creates the array.
;firstParam - address of the first VARIANT parameter.
;nParamsBefore - the number of function parameters before the first VARIANT parameter.

;EXAMPLE
;function` $name [`_A1] [`_A2] [`_A3] [`_A4] [`_A5] [`_A6]
;ARRAY(VARIANT) a; VariantArgsToArray a &_A1 1

int na = getopt(nargs 1)-nParamsBefore
a.create(na)
if na>0
,na*sizeof(VARIANT)
,memcpy &a[0] &firstParam na
,memset &firstParam 0 na

Function arrVar
 
Code:
Copy      Help
function` [`_A1] [`_A2] [`_A3] [`_A4] [`_A5] [`_A6]

CsScript x.AddCode("")

ARRAY(VARIANT) a; VariantArgsToArray a _A1

str s=
;cd
ret x.Call("test.Call2" s a)

#ret
using System;

public class test
{
,public static string Call2(string command, params object[] args)
,{
,,Console.WriteLine(command + ": " + string.Join(", ", args));
,,return null;
,}
}

Macro Macro3503
Code:
Copy      Help
arrVar("text", 1000)


Messages In This Thread
An array of variant types - by Davider - 06-06-2025, 11:11 AM
RE: An array of variant types - by Gintaras - 06-06-2025, 11:41 AM
RE: An array of variant types - by Davider - 06-06-2025, 12:24 PM
RE: An array of variant types - by Gintaras - 06-06-2025, 01:23 PM
RE: An array of variant types - by Davider - 06-06-2025, 01:47 PM
RE: An array of variant types - by Gintaras - 06-06-2025, 02:05 PM
RE: An array of variant types - by Davider - 06-06-2025, 02:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)