DEADSOFTWARE

moved compiler options to shared/a_modes.inc; turned on advanced records
[d2df-sdl.git] / src / shared / conbuf.pas
index 581a8818b5f1672a6a5047e9ea1d0e2d87bf2c02..42f85a52b5ef161f9aa51edabbbd19da3f6d0055 100644 (file)
@@ -13,7 +13,8 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *)
-{$MODE OBJFPC}
+{$INCLUDE a_modes.inc}
+{.$MODE OBJFPC}
 unit conbuf;
 
 interface
@@ -38,6 +39,9 @@ function cbufLineUp (var sp: LongWord; var ep: LongWord): Boolean;
 
 procedure cbufClear ();
 
+var
+  conbufDumpToStdOut: Boolean = false;
+
 
 implementation
 
@@ -60,6 +64,9 @@ function cbufLastChange (): LongWord; begin result := changeCount; end;
 
 
 // ////////////////////////////////////////////////////////////////////////// //
+var
+  needCon: Boolean = true;
+
 procedure cbufPutChars (buf: PChar; count: Integer);
 var
   np: LongWord;
@@ -67,6 +74,15 @@ var
 begin
   if count > 0 then
   begin
+    if conbufDumpToStdOut then
+    begin
+      for np := 0 to count-1 do
+      begin
+        if needCon then begin write(stdout, 'CON: '); needCon := false; end;
+        write(stdout, buf[np]);
+        needCon := (buf[np] = #10);
+      end;
+    end;
     Inc(changeCount);
     if changeCount = 0 then changeCount := 1;
     while count > 0 do