Difference between revisions of "MC-Basic:VESEXECUTE"

From SoftMC-Wiki
Jump to: navigation, search
m (1 revision)
(moved multi-line example from language basics)
Line 12: Line 12:
 
Invocation of Basic interpreter via virtual (internal) entry station.
 
Invocation of Basic interpreter via virtual (internal) entry station.
  
Pass to a string the virtual entry station (CLI) and get a response.  When VESEXECUTE is executed, it sends the command and waits for the response. While waiting for the response, it reads all the incoming messages from the VES message pipe. It discards all the non-relevant messages that it reads. This means that if an ASYNC message is printed to the VES message pipe while the VESEXECUTE command is waiting for the response, the user will never get this message since the VESEXECUTE deletes it. VESExecute returns the first 512 characters of the response string
+
Pass to a string the virtual entry station (CLI) and get a response.
 +
When VESEXECUTE is executed, it sends the command and waits for the response.  
 +
While waiting for the response, it reads all the incoming messages from the VES message pipe.  
  
Return value:      Response or Error message. Valid reply has prefix “D:”, while error response has prefix “E:”
+
It discards all the non-relevant messages that it reads.
 +
This means that if an ASYNC message is printed to the VES message pipe while the VESEXECUTE command is waiting for the response, the user will never get this message since the VESEXECUTE deletes it.
 +
 
 +
VESExecute returns the first 512 characters of the response string
 +
 
 +
;Return value
 +
: Response or Error message. Valid reply has prefix “D:”, while error response has prefix “E:”
 +
 
 +
=== Multi-line commands via entry station ===
 +
Short programs can be transferred via entry station as strings.
 +
Multi-line program strings can be assembled by concatenation of single-line command strings.
 +
Each single-line string should be terminated by CRLF (carriage return - line feed) characters.
  
 
|TYPE=
 
|TYPE=
Line 34: Line 47:
 
Only from task context
 
Only from task context
  
Errors:                 N/A
+
|EXAMPLE=
 +
<pre>
 +
?VESExecute(“dir *.prg”)
 +
str1=VESExecute(“Load “+var2”)
 +
</pre>
  
|EXAMPLE=
+
;Example for a multi-line command         
?VESExecute(“dir *.prg”)<br>
+
<pre>
 +
Dim Str as string
  
str1=VESExecute(“Load “+var2”)
+
Program
 +
  Str = Str + "Program" + chr$(0xd) + chr$(0xa)
 +
  Str = Str + "Dim Var As Long = 10" + chr$(0xd) + chr$(0xa)
 +
  Str = Str + "Print Var" + chr$(0xd) + chr$(0xa)
 +
  Str = Str + "End Program" + chr$(0xd) + chr$(0xa)
 +
  Print VesExecute(Str)
 +
End Program
 +
</pre>
  
 
|SEE ALSO=
 
|SEE ALSO=

Revision as of 14:03, 23 May 2011

Invocation of Basic interpreter via virtual (internal) entry station.

Pass to a string the virtual entry station (CLI) and get a response. When VESEXECUTE is executed, it sends the command and waits for the response. While waiting for the response, it reads all the incoming messages from the VES message pipe.

It discards all the non-relevant messages that it reads. This means that if an ASYNC message is printed to the VES message pipe while the VESEXECUTE command is waiting for the response, the user will never get this message since the VESEXECUTE deletes it.

VESExecute returns the first 512 characters of the response string

Return value
Response or Error message. Valid reply has prefix “D:”, while error response has prefix “E:”

Multi-line commands via entry station

Short programs can be transferred via entry station as strings. Multi-line program strings can be assembled by concatenation of single-line command strings. Each single-line string should be terminated by CRLF (carriage return - line feed) characters.

Syntax

<string var name> = VESExecute(<string expression>)

Availability

Versions 3.7.x and higher

Scope

Task

Limitations

Only from task context

Examples

?VESExecute(“dir *.prg”)
str1=VESExecute(“Load “+var2”)
Example for a multi-line command
Dim Str as string

Program
  Str = Str + "Program" + chr$(0xd) + chr$(0xa)
  Str = Str + "Dim Var As Long = 10" + chr$(0xd) + chr$(0xa)
  Str = Str + "Print Var" + chr$(0xd) + chr$(0xa)
  Str = Str + "End Program" + chr$(0xd) + chr$(0xa)
  Print VesExecute(Str)
End Program

See Also