Previous: Reordering task IDs, Up: Other statements [Contents][Index]
There are some features that are outside the scope of the coNCePTuaL language. coNCePTuaL does, however, provide a mechanism for inserting backend-specific statements into the control flow of a coNCePTuaL program. This feature is intended for users with specific needs that can’t be satisfied through the conventional coNCePTuaL statements.
<backend_stmt> | ::= | <source_task> |
BACKEND EXECUTES |
||
<expr> | <string> | ||
[ AND
<expr> | <string>]* |
The following example assumes a C-based backend:
ALL TASKS taskID BACKEND EXECUTE "my_c_function(" AND taskID AND ");"
The my_c_function()
function needs be defined in
some object file and linked with the coNCePTuaL-generated code.
Most users will never need to BACKEND EXECUTE
code.
In fact, most users should not use
<backend_stmt>s as they produce nonportable code.
One of coNCePTuaL’s goals is for programs to be understandable by
people unfamiliar with the language, and
<backend_stmt>s thwart that goal. However,
<backend_stmt>s do
help ensure that all of the target language/library’s features are
available to coNCePTuaL.
All <expr>s are passed to the backend in floating-point context (see Evaluation contexts). Consequently, all backend code that takes a coNCePTuaL <expr> needs to expect a floating-point value (which the backend code can of course cast explicitly to an integer if necessary).
There is an important special case defined for the argument to
the BACKEND EXECUTES
statement: once all of the <string> and <expr>
arguments are concatenated into a single string, all occurrences of
the substring ‘[MESSAGE BUFFER expr]’ are
replaced by a pointer to the exprth message buffer
created using the FROM BUFFER
or INTO
BUFFER
keywords (presented in Buffer control). This
special case makes it easy for a coNCePTuaL program to invoke
communication functions provided by the underlying communications
library. Note that the notion of a default buffer is not meaningful
in the context of BACKEND EXECUTES
,
which is not a communication statement.
See
Backend-specific declarations, for a description of
BACKEND DECLARES
, a companion statement to
BACKEND EXECUTES
that enables coNCePTuaL programs to
directly declare variables and functions in the target
language.
Previous: Reordering task IDs, Up: Other statements [Contents][Index]