This plugin provides an interface to write procedures that take a variable number of arguments, and can specify default values.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
include ../procedures/varargs.proc

# Write the calls with `call` instead of `@`
# but pass arguments separated with commas
# and use the special "keyword" `varargs`
call varargs greet
call varargs greet: "Paul"
call varargs greet: "Goodbye", "David"

# Define your procedures
procedure greet ()
  # Register the valid signatures
  .nil = 1
  .s   = 1
  .ss  = 1

  # Specify any default values
  .ing$  = "Hello"
  .name$ = "World"
endproc

# Implement _all_ signatures
procedure greet.nil ()
  @greet.ss: greet.ing$, greet.name$
endproc

procedure greet.s: .name$
  @greet.ss: greet.ing$, .name$
endproc

procedure greet.ss: .greet$, .name$
  appendInfoLine: .greet$, ", ", .name$, "!"
endproc

Installation

Install using CPrAN:

cpran install varargs

You can download an archive of the latest version for manual installation, but you’ll have to also manually install the dependencies yourself. You can manually install the plugin just like any other Praat plugin.

Requirements

  • None