! ! ! FIX_OMNET.TPU - Routine to turn CRLFs into line breaks ! and remove leading CRs and trailing CRLFs ! and to rebuild broken words at the end of ! lines. ! PROCEDURE fred$fix_omnet LOCAL the_range, eob, last_char; on_error if (error <> TPU$_STRNOTFOUND) then MESSAGE ("Error (" + STR (error) + ") at line " + STR (error_line)); return; endif; endon_error; ! ! ! Rebuild words broken by OMNET transmission ! MESSAGE ('Rebuilding the broken words...'); POSITION (BEGINNING_OF (CURRENT_BUFFER)); loop exitif (MARK(none) = END_OF (CURRENT_BUFFER)); if LENGTH (CURRENT_LINE) <> 0 then MOVE_HORIZONTAL (LENGTH (CURRENT_LINE)); ! Move to EOL last_char := MARK(REVERSE); ! Save location MOVE_HORIZONTAL (-1); ! Backup to last character if CURRENT_CHARACTER <> " " then fred$next_line; ! Move to beginning of next line exitif (MARK(none) = END_OF (CURRENT_BUFFER)); if (LENGTH (CURRENT_LINE) <> 0) and ! Next line begins (CURRENT_CHARACTER <> " ") then ! with a non-blank POSITION (last_char); ! Go to last char of previous line fred$delete_char; ! Delete the CR/LF endif; MOVE_HORIZONTAL (-CURRENT_OFFSET); ! Move to beginning of current line else fred$next_line; ! Move to beginning of next line endif; else fred$next_line; ! Move to beginning of next line endif; endloop; decus$fix_crlfs; MESSAGE ('OMNET file repair complete...'); ENDPROCEDURE;