X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fshared%2Fconbuf.pas;h=44ec2a8f780afacd378be030352c2f1a925b4eaf;hb=3fa3726fe9bf1c40052f2002e6b8b7f0337e1a68;hp=1be01b2f80df2eb36fffd90ec3d380828a97ea5d;hpb=5b3da92681d54bd987d55c4a2649da65ebeb70ba;p=d2df-sdl.git diff --git a/src/shared/conbuf.pas b/src/shared/conbuf.pas index 1be01b2..44ec2a8 100644 --- a/src/shared/conbuf.pas +++ b/src/shared/conbuf.pas @@ -1,9 +1,8 @@ -(* Copyright (C) DooM 2D:Forever Developers +(* Copyright (C) Doom 2D: Forever Developers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,7 +12,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . *) -{$MODE OBJFPC} +{$INCLUDE a_modes.inc} +{.$MODE OBJFPC} unit conbuf; interface @@ -26,10 +26,10 @@ function cbufLastChange (): LongWord; function cbufWalkStart (): LongWord; function cbufWalkEnd (pos: LongWord): LongWord; -procedure cbufPrev (var pos: LongWord); -procedure cbufNext (var pos: LongWord); +procedure cbufPrev (var pos: LongWord); inline; +procedure cbufNext (var pos: LongWord); inline; -function cbufAt (const pos: LongWord): Char; +function cbufAt (const pos: LongWord): Char; inline; // get last line procedure cbufLastLine (var sp: LongWord; var ep: LongWord); @@ -40,7 +40,8 @@ procedure cbufClear (); var conbufDumpToStdOut: Boolean = false; - + conbufConPrefix: Boolean = true; + conbufStdOutRawMode: Boolean = false; implementation @@ -77,7 +78,13 @@ begin begin for np := 0 to count-1 do begin - if needCon then begin write(stdout, 'CON: '); needCon := false; end; + if needCon then + begin + if conbufConPrefix then write(stdout, 'CON: '); + needCon := false; + end; + if conbufStdOutRawMode and (buf[np] = #10) then + write(stdout, #13); // force carriage return in raw mode write(stdout, buf[np]); needCon := (buf[np] = #10); end; @@ -117,10 +124,10 @@ end; // warning! don't modify conbuf while the range is active! function cbufWalkStart (): LongWord; begin result := cbuftail; end; function cbufWalkEnd (pos: LongWord): LongWord; begin result := cbufhead; end; -procedure cbufPrev (var pos: LongWord); begin pos := (pos+ConBufSize-1) mod ConBufSize; end; -procedure cbufNext (var pos: LongWord); begin pos := (pos+1) mod ConBufSize; end; +procedure cbufPrev (var pos: LongWord); inline; begin pos := (pos+ConBufSize-1) mod ConBufSize; end; +procedure cbufNext (var pos: LongWord); inline; begin pos := (pos+1) mod ConBufSize; end; -function cbufAt (const pos: LongWord): Char; begin result := cbuf[pos mod ConBufSize]; end; +function cbufAt (const pos: LongWord): Char; inline; begin result := cbuf[pos mod ConBufSize]; end; // ////////////////////////////////////////////////////////////////////////// //