waitln command inputstr can contain several lines after a waitn command that times out
Eröffnet am: 2014-10-19 06:08
Letztes Update: 2014-10-19 06:08
Auswertung: | gmmellem | Verantwortlicher: | (Keine) |
---|---|---|---|
Priorität: | 5 - Mittel | Meilenstein: | (Keine) |
Typ: | Fehler | Schweregrad: | 5 - Mittel |
Komponente: | Tera Term Macro | Status: | Offen |
Lösung | Keine |
Einzelheiten
If you do a waitln command after a waitn command that times out inputstr may contain several lines of text. Following code example below shows the problem. Run the code with a loop back plug on COM (pin 2 connected to pin 3) and terminal transmit to CR + LF to visualize the problem better 1. time the loop runs, inputstr contain "secondline>" 2. time the loop runs, inputstr contain "firstline CRLF secondline>" The problem does not occur when waitn command does not time out.
I have looked at the code, and I think I have found the problem. If a waitn command find the number of bytes (result = 1) the ClearWaitN() function is run (line 164 in ttmmain.cpp). on the other hand if the function times out, ClearWaitN() if not run. This again cause the Receive line buffer not to be cleared inside PutRecvLnBuff(BYTE b) function when it should later in the waitln command (line 403 ttmdde.c is always false). I have inserted a ClearWaitN(); in line 441 ttmmain.cpp when waitn exit because of timeout. Compiled and tested that problem is gone. (however i do not know the code well enough to not guarantee that this modification don't have any unknown side effects)
Code example:
timeout = 1 for tmpcnt 1 2 flushrecv sendln 'firstline' sendln 'secondline>' waitln '>' sprintf 'waitln %d.time inputstr [%s], result [%d]' tmpcnt inputstr result messagebox inputstr 'Test' waitn 1 next}}}
Letzte Aktualisierung für dieses Ticket
2014-10-19 06:08 Aktualisiert von: gmmellem
- New Ticket "waitln command inputstr can contain several lines after a waitn command that times out" created