Skip to content

Commit 7f66022

Browse files
committed
doc submit mode in cmdInput1
1 parent 733456f commit 7f66022

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

src/mmdata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ flag pntrEq(const pntrString *sout, const pntrString *sin);
858858
* \attention
859859
* - the pointers in \p g are copied to the result. If some of them
860860
* reference allocated memory, check for possible double free, for example.
861-
* - a pointer to constant data is padded to the right. The refernced memory
861+
* - a pointer to constant data is padded to the right. The referenced memory
862862
* must not be overwritten.
863863
* \post
864864
* - the elements of \p g are duplicated.

src/mminou.h

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ extern long g_commandFileNestingLevel;
6565
* valid, and point to opened files.
6666
*/
6767
extern FILE *g_commandFilePtr[MAX_COMMAND_FILE_NESTING + 1];
68+
/*!
69+
* \var vstring g_commandFileName[]
70+
* list of command file names in nested SUBMIT commands. This name need not be
71+
* fully qualified (with all directories down from the root directory). The
72+
* first element is reserved for stdin and never set.
73+
*/
6874
extern vstring g_commandFileName[MAX_COMMAND_FILE_NESTING + 1];
6975
extern flag g_commandFileSilent[MAX_COMMAND_FILE_NESTING + 1];
7076
/*!
@@ -210,9 +216,9 @@ vstring cmdInput(FILE *stream, const char *ask);
210216
* After some explanatory text is printed, gets a line from either stdin or the
211217
* command file stream in \ref g_commandFilePt, depending on the value of
212218
* \ref g_commandFileNestingLevel. If this value is 0, interactive input via
213-
* stdin is assumed, else non interpreted lines are read from a file. The line returned
214-
* to the caller is more or less what \ref cmdInput() yields, but some fine
215-
* tuning is applied.
219+
* stdin is assumed, else non interpreted lines are read from a file in submit
220+
* mode. The line returned to the caller is more or less what \ref cmdInput()
221+
* yields, but some fine tuning is applied.
216222
*
217223
* \par Displaying the prompt text
218224
*
@@ -239,6 +245,19 @@ vstring cmdInput(FILE *stream, const char *ask);
239245
* immediate stop on the caller's side.
240246
*
241247
* 4. If logging is enabled, prompt and returned input is logged.
248+
*
249+
* \par Submit Mode
250+
*
251+
* 1. a non-interpreted line is read from the appropriate entry in
252+
* \ref g_commandFilePtr by \ref cmdInput.
253+
*
254+
* 2. If NULL is returned, reaching EOF is assumed, the file is closed, its
255+
* name in \ref g_commandFileName deallocated and the previous
256+
* \ref g_commandFileLevel is activated. In this particular case the read line
257+
* is the empty string. A message indicating the end of the command file is
258+
* printed. The \ref g_commandFileSilentFlag controlling console output is
259+
* copied from the appropriate entry of \ref g_commandFileSilent, unless the
260+
* interactive mode is reached; here output is never suppressed (value 0).
242261
*
243262
* \return first not interpreted line as \ref vstring, or "EXIT" on error.
244263
* \pre
@@ -261,7 +280,15 @@ vstring cmdInput(FILE *stream, const char *ask);
261280
* - \ref g_logFileOpenFlag if set to 1, a not interpreted returned line is
262281
* logged before it is passed on to the caller.
263282
* \post
264-
* \ref localScrollMode is set to 1
283+
* - \ref localScrollMode is set to 1
284+
* - \ref printedLines is reset to 0
285+
* - \ref g_quitPrint is reset to 0
286+
* - interactive mode: \ref tempAllocStack frees top elements down to
287+
* \ref g_startTempAlloc.
288+
* - interactive mode: \ref pntrTempAllocStack frees top elements down to
289+
* \ref g_pntrStartTempAlloc.
290+
* - interactive mode: The \ref backBuffer is cleared, then filled with
291+
* prompt (last line only) and input of the user.
265292
* \warning the calling program must deallocate the returned string.
266293
*/
267294
vstring cmdInput1(const char *ask);

0 commit comments

Comments
 (0)