mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-28 17:20:22 +00:00
Added NetLinx language.
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -645,3 +645,6 @@
|
||||
[submodule "vendor/grammars/perl.tmbundle"]
|
||||
path = vendor/grammars/perl.tmbundle
|
||||
url = https://github.com/textmate/perl.tmbundle
|
||||
[submodule "vendor/grammars/sublime-netlinx"]
|
||||
path = vendor/grammars/sublime-netlinx
|
||||
url = https://github.com/amclain/sublime-netlinx
|
||||
|
||||
@@ -475,6 +475,9 @@ vendor/grammars/sublime-idris:
|
||||
- source.idris
|
||||
vendor/grammars/sublime-mask:
|
||||
- source.mask
|
||||
vendor/grammars/sublime-netlinx:
|
||||
- source.netlinx
|
||||
- source.netlinx.erb
|
||||
vendor/grammars/sublime-nginx:
|
||||
- source.nginx
|
||||
vendor/grammars/sublime-nix:
|
||||
|
||||
@@ -1955,6 +1955,24 @@ Nemerle:
|
||||
- .n
|
||||
ace_mode: text
|
||||
|
||||
NetLinx:
|
||||
type: programming
|
||||
color: "#0000ff"
|
||||
extensions:
|
||||
- .axs
|
||||
- .axi
|
||||
tm_scope: source.netlinx
|
||||
ace_mode: text
|
||||
|
||||
NetLinx+ERB:
|
||||
type: programming
|
||||
color: "#407fff"
|
||||
extensions:
|
||||
- .axs.erb
|
||||
- .axi.erb
|
||||
tm_scope: source.netlinx.erb
|
||||
ace_mode: text
|
||||
|
||||
NetLogo:
|
||||
type: programming
|
||||
color: "#ff2b2b"
|
||||
|
||||
132
samples/NetLinx/projector.axi
Normal file
132
samples/NetLinx/projector.axi
Normal file
@@ -0,0 +1,132 @@
|
||||
(***********************************************************
|
||||
Mock Projector
|
||||
|
||||
For testing syntax highlighting
|
||||
************************************************************)
|
||||
|
||||
#if_not_defined MOCK_PROJECTOR
|
||||
#define MOCK_PROJECTOR 1
|
||||
(***********************************************************)
|
||||
(* System Type : NetLinx *)
|
||||
(***********************************************************)
|
||||
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_DEVICE
|
||||
|
||||
dvPROJECTOR = 5001:1:0;
|
||||
|
||||
(***********************************************************)
|
||||
(* CONSTANT DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_CONSTANT
|
||||
|
||||
// Power States
|
||||
POWER_STATE_ON = 0;
|
||||
POWER_STATE_OFF = 1;
|
||||
POWER_STATE_WARMING = 2;
|
||||
POWER_STATE_COOLING = 3;
|
||||
|
||||
// Inputs
|
||||
INPUT_HDMI = 0;
|
||||
INPUT_VGA = 1;
|
||||
INPUT_COMPOSITE = 2;
|
||||
INPUT_SVIDEO = 3;
|
||||
|
||||
(***********************************************************)
|
||||
(* INCLUDES GO BELOW *)
|
||||
(***********************************************************)
|
||||
|
||||
#include 'amx-lib-log'
|
||||
|
||||
(***********************************************************)
|
||||
(* DATA TYPE DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_TYPE
|
||||
|
||||
struct projector_t
|
||||
{
|
||||
integer power_state;
|
||||
integer input;
|
||||
integer lamp_hours;
|
||||
}
|
||||
|
||||
(***********************************************************)
|
||||
(* VARIABLE DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_VARIABLE
|
||||
|
||||
volatile projector_t proj_1;
|
||||
|
||||
(***********************************************************)
|
||||
(* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
|
||||
define_function initialize(projector_t self)
|
||||
{
|
||||
self.power_state = POWER_STATE_OFF;
|
||||
self.input = INPUT_HDMI;
|
||||
self.lamp_hours = 0;
|
||||
}
|
||||
|
||||
define_function switch_input(projector_t self, integer input)
|
||||
{
|
||||
self.input = input;
|
||||
print(LOG_LEVEL_INFO, "'Projector set to input: ', itoa(input)");
|
||||
}
|
||||
|
||||
(***********************************************************)
|
||||
(* STARTUP CODE GOES BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_START
|
||||
|
||||
initialize(proj_1);
|
||||
|
||||
(***********************************************************)
|
||||
(* THE EVENTS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_EVENT
|
||||
|
||||
data_event[dvPROJECTOR]
|
||||
{
|
||||
string:
|
||||
{
|
||||
parse_message(data.text);
|
||||
}
|
||||
|
||||
command: {}
|
||||
online: {}
|
||||
offline: {}
|
||||
}
|
||||
|
||||
button_event[dvTP, BTN_HDMI]
|
||||
button_event[dvTP, BTN_VGA]
|
||||
button_event[dvTP, BTN_COMPOSITE]
|
||||
button_event[dvTP, BTN_SVIDEO]
|
||||
{
|
||||
push:
|
||||
{
|
||||
switch (button.input.channel)
|
||||
{
|
||||
case BTN_HDMI: switch_input(proj_1, INPUT_HDMI);
|
||||
case BTN_VGA: switch_input(proj_1, INPUT_VGA);
|
||||
case BTN_COMPOSITE: switch_input(proj_1, INPUT_COMPOSITE);
|
||||
case BTN_SVIDEO: switch_input(proj_1, INPUT_SVIDEO);
|
||||
}
|
||||
}
|
||||
|
||||
release: {}
|
||||
}
|
||||
|
||||
(***********************************************************)
|
||||
(* THE MAINLINE GOES BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_PROGRAM
|
||||
|
||||
[dvTP, BTN_POWER_ON] = (proj_1.power_state == POWER_STATE_ON);
|
||||
[dvTP, BTN_POWER_OFF] = (proj_1.power_state == POWER_STATE_OFF);
|
||||
|
||||
(***********************************************************)
|
||||
(* END OF PROGRAM *)
|
||||
(* DO NOT PUT ANY CODE BELOW THIS COMMENT *)
|
||||
(***********************************************************)
|
||||
#end_if
|
||||
158
samples/NetLinx/volume-array.axs
Normal file
158
samples/NetLinx/volume-array.axs
Normal file
@@ -0,0 +1,158 @@
|
||||
(***********************************************************
|
||||
AMX VOLUME CONTROL
|
||||
VOLUME ARRAY EXAMPLE
|
||||
|
||||
Website: https://sourceforge.net/projects/amx-lib-volume/
|
||||
|
||||
|
||||
This application demonstrates the use of volume control
|
||||
arrays using the amx-lib-volume library.
|
||||
|
||||
Volume control operation can be viewed by watching the
|
||||
master's internal diagnostic output.
|
||||
|
||||
I/O PORT CONNECTIONS:
|
||||
Ch 1: Volume Up Button
|
||||
Ch 2: Volume Down Button
|
||||
************************************************************
|
||||
Copyright 2011, 2012, 2014 Alex McLain
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
************************************************************)
|
||||
|
||||
PROGRAM_NAME='volume array'
|
||||
(***********************************************************)
|
||||
(***********************************************************)
|
||||
(* System Type : NetLinx *)
|
||||
(***********************************************************)
|
||||
(* REV HISTORY: *)
|
||||
(***********************************************************)
|
||||
(*
|
||||
$History: See version control repository.
|
||||
*)
|
||||
(***********************************************************)
|
||||
(* INCLUDES GO BELOW *)
|
||||
(***********************************************************)
|
||||
|
||||
// Include the volume control library.
|
||||
#include 'amx-lib-volume'
|
||||
|
||||
(***********************************************************)
|
||||
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_DEVICE
|
||||
|
||||
dvDebug = 0:0:0; // For debug output.
|
||||
|
||||
dvIO = 36000:1:0; // Volume up/down button connections.
|
||||
|
||||
(***********************************************************)
|
||||
(* CONSTANT DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_CONSTANT
|
||||
|
||||
// Volume control indexes.
|
||||
MIC1 = 1; // Microphone 1.
|
||||
MIC2 = 2; // Microphone 2.
|
||||
MIC3 = 3; // Microphone 3.
|
||||
MIC4 = 4; // Microphone 4.
|
||||
WLS1 = 5; // Wireless mic 1.
|
||||
WLS2 = 6; // Wireless mic 2.
|
||||
IPOD = 7; // iPod input.
|
||||
CD = 8; // CD player input.
|
||||
|
||||
(***********************************************************)
|
||||
(* DATA TYPE DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_TYPE
|
||||
|
||||
(***********************************************************)
|
||||
(* VARIABLE DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_VARIABLE
|
||||
|
||||
// Define a volume control array for the input devices.
|
||||
volume inputs[8];
|
||||
|
||||
(***********************************************************)
|
||||
(* LATCHING DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_LATCHING
|
||||
|
||||
(***********************************************************)
|
||||
(* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_MUTUALLY_EXCLUSIVE
|
||||
|
||||
(***********************************************************)
|
||||
(* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *)
|
||||
(***********************************************************)
|
||||
(* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *)
|
||||
(* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *)
|
||||
|
||||
(***********************************************************)
|
||||
(* STARTUP CODE GOES BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_START
|
||||
|
||||
// Initialize the array of volume controls.
|
||||
volArrayInit(inputs, 0, VOL_UNMUTED, 10000, 20000, 5);
|
||||
|
||||
(***********************************************************)
|
||||
(* THE EVENTS GO BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_EVENT
|
||||
|
||||
// Volume Up
|
||||
button_event[dvIO, 1]
|
||||
{
|
||||
PUSH:
|
||||
{
|
||||
volArrayIncrement(inputs); // Increment the volume up a step.
|
||||
send_string dvDebug, "'Volume Up MIC1: ', itoa(volGetLevel(inputs[MIC1]))";
|
||||
send_string dvDebug, "'Volume Up MIC2: ', itoa(volGetLevel(inputs[MIC2]))";
|
||||
send_string dvDebug, "'Volume Up MIC3: ', itoa(volGetLevel(inputs[MIC3]))";
|
||||
send_string dvDebug, "'Volume Up MIC4: ', itoa(volGetLevel(inputs[MIC4]))";
|
||||
send_string dvDebug, "'Volume Up WLS1: ', itoa(volGetLevel(inputs[WLS1]))";
|
||||
send_string dvDebug, "'Volume Up WLS2: ', itoa(volGetLevel(inputs[WLS2]))";
|
||||
send_string dvDebug, "'Volume Up IPOD: ', itoa(volGetLevel(inputs[IPOD]))";
|
||||
send_string dvDebug, "'Volume Up CD: ', itoa(volGetLevel(inputs[CD]))";
|
||||
}
|
||||
}
|
||||
|
||||
// Volume Down
|
||||
button_event[dvIO, 2]
|
||||
{
|
||||
PUSH:
|
||||
{
|
||||
volArrayDecrement(inputs); // Decrement the volume down a step.
|
||||
send_string dvDebug, "'Volume Dn MIC1: ', itoa(volGetLevel(inputs[MIC1]))";
|
||||
send_string dvDebug, "'Volume Dn MIC2: ', itoa(volGetLevel(inputs[MIC2]))";
|
||||
send_string dvDebug, "'Volume Dn MIC3: ', itoa(volGetLevel(inputs[MIC3]))";
|
||||
send_string dvDebug, "'Volume Dn MIC4: ', itoa(volGetLevel(inputs[MIC4]))";
|
||||
send_string dvDebug, "'Volume Dn WLS1: ', itoa(volGetLevel(inputs[WLS1]))";
|
||||
send_string dvDebug, "'Volume Dn WLS2: ', itoa(volGetLevel(inputs[WLS2]))";
|
||||
send_string dvDebug, "'Volume Dn IPOD: ', itoa(volGetLevel(inputs[IPOD]))";
|
||||
send_string dvDebug, "'Volume Dn CD: ', itoa(volGetLevel(inputs[CD]))";
|
||||
}
|
||||
}
|
||||
|
||||
(***********************************************************)
|
||||
(* THE ACTUAL PROGRAM GOES BELOW *)
|
||||
(***********************************************************)
|
||||
DEFINE_PROGRAM
|
||||
|
||||
(***********************************************************)
|
||||
(* END OF PROGRAM *)
|
||||
(* DO NOT PUT ANY CODE BELOW THIS COMMENT *)
|
||||
(***********************************************************)
|
||||
1
vendor/grammars/sublime-netlinx
vendored
Submodule
1
vendor/grammars/sublime-netlinx
vendored
Submodule
Submodule vendor/grammars/sublime-netlinx added at 704581c487
Reference in New Issue
Block a user