Xcon function

Description how Calling external programs with XCon() in RedCrab Calculator


External call with XCon()


RedCrab includes an integrated application interface (API). The API can send data to external programs for calculation.

The externally programmed functions are called by the function XCon() from the RedCrab worksheet.

The XCon() function sends data to an external program and waits until the program with a result responds.

Individual values, a single-column lists or tables can be transferred in both directions.

Syntax

XCon (value [[, Pipe [, Command]])

Description

XCon() expects 1 to 3 parameters.

The first argument represents the data to be transferred. If no further argument is specified, the communication is handled via pipe 0.

XCon (a)

The number of a pipe can be specified as the second argument

XCon (a, 2) uses pipe 2

If in the external program different functions are integrated, the name of the execute function can be determined with the command string.

XCon (a, 0, "Prime")

Summary

XCon() can communicate through a pipe number with various external programs. The external programs can run on the same computer or on another computer in the network. You can run certain functions in the external programmes, specifying by an optional command string.


Parallel calculation

In general, functions are calculated one by one in the order on which they are invoked. RedCrab can perform calculations parallel in external programs. For parallel execution enable Async task for this call on the toolbar.


Handling

First the calculator starts all selected XCon() functions. When all external functions are executed with returned results, the rest of the internal tasks are calculated

For effective progress, it is advisable to run the parallel calculation on different computers. However, modern computers whose processor has 4 or more cores can bring a considerable speed increase if the parallel calculation on the same computer, because the scheduling of tasks between the different cores will be improved.

Keep in mind that:

  • All parallel processes need to communicate with different pipes

  • The calculated argument can not contain a value from another parallel process