struct.h
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 614 行 · 第 1/2 页
H
614 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Definition if internal editor structures.
*
****************************************************************************/
#ifndef _STRUCT_INCLUDED
#define _STRUCT_INCLUDED
typedef unsigned short vi_ushort;
typedef unsigned short vi_key;
typedef struct ss {
struct ss *next,*prev;
} ss;
typedef struct {
char height;
char width;
} cursor_type;
typedef struct {
char case_ignore:1;
char use_regexp:1;
char search_forward:1;
char search_wrap:1;
char prompt:1;
char selection:1;
char spare:2;
char *find;
int findlen;
char *replace;
int replacelen;
char *ext;
int extlen;
char *path;
int pathlen;
} fancy_find;
typedef struct {
int max;
int curr;
char **data;
} history_data;
typedef struct {
char inuse:1;
char is_base:1;
char was_inuse:1;
char no_input_window:1;
char fill5:1,fill6:1,fill7:1,fill8:1;
vi_key *data;
} key_map;
/* command structure */
typedef struct {
char len;
char cmd[255];
} cmd_struct;
/*
* alias type
*/
typedef struct alias_list {
struct alias_list *next,*prev;
char *alias;
char *expand;
} alias_list;
/*
* line type
*/
typedef long linenum;
/*
* file stack
*/
typedef struct file_stack {
linenum lineno;
int col;
char fname[1];
} file_stack;
/*
* directory entry
*/
typedef struct {
unsigned sec:5;
unsigned min:6;
unsigned hour:5;
} time_struct;
typedef struct {
unsigned day:5;
unsigned month:4;
unsigned year:7;
} date_struct;
typedef struct {
char attr;
long fsize;
#ifndef __UNIX__
time_struct time;
date_struct date;
#else
unsigned long time;
unsigned short st_mode;
#endif
char name[1];
} direct_ent;
/*
* window dimension
*/
typedef struct {
short x1,y1,x2,y2;
} windim;
/*
* window id
*/
#ifdef __WIN__
#include "winhdr.h"
#ifdef HAS_HWND
typedef HWND window_id;
#else
#ifdef __WINDOWS_386__
typedef unsigned short window_id;
#else
typedef const void _NEAR * window_id;
#endif
#endif
#else
typedef int window_id;
#endif
/*
* info for a single text file line
*/
typedef struct linedata {
vi_ushort mark:5; // first mark on the line
vi_ushort globmatch:1; // global command matched this line
vi_ushort nolinedata:1; // no data associated with this line (WorkLine
// has the data instead)
vi_ushort hidden:1; // line is hidden (NYI)
vi_ushort hilite:1; // line need hiliting
vi_ushort fill10:1,fill11:1,fill12:1,fill13:1,fill14:1,fill15:1,fill16:1;
} linedata;
typedef struct line {
struct line *next,*prev; // links for other lines
short len; // length of line
union {
linedata ld;
short word;
} inf;
char data[1]; // actual string for line
} line;
#define LINE_SIZE sizeof( line )
/*
* info for a file control block in a file
*/
struct file;
typedef struct fcb {
struct fcb *next,*prev; // links fcbs in a file
struct fcb *thread_next,*thread_prev;// links all fcbs created
struct file *f; // file associated with fcb
line *line_head,*line_tail; // linked list of lines
linenum start_line,end_line; // starting/ending line number
short byte_cnt; // number of bytes in lines
long offset; // offset in swap file
long last_swap; // time fcb was last swapped
vi_ushort swapped:1; // fcb is swapped
vi_ushort in_memory:1; // fcb is in memory
vi_ushort on_display:1; // lines in fcb are displayed
vi_ushort non_swappable:1; // fcb is not swappable
vi_ushort dead:1; // fcb is dead (obsolete)
vi_ushort was_on_display:1; // fcb was on display (used to save
// display state when switching files)
vi_ushort in_extended_memory:1; // fcb is in extended memory
vi_ushort in_xms_memory:1; // fcb is in XMS memory
vi_ushort in_ems_memory:1; // fcb is in EMS memory
vi_ushort nullfcb:1; // fcb is a special one that has no
// lines associated with it
vi_ushort globalmatch:1; // a global command matched at least
// one line in this fcb
vi_ushort flag12:1;
vi_ushort flag13:1,flag14:1,flag15:1,flag16:1;
long xmemaddr; // address of fcb in extended memory
} fcb;
#define FCB_SIZE sizeof( fcb )
/*
* info for an entire file
*/
typedef struct file {
char *name; // file name
char *home; // home directory of file
fcb *fcb_head,*fcb_tail; // linked list of fcbs
long curr_pos; // current offset in file on disk
vi_ushort modified:1; // file has been modified
vi_ushort bytes_pending:1; // there are still bytes to be read
// off the disk for the file
vi_ushort viewonly:1; // file is view only
vi_ushort read_only:1; // file is read only
vi_ushort check_readonly:1; // file needs its read-only status
// checked against the file on disk
vi_ushort dup_count:4; // number of duplicate views on the
// file that have been opened
vi_ushort been_autosaved:1; // file has been autosaved
vi_ushort need_autosave:1; // file needs to be autosaved
vi_ushort is_stdio:1; // file is a "stdio" file (reads from
// stdin and writes to stdout)
vi_ushort needs_display:1; // file needs to be displayed
vi_ushort check_for_crlf:1; // check file system when we write it out
vi_ushort fill15:1,fill16:1;
long size; // size of file in bytes
int handle; // file handle (if entire file is not
// read, will be an open file handle)
#ifdef __UNIX__
short attr;
#endif
char as_name[TMP_NAME_LEN]; // name that file was auto-saved as
} file;
#define FILE_SIZE sizeof( file )
/*
* mark setting
*/
typedef struct {
linenum lineno; // line number that mark is on
char next; // pointer to next mark on the same line
vi_ushort col:12; // column that mark is on
vi_ushort inuse:1; // mark is being used
vi_ushort spare:3;
} mark;
#define MARK_SIZE sizeof( mark )
typedef struct i_mark {
linenum line;
int column;
} i_mark;
typedef struct range {
i_mark start;
i_mark end;
/*
* ACK! Here we have a lovely little wart on the operator/movement
* system. Some commands want to highlight a region of text after they
* have moved; to support this we add these marks which tell us where
* to begin and end highlighting, as well as a flag to decide whether to
* actually do the highlighting. Puke.
*/
i_mark hi_start;
i_mark hi_end;
char highlight:1;
char line_based:1;
/*
* Double ACK! Some times we need to treat a range differently depending
* on whether an operator or a move is using it. This tells us if we should
* include the last character or not (compare "d/foo" to "/foo"). Puke.
*/
char fix_range:1;
char spare:5;
} range;
typedef int (*insert_rtn)( void );
typedef int (*move_rtn)( range *, long count );
typedef int (*op_rtn)( range * );
typedef int (*misc_rtn)( long count );
typedef int (*old_rtn)( void );
typedef int (*alias_rtn)( void **, void ** );
typedef union command_rtn {
insert_rtn ins;
move_rtn move;
op_rtn op;
misc_rtn misc;
old_rtn old;
alias_rtn alias;
void *ptr;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?