{$I OVC.INC}

{$B-} {Complete Boolean Evaluation}
{$I+} {Input/Output-Checking}
{$P+} {Open Parameters}
{$T-} {Typed @ Operator}
{$W-} {Windows Stack Frame}
{$X+} {Extended Syntax}

{$IFNDEF Win32}
{$G+} {286 Instructions}
{$N+} {Numeric Coprocessor}
{$C MOVEABLE,DEMANDLOAD,DISCARDABLE}
{$ENDIF}

{*********************************************************}
{*                  OVCEDITU.PAS 2.00                    *}
{*     Copyright (c) TurboPower Software Co 1995-96      *}
{*                 All rights reserved.                  *}
{*********************************************************}

unit OvcEditU;
  {-editor utility routines}

interface

uses
  OvcBase, OvcData;

const
  MaxMarkers          = 10;    {maximum number of text markers}
  MaxHScrollRange     = 512;   {maximum horizontal scroll range}

  CRLF : array[1..2] of AnsiChar = ^M^J;

type
  TOvcEditBase = class(TOvcBase);

type
  TMarker = record
    Para  : LongInt;  {number of paragraph}
    Pos   : Integer;  {position in paragraph}
  end;
  TMarkerArray = array[0..MaxMarkers-1] of TMarker;

type
  {text position record}
  TOvcTextPos = packed record
    Line : LongInt;
    Col  : Integer;
  end;

function edBreakPoint(S : PAnsiChar; MaxLen : Word): Word;
  {-return the position to word break S}
procedure edDeleteSubString(S : PAnsiChar; SLen, Count, Pos : Integer);
  {-delete Cound characters from S starting at Pos}
function edEffectiveLen(S : PAnsiChar; Len : Word; TabSize : Byte) : Word;
  {-compute effective length of S, accounting for tabs}
function edFindNextLine(S : PAnsiChar; WrapCol : Integer) : PAnsiChar;
  {-find the start of the next line}
function edFindPosInMap(Map : Pointer; Lines, Pos : Integer) : Integer;
  {-return the para position}
function edGetActualCol(S : PAnsiChar; Col : Word; TabSize : Byte) : Word;
  {-compute actual column for effective column Col, accounting for tabs}
function edHaveTabs(S : PAnsiChar; Len : Word) : Boolean;
  {Return True if tab are found in S}
procedure edMoveBlock(var Src, Dest; Count : Word);
  {-move block of data from Src to Dest}
procedure edMoveFast(var Src, Dest; Count : Word);
  {-move block of data from Src to Dest fastly}
function edPadChPrim(S : PAnsiChar; C : AnsiChar; Len : Word) : PAnsiChar;
  {-return S padded with C to length Len}
function edPadPrim(S : PAnsiChar; Len : Word) : PAnsiChar;
  {-return a string right-padded to length len with blanks}
function edScanToEnd(P : PAnsiChar; Len : Word) : Word;
  {-return position of end of para P}
function edStrStInsert(Dest, S : PAnsiChar; DLen, SLen, Pos : Word) : PAnsiChar;
  {-insert S into Dest}
function edWhiteSpace(C : AnsiChar) : Boolean;
  {-return True if C is a white space character}


implementation
