Advanced Octave A58 — Documentation and descriptors from the Bridge

by Giux GX-TXT, octave-en, scripts-en 2 min read

Advanced GNU Octave with GX-TXT · Module 10

To use an API reliably, you need to know which operations and contracts belong to the installed version. The Documentation Browser allows you to search and read public entries from the same copy of the framework.

Objectives and prerequisites

Let’s repeat the calls to the Bridge used in previous lessons. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0. Import catalogo.m, register it and run it in the Runner.

Discover and read

DOCUMENTATION_BROWSER_API_v1/api_info describes the service; list searches for items associated with NUMERIC_API_v1. The test finds a voice with ID api:NUMERIC_API_v1. The script shows the metadata and uses read on the returned ID to read the text; print only length and first row, avoiding pouring all the manual into the output.

In addition, API_CATALOG_SERVICE_API_v1/status reports the status of the catalogue installed. A document item describes the contract; it does not imply that each host operation is invoked by a script. For a specific operation also check the Script Bridge cover, arguments and capabilities required in the version in use.

Choose the right source

See the copy documentation with which you run the program: a manual of another release can list different operations or behaviors. It records the name and version of the API along with the parameters of analysis. The result of the search can change if installation or modules change; a script must also manage the absence of entries.

Exercise

  1. What identification of the numerical voice was found in the test?
  2. Why use the ID returned by list in the read?
  3. The fact that a function is documented for the host ensures that it is available via Bridge?

Worked solution

  1. api:NUMERIC_API_v1.
  2. To read the item actually identified by the catalog installed.
  3. No: you need to check the Bridge’s cover and contract.

Download the Module 10 scripts (ZIP)

#GNU Octave #GX-TXT #GX-TXT public APIs

Other steps of this project

Leave a Reply

Your email address will not be published. Required fields are marked *