Product Documentation
Virtuoso Visualization and Analysis XL SKILL Reference
Product Version IC23.1, November 2023

calSpecialFunctionInput

calSpecialFunctionInput(
s_specialFunctionName
l_formFields
)
=> t_expression / nil

Description

Checks the buffer and stack and processes the arguments defined under l_formFields into the buffer expression.

Arguments

s_specialFunctionName

Symbol of the user-defined function.

l_formFields

Ordered list of form field symbols that composes the argument list of the user-defined function.

If the special symbol 'STACK is encountered in the list of fields, the top stack expression is popped into the special function argument list.

Currently, all argument fields specified must have associated values or an error message is generated.

If the field type is cyclic or radio, double quotes are added around the field value in the special function argument list.

Value Returned

t_expression

Expression is set in the Buffer.

nil

Indicates an error.

Examples

The following example defines a form myForm for a user-defined function. The form is represented by a symbol specialForm.

This form takes four arguments: Start, Stop, Threshold, and Edge Type.

These arguments are represented by symbols a, b, c, and d, respectively.

The first three arguments are string fields and the fourth argument Edge Type is a cyclic field. Valid values for the argument Edge Type are Rising and Falling. The default value is Rising.

procedure(myForm()
 let((a b c d fieldList)
  a=ahiCreateStringField(
   ?name 'a
   ?prompt "Start"
   ?value ""
  )
  b=ahiCreateStringField(
   ?name 'b
   ?prompt "Stop"
   ?value ""
  )
  c=ahiCreateStringField(
   ?name 'c
   ?prompt "Threshold"
   ?value ""
   )
  d=ahiCreateCyclicField(
   ?name 'd
   ?prompt "Edge Type"
   ?choices '("Rising" "Falling")
   ?value "Rising"
   ?defValue "Rising"
  )
  fieldList=list(
   list(a 20:10 230:10 90)
   list(b 20:40 230:10 90)
   list(c 20:70 230:10 90)
   list(d 20:110 230:10 90)
  )
 calCreateSpecialFunctionsForm('specialForm fieldList)
   )
)
=> myForm

The following example defines a callback procedure myFunctionPlotCB that calls the function calCreateSpecialFunction, which creates and displays the form My Test Function Form created for the user-defined function. The user-defined function is represented by a symbol myTestFunction.

procedure(myFunctionPlotCB()
 calCreateSpecialFunction(
  ?formSym 'specialForm
  ?formInitProc 'myForm
  ?formTitle "My Test Function Form"
  ?formCallback "calSpecialFunctionInput('myTestFunction '( a b c d))"
 )
)
=> myFunctionPlotCB

The following example registers the function myTestFunction with its callback myFunctionPlotCB.

calRegisterSpecialFunction(
 list("myTestFunction" 'myFunctionPlotCB)
)
=> nil

The next time you open the Calculator, the function myTestFunction, which you defined using the function calCreateSpecialFunction appear in the SKILL User Defined Functions category of the Function Panel, as shown in the following figure.

When you click myTestFunction from the SKILL User Defined Functions category in the Function Panel, the form that you created for the user-defined function using the function calCreateSpecialFunctionsForm opens.

Specify the arguments Start, Stop, Threshold, and Edge Type to 20u, 100u, 1.5, and Falling, respectively and then click OK.

The following expression is built in the buffer with the specified form fields.

myTestFunction(v("v2net" ?result "tran"),20u,100u,1.5,"Falling")


Return to top
 ⠀
X