1 /* unixmakr.h						  */
2 /* Copyright (C) 1993 Fred Kruse                          */
3 /* This is free software; you can redistribute it and/or  */
4 /* modify it under the terms of the                       */
5 /* GNU General Public License, see the file COPYING.      */
6 
7 #ifdef NOSTRSTR
8 char *strstr(char *s1, char *s2);
9 char *getcwd(char *dir, int n);
10 #endif
11 
12 #ifdef NCURSES
13 #define e_putp(s) 1
14 #else
15 #define e_putp(s) tputs((s), 1, fk_u_putchar)
16 #endif
17 
18 extern int cur_on;
19 
20 #ifdef DEFPGC
21 #define getc(fp) fgetc((fp))
22 #endif
23 #ifdef NCURSES
24 #define fk_getch() getch()
25 #else
26 #ifdef HAVE_LIBGPM
27 #define fk_getch() Gpm_Getc(stdin)
28 #else
29 #define fk_getch() fgetc(stdin)
30 #endif
31 #endif
32 #define WpeExit(n) e_exit((n))
33 
34 extern char *cur_rc, *cur_vs, *cur_nvs, *cur_vvs, *schirm;
35 extern char *att_no, *att_so, *att_ul, *att_rv, *att_bl, *att_dm, *att_bo;
36 extern int cur_x, cur_y;
37 extern char *user_shell;
38 
39 extern char *ctree[5];
40 
41 #ifdef NEWSTYLE
42 #define e_pr_char(x, y, c, frb)   \
43 (  *(schirm + 2*MAXSCOL*(y) + 2*(x)) = (c),  \
44    *(schirm + 2*MAXSCOL*(y) + 2*(x) + 1) = (frb), \
45    *(extbyte + MAXSCOL*(y) + (x)) = 0  )
46 #else
47 #define e_pr_char(x, y, c, frb)   \
48 (  *(schirm + 2*MAXSCOL*(y) + 2*(x)) = (c),  \
49    *(schirm + 2*MAXSCOL*(y) + 2*(x) + 1) = (frb)  )
50 #endif
51 #define e_pt_col(x, y, c)  ( *(schirm + 2*MAXSCOL*(y) + 2*(x) + 1) = (c) )
52 #define e_gt_char(x, y)  (*(schirm + 2*MAXSCOL*(y) + 2*(x)))
53 
54 #define e_gt_col(x, y)  (*(schirm + 2*MAXSCOL*(y) + 2*(x)+1))
55 
56 #define e_gt_byte(x, y)  (*(schirm + 2*MAXSCOL*(y) + (x)))
57 
58 #define e_pt_byte(x, y, c)  ( *(schirm + 2*MAXSCOL*(y) + (x)) = (c) )
59 
60 /*  Pointer to functions for function calls  */
61 
62 #define fk_locate(x, y) (*fk_u_locate)(x, y)
63 #define fk_cursor(x) (*fk_u_cursor)(x)
64 #define e_refresh() (*e_u_refresh)()
65 #define e_initscr(argc, argv) (*e_u_initscr)(argc, argv)
66 #define e_getch() (*e_u_getch)()
67 #define fk_putchar(c) (*fk_u_putchar)(c)
68 #define e_d_switch_out(c) (*e_u_d_switch_out)(c)
69 #define e_switch_screen(sw) (*e_u_switch_screen)(sw)
70 #define e_deb_out(f) (*e_u_deb_out)(f)
71 #define e_cp_X_to_buffer(f) (*e_u_cp_X_to_buffer)(f)
72 #define e_copy_X_buffer(f) (*e_u_copy_X_buffer)(f)
73 #define e_paste_X_buffer(f) (*e_u_paste_X_buffer)(f)
74 
75 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
76   bioskey - Get the status of shift, alt, and control keys.
77 
78     Returns: A bit field of the following info
79       Bit  Information
80        3   Alt key
81        2   Control key
82        1   Left shift
83        0   Right shift
84 \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
85 #define bioskey() (*u_bioskey)()
86 #define e_sys_ini() (*e_u_sys_ini)()
87 #define e_sys_end() (*e_u_sys_end)()
88 #define e_frb_menue(sw, xa, ya, f, md) (*e_frb_u_menue)(sw, xa, ya, f, md)
89 #define e_pr_col_kasten(xa, ya, x, y, f, sw) \
90 		(*e_pr_u_col_kasten)(xa, ya, x, y, f, sw)
91 #define e_s_clr(f, b) (*e_s_u_clr)(f, b)
92 #define e_n_clr(fb) (*e_n_u_clr)(fb)
93 
94 #define REALLOC(p, n) realloc((p), (n))
95 #define MALLOC(n) malloc(n)
96 #define FREE(n) free(n)
97 
98 #ifdef NEWSTYLE
99 extern char *extbyte, *altextbyte;
100 #endif
101 
102 #define sc_txt_1(f) { if(f->c_sw) f->c_sw = e_sc_txt(f->c_sw, f->b); }
103 
104 #define sc_txt_2(f) 							\
105 {   if(f->c_sw) 							\
106     {	if(f->s->mark_begin.y == f->s->mark_end.y)                      \
107         e_sc_nw_txt(f->s->mark_end.y, f->b, 0);                         \
108 	else								\
109 	{  f->c_sw = REALLOC(f->c_sw, f->b->mx.y * sizeof(int));	\
110 	   f->c_sw = e_sc_txt(f->c_sw, f->b);				\
111 	}								\
112     }									\
113 }
114 #define sc_txt_3(y, b, sw) {  if(b->f->c_sw) e_sc_nw_txt(y, b, sw);  }
115 #define sc_txt_4(y, b, sw)						\
116 {  if(b->f->c_sw && !e_undo_sw) e_sc_nw_txt(y, b, sw);  }
117 
118