Arbortext Command Language > Callbacks > doc_add_callback > linkto Callback Type
  
linkto Callback Type
Function prototype:
function funcname (doc, target, type, data, op)
linkto is called by the link command before the link action is taken. It is only called when either the -idref or -uri argument is specified for the link command. This is the only callback for the link command if one of these two arguments is specified.
Arguments
doc is the identifier of the current document.
target is the target of the link, either an IDREF or a URI.
type is the type of the target. When type is 0, the target is an IDREF. When type is 1, the target is a URI.
data is the string specified by the -data argument the link command.
op is the function callback operation. Callbacks are called twice in succession with op specifying the stage of callback operation.
1. op == 1 first call — The returned argument specifies whether the execution should continue or be stopped:
0 — Continue callback processing.
-1 — Stop further callback processing.
2. op == 2 second call — Occurs unless the processing was stopped during the first call. The returned argument allows or prevents basic Arbortext Editor processing after all callbacks have been called:
0 — Basic Arbortext Editor processing allowed.
-1 — Basic Arbortext Editor processing prevented.
The callback function must return -1 if it performs the link action; otherwise it should return 0 to let Arbortext Editor complete its normal processing.