home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-21 | 38.8 KB | 1,300 lines |
- -*-Web-*-
- This file, CWEAVE-P.CH, is part of CWEB-p.
- It is a changefile for CWEAVE.W, Version 3.0.
-
- Authors and Contributors:
- (H2B) Hans-Hermann Bode, Universität Osnabrück,
- (hhbode@@dosuni1.rz.uni-osnabrueck.de or HHBODE@@DOSUNI1.BITNET).
-
- (KG) Klaus Guntermann, TH Darmstadt,
- (guntermann@@iti.informatik.th-darmstadt.de).
-
- (AS) Andreas Scherer,
- Abt-Wolf-Straße 17, 96215 Lichtenfels, Germany.
-
- (CS) Carsten Steger, Universität München,
- carsten.steger@informatik.tu-muenchen.de
-
- Caveat utilitor: Some of the source code introduced by this change file is
- made conditional to the use of specific compilers on specific systems.
- This applies to places marked with `#ifdef __TURBOC__' and `#ifdef _AMIGA'.
-
- This program is distributed WITHOUT ANY WARRANTY, express or implied.
-
- The following copyright notice extends to this changefile only, not to
- the masterfile CWEAVE.W.
-
- Copyright (C) 1993 Andreas Scherer
- Copyright (C) 1991, 1993 Carsten Steger
- Copyright (C) 1991, 1992 Hans-Hermann Bode
-
- Permission is granted to make and distribute verbatim copies of this
- document provided that the copyright notice and this permission notice
- are preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of this
- document under the conditions for verbatim copying, provided that the
- entire resulting derived work is distributed under the terms of a
- permission notice identical to this one.
-
- Version history:
-
- Version Date Author Comment
- a1/t1 10 Oct 1991 H2B First attempt for CWEAVE.W 2.1.
- p2 13 Feb 1992 H2B Updated for CWEAVE.W 2.4, ANSI and Turbo
- changefiles merged together, typesetting of
- certain ANSI and special constructions fixed.
- p3 16 Apr 1992 H2B Updated for CWEAVE.W 2.5.
- p4 22 Jun 1992 H2B Updated for CWEAVE.W 2.6, retaining hack for
- underlining of customized iddentifiers.
- p5 21 Jul 1992 H2B Extensions for C++ implemented.
- p5a 24 Jul 1992 KG adaptions for other ANSI C compiler
- p5b 28 Jul 1992 H2B Remaining headers converted to ANSI style.
- p5c 30 Jul 1992 KG removed comments used after #endif
- p6 06 Sep 1992 H2B Updated for CWEAVE.W 2.7, |dot_dot_dot| added,
- proper typesetting of formatted macro
- identifiers provided, bug in processing
- short comments fixed.
- p6a 15 Mar 1993 AS adaptions for SAS/C 6.0 and use of German
- macro file gcwebmac.tex
- p6b 28 Jul 1993 AS new patch level due to minor changes
- 01 Aug 1993 AS missing `ptrdiff_t' datatype included
- p6c 04 Sep 1993 AS new patch level in accordance with Common
- p6d 09 Oct 1993 AS Updated for CWEAVE.W 2.8. (This was p7)
- p7 13 Nov 1992 H2B Converted to master change file, updated for
- CWEAVE.W 2.8. [Not released.]
- p7.5 29 Nov 1992 H2B Updated for CWEAVE.W 2.9beta. [Not released.]
- p8 04 Dec 1992 H2B Updated for CWEAVE.W 2.9++ (stuff went into
- the source file). [Not released.]
- p8a 10 Mar 1993 H2B Restructured for public release. [Not released.]
- p8b 15 Apr 1993 H2B Updated for CWEAVE.W 3.0beta. [Not released.]
- p8c 21 Jun 1993 H2B Updated for final CWEAVE.W 3.0.
- p8d 25 Oct 1993 AS Incorporated with Amiga version 2.8 [p7] and
- updated to version 3.0.
- ------------------------------------------------------------------------------
- @x l.1
- % This file is part of CWEB.
- % This program by Silvio Levy and Donald E. Knuth
- % is based on a program by Knuth.
- % It is distributed WITHOUT ANY WARRANTY, express or implied.
- % Version 3.0 --- June 1993
-
- % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth
- @y
- % This file, CWEAVE.W, is part of CWEB-p.
- % This program by Silvio Levy and Donald E. Knuth
- % is based on a program by Knuth.
- % It is distributed WITHOUT ANY WARRANTY, express or implied.
- % Version 2.6 --- Don Knuth, June 1992
- % Version 2.6 [p5] --- Hans-Hermann Bode, July 1992
- % Version 2.6 [p5a] --- Klaus Guntermann, July 1992
- % Version 2.6 [p5b] --- Hans-Hermann Bode, July 1992
- % Version 2.6 [p5c] --- Klaus Guntermann, July 1992
- % Version 2.7 --- Don Knuth, July 1992
- % Version 2.7 [p6] --- Hans-Hermann Bode, September 1992
- % Version 2.7 [p6a] --- Andreas Scherer, March 1993
- % Version 2.7 [p6b] --- Andreas Scherer, July 1993
- % Version 2.7 [p6c] --- Andreas Scherer, September 1993
- % Version 2.8 --- Don Knuth, September 1992
- % Version 2.8 [p7] --- Andreas Scherer, October 1993
- % Version 3.0 --- Don Knuth, June 1993
- % Version 3.0 [p8c] --- Hans-Hermann Bode, June 1993
- % Version 3.0 [p8d] --- Andreas Scherer, October 1993
-
- % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth
- % Copyright (C) 1991,1992,1993 Hans-Hermann Bode
- % Copyright (C) 1991,1993 Carsten Steger
- % Copyright (C) 1993 Andreas Scherer
- @z
- ------------------------------------------------------------------------------
- @x l.30
- \def\title{CWEAVE (Version 3.0)}
- @y
- \def\title{CWEAVE (Version 3.0 [p8d])}
- @z
- ------------------------------------------------------------------------------
- @x l.34
- \centerline{(Version 3.0)}
- @y
- \centerline{(Version 3.0 [p8d])}
- @z
- ------------------------------------------------------------------------------
- @x l.40
- Copyright \copyright\ 1987, 1990, 1993 Silvio Levy and Donald E. Knuth
- @y
- Copyright \copyright\ 1987, 1990, 1993 Silvio Levy and Donald E. Knuth
- \smallskip\noindent
- Copyright \copyright\ 1991, 1992, 1993 Hans-Hermann Bode
- \smallskip\noindent
- Copyright \copyright\ 1991, 1993 Carsten Steger
- \smallskip\noindent
- Copyright \copyright\ 1993 Andreas Scherer
- @z
- ------------------------------------------------------------------------------
- Activate this, if only the changed modules should be printed.
- x l.51
- \let\maybe=\iftrue
- y
- \let\maybe=\iffalse
- z
- ------------------------------------------------------------------------------
- @x l.54
- This is the \.{CWEAVE} program by Silvio Levy and Donald E. Knuth,
- based on \.{WEAVE} by Knuth.
- @y
- This is the \.{CWEAVE} program by Silvio Levy and Donald E. Knuth,
- based on \.{WEAVE} by Knuth, with {\mc ANSI-C} conforming changes
- and {\mc TURBO}-\CPLUSPLUS/ implementation made by Hans-Hermann Bode.
- Use of German macros and {\mc SAS/C~6.0} implementation made by Andreas
- Scherer based on ideas by Carsten Steger.
- @z
- ------------------------------------------------------------------------------
- @x l.64
- @d banner "This is CWEAVE (Version 3.0)\n"
- @y
- @d banner "This is CWEAVE (Version 3.0 [p8d])\n"
- @z
- ------------------------------------------------------------------------------
- @x l.78
- @<Predecl...@>=
- extern int strlen(); /* length of string */
- extern int strcmp(); /* compare strings lexicographically */
- extern char* strcpy(); /* copy one string to another */
- extern int strncmp(); /* compare up to $n$ string characters */
- extern char* strncpy(); /* copy up to $n$ string characters */
- @y
- @<Include files@>=
- #include <string.h>
- @z
- ------------------------------------------------------------------------------
- @x l.94
- int main (ac, av)
- int ac; /* argument count */
- char **av; /* argument values */
- @y
- int main (int ac, char **av)
- /* argument count and argument values */
- @z
- ------------------------------------------------------------------------------
- @x l.139
- @i common.h
- @y
- @i common-p.h
- @z
- ------------------------------------------------------------------------------
- @x l.223
- typedef struct xref_info {
- sixteen_bits num; /* section number plus zero or |def_flag| */
- struct xref_info *xlink; /* pointer to the previous cross-reference */
- } xref_info;
- typedef xref_info *xref_pointer;
- @y
- typedef struct xref_info {
- sixteen_bits num; /* section number plus zero or |def_flag| */
- struct xref_info HUGE *xlink; /* pointer to the previous cross-reference */
- } xref_info;
- typedef xref_info HUGE *xref_pointer;
- @z
- ------------------------------------------------------------------------------
- @x l.230
- xref_info xmem[max_refs]; /* contains cross-reference information */
- xref_pointer xmem_end = xmem+max_refs-1;
- @y
- #ifdef __TURBOC__
- xref_info HUGE *xmem; /* contains cross-reference information */
- xref_pointer xmem_end;
- #else
- xref_info xmem[max_refs]; /* contains cross-reference information */
- xref_pointer xmem_end = xmem+max_refs-1;
- #endif
- @z
- ------------------------------------------------------------------------------
- @x l.244
- xref_ptr=xmem; name_dir->xref=(char*)xmem; xref_switch=0; section_xref_switch=0;
- @y
- #ifdef __TURBOC__
- xmem=allocsafe(max_refs,sizeof(*xmem));
- xmem_end=xmem+max_refs-1;
- #endif
- xref_ptr=xmem; name_dir->xref=(char HUGE*)xmem; xref_switch=0; section_xref_switch=0;
- @z
- ------------------------------------------------------------------------------
- @x l.262
- @c
- void
- new_xref(p)
- name_pointer p;
- @y
- @c static void new_xref(name_pointer p)
- @z
- ------------------------------------------------------------------------------
- @x l.279
- append_xref(m); xref_ptr->xlink=q; p->xref=(char*)xref_ptr;
- @y
- append_xref(m); xref_ptr->xlink=q; p->xref=(char HUGE*)xref_ptr;
- @z
- ------------------------------------------------------------------------------
- @x l.293
- @c
- void
- new_section_xref(p)
- name_pointer p;
- @y
- @c static void new_section_xref(name_pointer p)
- @z
- ------------------------------------------------------------------------------
- @x l.306
- if (r==xmem) p->xref=(char*)xref_ptr;
- @y
- if (r==xmem) p->xref=(char HUGE*)xref_ptr;
- @z
- ------------------------------------------------------------------------------
- @x l.313
- @c
- void
- set_file_flag(p)
- name_pointer p;
- @y
- @c static void set_file_flag(name_pointer p)
- @z
- ------------------------------------------------------------------------------
- @x l.323
- p->xref = (char *)xref_ptr;
- @y
- p->xref = (char HUGE*)xref_ptr;
- @z
- ------------------------------------------------------------------------------
- @x l.334
- typedef token *token_pointer;
- typedef token_pointer *text_pointer;
- @y
- typedef token HUGE *token_pointer;
- typedef token_pointer HUGE *text_pointer;
- @z
- ------------------------------------------------------------------------------
- @x l.343
- token tok_mem[max_toks]; /* tokens */
- token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
- @y
- #ifdef __TURBOC__
- token HUGE *tok_mem; /* tokens */
- token_pointer tok_mem_end; /* end of |tok_mem| */
- #else
- token tok_mem[max_toks]; /* tokens */
- token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
- #endif
- @z
- ------------------------------------------------------------------------------
- @x l.353
- tok_ptr=tok_mem+1; text_ptr=tok_start+1; tok_start[0]=tok_mem+1;
- @y
- #ifdef __TURBOC__
- tok_mem=allocsafe(max_toks,sizeof(*tok_mem));
- tok_mem_end=tok_mem+max_toks-1;
- #endif
- tok_ptr=tok_mem+1; text_ptr=tok_start+1; tok_start[0]=tok_mem+1;
- @z
- ------------------------------------------------------------------------------
- @x l.359
- @c
- int names_match(p,first,l,t)
- name_pointer p; /* points to the proposed match */
- char *first; /* position of first character of string */
- int l; /* length of identifier */
- eight_bits t; /* desired ilk */
- @y
- @c int names_match(name_pointer p,char *first,int l,eight_bits t)
- /* |p|: points to the proposed match */
- /* |first|: position of first character of string */
- /* |l|: length of identifier */
- /* |t|: desired |ilk| */
- @z
- ------------------------------------------------------------------------------
- @x l.342
- return !strncmp(first,p->byte_start,l);
- @y
- return( !strncmp(first,p->byte_start,l) );
- @z
- ------------------------------------------------------------------------------
- @x l.370
- void
- init_p(p,t)
- name_pointer p;
- eight_bits t;
- @y
- void init_p(name_pointer p,eight_bits t)
- @z
- ------------------------------------------------------------------------------
- @x l.375
- p->ilk=t; p->xref=(char*)xmem;
- @y
- p->ilk=t; p->xref=(char HUGE*)xmem;
- @z
- ------------------------------------------------------------------------------
- @x l.378
- void
- init_node(p)
- name_pointer p;
- @y
- void init_node(name_pointer p)
- @z
- ------------------------------------------------------------------------------
- @x l.382
- p->xref=(char*)xmem;
- @y
- p->xref=(char HUGE*)xmem;
- @z
- ------------------------------------------------------------------------------
- We append AMIGA specific keywords from Commodore and {\mc SAS}~Institute.
- @x l.467
- id_lookup("while",NULL,for_like);
- @y
- id_lookup("while",NULL,for_like);
-
- #ifdef _AMIGA
- if(use_amiga_keywords) {
- @<Keywords specific to {\mc SAS/C 6.0}@>@;
- @<Registers of the Amiga@>@;
- @<Keywords by Commodore@>@;
- }
- #endif
- @z
- ------------------------------------------------------------------------------
- @x l.562
- @<Predec...@>=
- void skip_limbo();
-
- @ @c
- void
- skip_limbo() {
- @y
- @<Predec...@>=
- static void skip_limbo(void);
-
- @ @c
- static void skip_limbo(void) {
- @z
- ------------------------------------------------------------------------------
- @x l.587
- @c
- unsigned
- skip_TeX() /* skip past pure \TEX/ code */
- @y
- @c static unsigned skip_TeX(void) /* skip past pure \TEX/ code */
- @z
- ------------------------------------------------------------------------------
- @x l.655
- @<Predecl...@>=
- eight_bits get_next();
-
- @ @c
- eight_bits
- get_next() /* produces the next input token */
- @y
- @<Predecl...@>=
- static eight_bits get_next(void);
-
- @ @c
- static eight_bits get_next(void) /* produces the next input token */
- @z
- ------------------------------------------------------------------------------
- Macro invocation may have multiple side effects.
- @x l.798
- *id_loc++='$'; *id_loc++=toupper(*loc++);
- @y
- *id_loc++='$'; *id_loc++=toupper(*loc); *loc++;
- @z
- ------------------------------------------------------------------------------
- @x l.933
- @<Predecl...@>=
- void skip_restricted();
-
- @ @c
- void
- skip_restricted()
- @y
- @<Predecl...@>=
- void skip_restricted(void);
-
- @ @c
- void skip_restricted(void)
- @z
- ------------------------------------------------------------------------------
- @x l.983
- @ The overall processing strategy in phase one has the following
- straightforward outline.
-
- @<Predecl...@>=
- void phase_one();
-
- @ @c
- void
- phase_one() {
- @y
- @ The overall processing strategy in phase one has the following
- straightforward outline.
-
- @<Predecl...@>=
- static void phase_one(void);
-
- @ @c
- static void phase_one(void) {
- @z
- ------------------------------------------------------------------------------
- @x l.1037
- @<Predecl...@>=
- void C_xref();
-
- @ @c
- void
- C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
- eight_bits spec_ctrl;
- @y
- @<Predecl...@>=
- static void C_xref(eight_bits);
-
- @ @c
- static void C_xref( eight_bits spec_ctrl )
- /* makes cross-references for \CEE/ identifiers */
- @z
- ------------------------------------------------------------------------------
- @x l.1065
- @<Predecl...@>=
- void outer_xref();
-
- @ @c
- void
- outer_xref() /* extension of |C_xref| */
- @y
- @<Predecl...@>=
- static void outer_xref(void);
-
- @ @c
- static void outer_xref(void) /* extension of |C_xref| */
- @z
- ------------------------------------------------------------------------------
- @x l.1168
- else lhs->xref=(char*)q->xlink;
- @y
- else lhs->xref=(char HUGE*)q->xlink;
- @z
- ------------------------------------------------------------------------------
- @x l.1226
- @<Predecl...@>=
- void section_check();
-
- @ @c
- void
- section_check(p)
- name_pointer p; /* print anomalies in subtree |p| */
- @y
- @<Predecl...@>=
- static void section_check(name_pointer);
-
- @ @c
- static void section_check(name_pointer p)
- /* print anomalies in subtree |p| */
- @z
- ------------------------------------------------------------------------------
- @x l.1283
- void
- flush_buffer(b,per_cent,carryover)
- char *b; /* outputs from |out_buf+1| to |b|,where |b<=out_ptr| */
- boolean per_cent,carryover;
- @y
- static void flush_buffer(char *b,boolean per_cent,boolean carryover)
- /* outputs from |out_buf+1| to |b|, where |b<=out_ptr| */
- @z
- ------------------------------------------------------------------------------
- @x l.1312
- void
- finish_line() /* do this at the end of a line */
- @y
- static void finish_line(void) /* do this at the end of a line */
- @z
- ------------------------------------------------------------------------------
- % Additionally to the AMIGA keywords there is also a German version of
- % the TeX macros called gcwebmac.tex. You may include these macros by
- % setting the `+g' command line switch.
- @x l.1327
- `\.{\\input cwebmac}'.
-
- @<Set init...@>=
- out_ptr=out_buf+1; out_line=1; active_file=tex_file;
- *out_ptr='c'; tex_printf("\\input cwebma");
- @y
- `\.{\\input ccwebmac}' or `\.{\\input gcwebmac}' if the `\.{+g}' option was
- set.
-
- @<Set init...@>=
- if(use_german_macros) {
- out_ptr=out_buf+1; out_line=1; active_file=tex_file;
- *out_ptr='c'; tex_printf("\\input gcwebma");
- }
- else {
- out_ptr=out_buf+1; out_line=1; active_file=tex_file;
- *out_ptr='c'; tex_printf("\\input ccwebma");
- }
- @z
- ------------------------------------------------------------------------------
- @x l.1344
- void
- out_str(s) /* output characters from |s| to end of string */
- char *s;
- @y
- static void out_str(char*s) /* output characters from |s| to end of string */
- @z
- ------------------------------------------------------------------------------
- @x l.1362
- @<Predecl...@>=
- void break_out();
-
- @ @c
- void
- break_out() /* finds a way to break the output line */
- @y
- @<Predecl...@>=
- static void break_out(void);
-
- @ @c static void break_out(void) /* finds a way to break the output line */
- @z
- ------------------------------------------------------------------------------
- @x l.1401
- void
- out_section(n)
- sixteen_bits n;
- @y
- static void out_section(sixteen_bits n)
- @z
- ------------------------------------------------------------------------------
- @x l.1415
- void
- out_name(p)
- name_pointer p;
- {
- char *k, *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */
- @y
- static void out_name(name_pointer p)
- {
- char HUGE *k;
- char HUGE *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */
- @z
- ------------------------------------------------------------------------------
- @x l.1442
- void
- copy_limbo()
- @y
- static void copy_limbo(void)
- @z
- ------------------------------------------------------------------------------
- @x l.1477
- eight_bits
- copy_TeX()
- @y
- static eight_bits copy_TeX(void)
- @z
- ------------------------------------------------------------------------------
- @x l.1505
- @<Predec...@>=
- int copy_comment();
-
- @ @c
- int copy_comment(is_long_comment,bal) /* copies \TEX/ code in comments */
- boolean is_long_comment; /* is this a traditional \CEE/ comment? */
- int bal; /* brace balance */
- @y
- @c static copy_comment(boolean is_long_comment,int bal)
- /* copies \TeX\ code in comments */
- /* |is_long_comment|: is this a traditional \CEE/ comment? */
- /* |bal|: brace balance */
- @z
- ------------------------------------------------------------------------------
- @x l.1731
- void
- print_cat(c) /* symbolic printout of a category */
- eight_bits c;
- @y
- static void print_cat(eight_bits c) /* symbolic printout of a category */
- @z
- ------------------------------------------------------------------------------
- @x l.1974
- @i prod.w
- @y
- @i prod-p.w
- @z
- ------------------------------------------------------------------------------
- The function |print_text| is never called in CWEAVE.
- @x l.2059
- void
- print_text(p) /* prints a token list for debugging; not used in |main| */
- text_pointer p;
- @y
- static void print_text(text_pointer p)
- /* prints a token list for debugging; not used in |main| */
- @z
- ------------------------------------------------------------------------------
- @x l.2184
- @ @c
- void
- app_str(s)
- char *s;
- @y
- @ @c static void app_str(char *s)
- @z
- ------------------------------------------------------------------------------
- @x l.2191
- void
- big_app(a)
- token a;
- @y
- static void big_app(token a)
- @z
- ------------------------------------------------------------------------------
- @x l.2208
- void
- big_app1(a)
- scrap_pointer a;
- @y
- static void big_app1(scrap_pointer a)
- @z
- ------------------------------------------------------------------------------
- @x l.2309
- token_pointer
- find_first_ident(p)
- text_pointer p;
- @y
- static token_pointer find_first_ident(text_pointer p)
- @z
- ------------------------------------------------------------------------------
- @x l.2336
- void
- make_reserved(p) /* make the first identifier in |p->trans| like |int| */
- scrap_pointer p;
- @y
- static void make_reserved(scrap_pointer p)
- /* make the first identifier in |p->trans| like |int| */
- @z
- ------------------------------------------------------------------------------
- @x l.2367
- void
- make_underlined(p)
- /* underline the entry for the first identifier in |p->trans| */
- scrap_pointer p;
- @y
- static void make_underlined(scrap_pointer p)
- /* underline the entry for the first identifier in |p->trans| */
- @z
- ------------------------------------------------------------------------------
- @x l.2384
- @<Predecl...@>=
- void underline_xref();
-
- @ @c
- void
- underline_xref(p)
- name_pointer p;
- @y
- @<Predecl...@>=
- static void underline_xref(name_pointer);
-
- @ @c
- static void underline_xref(name_pointer p)
- @z
- ------------------------------------------------------------------------------
- @x l.2420
- p->xref=(char*)xref_ptr;
- @y
- p->xref=(char HUGE*)xref_ptr;
- @z
- ------------------------------------------------------------------------------
- CWeave indents declarations after old-style function definitions.
- That's just awful! Make this better looking! You won't see the effect of
- this change if you use the ANSI-style function definitions.
- @x l.2128
- @<Cases for |exp|@>=
- if (cat1==lbrace || cat1==int_like || cat1==decl) {
- make_underlined(pp); big_app1(pp); big_app(indent); app(indent);
- reduce(pp,1,fn_decl,0,1);
- }
- @y
- @<Cases for |exp|@>=
- if(cat1==lbrace || cat1==int_like || cat1==decl) {
- make_underlined(pp); big_app1(pp);
- if (indent_param_decl) {
- big_app(indent); app(indent);
- }
- reduce(pp,1,fn_decl,0,1);
- }
- @z
- ----------------------------------------------------------------------
- The most important change on indentation.
- @x l.2534
- @ @<Cases for |decl_head|@>=
- if (cat1==comma) {
- big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33);
- }
- else if (cat1==unorbinop) {
- big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}');
- reduce(pp,2,decl_head,-1,34);
- }
- else if (cat1==exp && cat2!=lpar && cat2!=exp) {
- make_underlined(pp+1); squash(pp,2,decl_head,-1,35);
- }
- else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma ||
- cat3==semi || cat3==rpar))
- squash(pp,3,decl_head,-1,36);
- else if (cat1==cast) squash(pp,2,decl_head,-1,37);
- else if (cat1==lbrace || (cat1==int_like&&cat2!=colcol) || cat1==decl) {
- big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,38);
- }
- else if (cat1==semi) squash(pp,2,decl,-1,39);
- @y
- @ @<Cases for |decl_head|@>=
- if (cat1==comma) {
- big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33);
- }
- else if (cat1==unorbinop) {
- big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}');
- reduce(pp,2,decl_head,-1,34);
- }
- else if (cat1==exp && cat2!=lpar && cat2!=exp) {
- make_underlined(pp+1); squash(pp,2,decl_head,-1,35);
- }
- else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma ||
- cat3==semi || cat3==rpar))
- squash(pp,3,decl_head,-1,36);
- else if (cat1==cast) squash(pp,2,decl_head,-1,37);
- else if (cat1==lbrace || (cat1==int_like&&cat2!=colcol) || cat1==decl) {
- big_app1(pp);
- if (indent_param_decl) {
- big_app(indent); app(indent);
- }
- reduce(pp,1,fn_decl,0,38);
- }
- else if (cat1==semi) squash(pp,2,decl,-1,39);
- @z
- ------------------------------------------------------------------------------
- Another change on indentation.
- @x l.2605
- @ @<Cases for |fn_decl|@>=
- if (cat1==decl) {
- big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51);
- }
- else if (cat1==stmt) {
- big_app1(pp); app(outdent); app(outdent); big_app(force);
- big_app1(pp+1); reduce(pp,2,function,-1,52);
- }
- @y
- @ @<Cases for |fn_decl|@>=
- if (cat1==decl) {
- big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51);
- }
- else if (cat1==stmt) {
- big_app1(pp);
- if (indent_param_decl) {
- app(outdent); app(outdent);
- }
- big_app(force);
- big_app1(pp+1); reduce(pp,2,function,-1,52);
- }
- @z
- ----------------------------------------------------------------------
- @x l.2863
- void
- reduce(j,k,c,d,n)
- scrap_pointer j;
- eight_bits c;
- short k, d, n;
- @y
- static void reduce(scrap_pointer j, short k, eight_bits c, short d, short n)
- @z
- ------------------------------------------------------------------------------
- @x l.2893
- void
- squash(j,k,c,d,n)
- scrap_pointer j;
- eight_bits c;
- short k, d, n;
- @y
- static void squash(scrap_pointer j, short k, eight_bits c, short d, short n)
- @z
- ------------------------------------------------------------------------------
- @x l.2989
- text_pointer
- translate() /* converts a sequence of scraps */
- @y
- static text_pointer translate(void) /* converts a sequence of scraps */
- @z
- ------------------------------------------------------------------------------
- @x l.3054
- void
- C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */
- eight_bits spec_ctrl;
- @y
- static void C_parse(eight_bits spec_ctrl)
- /* creates scraps from \CEE/ tokens */
- @z
- ------------------------------------------------------------------------------
- @x l.3124
- @t\4@> @<Cases involving nonstandard characters@>@;
- @y
- @#@<Cases involving nonstandard characters@>@;@#
- @z
- ------------------------------------------------------------------------------
- @x l.3273
- @<Predec...@>=
- void app_cur_id();
-
- @ @c
- void
- app_cur_id(scrapping)
- boolean scrapping; /* are we making this into a scrap? */
- @y
- @<Predec...@>=
- void app_cur_id(boolean);
-
- @ @c
- void app_cur_id(boolean scrapping) /* are we making this into a scrap? */
- @z
- ------------------------------------------------------------------------------
- @x l.3298
- text_pointer
- C_translate()
- @y
- static text_pointer C_translate(void)
- @z
- ------------------------------------------------------------------------------
- @x l.3320
- void
- outer_parse() /* makes scraps from \CEE/ tokens and comments */
- @y
- static void outer_parse(void) /* makes scraps from \CEE/ tokens and comments */
- @z
- ------------------------------------------------------------------------------
- @x l.3424
- void
- push_level(p) /* suspends the current level */
- text_pointer p;
- @y
- static void push_level(text_pointer p) /* suspends the current level */
- @z
- ------------------------------------------------------------------------------
- @x l.3444
- void
- pop_level()
- @y
- static void pop_level(void)
- @z
- ------------------------------------------------------------------------------
- @x l.3466
- eight_bits
- get_output() /* returns the next token of output */
- @y
- static eight_bits get_output(void) /* returns the next token of output */
- @z
- ------------------------------------------------------------------------------
- BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG
- This one was sooooo terrible, I really have to write the story down. When
- I received CWeb version 2.8 yesterday, I immediately started to implement
- all changes from CWeb version 2.7, patch level 6, modification level c.
- After a few hours, CTangle 2.8 [p7] worked perfectly well, also the complete
- ./examples directory was up to date, but there were severe problems with the
- newly compiled CWeave 2.8 [p7]: *every* section reference came out as a
- non-ASCII control character, instead of a string. After locating all
- changes, I finally got hold of the origin: line 2958 of CWEAVE.W 2.8 was
- mistakenly modified by the changefile CWEAVE-P.CH 2.7 [p6c], so that
- instead of `section_code', `(eight_bits)section_name' was returned. As
- all return codes are globally defined, I eliminate the casts to `eight_bits',
- only for the variable `a' is a change necessary.
- @x l.2966
- return(a);
- @y
- return((eight_bits)a);
- @z
- ------------------------------------------------------------------------------
- @x l.3508
- void
- output_C() /* outputs the current token list */
- @y
- static void output_C(void) /* outputs the current token list */
- @z
- ------------------------------------------------------------------------------
- @x l.3528
- @<Predecl...@>=
- void make_output();
-
- @ @c
- void
- make_output() /* outputs the equivalents of tokens */
- @y
- @<Predecl...@>=
- static void make_output(void);
-
- @ @c
- static void make_output(void) /* outputs the equivalents of tokens */
- @z
- ------------------------------------------------------------------------------
- @x l.3538
- char *k, *k_limit; /* indices into |byte_mem| */
- @y
- char HUGE *k;
- char HUGE *k_limit; /* indices into |byte_mem| */
- @z
- ------------------------------------------------------------------------------
- We need a huge pointer here instead of j; k seems a good choice, since it is
- declared as index into byte_mem anyhow.
- @x l.3584
- for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++)
- out(isxalpha(*j)? 'x':*j);
- @y
- #ifdef __TURBOC__
- for (k=cur_name->byte_start;k<(cur_name+1)->byte_start;k++)
- out(isxalpha(*k)? 'x':*k);
- #else
- for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++)
- out(isxalpha(*j)? 'x':*j);
- #endif /* |__TURBOC__| */
- @z
- ------------------------------------------------------------------------------
- @x
- for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++)
- if (islower(*j)) { /* not entirely uppercase */
- @y
- #ifdef __TURBOC__
- for (k=cur_name->byte_start;k<(cur_name+1)->byte_start;k++)
- if (islower(*k)) { /* not entirely uppercase */
- #else
- for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++)
- if (islower(*j)) { /* not entirely uppercase */
- #endif /* |__TURBOC__| */
- @z
- ------------------------------------------------------------------------------
- @x l.3786
- @<Predecl...@>=
- void phase_two();
-
- @ @c
- void
- phase_two() {
- @y
- @<Predecl...@>=
- static void phase_two(void);
-
- @ @c
- static void phase_two(void) {
- @z
- ------------------------------------------------------------------------------
- @x l.3909
- @<Predecl...@>=
- void finish_C();
-
- @ @c
- void
- finish_C(visible) /* finishes a definition or a \CEE/ part */
- boolean visible; /* nonzero if we should produce \TEX/ output */
- @y
- @<Predecl...@>=
- static void finish_C(boolean);
-
- @ @c
- static void finish_C(boolean visible) /* finishes a definition or a \Cee\ part */
- /* |visible|: nonzero if we should produce \TeX\ output */
- @z
- ------------------------------------------------------------------------------
- @x l.4080
- @<Predecl...@>=
- void footnote();
-
- @ @c
- void
- footnote(flag) /* outputs section cross-references */
- sixteen_bits flag;
- @y
- @<Predecl...@>=
- static void footnote(sixteen_bits);
-
- @ @c
- static void footnote(sixteen_bits flag) /* outputs section cross-references */
- @z
- ------------------------------------------------------------------------------
- @x l.4129
- @<Predecl...@>=
- void phase_three();
-
- @ @c
- void
- phase_three() {
- @y
- @<Predecl...@>=
- static void phase_three(void);
-
- @ @c
- static void phase_three(void) {
- @z
- ------------------------------------------------------------------------------
- @x l.4221
- if (cur_name->xref!=(char*)xmem) {
- @y
- if (cur_name->xref!=(char HUGE*)xmem) {
- @z
- ------------------------------------------------------------------------------
- @x l.4251
- char *cur_byte; /* index into |byte_mem| */
- @y
- char HUGE *cur_byte; /* index into |byte_mem| */
- @z
- ------------------------------------------------------------------------------
- @x l.4294
- @<Predecl...@>=
- void unbucket();
-
- @ @c
- void
- unbucket(d) /* empties buckets having depth |d| */
- eight_bits d;
- @y
- @<Predecl...@>=
- static void unbucket(eight_bits);
-
- @ @c
- static void unbucket(eight_bits d) /* empties buckets having depth |d| */
- @z
- ------------------------------------------------------------------------------
- @x l.4355
- else {char *j;
- @y
- else {char HUGE *j;
- @z
- ------------------------------------------------------------------------------
- @x l.4370
- case custom: case quoted: {char *j; out_str("$\\");
- @y
- case custom: case quoted: {char HUGE *j; out_str("$\\");
- @z
- ------------------------------------------------------------------------------
- @x l.4414
- @<Predecl...@>=
- void section_print();
-
- @ @c
- void
- section_print(p) /* print all section names in subtree |p| */
- name_pointer p;
- @y
- @<Predecl...@>=
- static void section_print(name_pointer);
-
- @ @c
- static void section_print(name_pointer p) /* print all section names in subtree |p| */
- @z
- ------------------------------------------------------------------------------
- @x l.4440
- void
- print_stats() {
- @y
- void print_stats(void) {
- @z
- ------------------------------------------------------------------------------
- @x l.3817
- printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
- printf("%ld cross-references (out of %ld)\n",
- (long)(xref_ptr-xmem),(long)max_refs);
- printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
- printf("Parsing:\n");
- printf("%ld scraps (out of %ld)\n",
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
- printf("%ld texts (out of %ld)\n",
- (long)(max_text_ptr-tok_start),(long)max_texts);
- printf("%ld tokens (out of %ld)\n",
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
- printf("%ld levels (out of %ld)\n",
- (long)(max_stack_ptr-stack),(long)stack_size);
- printf("Sorting:\n");
- printf("%ld levels (out of %ld)\n",
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
- @y
- #ifdef __TURBOC__
- printf("%ld names (out of %ld)\n",name_ptr-name_dir,(long)max_names);
- printf("%ld cross-references (out of %ld)\n",xref_ptr-xmem,(long)max_refs);
- printf("%ld bytes (out of %ld)\n",byte_ptr-byte_mem,(long)max_bytes);
- printf("Parsing:\n");
- printf("%ld scraps (out of %ld)\n",max_scr_ptr-scrap_info,(long)max_scraps);
- printf("%ld texts (out of %ld)\n",max_text_ptr-tok_start,(long)max_texts);
- printf("%ld tokens (out of %ld)\n",max_tok_ptr-tok_mem,(long)max_toks);
- printf("%ld levels (out of %ld)\n",max_stack_ptr-stack,(long)stack_size);
- printf("Sorting:\n");
- printf("%ld levels (out of %ld)\n",max_sort_ptr-scrap_info,(long)max_scraps);
- #else
- printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
- printf("%ld cross-references (out of %ld)\n",
- (long)(xref_ptr-xmem),(long)max_refs);
- printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
- printf("Parsing:\n");
- printf("%ld scraps (out of %ld)\n",
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
- printf("%ld texts (out of %ld)\n",
- (long)(max_text_ptr-tok_start),(long)max_texts);
- printf("%ld tokens (out of %ld)\n",
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
- printf("%ld levels (out of %ld)\n",
- (long)(max_stack_ptr-stack),(long)stack_size);
- printf("Sorting:\n");
- printf("%ld levels (out of %ld)\n",
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
- #endif
- @z
- ------------------------------------------------------------------------------
- @x l.4464
- @** Index.
- @y
- @* Function declarations. Here are declarations---conforming to
- {\mc ANSI~C}---of all functions in this code, as far as they are
- not already in |"common.h"|.
-
- @<Predecl...@>=
- static void new_xref(name_pointer);@/
- static void new_section_xref(name_pointer);@/
- static void set_file_flag(name_pointer);@/
- static void skip_limbo(void);@/
- static unsigned skip_TeX(void);@/
- static void flush_buffer(char *,boolean,boolean);@/
- static void finish_line(void);@/
- #ifdef DEAD_CODE
- static void out_str_del(char *,char *);@/
- #endif
- static void out_str(char *);@/
- static void out_section(sixteen_bits);@/
- static void out_name(name_pointer);@/
- static void copy_limbo(void);@/
- static eight_bits copy_TeX(void);@/
- static int copy_comment(boolean,int);@/
- static void app_str(char *);@/
- static void big_app(token);@/
- static void big_app1(scrap_pointer);@/
- static token_pointer find_first_ident(text_pointer);@/
- static void make_reserved(scrap_pointer);@/
- static void make_underlined(scrap_pointer);@/
- static void reduce(scrap_pointer,short,eight_bits,short,short);@/
- static void squash(scrap_pointer,short,eight_bits,short,short);@/
- static text_pointer translate(void);@/
- static void C_parse(eight_bits);@/
- static text_pointer C_translate(void);@/
- static void outer_parse(void);@/
- static void push_level(text_pointer);@/
- static void pop_level(void);@/
- static eight_bits get_output(void);@/
- static void output_C(void);@/
- static void print_cat(eight_bits);@/
- static void print_text(text_pointer p);@/
-
- @ Finally, we include \.{string.h} for |strcpy|, |strncpy|, and |strncmp|.
-
- @<Include...@>=
- #include <string.h>
-
- @ In accordance to the philosophy of \.{CWEB} that additional modules to
- standard programs should not interfere with the module numbering, the new
- patch level introduces Commodore and {\mc SAS} specific key words at the
- end of the changes.
-
- @<Keywords specific to {\mc SAS/C 6.0}@>=
- id_lookup("__aligned",NULL,int_like);@+
- id_lookup("__asm",NULL,int_like);
- id_lookup("__chip",NULL,int_like);@+
- id_lookup("__far",NULL,int_like);
- id_lookup("__inline",NULL,int_like);@+
- id_lookup("__interrupt",NULL,int_like);
- id_lookup("__near",NULL,int_like);@+
- id_lookup("__regargs",NULL,int_like);
- id_lookup("__saveds",NULL,int_like);@+
- id_lookup("__stackext",NULL,int_like);
- id_lookup("__stdargs",NULL,int_like);
-
- @ @<Registers of the Amiga@>=
- id_lookup("__d0",NULL,int_like);@+
- id_lookup("__d1",NULL,int_like);
- id_lookup("__d2",NULL,int_like);@+
- id_lookup("__d3",NULL,int_like);
- id_lookup("__d4",NULL,int_like);@+
- id_lookup("__d5",NULL,int_like);
- id_lookup("__d6",NULL,int_like);@+
- id_lookup("__d7",NULL,int_like);
- id_lookup("__a0",NULL,int_like);@+
- id_lookup("__a1",NULL,int_like);
- id_lookup("__a2",NULL,int_like);@+
- id_lookup("__a3",NULL,int_like);
- id_lookup("__a4",NULL,int_like);@+
- id_lookup("__a5",NULL,int_like);
- id_lookup("__a6",NULL,int_like);@+
- id_lookup("__a7",NULL,int_like);
- id_lookup("__fp0",NULL,int_like);@+
- id_lookup("__fp1",NULL,int_like);
- id_lookup("__fp2",NULL,int_like);@+
- id_lookup("__fp3",NULL,int_like);
- id_lookup("__fp4",NULL,int_like);@+
- id_lookup("__fp5",NULL,int_like);
- id_lookup("__fp6",NULL,int_like);@+
- id_lookup("__fp7",NULL,int_like);
-
- @ @<Keywords by Commodore@>=
- id_lookup("GLOBAL",NULL,int_like);@+
- id_lookup("IMPORT",NULL,int_like);
- id_lookup("STATIC",NULL,int_like);@+
- id_lookup("REGISTER",NULL,int_like);
- id_lookup("VOID",NULL,int_like);@+
- id_lookup("APTR",NULL,int_like);
- id_lookup("LONG",NULL,int_like);@+
- id_lookup("ULONG",NULL,int_like);
- id_lookup("LONGBITS",NULL,int_like);@+
- id_lookup("WORD",NULL,int_like);
- id_lookup("UWORD",NULL,int_like);@+
- id_lookup("WORDBITS",NULL,int_like);
- id_lookup("BYTE",NULL,int_like);@+
- id_lookup("UBYTE",NULL,int_like);
- id_lookup("BYTEBITS",NULL,int_like);@+
- id_lookup("RPTR",NULL,int_like);
- id_lookup("STRPTR",NULL,int_like);@+
- id_lookup("SHORT",NULL,int_like);
- id_lookup("USHORT",NULL,int_like);@+
- id_lookup("COUNT",NULL,int_like);
- id_lookup("UCOUNT",NULL,int_like);@+
- id_lookup("CPTR",NULL,int_like);
- id_lookup("FLOAT",NULL,int_like);@+
- id_lookup("DOUBLE",NULL,int_like);
- id_lookup("BOOL",NULL,int_like);@+
- id_lookup("TEXT",NULL,int_like);
- id_lookup("BPTR",NULL,int_like);@+
- id_lookup("BSTR",NULL,int_like);
-
- id_lookup("byte",NULL,int_like);@+
- id_lookup("Class",NULL,int_like);
- id_lookup("ClassID",NULL,int_like);@+
- id_lookup("CxMsg",NULL,int_like);
- id_lookup("CxObj",NULL,int_like);@+
- id_lookup("dev_t",NULL,int_like);
- id_lookup("DIR",NULL,int_like);@+
- id_lookup("DisplayInfoHandle",NULL,int_like);
- id_lookup("ino_t",NULL,int_like);@+
- id_lookup("IX",NULL,int_like);
- id_lookup("Msg",NULL,int_like);@+
- id_lookup("Object",NULL,int_like);
- id_lookup("off_t",NULL,int_like);@+
- id_lookup("PFL",NULL,int_like);
- id_lookup("PLANEPTR",NULL,int_like);@+
- id_lookup("Tag",NULL,int_like);
- id_lookup("tPoint",NULL,int_like);@+
- id_lookup("ushort",NULL,int_like);
- id_lookup("u_char",NULL,int_like);@+
- id_lookup("u_int",NULL,int_like);
- id_lookup("u_long",NULL,int_like);@+
- id_lookup("u_short",NULL,int_like);
- id_lookup("WINDOW",NULL,int_like);
-
- @** Index.
- @z
- ------------------------------------------------------------------------------
-