Subroutines > Detailed Descriptions > MIAMEX

MIAMEX 18: Get next line of command file

xcall MIAMEX, MX_NXTCMD, cmd, status {,flag}

This operation returns (and in doing so, by-passes) the next line of the current command (.CMD or .DO) file. It is used in the implementation of GOTO.LIT in order to scan the command file for labels.

This routine was modified, in A-Shell 5.1.1159 of 24 September 2009, to support returning data into dynamic variables, such that they expand as needed. Previously, the output data was being truncated to the current size of the variable, or 0 for uninitialized. The flag parameter was added in A-Shell 5.1.1182 of 13 May 2010.

Parameters

cmdline should be a string variable long enough to return any expected command line.

status is a floating-point return code indicating the success of the operation. A zero value indicates that either no command file is running, or the end of the current command file has been reached. A non-zero value indicates success, in which case cmdline contains the text of the command line.

If flag (numeric) is specified and evaluates to a non-zero value, then the next line of the command file (returned in cmd) will not be removed from the current command file—i.e., a non-destructive read.

History

2010 May, build 1150

Add flag parameter.

2009 Sept, build 1182

Support returning data into dynamic variables, such that they expand as needed. Previously, the output data was being truncated to the current size of the variable, or 0 for uninitialized