Modify line ending behavior to be less efficient for the sake of C initiates.

This commit is contained in:
Quinn Evans 2015-09-30 10:37:17 -06:00
parent 534733386c
commit 26a28b9c61
3 changed files with 16 additions and 5 deletions

View File

@ -8,8 +8,8 @@
03 IP PIC 9(3) VALUE 1.
03 CYCLES PIC 9(5) VALUE 0.
03 OUT-PTR PIC 9(3) VALUE 1.
03 LOOP-DEPTH PIC 9 VALUE 0.
03 LOOP-WORK PIC 9 VALUE 0.
03 LOOP-DEPTH PIC 99 VALUE 0.
03 LOOP-WORK PIC 99 VALUE 0.
03 LOOP-STATE PIC 99 VALUE 0.
88 DONE VALUE 99.
01 BF-MEMORY.
@ -144,11 +144,14 @@
IF ESCAPE-CHAR THEN
MOVE I-O-CHARACTER TO COBOL-STRING
ELSE IF IN-PTR < 507 THEN
SUBTRACT 1 FROM IN-PTR
UNSTRING BF-INPUT,
DELIMITED BY "$",
INTO COBOL-STRING,
WITH POINTER IN-PTR
ELSE GO TO HELL.
ELSE GO TO HELL
ELSE GO TO HELL.
CALL "ENCODE-ASCII" USING CONVERSION.
MOVE CHAR-CODE TO BF-CELL(CURRENT-CELL).
D DISPLAY "IN", I-O-CHARACTER, BF-CELL(CURRENT-CELL).

View File

@ -461,7 +461,7 @@
PERFORM SEND-LINE
ELSE
MOVE PARAM(2) TO REG(1)
* PRESERVE VARIABLES FOR REPL
* PRESERVE VARIABLES FOR REPLY.
MOVE NICK TO REG(2)
MOVE COMMAND TO REG(3)
MOVE TARGET TO REG(4)
@ -479,7 +479,7 @@
PERFORM BEGIN-REPLY.
D DISPLAY "STRINGING BF OUTPUT".
STRING "OUTPUT. " DELIMITED BY SIZE,
BF-OUTPUT DELIMITED BY "$LF$"
BF-OUTPUT DELIMITED BY "$NUL$"
INTO MSG-BODY
WITH POINTER MSG-LENGTH.
D DISPLAY "SENDING LINE".

View File

@ -50,6 +50,14 @@ void channel_set_status(int value)
void channel_from_cobol(void)
{
int message_length = channel_message_length();
if (message_length == msg_body_len + 1) {
int i;
for(i = 0; i < msg_body_len; i++) {
if(msg_body[i] != ' ') {
message_length = i + 1;
}
}
}
memset(msg_body + message_length, 0, msg_body_len - message_length + 1);
for(char *c = msg_body; *c; c++) {
if(*c == ';') *c = ':';