/* Ofront+ 1.0 -swC -48 */

#ifndef EditorText__oh
#define EditorText__oh

#include "SYSTEM.oh"

typedef
  struct EditorText_LineDesc *EditorText_Line;

typedef
  LONGCHAR EditorText_String[256];

typedef
  struct EditorText_LineDesc {
    EditorText_String s;
    INTEGER len, lineEndLen, comLevel;
    EditorText_Line prev, next;
  } EditorText_LineDesc;

import void EditorText_Line_InsertChar (EditorText_Line L, LONGCHAR ch, INTEGER pos);
#define __EditorText_Line_InsertChar(L, ch, pos) __SEND(__TYPEOF(L), EditorText_Line_InsertChar, 2, void(*)(EditorText_Line, LONGCHAR, INTEGER), (L, ch, pos))

typedef
  struct EditorText_TextDesc *EditorText_Text;

typedef
  struct EditorText_TextDesc {
    INTEGER x, y, scrY;
    EditorText_Line first, last, cur, scrFirst;
    BOOLEAN selected;
    INTEGER selL, selR, selT, selB;
    BOOLEAN changed, newLineCreated, winLineEndings;
  } EditorText_TextDesc;

import void EditorText_Text_AddIndent (EditorText_Text t);
import void EditorText_Text_Clear (EditorText_Text t);
import void EditorText_Text_CopySelection (EditorText_Text t, LONGCHAR *buf, INTEGER buf__len);
import INTEGER EditorText_Text_CurCharKind (EditorText_Text t);
import void EditorText_Text_DeleteSelection (EditorText_Text t);
import EditorText_Line EditorText_Text_GetFirstSelLine (EditorText_Text t);
import void EditorText_Text_HandleBackspace (EditorText_Text t);
import void EditorText_Text_HandleDelete (EditorText_Text t);
import void EditorText_Text_HandleEnter (EditorText_Text t, BOOLEAN autoIndent);
import void EditorText_Text_Insert (EditorText_Text t, LONGCHAR *s, INTEGER s__len, BOOLEAN autoIndent);
import void EditorText_Text_InsertChar (EditorText_Text t, LONGCHAR ch);
import BOOLEAN EditorText_Text_IsEdge (EditorText_Text t);
import BOOLEAN EditorText_Text_LoadFromFile (EditorText_Text t, LONGCHAR *fname, INTEGER fname__len);
import void EditorText_Text_MaybeRemoveIndent (EditorText_Text t);
import void EditorText_Text_MoveToLineCol (EditorText_Text t, INTEGER line, INTEGER col, INTEGER winH);
import void EditorText_Text_MoveToPos (EditorText_Text t, INTEGER pos, INTEGER winH);
import void EditorText_Text_RemoveIndent (EditorText_Text t);
import BOOLEAN EditorText_Text_SaveToFile (EditorText_Text t, LONGCHAR *fname, INTEGER fname__len);
import void EditorText_Text_Select (EditorText_Text t, INTEGER selL, INTEGER selR, INTEGER selT, INTEGER selB, INTEGER winH);
import void EditorText_Text_SelectAll (EditorText_Text t);
import BOOLEAN EditorText_Text_WholeLineSelected (EditorText_Text t);
#define __EditorText_Text_AddIndent(t) __SEND(__TYPEOF(t), EditorText_Text_AddIndent, 0, void(*)(EditorText_Text), (t))
#define __EditorText_Text_Clear(t) __SEND(__TYPEOF(t), EditorText_Text_Clear, 1, void(*)(EditorText_Text), (t))
#define __EditorText_Text_CopySelection(t, buf, buf__len) __SEND(__TYPEOF(t), EditorText_Text_CopySelection, 3, void(*)(EditorText_Text, LONGCHAR*, INTEGER ), (t, buf, buf__len))
#define __EditorText_Text_CurCharKind(t) __SEND(__TYPEOF(t), EditorText_Text_CurCharKind, 4, INTEGER(*)(EditorText_Text), (t))
#define __EditorText_Text_DeleteSelection(t) __SEND(__TYPEOF(t), EditorText_Text_DeleteSelection, 5, void(*)(EditorText_Text), (t))
#define __EditorText_Text_GetFirstSelLine(t) __SEND(__TYPEOF(t), EditorText_Text_GetFirstSelLine, 6, EditorText_Line(*)(EditorText_Text), (t))
#define __EditorText_Text_HandleBackspace(t) __SEND(__TYPEOF(t), EditorText_Text_HandleBackspace, 7, void(*)(EditorText_Text), (t))
#define __EditorText_Text_HandleDelete(t) __SEND(__TYPEOF(t), EditorText_Text_HandleDelete, 8, void(*)(EditorText_Text), (t))
#define __EditorText_Text_HandleEnter(t, autoIndent) __SEND(__TYPEOF(t), EditorText_Text_HandleEnter, 9, void(*)(EditorText_Text, BOOLEAN), (t, autoIndent))
#define __EditorText_Text_Insert(t, s, s__len, autoIndent) __SEND(__TYPEOF(t), EditorText_Text_Insert, 10, void(*)(EditorText_Text, LONGCHAR*, INTEGER , BOOLEAN), (t, s, s__len, autoIndent))
#define __EditorText_Text_InsertChar(t, ch) __SEND(__TYPEOF(t), EditorText_Text_InsertChar, 11, void(*)(EditorText_Text, LONGCHAR), (t, ch))
#define __EditorText_Text_IsEdge(t) __SEND(__TYPEOF(t), EditorText_Text_IsEdge, 12, BOOLEAN(*)(EditorText_Text), (t))
#define __EditorText_Text_LoadFromFile(t, fname, fname__len) __SEND(__TYPEOF(t), EditorText_Text_LoadFromFile, 13, BOOLEAN(*)(EditorText_Text, LONGCHAR*, INTEGER ), (t, fname, fname__len))
#define __EditorText_Text_MaybeRemoveIndent(t) __SEND(__TYPEOF(t), EditorText_Text_MaybeRemoveIndent, 14, void(*)(EditorText_Text), (t))
#define __EditorText_Text_MoveToLineCol(t, line, col, winH) __SEND(__TYPEOF(t), EditorText_Text_MoveToLineCol, 15, void(*)(EditorText_Text, INTEGER, INTEGER, INTEGER), (t, line, col, winH))
#define __EditorText_Text_MoveToPos(t, pos, winH) __SEND(__TYPEOF(t), EditorText_Text_MoveToPos, 16, void(*)(EditorText_Text, INTEGER, INTEGER), (t, pos, winH))
#define __EditorText_Text_RemoveIndent(t) __SEND(__TYPEOF(t), EditorText_Text_RemoveIndent, 17, void(*)(EditorText_Text), (t))
#define __EditorText_Text_SaveToFile(t, fname, fname__len) __SEND(__TYPEOF(t), EditorText_Text_SaveToFile, 19, BOOLEAN(*)(EditorText_Text, LONGCHAR*, INTEGER ), (t, fname, fname__len))
#define __EditorText_Text_Select(t, selL, selR, selT, selB, winH) __SEND(__TYPEOF(t), EditorText_Text_Select, 20, void(*)(EditorText_Text, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER), (t, selL, selR, selT, selB, winH))
#define __EditorText_Text_SelectAll(t) __SEND(__TYPEOF(t), EditorText_Text_SelectAll, 21, void(*)(EditorText_Text), (t))
#define __EditorText_Text_WholeLineSelected(t) __SEND(__TYPEOF(t), EditorText_Text_WholeLineSelected, 22, BOOLEAN(*)(EditorText_Text), (t))



import SYSTEM_ADRINT *EditorText_LineDesc__typ;
import SYSTEM_ADRINT *EditorText_TextDesc__typ;

import void EditorText_FindNext (EditorText_Text t, LONGCHAR *find, INTEGER find__len, INTEGER x, INTEGER y, INTEGER winH, BOOLEAN *ok);
import void EditorText_InitLine (EditorText_Line L);
import void EditorText_InitText (EditorText_Text t);
import EditorText_Line EditorText_NewLine (void);
import EditorText_Text EditorText_NewText (void);
import void *EditorText__init (void);


#endif
