Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada
 
Français Contact Us Help Search Canada Site
Home What's New DFO National Site Map Media

Fisheries & Oceans
 
 
Maritimes Region
Fishing Industry
General Public
Marine & Oceans Industry
Media
Students and Teachers
Scientists and Researchers
 
AconIcon ACON       Home/Topics   |   Commands

Control and Information


The control commands include: Echo, Prompt, Save Window, Script File, Status Msg, Search Paths, System Command, Wait, and Quit.

The information commands include: About, GetWind, GetView, PutEnv, GetEnv, Find In Search Paths, Find In Memory, Key Map, Plot Status, Locator, List Functions, List Variables, Getenv, and Version.


Echo

This command sets the command echoing. When using a graphics terminal with the VAX or Unix version, the default is not to echo messages (as they could interfere with the graphics output). If echoing is enabled, messages which are normally printed in the output file "acon.lis" are also echoed to the screen.

If this command is issued without any parameters the current state is reversed.

There is 1 optional parameter:
echo flag - 0 = no echo, 1 = echo.

Echo(echo flag);

Echo(1); /* turn on echoing */

initial program state - echoing is disabled


Prompt

This command prompts the user with a text string. The command may be used to merely present the user with textual information, or it may be used to request information from the user.

There are 1 or 2 parameters:
prompt string - the character string containing the message to prompt the user with.
default string - an optional argument which is the default response if this prompt is requesting a response from the user.
If there is 1 argument, the command does not return a result.
If there are 2 arguments, the command is a function and returns a text string as the result.

prompt("prompt string");
answer = prompt("prompt string","default string");

prompt("This next step will take a few moments...");
filename = prompt("Enter the name of the input data file","Datain");


Save Window

This command saves the contents of a window to a disk file. This command is particularily useful when the results of an ACON script (in the Editor 2 window) are needed to be saved for later user.

This command is specific to the ACON_GUI version of ACON.

There are 2 parameters:
window number - index of window to be saved (0 = graph window, 1 = editor 1 window, 2 = editor 2 window).
file name - name of file to create. Old files of the same name will be replaced.

save_window(window number,"file name");

save_window(2,"My Results");


Script File...

This command requires the name of a Script file to be used. This file should be a previously created text file containing ACON commands. Each line of the text file will be read and interpreted to execute any valid commands found in the file. When all commands from the file are executed, control of the program is transferred back to the user interface.

Script_File commands may be nested, however it is up to the user to ensure that an infinite loop (recursion) is not created through the reuse of Script files.

Script_File("file name");

Script_File("C:/AconScripts/myscriptfile.acn");


Status Message

The command prints it´s text argument in the status bar. This message is transitory and will be replaced with new messages as mouse movements occur.

This command is specific to the ACON_GUI version of ACON.

There is 1 parameter:
text - the character string to print.

Status_Msg(string);

Status_Msg("Hello, this is a test.");


Search Paths

This command establishes a hierarchy of directories where the system will search for additional user- defined functions/scripts.
This command sets an additional search path or gets the list of paths used as search paths.

There is 1 parameter or none:
search path - the path the user wants to set as a function search path.
If called without an argument, this command returns the current list of search paths.

search_paths("path");

search_paths();
C:/ACON/ACON_GUI/DEBUG/systemfns/

search_paths("C:/Program Files/");
C:/ACON/ACON_GUI/DEBUG/systemfns/
C:/Program Files/


System Command

This command executes a system command.

There are 2 parameters:
program name - the name of the program to execute. e.g. PROGRAM.COM
arguments - the arguements to pass to the program. e.g. DIR

System_Command("doscript","text");

cr = numtochar(13);
script = cat("tell application \"FileMaker Pro\"",cr);
script = cat(script,"Show Layout named \"TestMap\"",cr);
script = cat(script,"Get Data every record whose cell \"Latitude\quot; > 0",cr);
script = cat(script,"end tell",cr);
x = System_Command("doscript",script);
num(x);


Wait

This command pauses program execution for a specified time interval. This function has a single parameter, the decimal number of seconds to pause.

There is 1 parameter:
seconds - the number of seconds to pause.

wait(seconds);

wait(1.5);


Quit

This command allows you to stop the execution of the program. In windowing environments, a dialog will be presented after selecting this item which allows you to save the contents of the windows.
Quit


Information


About

This command lists the version number of Acon. There are no parameters.

about();

about();
ACON 10.20 (Win95 version)

GetWind

This function requires a single numeric argument defining the index of the window boundary for which the value is returned.
If a negative index is supplied, the actual limits of the current window (as drawn after projection) are returned. Some projections are not rectangular, so while you may have specified a restricted window with the Data_Window() command, the actual limits of the visible data will exceed what you requested.

There is 1 parameter:
index - the index of the window boundary to return
(1 = left, 2 = right, 3 = bottom, 4 = top [or their negative equivalents]). Optionally, this parameter may be a vector of indices.

getwind(index);

x = getwind(1);
x
-67.0

GetView

This function requires a single numeric argument defining the index of the viewport boundary for which the value is returned. The value returned is in NDC units.

There is 1 parameter:
index= the index of the viewport boundary to return
(1 = left, 2 = right, 3 = bottom, 4 = top). Optionally, this parameter may be a vector of indices.

getview(index);

x = getview(1);

Find In Search Paths

This command looks for a text string in the user-defined functions/scripts in the search paths. This function has one argument which is the text string that the user is looking for in the files.

There is 1 parameter:
text string - the text string to look for in the search paths.

find_in_search_paths("text string");

find_in_search_paths("object");
ObjectPath Function Objectpath(x) {
ObjectPath // returns the path to the ACON objects folder
ObjectPath return( cat(hostpath(),"objects\",x) );

Find In Memory

This command looks for text strings in the current set of user-defined functions that have already been compiled and loaded into memory.

There is 1 parameter:
text string - the text string to look for within all user-defined functions in memory.

find_in_memory("text string");

After running the nlls.acn script, here is what we get as a result of Find_in_Memory("nlls"):

Find_in_Memory("nlls")

VONB_CURVE_FIT // generates Von B curve residuals for a given set of LENGTHs and AGEs, to be called by NLLS
VONB_CURVE_FIT // resid - an output vector of calculated residuals which NLLS uses to determine the optimal parameter values iteratively

Key Map

This command returns a vector of 128 integers (0 or 1) representing the state of the each key on the keyboard. This command returns a vector of zeros when if issued in the console version of ACON.

There are no parameters:

result = Key_Map();

// If the command is executed interactively (using CTRL CR)
// both the CR and CTRL key are detected
x = key_map()
x
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

bindex(x); // return the ASCII equivalent of any keys pressed
13 17
// CR = 13, CTRL = 17

Plot Status

This command prints the current values for data_projection, data_window, data_viewport and the graph scale.

Plot_Status();
Data_Projection("NIL")
Data_Window(-68.,-59.,43.,49.229233);
Data_Viewport(50.),mm(180.),mm(100.),mm(230.));
Scale at y max (49.229233) is 1:5061858.704958.0

Locator

This command allows the user determine the user coordinates of points on the graphic window. The user must point to and click in the graph window within the user data window (the rectangle defined by the axis border). The positions where the user clicks are marked on the screen temporarily. The user coordinate values are returned as an n x 2 matrix (which by default will be listed in the Editor 2 window).

This command is useful for creating blanking files to remove unwanted delaunay triangles.

The locator command will terminate when the user

has clicked outside the data window (the rectangle defined by the axis border), and did not choose to record NDC's
has double clicked on a data point
has specified a certain number of points to digitize and that limit is reached
There are 2 parameters:
npoints = the number of points to locate.
ndc flag = optional flag to indicate that the coordinates should be return in NDC units (0 = default value is user units, 1 = NDC units).

Locator(npoints[,ndc flag]);
xymat = Locator(npoints [,ndc flag]);


List Functions

This command returns the names of the currently defined ACON functions (commands). All built-in ACON commands and all user-defined functions are returned as an n x m character matrix (which by default will be listed in the Editor 2 window). Alternately, if the names of 1 or more user-defined function names are provided, the source code for the function(s) are returned.

In addition an option is available to return the literals used by a function. This may be used to construct system documentation about the actions of a function.

There are 2 optional parameters:
function name - the name of a user-defined function for which the source is returned.
  OR
function name matrix - a matrix of user-defined function names for which the source is returned.
  OR
type - 0 = list all functions, 1 = list built-in functions, 2 = list user-defined functions.
The following are additional parameters:
path - 1 = return path information when listing user-defined functions (used with type 2).
literals - 1 = return literals when listing a user-defined function (used with function name).

List_Functions(); // return the names of all functions

List_Functions(1); // return the names of all built-in commands

List_Functions(2,1); // return user-defined functions with path names

List_Functions("myfunction"); // return the source code of the function

List_Functions("myfunction",1); // return the literals used in the function

cmat = List_Functions();

List Variables

This command lists the names of the currently defined ACON variables. All "built-in" ACON variables and all user-defined variables are returned as an n x m character matrix (which by default will be listed in the Editor 2 window).
Built-in variables are always prefixed with "@". The current set of built-in variables include @PI.

Note that user-defined variables are not "remembered" from session to session. The user must redefine the variables for ACON (this could easily be done by using a Script file).

List_Variables();

cmat = List_Variables();

Getenv

This command returns an environmental variable as a string. It uses the predefined C function getenv() to retrieve an environment variable. If the environmental variable can't be found a string of length 0 is returned.

There is 1 parameter:
variable - name of the environmental variable to get.

getenv("variable");

getenv("path");
C:\WINDOWS;C:\WINDOWS\COMMAND

path = getenv("PATH");
server_name = getenv("SERVER_NAME");
server_port = getenv("SERVER_PORT");

PutEnv

This command creates an environmental variable from a string. It uses the predefined C function putenv() to create the environment variable.

There is 1 parameter:
varstring - environmental variable to create as a text string.

PutEnv(varstring);

paths = PutEnv("MYTEMP=X654");


Version

This command reports the important changes between the version of ACON which you are running, and the version number given as its argument.

There is 1 parameter:
version number - the number of the version used when this script was created.

version(version number);

version(4.34);
... lists the changes ...
/* This is version 5.00 (created April 10, 1991) */
/* Todays date: Sun Apr 21 10:35:07 1991) */
/* 5.00 - Changed syntax of assignment operator: ":=" is now"=". */
/* 5.00 - Changed syntax of equality test: "=" is now "=". */
/* 5.00 - Added Version(), StrLen(), StrPos(), FName(). */


AconIcon ACON       Home/Topics   |   Commands



Last Modified : 2005-11-12