home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
TEDDECL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-02
|
6KB
|
167 lines
/*
teddecl.h 4/2/88 jdc
% public header for textbuffer editting
C-scape 3.2
Copyright (c) 1988 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
9/15/87 jmd added _arg, extern
11/28/88 jmd reorganized headers, added sed_GetCRow, sed_GetCCol.
2/02/89 jdc fixed move_method typedef
3/31/89 jmd Cleaned up some macros
7/15/89 ted Converted '_func' prototypes from typedef to macro.
12/19/89 jmdc added ted insensitive search
1/21/90 jdc added ted_StripWhiteSpace
2/23/90 jmd made ted_UpChar, etc. into macros
3/28/90 jmd ansi-fied
5/02/90 jdc added return values to PageUp, PageDown and GoBottom
*/
#define TED_BACKWARD 0x00
#define TED_FORWARD 0x01
#define TED_AFTER 0x02
#define TED_BEFORE 0x04
#define TED_INSENSITIVE 0x08
#define TED_NOMATCH 0
#define TED_MATCH 1
#define TED_MORE 2
#define TED_NOREFRESH 0
#define TED_REFRESH 1
#define TED_NOTABJUMP 0
#define TED_TABJUMP 1
#define TED_HARD 0
#define TED_SOFT 1
#define TED_LEN 2
#define B_CUT 1
#define B_COPY 2
#define B_ATTR 4
#define B_PAD 8
/* ted_funcs, (FNTED.C) */
OEXTERN field_funcs_struct ted_funcs;
extern void ted_fenter(sed_type sed);
extern void ted_fkey(sed_type sed);
extern void ted_senter(sed_type sed, int fieldno);
extern void ted_sexit(sed_type sed, int fieldno);
/* move methods */
/* TEDFOLL.C */
extern move_func (ted_Follow);
/* TEDPAST.C */
extern move_func (ted_Past);
/* character and cursor movement functions */
/* TEDIT.C */
extern boolean ted_AddChar(sed_type sed, char c);
extern boolean ted_AddString(sed_type sed, char *s, unsigned len);
extern char ted_DeleteString(sed_type sed, int row, int col, unsigned len);
extern void ted_StartWorking(sed_type sed);
extern boolean ted_MoveChar(sed_type sed, int r, int c, int tab_mode);
extern void ted_GetPosition(sed_type sed, int *row, int *col);
extern boolean ted_GoEnd(sed_type sed);
extern boolean ted_PageUp(sed_type sed);
extern boolean ted_PageDown(sed_type sed);
extern boolean ted_GoBottom(sed_type sed);
extern boolean ted_Scroll(sed_type sed);
extern void ted_SetCursor(sed_type sed, int row, int col);
extern void ted_reset(sed_type sed, int i, int mode);
/* TEDGSTR.C */
extern unsigned ted_GetString(sed_type sed, char *buf, unsigned len);
/* TEDWORD.C */
extern boolean ted_FindWord(sed_type sed, int mode);
/* TEDSRCH.C */
extern boolean ted_Search(sed_type sed, char *pattern, int mode);
/* TEDCURS.C */
extern long ted_GetCursor(sed_type sed);
extern boolean ted_GotoCursor(sed_type sed, long cursor);
/* TEDCOPY.C */
extern int ted_GetMark(sed_type sed);
extern void ted_SetMark(sed_type sed, int mode);
extern boolean ted_copy(sed_type sed, menu_type cmenu, byte attr, int mode);
extern boolean ted_insert(sed_type sed, menu_type cmenu);
/* TEDFILE.C */
extern long ted_ReadFile(sed_type sed, FILE *fp);
extern long ted_WriteFile(sed_type sed, FILE *fp, int mode);
/* TEDLINE.C */
extern int ted_line(sed_type sed, int mode);
/* TEDSTRIP.C */
extern boolean ted_StripWhiteSpace(sed_type sed);
/* TEDSETMV.C */
extern void ted_SetMoveMethod(sed_type sed, move_method mm);
/** Macros **/
#define sed_GetCRow(sed) ((sed_getxd(sed))->row)
#define sed_GetCCol(sed) ((sed_getxd(sed))->col)
#define ted_GotoPosition(sed, row, col) (*((sed_getxd(sed))->move))(sed, row, col)
#define ted_AddRow(sed) ted_AddChar(sed, '\n')
#define ted_UpChar(sed) ted_MoveChar(sed, -1, 0, TED_NOTABJUMP)
#define ted_DownChar(sed) ted_MoveChar(sed, 1, 0, TED_NOTABJUMP)
#define ted_LeftChar(sed, t) ted_MoveChar(sed, 0, -1, t)
#define ted_RightChar(sed, t) ted_MoveChar(sed, 0, 1, t)
#define ted_GoHome(sed) ted_GotoPosition(sed, sed_GetCRow(sed), 0)
#define ted_GoTop(sed) ted_GotoPosition(sed, 0, 0)
#define ted_LeftWord(sed) ted_FindWord(sed, TED_BACKWARD)
#define ted_RightWord(sed) ted_FindWord(sed, TED_FORWARD)
#define ted_DeleteChar(sed) ted_DeleteString(sed, sed_GetCRow(sed), sed_GetCCol(sed), 1)
/* buf is expected to be a menu_type */
#define ted_BlockCut(sed, buf) ted_copy(sed, buf, 0x00, B_CUT + B_COPY)
#define ted_BlockCopy(sed, buf) ted_copy(sed, buf, 0x00, B_COPY)
#define ted_BlockCopyPad(sed, buf) ted_copy(sed, buf, 0x00, B_PAD + B_COPY)
#define ted_BlockDelete(sed) ted_copy(sed, NULL, 0x00, B_CUT)
#define ted_BlockAttr(sed, attr) ted_copy(sed, NULL, attr, B_ATTR)
#define ted_BlockPaste(sed, buf) ted_insert(sed, buf)
#define ted_GetWrapWidth(sed) ((sed_GetMenu(sed))->textbuf->width)
#define ted_SetWrapWidth(sed, w) ted_reset(sed, w, 0)
#define ted_GetTabSize(sed) ((sed_GetMenu(sed))->textbuf->tab_size)
#define ted_SetTabSize(sed, t) ted_reset(sed, t, 1)
#define ted_GetRefresh(sed) ((sed_GetMenu(sed))->textbuf->refresh)
#define ted_SetRefresh(sed, mode) ((sed_GetMenu(sed))->textbuf->refresh = (mode))
#define ted_GetInsert(sed) ((sed_GetMenu(sed))->textbuf->insert)
#define ted_SetInsert(sed, mode) ((sed_GetMenu(sed))->textbuf->insert = (mode))
#define ted_GetTabChar(sed) ((sed_GetMenu(sed))->textbuf->tab_char)
#define ted_SetTabChar(sed, chr) ((sed_GetMenu(sed))->textbuf->tab_char = (chr))
#define ted_GetNewLineChar(sed) ((sed_GetMenu(sed))->textbuf->newline_char)
#define ted_SetNewLineChar(sed, chr) ((sed_GetMenu(sed))->textbuf->newline_char = (chr))
#define ted_GetMaxSize(sed) (((sed_GetMenu(sed))->textbuf->limit ) ? (sed_GetMenu(sed))->textbuf->max_size : 0L)
#define ted_SetMaxSize(sed, size) tb_SetMaxSize((sed_GetMenu(sed))->textbuf, size)
#define ted_GetSize(sed) tb_GetSize((sed_GetMenu(sed))->textbuf)
#define ted_GetMoveMethod(sed) ((sed_getxd(sed))->move)
#define ted_GetLineLen(sed) ted_line(sed, TED_LEN)
#define ted_IsHardLine(sed) ted_line(sed, TED_HARD)
#define is_whitespace(c) ((c == ' ' || c == '\t' || c == '\n') ? 1 : 0)