Switch; System_Call; System_Number; Time - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

Keywords & Run-Time Library Functions (Cont.)
SWITCH...CASE

SYSTEM_CALL

SYSTEM_NUMBER

TIME

TIME_TO_HOUR

TIME_TO_MINUTE

NetLinx Programming Language Reference Guide
This keyword statement provides a programming construct for selective execu-
tion of code blocks based on the evaluation of a single condition.
SWITCH (var)
{
CASE 1:
{
IF(Var2=1)
{
BREAK // IF Var2=1 STOP EXECUTION
}
(statements go here if Var2 < > 1)
}
CASE 3:
{
(statements go here)
}
CASE 5:
{
(statements go here)
}
DEFAULT:
{
(statements go here)
}
}
This keyword is similar to CALL except that the subroutine invoked using the
SYSTEM_CALL keyword resides in a special file called a library file. When this
keyword is used, the compiler generates a call to the subroutine in the library
file and automatically includes the library file for compilation.
This keyword defines an unsigned 16-bit integer system constant that contains
the system number.
This keyword holds the current time as a string in the form "hh:mm:ss". The
time is represented in 24-hour format.
IF (TIME = '23:59:59')
{
}
This function returns an integer representing the hour portion of a time string.
SINTEGER TIME_TO_HOUR (CHAR TimeStr[ ])
Parameters:
• TimeStr: Input string containing the time in hh:mm:ss format.
If successful, this function returns an integer (0-23) representing the hour por-
tion of the time string. The specified time is invalid, this function returns -1.
CHAR TimeStr[ ] = '9:30:08'
SINTEGER nHour
nHour = TIME_TO_HOUR (TimeStr)
This function returns an integer representing the minute portion of a time string.
SINTEGER TIME_TO_MINUTE (CHAR TimeStr[ ])
Parameters:
• TimeStr: Input string containing the time in hh:mm:ss format.
If successful, this function returns an integer (0-59) representing the minute
portion of the time string. If the specified time is invalid, this function returns -1.
CHAR TimeStr[ ] = '9:30:08'
SINTEGER nMinute
nMinute = TIME_TO_MINUTE (TimeStr) // nMinute = 30
Reserved Identifiers
// nHour = 9
153

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents