Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

Commit

Permalink
Merge in upstream changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnathan committed Jul 30, 2015
2 parents 2ee78da + f750b27 commit 679b09b
Show file tree
Hide file tree
Showing 10 changed files with 645 additions and 318 deletions.
38 changes: 19 additions & 19 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Copyright (C) 2011 Queensland Department of Justice and Attorney General.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Copyright (C) 2011 Queensland Department of Justice and Attorney General.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
68 changes: 35 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
This project contains globally useful, portable includes for augmenting the base functionality of the proprietary AMX NetLinx language used for programming [AMX NetLinx integrated controllers](http://www.amx.com/products/categoryCentralControllers.asp).

Currently the project provides a math library, string manipulation library, time and date library, array utils, a managed debug messaging library and an associated console output library.

# Contributors
[Kim Burgess](http://kimburgess.info)

[true](mailto:[email protected])

[Jeff Spire](http://spireintegrated.com/)

[Jorde Vorstenbosch](mailto:[email protected])

[Andy Dixon](https://github.com/PsyenceFact)

# Contributing

Want to help out? Awesome.

1. Fork it.
2. Make your changes / improvements / bug fixes etc (and ensure that you adhere to the [project style guide](https://github.com/KimBurgess/NetLinx-Common-Libraries/wiki/Code-Format-and-Commenting) whilst doing so).
3. Submit a pull request.
4. Win.

# Usage

A convenience include has been provided to simplify usage. Ensure that the libraries are placed within your project's compile path then include prior to utilizing provided functionality within your project code.

include 'netlinx-common-libraries'

Alternatively, individually specify the library components that you require. Any cross include dependencies within the NetLinx Common Libraries are handled internally.

This project is licensed under the MIT License. Feel free to use it, sell it, modify it, re-distribute - basically whatever the hell you like. See [LICENSE](https://github.com/KimBurgess/NetLinx-Common-Libraries/blob/master/LICENSE) for more info.
This project contains globally useful, portable includes for augmenting the base functionality of the proprietary AMX NetLinx language used for programming [AMX NetLinx integrated controllers](http://www.amx.com/products/categoryCentralControllers.asp).

Currently the project provides a math library, string manipulation library, time and date library, array utils, a managed debug messaging library and an associated console output library.

# Contributors
[Kim Burgess](http://kimburgess.info)

[true](mailto:[email protected])

[Jeff Spire](http://spireintegrated.com/)

[Jorde Vorstenbosch](mailto:[email protected])

[Andy Dixon](https://github.com/PsyenceFact)

[Motaz Abuthiab](mailto:[email protected])

# Contributing

Want to help out? Awesome.

1. Fork it.
2. Make your changes / improvements / bug fixes etc (and ensure that you adhere to the [project style guide](https://github.com/KimBurgess/NetLinx-Common-Libraries/wiki/Code-Format-and-Commenting) whilst doing so).
3. Submit a pull request.
4. Win.

# Usage

A convenience include has been provided to simplify usage. Ensure that the libraries are placed within your project's compile path then include prior to utilizing provided functionality within your project code.

include 'netlinx-common-libraries'

Alternatively, individually specify the library components that you require. Any cross include dependencies within the NetLinx Common Libraries are handled internally.

This project is licensed under the MIT License. Feel free to use it, sell it, modify it, re-distribute - basically whatever the hell you like. See [LICENSE](https://github.com/KimBurgess/NetLinx-Common-Libraries/blob/master/LICENSE) for more info.
89 changes: 87 additions & 2 deletions array.axi
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,105 @@ program_name='array'


include 'math'
include 'io'


define_function array_function_deprecated(char old[64], char new[64]) {

println("'Warning, the array function ',old,'() is deprecated',
', please use ', new, '()'");

}

/**
* Finds the index for an matching entry in an array.
*
* Finds the index for any matching device entry in an array.
* @deprecated
* @param item item to find in the array
* @param list array of items
*
* @return the index of the matching value, or 0 if no match
*/
define_function integer array_index(dev item, dev list[])
{
array_function_deprecated('array_index', 'array_device_index');
return array_device_index(item, list);
}

/**
* Finds the index for any matching device entry in an array.
*
* @param item item to find in the array
* @param list array of items
*
* @return the index of the matching value, or 0 if no match
*/
define_function integer array_device_index(dev item, dev list[])
{
stack_var integer i

for (i = 1; i <= max_length_array(list); i++) {
if (item == list[i]) {
return i
}
}

return 0
}

/**
* Finds the index for any matching integer entry in an array.
*
* @param item item to find in the array
* @param list array of items
*
* @return the index of the matching value, or 0 if no match
*/
define_function integer array_integer_index(integer item, integer list[])
{
stack_var integer i

for (i = 1; i <= max_length_array(list); i++) {
if (item == list[i]) {
return i
}
}

return 0
}

/**
* Finds the index for any matching double entry in an array.
*
* @param item item to find in the array
* @param list array of items
*
* @return the index of the matching value, or 0 if no match
*/
define_function integer array_double_index(double item, double list[])
{
stack_var integer i

for (i = 1; i <= max_length_array(list); i++) {
if (item == list[i]) {
return i
}
}

return 0
}

/**
* Finds the index for any matching string entry in an array.
*
* @param item item to find in the array
* @param list array of items
*
* @return the index of the matching value, or 0 if no match
*/
define_function integer array_string_index(char item[], char list[][])
{
stack_var integer i

for (i = 1; i <= max_length_array(list); i++) {
if (item == list[i]) {
return i
Expand Down
27 changes: 27 additions & 0 deletions debug.axi
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ define_function char[5] debug_get_level_string(char x)
return DEBUG_LEVEL_STRINGS[x + 1]
}

/**
* Gets a numerical debug level based on it's equivalent string representation.
*
* @param x a character array containing the string to parse
* @return a character containing the numerical debug level represented
* by the content of x
*/
define_function char debug_get_level_from_string(char x[]) {
stack_var char lvl;

if (length_string(x) == 1) {
lvl = atoi(x);
if (lvl > 4) {
lvl = DEBUG_OFF;
}
}

for (lvl = length_array(DEBUG_LEVEL_STRINGS); lvl; lvl--) {
if (lower_string(x) == lower_string(DEBUG_LEVEL_STRINGS[lvl])) {
lvl = lvl - 1;
break;
}
}

return lvl;
}

/**
* Sets the current system debugging level for controlling debug message
* verbosity.
Expand Down
Loading

0 comments on commit 679b09b

Please sign in to comment.