Deleted Added
full compact
TOUR (245689) TOUR (253650)
1# @(#)TOUR 8.1 (Berkeley) 5/31/93
1# @(#)TOUR 8.1 (Berkeley) 5/31/93
2# $FreeBSD: head/bin/sh/TOUR 245689 2013-01-20 12:44:50Z jilles $
2# $FreeBSD: head/bin/sh/TOUR 253650 2013-07-25 15:08:41Z jilles $
3
4NOTE -- This is the original TOUR paper distributed with ash and
5does not represent the current state of the shell. It is provided anyway
6since it provides helpful information for how the shell is structured,
7but be warned that things have changed -- the current shell is
8still under development.
9
10================================================================

--- 9 unchanged lines hidden (view full) ---

20
21SOURCE CODE GENERATORS: Files whose names begin with "mk" are
22programs that generate source code. A complete list of these
23programs is:
24
25 program input files generates
26 ------- ----------- ---------
27 mkbuiltins builtins builtins.h builtins.c
3
4NOTE -- This is the original TOUR paper distributed with ash and
5does not represent the current state of the shell. It is provided anyway
6since it provides helpful information for how the shell is structured,
7but be warned that things have changed -- the current shell is
8still under development.
9
10================================================================

--- 9 unchanged lines hidden (view full) ---

20
21SOURCE CODE GENERATORS: Files whose names begin with "mk" are
22programs that generate source code. A complete list of these
23programs is:
24
25 program input files generates
26 ------- ----------- ---------
27 mkbuiltins builtins builtins.h builtins.c
28 mkinit *.c init.c
29 mknodes nodetypes nodes.h nodes.c
30 mksyntax - syntax.h syntax.c
31 mktokens - token.h
32
28 mknodes nodetypes nodes.h nodes.c
29 mksyntax - syntax.h syntax.c
30 mktokens - token.h
31
33There are undoubtedly too many of these. Mkinit searches all the
34C source files for entries looking like:
32There are undoubtedly too many of these.
35
33
36 RESET {
37 x = 2; /* executed when the shell does a longjmp
38 back to the main command loop */
39 }
40
41It pulls this code out into routines which are when particular
42events occur. The intent is to improve modularity by isolating
43the information about which modules need to be explicitly
44initialized/reset within the modules themselves.
45
46Mkinit recognizes several constructs for placing declarations in
47the init.c file.
48 INCLUDE "file.h"
49includes a file. The storage class MKINIT makes a declaration
50available in the init.c file, for example:
51 MKINIT int funcnest; /* depth of function calls */
52MKINIT alone on a line introduces a structure or union declara-
53tion:
54 MKINIT
55 struct redirtab {
56 short renamed[10];
57 };
58Preprocessor #define statements are copied to init.c without any
59special action to request this.
60
61EXCEPTIONS: Code for dealing with exceptions appears in
62exceptions.c. The C language doesn't include exception handling,
63so I implement it using setjmp and longjmp. The global variable
64exception contains the type of exception. EXERROR is raised by
65calling error. EXINT is an interrupt.
66
67INTERRUPTS: In an interactive shell, an interrupt will cause an
68EXINT exception to return to the main command loop. (Exception:

--- 247 unchanged lines hidden ---
34EXCEPTIONS: Code for dealing with exceptions appears in
35exceptions.c. The C language doesn't include exception handling,
36so I implement it using setjmp and longjmp. The global variable
37exception contains the type of exception. EXERROR is raised by
38calling error. EXINT is an interrupt.
39
40INTERRUPTS: In an interactive shell, an interrupt will cause an
41EXINT exception to return to the main command loop. (Exception:

--- 247 unchanged lines hidden ---