Unhook gperf, it was only used by gcc2.
[dragonfly.git] / usr.sbin / pcvt / fed / fed.c
1 /*
2  * Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *    This product includes software developed by Hellmuth Michaelis.
17  * 4. The name of the developer may not be used to endorse or promote
18  *    products derived from this software without specific prior written
19  *    permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  *      fed.c, 3.00, last edit-date: [Sun Jan  2 20:08:45 1994]
33  */
34
35 /*---------------------------------------------------------------------------
36  *
37  *      fed.c           font editor main file
38  *      -------------------------------------
39  *
40  *      written by Hellmuth Michaelis, hm@hcshh.hcs.de
41  *
42  *      -hm     first public release
43  *      -hm     activating font save
44  *
45  *---------------------------------------------------------------------------*/
46
47 #define FED
48
49 #include "fed.h"
50
51 void main(int argc, char *argv[])
52 {
53         int i;
54         int row, col;
55         int ret;
56
57         if(argc != 2)
58         {
59                 fprintf(stderr,"EGA/VGA Fonteditor, Rel 1.00\n");
60                 fprintf(stderr,"usage: %s <fontfilename>\n",argv[0]);
61                 exit(1);
62         }
63
64         readfont(argv[1]);              /* read fontfile into memory */
65
66         initscr();
67         cbreak();
68         noecho();
69         nonl();
70         keypad(stdscr,TRUE);
71         idlok(stdscr, TRUE);
72
73         move(0,0);
74         standout();
75         addstr("      Interactive EGA/VGA Fonteditor - (c) 1993, 1994 Hellmuth Michaelis        ");
76         standend();
77
78 /* character horizontal ruler */
79
80         move(WINROW-1, CHCOL + ((WIDTH16 - ch_width)/2) + 1);
81         if(ch_width == WIDTH16)
82                 addstr("1234567890123456");
83         else
84                 addstr("12345678");
85
86 /* charcater vertical ruler */
87
88         for(i=1; i < ch_height+1; i++)
89                 mvprintw((WINROW+i), (CHCOL + ((WIDTH16 - ch_width)/2) - 2), "%2d", i);
90
91
92 /* select horizontal ruler */
93
94         move(WINROW-1,SETCOL+2);
95         addstr("0 1 2 3 4 5 6 7 8 9 A B C D E F ");
96
97 /* select vertical ruler */
98
99         for(i=0; i<10; i++)
100                 mvaddch((WINROW+i+1),(SETCOL-1),(i+'0'));
101         for(i=0; i<6; i++)
102                 mvaddch((WINROW+10+i+1),(SETCOL-1),(i+'A'));
103
104 /* label available commands window */
105
106         move(WINROW-1,CMDCOL+1);
107         addstr("Commands");
108
109         refresh();
110
111 /* command window */
112
113         cmd_win = newwin(((WSIZE)+(2*WBORDER)),(CMDSIZE+(2*WBORDER)),
114                                 WINROW,CMDCOL);
115         keypad(cmd_win,TRUE);
116         idlok(cmd_win, TRUE);
117         box(cmd_win,'|','-');
118
119         sel_mode();
120
121 /* character font window */
122
123         ch_win = newwin((ch_height+(2*WBORDER)),(ch_width+(2*WBORDER)),
124                                 WINROW, CHCOL+((WIDTH16 - ch_width)/2));
125         keypad(ch_win,TRUE);
126         idlok(ch_win, TRUE);
127
128         box(ch_win,'|','-');
129         wrefresh(ch_win);
130
131 /* character select window */
132
133         set_win = newwin((WSIZE+(2*WBORDER)),((WSIZE*2)+(2*WBORDER)),
134                                 WINROW,SETCOL); /* whole character set */
135         keypad(set_win,TRUE);
136         idlok(set_win, TRUE);
137
138         box(set_win,'|','-');
139
140         row = 0;
141         col = 0;
142
143         for(i=0; i<256; i++)
144         {
145                 mvwprintw(set_win,row+1,col+1,"%02.2X",i);
146                 if(++row > 15)
147                 {
148                         row = 0;
149                         col += 2;
150                 }
151         }
152         wmove(set_win,1,1);
153         wrefresh(set_win);
154
155 /* start */
156
157         clr_cmd();
158
159         curchar = 0;
160
161         if((ret = selectc()) == 1)
162         {
163                 writefont();
164         }
165         endwin();
166 }
167
168 /*---------------------------------- E O F ----------------------------------*/