Skip to content

External symbol definition file format

Hiroaki@R-Koubou edited this page Oct 13, 2023 · 2 revisions

Table of Contents

What's this and Purposes?

Export NI's reserved symbol in tab separated column file.(Plain text)

These files puts on to data/reserved.

-> It is for eliminating hard coding to re-build parser program.

Tab separated column format

Line Comment

It starts with '#'

Regex: ^\s*#.*

Variables

Filename

variables.txt

Format

<type> <name> <available on init>

Appendix

  • <available on init> : A variable be allowed to read access at "on init" callback [Y|N]

Example

I	ENV_TYPE_DBD	Y
I	ENV_TYPE_FLEX	Y
I	EVENT_ID	N
I	EVENT_NOTE	N
I	EVENT_PAR_0	Y
I	EVENT_PAR_1	Y
I	EVENT_PAR_2	Y
I	EVENT_PAR_3	Y
I	EVENT_PAR_ALLOW_GROUP	Y

UI Variables("ui_xxxx" attribute)

e.g.

declare ui_knob $Knob(0,1,100)

A ui_knob is ui attribute.

Filename

uitypes.txt

Format

<ui-typename> <constant> <init-require> ( <initialize-type> )*

Appendix

  • <constant> : Deny write access [Y|N]
  • <init-require> : Required initializer [Y|N]

Example

ui_button	N	Y	I	I
ui_knob	N	Y	I	I	I	I
ui_file_selector	Y	N	V
ui_label	N	Y	I[]	I	I
ui_level_meter	Y	N	V
ui_menu	Y	N	V
ui_slider	N	Y	I[]	I	I
ui_switch	Y	N	V
ui_table	N	Y	I[]	I	I	I
ui_text_edit	Y	N	V
ui_value_edit	N	Y	I[]	I	I	I
ui_waveform	N	Y	I[]	I	I	I
ui_xy	N	N	R[]

Callback

Filename

callbacks.txt

Format

<duplecate> : Allow duplicate definitions. [Y|N] (e.g. on ui_control() )

  1. have argument(s) case 1

    <name> <duplecate> <type>( <type>)*

  2. have argument(s) case 2

    <name> <duplecate> &<type>( &<type>)*

    if argument name == ui variable name that declared at "on init", use '&' before type character.

    Example

    ui_control	Y	&I
    

    KSP Code

    on init
        declare ui_knob $Knob (0,100,1) {Variable name is $Knob}
    end on
    
    on ui_control( $Knob ) { Event handling for $Knob }
        {code for $Knob}
    end on
    
  3. don't have argument

    <name> <duplecate> Example

    init	N
    

    KSP Code

    on init
        {code}
    end on
    

Command

Filename

commands.txt

Format

  1. have argument(s)

    <return-type> <name> <available callback name> <type>( <type>)*

  2. don't have argument * WITHOUT parentheses "()"

    <return-type> <name> <available callback name>

    Example : exit command

    V	exit	*
    
  3. don't have argument * WITH parentheses "()"

    <return-type> <name> <available callback name> V

    Example : mf_reset() command

    V	mf_reset	*	V
    

Appendix

  1. <available callback> : A command be allowed to call given call back name.

    If available at any callbacks, use *

    Example

    V	inc	*	I
    

    PREFIX (1st letter)

    • alphabetical: A commnd available given callback name only

      Example (change_note() is only allowed in the note callback.)

      V	change_note	note	@I	@I
      

      if multiple callbacks, use || as delimiter.

      Example (ignore_event() is only available at "on note" or "on release" callback )

      V	ignore_event	note||release
      
    • ! : A commnd available at the all callbacks except the given name.

      Example (note_off() cannot call at "on init callback" )

      note_off	!init	@I
      
  2. Parameter type

    • If allowing any data types (without ui_####), use * (primitive type).

      Example ( num_elements() allows all array types )

      I	num_elements	*	*[]
      
    • If data type is an UI type, use ui type name.

      Example ( add_menu_item() allows ui_menu only )

      V	add_menu_item	init	ui_menu	@S	@I
      
    • If data type is any UI types, use ui_*

      Example ( hide_part() allows any ui type variable )

      V	hide_part	*	ui_*	@I
      
    • If allowing multiple data types, use || (=or) as delimiter.

      Example ( sort() allows Integer array or Real array )

      V	sort	*	I[]||R[]	@I
      

Type

  • I : int
  • I[] : int array
  • R : real
  • R[] : real array
  • S : string
  • S[] : string array
  • B : boolean( true or false. Using at conditional statement. (e.g. if, while ) )
  • B[] : boolean array
  • ui_#### : UI variable type. (e.g. ui_knob )
  • V : void ( None return value / None arguments. It means like language "C". )
  • PP : Preprocessor Symbol

If allow constant / literal ( PREFIX: "@" ) at a Variable initializer / argument / condition expression

  • @I : int
  • @R : real
  • @S : string
  • @I[] : int array
  • @R[] : real array
  • @S[] : string array