-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathOS2VIO.H
168 lines (146 loc) · 4.06 KB
/
OS2VIO.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/* Copyright (c) 1990,1991,1992 Chris and John Downey */
/***
* @(#)os2vio.h 2.1 (Chris & John Downey) 7/29/92
* program name:
xvi
* function:
PD version of UNIX "vi" editor, with extensions.
* module name:
os2vio.h
* module function:
Definitions for OS/2 system interface.
* history:
STEVIE - ST Editor for VI Enthusiasts, Version 3.10
Originally by Tim Thompson (twitch!tjt)
Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
Heavily modified by Chris & John Downey
***/
/*
* System include files.
*/
#define INCL_BASE
#define INCL_DOS
#define INCL_SUB
#define INCL_DOSERRORS
#include <os2.h>
/*
* Include files for Microsoft C library.
*/
#include <fcntl.h>
#include <malloc.h>
#include <process.h>
#include <stdlib.h>
#include <time.h>
#ifndef SIGINT
# include <signal.h>
#endif
/*
* This is a multi-thread program, so we allocate multiple stacks
* within the same stack segment, so there isn't much point in letting
* the compiler put in stack probes.
*/
#pragma check_stack(off)
#ifndef HELPFILE
# define HELPFILE "d:\\jmd\\xvi\\help"
#endif
/*
* System-dependent constants.
*
* These are right for MS-DOS & (I think) OS/2. (jmd)
*/
#define MAXPATHLEN 143 /* maximum length of full path name */
#define MAXNAMLEN 12 /* maximum length of file name */
#define DIRSEPS "\\/" /*
* directory separators within
* pathnames
*/
/*
* Under OS/2, characters with the top bit set are perfectly valid
* (although not necessarily always what you want to see).
*/
#define DEF_CCHARS TRUE
#define DEF_MCHARS TRUE
#define SETVBUF_AVAIL
#define WRTBUFSIZ 0x7000
#define READBUFSIZ 0x7000
extern unsigned Rows, Columns;
extern unsigned char virt_row, virt_col;
extern unsigned char curcell[2];
/*
* Default value for P_format parameter.
*/
#define DEF_TFF fmt_OS2
/*
* Terminal driving functions - just use macros here.
*/
#define insert_line() /* insert one line */
#define delete_line() /* delete one line */
#define save_cursor() /* save cursor position */
#define restore_cursor() /* restore cursor position */
#define invis_cursor() /* invisible cursor */
#define vis_cursor() /* visible cursor */
#define tty_goto(r,c) (virt_row = (r), virt_col = (c))
#define cost_goto 0 /* cost of using tty_goto() */
/*
* Update actual screen cursor position. This is the only output flushing we
* need to do, because outstr() & outchar() use system calls which update
* video memory directly.
*/
#define flush_output() VioSetCurPos(virt_row, virt_col, 0)
#define can_ins_line FALSE
#define can_del_line FALSE
#define can_scroll_area TRUE
/*
* tty_linefeed() isn't needed if can_scroll_area is TRUE.
*/
#define tty_linefeed()
#define can_inschar FALSE
#define inschar(c)
#define set_colour(a) (curcell[1] = (a))
/*
* User-definable screen colours. Default values are for mono
* displays.
*/
#define DEF_COLOUR 7
#define DEF_STCOLOUR 112
#define DEF_SYSCOLOUR 7
#define alert() DosBeep(2000, 150)
/*
* Macros to open files in binary mode,
* and to expand filenames.
*/
#define fopenrb(f) fopen((f),"rb")
#define fopenwb(f) fopen((f),"wb")
#define fexpand(f) (f)
/*
* exists(): TRUE if file exists.
*/
#define exists(f) (access((f),0) == 0)
/*
* can_write(): TRUE if file does not exist or exists and is writeable.
*/
#define can_write(f) (access((f),0) != 0 || access((f), 2) == 0)
#define delay() DosSleep((long) 200)
#define call_shell(s) spawnlp(P_WAIT, (s), (s), (char *) NULL)
#define call_system(s) system(s)
/*
* Declarations for system interface routines in os2vio.c.
*/
extern void erase_display(void);
extern void erase_line(void);
extern int inchar(long);
extern void outchar(int);
extern void outstr(char*);
extern void scroll_down(unsigned, unsigned, unsigned);
extern void scroll_up(unsigned, unsigned, unsigned);
extern char *tempfname(char *);
extern void sys_init(void);
extern void sys_exit(int);
extern bool_t sys_pipe P((char *, int (*)(FILE *), long (*)(FILE *)));
extern void sys_startv(void);
extern void sys_endv(void);
/*
* in i286.asm:
*/
extern void far es0(void);
extern unsigned char * far newstack(int);