Mercurial > emacs
view lib-src/=aixcc.lex @ 1284:4742a5797146
Password:
Last login: Tue Sep 29 20:00:25 from paris.CS.Berkele
4.3 BSD UNIX #1: Fri Dec 1 20:30:54 EST 1989
This machine belongs to the GNU project. Feel free to use it.
Send questions, requests, or other remarks to request@gnu.ai.mit.edu
The GNU Project does not have the physical resources to "host" random games
and IRC daemons on its machines. They tie up computing resources needed to
develop software and further GNU. They have become a real hassle for us, so
please don't run them.
/home/fsg is full. Do the right thing.
Guests: please don't use the hp300 machines for games, IRC, or news. You
are welcome to use them for other purposes as long as a staff member
doesn't ask you to log out and use another host. The hp300s include
wookumz, churchy, geech, and mole. Machines which may be used for just
about any purpose include hal, wombat, kropotkin, goldman, and hill.
You have mail.
This is a -bash login shell.
No DISPLAY variable here...
jla@churchy$ pwd
/home/fsf/jla
jla@churchy$ cd src
/gd/gnu/emacs/19.0/src
jla@churchy$ gdb xemacs
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
TERMCAP and TERM environment variables unset.
Environment variable "DISPLAY" not defined.
Breakpoint 1 at 0x7d6ec
Breakpoint 2 at 0x77310
(gdb) set env DISPLAY 128.32.150.43:0.0
(gdb) r
Starting program: /home/gd/gnu/emacs/19.0/src/xemacs -q
Cannot insert breakpoint 1:
The same program may be running in another process.
Cannot access memory at address 0x7d6ec.
(gdb)
[1]+ Stopped gdb xemacs
jla@churchy$ ps x
PID TT STAT TIME COMMAND
29053 p7 S 0:05 -bash (bash)
29074 p7 T 0:04 gdb xemacs
29075 p7 T 0:00 /home/gd/gnu/emacs/19.0/src/xemacs -q
29076 p7 R 0:00 ps x
jla@churchy$ ps ax
PID TT STAT TIME COMMAND
0 ? D 0:36 swapper
1 ? I 0:01 init
2 ? D 0:03 pagedaemon
49 ? S 15:02 syslogd
50 ? I 0:58 portmap
60 ? I 0:12 -accepting connections (sendmail)
64 ? S < 0:53 /usr/local/etc/ntpd
67 ? I 0:01 /usr/bin/X11/xdm
97 ? I 0:19 cron
101 ? S 2:22 /usr/etc/rwhod
103 ? I 2:45 /etc/inetd
106 ? IW 0:00 /usr/lib/lpd
145 ? IW 0:00 (nfsd)
146 ? IW 0:00 (nfsd)
147 ? IW 0:00 (nfsd)
148 ? IW 0:00 (nfsd)
152 ? IW 1:38 (biod)
153 ? IW 1:40 (biod)
154 ? IW 1:41 (biod)
155 ? IW 1:40 (biod)
2925 ? IW 0:00 rpc.mountd
5255 ? I 11:14 ibble
24806 ? S 19:37 /usr/bin/X11/X :0
28913 ? I 0:00 -:0 (xdm)
28924 ? I 0:01 sh /home/fsf/melissa/.xinitrc
28932 ? I 0:00 xterm -C -ut +sb -n Console -geometry 80x24+1+0
28933 ? I 0:00 xbiff -geometry -140+180
28934 ? S 0:02 xclock -analog -geometry -0+180
28935 ? S 0:02 xclock -digital -geometry 85x17-0+280
28936 ? I 0:54 emacs -wn Mail -in Mail -geometry 80x55+35+18 -f rmail -fon
28937 ? I 0:01 twm
28940 ? I 0:00 /usr/local/lib/emacs/etc/wakeup 60
28951 ? I 0:11 emacs -d :0.0 -w
28952 ? I 0:00 /usr/local/lib/emacs/etc/wakeup 60
29024 ? I 0:09 emacs -d :0.0 -w
29025 ? I 0:00 /usr/local/lib/emacs/etc/wakeup 60
29045 ? I 0:00 -AA29035 mizzou1.missouri.edu: user open (sendmail)
28938 p0 I 0:00 bash
28942 p1 I 0:00 /usr/local/gnubin/bash -i
28943 p2 I 0:00 -sh (csh)
28953 p3 I 0:00 /usr/local/gnubin/bash -i
28954 p4 I 0:00 -sh (csh)
29026 p5 I 0:00 /usr/local/gnubin/bash -i
560 p6 I 0:08 .nbin/mr
29027 p6 I 0:00 -sh (csh)
29052 p7 S 0:00 rlogind
29053 p7 S 0:05 -bash (bash)
29074 p7 T 0:04 gdb xemacs
29075 p7 T 0:00 /home/gd/gnu/emacs/19.0/src/xemacs -q
29077 p7 R 0:00 ps ax
5256 q0 IW 0:00 -bin/csh (csh)
5272 q0 S 6:38 tf2
5261 q1 IW 0:00 -bin/csh (csh)
5266 q2 IW 0:00 -bin/csh (csh)
15329 q2 I 7:27 emacs -f gnus
15330 q2 I 0:01 /usr/local/lib/emacs/etc/wakeup 60
95 ? S 2:22 update
157 ? IW 0:00 - 300h console (getty)
jla@churchy$ fg
gdb xemacs
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/gd/gnu/emacs/19.0/src/xemacs -q
Cannot insert breakpoint 1:
The same program may be running in another process.
Cannot access memory at address 0x7d6ec.
(gdb) dis
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/gd/gnu/emacs/19.0/src/xemacs -q
Program received signal 2, Interrupt
0x83ffe in select ()
(gdb) b Fsignal
Breakpoint 3 at 0x503da: file eval.c, line 1105.
(gdb) c
Continuing.
Cannot insert breakpoint 3:
The same program may be running in another process.
Cannot access memory at address 0x503da.
(gdb) dis
(gdb) c
Continuing.
Program received signal 2, Interrupt
0x83ffe in select ()
(gdb) k`
Kill the inferior process? (y or n) y
(gdb) q
jla@churchy$ who
jla ttyp7 Sep 30 14:10 (priam.CS.Berkele)
melissa :0 Sep 30 13:41
jla@churchy$ ll *emacs*
-rwxrwxrwx 1 jimb daemon 2464158 Sep 27 23:33 emacs-19.0.437*
-rwxrwxrwx 1 jimb daemon 2464135 Sep 28 02:19 emacs-19.0.438*
-rwxrwxrwx 1 rms daemon 2464283 Sep 28 09:08 emacs-19.0.439*
-rwxrwxrwx 1 jimb daemon 2464480 Sep 29 00:59 emacs-19.0.440*
-rwxrwxrwx 1 jimb daemon 2465827 Sep 29 09:24 emacs-19.0.444*
-rwxrwxrwx 1 jimb daemon 2466058 Sep 29 10:16 emacs-19.0.445*
-rwxrwxrwx 1 jimb daemon 2466058 Sep 29 10:35 emacs-19.0.446*
-rwxrwxrwx 1 jimb daemon 2466070 Sep 29 13:18 emacs-19.0.447*
-rwxrwxrwx 1 jimb daemon 2462257 Sep 30 11:00 emacs-19.0.448*
-rwxrwxrwx 2 jimb daemon 2462209 Sep 30 11:16 emacs-19.0.449*
-rwxrwxrwx 1 jimb daemon 2462194 Sep 30 11:57 emacs-19.0.450*
-rwxrwxrwx 2 jimb daemon 2466524 Sep 30 12:19 emacs-19.0.451*
-r--r--r-- 1 jimb daemon 20265 Sep 22 23:40 emacs.c
-rw-rw-rw- 1 rms daemon 18316 Sep 23 08:15 emacs.o
-rwxrwxrwx 1 jimb daemon 2466070 Sep 29 14:36 jimb-xemacs*
-rwxrwxrwx 1 jimb daemon 2097884 Sep 30 12:17 temacs*
-rwxrwxrwx 1 jimb daemon 1822178 Sep 13 09:31 temacs-2*
-rw-rw-rw- 1 jimb daemon 784 Sep 18 1988 temacs.opt
-rw-rw-rw- 1 jimb daemon 177 Feb 26 1987 testemacs.com
-rwxrwxrwx 2 jimb daemon 2466524 Sep 30 12:19 xemacs*
-rwxrwxrwx 1 jla daemon 2463040 Sep 23 17:15 yemacs*
jla@churchy$ rm yemacs
jla@churchy$ cp xemacs yemacs &
[1] 29088
jla@churchy$ more ChangeLog
Wed Sep 30 06:59:07 1992 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
* buffer.c (Fother_buffer): Add back the VISIBLE_OK argument. It
got removed with no comment or ChangeLog entry, and
append-to-buffer uses it.
* window.c (struct save_window_data): Add a member called
focus_frame, to save and restore the screen's focus frame.
(Fset_window_configuration): Redirect the frame's focus as
indicated in the window configuration.
(Fcurrent_window_configuration): Record the frame's current focus.
* minibuf.c (read_minibuf): Don't bother to save the current
frame's focus, and have read_minibuf_unwind restore it; saving and
restoring the window configurations will take care of that.
(read_minibuf_unwind): Don't worry about restoring the frame's focus.
* window.c (Fset_window_configuration): Don't select the frame
just because we restored its configuration.
* window.c (Fset_window_configuration): Don't forget to set the
frame's selected window when we can't call Fselect_window.
* xterm.c (x_meta_mod_mask): New variable, indicating which X
modifier bits denote meta keys.
(x_find_modifier_meanings): New function, to set x_meta_mod_mask.
(x_convert_modifiers): Use that.
(x_term_init): Call x_find_modifier_meanings.
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
swap in the value for the current buffer immediately.
* lisp.h: Doc elaboration for Lisp_Buffer_Local_Value.
Tue Sep 29 21:05:30 1992 Joseph Arceneaux (jla@churchy.gnu.ai.mit.edu)
* textprop.c (Ferase_text_properties): Merge intervals when
possible.
Tue Sep 29 00:04:05 1992 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
* xselect.c (Qcut_buffer0): Symbol removed; we're using a new
interface to the cut buffer now.
(NUM_CUT_BUFFERS, cut_buffer_atom, cut_buffer_value,
cut_buffer_cached, cut_buffer_just_set): New variables.
(Fx_own_selection, Fx_selection_value): Dike out the code to
handle CUT_BUFFER0 requests.
(Fx_get_cut_buffer, Fx_set_cut_buffer, x_watch_cut_buffer_cache,
x_invalidate_cut_buffer_cache): New functions.
[1]+ Exit 0 cp xemacs yemacs
jla@churchy$ gdb yemacs
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
TERMCAP and TERM environment variables unset.
Environment variable "DISPLAY" not defined.
Breakpoint 1 at 0x7d6ec
Breakpoint 2 at 0x77310
(gdb) b Fsignal
Breakpoint 3 at 0x503da: file eval.c, line 1105.
(gdb) set env DISPLAY 128.32.150.43:0.0
(gdb) r
Starting program: /home/gd/gnu/emacs/19.0/src/yemacs -q
Breakpoint 3, Fsignal (sig=17759556, data=17759236) at eval.c:1105
1105 register struct handler *allhandlers = handlerlist;
(gdb) c
Continuing.
Breakpoint 3, Fsignal (sig=17759576, data=84996828) at eval.c:1105
1105 register struct handler *allhandlers = handlerlist;
(gdb) bt
#0 Fsignal (sig=17759576, data=84996828) at eval.c:1105
#1 0x4664a in wrong_type_argument (predicate=17803608, value=987136)
at data.c:73
#2 0x4572 in Fredirect_frame_focus (frame=987136, focus_frame=235868160)
at frame.c:893
#3 0xe114 in Fset_window_configuration (configuration=353327296)
at window.c:2498
#4 0x524aa in unbind_to (count=7, value=51516952) at eval.c:2111
#5 0xe61c in Fsave_window_excursion (args=84526412) at window.c:2683
#6 0x60cd4 in Fbyte_code (bytestr=50971960, vector=67749184, maxdepth=1)
at bytecode.c:555
#7 0x521a8 in funcall_lambda (fun=101303552, nargs=2, arg_vector=0xffeff7ae)
at eval.c:2032
#8 0x51c42 in Ffuncall (nargs=3, args=0xffeff7aa) at eval.c:1898
#9 0x607c8 in Fbyte_code (bytestr=50977256, vector=67754576, maxdepth=5)
at bytecode.c:422
#10 0x521a8 in funcall_lambda (fun=101308856, nargs=1, arg_vector=0xffeff8ee)
at eval.c:2032
#11 0x51c42 in Ffuncall (nargs=2, args=0xffeff8ea) at eval.c:1898
#12 0x4e980 in Fcall_interactively (function=17914640, record=17759236)
at callint.c:508
#13 0x24090 in Fcommand_execute (cmd=17914640, record=17759236)
at keyboard.c:3025
#14 0x21028 in command_loop_1 () at keyboard.c:973
#15 0x50370 in internal_condition_case (bfun=0x2084c <command_loop_1>,
handlers=17759536, hfun=0x20304 <cmd_error>) at eval.c:1083
#16 0x2066a in command_loop_2 () at keyboard.c:701
#17 0x4fece in internal_catch (tag=17759516, func=0x2064e <command_loop_2>,
arg=17759236) at eval.c:875
#18 0x2062e in command_loop () at keyboard.c:681
#19 0x201ca in recursive_edit_1 () at keyboard.c:523
#20 0x20298 in Frecursive_edit () at keyboard.c:558
#21 0x1fa36 in main (argc=2, argv=0xffeffce4, envp=0xffeffcf0) at emacs.c:581
(gdb) fr 2
#2 0x4572 in Fredirect_frame_focus (frame=987136, focus_frame=235868160)
at frame.c:893
893 CHECK_LIVE_FRAME (frame, 0);
(gdb) l
888 This is useful for temporarily redirecting keystrokes to the minibuffer\n\
889 window when a frame doesn't have its own minibuffer.")
890 (frame, focus_frame)
891 Lisp_Object frame, focus_frame;
892 {
893 CHECK_LIVE_FRAME (frame, 0);
894
895 if (NILP (focus_frame))
896 focus_frame = frame;
897 else
(gdb)
898 CHECK_LIVE_FRAME (focus_frame, 1);
899
900 XFRAME (frame)->focus_frame = focus_frame;
901
902 if (frame_rehighlight_hook)
903 (*frame_rehighlight_hook) ();
904
jla@churchy$ l
elisp/ jla-src/ v19-src/
jla@churchy$ cd v19-src/
jla@churchy$ grep INTERVAL lisp.h
#ifdef USE_INTERVALS
typedef struct interval *INTERVAL;
#define DECLARE_INTERVALS INTERVAL intervals;
#define INITIALIZE_INTERVAL(ptr,val) ptr->intervals = val
#define INTERVAL
#define DECLARE_INTERVALS
#define INITIALIZE_INTERVAL(ptr,val)
#endif /* USE_INTERVALS */
DECLARE_INTERVALS
jla@churchy$ grep INTERVAL config.h
/* Define USE_INTERVALS to handle fat text. */
#define USE_INTERVALS
jla@churchy$ d
/gd2/jla/v19-src
jla@churchy$ pwd
/home/gd2/jla/v19-src
jla@churchy$ grep DECLARE_INTERVALS *.[ch]
buffer.h: DECLARE_INTERVALS
lisp.h:#define DECLARE_INTERVALS INTERVAL intervals;
lisp.h:#define DECLARE_INTERVALS
lisp.h: DECLARE_INTERVALS
jla@churchy$ grep INITIALIZE_INTERVAL *.c
alloc.c: INITIALIZE_INTERVAL (XSTRING (val), NULL_INTERVAL);
alloc.c: INITIALIZE_INTERVAL (XSTRING (new), NULL_INTERVAL);
buffer.c: INITIALIZE_INTERVAL (b, NULL_INTERVAL);
buffer.c: INITIALIZE_INTERVAL (b, NULL_INTERVAL);
jla@churchy$ pwd
/home/gd2/jla/v19-src
jla@churchy$ cd etc
/gd/gnu/emacs/19.0/etc
jla@churchy$ l *.c
/usr/local/gnubin/ls: *.c: No such file or directory
jla@churchy$ more Makefile
DESTDIR=
LIBDIR=/usr/local/lib
BINDIR=/usr/local/bin
MANDIR=/usr/man/man1
MANEXT=1
all:
distclean:
-rm -f *~ \#* DOC* core
clean:
-rm -f core
jla@churchy$ cd ..
jla@churchy$ l
ChangeLog README.~3~ info/
ChangeLog~ README.~6~ lib-src/
GETTING.GNU.SOFTWARE README.~7~ lisp/
GETTING.GNU.SOFTWARE.~1~ arch-lib/ local-lisp/
GETTING.GNU.SOFTWARE.~2~ build-install* lock/
INSTALL build-install.in* make-dist*
INSTALL.~1~ build-install.in,v* make-dist.~10~*
INSTALL.~2~ config.emacs.~1~* make-dist.~11~*
jla@churchy$ cd src
/gd/gnu/emacs/19.0/src
jla@churchy$ make -f xmakefile editfns.o
make: `editfns.o' is up to date.
jla@churchy$ ll editfns.[co]
-rw-r--r-- 1 jla daemon 36258 Sep 30 20:39 editfns.c
-rw-rw-rw- 1 jla daemon 38383 Sep 30 20:43 editfns.o
jla@churchy$ date
Wed Sep 30 20:45:25 EDT 1992
jla@churchy$ rm editfns.o
jla@churchy$ make -f xmakefile editfns.o
cc -g -Demacs -Is -Im -c editfns.c -o editfns.o
jla@churchy$ lt {insdel,emacs,buffer}.[co]
-rw-rw-rw- 1 jla daemon 16422 Sep 30 20:42 insdel.o
-rw-rw-rw- 1 rms daemon 18316 Sep 30 20:40 emacs.o
-rw-r--r-- 1 jla daemon 14931 Sep 30 19:54 insdel.c
-rw-r--r-- 1 jla daemon 20387 Sep 30 19:33 emacs.c
-rw-rw-rw- 1 jla daemon 44674 Sep 30 19:29 buffer.o
-r--r--r-- 1 jimb daemon 56614 Sep 30 14:13 buffer.c
jla@churchy$ ll buffer.h
-rw-r--r-- 1 jla daemon 14323 Sep 30 18:36 buffer.h
jla@churchy$ ll temacs
-rw-rw-rw- 1 jimb daemon 313564 Sep 30 20:46 temacs
jla@churchy$ man rcs
jla@churchy$ man rlog
jla@churchy$ rlog RCS/buffer.c,v
RCS file: RCS/buffer.c,v
Working file: buffer.c
head: 1.15
branch:
locks: strict
access list:
symbolic names:
comment leader: " * "
keyword substitution: kv
total revisions: 15; selected revisions: 15
description:
/* Buffer manipulation primitives for GNU Emacs.
----------------------------
revision 1.15
date: 1992/09/30 18:16:11; author: jimb; state: Exp; lines: +9 -5
* buffer.c (Fother_buffer): Add back the VISIBLE_OK argument. It
got removed with no comment or ChangeLog entry, and
append-to-buffer uses it.
----------------------------
revision 1.14
date: 1992/09/29 04:54:28; author: jimb; state: Exp; lines: +1 -1
* data.c (Frem): Use the `fmod' function under SunOS, Ultrix, and
HP/UX, not just under USG systems.
----------------------------
revision 1.13
date: 1992/09/29 04:08:04; author: jimb; state: Exp; lines: +20 -14
* buffer.c (Fbury_buffer): This used to undisplay the buffer being
buried only if the BUFFER argument was nil. Instead, undisplay the
buffer whenever it's displayed in the selected window, no matter
how it was specified by BUFFER. This is how it behaves in 18.58,
and I can't find any ChangeLog entry in 18.58 or 19.0 saying why
they differ. Fix the doc string accordingly.
----------------------------
revision 1.12
date: 1992/09/22 05:16:47; author: jimb; state: Exp; lines: +1 -0
* buffer.c (Fget_buffer_create): Doc fix.
jla@churchy$ d
/gd/gnu/emacs/19.0/src
jla@churchy$ ci editfns.c insdel.c emacs.c buffer.h intervals.h intervals.c tex
tprop.c
RCS/editfns.c,v <-- editfns.c
new revision: 1.14; previous revision: 1.13
enter log message, terminated with single '.' or end of file:
>>
>> * editfns.c (make_buffer_string): Call copy_intervals_to_string().
(Finsert_buffer_substring): Call graft_intervals_into_buffer().
#include "intervals.h".
>> >> >> .
done
RCS/insdel.c,v <-- insdel.c
new revision: 1.5; previous revision: 1.4
reuse log message of previous file? [yn](y): n
enter log message, terminated with single '.' or end of file:
>> * insdel.c: #include "intervals.h"
(prepare_to_modify_buffer): Call verify_interval_modification().
(insert_from_string): Call offset_intervals() and
graft_intervals_into_buffer().
(del_range): Call offset_intervals().
(insert): Call offset_interv>> >> >> >> >> als().
>> .
done
author | Joseph Arceneaux <jla@gnu.org> |
---|---|
date | Thu, 01 Oct 1992 00:56:11 +0000 |
parents | ffa6d5c9b074 |
children | 507f64624555 |
line wrap: on
line source
%Start ErrorText ErrorMessage OtherText EC [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9] D [0-9] D3 [0-9 ][0-9 ][0-9] D4 [0-9 ][0-9 ][0-9 ][0-9] D5 [0-9 ][0-9 ][0-9 ][0-9 ][0-9] DS [0-9 ] %{ /* moore@wilma.cs.utk.edu * Hack to work around the AIX C compiler's brain-damaged error messages * so that emacs can parse them. It runs /bin/cc as a subprocess, and * tries to rearrange the error messages so that (a) each message contains * both the filename and line number where the error occurred, and (b) * the error message(s) for a particular line get displayed *before* the * line itself. * * to compile: * lex aixcc.lex * cc -o aixcc lex.yy.c * * * Copyright December 1991 by Keith Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * TODO: figure out how the compiler counts file numbers for included * files, keep track of which file corresponds to which number, and * always output the right file name. */ #include <stdio.h> #include <string.h> char *current_file; int line; int debug = 0; char bigbuf[10240]; char *bufptr = bigbuf; int last_line_was_error = 0; spaces (s) char *s; { while (*s++) *bufptr++ = ' '; } char * strsave (s) char *s; { char *ptr = malloc (strlen (s) + 1); strcpy (ptr, s); return ptr; } yywrap () { *bufptr = '\0'; bufptr = bigbuf; while (*bufptr) putc (*bufptr++, yyout); return 1; } %} %% ^File\ Line\ Column\ Message\ text[^\n]* { /* * ignore this. don't treat it as error text */ } ^{DS}{DS}{DS}\ {D5}\ \| { /* * (optional) nesting level, followed by line number, followed * by the source code fragment that caused the error */ /* * save the line number for later */ line = atoi (yytext+4); if (debug) { fprintf (yyout, "line <= %d\n", line); fprintf (yyout, "%s\n", yytext); } /* * if the last line was an error message, to flush out all of * the old source text before starting to save the new source text. */ if (last_line_was_error) { *bufptr = '\0'; bufptr = bigbuf; while (*bufptr) putc (*bufptr++, yyout); bufptr = bigbuf; last_line_was_error = 0; } /* * stuff enough spaces in the text buffer so that the * saved text will line up properly when displayed. */ spaces (yytext); BEGIN ErrorText; /* continue below */ } <ErrorText>[^\n]*$ { char *ptr; /* * Save the text until we see the error message(s), then print it. * This because emacs puts the error message at the top of the * window, and it's nice to be able to see the text below it. */ ptr = yytext; while (*ptr) *bufptr++ = *ptr++; *bufptr++ = '\n'; BEGIN 0; } ^Processing\ include\ file\ .*$ { /* * name of a new include file being processed. Increment file number * and remember the file name corresponding to this file number. */ current_file = strsave (yytext+24); if (debug) { fprintf (yyout, "current_file <= %s\n", current_file); fprintf (yyout, "%s\n", yytext); } } ^([a-z]\ -)?\ *{EC}: { /* * error message (which we print immediately) preceeded by an * error code (which we ignore) */ fprintf (yyout, "\"%s\", line %d: %c -", current_file, line, *yytext); last_line_was_error = 1; BEGIN ErrorMessage; } ^{D3}\ {D5}\ {D4}\ {EC}: { /* * (optional) nesting level, followed by line number, followed * by column number, followed by error message text. */ /* * save the line number for later */ line = atoi (yytext+4); if (debug) { fprintf (yyout, "line <= %d\n", line); fprintf (yyout, "%s\n", yytext); } /* * if the last line was an error message, flush out all of * the old source text before printing this error message. */ if (last_line_was_error) { *bufptr = '\0'; bufptr = bigbuf; while (*bufptr) putc (*bufptr++, yyout); bufptr = bigbuf; last_line_was_error = 0; } fprintf (yyout, "\"%s\", line %d:", current_file, line); last_line_was_error = 1; BEGIN ErrorMessage; } <ErrorMessage>[^\n]*$ { fprintf (yyout, "%s\n", yytext); BEGIN 0; } ^[^ :]+".c:"\ *$ { /* name of new source file being processed */ char *ptr; if (current_file) free (current_file); ptr = strchr (yytext, ':'); *ptr = '\0'; current_file = strsave (yytext); } ^[^\n] { /* * other text starting with a newline. We have to break it up this * way to keep this rule from matching any of the above patterns */ if (last_line_was_error) { *bufptr = '\0'; bufptr = bigbuf; while (*bufptr) putc (*bufptr++, yyout); bufptr = bigbuf; last_line_was_error = 0; } *bufptr++ = *yytext; BEGIN OtherText; } <OtherText>[^\n]*$ { char *ptr; ptr = yytext; while (*ptr) *bufptr++ = *ptr++; *bufptr++ = '\n'; BEGIN 0; } \n ; %% main (argc, argv) char **argv; { int pfd[2]; int child_pid; int i; current_file = strsave ("/dev/null"); line = 0; for (i = 1; i < argc; ++i) { char *ptr = strrchr (argv[i], '.'); if (ptr && ptr[1] == 'c' && ptr[2] == '\0') { current_file = strsave (argv[i]); break; } } if (pipe (pfd) < 0) { perror ("pipe"); exit (1); } if ((child_pid = fork()) > 0) { int status; close (pfd[1]); yyin = fdopen (pfd[0], "r"); yyout = stderr; yylex(); wait (&status); exit ((status >> 8) & 0xff); } else if (child_pid == 0) { dup2 (pfd[1], 2); close (pfd[0]); close (pfd[1]); argv[0] = "cc"; execv ("/bin/cc", argv); perror ("/bin/cc"); exit (1); } else { perror ("fork"); exit (1); } }