The Questor API

The folder Questor_API contains a number of examples of the Application Programming Interface (API) for the spreadsheet application Questor from Xanthus.

The folder contains the following:

Demos - a folder with five different applications that exemplifies the use of the Questor API.
Files - a folder with files that you need to compile applications that uses the Questor API.
README.rtf - this file.
Sources - a folder with the source code for the five different applications in the Demos folder.

These are the API demo applications:

Questor_API_Demo1

This example application demonstrates the use of the function send_alien_message in Questor.

With send_alien_message you can send Objective-C messages to any NEXTSTEP application with a public API.

The syntax:
	send_alien_message(host, app, selector, types, arg1, arg2, arg3...)

Where :
·	host is the host that the receiving application is running on. To indicate the local machine, use nil.
·	app is a string naming the application (or Mach port).
·	selector is the Objective-C method selector to execute.
·	types is a string defining the types of the arguments of selector.
·	arg1 to argn are Questor values.

Example: 
·	Start Questor.
·	Start Questor_API_Demo1.
·	Open a console for the current worksheet in Questor.
·	Type in the following and press return:

	send_alien_message(nil, "Questor_API_Demo1", "addA:andB:to:", "iiI", 23, 11, "a")

	This will send the message addA:andB:to: to the running Questor_API_Demo1 which will display the values 23 and 11, calculating the result and sending it back to Questor.
·	If you then type a in the console in Questor followed by a carriage return, a will be evaluated and the result of 23 + 11 is displayed.

Questor_API_Demo2

This example application demonstrates how you can send ranges of data from Questor to other NEXTSTEP applications.

The function send_range in Questor allows you to send arbitrary ranges to other NeXT applications.

The syntax is
	send_range(host, application, range)

Where:
·	host is the name of the computer running the remote NEXTSTEP application. To indicate the local machine, use nil.
·	application is the name of the remote application (or a name of a mach port of the app)
·	range is a Questor range like A1:B6

Example:
·	Start Questor.
·	Start Questor_API_Demo2.
·	Fill the range A1:B4 with some values.
·	Open a console for the current worksheet in Questor.
·	Type in the following and press return:

	send_range(nil, "Questor_API_Demo2", A1:B4)

	This causes the values in the range to be sent to this app which displays them in the wordprocessor to the right.

Questor_API_Demo3

This example application demonstrates how to create a new worksheet in Questor from another NEXTSTEP application.

With Questor you get a compiled object called QuestorInterface. This object is responsible for
communicating with Questor and a Questor worksheet. To be able to use it, you just have to link it into your own application.

If you hit the "Send to Questor" button, a message is sent to launch Questor, and then Questor is told to create a new worksheet, and finally the data in the matrix is sent to be displayed in the new worksheet.

This example only creates a new worksheet and fills it with data. The QuestorInterface object is freed immediately afterwards. There is another demo which keeps the QuestorInterface object around for a while, communicating with the worksheet it has been connected to.

Questor_API_Demo4

This example application demonstrates how to use a QuestorInterface object around communicating with a worksheet.

If you hit the "Create Sheet" button a QuestorInterface object is created and it will send a message to Questor to create a new worksheet. The interface object will keep a pointer to the worksheet and you can use the other buttons to send messages to the worksheet. 

When you manipulate the connected worksheet in Questor, messages are sent to the interface object. When these messages arrive you will be notified in the console.

Questor_API_Demo5

This example application demonstrates the API which enables you to call functions in Questor and get the result back.

Type in the function you want to call and the arguments to it. Click the "Call Function.." button. A worksheet will be created and the result of the function call is displayed at the bottom of this window.

Note that this demo only supports calling functions with numeric arguments, but if you write your own code you can call other types of functions.

Note that you can also call user defined functions in the worksheet connected to the QuestorInterface object.