Menu

Tree [c85315] default tip /
 History

Read Only access


File Date Author Commit
 lib 2013-06-02 Alex McLain Alex McLain [980076] Generates program name, include definitions, an...
 templates 2013-05-26 Alex McLain Alex McLain [76cc11] Added ERB template example.
 test 2013-05-31 Alex McLain Alex McLain [b2888e] Implemented basic event_definition, event_handl...
 .hgignore 2013-05-24 Alex McLain Alex McLain [81e620] Initial import.
 Chains Structure Notes.txt 2013-05-27 Alex McLain Alex McLain [ca599b] Modified indent_count for tabs or spaces.
 NetLinx Structure Notes.txt 2013-05-26 Alex McLain Alex McLain [f660a3] Added Conditional.
 README.md 2014-05-01 Alex McLain Alex McLain [c85315] Added syntax example as readme.
 Rakefile 2013-05-27 Alex McLain Alex McLain [b528db] Reconfiguring parser based on scratch notes.
 chains.rb 2013-06-02 Alex McLain Alex McLain [df1808] Started Chains::NetLinxTransformation.
 license.txt 2013-06-20 Alex McLain Alex McLain [8707e5] Added license.
 netlinx_dom_test.rb 2013-05-26 Alex McLain Alex McLain [a5801c] Moved chains.rb to netlinx_dom_test.
 scratch 2013-05-28 Alex McLain Alex McLain [935be1] Refactoring indentation.
 syntax.axs.chains 2013-05-31 Alex McLain Alex McLain [b2888e] Implemented basic event_definition, event_handl...

Read Me

Chains

(!**********************************************************
    Example of how the Chains syntax should look.

    File extension = .axs.chains
***********************************************************!)

PROGRAM_NAME = 'NetLinx Preparser'
(^*********************************************************^)
(^                        DEVICES                          ^)
(^*********************************************************^)

// Single device.
dvTP        = 33000:1:0   'touchpanel-file[.tp4]'


// Device combine.
vdvTP       = 34000:1:0   'file-for-all-panels[.tp4]'
    dvTP1   = 10001:1:0
    dvTP2   = 10002:1:0


// Optional device file paths can instruct a tool on how
// to transfer the file without needing a workspace definition.

(^*********************************************************^)
(^                       CONSTANTS                         ^)
(^*********************************************************^)

MY_CONSTANT_INTEGER     = 1
MY_CONSTANT_STRING      = 'a string'

MY_CONSTANT_COMPOSITION = "#[var type]{MY_CONSTANT_STRING} plus another string"

(^*********************************************************^)
(^                        INCLUDES                         ^)
(^*********************************************************^)

#include 'amx-lib-log'

(^*********************************************************^)
(^                       STRUCTURES                        ^)
(^*********************************************************^)

volume:
    ui  lvl
    ch  mute
    ui  max
    ui  min
    ui  step
    ch  dim
    ui  dimAmount

(^*********************************************************^)
(^                       VARIABLES                         ^)
(^*********************************************************^)

ui myVar = 123

/*
// Variable types:
ui  unsigned int
si  signed int
ul  unsigned long
sl  signed long
ch  character
wc  wide character
st  string (char[255])
st[#]   string (char[#])
dv  device
dc  devchan
[named] user-defined type
*/

// Split after equals.
ui myVar2 =
    456

(^*********************************************************^)
(^                       FUNCTIONS                         ^)
(^*********************************************************^)

volumeUp (ui chan) ->
    doStuff chan

// Split parameters on open parenthesis.
sinteger setVolume(
    ui channel
    ui level
) ->
    doStuff channel, level


(^*********************************************************^)
(^                         EVENTS                          ^)
(^*********************************************************^)

startup =>

mainline =>

data => vdvTP
    string ->
        doStuff

    online ->

// How to handle multiple channels / dev-chans.
// List kind of like an array?

button => vdvTP, CHANNEL_NUMBER
    push ->
        doStuff

    release ->
        doStuff


button =>
    vdvTP, CHANNEL_NUMBER_1
    vdvTP, CHANNEL_NUMBER_2
    DEV-CHAN

    push ->
        doStuff

    release ->
        doStuff

(^*********************************************************^)

// Header: (! *)

// Comments: //, /* */, (* *)

// Comments omitted from NetLinx: //^, /^ */, (^ *)

// Ranges:
    [1..5]      // [1, 2, 3, 4, 5]
    [1...5]     // [1, 2, 3, 4]

// Loops:
    for i in items
        doStuff i

    for i in [1..5]
        doStuff i

// Ternary:
    a = i > 3 ? x : y

// Switch, Case
    switch i
    case 1
        doStuff
    case 2
        doStuff

    case 3: doStuff
    case 4: doStuff

// Case, When

    case i
    when 1
        doStuff
    when 2: doStuff
    when x


(^*********************************************************^)
(^                     END OF PROGRAM                      ^)
(^          DO NOT PUT ANY CODE BELOW THIS COMMENT         ^)
(^*********************************************************^)