Neuron c version 2.3 enhancements – Echelon IzoT NodeBuilder User Manual

Page 19

Advertising
background image

// TO DO: add code to return the current length of the network variable
// with index "nvIndex."
// Example code follows:
//
// switch (nvIndex) {
// case nviChangeableNv::global_index:
// if (nviChangeableNv::cpNvType.type_category != NVT_CAT_INITIAL
// && nviChangeableNv::cpNvType.type_category != NVT_CAT_NUL) {
// uResult = nviChangeableNv::cpNvType.type_length;
// }
// break;
// } // switch

return uResult;
}

See Implementing Changeable-Type Network Variables in chapter 4 of this guide and Changeable-
Type Network Variables
in the Neuron C Programmer’s Guide for more detail.

Neuron C Version 2.3 Enhancements

The new features in the Neuron C Version 2.3 programming language include support for transient and
resident functions, automatic memory maps, a new preprocessor, support for initialization of automatic
variables implementing scalar types, and new or enhanced compiler directives and other language
enhancements. These new features are detailed in the Neuron C Programmer’s Guide and Neuron C
Reference Guide
.

Support for transient functions and automatic memory maps is detailed earlier in this section.

The new preprocessor, based on the open source MCPP implementation by Kioshi Matsui, provides
previously unsupported directives such as #if and #elif.

Automatic variables implementing scalar types can now be initialized. For example:

unsigned long add(unsigned num, unsigned *values) {
unsigned long result = 0;
while (num--) {
result += *values++;
}
return result;
}

Automatic variables which implement aggregate types such as structures, unions and arrays cannot be
initialized in this manner. To initialize such a variable, declare the variable and provide its initial data
in two distinct expressions.

Enhanced compiler directives include the pragma addresses and pragma aliases directives (also
known as pragma num_addr_table_entries and pragma num_alias_table_entries, respectively).
These directives are enhanced with a more user-friendly new name, and automatic allocation of the
corresponding resource based on the compiler’s inspection of your application. The directives can be
used to override this allocation.

The pragma num_domains directive is also supported with a user-friendly alias, pragma domains.

New directives are supplied to control new features (pragma dhcp, pragma enhanced_mode,
pragma resident) and to control placement of certain portions of your application within the available
space (pragma locate).

In addition, the new __type_index and __type_scope built-in properties are supported for network
variables, and yield a numeric constant for the type index and type scope number, respectively. These
properties begin with a double underscore character to avoid conflicts with existing application code.
For example, a SNVT_switch typed network variable reports 95 for the type index, and a scope of
zero.

IzoT NodeBuilder User's Guide

5

Advertising